vendors.bundle.js 773 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514
  1. (function() {
  2. var AjaxMonitor, Bar, DocumentMonitor, ElementMonitor, ElementTracker, EventLagMonitor, Evented, Events, NoTargetError, Pace, RequestIntercept, SOURCE_KEYS, Scaler, SocketRequestTracker, XHRRequestTracker, animation, avgAmplitude, bar, cancelAnimation, cancelAnimationFrame, defaultOptions, extend, extendNative, getFromDOM, getIntercept, handlePushState, ignoreStack, init, now, options, requestAnimationFrame, result, runAnimation, scalers, shouldIgnoreURL, shouldTrack, source, sources, uniScaler, _WebSocket, _XDomainRequest, _XMLHttpRequest, _i, _intercept, _len, _pushState, _ref, _ref1, _replaceState,
  3. __slice = [].slice,
  4. __hasProp = {}.hasOwnProperty,
  5. __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  6. __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
  7. defaultOptions = {
  8. catchupTime: 100,
  9. initialRate: .03,
  10. minTime: 250,
  11. ghostTime: 100,
  12. maxProgressPerFrame: 20,
  13. easeFactor: 1.25,
  14. startOnPageLoad: true,
  15. restartOnPushState: true,
  16. restartOnRequestAfter: 500,
  17. target: 'body',
  18. elements: {
  19. checkInterval: 100,
  20. selectors: ['body']
  21. },
  22. eventLag: {
  23. minSamples: 10,
  24. sampleCount: 3,
  25. lagThreshold: 3
  26. },
  27. ajax: {
  28. trackMethods: ['GET'],
  29. trackWebSockets: true,
  30. ignoreURLs: []
  31. }
  32. };
  33. now = function() {
  34. var _ref;
  35. return (_ref = typeof performance !== "undefined" && performance !== null ? typeof performance.now === "function" ? performance.now() : void 0 : void 0) != null ? _ref : +(new Date);
  36. };
  37. requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
  38. cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame;
  39. if (requestAnimationFrame == null) {
  40. requestAnimationFrame = function(fn) {
  41. return setTimeout(fn, 50);
  42. };
  43. cancelAnimationFrame = function(id) {
  44. return clearTimeout(id);
  45. };
  46. }
  47. runAnimation = function(fn) {
  48. var last, tick;
  49. last = now();
  50. tick = function() {
  51. var diff;
  52. diff = now() - last;
  53. if (diff >= 33) {
  54. last = now();
  55. return fn(diff, function() {
  56. return requestAnimationFrame(tick);
  57. });
  58. } else {
  59. return setTimeout(tick, 33 - diff);
  60. }
  61. };
  62. return tick();
  63. };
  64. result = function() {
  65. var args, key, obj;
  66. obj = arguments[0], key = arguments[1], args = 3 <= arguments.length ? __slice.call(arguments, 2) : [];
  67. if (typeof obj[key] === 'function') {
  68. return obj[key].apply(obj, args);
  69. } else {
  70. return obj[key];
  71. }
  72. };
  73. extend = function() {
  74. var key, out, source, sources, val, _i, _len;
  75. out = arguments[0], sources = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
  76. for (_i = 0, _len = sources.length; _i < _len; _i++) {
  77. source = sources[_i];
  78. if (source) {
  79. for (key in source) {
  80. if (!__hasProp.call(source, key)) continue;
  81. val = source[key];
  82. if ((out[key] != null) && typeof out[key] === 'object' && (val != null) && typeof val === 'object') {
  83. extend(out[key], val);
  84. } else {
  85. out[key] = val;
  86. }
  87. }
  88. }
  89. }
  90. return out;
  91. };
  92. avgAmplitude = function(arr) {
  93. var count, sum, v, _i, _len;
  94. sum = count = 0;
  95. for (_i = 0, _len = arr.length; _i < _len; _i++) {
  96. v = arr[_i];
  97. sum += Math.abs(v);
  98. count++;
  99. }
  100. return sum / count;
  101. };
  102. getFromDOM = function(key, json) {
  103. var data, e, el;
  104. if (key == null) {
  105. key = 'options';
  106. }
  107. if (json == null) {
  108. json = true;
  109. }
  110. el = document.querySelector("[data-pace-" + key + "]");
  111. if (!el) {
  112. return;
  113. }
  114. data = el.getAttribute("data-pace-" + key);
  115. if (!json) {
  116. return data;
  117. }
  118. try {
  119. return JSON.parse(data);
  120. } catch (_error) {
  121. e = _error;
  122. return typeof console !== "undefined" && console !== null ? console.error("Error parsing inline pace options", e) : void 0;
  123. }
  124. };
  125. Evented = (function() {
  126. function Evented() {}
  127. Evented.prototype.on = function(event, handler, ctx, once) {
  128. var _base;
  129. if (once == null) {
  130. once = false;
  131. }
  132. if (this.bindings == null) {
  133. this.bindings = {};
  134. }
  135. if ((_base = this.bindings)[event] == null) {
  136. _base[event] = [];
  137. }
  138. return this.bindings[event].push({
  139. handler: handler,
  140. ctx: ctx,
  141. once: once
  142. });
  143. };
  144. Evented.prototype.once = function(event, handler, ctx) {
  145. return this.on(event, handler, ctx, true);
  146. };
  147. Evented.prototype.off = function(event, handler) {
  148. var i, _ref, _results;
  149. if (((_ref = this.bindings) != null ? _ref[event] : void 0) == null) {
  150. return;
  151. }
  152. if (handler == null) {
  153. return delete this.bindings[event];
  154. } else {
  155. i = 0;
  156. _results = [];
  157. while (i < this.bindings[event].length) {
  158. if (this.bindings[event][i].handler === handler) {
  159. _results.push(this.bindings[event].splice(i, 1));
  160. } else {
  161. _results.push(i++);
  162. }
  163. }
  164. return _results;
  165. }
  166. };
  167. Evented.prototype.trigger = function() {
  168. var args, ctx, event, handler, i, once, _ref, _ref1, _results;
  169. event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
  170. if ((_ref = this.bindings) != null ? _ref[event] : void 0) {
  171. i = 0;
  172. _results = [];
  173. while (i < this.bindings[event].length) {
  174. _ref1 = this.bindings[event][i], handler = _ref1.handler, ctx = _ref1.ctx, once = _ref1.once;
  175. handler.apply(ctx != null ? ctx : this, args);
  176. if (once) {
  177. _results.push(this.bindings[event].splice(i, 1));
  178. } else {
  179. _results.push(i++);
  180. }
  181. }
  182. return _results;
  183. }
  184. };
  185. return Evented;
  186. })();
  187. Pace = window.Pace || {};
  188. window.Pace = Pace;
  189. extend(Pace, Evented.prototype);
  190. options = Pace.options = extend({}, defaultOptions, window.paceOptions, getFromDOM());
  191. _ref = ['ajax', 'document', 'eventLag', 'elements'];
  192. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  193. source = _ref[_i];
  194. if (options[source] === true) {
  195. options[source] = defaultOptions[source];
  196. }
  197. }
  198. NoTargetError = (function(_super) {
  199. __extends(NoTargetError, _super);
  200. function NoTargetError() {
  201. _ref1 = NoTargetError.__super__.constructor.apply(this, arguments);
  202. return _ref1;
  203. }
  204. return NoTargetError;
  205. })(Error);
  206. Bar = (function() {
  207. function Bar() {
  208. this.progress = 0;
  209. }
  210. Bar.prototype.getElement = function() {
  211. var targetElement;
  212. if (this.el == null) {
  213. targetElement = document.querySelector(options.target);
  214. if (!targetElement) {
  215. throw new NoTargetError;
  216. }
  217. this.el = document.createElement('div');
  218. this.el.className = "pace pace-active";
  219. document.body.className = document.body.className.replace(/pace-done/g, '');
  220. document.body.className += ' pace-running';
  221. this.el.innerHTML = '<div class="pace-progress">\n <div class="pace-progress-inner"></div>\n</div>\n<div class="pace-activity"></div>';
  222. if (targetElement.firstChild != null) {
  223. targetElement.insertBefore(this.el, targetElement.firstChild);
  224. } else {
  225. targetElement.appendChild(this.el);
  226. }
  227. }
  228. return this.el;
  229. };
  230. Bar.prototype.finish = function() {
  231. var el;
  232. el = this.getElement();
  233. el.className = el.className.replace('pace-active', '');
  234. el.className += ' pace-inactive';
  235. document.body.className = document.body.className.replace('pace-running', '');
  236. return document.body.className += ' pace-done';
  237. };
  238. Bar.prototype.update = function(prog) {
  239. this.progress = prog;
  240. return this.render();
  241. };
  242. Bar.prototype.destroy = function() {
  243. try {
  244. this.getElement().parentNode.removeChild(this.getElement());
  245. } catch (_error) {
  246. NoTargetError = _error;
  247. }
  248. return this.el = void 0;
  249. };
  250. Bar.prototype.render = function() {
  251. var el, key, progressStr, transform, _j, _len1, _ref2;
  252. if (document.querySelector(options.target) == null) {
  253. return false;
  254. }
  255. el = this.getElement();
  256. transform = "translate3d(" + this.progress + "%, 0, 0)";
  257. _ref2 = ['webkitTransform', 'msTransform', 'transform'];
  258. for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
  259. key = _ref2[_j];
  260. el.children[0].style[key] = transform;
  261. }
  262. if (!this.lastRenderedProgress || this.lastRenderedProgress | 0 !== this.progress | 0) {
  263. el.children[0].setAttribute('data-progress-text', "" + (this.progress | 0) + "%");
  264. if (this.progress >= 100) {
  265. progressStr = '99';
  266. } else {
  267. progressStr = this.progress < 10 ? "0" : "";
  268. progressStr += this.progress | 0;
  269. }
  270. el.children[0].setAttribute('data-progress', "" + progressStr);
  271. }
  272. return this.lastRenderedProgress = this.progress;
  273. };
  274. Bar.prototype.done = function() {
  275. return this.progress >= 100;
  276. };
  277. return Bar;
  278. })();
  279. Events = (function() {
  280. function Events() {
  281. this.bindings = {};
  282. }
  283. Events.prototype.trigger = function(name, val) {
  284. var binding, _j, _len1, _ref2, _results;
  285. if (this.bindings[name] != null) {
  286. _ref2 = this.bindings[name];
  287. _results = [];
  288. for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
  289. binding = _ref2[_j];
  290. _results.push(binding.call(this, val));
  291. }
  292. return _results;
  293. }
  294. };
  295. Events.prototype.on = function(name, fn) {
  296. var _base;
  297. if ((_base = this.bindings)[name] == null) {
  298. _base[name] = [];
  299. }
  300. return this.bindings[name].push(fn);
  301. };
  302. return Events;
  303. })();
  304. _XMLHttpRequest = window.XMLHttpRequest;
  305. _XDomainRequest = window.XDomainRequest;
  306. _WebSocket = window.WebSocket;
  307. extendNative = function(to, from) {
  308. var e, key, _results;
  309. _results = [];
  310. for (key in from.prototype) {
  311. try {
  312. if ((to[key] == null) && typeof from[key] !== 'function') {
  313. if (typeof Object.defineProperty === 'function') {
  314. _results.push(Object.defineProperty(to, key, {
  315. get: function() {
  316. return from.prototype[key];
  317. },
  318. configurable: true,
  319. enumerable: true
  320. }));
  321. } else {
  322. _results.push(to[key] = from.prototype[key]);
  323. }
  324. } else {
  325. _results.push(void 0);
  326. }
  327. } catch (_error) {
  328. e = _error;
  329. }
  330. }
  331. return _results;
  332. };
  333. ignoreStack = [];
  334. Pace.ignore = function() {
  335. var args, fn, ret;
  336. fn = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
  337. ignoreStack.unshift('ignore');
  338. ret = fn.apply(null, args);
  339. ignoreStack.shift();
  340. return ret;
  341. };
  342. Pace.track = function() {
  343. var args, fn, ret;
  344. fn = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
  345. ignoreStack.unshift('track');
  346. ret = fn.apply(null, args);
  347. ignoreStack.shift();
  348. return ret;
  349. };
  350. shouldTrack = function(method) {
  351. var _ref2;
  352. if (method == null) {
  353. method = 'GET';
  354. }
  355. if (ignoreStack[0] === 'track') {
  356. return 'force';
  357. }
  358. if (!ignoreStack.length && options.ajax) {
  359. if (method === 'socket' && options.ajax.trackWebSockets) {
  360. return true;
  361. } else if (_ref2 = method.toUpperCase(), __indexOf.call(options.ajax.trackMethods, _ref2) >= 0) {
  362. return true;
  363. }
  364. }
  365. return false;
  366. };
  367. RequestIntercept = (function(_super) {
  368. __extends(RequestIntercept, _super);
  369. function RequestIntercept() {
  370. var monitorXHR,
  371. _this = this;
  372. RequestIntercept.__super__.constructor.apply(this, arguments);
  373. monitorXHR = function(req) {
  374. var _open;
  375. _open = req.open;
  376. return req.open = function(type, url, async) {
  377. if (shouldTrack(type)) {
  378. _this.trigger('request', {
  379. type: type,
  380. url: url,
  381. request: req
  382. });
  383. }
  384. return _open.apply(req, arguments);
  385. };
  386. };
  387. window.XMLHttpRequest = function(flags) {
  388. var req;
  389. req = new _XMLHttpRequest(flags);
  390. monitorXHR(req);
  391. return req;
  392. };
  393. try {
  394. extendNative(window.XMLHttpRequest, _XMLHttpRequest);
  395. } catch (_error) {}
  396. if (_XDomainRequest != null) {
  397. window.XDomainRequest = function() {
  398. var req;
  399. req = new _XDomainRequest;
  400. monitorXHR(req);
  401. return req;
  402. };
  403. try {
  404. extendNative(window.XDomainRequest, _XDomainRequest);
  405. } catch (_error) {}
  406. }
  407. if ((_WebSocket != null) && options.ajax.trackWebSockets) {
  408. window.WebSocket = function(url, protocols) {
  409. var req;
  410. if (protocols != null) {
  411. req = new _WebSocket(url, protocols);
  412. } else {
  413. req = new _WebSocket(url);
  414. }
  415. if (shouldTrack('socket')) {
  416. _this.trigger('request', {
  417. type: 'socket',
  418. url: url,
  419. protocols: protocols,
  420. request: req
  421. });
  422. }
  423. return req;
  424. };
  425. try {
  426. extendNative(window.WebSocket, _WebSocket);
  427. } catch (_error) {}
  428. }
  429. }
  430. return RequestIntercept;
  431. })(Events);
  432. _intercept = null;
  433. getIntercept = function() {
  434. if (_intercept == null) {
  435. _intercept = new RequestIntercept;
  436. }
  437. return _intercept;
  438. };
  439. shouldIgnoreURL = function(url) {
  440. var pattern, _j, _len1, _ref2;
  441. _ref2 = options.ajax.ignoreURLs;
  442. for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
  443. pattern = _ref2[_j];
  444. if (typeof pattern === 'string') {
  445. if (url.indexOf(pattern) !== -1) {
  446. return true;
  447. }
  448. } else {
  449. if (pattern.test(url)) {
  450. return true;
  451. }
  452. }
  453. }
  454. return false;
  455. };
  456. getIntercept().on('request', function(_arg) {
  457. var after, args, request, type, url;
  458. type = _arg.type, request = _arg.request, url = _arg.url;
  459. if (shouldIgnoreURL(url)) {
  460. return;
  461. }
  462. if (!Pace.running && (options.restartOnRequestAfter !== false || shouldTrack(type) === 'force')) {
  463. args = arguments;
  464. after = options.restartOnRequestAfter || 0;
  465. if (typeof after === 'boolean') {
  466. after = 0;
  467. }
  468. return setTimeout(function() {
  469. var stillActive, _j, _len1, _ref2, _ref3, _results;
  470. if (type === 'socket') {
  471. stillActive = request.readyState < 2;
  472. } else {
  473. stillActive = (0 < (_ref2 = request.readyState) && _ref2 < 4);
  474. }
  475. if (stillActive) {
  476. Pace.restart();
  477. _ref3 = Pace.sources;
  478. _results = [];
  479. for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) {
  480. source = _ref3[_j];
  481. if (source instanceof AjaxMonitor) {
  482. source.watch.apply(source, args);
  483. break;
  484. } else {
  485. _results.push(void 0);
  486. }
  487. }
  488. return _results;
  489. }
  490. }, after);
  491. }
  492. });
  493. AjaxMonitor = (function() {
  494. function AjaxMonitor() {
  495. var _this = this;
  496. this.elements = [];
  497. getIntercept().on('request', function() {
  498. return _this.watch.apply(_this, arguments);
  499. });
  500. }
  501. AjaxMonitor.prototype.watch = function(_arg) {
  502. var request, tracker, type, url;
  503. type = _arg.type, request = _arg.request, url = _arg.url;
  504. if (shouldIgnoreURL(url)) {
  505. return;
  506. }
  507. if (type === 'socket') {
  508. tracker = new SocketRequestTracker(request);
  509. } else {
  510. tracker = new XHRRequestTracker(request);
  511. }
  512. return this.elements.push(tracker);
  513. };
  514. return AjaxMonitor;
  515. })();
  516. XHRRequestTracker = (function() {
  517. function XHRRequestTracker(request) {
  518. var event, size, _j, _len1, _onreadystatechange, _ref2,
  519. _this = this;
  520. this.progress = 0;
  521. if (window.ProgressEvent != null) {
  522. size = null;
  523. request.addEventListener('progress', function(evt) {
  524. if (evt.lengthComputable) {
  525. return _this.progress = 100 * evt.loaded / evt.total;
  526. } else {
  527. return _this.progress = _this.progress + (100 - _this.progress) / 2;
  528. }
  529. }, false);
  530. _ref2 = ['load', 'abort', 'timeout', 'error'];
  531. for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
  532. event = _ref2[_j];
  533. request.addEventListener(event, function() {
  534. return _this.progress = 100;
  535. }, false);
  536. }
  537. } else {
  538. _onreadystatechange = request.onreadystatechange;
  539. request.onreadystatechange = function() {
  540. var _ref3;
  541. if ((_ref3 = request.readyState) === 0 || _ref3 === 4) {
  542. _this.progress = 100;
  543. } else if (request.readyState === 3) {
  544. _this.progress = 50;
  545. }
  546. return typeof _onreadystatechange === "function" ? _onreadystatechange.apply(null, arguments) : void 0;
  547. };
  548. }
  549. }
  550. return XHRRequestTracker;
  551. })();
  552. SocketRequestTracker = (function() {
  553. function SocketRequestTracker(request) {
  554. var event, _j, _len1, _ref2,
  555. _this = this;
  556. this.progress = 0;
  557. _ref2 = ['error', 'open'];
  558. for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
  559. event = _ref2[_j];
  560. request.addEventListener(event, function() {
  561. return _this.progress = 100;
  562. }, false);
  563. }
  564. }
  565. return SocketRequestTracker;
  566. })();
  567. ElementMonitor = (function() {
  568. function ElementMonitor(options) {
  569. var selector, _j, _len1, _ref2;
  570. if (options == null) {
  571. options = {};
  572. }
  573. this.elements = [];
  574. if (options.selectors == null) {
  575. options.selectors = [];
  576. }
  577. _ref2 = options.selectors;
  578. for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
  579. selector = _ref2[_j];
  580. this.elements.push(new ElementTracker(selector));
  581. }
  582. }
  583. return ElementMonitor;
  584. })();
  585. ElementTracker = (function() {
  586. function ElementTracker(selector) {
  587. this.selector = selector;
  588. this.progress = 0;
  589. this.check();
  590. }
  591. ElementTracker.prototype.check = function() {
  592. var _this = this;
  593. if (document.querySelector(this.selector)) {
  594. return this.done();
  595. } else {
  596. return setTimeout((function() {
  597. return _this.check();
  598. }), options.elements.checkInterval);
  599. }
  600. };
  601. ElementTracker.prototype.done = function() {
  602. return this.progress = 100;
  603. };
  604. return ElementTracker;
  605. })();
  606. DocumentMonitor = (function() {
  607. DocumentMonitor.prototype.states = {
  608. loading: 0,
  609. interactive: 50,
  610. complete: 100
  611. };
  612. function DocumentMonitor() {
  613. var _onreadystatechange, _ref2,
  614. _this = this;
  615. this.progress = (_ref2 = this.states[document.readyState]) != null ? _ref2 : 100;
  616. _onreadystatechange = document.onreadystatechange;
  617. document.onreadystatechange = function() {
  618. if (_this.states[document.readyState] != null) {
  619. _this.progress = _this.states[document.readyState];
  620. }
  621. return typeof _onreadystatechange === "function" ? _onreadystatechange.apply(null, arguments) : void 0;
  622. };
  623. }
  624. return DocumentMonitor;
  625. })();
  626. EventLagMonitor = (function() {
  627. function EventLagMonitor() {
  628. var avg, interval, last, points, samples,
  629. _this = this;
  630. this.progress = 0;
  631. avg = 0;
  632. samples = [];
  633. points = 0;
  634. last = now();
  635. interval = setInterval(function() {
  636. var diff;
  637. diff = now() - last - 50;
  638. last = now();
  639. samples.push(diff);
  640. if (samples.length > options.eventLag.sampleCount) {
  641. samples.shift();
  642. }
  643. avg = avgAmplitude(samples);
  644. if (++points >= options.eventLag.minSamples && avg < options.eventLag.lagThreshold) {
  645. _this.progress = 100;
  646. return clearInterval(interval);
  647. } else {
  648. return _this.progress = 100 * (3 / (avg + 3));
  649. }
  650. }, 50);
  651. }
  652. return EventLagMonitor;
  653. })();
  654. Scaler = (function() {
  655. function Scaler(source) {
  656. this.source = source;
  657. this.last = this.sinceLastUpdate = 0;
  658. this.rate = options.initialRate;
  659. this.catchup = 0;
  660. this.progress = this.lastProgress = 0;
  661. if (this.source != null) {
  662. this.progress = result(this.source, 'progress');
  663. }
  664. }
  665. Scaler.prototype.tick = function(frameTime, val) {
  666. var scaling;
  667. if (val == null) {
  668. val = result(this.source, 'progress');
  669. }
  670. if (val >= 100) {
  671. this.done = true;
  672. }
  673. if (val === this.last) {
  674. this.sinceLastUpdate += frameTime;
  675. } else {
  676. if (this.sinceLastUpdate) {
  677. this.rate = (val - this.last) / this.sinceLastUpdate;
  678. }
  679. this.catchup = (val - this.progress) / options.catchupTime;
  680. this.sinceLastUpdate = 0;
  681. this.last = val;
  682. }
  683. if (val > this.progress) {
  684. this.progress += this.catchup * frameTime;
  685. }
  686. scaling = 1 - Math.pow(this.progress / 100, options.easeFactor);
  687. this.progress += scaling * this.rate * frameTime;
  688. this.progress = Math.min(this.lastProgress + options.maxProgressPerFrame, this.progress);
  689. this.progress = Math.max(0, this.progress);
  690. this.progress = Math.min(100, this.progress);
  691. this.lastProgress = this.progress;
  692. return this.progress;
  693. };
  694. return Scaler;
  695. })();
  696. sources = null;
  697. scalers = null;
  698. bar = null;
  699. uniScaler = null;
  700. animation = null;
  701. cancelAnimation = null;
  702. Pace.running = false;
  703. handlePushState = function() {
  704. if (options.restartOnPushState) {
  705. return Pace.restart();
  706. }
  707. };
  708. if (window.history.pushState != null) {
  709. _pushState = window.history.pushState;
  710. window.history.pushState = function() {
  711. handlePushState();
  712. return _pushState.apply(window.history, arguments);
  713. };
  714. }
  715. if (window.history.replaceState != null) {
  716. _replaceState = window.history.replaceState;
  717. window.history.replaceState = function() {
  718. handlePushState();
  719. return _replaceState.apply(window.history, arguments);
  720. };
  721. }
  722. SOURCE_KEYS = {
  723. ajax: AjaxMonitor,
  724. elements: ElementMonitor,
  725. document: DocumentMonitor,
  726. eventLag: EventLagMonitor
  727. };
  728. (init = function() {
  729. var type, _j, _k, _len1, _len2, _ref2, _ref3, _ref4;
  730. Pace.sources = sources = [];
  731. _ref2 = ['ajax', 'elements', 'document', 'eventLag'];
  732. for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
  733. type = _ref2[_j];
  734. if (options[type] !== false) {
  735. sources.push(new SOURCE_KEYS[type](options[type]));
  736. }
  737. }
  738. _ref4 = (_ref3 = options.extraSources) != null ? _ref3 : [];
  739. for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) {
  740. source = _ref4[_k];
  741. sources.push(new source(options));
  742. }
  743. Pace.bar = bar = new Bar;
  744. scalers = [];
  745. return uniScaler = new Scaler;
  746. })();
  747. Pace.stop = function() {
  748. Pace.trigger('stop');
  749. Pace.running = false;
  750. bar.destroy();
  751. cancelAnimation = true;
  752. if (animation != null) {
  753. if (typeof cancelAnimationFrame === "function") {
  754. cancelAnimationFrame(animation);
  755. }
  756. animation = null;
  757. }
  758. return init();
  759. };
  760. Pace.restart = function() {
  761. Pace.trigger('restart');
  762. Pace.stop();
  763. return Pace.start();
  764. };
  765. Pace.go = function() {
  766. var start;
  767. Pace.running = true;
  768. bar.render();
  769. start = now();
  770. cancelAnimation = false;
  771. return animation = runAnimation(function(frameTime, enqueueNextFrame) {
  772. var avg, count, done, element, elements, i, j, remaining, scaler, scalerList, sum, _j, _k, _len1, _len2, _ref2;
  773. remaining = 100 - bar.progress;
  774. count = sum = 0;
  775. done = true;
  776. for (i = _j = 0, _len1 = sources.length; _j < _len1; i = ++_j) {
  777. source = sources[i];
  778. scalerList = scalers[i] != null ? scalers[i] : scalers[i] = [];
  779. elements = (_ref2 = source.elements) != null ? _ref2 : [source];
  780. for (j = _k = 0, _len2 = elements.length; _k < _len2; j = ++_k) {
  781. element = elements[j];
  782. scaler = scalerList[j] != null ? scalerList[j] : scalerList[j] = new Scaler(element);
  783. done &= scaler.done;
  784. if (scaler.done) {
  785. continue;
  786. }
  787. count++;
  788. sum += scaler.tick(frameTime);
  789. }
  790. }
  791. avg = sum / count;
  792. bar.update(uniScaler.tick(frameTime, avg));
  793. if (bar.done() || done || cancelAnimation) {
  794. bar.update(100);
  795. Pace.trigger('done');
  796. return setTimeout(function() {
  797. bar.finish();
  798. Pace.running = false;
  799. return Pace.trigger('hide');
  800. }, Math.max(options.ghostTime, Math.max(options.minTime - (now() - start), 0)));
  801. } else {
  802. return enqueueNextFrame();
  803. }
  804. });
  805. };
  806. Pace.start = function(_options) {
  807. extend(options, _options);
  808. Pace.running = true;
  809. try {
  810. bar.render();
  811. } catch (_error) {
  812. NoTargetError = _error;
  813. }
  814. if (!document.querySelector('.pace')) {
  815. return setTimeout(Pace.start, 50);
  816. } else {
  817. Pace.trigger('start');
  818. return Pace.go();
  819. }
  820. };
  821. if (typeof define === 'function' && define.amd) {
  822. define(['pace'], function() {
  823. return Pace;
  824. });
  825. } else if (typeof exports === 'object') {
  826. module.exports = Pace;
  827. } else {
  828. if (options.startOnPageLoad) {
  829. Pace.start();
  830. }
  831. }
  832. }).call(this);
  833. /*!
  834. * jQuery JavaScript Library v3.4.1
  835. * https://jquery.com/
  836. *
  837. * Includes Sizzle.js
  838. * https://sizzlejs.com/
  839. *
  840. * Copyright JS Foundation and other contributors
  841. * Released under the MIT license
  842. * https://jquery.org/license
  843. *
  844. * Date: 2019-05-01T21:04Z
  845. */
  846. ( function( global, factory ) {
  847. "use strict";
  848. if ( typeof module === "object" && typeof module.exports === "object" ) {
  849. // For CommonJS and CommonJS-like environments where a proper `window`
  850. // is present, execute the factory and get jQuery.
  851. // For environments that do not have a `window` with a `document`
  852. // (such as Node.js), expose a factory as module.exports.
  853. // This accentuates the need for the creation of a real `window`.
  854. // e.g. var jQuery = require("jquery")(window);
  855. // See ticket #14549 for more info.
  856. module.exports = global.document ?
  857. factory( global, true ) :
  858. function( w ) {
  859. if ( !w.document ) {
  860. throw new Error( "jQuery requires a window with a document" );
  861. }
  862. return factory( w );
  863. };
  864. } else {
  865. factory( global );
  866. }
  867. // Pass this if window is not defined yet
  868. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  869. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  870. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  871. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  872. // enough that all such attempts are guarded in a try block.
  873. "use strict";
  874. var arr = [];
  875. var document = window.document;
  876. var getProto = Object.getPrototypeOf;
  877. var slice = arr.slice;
  878. var concat = arr.concat;
  879. var push = arr.push;
  880. var indexOf = arr.indexOf;
  881. var class2type = {};
  882. var toString = class2type.toString;
  883. var hasOwn = class2type.hasOwnProperty;
  884. var fnToString = hasOwn.toString;
  885. var ObjectFunctionString = fnToString.call( Object );
  886. var support = {};
  887. var isFunction = function isFunction( obj ) {
  888. // Support: Chrome <=57, Firefox <=52
  889. // In some browsers, typeof returns "function" for HTML <object> elements
  890. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  891. // We don't want to classify *any* DOM node as a function.
  892. return typeof obj === "function" && typeof obj.nodeType !== "number";
  893. };
  894. var isWindow = function isWindow( obj ) {
  895. return obj != null && obj === obj.window;
  896. };
  897. var preservedScriptAttributes = {
  898. type: true,
  899. src: true,
  900. nonce: true,
  901. noModule: true
  902. };
  903. function DOMEval( code, node, doc ) {
  904. doc = doc || document;
  905. var i, val,
  906. script = doc.createElement( "script" );
  907. script.text = code;
  908. if ( node ) {
  909. for ( i in preservedScriptAttributes ) {
  910. // Support: Firefox 64+, Edge 18+
  911. // Some browsers don't support the "nonce" property on scripts.
  912. // On the other hand, just using `getAttribute` is not enough as
  913. // the `nonce` attribute is reset to an empty string whenever it
  914. // becomes browsing-context connected.
  915. // See https://github.com/whatwg/html/issues/2369
  916. // See https://html.spec.whatwg.org/#nonce-attributes
  917. // The `node.getAttribute` check was added for the sake of
  918. // `jQuery.globalEval` so that it can fake a nonce-containing node
  919. // via an object.
  920. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  921. if ( val ) {
  922. script.setAttribute( i, val );
  923. }
  924. }
  925. }
  926. doc.head.appendChild( script ).parentNode.removeChild( script );
  927. }
  928. function toType( obj ) {
  929. if ( obj == null ) {
  930. return obj + "";
  931. }
  932. // Support: Android <=2.3 only (functionish RegExp)
  933. return typeof obj === "object" || typeof obj === "function" ?
  934. class2type[ toString.call( obj ) ] || "object" :
  935. typeof obj;
  936. }
  937. /* global Symbol */
  938. // Defining this global in .eslintrc.json would create a danger of using the global
  939. // unguarded in another place, it seems safer to define global only for this module
  940. var
  941. version = "3.4.1",
  942. // Define a local copy of jQuery
  943. jQuery = function( selector, context ) {
  944. // The jQuery object is actually just the init constructor 'enhanced'
  945. // Need init if jQuery is called (just allow error to be thrown if not included)
  946. return new jQuery.fn.init( selector, context );
  947. },
  948. // Support: Android <=4.0 only
  949. // Make sure we trim BOM and NBSP
  950. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  951. jQuery.fn = jQuery.prototype = {
  952. // The current version of jQuery being used
  953. jquery: version,
  954. constructor: jQuery,
  955. // The default length of a jQuery object is 0
  956. length: 0,
  957. toArray: function() {
  958. return slice.call( this );
  959. },
  960. // Get the Nth element in the matched element set OR
  961. // Get the whole matched element set as a clean array
  962. get: function( num ) {
  963. // Return all the elements in a clean array
  964. if ( num == null ) {
  965. return slice.call( this );
  966. }
  967. // Return just the one element from the set
  968. return num < 0 ? this[ num + this.length ] : this[ num ];
  969. },
  970. // Take an array of elements and push it onto the stack
  971. // (returning the new matched element set)
  972. pushStack: function( elems ) {
  973. // Build a new jQuery matched element set
  974. var ret = jQuery.merge( this.constructor(), elems );
  975. // Add the old object onto the stack (as a reference)
  976. ret.prevObject = this;
  977. // Return the newly-formed element set
  978. return ret;
  979. },
  980. // Execute a callback for every element in the matched set.
  981. each: function( callback ) {
  982. return jQuery.each( this, callback );
  983. },
  984. map: function( callback ) {
  985. return this.pushStack( jQuery.map( this, function( elem, i ) {
  986. return callback.call( elem, i, elem );
  987. } ) );
  988. },
  989. slice: function() {
  990. return this.pushStack( slice.apply( this, arguments ) );
  991. },
  992. first: function() {
  993. return this.eq( 0 );
  994. },
  995. last: function() {
  996. return this.eq( -1 );
  997. },
  998. eq: function( i ) {
  999. var len = this.length,
  1000. j = +i + ( i < 0 ? len : 0 );
  1001. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  1002. },
  1003. end: function() {
  1004. return this.prevObject || this.constructor();
  1005. },
  1006. // For internal use only.
  1007. // Behaves like an Array's method, not like a jQuery method.
  1008. push: push,
  1009. sort: arr.sort,
  1010. splice: arr.splice
  1011. };
  1012. jQuery.extend = jQuery.fn.extend = function() {
  1013. var options, name, src, copy, copyIsArray, clone,
  1014. target = arguments[ 0 ] || {},
  1015. i = 1,
  1016. length = arguments.length,
  1017. deep = false;
  1018. // Handle a deep copy situation
  1019. if ( typeof target === "boolean" ) {
  1020. deep = target;
  1021. // Skip the boolean and the target
  1022. target = arguments[ i ] || {};
  1023. i++;
  1024. }
  1025. // Handle case when target is a string or something (possible in deep copy)
  1026. if ( typeof target !== "object" && !isFunction( target ) ) {
  1027. target = {};
  1028. }
  1029. // Extend jQuery itself if only one argument is passed
  1030. if ( i === length ) {
  1031. target = this;
  1032. i--;
  1033. }
  1034. for ( ; i < length; i++ ) {
  1035. // Only deal with non-null/undefined values
  1036. if ( ( options = arguments[ i ] ) != null ) {
  1037. // Extend the base object
  1038. for ( name in options ) {
  1039. copy = options[ name ];
  1040. // Prevent Object.prototype pollution
  1041. // Prevent never-ending loop
  1042. if ( name === "__proto__" || target === copy ) {
  1043. continue;
  1044. }
  1045. // Recurse if we're merging plain objects or arrays
  1046. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  1047. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  1048. src = target[ name ];
  1049. // Ensure proper type for the source value
  1050. if ( copyIsArray && !Array.isArray( src ) ) {
  1051. clone = [];
  1052. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  1053. clone = {};
  1054. } else {
  1055. clone = src;
  1056. }
  1057. copyIsArray = false;
  1058. // Never move original objects, clone them
  1059. target[ name ] = jQuery.extend( deep, clone, copy );
  1060. // Don't bring in undefined values
  1061. } else if ( copy !== undefined ) {
  1062. target[ name ] = copy;
  1063. }
  1064. }
  1065. }
  1066. }
  1067. // Return the modified object
  1068. return target;
  1069. };
  1070. jQuery.extend( {
  1071. // Unique for each copy of jQuery on the page
  1072. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  1073. // Assume jQuery is ready without the ready module
  1074. isReady: true,
  1075. error: function( msg ) {
  1076. throw new Error( msg );
  1077. },
  1078. noop: function() {},
  1079. isPlainObject: function( obj ) {
  1080. var proto, Ctor;
  1081. // Detect obvious negatives
  1082. // Use toString instead of jQuery.type to catch host objects
  1083. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  1084. return false;
  1085. }
  1086. proto = getProto( obj );
  1087. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  1088. if ( !proto ) {
  1089. return true;
  1090. }
  1091. // Objects with prototype are plain iff they were constructed by a global Object function
  1092. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  1093. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  1094. },
  1095. isEmptyObject: function( obj ) {
  1096. var name;
  1097. for ( name in obj ) {
  1098. return false;
  1099. }
  1100. return true;
  1101. },
  1102. // Evaluates a script in a global context
  1103. globalEval: function( code, options ) {
  1104. DOMEval( code, { nonce: options && options.nonce } );
  1105. },
  1106. each: function( obj, callback ) {
  1107. var length, i = 0;
  1108. if ( isArrayLike( obj ) ) {
  1109. length = obj.length;
  1110. for ( ; i < length; i++ ) {
  1111. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  1112. break;
  1113. }
  1114. }
  1115. } else {
  1116. for ( i in obj ) {
  1117. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  1118. break;
  1119. }
  1120. }
  1121. }
  1122. return obj;
  1123. },
  1124. // Support: Android <=4.0 only
  1125. trim: function( text ) {
  1126. return text == null ?
  1127. "" :
  1128. ( text + "" ).replace( rtrim, "" );
  1129. },
  1130. // results is for internal usage only
  1131. makeArray: function( arr, results ) {
  1132. var ret = results || [];
  1133. if ( arr != null ) {
  1134. if ( isArrayLike( Object( arr ) ) ) {
  1135. jQuery.merge( ret,
  1136. typeof arr === "string" ?
  1137. [ arr ] : arr
  1138. );
  1139. } else {
  1140. push.call( ret, arr );
  1141. }
  1142. }
  1143. return ret;
  1144. },
  1145. inArray: function( elem, arr, i ) {
  1146. return arr == null ? -1 : indexOf.call( arr, elem, i );
  1147. },
  1148. // Support: Android <=4.0 only, PhantomJS 1 only
  1149. // push.apply(_, arraylike) throws on ancient WebKit
  1150. merge: function( first, second ) {
  1151. var len = +second.length,
  1152. j = 0,
  1153. i = first.length;
  1154. for ( ; j < len; j++ ) {
  1155. first[ i++ ] = second[ j ];
  1156. }
  1157. first.length = i;
  1158. return first;
  1159. },
  1160. grep: function( elems, callback, invert ) {
  1161. var callbackInverse,
  1162. matches = [],
  1163. i = 0,
  1164. length = elems.length,
  1165. callbackExpect = !invert;
  1166. // Go through the array, only saving the items
  1167. // that pass the validator function
  1168. for ( ; i < length; i++ ) {
  1169. callbackInverse = !callback( elems[ i ], i );
  1170. if ( callbackInverse !== callbackExpect ) {
  1171. matches.push( elems[ i ] );
  1172. }
  1173. }
  1174. return matches;
  1175. },
  1176. // arg is for internal usage only
  1177. map: function( elems, callback, arg ) {
  1178. var length, value,
  1179. i = 0,
  1180. ret = [];
  1181. // Go through the array, translating each of the items to their new values
  1182. if ( isArrayLike( elems ) ) {
  1183. length = elems.length;
  1184. for ( ; i < length; i++ ) {
  1185. value = callback( elems[ i ], i, arg );
  1186. if ( value != null ) {
  1187. ret.push( value );
  1188. }
  1189. }
  1190. // Go through every key on the object,
  1191. } else {
  1192. for ( i in elems ) {
  1193. value = callback( elems[ i ], i, arg );
  1194. if ( value != null ) {
  1195. ret.push( value );
  1196. }
  1197. }
  1198. }
  1199. // Flatten any nested arrays
  1200. return concat.apply( [], ret );
  1201. },
  1202. // A global GUID counter for objects
  1203. guid: 1,
  1204. // jQuery.support is not used in Core but other projects attach their
  1205. // properties to it so it needs to exist.
  1206. support: support
  1207. } );
  1208. if ( typeof Symbol === "function" ) {
  1209. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  1210. }
  1211. // Populate the class2type map
  1212. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  1213. function( i, name ) {
  1214. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  1215. } );
  1216. function isArrayLike( obj ) {
  1217. // Support: real iOS 8.2 only (not reproducible in simulator)
  1218. // `in` check used to prevent JIT error (gh-2145)
  1219. // hasOwn isn't used here due to false negatives
  1220. // regarding Nodelist length in IE
  1221. var length = !!obj && "length" in obj && obj.length,
  1222. type = toType( obj );
  1223. if ( isFunction( obj ) || isWindow( obj ) ) {
  1224. return false;
  1225. }
  1226. return type === "array" || length === 0 ||
  1227. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  1228. }
  1229. var Sizzle =
  1230. /*!
  1231. * Sizzle CSS Selector Engine v2.3.4
  1232. * https://sizzlejs.com/
  1233. *
  1234. * Copyright JS Foundation and other contributors
  1235. * Released under the MIT license
  1236. * https://js.foundation/
  1237. *
  1238. * Date: 2019-04-08
  1239. */
  1240. (function( window ) {
  1241. var i,
  1242. support,
  1243. Expr,
  1244. getText,
  1245. isXML,
  1246. tokenize,
  1247. compile,
  1248. select,
  1249. outermostContext,
  1250. sortInput,
  1251. hasDuplicate,
  1252. // Local document vars
  1253. setDocument,
  1254. document,
  1255. docElem,
  1256. documentIsHTML,
  1257. rbuggyQSA,
  1258. rbuggyMatches,
  1259. matches,
  1260. contains,
  1261. // Instance-specific data
  1262. expando = "sizzle" + 1 * new Date(),
  1263. preferredDoc = window.document,
  1264. dirruns = 0,
  1265. done = 0,
  1266. classCache = createCache(),
  1267. tokenCache = createCache(),
  1268. compilerCache = createCache(),
  1269. nonnativeSelectorCache = createCache(),
  1270. sortOrder = function( a, b ) {
  1271. if ( a === b ) {
  1272. hasDuplicate = true;
  1273. }
  1274. return 0;
  1275. },
  1276. // Instance methods
  1277. hasOwn = ({}).hasOwnProperty,
  1278. arr = [],
  1279. pop = arr.pop,
  1280. push_native = arr.push,
  1281. push = arr.push,
  1282. slice = arr.slice,
  1283. // Use a stripped-down indexOf as it's faster than native
  1284. // https://jsperf.com/thor-indexof-vs-for/5
  1285. indexOf = function( list, elem ) {
  1286. var i = 0,
  1287. len = list.length;
  1288. for ( ; i < len; i++ ) {
  1289. if ( list[i] === elem ) {
  1290. return i;
  1291. }
  1292. }
  1293. return -1;
  1294. },
  1295. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  1296. // Regular expressions
  1297. // http://www.w3.org/TR/css3-selectors/#whitespace
  1298. whitespace = "[\\x20\\t\\r\\n\\f]",
  1299. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  1300. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  1301. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  1302. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  1303. // Operator (capture 2)
  1304. "*([*^$|!~]?=)" + whitespace +
  1305. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  1306. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  1307. "*\\]",
  1308. pseudos = ":(" + identifier + ")(?:\\((" +
  1309. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  1310. // 1. quoted (capture 3; capture 4 or capture 5)
  1311. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  1312. // 2. simple (capture 6)
  1313. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  1314. // 3. anything else (capture 2)
  1315. ".*" +
  1316. ")\\)|)",
  1317. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  1318. rwhitespace = new RegExp( whitespace + "+", "g" ),
  1319. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  1320. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  1321. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  1322. rdescend = new RegExp( whitespace + "|>" ),
  1323. rpseudo = new RegExp( pseudos ),
  1324. ridentifier = new RegExp( "^" + identifier + "$" ),
  1325. matchExpr = {
  1326. "ID": new RegExp( "^#(" + identifier + ")" ),
  1327. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  1328. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  1329. "ATTR": new RegExp( "^" + attributes ),
  1330. "PSEUDO": new RegExp( "^" + pseudos ),
  1331. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  1332. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  1333. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  1334. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  1335. // For use in libraries implementing .is()
  1336. // We use this for POS matching in `select`
  1337. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  1338. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  1339. },
  1340. rhtml = /HTML$/i,
  1341. rinputs = /^(?:input|select|textarea|button)$/i,
  1342. rheader = /^h\d$/i,
  1343. rnative = /^[^{]+\{\s*\[native \w/,
  1344. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  1345. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  1346. rsibling = /[+~]/,
  1347. // CSS escapes
  1348. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  1349. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  1350. funescape = function( _, escaped, escapedWhitespace ) {
  1351. var high = "0x" + escaped - 0x10000;
  1352. // NaN means non-codepoint
  1353. // Support: Firefox<24
  1354. // Workaround erroneous numeric interpretation of +"0x"
  1355. return high !== high || escapedWhitespace ?
  1356. escaped :
  1357. high < 0 ?
  1358. // BMP codepoint
  1359. String.fromCharCode( high + 0x10000 ) :
  1360. // Supplemental Plane codepoint (surrogate pair)
  1361. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  1362. },
  1363. // CSS string/identifier serialization
  1364. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  1365. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  1366. fcssescape = function( ch, asCodePoint ) {
  1367. if ( asCodePoint ) {
  1368. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  1369. if ( ch === "\0" ) {
  1370. return "\uFFFD";
  1371. }
  1372. // Control characters and (dependent upon position) numbers get escaped as code points
  1373. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  1374. }
  1375. // Other potentially-special ASCII characters get backslash-escaped
  1376. return "\\" + ch;
  1377. },
  1378. // Used for iframes
  1379. // See setDocument()
  1380. // Removing the function wrapper causes a "Permission Denied"
  1381. // error in IE
  1382. unloadHandler = function() {
  1383. setDocument();
  1384. },
  1385. inDisabledFieldset = addCombinator(
  1386. function( elem ) {
  1387. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  1388. },
  1389. { dir: "parentNode", next: "legend" }
  1390. );
  1391. // Optimize for push.apply( _, NodeList )
  1392. try {
  1393. push.apply(
  1394. (arr = slice.call( preferredDoc.childNodes )),
  1395. preferredDoc.childNodes
  1396. );
  1397. // Support: Android<4.0
  1398. // Detect silently failing push.apply
  1399. arr[ preferredDoc.childNodes.length ].nodeType;
  1400. } catch ( e ) {
  1401. push = { apply: arr.length ?
  1402. // Leverage slice if possible
  1403. function( target, els ) {
  1404. push_native.apply( target, slice.call(els) );
  1405. } :
  1406. // Support: IE<9
  1407. // Otherwise append directly
  1408. function( target, els ) {
  1409. var j = target.length,
  1410. i = 0;
  1411. // Can't trust NodeList.length
  1412. while ( (target[j++] = els[i++]) ) {}
  1413. target.length = j - 1;
  1414. }
  1415. };
  1416. }
  1417. function Sizzle( selector, context, results, seed ) {
  1418. var m, i, elem, nid, match, groups, newSelector,
  1419. newContext = context && context.ownerDocument,
  1420. // nodeType defaults to 9, since context defaults to document
  1421. nodeType = context ? context.nodeType : 9;
  1422. results = results || [];
  1423. // Return early from calls with invalid selector or context
  1424. if ( typeof selector !== "string" || !selector ||
  1425. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  1426. return results;
  1427. }
  1428. // Try to shortcut find operations (as opposed to filters) in HTML documents
  1429. if ( !seed ) {
  1430. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  1431. setDocument( context );
  1432. }
  1433. context = context || document;
  1434. if ( documentIsHTML ) {
  1435. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  1436. // (excepting DocumentFragment context, where the methods don't exist)
  1437. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  1438. // ID selector
  1439. if ( (m = match[1]) ) {
  1440. // Document context
  1441. if ( nodeType === 9 ) {
  1442. if ( (elem = context.getElementById( m )) ) {
  1443. // Support: IE, Opera, Webkit
  1444. // TODO: identify versions
  1445. // getElementById can match elements by name instead of ID
  1446. if ( elem.id === m ) {
  1447. results.push( elem );
  1448. return results;
  1449. }
  1450. } else {
  1451. return results;
  1452. }
  1453. // Element context
  1454. } else {
  1455. // Support: IE, Opera, Webkit
  1456. // TODO: identify versions
  1457. // getElementById can match elements by name instead of ID
  1458. if ( newContext && (elem = newContext.getElementById( m )) &&
  1459. contains( context, elem ) &&
  1460. elem.id === m ) {
  1461. results.push( elem );
  1462. return results;
  1463. }
  1464. }
  1465. // Type selector
  1466. } else if ( match[2] ) {
  1467. push.apply( results, context.getElementsByTagName( selector ) );
  1468. return results;
  1469. // Class selector
  1470. } else if ( (m = match[3]) && support.getElementsByClassName &&
  1471. context.getElementsByClassName ) {
  1472. push.apply( results, context.getElementsByClassName( m ) );
  1473. return results;
  1474. }
  1475. }
  1476. // Take advantage of querySelectorAll
  1477. if ( support.qsa &&
  1478. !nonnativeSelectorCache[ selector + " " ] &&
  1479. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  1480. // Support: IE 8 only
  1481. // Exclude object elements
  1482. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  1483. newSelector = selector;
  1484. newContext = context;
  1485. // qSA considers elements outside a scoping root when evaluating child or
  1486. // descendant combinators, which is not what we want.
  1487. // In such cases, we work around the behavior by prefixing every selector in the
  1488. // list with an ID selector referencing the scope context.
  1489. // Thanks to Andrew Dupont for this technique.
  1490. if ( nodeType === 1 && rdescend.test( selector ) ) {
  1491. // Capture the context ID, setting it first if necessary
  1492. if ( (nid = context.getAttribute( "id" )) ) {
  1493. nid = nid.replace( rcssescape, fcssescape );
  1494. } else {
  1495. context.setAttribute( "id", (nid = expando) );
  1496. }
  1497. // Prefix every selector in the list
  1498. groups = tokenize( selector );
  1499. i = groups.length;
  1500. while ( i-- ) {
  1501. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  1502. }
  1503. newSelector = groups.join( "," );
  1504. // Expand context for sibling selectors
  1505. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  1506. context;
  1507. }
  1508. try {
  1509. push.apply( results,
  1510. newContext.querySelectorAll( newSelector )
  1511. );
  1512. return results;
  1513. } catch ( qsaError ) {
  1514. nonnativeSelectorCache( selector, true );
  1515. } finally {
  1516. if ( nid === expando ) {
  1517. context.removeAttribute( "id" );
  1518. }
  1519. }
  1520. }
  1521. }
  1522. }
  1523. // All others
  1524. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  1525. }
  1526. /**
  1527. * Create key-value caches of limited size
  1528. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  1529. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  1530. * deleting the oldest entry
  1531. */
  1532. function createCache() {
  1533. var keys = [];
  1534. function cache( key, value ) {
  1535. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  1536. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  1537. // Only keep the most recent entries
  1538. delete cache[ keys.shift() ];
  1539. }
  1540. return (cache[ key + " " ] = value);
  1541. }
  1542. return cache;
  1543. }
  1544. /**
  1545. * Mark a function for special use by Sizzle
  1546. * @param {Function} fn The function to mark
  1547. */
  1548. function markFunction( fn ) {
  1549. fn[ expando ] = true;
  1550. return fn;
  1551. }
  1552. /**
  1553. * Support testing using an element
  1554. * @param {Function} fn Passed the created element and returns a boolean result
  1555. */
  1556. function assert( fn ) {
  1557. var el = document.createElement("fieldset");
  1558. try {
  1559. return !!fn( el );
  1560. } catch (e) {
  1561. return false;
  1562. } finally {
  1563. // Remove from its parent by default
  1564. if ( el.parentNode ) {
  1565. el.parentNode.removeChild( el );
  1566. }
  1567. // release memory in IE
  1568. el = null;
  1569. }
  1570. }
  1571. /**
  1572. * Adds the same handler for all of the specified attrs
  1573. * @param {String} attrs Pipe-separated list of attributes
  1574. * @param {Function} handler The method that will be applied
  1575. */
  1576. function addHandle( attrs, handler ) {
  1577. var arr = attrs.split("|"),
  1578. i = arr.length;
  1579. while ( i-- ) {
  1580. Expr.attrHandle[ arr[i] ] = handler;
  1581. }
  1582. }
  1583. /**
  1584. * Checks document order of two siblings
  1585. * @param {Element} a
  1586. * @param {Element} b
  1587. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  1588. */
  1589. function siblingCheck( a, b ) {
  1590. var cur = b && a,
  1591. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  1592. a.sourceIndex - b.sourceIndex;
  1593. // Use IE sourceIndex if available on both nodes
  1594. if ( diff ) {
  1595. return diff;
  1596. }
  1597. // Check if b follows a
  1598. if ( cur ) {
  1599. while ( (cur = cur.nextSibling) ) {
  1600. if ( cur === b ) {
  1601. return -1;
  1602. }
  1603. }
  1604. }
  1605. return a ? 1 : -1;
  1606. }
  1607. /**
  1608. * Returns a function to use in pseudos for input types
  1609. * @param {String} type
  1610. */
  1611. function createInputPseudo( type ) {
  1612. return function( elem ) {
  1613. var name = elem.nodeName.toLowerCase();
  1614. return name === "input" && elem.type === type;
  1615. };
  1616. }
  1617. /**
  1618. * Returns a function to use in pseudos for buttons
  1619. * @param {String} type
  1620. */
  1621. function createButtonPseudo( type ) {
  1622. return function( elem ) {
  1623. var name = elem.nodeName.toLowerCase();
  1624. return (name === "input" || name === "button") && elem.type === type;
  1625. };
  1626. }
  1627. /**
  1628. * Returns a function to use in pseudos for :enabled/:disabled
  1629. * @param {Boolean} disabled true for :disabled; false for :enabled
  1630. */
  1631. function createDisabledPseudo( disabled ) {
  1632. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  1633. return function( elem ) {
  1634. // Only certain elements can match :enabled or :disabled
  1635. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  1636. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  1637. if ( "form" in elem ) {
  1638. // Check for inherited disabledness on relevant non-disabled elements:
  1639. // * listed form-associated elements in a disabled fieldset
  1640. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  1641. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  1642. // * option elements in a disabled optgroup
  1643. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  1644. // All such elements have a "form" property.
  1645. if ( elem.parentNode && elem.disabled === false ) {
  1646. // Option elements defer to a parent optgroup if present
  1647. if ( "label" in elem ) {
  1648. if ( "label" in elem.parentNode ) {
  1649. return elem.parentNode.disabled === disabled;
  1650. } else {
  1651. return elem.disabled === disabled;
  1652. }
  1653. }
  1654. // Support: IE 6 - 11
  1655. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  1656. return elem.isDisabled === disabled ||
  1657. // Where there is no isDisabled, check manually
  1658. /* jshint -W018 */
  1659. elem.isDisabled !== !disabled &&
  1660. inDisabledFieldset( elem ) === disabled;
  1661. }
  1662. return elem.disabled === disabled;
  1663. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  1664. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  1665. // even exist on them, let alone have a boolean value.
  1666. } else if ( "label" in elem ) {
  1667. return elem.disabled === disabled;
  1668. }
  1669. // Remaining elements are neither :enabled nor :disabled
  1670. return false;
  1671. };
  1672. }
  1673. /**
  1674. * Returns a function to use in pseudos for positionals
  1675. * @param {Function} fn
  1676. */
  1677. function createPositionalPseudo( fn ) {
  1678. return markFunction(function( argument ) {
  1679. argument = +argument;
  1680. return markFunction(function( seed, matches ) {
  1681. var j,
  1682. matchIndexes = fn( [], seed.length, argument ),
  1683. i = matchIndexes.length;
  1684. // Match elements found at the specified indexes
  1685. while ( i-- ) {
  1686. if ( seed[ (j = matchIndexes[i]) ] ) {
  1687. seed[j] = !(matches[j] = seed[j]);
  1688. }
  1689. }
  1690. });
  1691. });
  1692. }
  1693. /**
  1694. * Checks a node for validity as a Sizzle context
  1695. * @param {Element|Object=} context
  1696. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  1697. */
  1698. function testContext( context ) {
  1699. return context && typeof context.getElementsByTagName !== "undefined" && context;
  1700. }
  1701. // Expose support vars for convenience
  1702. support = Sizzle.support = {};
  1703. /**
  1704. * Detects XML nodes
  1705. * @param {Element|Object} elem An element or a document
  1706. * @returns {Boolean} True iff elem is a non-HTML XML node
  1707. */
  1708. isXML = Sizzle.isXML = function( elem ) {
  1709. var namespace = elem.namespaceURI,
  1710. docElem = (elem.ownerDocument || elem).documentElement;
  1711. // Support: IE <=8
  1712. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  1713. // https://bugs.jquery.com/ticket/4833
  1714. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  1715. };
  1716. /**
  1717. * Sets document-related variables once based on the current document
  1718. * @param {Element|Object} [doc] An element or document object to use to set the document
  1719. * @returns {Object} Returns the current document
  1720. */
  1721. setDocument = Sizzle.setDocument = function( node ) {
  1722. var hasCompare, subWindow,
  1723. doc = node ? node.ownerDocument || node : preferredDoc;
  1724. // Return early if doc is invalid or already selected
  1725. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  1726. return document;
  1727. }
  1728. // Update global variables
  1729. document = doc;
  1730. docElem = document.documentElement;
  1731. documentIsHTML = !isXML( document );
  1732. // Support: IE 9-11, Edge
  1733. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  1734. if ( preferredDoc !== document &&
  1735. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  1736. // Support: IE 11, Edge
  1737. if ( subWindow.addEventListener ) {
  1738. subWindow.addEventListener( "unload", unloadHandler, false );
  1739. // Support: IE 9 - 10 only
  1740. } else if ( subWindow.attachEvent ) {
  1741. subWindow.attachEvent( "onunload", unloadHandler );
  1742. }
  1743. }
  1744. /* Attributes
  1745. ---------------------------------------------------------------------- */
  1746. // Support: IE<8
  1747. // Verify that getAttribute really returns attributes and not properties
  1748. // (excepting IE8 booleans)
  1749. support.attributes = assert(function( el ) {
  1750. el.className = "i";
  1751. return !el.getAttribute("className");
  1752. });
  1753. /* getElement(s)By*
  1754. ---------------------------------------------------------------------- */
  1755. // Check if getElementsByTagName("*") returns only elements
  1756. support.getElementsByTagName = assert(function( el ) {
  1757. el.appendChild( document.createComment("") );
  1758. return !el.getElementsByTagName("*").length;
  1759. });
  1760. // Support: IE<9
  1761. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  1762. // Support: IE<10
  1763. // Check if getElementById returns elements by name
  1764. // The broken getElementById methods don't pick up programmatically-set names,
  1765. // so use a roundabout getElementsByName test
  1766. support.getById = assert(function( el ) {
  1767. docElem.appendChild( el ).id = expando;
  1768. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  1769. });
  1770. // ID filter and find
  1771. if ( support.getById ) {
  1772. Expr.filter["ID"] = function( id ) {
  1773. var attrId = id.replace( runescape, funescape );
  1774. return function( elem ) {
  1775. return elem.getAttribute("id") === attrId;
  1776. };
  1777. };
  1778. Expr.find["ID"] = function( id, context ) {
  1779. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  1780. var elem = context.getElementById( id );
  1781. return elem ? [ elem ] : [];
  1782. }
  1783. };
  1784. } else {
  1785. Expr.filter["ID"] = function( id ) {
  1786. var attrId = id.replace( runescape, funescape );
  1787. return function( elem ) {
  1788. var node = typeof elem.getAttributeNode !== "undefined" &&
  1789. elem.getAttributeNode("id");
  1790. return node && node.value === attrId;
  1791. };
  1792. };
  1793. // Support: IE 6 - 7 only
  1794. // getElementById is not reliable as a find shortcut
  1795. Expr.find["ID"] = function( id, context ) {
  1796. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  1797. var node, i, elems,
  1798. elem = context.getElementById( id );
  1799. if ( elem ) {
  1800. // Verify the id attribute
  1801. node = elem.getAttributeNode("id");
  1802. if ( node && node.value === id ) {
  1803. return [ elem ];
  1804. }
  1805. // Fall back on getElementsByName
  1806. elems = context.getElementsByName( id );
  1807. i = 0;
  1808. while ( (elem = elems[i++]) ) {
  1809. node = elem.getAttributeNode("id");
  1810. if ( node && node.value === id ) {
  1811. return [ elem ];
  1812. }
  1813. }
  1814. }
  1815. return [];
  1816. }
  1817. };
  1818. }
  1819. // Tag
  1820. Expr.find["TAG"] = support.getElementsByTagName ?
  1821. function( tag, context ) {
  1822. if ( typeof context.getElementsByTagName !== "undefined" ) {
  1823. return context.getElementsByTagName( tag );
  1824. // DocumentFragment nodes don't have gEBTN
  1825. } else if ( support.qsa ) {
  1826. return context.querySelectorAll( tag );
  1827. }
  1828. } :
  1829. function( tag, context ) {
  1830. var elem,
  1831. tmp = [],
  1832. i = 0,
  1833. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  1834. results = context.getElementsByTagName( tag );
  1835. // Filter out possible comments
  1836. if ( tag === "*" ) {
  1837. while ( (elem = results[i++]) ) {
  1838. if ( elem.nodeType === 1 ) {
  1839. tmp.push( elem );
  1840. }
  1841. }
  1842. return tmp;
  1843. }
  1844. return results;
  1845. };
  1846. // Class
  1847. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  1848. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  1849. return context.getElementsByClassName( className );
  1850. }
  1851. };
  1852. /* QSA/matchesSelector
  1853. ---------------------------------------------------------------------- */
  1854. // QSA and matchesSelector support
  1855. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  1856. rbuggyMatches = [];
  1857. // qSa(:focus) reports false when true (Chrome 21)
  1858. // We allow this because of a bug in IE8/9 that throws an error
  1859. // whenever `document.activeElement` is accessed on an iframe
  1860. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  1861. // See https://bugs.jquery.com/ticket/13378
  1862. rbuggyQSA = [];
  1863. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  1864. // Build QSA regex
  1865. // Regex strategy adopted from Diego Perini
  1866. assert(function( el ) {
  1867. // Select is set to empty string on purpose
  1868. // This is to test IE's treatment of not explicitly
  1869. // setting a boolean content attribute,
  1870. // since its presence should be enough
  1871. // https://bugs.jquery.com/ticket/12359
  1872. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  1873. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  1874. "<option selected=''></option></select>";
  1875. // Support: IE8, Opera 11-12.16
  1876. // Nothing should be selected when empty strings follow ^= or $= or *=
  1877. // The test attribute must be unknown in Opera but "safe" for WinRT
  1878. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  1879. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  1880. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  1881. }
  1882. // Support: IE8
  1883. // Boolean attributes and "value" are not treated correctly
  1884. if ( !el.querySelectorAll("[selected]").length ) {
  1885. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  1886. }
  1887. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  1888. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  1889. rbuggyQSA.push("~=");
  1890. }
  1891. // Webkit/Opera - :checked should return selected option elements
  1892. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1893. // IE8 throws error here and will not see later tests
  1894. if ( !el.querySelectorAll(":checked").length ) {
  1895. rbuggyQSA.push(":checked");
  1896. }
  1897. // Support: Safari 8+, iOS 8+
  1898. // https://bugs.webkit.org/show_bug.cgi?id=136851
  1899. // In-page `selector#id sibling-combinator selector` fails
  1900. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  1901. rbuggyQSA.push(".#.+[+~]");
  1902. }
  1903. });
  1904. assert(function( el ) {
  1905. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  1906. "<select disabled='disabled'><option/></select>";
  1907. // Support: Windows 8 Native Apps
  1908. // The type and name attributes are restricted during .innerHTML assignment
  1909. var input = document.createElement("input");
  1910. input.setAttribute( "type", "hidden" );
  1911. el.appendChild( input ).setAttribute( "name", "D" );
  1912. // Support: IE8
  1913. // Enforce case-sensitivity of name attribute
  1914. if ( el.querySelectorAll("[name=d]").length ) {
  1915. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  1916. }
  1917. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  1918. // IE8 throws error here and will not see later tests
  1919. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  1920. rbuggyQSA.push( ":enabled", ":disabled" );
  1921. }
  1922. // Support: IE9-11+
  1923. // IE's :disabled selector does not pick up the children of disabled fieldsets
  1924. docElem.appendChild( el ).disabled = true;
  1925. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  1926. rbuggyQSA.push( ":enabled", ":disabled" );
  1927. }
  1928. // Opera 10-11 does not throw on post-comma invalid pseudos
  1929. el.querySelectorAll("*,:x");
  1930. rbuggyQSA.push(",.*:");
  1931. });
  1932. }
  1933. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  1934. docElem.webkitMatchesSelector ||
  1935. docElem.mozMatchesSelector ||
  1936. docElem.oMatchesSelector ||
  1937. docElem.msMatchesSelector) )) ) {
  1938. assert(function( el ) {
  1939. // Check to see if it's possible to do matchesSelector
  1940. // on a disconnected node (IE 9)
  1941. support.disconnectedMatch = matches.call( el, "*" );
  1942. // This should fail with an exception
  1943. // Gecko does not error, returns false instead
  1944. matches.call( el, "[s!='']:x" );
  1945. rbuggyMatches.push( "!=", pseudos );
  1946. });
  1947. }
  1948. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  1949. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  1950. /* Contains
  1951. ---------------------------------------------------------------------- */
  1952. hasCompare = rnative.test( docElem.compareDocumentPosition );
  1953. // Element contains another
  1954. // Purposefully self-exclusive
  1955. // As in, an element does not contain itself
  1956. contains = hasCompare || rnative.test( docElem.contains ) ?
  1957. function( a, b ) {
  1958. var adown = a.nodeType === 9 ? a.documentElement : a,
  1959. bup = b && b.parentNode;
  1960. return a === bup || !!( bup && bup.nodeType === 1 && (
  1961. adown.contains ?
  1962. adown.contains( bup ) :
  1963. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  1964. ));
  1965. } :
  1966. function( a, b ) {
  1967. if ( b ) {
  1968. while ( (b = b.parentNode) ) {
  1969. if ( b === a ) {
  1970. return true;
  1971. }
  1972. }
  1973. }
  1974. return false;
  1975. };
  1976. /* Sorting
  1977. ---------------------------------------------------------------------- */
  1978. // Document order sorting
  1979. sortOrder = hasCompare ?
  1980. function( a, b ) {
  1981. // Flag for duplicate removal
  1982. if ( a === b ) {
  1983. hasDuplicate = true;
  1984. return 0;
  1985. }
  1986. // Sort on method existence if only one input has compareDocumentPosition
  1987. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  1988. if ( compare ) {
  1989. return compare;
  1990. }
  1991. // Calculate position if both inputs belong to the same document
  1992. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  1993. a.compareDocumentPosition( b ) :
  1994. // Otherwise we know they are disconnected
  1995. 1;
  1996. // Disconnected nodes
  1997. if ( compare & 1 ||
  1998. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  1999. // Choose the first element that is related to our preferred document
  2000. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  2001. return -1;
  2002. }
  2003. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  2004. return 1;
  2005. }
  2006. // Maintain original order
  2007. return sortInput ?
  2008. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  2009. 0;
  2010. }
  2011. return compare & 4 ? -1 : 1;
  2012. } :
  2013. function( a, b ) {
  2014. // Exit early if the nodes are identical
  2015. if ( a === b ) {
  2016. hasDuplicate = true;
  2017. return 0;
  2018. }
  2019. var cur,
  2020. i = 0,
  2021. aup = a.parentNode,
  2022. bup = b.parentNode,
  2023. ap = [ a ],
  2024. bp = [ b ];
  2025. // Parentless nodes are either documents or disconnected
  2026. if ( !aup || !bup ) {
  2027. return a === document ? -1 :
  2028. b === document ? 1 :
  2029. aup ? -1 :
  2030. bup ? 1 :
  2031. sortInput ?
  2032. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  2033. 0;
  2034. // If the nodes are siblings, we can do a quick check
  2035. } else if ( aup === bup ) {
  2036. return siblingCheck( a, b );
  2037. }
  2038. // Otherwise we need full lists of their ancestors for comparison
  2039. cur = a;
  2040. while ( (cur = cur.parentNode) ) {
  2041. ap.unshift( cur );
  2042. }
  2043. cur = b;
  2044. while ( (cur = cur.parentNode) ) {
  2045. bp.unshift( cur );
  2046. }
  2047. // Walk down the tree looking for a discrepancy
  2048. while ( ap[i] === bp[i] ) {
  2049. i++;
  2050. }
  2051. return i ?
  2052. // Do a sibling check if the nodes have a common ancestor
  2053. siblingCheck( ap[i], bp[i] ) :
  2054. // Otherwise nodes in our document sort first
  2055. ap[i] === preferredDoc ? -1 :
  2056. bp[i] === preferredDoc ? 1 :
  2057. 0;
  2058. };
  2059. return document;
  2060. };
  2061. Sizzle.matches = function( expr, elements ) {
  2062. return Sizzle( expr, null, null, elements );
  2063. };
  2064. Sizzle.matchesSelector = function( elem, expr ) {
  2065. // Set document vars if needed
  2066. if ( ( elem.ownerDocument || elem ) !== document ) {
  2067. setDocument( elem );
  2068. }
  2069. if ( support.matchesSelector && documentIsHTML &&
  2070. !nonnativeSelectorCache[ expr + " " ] &&
  2071. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  2072. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  2073. try {
  2074. var ret = matches.call( elem, expr );
  2075. // IE 9's matchesSelector returns false on disconnected nodes
  2076. if ( ret || support.disconnectedMatch ||
  2077. // As well, disconnected nodes are said to be in a document
  2078. // fragment in IE 9
  2079. elem.document && elem.document.nodeType !== 11 ) {
  2080. return ret;
  2081. }
  2082. } catch (e) {
  2083. nonnativeSelectorCache( expr, true );
  2084. }
  2085. }
  2086. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  2087. };
  2088. Sizzle.contains = function( context, elem ) {
  2089. // Set document vars if needed
  2090. if ( ( context.ownerDocument || context ) !== document ) {
  2091. setDocument( context );
  2092. }
  2093. return contains( context, elem );
  2094. };
  2095. Sizzle.attr = function( elem, name ) {
  2096. // Set document vars if needed
  2097. if ( ( elem.ownerDocument || elem ) !== document ) {
  2098. setDocument( elem );
  2099. }
  2100. var fn = Expr.attrHandle[ name.toLowerCase() ],
  2101. // Don't get fooled by Object.prototype properties (jQuery #13807)
  2102. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  2103. fn( elem, name, !documentIsHTML ) :
  2104. undefined;
  2105. return val !== undefined ?
  2106. val :
  2107. support.attributes || !documentIsHTML ?
  2108. elem.getAttribute( name ) :
  2109. (val = elem.getAttributeNode(name)) && val.specified ?
  2110. val.value :
  2111. null;
  2112. };
  2113. Sizzle.escape = function( sel ) {
  2114. return (sel + "").replace( rcssescape, fcssescape );
  2115. };
  2116. Sizzle.error = function( msg ) {
  2117. throw new Error( "Syntax error, unrecognized expression: " + msg );
  2118. };
  2119. /**
  2120. * Document sorting and removing duplicates
  2121. * @param {ArrayLike} results
  2122. */
  2123. Sizzle.uniqueSort = function( results ) {
  2124. var elem,
  2125. duplicates = [],
  2126. j = 0,
  2127. i = 0;
  2128. // Unless we *know* we can detect duplicates, assume their presence
  2129. hasDuplicate = !support.detectDuplicates;
  2130. sortInput = !support.sortStable && results.slice( 0 );
  2131. results.sort( sortOrder );
  2132. if ( hasDuplicate ) {
  2133. while ( (elem = results[i++]) ) {
  2134. if ( elem === results[ i ] ) {
  2135. j = duplicates.push( i );
  2136. }
  2137. }
  2138. while ( j-- ) {
  2139. results.splice( duplicates[ j ], 1 );
  2140. }
  2141. }
  2142. // Clear input after sorting to release objects
  2143. // See https://github.com/jquery/sizzle/pull/225
  2144. sortInput = null;
  2145. return results;
  2146. };
  2147. /**
  2148. * Utility function for retrieving the text value of an array of DOM nodes
  2149. * @param {Array|Element} elem
  2150. */
  2151. getText = Sizzle.getText = function( elem ) {
  2152. var node,
  2153. ret = "",
  2154. i = 0,
  2155. nodeType = elem.nodeType;
  2156. if ( !nodeType ) {
  2157. // If no nodeType, this is expected to be an array
  2158. while ( (node = elem[i++]) ) {
  2159. // Do not traverse comment nodes
  2160. ret += getText( node );
  2161. }
  2162. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  2163. // Use textContent for elements
  2164. // innerText usage removed for consistency of new lines (jQuery #11153)
  2165. if ( typeof elem.textContent === "string" ) {
  2166. return elem.textContent;
  2167. } else {
  2168. // Traverse its children
  2169. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  2170. ret += getText( elem );
  2171. }
  2172. }
  2173. } else if ( nodeType === 3 || nodeType === 4 ) {
  2174. return elem.nodeValue;
  2175. }
  2176. // Do not include comment or processing instruction nodes
  2177. return ret;
  2178. };
  2179. Expr = Sizzle.selectors = {
  2180. // Can be adjusted by the user
  2181. cacheLength: 50,
  2182. createPseudo: markFunction,
  2183. match: matchExpr,
  2184. attrHandle: {},
  2185. find: {},
  2186. relative: {
  2187. ">": { dir: "parentNode", first: true },
  2188. " ": { dir: "parentNode" },
  2189. "+": { dir: "previousSibling", first: true },
  2190. "~": { dir: "previousSibling" }
  2191. },
  2192. preFilter: {
  2193. "ATTR": function( match ) {
  2194. match[1] = match[1].replace( runescape, funescape );
  2195. // Move the given value to match[3] whether quoted or unquoted
  2196. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  2197. if ( match[2] === "~=" ) {
  2198. match[3] = " " + match[3] + " ";
  2199. }
  2200. return match.slice( 0, 4 );
  2201. },
  2202. "CHILD": function( match ) {
  2203. /* matches from matchExpr["CHILD"]
  2204. 1 type (only|nth|...)
  2205. 2 what (child|of-type)
  2206. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  2207. 4 xn-component of xn+y argument ([+-]?\d*n|)
  2208. 5 sign of xn-component
  2209. 6 x of xn-component
  2210. 7 sign of y-component
  2211. 8 y of y-component
  2212. */
  2213. match[1] = match[1].toLowerCase();
  2214. if ( match[1].slice( 0, 3 ) === "nth" ) {
  2215. // nth-* requires argument
  2216. if ( !match[3] ) {
  2217. Sizzle.error( match[0] );
  2218. }
  2219. // numeric x and y parameters for Expr.filter.CHILD
  2220. // remember that false/true cast respectively to 0/1
  2221. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  2222. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  2223. // other types prohibit arguments
  2224. } else if ( match[3] ) {
  2225. Sizzle.error( match[0] );
  2226. }
  2227. return match;
  2228. },
  2229. "PSEUDO": function( match ) {
  2230. var excess,
  2231. unquoted = !match[6] && match[2];
  2232. if ( matchExpr["CHILD"].test( match[0] ) ) {
  2233. return null;
  2234. }
  2235. // Accept quoted arguments as-is
  2236. if ( match[3] ) {
  2237. match[2] = match[4] || match[5] || "";
  2238. // Strip excess characters from unquoted arguments
  2239. } else if ( unquoted && rpseudo.test( unquoted ) &&
  2240. // Get excess from tokenize (recursively)
  2241. (excess = tokenize( unquoted, true )) &&
  2242. // advance to the next closing parenthesis
  2243. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  2244. // excess is a negative index
  2245. match[0] = match[0].slice( 0, excess );
  2246. match[2] = unquoted.slice( 0, excess );
  2247. }
  2248. // Return only captures needed by the pseudo filter method (type and argument)
  2249. return match.slice( 0, 3 );
  2250. }
  2251. },
  2252. filter: {
  2253. "TAG": function( nodeNameSelector ) {
  2254. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  2255. return nodeNameSelector === "*" ?
  2256. function() { return true; } :
  2257. function( elem ) {
  2258. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  2259. };
  2260. },
  2261. "CLASS": function( className ) {
  2262. var pattern = classCache[ className + " " ];
  2263. return pattern ||
  2264. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  2265. classCache( className, function( elem ) {
  2266. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  2267. });
  2268. },
  2269. "ATTR": function( name, operator, check ) {
  2270. return function( elem ) {
  2271. var result = Sizzle.attr( elem, name );
  2272. if ( result == null ) {
  2273. return operator === "!=";
  2274. }
  2275. if ( !operator ) {
  2276. return true;
  2277. }
  2278. result += "";
  2279. return operator === "=" ? result === check :
  2280. operator === "!=" ? result !== check :
  2281. operator === "^=" ? check && result.indexOf( check ) === 0 :
  2282. operator === "*=" ? check && result.indexOf( check ) > -1 :
  2283. operator === "$=" ? check && result.slice( -check.length ) === check :
  2284. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  2285. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  2286. false;
  2287. };
  2288. },
  2289. "CHILD": function( type, what, argument, first, last ) {
  2290. var simple = type.slice( 0, 3 ) !== "nth",
  2291. forward = type.slice( -4 ) !== "last",
  2292. ofType = what === "of-type";
  2293. return first === 1 && last === 0 ?
  2294. // Shortcut for :nth-*(n)
  2295. function( elem ) {
  2296. return !!elem.parentNode;
  2297. } :
  2298. function( elem, context, xml ) {
  2299. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  2300. dir = simple !== forward ? "nextSibling" : "previousSibling",
  2301. parent = elem.parentNode,
  2302. name = ofType && elem.nodeName.toLowerCase(),
  2303. useCache = !xml && !ofType,
  2304. diff = false;
  2305. if ( parent ) {
  2306. // :(first|last|only)-(child|of-type)
  2307. if ( simple ) {
  2308. while ( dir ) {
  2309. node = elem;
  2310. while ( (node = node[ dir ]) ) {
  2311. if ( ofType ?
  2312. node.nodeName.toLowerCase() === name :
  2313. node.nodeType === 1 ) {
  2314. return false;
  2315. }
  2316. }
  2317. // Reverse direction for :only-* (if we haven't yet done so)
  2318. start = dir = type === "only" && !start && "nextSibling";
  2319. }
  2320. return true;
  2321. }
  2322. start = [ forward ? parent.firstChild : parent.lastChild ];
  2323. // non-xml :nth-child(...) stores cache data on `parent`
  2324. if ( forward && useCache ) {
  2325. // Seek `elem` from a previously-cached index
  2326. // ...in a gzip-friendly way
  2327. node = parent;
  2328. outerCache = node[ expando ] || (node[ expando ] = {});
  2329. // Support: IE <9 only
  2330. // Defend against cloned attroperties (jQuery gh-1709)
  2331. uniqueCache = outerCache[ node.uniqueID ] ||
  2332. (outerCache[ node.uniqueID ] = {});
  2333. cache = uniqueCache[ type ] || [];
  2334. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  2335. diff = nodeIndex && cache[ 2 ];
  2336. node = nodeIndex && parent.childNodes[ nodeIndex ];
  2337. while ( (node = ++nodeIndex && node && node[ dir ] ||
  2338. // Fallback to seeking `elem` from the start
  2339. (diff = nodeIndex = 0) || start.pop()) ) {
  2340. // When found, cache indexes on `parent` and break
  2341. if ( node.nodeType === 1 && ++diff && node === elem ) {
  2342. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  2343. break;
  2344. }
  2345. }
  2346. } else {
  2347. // Use previously-cached element index if available
  2348. if ( useCache ) {
  2349. // ...in a gzip-friendly way
  2350. node = elem;
  2351. outerCache = node[ expando ] || (node[ expando ] = {});
  2352. // Support: IE <9 only
  2353. // Defend against cloned attroperties (jQuery gh-1709)
  2354. uniqueCache = outerCache[ node.uniqueID ] ||
  2355. (outerCache[ node.uniqueID ] = {});
  2356. cache = uniqueCache[ type ] || [];
  2357. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  2358. diff = nodeIndex;
  2359. }
  2360. // xml :nth-child(...)
  2361. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  2362. if ( diff === false ) {
  2363. // Use the same loop as above to seek `elem` from the start
  2364. while ( (node = ++nodeIndex && node && node[ dir ] ||
  2365. (diff = nodeIndex = 0) || start.pop()) ) {
  2366. if ( ( ofType ?
  2367. node.nodeName.toLowerCase() === name :
  2368. node.nodeType === 1 ) &&
  2369. ++diff ) {
  2370. // Cache the index of each encountered element
  2371. if ( useCache ) {
  2372. outerCache = node[ expando ] || (node[ expando ] = {});
  2373. // Support: IE <9 only
  2374. // Defend against cloned attroperties (jQuery gh-1709)
  2375. uniqueCache = outerCache[ node.uniqueID ] ||
  2376. (outerCache[ node.uniqueID ] = {});
  2377. uniqueCache[ type ] = [ dirruns, diff ];
  2378. }
  2379. if ( node === elem ) {
  2380. break;
  2381. }
  2382. }
  2383. }
  2384. }
  2385. }
  2386. // Incorporate the offset, then check against cycle size
  2387. diff -= last;
  2388. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  2389. }
  2390. };
  2391. },
  2392. "PSEUDO": function( pseudo, argument ) {
  2393. // pseudo-class names are case-insensitive
  2394. // http://www.w3.org/TR/selectors/#pseudo-classes
  2395. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  2396. // Remember that setFilters inherits from pseudos
  2397. var args,
  2398. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  2399. Sizzle.error( "unsupported pseudo: " + pseudo );
  2400. // The user may use createPseudo to indicate that
  2401. // arguments are needed to create the filter function
  2402. // just as Sizzle does
  2403. if ( fn[ expando ] ) {
  2404. return fn( argument );
  2405. }
  2406. // But maintain support for old signatures
  2407. if ( fn.length > 1 ) {
  2408. args = [ pseudo, pseudo, "", argument ];
  2409. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  2410. markFunction(function( seed, matches ) {
  2411. var idx,
  2412. matched = fn( seed, argument ),
  2413. i = matched.length;
  2414. while ( i-- ) {
  2415. idx = indexOf( seed, matched[i] );
  2416. seed[ idx ] = !( matches[ idx ] = matched[i] );
  2417. }
  2418. }) :
  2419. function( elem ) {
  2420. return fn( elem, 0, args );
  2421. };
  2422. }
  2423. return fn;
  2424. }
  2425. },
  2426. pseudos: {
  2427. // Potentially complex pseudos
  2428. "not": markFunction(function( selector ) {
  2429. // Trim the selector passed to compile
  2430. // to avoid treating leading and trailing
  2431. // spaces as combinators
  2432. var input = [],
  2433. results = [],
  2434. matcher = compile( selector.replace( rtrim, "$1" ) );
  2435. return matcher[ expando ] ?
  2436. markFunction(function( seed, matches, context, xml ) {
  2437. var elem,
  2438. unmatched = matcher( seed, null, xml, [] ),
  2439. i = seed.length;
  2440. // Match elements unmatched by `matcher`
  2441. while ( i-- ) {
  2442. if ( (elem = unmatched[i]) ) {
  2443. seed[i] = !(matches[i] = elem);
  2444. }
  2445. }
  2446. }) :
  2447. function( elem, context, xml ) {
  2448. input[0] = elem;
  2449. matcher( input, null, xml, results );
  2450. // Don't keep the element (issue #299)
  2451. input[0] = null;
  2452. return !results.pop();
  2453. };
  2454. }),
  2455. "has": markFunction(function( selector ) {
  2456. return function( elem ) {
  2457. return Sizzle( selector, elem ).length > 0;
  2458. };
  2459. }),
  2460. "contains": markFunction(function( text ) {
  2461. text = text.replace( runescape, funescape );
  2462. return function( elem ) {
  2463. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  2464. };
  2465. }),
  2466. // "Whether an element is represented by a :lang() selector
  2467. // is based solely on the element's language value
  2468. // being equal to the identifier C,
  2469. // or beginning with the identifier C immediately followed by "-".
  2470. // The matching of C against the element's language value is performed case-insensitively.
  2471. // The identifier C does not have to be a valid language name."
  2472. // http://www.w3.org/TR/selectors/#lang-pseudo
  2473. "lang": markFunction( function( lang ) {
  2474. // lang value must be a valid identifier
  2475. if ( !ridentifier.test(lang || "") ) {
  2476. Sizzle.error( "unsupported lang: " + lang );
  2477. }
  2478. lang = lang.replace( runescape, funescape ).toLowerCase();
  2479. return function( elem ) {
  2480. var elemLang;
  2481. do {
  2482. if ( (elemLang = documentIsHTML ?
  2483. elem.lang :
  2484. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  2485. elemLang = elemLang.toLowerCase();
  2486. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  2487. }
  2488. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  2489. return false;
  2490. };
  2491. }),
  2492. // Miscellaneous
  2493. "target": function( elem ) {
  2494. var hash = window.location && window.location.hash;
  2495. return hash && hash.slice( 1 ) === elem.id;
  2496. },
  2497. "root": function( elem ) {
  2498. return elem === docElem;
  2499. },
  2500. "focus": function( elem ) {
  2501. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  2502. },
  2503. // Boolean properties
  2504. "enabled": createDisabledPseudo( false ),
  2505. "disabled": createDisabledPseudo( true ),
  2506. "checked": function( elem ) {
  2507. // In CSS3, :checked should return both checked and selected elements
  2508. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  2509. var nodeName = elem.nodeName.toLowerCase();
  2510. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  2511. },
  2512. "selected": function( elem ) {
  2513. // Accessing this property makes selected-by-default
  2514. // options in Safari work properly
  2515. if ( elem.parentNode ) {
  2516. elem.parentNode.selectedIndex;
  2517. }
  2518. return elem.selected === true;
  2519. },
  2520. // Contents
  2521. "empty": function( elem ) {
  2522. // http://www.w3.org/TR/selectors/#empty-pseudo
  2523. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  2524. // but not by others (comment: 8; processing instruction: 7; etc.)
  2525. // nodeType < 6 works because attributes (2) do not appear as children
  2526. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  2527. if ( elem.nodeType < 6 ) {
  2528. return false;
  2529. }
  2530. }
  2531. return true;
  2532. },
  2533. "parent": function( elem ) {
  2534. return !Expr.pseudos["empty"]( elem );
  2535. },
  2536. // Element/input types
  2537. "header": function( elem ) {
  2538. return rheader.test( elem.nodeName );
  2539. },
  2540. "input": function( elem ) {
  2541. return rinputs.test( elem.nodeName );
  2542. },
  2543. "button": function( elem ) {
  2544. var name = elem.nodeName.toLowerCase();
  2545. return name === "input" && elem.type === "button" || name === "button";
  2546. },
  2547. "text": function( elem ) {
  2548. var attr;
  2549. return elem.nodeName.toLowerCase() === "input" &&
  2550. elem.type === "text" &&
  2551. // Support: IE<8
  2552. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  2553. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  2554. },
  2555. // Position-in-collection
  2556. "first": createPositionalPseudo(function() {
  2557. return [ 0 ];
  2558. }),
  2559. "last": createPositionalPseudo(function( matchIndexes, length ) {
  2560. return [ length - 1 ];
  2561. }),
  2562. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  2563. return [ argument < 0 ? argument + length : argument ];
  2564. }),
  2565. "even": createPositionalPseudo(function( matchIndexes, length ) {
  2566. var i = 0;
  2567. for ( ; i < length; i += 2 ) {
  2568. matchIndexes.push( i );
  2569. }
  2570. return matchIndexes;
  2571. }),
  2572. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  2573. var i = 1;
  2574. for ( ; i < length; i += 2 ) {
  2575. matchIndexes.push( i );
  2576. }
  2577. return matchIndexes;
  2578. }),
  2579. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  2580. var i = argument < 0 ?
  2581. argument + length :
  2582. argument > length ?
  2583. length :
  2584. argument;
  2585. for ( ; --i >= 0; ) {
  2586. matchIndexes.push( i );
  2587. }
  2588. return matchIndexes;
  2589. }),
  2590. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  2591. var i = argument < 0 ? argument + length : argument;
  2592. for ( ; ++i < length; ) {
  2593. matchIndexes.push( i );
  2594. }
  2595. return matchIndexes;
  2596. })
  2597. }
  2598. };
  2599. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  2600. // Add button/input type pseudos
  2601. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  2602. Expr.pseudos[ i ] = createInputPseudo( i );
  2603. }
  2604. for ( i in { submit: true, reset: true } ) {
  2605. Expr.pseudos[ i ] = createButtonPseudo( i );
  2606. }
  2607. // Easy API for creating new setFilters
  2608. function setFilters() {}
  2609. setFilters.prototype = Expr.filters = Expr.pseudos;
  2610. Expr.setFilters = new setFilters();
  2611. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  2612. var matched, match, tokens, type,
  2613. soFar, groups, preFilters,
  2614. cached = tokenCache[ selector + " " ];
  2615. if ( cached ) {
  2616. return parseOnly ? 0 : cached.slice( 0 );
  2617. }
  2618. soFar = selector;
  2619. groups = [];
  2620. preFilters = Expr.preFilter;
  2621. while ( soFar ) {
  2622. // Comma and first run
  2623. if ( !matched || (match = rcomma.exec( soFar )) ) {
  2624. if ( match ) {
  2625. // Don't consume trailing commas as valid
  2626. soFar = soFar.slice( match[0].length ) || soFar;
  2627. }
  2628. groups.push( (tokens = []) );
  2629. }
  2630. matched = false;
  2631. // Combinators
  2632. if ( (match = rcombinators.exec( soFar )) ) {
  2633. matched = match.shift();
  2634. tokens.push({
  2635. value: matched,
  2636. // Cast descendant combinators to space
  2637. type: match[0].replace( rtrim, " " )
  2638. });
  2639. soFar = soFar.slice( matched.length );
  2640. }
  2641. // Filters
  2642. for ( type in Expr.filter ) {
  2643. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  2644. (match = preFilters[ type ]( match ))) ) {
  2645. matched = match.shift();
  2646. tokens.push({
  2647. value: matched,
  2648. type: type,
  2649. matches: match
  2650. });
  2651. soFar = soFar.slice( matched.length );
  2652. }
  2653. }
  2654. if ( !matched ) {
  2655. break;
  2656. }
  2657. }
  2658. // Return the length of the invalid excess
  2659. // if we're just parsing
  2660. // Otherwise, throw an error or return tokens
  2661. return parseOnly ?
  2662. soFar.length :
  2663. soFar ?
  2664. Sizzle.error( selector ) :
  2665. // Cache the tokens
  2666. tokenCache( selector, groups ).slice( 0 );
  2667. };
  2668. function toSelector( tokens ) {
  2669. var i = 0,
  2670. len = tokens.length,
  2671. selector = "";
  2672. for ( ; i < len; i++ ) {
  2673. selector += tokens[i].value;
  2674. }
  2675. return selector;
  2676. }
  2677. function addCombinator( matcher, combinator, base ) {
  2678. var dir = combinator.dir,
  2679. skip = combinator.next,
  2680. key = skip || dir,
  2681. checkNonElements = base && key === "parentNode",
  2682. doneName = done++;
  2683. return combinator.first ?
  2684. // Check against closest ancestor/preceding element
  2685. function( elem, context, xml ) {
  2686. while ( (elem = elem[ dir ]) ) {
  2687. if ( elem.nodeType === 1 || checkNonElements ) {
  2688. return matcher( elem, context, xml );
  2689. }
  2690. }
  2691. return false;
  2692. } :
  2693. // Check against all ancestor/preceding elements
  2694. function( elem, context, xml ) {
  2695. var oldCache, uniqueCache, outerCache,
  2696. newCache = [ dirruns, doneName ];
  2697. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  2698. if ( xml ) {
  2699. while ( (elem = elem[ dir ]) ) {
  2700. if ( elem.nodeType === 1 || checkNonElements ) {
  2701. if ( matcher( elem, context, xml ) ) {
  2702. return true;
  2703. }
  2704. }
  2705. }
  2706. } else {
  2707. while ( (elem = elem[ dir ]) ) {
  2708. if ( elem.nodeType === 1 || checkNonElements ) {
  2709. outerCache = elem[ expando ] || (elem[ expando ] = {});
  2710. // Support: IE <9 only
  2711. // Defend against cloned attroperties (jQuery gh-1709)
  2712. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  2713. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  2714. elem = elem[ dir ] || elem;
  2715. } else if ( (oldCache = uniqueCache[ key ]) &&
  2716. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  2717. // Assign to newCache so results back-propagate to previous elements
  2718. return (newCache[ 2 ] = oldCache[ 2 ]);
  2719. } else {
  2720. // Reuse newcache so results back-propagate to previous elements
  2721. uniqueCache[ key ] = newCache;
  2722. // A match means we're done; a fail means we have to keep checking
  2723. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  2724. return true;
  2725. }
  2726. }
  2727. }
  2728. }
  2729. }
  2730. return false;
  2731. };
  2732. }
  2733. function elementMatcher( matchers ) {
  2734. return matchers.length > 1 ?
  2735. function( elem, context, xml ) {
  2736. var i = matchers.length;
  2737. while ( i-- ) {
  2738. if ( !matchers[i]( elem, context, xml ) ) {
  2739. return false;
  2740. }
  2741. }
  2742. return true;
  2743. } :
  2744. matchers[0];
  2745. }
  2746. function multipleContexts( selector, contexts, results ) {
  2747. var i = 0,
  2748. len = contexts.length;
  2749. for ( ; i < len; i++ ) {
  2750. Sizzle( selector, contexts[i], results );
  2751. }
  2752. return results;
  2753. }
  2754. function condense( unmatched, map, filter, context, xml ) {
  2755. var elem,
  2756. newUnmatched = [],
  2757. i = 0,
  2758. len = unmatched.length,
  2759. mapped = map != null;
  2760. for ( ; i < len; i++ ) {
  2761. if ( (elem = unmatched[i]) ) {
  2762. if ( !filter || filter( elem, context, xml ) ) {
  2763. newUnmatched.push( elem );
  2764. if ( mapped ) {
  2765. map.push( i );
  2766. }
  2767. }
  2768. }
  2769. }
  2770. return newUnmatched;
  2771. }
  2772. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  2773. if ( postFilter && !postFilter[ expando ] ) {
  2774. postFilter = setMatcher( postFilter );
  2775. }
  2776. if ( postFinder && !postFinder[ expando ] ) {
  2777. postFinder = setMatcher( postFinder, postSelector );
  2778. }
  2779. return markFunction(function( seed, results, context, xml ) {
  2780. var temp, i, elem,
  2781. preMap = [],
  2782. postMap = [],
  2783. preexisting = results.length,
  2784. // Get initial elements from seed or context
  2785. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  2786. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  2787. matcherIn = preFilter && ( seed || !selector ) ?
  2788. condense( elems, preMap, preFilter, context, xml ) :
  2789. elems,
  2790. matcherOut = matcher ?
  2791. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  2792. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  2793. // ...intermediate processing is necessary
  2794. [] :
  2795. // ...otherwise use results directly
  2796. results :
  2797. matcherIn;
  2798. // Find primary matches
  2799. if ( matcher ) {
  2800. matcher( matcherIn, matcherOut, context, xml );
  2801. }
  2802. // Apply postFilter
  2803. if ( postFilter ) {
  2804. temp = condense( matcherOut, postMap );
  2805. postFilter( temp, [], context, xml );
  2806. // Un-match failing elements by moving them back to matcherIn
  2807. i = temp.length;
  2808. while ( i-- ) {
  2809. if ( (elem = temp[i]) ) {
  2810. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  2811. }
  2812. }
  2813. }
  2814. if ( seed ) {
  2815. if ( postFinder || preFilter ) {
  2816. if ( postFinder ) {
  2817. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  2818. temp = [];
  2819. i = matcherOut.length;
  2820. while ( i-- ) {
  2821. if ( (elem = matcherOut[i]) ) {
  2822. // Restore matcherIn since elem is not yet a final match
  2823. temp.push( (matcherIn[i] = elem) );
  2824. }
  2825. }
  2826. postFinder( null, (matcherOut = []), temp, xml );
  2827. }
  2828. // Move matched elements from seed to results to keep them synchronized
  2829. i = matcherOut.length;
  2830. while ( i-- ) {
  2831. if ( (elem = matcherOut[i]) &&
  2832. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  2833. seed[temp] = !(results[temp] = elem);
  2834. }
  2835. }
  2836. }
  2837. // Add elements to results, through postFinder if defined
  2838. } else {
  2839. matcherOut = condense(
  2840. matcherOut === results ?
  2841. matcherOut.splice( preexisting, matcherOut.length ) :
  2842. matcherOut
  2843. );
  2844. if ( postFinder ) {
  2845. postFinder( null, results, matcherOut, xml );
  2846. } else {
  2847. push.apply( results, matcherOut );
  2848. }
  2849. }
  2850. });
  2851. }
  2852. function matcherFromTokens( tokens ) {
  2853. var checkContext, matcher, j,
  2854. len = tokens.length,
  2855. leadingRelative = Expr.relative[ tokens[0].type ],
  2856. implicitRelative = leadingRelative || Expr.relative[" "],
  2857. i = leadingRelative ? 1 : 0,
  2858. // The foundational matcher ensures that elements are reachable from top-level context(s)
  2859. matchContext = addCombinator( function( elem ) {
  2860. return elem === checkContext;
  2861. }, implicitRelative, true ),
  2862. matchAnyContext = addCombinator( function( elem ) {
  2863. return indexOf( checkContext, elem ) > -1;
  2864. }, implicitRelative, true ),
  2865. matchers = [ function( elem, context, xml ) {
  2866. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  2867. (checkContext = context).nodeType ?
  2868. matchContext( elem, context, xml ) :
  2869. matchAnyContext( elem, context, xml ) );
  2870. // Avoid hanging onto element (issue #299)
  2871. checkContext = null;
  2872. return ret;
  2873. } ];
  2874. for ( ; i < len; i++ ) {
  2875. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  2876. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  2877. } else {
  2878. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  2879. // Return special upon seeing a positional matcher
  2880. if ( matcher[ expando ] ) {
  2881. // Find the next relative operator (if any) for proper handling
  2882. j = ++i;
  2883. for ( ; j < len; j++ ) {
  2884. if ( Expr.relative[ tokens[j].type ] ) {
  2885. break;
  2886. }
  2887. }
  2888. return setMatcher(
  2889. i > 1 && elementMatcher( matchers ),
  2890. i > 1 && toSelector(
  2891. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  2892. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  2893. ).replace( rtrim, "$1" ),
  2894. matcher,
  2895. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  2896. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  2897. j < len && toSelector( tokens )
  2898. );
  2899. }
  2900. matchers.push( matcher );
  2901. }
  2902. }
  2903. return elementMatcher( matchers );
  2904. }
  2905. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  2906. var bySet = setMatchers.length > 0,
  2907. byElement = elementMatchers.length > 0,
  2908. superMatcher = function( seed, context, xml, results, outermost ) {
  2909. var elem, j, matcher,
  2910. matchedCount = 0,
  2911. i = "0",
  2912. unmatched = seed && [],
  2913. setMatched = [],
  2914. contextBackup = outermostContext,
  2915. // We must always have either seed elements or outermost context
  2916. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  2917. // Use integer dirruns iff this is the outermost matcher
  2918. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  2919. len = elems.length;
  2920. if ( outermost ) {
  2921. outermostContext = context === document || context || outermost;
  2922. }
  2923. // Add elements passing elementMatchers directly to results
  2924. // Support: IE<9, Safari
  2925. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  2926. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  2927. if ( byElement && elem ) {
  2928. j = 0;
  2929. if ( !context && elem.ownerDocument !== document ) {
  2930. setDocument( elem );
  2931. xml = !documentIsHTML;
  2932. }
  2933. while ( (matcher = elementMatchers[j++]) ) {
  2934. if ( matcher( elem, context || document, xml) ) {
  2935. results.push( elem );
  2936. break;
  2937. }
  2938. }
  2939. if ( outermost ) {
  2940. dirruns = dirrunsUnique;
  2941. }
  2942. }
  2943. // Track unmatched elements for set filters
  2944. if ( bySet ) {
  2945. // They will have gone through all possible matchers
  2946. if ( (elem = !matcher && elem) ) {
  2947. matchedCount--;
  2948. }
  2949. // Lengthen the array for every element, matched or not
  2950. if ( seed ) {
  2951. unmatched.push( elem );
  2952. }
  2953. }
  2954. }
  2955. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  2956. // makes the latter nonnegative.
  2957. matchedCount += i;
  2958. // Apply set filters to unmatched elements
  2959. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  2960. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  2961. // no element matchers and no seed.
  2962. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  2963. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  2964. // numerically zero.
  2965. if ( bySet && i !== matchedCount ) {
  2966. j = 0;
  2967. while ( (matcher = setMatchers[j++]) ) {
  2968. matcher( unmatched, setMatched, context, xml );
  2969. }
  2970. if ( seed ) {
  2971. // Reintegrate element matches to eliminate the need for sorting
  2972. if ( matchedCount > 0 ) {
  2973. while ( i-- ) {
  2974. if ( !(unmatched[i] || setMatched[i]) ) {
  2975. setMatched[i] = pop.call( results );
  2976. }
  2977. }
  2978. }
  2979. // Discard index placeholder values to get only actual matches
  2980. setMatched = condense( setMatched );
  2981. }
  2982. // Add matches to results
  2983. push.apply( results, setMatched );
  2984. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  2985. if ( outermost && !seed && setMatched.length > 0 &&
  2986. ( matchedCount + setMatchers.length ) > 1 ) {
  2987. Sizzle.uniqueSort( results );
  2988. }
  2989. }
  2990. // Override manipulation of globals by nested matchers
  2991. if ( outermost ) {
  2992. dirruns = dirrunsUnique;
  2993. outermostContext = contextBackup;
  2994. }
  2995. return unmatched;
  2996. };
  2997. return bySet ?
  2998. markFunction( superMatcher ) :
  2999. superMatcher;
  3000. }
  3001. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  3002. var i,
  3003. setMatchers = [],
  3004. elementMatchers = [],
  3005. cached = compilerCache[ selector + " " ];
  3006. if ( !cached ) {
  3007. // Generate a function of recursive functions that can be used to check each element
  3008. if ( !match ) {
  3009. match = tokenize( selector );
  3010. }
  3011. i = match.length;
  3012. while ( i-- ) {
  3013. cached = matcherFromTokens( match[i] );
  3014. if ( cached[ expando ] ) {
  3015. setMatchers.push( cached );
  3016. } else {
  3017. elementMatchers.push( cached );
  3018. }
  3019. }
  3020. // Cache the compiled function
  3021. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  3022. // Save selector and tokenization
  3023. cached.selector = selector;
  3024. }
  3025. return cached;
  3026. };
  3027. /**
  3028. * A low-level selection function that works with Sizzle's compiled
  3029. * selector functions
  3030. * @param {String|Function} selector A selector or a pre-compiled
  3031. * selector function built with Sizzle.compile
  3032. * @param {Element} context
  3033. * @param {Array} [results]
  3034. * @param {Array} [seed] A set of elements to match against
  3035. */
  3036. select = Sizzle.select = function( selector, context, results, seed ) {
  3037. var i, tokens, token, type, find,
  3038. compiled = typeof selector === "function" && selector,
  3039. match = !seed && tokenize( (selector = compiled.selector || selector) );
  3040. results = results || [];
  3041. // Try to minimize operations if there is only one selector in the list and no seed
  3042. // (the latter of which guarantees us context)
  3043. if ( match.length === 1 ) {
  3044. // Reduce context if the leading compound selector is an ID
  3045. tokens = match[0] = match[0].slice( 0 );
  3046. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  3047. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  3048. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  3049. if ( !context ) {
  3050. return results;
  3051. // Precompiled matchers will still verify ancestry, so step up a level
  3052. } else if ( compiled ) {
  3053. context = context.parentNode;
  3054. }
  3055. selector = selector.slice( tokens.shift().value.length );
  3056. }
  3057. // Fetch a seed set for right-to-left matching
  3058. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  3059. while ( i-- ) {
  3060. token = tokens[i];
  3061. // Abort if we hit a combinator
  3062. if ( Expr.relative[ (type = token.type) ] ) {
  3063. break;
  3064. }
  3065. if ( (find = Expr.find[ type ]) ) {
  3066. // Search, expanding context for leading sibling combinators
  3067. if ( (seed = find(
  3068. token.matches[0].replace( runescape, funescape ),
  3069. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  3070. )) ) {
  3071. // If seed is empty or no tokens remain, we can return early
  3072. tokens.splice( i, 1 );
  3073. selector = seed.length && toSelector( tokens );
  3074. if ( !selector ) {
  3075. push.apply( results, seed );
  3076. return results;
  3077. }
  3078. break;
  3079. }
  3080. }
  3081. }
  3082. }
  3083. // Compile and execute a filtering function if one is not provided
  3084. // Provide `match` to avoid retokenization if we modified the selector above
  3085. ( compiled || compile( selector, match ) )(
  3086. seed,
  3087. context,
  3088. !documentIsHTML,
  3089. results,
  3090. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  3091. );
  3092. return results;
  3093. };
  3094. // One-time assignments
  3095. // Sort stability
  3096. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  3097. // Support: Chrome 14-35+
  3098. // Always assume duplicates if they aren't passed to the comparison function
  3099. support.detectDuplicates = !!hasDuplicate;
  3100. // Initialize against the default document
  3101. setDocument();
  3102. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  3103. // Detached nodes confoundingly follow *each other*
  3104. support.sortDetached = assert(function( el ) {
  3105. // Should return 1, but returns 4 (following)
  3106. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  3107. });
  3108. // Support: IE<8
  3109. // Prevent attribute/property "interpolation"
  3110. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  3111. if ( !assert(function( el ) {
  3112. el.innerHTML = "<a href='#'></a>";
  3113. return el.firstChild.getAttribute("href") === "#" ;
  3114. }) ) {
  3115. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  3116. if ( !isXML ) {
  3117. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  3118. }
  3119. });
  3120. }
  3121. // Support: IE<9
  3122. // Use defaultValue in place of getAttribute("value")
  3123. if ( !support.attributes || !assert(function( el ) {
  3124. el.innerHTML = "<input/>";
  3125. el.firstChild.setAttribute( "value", "" );
  3126. return el.firstChild.getAttribute( "value" ) === "";
  3127. }) ) {
  3128. addHandle( "value", function( elem, name, isXML ) {
  3129. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  3130. return elem.defaultValue;
  3131. }
  3132. });
  3133. }
  3134. // Support: IE<9
  3135. // Use getAttributeNode to fetch booleans when getAttribute lies
  3136. if ( !assert(function( el ) {
  3137. return el.getAttribute("disabled") == null;
  3138. }) ) {
  3139. addHandle( booleans, function( elem, name, isXML ) {
  3140. var val;
  3141. if ( !isXML ) {
  3142. return elem[ name ] === true ? name.toLowerCase() :
  3143. (val = elem.getAttributeNode( name )) && val.specified ?
  3144. val.value :
  3145. null;
  3146. }
  3147. });
  3148. }
  3149. return Sizzle;
  3150. })( window );
  3151. jQuery.find = Sizzle;
  3152. jQuery.expr = Sizzle.selectors;
  3153. // Deprecated
  3154. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  3155. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  3156. jQuery.text = Sizzle.getText;
  3157. jQuery.isXMLDoc = Sizzle.isXML;
  3158. jQuery.contains = Sizzle.contains;
  3159. jQuery.escapeSelector = Sizzle.escape;
  3160. var dir = function( elem, dir, until ) {
  3161. var matched = [],
  3162. truncate = until !== undefined;
  3163. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  3164. if ( elem.nodeType === 1 ) {
  3165. if ( truncate && jQuery( elem ).is( until ) ) {
  3166. break;
  3167. }
  3168. matched.push( elem );
  3169. }
  3170. }
  3171. return matched;
  3172. };
  3173. var siblings = function( n, elem ) {
  3174. var matched = [];
  3175. for ( ; n; n = n.nextSibling ) {
  3176. if ( n.nodeType === 1 && n !== elem ) {
  3177. matched.push( n );
  3178. }
  3179. }
  3180. return matched;
  3181. };
  3182. var rneedsContext = jQuery.expr.match.needsContext;
  3183. function nodeName( elem, name ) {
  3184. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  3185. };
  3186. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  3187. // Implement the identical functionality for filter and not
  3188. function winnow( elements, qualifier, not ) {
  3189. if ( isFunction( qualifier ) ) {
  3190. return jQuery.grep( elements, function( elem, i ) {
  3191. return !!qualifier.call( elem, i, elem ) !== not;
  3192. } );
  3193. }
  3194. // Single element
  3195. if ( qualifier.nodeType ) {
  3196. return jQuery.grep( elements, function( elem ) {
  3197. return ( elem === qualifier ) !== not;
  3198. } );
  3199. }
  3200. // Arraylike of elements (jQuery, arguments, Array)
  3201. if ( typeof qualifier !== "string" ) {
  3202. return jQuery.grep( elements, function( elem ) {
  3203. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  3204. } );
  3205. }
  3206. // Filtered directly for both simple and complex selectors
  3207. return jQuery.filter( qualifier, elements, not );
  3208. }
  3209. jQuery.filter = function( expr, elems, not ) {
  3210. var elem = elems[ 0 ];
  3211. if ( not ) {
  3212. expr = ":not(" + expr + ")";
  3213. }
  3214. if ( elems.length === 1 && elem.nodeType === 1 ) {
  3215. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  3216. }
  3217. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  3218. return elem.nodeType === 1;
  3219. } ) );
  3220. };
  3221. jQuery.fn.extend( {
  3222. find: function( selector ) {
  3223. var i, ret,
  3224. len = this.length,
  3225. self = this;
  3226. if ( typeof selector !== "string" ) {
  3227. return this.pushStack( jQuery( selector ).filter( function() {
  3228. for ( i = 0; i < len; i++ ) {
  3229. if ( jQuery.contains( self[ i ], this ) ) {
  3230. return true;
  3231. }
  3232. }
  3233. } ) );
  3234. }
  3235. ret = this.pushStack( [] );
  3236. for ( i = 0; i < len; i++ ) {
  3237. jQuery.find( selector, self[ i ], ret );
  3238. }
  3239. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  3240. },
  3241. filter: function( selector ) {
  3242. return this.pushStack( winnow( this, selector || [], false ) );
  3243. },
  3244. not: function( selector ) {
  3245. return this.pushStack( winnow( this, selector || [], true ) );
  3246. },
  3247. is: function( selector ) {
  3248. return !!winnow(
  3249. this,
  3250. // If this is a positional/relative selector, check membership in the returned set
  3251. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  3252. typeof selector === "string" && rneedsContext.test( selector ) ?
  3253. jQuery( selector ) :
  3254. selector || [],
  3255. false
  3256. ).length;
  3257. }
  3258. } );
  3259. // Initialize a jQuery object
  3260. // A central reference to the root jQuery(document)
  3261. var rootjQuery,
  3262. // A simple way to check for HTML strings
  3263. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  3264. // Strict HTML recognition (#11290: must start with <)
  3265. // Shortcut simple #id case for speed
  3266. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  3267. init = jQuery.fn.init = function( selector, context, root ) {
  3268. var match, elem;
  3269. // HANDLE: $(""), $(null), $(undefined), $(false)
  3270. if ( !selector ) {
  3271. return this;
  3272. }
  3273. // Method init() accepts an alternate rootjQuery
  3274. // so migrate can support jQuery.sub (gh-2101)
  3275. root = root || rootjQuery;
  3276. // Handle HTML strings
  3277. if ( typeof selector === "string" ) {
  3278. if ( selector[ 0 ] === "<" &&
  3279. selector[ selector.length - 1 ] === ">" &&
  3280. selector.length >= 3 ) {
  3281. // Assume that strings that start and end with <> are HTML and skip the regex check
  3282. match = [ null, selector, null ];
  3283. } else {
  3284. match = rquickExpr.exec( selector );
  3285. }
  3286. // Match html or make sure no context is specified for #id
  3287. if ( match && ( match[ 1 ] || !context ) ) {
  3288. // HANDLE: $(html) -> $(array)
  3289. if ( match[ 1 ] ) {
  3290. context = context instanceof jQuery ? context[ 0 ] : context;
  3291. // Option to run scripts is true for back-compat
  3292. // Intentionally let the error be thrown if parseHTML is not present
  3293. jQuery.merge( this, jQuery.parseHTML(
  3294. match[ 1 ],
  3295. context && context.nodeType ? context.ownerDocument || context : document,
  3296. true
  3297. ) );
  3298. // HANDLE: $(html, props)
  3299. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  3300. for ( match in context ) {
  3301. // Properties of context are called as methods if possible
  3302. if ( isFunction( this[ match ] ) ) {
  3303. this[ match ]( context[ match ] );
  3304. // ...and otherwise set as attributes
  3305. } else {
  3306. this.attr( match, context[ match ] );
  3307. }
  3308. }
  3309. }
  3310. return this;
  3311. // HANDLE: $(#id)
  3312. } else {
  3313. elem = document.getElementById( match[ 2 ] );
  3314. if ( elem ) {
  3315. // Inject the element directly into the jQuery object
  3316. this[ 0 ] = elem;
  3317. this.length = 1;
  3318. }
  3319. return this;
  3320. }
  3321. // HANDLE: $(expr, $(...))
  3322. } else if ( !context || context.jquery ) {
  3323. return ( context || root ).find( selector );
  3324. // HANDLE: $(expr, context)
  3325. // (which is just equivalent to: $(context).find(expr)
  3326. } else {
  3327. return this.constructor( context ).find( selector );
  3328. }
  3329. // HANDLE: $(DOMElement)
  3330. } else if ( selector.nodeType ) {
  3331. this[ 0 ] = selector;
  3332. this.length = 1;
  3333. return this;
  3334. // HANDLE: $(function)
  3335. // Shortcut for document ready
  3336. } else if ( isFunction( selector ) ) {
  3337. return root.ready !== undefined ?
  3338. root.ready( selector ) :
  3339. // Execute immediately if ready is not present
  3340. selector( jQuery );
  3341. }
  3342. return jQuery.makeArray( selector, this );
  3343. };
  3344. // Give the init function the jQuery prototype for later instantiation
  3345. init.prototype = jQuery.fn;
  3346. // Initialize central reference
  3347. rootjQuery = jQuery( document );
  3348. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  3349. // Methods guaranteed to produce a unique set when starting from a unique set
  3350. guaranteedUnique = {
  3351. children: true,
  3352. contents: true,
  3353. next: true,
  3354. prev: true
  3355. };
  3356. jQuery.fn.extend( {
  3357. has: function( target ) {
  3358. var targets = jQuery( target, this ),
  3359. l = targets.length;
  3360. return this.filter( function() {
  3361. var i = 0;
  3362. for ( ; i < l; i++ ) {
  3363. if ( jQuery.contains( this, targets[ i ] ) ) {
  3364. return true;
  3365. }
  3366. }
  3367. } );
  3368. },
  3369. closest: function( selectors, context ) {
  3370. var cur,
  3371. i = 0,
  3372. l = this.length,
  3373. matched = [],
  3374. targets = typeof selectors !== "string" && jQuery( selectors );
  3375. // Positional selectors never match, since there's no _selection_ context
  3376. if ( !rneedsContext.test( selectors ) ) {
  3377. for ( ; i < l; i++ ) {
  3378. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  3379. // Always skip document fragments
  3380. if ( cur.nodeType < 11 && ( targets ?
  3381. targets.index( cur ) > -1 :
  3382. // Don't pass non-elements to Sizzle
  3383. cur.nodeType === 1 &&
  3384. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  3385. matched.push( cur );
  3386. break;
  3387. }
  3388. }
  3389. }
  3390. }
  3391. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  3392. },
  3393. // Determine the position of an element within the set
  3394. index: function( elem ) {
  3395. // No argument, return index in parent
  3396. if ( !elem ) {
  3397. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  3398. }
  3399. // Index in selector
  3400. if ( typeof elem === "string" ) {
  3401. return indexOf.call( jQuery( elem ), this[ 0 ] );
  3402. }
  3403. // Locate the position of the desired element
  3404. return indexOf.call( this,
  3405. // If it receives a jQuery object, the first element is used
  3406. elem.jquery ? elem[ 0 ] : elem
  3407. );
  3408. },
  3409. add: function( selector, context ) {
  3410. return this.pushStack(
  3411. jQuery.uniqueSort(
  3412. jQuery.merge( this.get(), jQuery( selector, context ) )
  3413. )
  3414. );
  3415. },
  3416. addBack: function( selector ) {
  3417. return this.add( selector == null ?
  3418. this.prevObject : this.prevObject.filter( selector )
  3419. );
  3420. }
  3421. } );
  3422. function sibling( cur, dir ) {
  3423. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  3424. return cur;
  3425. }
  3426. jQuery.each( {
  3427. parent: function( elem ) {
  3428. var parent = elem.parentNode;
  3429. return parent && parent.nodeType !== 11 ? parent : null;
  3430. },
  3431. parents: function( elem ) {
  3432. return dir( elem, "parentNode" );
  3433. },
  3434. parentsUntil: function( elem, i, until ) {
  3435. return dir( elem, "parentNode", until );
  3436. },
  3437. next: function( elem ) {
  3438. return sibling( elem, "nextSibling" );
  3439. },
  3440. prev: function( elem ) {
  3441. return sibling( elem, "previousSibling" );
  3442. },
  3443. nextAll: function( elem ) {
  3444. return dir( elem, "nextSibling" );
  3445. },
  3446. prevAll: function( elem ) {
  3447. return dir( elem, "previousSibling" );
  3448. },
  3449. nextUntil: function( elem, i, until ) {
  3450. return dir( elem, "nextSibling", until );
  3451. },
  3452. prevUntil: function( elem, i, until ) {
  3453. return dir( elem, "previousSibling", until );
  3454. },
  3455. siblings: function( elem ) {
  3456. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  3457. },
  3458. children: function( elem ) {
  3459. return siblings( elem.firstChild );
  3460. },
  3461. contents: function( elem ) {
  3462. if ( typeof elem.contentDocument !== "undefined" ) {
  3463. return elem.contentDocument;
  3464. }
  3465. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  3466. // Treat the template element as a regular one in browsers that
  3467. // don't support it.
  3468. if ( nodeName( elem, "template" ) ) {
  3469. elem = elem.content || elem;
  3470. }
  3471. return jQuery.merge( [], elem.childNodes );
  3472. }
  3473. }, function( name, fn ) {
  3474. jQuery.fn[ name ] = function( until, selector ) {
  3475. var matched = jQuery.map( this, fn, until );
  3476. if ( name.slice( -5 ) !== "Until" ) {
  3477. selector = until;
  3478. }
  3479. if ( selector && typeof selector === "string" ) {
  3480. matched = jQuery.filter( selector, matched );
  3481. }
  3482. if ( this.length > 1 ) {
  3483. // Remove duplicates
  3484. if ( !guaranteedUnique[ name ] ) {
  3485. jQuery.uniqueSort( matched );
  3486. }
  3487. // Reverse order for parents* and prev-derivatives
  3488. if ( rparentsprev.test( name ) ) {
  3489. matched.reverse();
  3490. }
  3491. }
  3492. return this.pushStack( matched );
  3493. };
  3494. } );
  3495. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  3496. // Convert String-formatted options into Object-formatted ones
  3497. function createOptions( options ) {
  3498. var object = {};
  3499. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  3500. object[ flag ] = true;
  3501. } );
  3502. return object;
  3503. }
  3504. /*
  3505. * Create a callback list using the following parameters:
  3506. *
  3507. * options: an optional list of space-separated options that will change how
  3508. * the callback list behaves or a more traditional option object
  3509. *
  3510. * By default a callback list will act like an event callback list and can be
  3511. * "fired" multiple times.
  3512. *
  3513. * Possible options:
  3514. *
  3515. * once: will ensure the callback list can only be fired once (like a Deferred)
  3516. *
  3517. * memory: will keep track of previous values and will call any callback added
  3518. * after the list has been fired right away with the latest "memorized"
  3519. * values (like a Deferred)
  3520. *
  3521. * unique: will ensure a callback can only be added once (no duplicate in the list)
  3522. *
  3523. * stopOnFalse: interrupt callings when a callback returns false
  3524. *
  3525. */
  3526. jQuery.Callbacks = function( options ) {
  3527. // Convert options from String-formatted to Object-formatted if needed
  3528. // (we check in cache first)
  3529. options = typeof options === "string" ?
  3530. createOptions( options ) :
  3531. jQuery.extend( {}, options );
  3532. var // Flag to know if list is currently firing
  3533. firing,
  3534. // Last fire value for non-forgettable lists
  3535. memory,
  3536. // Flag to know if list was already fired
  3537. fired,
  3538. // Flag to prevent firing
  3539. locked,
  3540. // Actual callback list
  3541. list = [],
  3542. // Queue of execution data for repeatable lists
  3543. queue = [],
  3544. // Index of currently firing callback (modified by add/remove as needed)
  3545. firingIndex = -1,
  3546. // Fire callbacks
  3547. fire = function() {
  3548. // Enforce single-firing
  3549. locked = locked || options.once;
  3550. // Execute callbacks for all pending executions,
  3551. // respecting firingIndex overrides and runtime changes
  3552. fired = firing = true;
  3553. for ( ; queue.length; firingIndex = -1 ) {
  3554. memory = queue.shift();
  3555. while ( ++firingIndex < list.length ) {
  3556. // Run callback and check for early termination
  3557. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  3558. options.stopOnFalse ) {
  3559. // Jump to end and forget the data so .add doesn't re-fire
  3560. firingIndex = list.length;
  3561. memory = false;
  3562. }
  3563. }
  3564. }
  3565. // Forget the data if we're done with it
  3566. if ( !options.memory ) {
  3567. memory = false;
  3568. }
  3569. firing = false;
  3570. // Clean up if we're done firing for good
  3571. if ( locked ) {
  3572. // Keep an empty list if we have data for future add calls
  3573. if ( memory ) {
  3574. list = [];
  3575. // Otherwise, this object is spent
  3576. } else {
  3577. list = "";
  3578. }
  3579. }
  3580. },
  3581. // Actual Callbacks object
  3582. self = {
  3583. // Add a callback or a collection of callbacks to the list
  3584. add: function() {
  3585. if ( list ) {
  3586. // If we have memory from a past run, we should fire after adding
  3587. if ( memory && !firing ) {
  3588. firingIndex = list.length - 1;
  3589. queue.push( memory );
  3590. }
  3591. ( function add( args ) {
  3592. jQuery.each( args, function( _, arg ) {
  3593. if ( isFunction( arg ) ) {
  3594. if ( !options.unique || !self.has( arg ) ) {
  3595. list.push( arg );
  3596. }
  3597. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  3598. // Inspect recursively
  3599. add( arg );
  3600. }
  3601. } );
  3602. } )( arguments );
  3603. if ( memory && !firing ) {
  3604. fire();
  3605. }
  3606. }
  3607. return this;
  3608. },
  3609. // Remove a callback from the list
  3610. remove: function() {
  3611. jQuery.each( arguments, function( _, arg ) {
  3612. var index;
  3613. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  3614. list.splice( index, 1 );
  3615. // Handle firing indexes
  3616. if ( index <= firingIndex ) {
  3617. firingIndex--;
  3618. }
  3619. }
  3620. } );
  3621. return this;
  3622. },
  3623. // Check if a given callback is in the list.
  3624. // If no argument is given, return whether or not list has callbacks attached.
  3625. has: function( fn ) {
  3626. return fn ?
  3627. jQuery.inArray( fn, list ) > -1 :
  3628. list.length > 0;
  3629. },
  3630. // Remove all callbacks from the list
  3631. empty: function() {
  3632. if ( list ) {
  3633. list = [];
  3634. }
  3635. return this;
  3636. },
  3637. // Disable .fire and .add
  3638. // Abort any current/pending executions
  3639. // Clear all callbacks and values
  3640. disable: function() {
  3641. locked = queue = [];
  3642. list = memory = "";
  3643. return this;
  3644. },
  3645. disabled: function() {
  3646. return !list;
  3647. },
  3648. // Disable .fire
  3649. // Also disable .add unless we have memory (since it would have no effect)
  3650. // Abort any pending executions
  3651. lock: function() {
  3652. locked = queue = [];
  3653. if ( !memory && !firing ) {
  3654. list = memory = "";
  3655. }
  3656. return this;
  3657. },
  3658. locked: function() {
  3659. return !!locked;
  3660. },
  3661. // Call all callbacks with the given context and arguments
  3662. fireWith: function( context, args ) {
  3663. if ( !locked ) {
  3664. args = args || [];
  3665. args = [ context, args.slice ? args.slice() : args ];
  3666. queue.push( args );
  3667. if ( !firing ) {
  3668. fire();
  3669. }
  3670. }
  3671. return this;
  3672. },
  3673. // Call all the callbacks with the given arguments
  3674. fire: function() {
  3675. self.fireWith( this, arguments );
  3676. return this;
  3677. },
  3678. // To know if the callbacks have already been called at least once
  3679. fired: function() {
  3680. return !!fired;
  3681. }
  3682. };
  3683. return self;
  3684. };
  3685. function Identity( v ) {
  3686. return v;
  3687. }
  3688. function Thrower( ex ) {
  3689. throw ex;
  3690. }
  3691. function adoptValue( value, resolve, reject, noValue ) {
  3692. var method;
  3693. try {
  3694. // Check for promise aspect first to privilege synchronous behavior
  3695. if ( value && isFunction( ( method = value.promise ) ) ) {
  3696. method.call( value ).done( resolve ).fail( reject );
  3697. // Other thenables
  3698. } else if ( value && isFunction( ( method = value.then ) ) ) {
  3699. method.call( value, resolve, reject );
  3700. // Other non-thenables
  3701. } else {
  3702. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  3703. // * false: [ value ].slice( 0 ) => resolve( value )
  3704. // * true: [ value ].slice( 1 ) => resolve()
  3705. resolve.apply( undefined, [ value ].slice( noValue ) );
  3706. }
  3707. // For Promises/A+, convert exceptions into rejections
  3708. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  3709. // Deferred#then to conditionally suppress rejection.
  3710. } catch ( value ) {
  3711. // Support: Android 4.0 only
  3712. // Strict mode functions invoked without .call/.apply get global-object context
  3713. reject.apply( undefined, [ value ] );
  3714. }
  3715. }
  3716. jQuery.extend( {
  3717. Deferred: function( func ) {
  3718. var tuples = [
  3719. // action, add listener, callbacks,
  3720. // ... .then handlers, argument index, [final state]
  3721. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  3722. jQuery.Callbacks( "memory" ), 2 ],
  3723. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  3724. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  3725. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  3726. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  3727. ],
  3728. state = "pending",
  3729. promise = {
  3730. state: function() {
  3731. return state;
  3732. },
  3733. always: function() {
  3734. deferred.done( arguments ).fail( arguments );
  3735. return this;
  3736. },
  3737. "catch": function( fn ) {
  3738. return promise.then( null, fn );
  3739. },
  3740. // Keep pipe for back-compat
  3741. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  3742. var fns = arguments;
  3743. return jQuery.Deferred( function( newDefer ) {
  3744. jQuery.each( tuples, function( i, tuple ) {
  3745. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  3746. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  3747. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  3748. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  3749. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  3750. deferred[ tuple[ 1 ] ]( function() {
  3751. var returned = fn && fn.apply( this, arguments );
  3752. if ( returned && isFunction( returned.promise ) ) {
  3753. returned.promise()
  3754. .progress( newDefer.notify )
  3755. .done( newDefer.resolve )
  3756. .fail( newDefer.reject );
  3757. } else {
  3758. newDefer[ tuple[ 0 ] + "With" ](
  3759. this,
  3760. fn ? [ returned ] : arguments
  3761. );
  3762. }
  3763. } );
  3764. } );
  3765. fns = null;
  3766. } ).promise();
  3767. },
  3768. then: function( onFulfilled, onRejected, onProgress ) {
  3769. var maxDepth = 0;
  3770. function resolve( depth, deferred, handler, special ) {
  3771. return function() {
  3772. var that = this,
  3773. args = arguments,
  3774. mightThrow = function() {
  3775. var returned, then;
  3776. // Support: Promises/A+ section 2.3.3.3.3
  3777. // https://promisesaplus.com/#point-59
  3778. // Ignore double-resolution attempts
  3779. if ( depth < maxDepth ) {
  3780. return;
  3781. }
  3782. returned = handler.apply( that, args );
  3783. // Support: Promises/A+ section 2.3.1
  3784. // https://promisesaplus.com/#point-48
  3785. if ( returned === deferred.promise() ) {
  3786. throw new TypeError( "Thenable self-resolution" );
  3787. }
  3788. // Support: Promises/A+ sections 2.3.3.1, 3.5
  3789. // https://promisesaplus.com/#point-54
  3790. // https://promisesaplus.com/#point-75
  3791. // Retrieve `then` only once
  3792. then = returned &&
  3793. // Support: Promises/A+ section 2.3.4
  3794. // https://promisesaplus.com/#point-64
  3795. // Only check objects and functions for thenability
  3796. ( typeof returned === "object" ||
  3797. typeof returned === "function" ) &&
  3798. returned.then;
  3799. // Handle a returned thenable
  3800. if ( isFunction( then ) ) {
  3801. // Special processors (notify) just wait for resolution
  3802. if ( special ) {
  3803. then.call(
  3804. returned,
  3805. resolve( maxDepth, deferred, Identity, special ),
  3806. resolve( maxDepth, deferred, Thrower, special )
  3807. );
  3808. // Normal processors (resolve) also hook into progress
  3809. } else {
  3810. // ...and disregard older resolution values
  3811. maxDepth++;
  3812. then.call(
  3813. returned,
  3814. resolve( maxDepth, deferred, Identity, special ),
  3815. resolve( maxDepth, deferred, Thrower, special ),
  3816. resolve( maxDepth, deferred, Identity,
  3817. deferred.notifyWith )
  3818. );
  3819. }
  3820. // Handle all other returned values
  3821. } else {
  3822. // Only substitute handlers pass on context
  3823. // and multiple values (non-spec behavior)
  3824. if ( handler !== Identity ) {
  3825. that = undefined;
  3826. args = [ returned ];
  3827. }
  3828. // Process the value(s)
  3829. // Default process is resolve
  3830. ( special || deferred.resolveWith )( that, args );
  3831. }
  3832. },
  3833. // Only normal processors (resolve) catch and reject exceptions
  3834. process = special ?
  3835. mightThrow :
  3836. function() {
  3837. try {
  3838. mightThrow();
  3839. } catch ( e ) {
  3840. if ( jQuery.Deferred.exceptionHook ) {
  3841. jQuery.Deferred.exceptionHook( e,
  3842. process.stackTrace );
  3843. }
  3844. // Support: Promises/A+ section 2.3.3.3.4.1
  3845. // https://promisesaplus.com/#point-61
  3846. // Ignore post-resolution exceptions
  3847. if ( depth + 1 >= maxDepth ) {
  3848. // Only substitute handlers pass on context
  3849. // and multiple values (non-spec behavior)
  3850. if ( handler !== Thrower ) {
  3851. that = undefined;
  3852. args = [ e ];
  3853. }
  3854. deferred.rejectWith( that, args );
  3855. }
  3856. }
  3857. };
  3858. // Support: Promises/A+ section 2.3.3.3.1
  3859. // https://promisesaplus.com/#point-57
  3860. // Re-resolve promises immediately to dodge false rejection from
  3861. // subsequent errors
  3862. if ( depth ) {
  3863. process();
  3864. } else {
  3865. // Call an optional hook to record the stack, in case of exception
  3866. // since it's otherwise lost when execution goes async
  3867. if ( jQuery.Deferred.getStackHook ) {
  3868. process.stackTrace = jQuery.Deferred.getStackHook();
  3869. }
  3870. window.setTimeout( process );
  3871. }
  3872. };
  3873. }
  3874. return jQuery.Deferred( function( newDefer ) {
  3875. // progress_handlers.add( ... )
  3876. tuples[ 0 ][ 3 ].add(
  3877. resolve(
  3878. 0,
  3879. newDefer,
  3880. isFunction( onProgress ) ?
  3881. onProgress :
  3882. Identity,
  3883. newDefer.notifyWith
  3884. )
  3885. );
  3886. // fulfilled_handlers.add( ... )
  3887. tuples[ 1 ][ 3 ].add(
  3888. resolve(
  3889. 0,
  3890. newDefer,
  3891. isFunction( onFulfilled ) ?
  3892. onFulfilled :
  3893. Identity
  3894. )
  3895. );
  3896. // rejected_handlers.add( ... )
  3897. tuples[ 2 ][ 3 ].add(
  3898. resolve(
  3899. 0,
  3900. newDefer,
  3901. isFunction( onRejected ) ?
  3902. onRejected :
  3903. Thrower
  3904. )
  3905. );
  3906. } ).promise();
  3907. },
  3908. // Get a promise for this deferred
  3909. // If obj is provided, the promise aspect is added to the object
  3910. promise: function( obj ) {
  3911. return obj != null ? jQuery.extend( obj, promise ) : promise;
  3912. }
  3913. },
  3914. deferred = {};
  3915. // Add list-specific methods
  3916. jQuery.each( tuples, function( i, tuple ) {
  3917. var list = tuple[ 2 ],
  3918. stateString = tuple[ 5 ];
  3919. // promise.progress = list.add
  3920. // promise.done = list.add
  3921. // promise.fail = list.add
  3922. promise[ tuple[ 1 ] ] = list.add;
  3923. // Handle state
  3924. if ( stateString ) {
  3925. list.add(
  3926. function() {
  3927. // state = "resolved" (i.e., fulfilled)
  3928. // state = "rejected"
  3929. state = stateString;
  3930. },
  3931. // rejected_callbacks.disable
  3932. // fulfilled_callbacks.disable
  3933. tuples[ 3 - i ][ 2 ].disable,
  3934. // rejected_handlers.disable
  3935. // fulfilled_handlers.disable
  3936. tuples[ 3 - i ][ 3 ].disable,
  3937. // progress_callbacks.lock
  3938. tuples[ 0 ][ 2 ].lock,
  3939. // progress_handlers.lock
  3940. tuples[ 0 ][ 3 ].lock
  3941. );
  3942. }
  3943. // progress_handlers.fire
  3944. // fulfilled_handlers.fire
  3945. // rejected_handlers.fire
  3946. list.add( tuple[ 3 ].fire );
  3947. // deferred.notify = function() { deferred.notifyWith(...) }
  3948. // deferred.resolve = function() { deferred.resolveWith(...) }
  3949. // deferred.reject = function() { deferred.rejectWith(...) }
  3950. deferred[ tuple[ 0 ] ] = function() {
  3951. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  3952. return this;
  3953. };
  3954. // deferred.notifyWith = list.fireWith
  3955. // deferred.resolveWith = list.fireWith
  3956. // deferred.rejectWith = list.fireWith
  3957. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  3958. } );
  3959. // Make the deferred a promise
  3960. promise.promise( deferred );
  3961. // Call given func if any
  3962. if ( func ) {
  3963. func.call( deferred, deferred );
  3964. }
  3965. // All done!
  3966. return deferred;
  3967. },
  3968. // Deferred helper
  3969. when: function( singleValue ) {
  3970. var
  3971. // count of uncompleted subordinates
  3972. remaining = arguments.length,
  3973. // count of unprocessed arguments
  3974. i = remaining,
  3975. // subordinate fulfillment data
  3976. resolveContexts = Array( i ),
  3977. resolveValues = slice.call( arguments ),
  3978. // the master Deferred
  3979. master = jQuery.Deferred(),
  3980. // subordinate callback factory
  3981. updateFunc = function( i ) {
  3982. return function( value ) {
  3983. resolveContexts[ i ] = this;
  3984. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  3985. if ( !( --remaining ) ) {
  3986. master.resolveWith( resolveContexts, resolveValues );
  3987. }
  3988. };
  3989. };
  3990. // Single- and empty arguments are adopted like Promise.resolve
  3991. if ( remaining <= 1 ) {
  3992. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  3993. !remaining );
  3994. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  3995. if ( master.state() === "pending" ||
  3996. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  3997. return master.then();
  3998. }
  3999. }
  4000. // Multiple arguments are aggregated like Promise.all array elements
  4001. while ( i-- ) {
  4002. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  4003. }
  4004. return master.promise();
  4005. }
  4006. } );
  4007. // These usually indicate a programmer mistake during development,
  4008. // warn about them ASAP rather than swallowing them by default.
  4009. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  4010. jQuery.Deferred.exceptionHook = function( error, stack ) {
  4011. // Support: IE 8 - 9 only
  4012. // Console exists when dev tools are open, which can happen at any time
  4013. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  4014. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  4015. }
  4016. };
  4017. jQuery.readyException = function( error ) {
  4018. window.setTimeout( function() {
  4019. throw error;
  4020. } );
  4021. };
  4022. // The deferred used on DOM ready
  4023. var readyList = jQuery.Deferred();
  4024. jQuery.fn.ready = function( fn ) {
  4025. readyList
  4026. .then( fn )
  4027. // Wrap jQuery.readyException in a function so that the lookup
  4028. // happens at the time of error handling instead of callback
  4029. // registration.
  4030. .catch( function( error ) {
  4031. jQuery.readyException( error );
  4032. } );
  4033. return this;
  4034. };
  4035. jQuery.extend( {
  4036. // Is the DOM ready to be used? Set to true once it occurs.
  4037. isReady: false,
  4038. // A counter to track how many items to wait for before
  4039. // the ready event fires. See #6781
  4040. readyWait: 1,
  4041. // Handle when the DOM is ready
  4042. ready: function( wait ) {
  4043. // Abort if there are pending holds or we're already ready
  4044. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  4045. return;
  4046. }
  4047. // Remember that the DOM is ready
  4048. jQuery.isReady = true;
  4049. // If a normal DOM Ready event fired, decrement, and wait if need be
  4050. if ( wait !== true && --jQuery.readyWait > 0 ) {
  4051. return;
  4052. }
  4053. // If there are functions bound, to execute
  4054. readyList.resolveWith( document, [ jQuery ] );
  4055. }
  4056. } );
  4057. jQuery.ready.then = readyList.then;
  4058. // The ready event handler and self cleanup method
  4059. function completed() {
  4060. document.removeEventListener( "DOMContentLoaded", completed );
  4061. window.removeEventListener( "load", completed );
  4062. jQuery.ready();
  4063. }
  4064. // Catch cases where $(document).ready() is called
  4065. // after the browser event has already occurred.
  4066. // Support: IE <=9 - 10 only
  4067. // Older IE sometimes signals "interactive" too soon
  4068. if ( document.readyState === "complete" ||
  4069. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  4070. // Handle it asynchronously to allow scripts the opportunity to delay ready
  4071. window.setTimeout( jQuery.ready );
  4072. } else {
  4073. // Use the handy event callback
  4074. document.addEventListener( "DOMContentLoaded", completed );
  4075. // A fallback to window.onload, that will always work
  4076. window.addEventListener( "load", completed );
  4077. }
  4078. // Multifunctional method to get and set values of a collection
  4079. // The value/s can optionally be executed if it's a function
  4080. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  4081. var i = 0,
  4082. len = elems.length,
  4083. bulk = key == null;
  4084. // Sets many values
  4085. if ( toType( key ) === "object" ) {
  4086. chainable = true;
  4087. for ( i in key ) {
  4088. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  4089. }
  4090. // Sets one value
  4091. } else if ( value !== undefined ) {
  4092. chainable = true;
  4093. if ( !isFunction( value ) ) {
  4094. raw = true;
  4095. }
  4096. if ( bulk ) {
  4097. // Bulk operations run against the entire set
  4098. if ( raw ) {
  4099. fn.call( elems, value );
  4100. fn = null;
  4101. // ...except when executing function values
  4102. } else {
  4103. bulk = fn;
  4104. fn = function( elem, key, value ) {
  4105. return bulk.call( jQuery( elem ), value );
  4106. };
  4107. }
  4108. }
  4109. if ( fn ) {
  4110. for ( ; i < len; i++ ) {
  4111. fn(
  4112. elems[ i ], key, raw ?
  4113. value :
  4114. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  4115. );
  4116. }
  4117. }
  4118. }
  4119. if ( chainable ) {
  4120. return elems;
  4121. }
  4122. // Gets
  4123. if ( bulk ) {
  4124. return fn.call( elems );
  4125. }
  4126. return len ? fn( elems[ 0 ], key ) : emptyGet;
  4127. };
  4128. // Matches dashed string for camelizing
  4129. var rmsPrefix = /^-ms-/,
  4130. rdashAlpha = /-([a-z])/g;
  4131. // Used by camelCase as callback to replace()
  4132. function fcamelCase( all, letter ) {
  4133. return letter.toUpperCase();
  4134. }
  4135. // Convert dashed to camelCase; used by the css and data modules
  4136. // Support: IE <=9 - 11, Edge 12 - 15
  4137. // Microsoft forgot to hump their vendor prefix (#9572)
  4138. function camelCase( string ) {
  4139. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  4140. }
  4141. var acceptData = function( owner ) {
  4142. // Accepts only:
  4143. // - Node
  4144. // - Node.ELEMENT_NODE
  4145. // - Node.DOCUMENT_NODE
  4146. // - Object
  4147. // - Any
  4148. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  4149. };
  4150. function Data() {
  4151. this.expando = jQuery.expando + Data.uid++;
  4152. }
  4153. Data.uid = 1;
  4154. Data.prototype = {
  4155. cache: function( owner ) {
  4156. // Check if the owner object already has a cache
  4157. var value = owner[ this.expando ];
  4158. // If not, create one
  4159. if ( !value ) {
  4160. value = {};
  4161. // We can accept data for non-element nodes in modern browsers,
  4162. // but we should not, see #8335.
  4163. // Always return an empty object.
  4164. if ( acceptData( owner ) ) {
  4165. // If it is a node unlikely to be stringify-ed or looped over
  4166. // use plain assignment
  4167. if ( owner.nodeType ) {
  4168. owner[ this.expando ] = value;
  4169. // Otherwise secure it in a non-enumerable property
  4170. // configurable must be true to allow the property to be
  4171. // deleted when data is removed
  4172. } else {
  4173. Object.defineProperty( owner, this.expando, {
  4174. value: value,
  4175. configurable: true
  4176. } );
  4177. }
  4178. }
  4179. }
  4180. return value;
  4181. },
  4182. set: function( owner, data, value ) {
  4183. var prop,
  4184. cache = this.cache( owner );
  4185. // Handle: [ owner, key, value ] args
  4186. // Always use camelCase key (gh-2257)
  4187. if ( typeof data === "string" ) {
  4188. cache[ camelCase( data ) ] = value;
  4189. // Handle: [ owner, { properties } ] args
  4190. } else {
  4191. // Copy the properties one-by-one to the cache object
  4192. for ( prop in data ) {
  4193. cache[ camelCase( prop ) ] = data[ prop ];
  4194. }
  4195. }
  4196. return cache;
  4197. },
  4198. get: function( owner, key ) {
  4199. return key === undefined ?
  4200. this.cache( owner ) :
  4201. // Always use camelCase key (gh-2257)
  4202. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  4203. },
  4204. access: function( owner, key, value ) {
  4205. // In cases where either:
  4206. //
  4207. // 1. No key was specified
  4208. // 2. A string key was specified, but no value provided
  4209. //
  4210. // Take the "read" path and allow the get method to determine
  4211. // which value to return, respectively either:
  4212. //
  4213. // 1. The entire cache object
  4214. // 2. The data stored at the key
  4215. //
  4216. if ( key === undefined ||
  4217. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  4218. return this.get( owner, key );
  4219. }
  4220. // When the key is not a string, or both a key and value
  4221. // are specified, set or extend (existing objects) with either:
  4222. //
  4223. // 1. An object of properties
  4224. // 2. A key and value
  4225. //
  4226. this.set( owner, key, value );
  4227. // Since the "set" path can have two possible entry points
  4228. // return the expected data based on which path was taken[*]
  4229. return value !== undefined ? value : key;
  4230. },
  4231. remove: function( owner, key ) {
  4232. var i,
  4233. cache = owner[ this.expando ];
  4234. if ( cache === undefined ) {
  4235. return;
  4236. }
  4237. if ( key !== undefined ) {
  4238. // Support array or space separated string of keys
  4239. if ( Array.isArray( key ) ) {
  4240. // If key is an array of keys...
  4241. // We always set camelCase keys, so remove that.
  4242. key = key.map( camelCase );
  4243. } else {
  4244. key = camelCase( key );
  4245. // If a key with the spaces exists, use it.
  4246. // Otherwise, create an array by matching non-whitespace
  4247. key = key in cache ?
  4248. [ key ] :
  4249. ( key.match( rnothtmlwhite ) || [] );
  4250. }
  4251. i = key.length;
  4252. while ( i-- ) {
  4253. delete cache[ key[ i ] ];
  4254. }
  4255. }
  4256. // Remove the expando if there's no more data
  4257. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  4258. // Support: Chrome <=35 - 45
  4259. // Webkit & Blink performance suffers when deleting properties
  4260. // from DOM nodes, so set to undefined instead
  4261. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  4262. if ( owner.nodeType ) {
  4263. owner[ this.expando ] = undefined;
  4264. } else {
  4265. delete owner[ this.expando ];
  4266. }
  4267. }
  4268. },
  4269. hasData: function( owner ) {
  4270. var cache = owner[ this.expando ];
  4271. return cache !== undefined && !jQuery.isEmptyObject( cache );
  4272. }
  4273. };
  4274. var dataPriv = new Data();
  4275. var dataUser = new Data();
  4276. // Implementation Summary
  4277. //
  4278. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  4279. // 2. Improve the module's maintainability by reducing the storage
  4280. // paths to a single mechanism.
  4281. // 3. Use the same single mechanism to support "private" and "user" data.
  4282. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  4283. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  4284. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  4285. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  4286. rmultiDash = /[A-Z]/g;
  4287. function getData( data ) {
  4288. if ( data === "true" ) {
  4289. return true;
  4290. }
  4291. if ( data === "false" ) {
  4292. return false;
  4293. }
  4294. if ( data === "null" ) {
  4295. return null;
  4296. }
  4297. // Only convert to a number if it doesn't change the string
  4298. if ( data === +data + "" ) {
  4299. return +data;
  4300. }
  4301. if ( rbrace.test( data ) ) {
  4302. return JSON.parse( data );
  4303. }
  4304. return data;
  4305. }
  4306. function dataAttr( elem, key, data ) {
  4307. var name;
  4308. // If nothing was found internally, try to fetch any
  4309. // data from the HTML5 data-* attribute
  4310. if ( data === undefined && elem.nodeType === 1 ) {
  4311. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  4312. data = elem.getAttribute( name );
  4313. if ( typeof data === "string" ) {
  4314. try {
  4315. data = getData( data );
  4316. } catch ( e ) {}
  4317. // Make sure we set the data so it isn't changed later
  4318. dataUser.set( elem, key, data );
  4319. } else {
  4320. data = undefined;
  4321. }
  4322. }
  4323. return data;
  4324. }
  4325. jQuery.extend( {
  4326. hasData: function( elem ) {
  4327. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  4328. },
  4329. data: function( elem, name, data ) {
  4330. return dataUser.access( elem, name, data );
  4331. },
  4332. removeData: function( elem, name ) {
  4333. dataUser.remove( elem, name );
  4334. },
  4335. // TODO: Now that all calls to _data and _removeData have been replaced
  4336. // with direct calls to dataPriv methods, these can be deprecated.
  4337. _data: function( elem, name, data ) {
  4338. return dataPriv.access( elem, name, data );
  4339. },
  4340. _removeData: function( elem, name ) {
  4341. dataPriv.remove( elem, name );
  4342. }
  4343. } );
  4344. jQuery.fn.extend( {
  4345. data: function( key, value ) {
  4346. var i, name, data,
  4347. elem = this[ 0 ],
  4348. attrs = elem && elem.attributes;
  4349. // Gets all values
  4350. if ( key === undefined ) {
  4351. if ( this.length ) {
  4352. data = dataUser.get( elem );
  4353. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  4354. i = attrs.length;
  4355. while ( i-- ) {
  4356. // Support: IE 11 only
  4357. // The attrs elements can be null (#14894)
  4358. if ( attrs[ i ] ) {
  4359. name = attrs[ i ].name;
  4360. if ( name.indexOf( "data-" ) === 0 ) {
  4361. name = camelCase( name.slice( 5 ) );
  4362. dataAttr( elem, name, data[ name ] );
  4363. }
  4364. }
  4365. }
  4366. dataPriv.set( elem, "hasDataAttrs", true );
  4367. }
  4368. }
  4369. return data;
  4370. }
  4371. // Sets multiple values
  4372. if ( typeof key === "object" ) {
  4373. return this.each( function() {
  4374. dataUser.set( this, key );
  4375. } );
  4376. }
  4377. return access( this, function( value ) {
  4378. var data;
  4379. // The calling jQuery object (element matches) is not empty
  4380. // (and therefore has an element appears at this[ 0 ]) and the
  4381. // `value` parameter was not undefined. An empty jQuery object
  4382. // will result in `undefined` for elem = this[ 0 ] which will
  4383. // throw an exception if an attempt to read a data cache is made.
  4384. if ( elem && value === undefined ) {
  4385. // Attempt to get data from the cache
  4386. // The key will always be camelCased in Data
  4387. data = dataUser.get( elem, key );
  4388. if ( data !== undefined ) {
  4389. return data;
  4390. }
  4391. // Attempt to "discover" the data in
  4392. // HTML5 custom data-* attrs
  4393. data = dataAttr( elem, key );
  4394. if ( data !== undefined ) {
  4395. return data;
  4396. }
  4397. // We tried really hard, but the data doesn't exist.
  4398. return;
  4399. }
  4400. // Set the data...
  4401. this.each( function() {
  4402. // We always store the camelCased key
  4403. dataUser.set( this, key, value );
  4404. } );
  4405. }, null, value, arguments.length > 1, null, true );
  4406. },
  4407. removeData: function( key ) {
  4408. return this.each( function() {
  4409. dataUser.remove( this, key );
  4410. } );
  4411. }
  4412. } );
  4413. jQuery.extend( {
  4414. queue: function( elem, type, data ) {
  4415. var queue;
  4416. if ( elem ) {
  4417. type = ( type || "fx" ) + "queue";
  4418. queue = dataPriv.get( elem, type );
  4419. // Speed up dequeue by getting out quickly if this is just a lookup
  4420. if ( data ) {
  4421. if ( !queue || Array.isArray( data ) ) {
  4422. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  4423. } else {
  4424. queue.push( data );
  4425. }
  4426. }
  4427. return queue || [];
  4428. }
  4429. },
  4430. dequeue: function( elem, type ) {
  4431. type = type || "fx";
  4432. var queue = jQuery.queue( elem, type ),
  4433. startLength = queue.length,
  4434. fn = queue.shift(),
  4435. hooks = jQuery._queueHooks( elem, type ),
  4436. next = function() {
  4437. jQuery.dequeue( elem, type );
  4438. };
  4439. // If the fx queue is dequeued, always remove the progress sentinel
  4440. if ( fn === "inprogress" ) {
  4441. fn = queue.shift();
  4442. startLength--;
  4443. }
  4444. if ( fn ) {
  4445. // Add a progress sentinel to prevent the fx queue from being
  4446. // automatically dequeued
  4447. if ( type === "fx" ) {
  4448. queue.unshift( "inprogress" );
  4449. }
  4450. // Clear up the last queue stop function
  4451. delete hooks.stop;
  4452. fn.call( elem, next, hooks );
  4453. }
  4454. if ( !startLength && hooks ) {
  4455. hooks.empty.fire();
  4456. }
  4457. },
  4458. // Not public - generate a queueHooks object, or return the current one
  4459. _queueHooks: function( elem, type ) {
  4460. var key = type + "queueHooks";
  4461. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  4462. empty: jQuery.Callbacks( "once memory" ).add( function() {
  4463. dataPriv.remove( elem, [ type + "queue", key ] );
  4464. } )
  4465. } );
  4466. }
  4467. } );
  4468. jQuery.fn.extend( {
  4469. queue: function( type, data ) {
  4470. var setter = 2;
  4471. if ( typeof type !== "string" ) {
  4472. data = type;
  4473. type = "fx";
  4474. setter--;
  4475. }
  4476. if ( arguments.length < setter ) {
  4477. return jQuery.queue( this[ 0 ], type );
  4478. }
  4479. return data === undefined ?
  4480. this :
  4481. this.each( function() {
  4482. var queue = jQuery.queue( this, type, data );
  4483. // Ensure a hooks for this queue
  4484. jQuery._queueHooks( this, type );
  4485. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  4486. jQuery.dequeue( this, type );
  4487. }
  4488. } );
  4489. },
  4490. dequeue: function( type ) {
  4491. return this.each( function() {
  4492. jQuery.dequeue( this, type );
  4493. } );
  4494. },
  4495. clearQueue: function( type ) {
  4496. return this.queue( type || "fx", [] );
  4497. },
  4498. // Get a promise resolved when queues of a certain type
  4499. // are emptied (fx is the type by default)
  4500. promise: function( type, obj ) {
  4501. var tmp,
  4502. count = 1,
  4503. defer = jQuery.Deferred(),
  4504. elements = this,
  4505. i = this.length,
  4506. resolve = function() {
  4507. if ( !( --count ) ) {
  4508. defer.resolveWith( elements, [ elements ] );
  4509. }
  4510. };
  4511. if ( typeof type !== "string" ) {
  4512. obj = type;
  4513. type = undefined;
  4514. }
  4515. type = type || "fx";
  4516. while ( i-- ) {
  4517. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  4518. if ( tmp && tmp.empty ) {
  4519. count++;
  4520. tmp.empty.add( resolve );
  4521. }
  4522. }
  4523. resolve();
  4524. return defer.promise( obj );
  4525. }
  4526. } );
  4527. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  4528. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  4529. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  4530. var documentElement = document.documentElement;
  4531. var isAttached = function( elem ) {
  4532. return jQuery.contains( elem.ownerDocument, elem );
  4533. },
  4534. composed = { composed: true };
  4535. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  4536. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  4537. // Support: iOS 10.0-10.2 only
  4538. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  4539. // leading to errors. We need to check for `getRootNode`.
  4540. if ( documentElement.getRootNode ) {
  4541. isAttached = function( elem ) {
  4542. return jQuery.contains( elem.ownerDocument, elem ) ||
  4543. elem.getRootNode( composed ) === elem.ownerDocument;
  4544. };
  4545. }
  4546. var isHiddenWithinTree = function( elem, el ) {
  4547. // isHiddenWithinTree might be called from jQuery#filter function;
  4548. // in that case, element will be second argument
  4549. elem = el || elem;
  4550. // Inline style trumps all
  4551. return elem.style.display === "none" ||
  4552. elem.style.display === "" &&
  4553. // Otherwise, check computed style
  4554. // Support: Firefox <=43 - 45
  4555. // Disconnected elements can have computed display: none, so first confirm that elem is
  4556. // in the document.
  4557. isAttached( elem ) &&
  4558. jQuery.css( elem, "display" ) === "none";
  4559. };
  4560. var swap = function( elem, options, callback, args ) {
  4561. var ret, name,
  4562. old = {};
  4563. // Remember the old values, and insert the new ones
  4564. for ( name in options ) {
  4565. old[ name ] = elem.style[ name ];
  4566. elem.style[ name ] = options[ name ];
  4567. }
  4568. ret = callback.apply( elem, args || [] );
  4569. // Revert the old values
  4570. for ( name in options ) {
  4571. elem.style[ name ] = old[ name ];
  4572. }
  4573. return ret;
  4574. };
  4575. function adjustCSS( elem, prop, valueParts, tween ) {
  4576. var adjusted, scale,
  4577. maxIterations = 20,
  4578. currentValue = tween ?
  4579. function() {
  4580. return tween.cur();
  4581. } :
  4582. function() {
  4583. return jQuery.css( elem, prop, "" );
  4584. },
  4585. initial = currentValue(),
  4586. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  4587. // Starting value computation is required for potential unit mismatches
  4588. initialInUnit = elem.nodeType &&
  4589. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  4590. rcssNum.exec( jQuery.css( elem, prop ) );
  4591. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  4592. // Support: Firefox <=54
  4593. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  4594. initial = initial / 2;
  4595. // Trust units reported by jQuery.css
  4596. unit = unit || initialInUnit[ 3 ];
  4597. // Iteratively approximate from a nonzero starting point
  4598. initialInUnit = +initial || 1;
  4599. while ( maxIterations-- ) {
  4600. // Evaluate and update our best guess (doubling guesses that zero out).
  4601. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  4602. jQuery.style( elem, prop, initialInUnit + unit );
  4603. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  4604. maxIterations = 0;
  4605. }
  4606. initialInUnit = initialInUnit / scale;
  4607. }
  4608. initialInUnit = initialInUnit * 2;
  4609. jQuery.style( elem, prop, initialInUnit + unit );
  4610. // Make sure we update the tween properties later on
  4611. valueParts = valueParts || [];
  4612. }
  4613. if ( valueParts ) {
  4614. initialInUnit = +initialInUnit || +initial || 0;
  4615. // Apply relative offset (+=/-=) if specified
  4616. adjusted = valueParts[ 1 ] ?
  4617. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  4618. +valueParts[ 2 ];
  4619. if ( tween ) {
  4620. tween.unit = unit;
  4621. tween.start = initialInUnit;
  4622. tween.end = adjusted;
  4623. }
  4624. }
  4625. return adjusted;
  4626. }
  4627. var defaultDisplayMap = {};
  4628. function getDefaultDisplay( elem ) {
  4629. var temp,
  4630. doc = elem.ownerDocument,
  4631. nodeName = elem.nodeName,
  4632. display = defaultDisplayMap[ nodeName ];
  4633. if ( display ) {
  4634. return display;
  4635. }
  4636. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  4637. display = jQuery.css( temp, "display" );
  4638. temp.parentNode.removeChild( temp );
  4639. if ( display === "none" ) {
  4640. display = "block";
  4641. }
  4642. defaultDisplayMap[ nodeName ] = display;
  4643. return display;
  4644. }
  4645. function showHide( elements, show ) {
  4646. var display, elem,
  4647. values = [],
  4648. index = 0,
  4649. length = elements.length;
  4650. // Determine new display value for elements that need to change
  4651. for ( ; index < length; index++ ) {
  4652. elem = elements[ index ];
  4653. if ( !elem.style ) {
  4654. continue;
  4655. }
  4656. display = elem.style.display;
  4657. if ( show ) {
  4658. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  4659. // check is required in this first loop unless we have a nonempty display value (either
  4660. // inline or about-to-be-restored)
  4661. if ( display === "none" ) {
  4662. values[ index ] = dataPriv.get( elem, "display" ) || null;
  4663. if ( !values[ index ] ) {
  4664. elem.style.display = "";
  4665. }
  4666. }
  4667. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  4668. values[ index ] = getDefaultDisplay( elem );
  4669. }
  4670. } else {
  4671. if ( display !== "none" ) {
  4672. values[ index ] = "none";
  4673. // Remember what we're overwriting
  4674. dataPriv.set( elem, "display", display );
  4675. }
  4676. }
  4677. }
  4678. // Set the display of the elements in a second loop to avoid constant reflow
  4679. for ( index = 0; index < length; index++ ) {
  4680. if ( values[ index ] != null ) {
  4681. elements[ index ].style.display = values[ index ];
  4682. }
  4683. }
  4684. return elements;
  4685. }
  4686. jQuery.fn.extend( {
  4687. show: function() {
  4688. return showHide( this, true );
  4689. },
  4690. hide: function() {
  4691. return showHide( this );
  4692. },
  4693. toggle: function( state ) {
  4694. if ( typeof state === "boolean" ) {
  4695. return state ? this.show() : this.hide();
  4696. }
  4697. return this.each( function() {
  4698. if ( isHiddenWithinTree( this ) ) {
  4699. jQuery( this ).show();
  4700. } else {
  4701. jQuery( this ).hide();
  4702. }
  4703. } );
  4704. }
  4705. } );
  4706. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  4707. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  4708. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  4709. // We have to close these tags to support XHTML (#13200)
  4710. var wrapMap = {
  4711. // Support: IE <=9 only
  4712. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  4713. // XHTML parsers do not magically insert elements in the
  4714. // same way that tag soup parsers do. So we cannot shorten
  4715. // this by omitting <tbody> or other required elements.
  4716. thead: [ 1, "<table>", "</table>" ],
  4717. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  4718. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  4719. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  4720. _default: [ 0, "", "" ]
  4721. };
  4722. // Support: IE <=9 only
  4723. wrapMap.optgroup = wrapMap.option;
  4724. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  4725. wrapMap.th = wrapMap.td;
  4726. function getAll( context, tag ) {
  4727. // Support: IE <=9 - 11 only
  4728. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  4729. var ret;
  4730. if ( typeof context.getElementsByTagName !== "undefined" ) {
  4731. ret = context.getElementsByTagName( tag || "*" );
  4732. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  4733. ret = context.querySelectorAll( tag || "*" );
  4734. } else {
  4735. ret = [];
  4736. }
  4737. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  4738. return jQuery.merge( [ context ], ret );
  4739. }
  4740. return ret;
  4741. }
  4742. // Mark scripts as having already been evaluated
  4743. function setGlobalEval( elems, refElements ) {
  4744. var i = 0,
  4745. l = elems.length;
  4746. for ( ; i < l; i++ ) {
  4747. dataPriv.set(
  4748. elems[ i ],
  4749. "globalEval",
  4750. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  4751. );
  4752. }
  4753. }
  4754. var rhtml = /<|&#?\w+;/;
  4755. function buildFragment( elems, context, scripts, selection, ignored ) {
  4756. var elem, tmp, tag, wrap, attached, j,
  4757. fragment = context.createDocumentFragment(),
  4758. nodes = [],
  4759. i = 0,
  4760. l = elems.length;
  4761. for ( ; i < l; i++ ) {
  4762. elem = elems[ i ];
  4763. if ( elem || elem === 0 ) {
  4764. // Add nodes directly
  4765. if ( toType( elem ) === "object" ) {
  4766. // Support: Android <=4.0 only, PhantomJS 1 only
  4767. // push.apply(_, arraylike) throws on ancient WebKit
  4768. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  4769. // Convert non-html into a text node
  4770. } else if ( !rhtml.test( elem ) ) {
  4771. nodes.push( context.createTextNode( elem ) );
  4772. // Convert html into DOM nodes
  4773. } else {
  4774. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  4775. // Deserialize a standard representation
  4776. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  4777. wrap = wrapMap[ tag ] || wrapMap._default;
  4778. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  4779. // Descend through wrappers to the right content
  4780. j = wrap[ 0 ];
  4781. while ( j-- ) {
  4782. tmp = tmp.lastChild;
  4783. }
  4784. // Support: Android <=4.0 only, PhantomJS 1 only
  4785. // push.apply(_, arraylike) throws on ancient WebKit
  4786. jQuery.merge( nodes, tmp.childNodes );
  4787. // Remember the top-level container
  4788. tmp = fragment.firstChild;
  4789. // Ensure the created nodes are orphaned (#12392)
  4790. tmp.textContent = "";
  4791. }
  4792. }
  4793. }
  4794. // Remove wrapper from fragment
  4795. fragment.textContent = "";
  4796. i = 0;
  4797. while ( ( elem = nodes[ i++ ] ) ) {
  4798. // Skip elements already in the context collection (trac-4087)
  4799. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  4800. if ( ignored ) {
  4801. ignored.push( elem );
  4802. }
  4803. continue;
  4804. }
  4805. attached = isAttached( elem );
  4806. // Append to fragment
  4807. tmp = getAll( fragment.appendChild( elem ), "script" );
  4808. // Preserve script evaluation history
  4809. if ( attached ) {
  4810. setGlobalEval( tmp );
  4811. }
  4812. // Capture executables
  4813. if ( scripts ) {
  4814. j = 0;
  4815. while ( ( elem = tmp[ j++ ] ) ) {
  4816. if ( rscriptType.test( elem.type || "" ) ) {
  4817. scripts.push( elem );
  4818. }
  4819. }
  4820. }
  4821. }
  4822. return fragment;
  4823. }
  4824. ( function() {
  4825. var fragment = document.createDocumentFragment(),
  4826. div = fragment.appendChild( document.createElement( "div" ) ),
  4827. input = document.createElement( "input" );
  4828. // Support: Android 4.0 - 4.3 only
  4829. // Check state lost if the name is set (#11217)
  4830. // Support: Windows Web Apps (WWA)
  4831. // `name` and `type` must use .setAttribute for WWA (#14901)
  4832. input.setAttribute( "type", "radio" );
  4833. input.setAttribute( "checked", "checked" );
  4834. input.setAttribute( "name", "t" );
  4835. div.appendChild( input );
  4836. // Support: Android <=4.1 only
  4837. // Older WebKit doesn't clone checked state correctly in fragments
  4838. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  4839. // Support: IE <=11 only
  4840. // Make sure textarea (and checkbox) defaultValue is properly cloned
  4841. div.innerHTML = "<textarea>x</textarea>";
  4842. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  4843. } )();
  4844. var
  4845. rkeyEvent = /^key/,
  4846. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  4847. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  4848. function returnTrue() {
  4849. return true;
  4850. }
  4851. function returnFalse() {
  4852. return false;
  4853. }
  4854. // Support: IE <=9 - 11+
  4855. // focus() and blur() are asynchronous, except when they are no-op.
  4856. // So expect focus to be synchronous when the element is already active,
  4857. // and blur to be synchronous when the element is not already active.
  4858. // (focus and blur are always synchronous in other supported browsers,
  4859. // this just defines when we can count on it).
  4860. function expectSync( elem, type ) {
  4861. return ( elem === safeActiveElement() ) === ( type === "focus" );
  4862. }
  4863. // Support: IE <=9 only
  4864. // Accessing document.activeElement can throw unexpectedly
  4865. // https://bugs.jquery.com/ticket/13393
  4866. function safeActiveElement() {
  4867. try {
  4868. return document.activeElement;
  4869. } catch ( err ) { }
  4870. }
  4871. function on( elem, types, selector, data, fn, one ) {
  4872. var origFn, type;
  4873. // Types can be a map of types/handlers
  4874. if ( typeof types === "object" ) {
  4875. // ( types-Object, selector, data )
  4876. if ( typeof selector !== "string" ) {
  4877. // ( types-Object, data )
  4878. data = data || selector;
  4879. selector = undefined;
  4880. }
  4881. for ( type in types ) {
  4882. on( elem, type, selector, data, types[ type ], one );
  4883. }
  4884. return elem;
  4885. }
  4886. if ( data == null && fn == null ) {
  4887. // ( types, fn )
  4888. fn = selector;
  4889. data = selector = undefined;
  4890. } else if ( fn == null ) {
  4891. if ( typeof selector === "string" ) {
  4892. // ( types, selector, fn )
  4893. fn = data;
  4894. data = undefined;
  4895. } else {
  4896. // ( types, data, fn )
  4897. fn = data;
  4898. data = selector;
  4899. selector = undefined;
  4900. }
  4901. }
  4902. if ( fn === false ) {
  4903. fn = returnFalse;
  4904. } else if ( !fn ) {
  4905. return elem;
  4906. }
  4907. if ( one === 1 ) {
  4908. origFn = fn;
  4909. fn = function( event ) {
  4910. // Can use an empty set, since event contains the info
  4911. jQuery().off( event );
  4912. return origFn.apply( this, arguments );
  4913. };
  4914. // Use same guid so caller can remove using origFn
  4915. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  4916. }
  4917. return elem.each( function() {
  4918. jQuery.event.add( this, types, fn, data, selector );
  4919. } );
  4920. }
  4921. /*
  4922. * Helper functions for managing events -- not part of the public interface.
  4923. * Props to Dean Edwards' addEvent library for many of the ideas.
  4924. */
  4925. jQuery.event = {
  4926. global: {},
  4927. add: function( elem, types, handler, data, selector ) {
  4928. var handleObjIn, eventHandle, tmp,
  4929. events, t, handleObj,
  4930. special, handlers, type, namespaces, origType,
  4931. elemData = dataPriv.get( elem );
  4932. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  4933. if ( !elemData ) {
  4934. return;
  4935. }
  4936. // Caller can pass in an object of custom data in lieu of the handler
  4937. if ( handler.handler ) {
  4938. handleObjIn = handler;
  4939. handler = handleObjIn.handler;
  4940. selector = handleObjIn.selector;
  4941. }
  4942. // Ensure that invalid selectors throw exceptions at attach time
  4943. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  4944. if ( selector ) {
  4945. jQuery.find.matchesSelector( documentElement, selector );
  4946. }
  4947. // Make sure that the handler has a unique ID, used to find/remove it later
  4948. if ( !handler.guid ) {
  4949. handler.guid = jQuery.guid++;
  4950. }
  4951. // Init the element's event structure and main handler, if this is the first
  4952. if ( !( events = elemData.events ) ) {
  4953. events = elemData.events = {};
  4954. }
  4955. if ( !( eventHandle = elemData.handle ) ) {
  4956. eventHandle = elemData.handle = function( e ) {
  4957. // Discard the second event of a jQuery.event.trigger() and
  4958. // when an event is called after a page has unloaded
  4959. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  4960. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  4961. };
  4962. }
  4963. // Handle multiple events separated by a space
  4964. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  4965. t = types.length;
  4966. while ( t-- ) {
  4967. tmp = rtypenamespace.exec( types[ t ] ) || [];
  4968. type = origType = tmp[ 1 ];
  4969. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  4970. // There *must* be a type, no attaching namespace-only handlers
  4971. if ( !type ) {
  4972. continue;
  4973. }
  4974. // If event changes its type, use the special event handlers for the changed type
  4975. special = jQuery.event.special[ type ] || {};
  4976. // If selector defined, determine special event api type, otherwise given type
  4977. type = ( selector ? special.delegateType : special.bindType ) || type;
  4978. // Update special based on newly reset type
  4979. special = jQuery.event.special[ type ] || {};
  4980. // handleObj is passed to all event handlers
  4981. handleObj = jQuery.extend( {
  4982. type: type,
  4983. origType: origType,
  4984. data: data,
  4985. handler: handler,
  4986. guid: handler.guid,
  4987. selector: selector,
  4988. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  4989. namespace: namespaces.join( "." )
  4990. }, handleObjIn );
  4991. // Init the event handler queue if we're the first
  4992. if ( !( handlers = events[ type ] ) ) {
  4993. handlers = events[ type ] = [];
  4994. handlers.delegateCount = 0;
  4995. // Only use addEventListener if the special events handler returns false
  4996. if ( !special.setup ||
  4997. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  4998. if ( elem.addEventListener ) {
  4999. elem.addEventListener( type, eventHandle );
  5000. }
  5001. }
  5002. }
  5003. if ( special.add ) {
  5004. special.add.call( elem, handleObj );
  5005. if ( !handleObj.handler.guid ) {
  5006. handleObj.handler.guid = handler.guid;
  5007. }
  5008. }
  5009. // Add to the element's handler list, delegates in front
  5010. if ( selector ) {
  5011. handlers.splice( handlers.delegateCount++, 0, handleObj );
  5012. } else {
  5013. handlers.push( handleObj );
  5014. }
  5015. // Keep track of which events have ever been used, for event optimization
  5016. jQuery.event.global[ type ] = true;
  5017. }
  5018. },
  5019. // Detach an event or set of events from an element
  5020. remove: function( elem, types, handler, selector, mappedTypes ) {
  5021. var j, origCount, tmp,
  5022. events, t, handleObj,
  5023. special, handlers, type, namespaces, origType,
  5024. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  5025. if ( !elemData || !( events = elemData.events ) ) {
  5026. return;
  5027. }
  5028. // Once for each type.namespace in types; type may be omitted
  5029. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  5030. t = types.length;
  5031. while ( t-- ) {
  5032. tmp = rtypenamespace.exec( types[ t ] ) || [];
  5033. type = origType = tmp[ 1 ];
  5034. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  5035. // Unbind all events (on this namespace, if provided) for the element
  5036. if ( !type ) {
  5037. for ( type in events ) {
  5038. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  5039. }
  5040. continue;
  5041. }
  5042. special = jQuery.event.special[ type ] || {};
  5043. type = ( selector ? special.delegateType : special.bindType ) || type;
  5044. handlers = events[ type ] || [];
  5045. tmp = tmp[ 2 ] &&
  5046. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  5047. // Remove matching events
  5048. origCount = j = handlers.length;
  5049. while ( j-- ) {
  5050. handleObj = handlers[ j ];
  5051. if ( ( mappedTypes || origType === handleObj.origType ) &&
  5052. ( !handler || handler.guid === handleObj.guid ) &&
  5053. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  5054. ( !selector || selector === handleObj.selector ||
  5055. selector === "**" && handleObj.selector ) ) {
  5056. handlers.splice( j, 1 );
  5057. if ( handleObj.selector ) {
  5058. handlers.delegateCount--;
  5059. }
  5060. if ( special.remove ) {
  5061. special.remove.call( elem, handleObj );
  5062. }
  5063. }
  5064. }
  5065. // Remove generic event handler if we removed something and no more handlers exist
  5066. // (avoids potential for endless recursion during removal of special event handlers)
  5067. if ( origCount && !handlers.length ) {
  5068. if ( !special.teardown ||
  5069. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  5070. jQuery.removeEvent( elem, type, elemData.handle );
  5071. }
  5072. delete events[ type ];
  5073. }
  5074. }
  5075. // Remove data and the expando if it's no longer used
  5076. if ( jQuery.isEmptyObject( events ) ) {
  5077. dataPriv.remove( elem, "handle events" );
  5078. }
  5079. },
  5080. dispatch: function( nativeEvent ) {
  5081. // Make a writable jQuery.Event from the native event object
  5082. var event = jQuery.event.fix( nativeEvent );
  5083. var i, j, ret, matched, handleObj, handlerQueue,
  5084. args = new Array( arguments.length ),
  5085. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  5086. special = jQuery.event.special[ event.type ] || {};
  5087. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  5088. args[ 0 ] = event;
  5089. for ( i = 1; i < arguments.length; i++ ) {
  5090. args[ i ] = arguments[ i ];
  5091. }
  5092. event.delegateTarget = this;
  5093. // Call the preDispatch hook for the mapped type, and let it bail if desired
  5094. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  5095. return;
  5096. }
  5097. // Determine handlers
  5098. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  5099. // Run delegates first; they may want to stop propagation beneath us
  5100. i = 0;
  5101. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  5102. event.currentTarget = matched.elem;
  5103. j = 0;
  5104. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  5105. !event.isImmediatePropagationStopped() ) {
  5106. // If the event is namespaced, then each handler is only invoked if it is
  5107. // specially universal or its namespaces are a superset of the event's.
  5108. if ( !event.rnamespace || handleObj.namespace === false ||
  5109. event.rnamespace.test( handleObj.namespace ) ) {
  5110. event.handleObj = handleObj;
  5111. event.data = handleObj.data;
  5112. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  5113. handleObj.handler ).apply( matched.elem, args );
  5114. if ( ret !== undefined ) {
  5115. if ( ( event.result = ret ) === false ) {
  5116. event.preventDefault();
  5117. event.stopPropagation();
  5118. }
  5119. }
  5120. }
  5121. }
  5122. }
  5123. // Call the postDispatch hook for the mapped type
  5124. if ( special.postDispatch ) {
  5125. special.postDispatch.call( this, event );
  5126. }
  5127. return event.result;
  5128. },
  5129. handlers: function( event, handlers ) {
  5130. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  5131. handlerQueue = [],
  5132. delegateCount = handlers.delegateCount,
  5133. cur = event.target;
  5134. // Find delegate handlers
  5135. if ( delegateCount &&
  5136. // Support: IE <=9
  5137. // Black-hole SVG <use> instance trees (trac-13180)
  5138. cur.nodeType &&
  5139. // Support: Firefox <=42
  5140. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  5141. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  5142. // Support: IE 11 only
  5143. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  5144. !( event.type === "click" && event.button >= 1 ) ) {
  5145. for ( ; cur !== this; cur = cur.parentNode || this ) {
  5146. // Don't check non-elements (#13208)
  5147. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  5148. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  5149. matchedHandlers = [];
  5150. matchedSelectors = {};
  5151. for ( i = 0; i < delegateCount; i++ ) {
  5152. handleObj = handlers[ i ];
  5153. // Don't conflict with Object.prototype properties (#13203)
  5154. sel = handleObj.selector + " ";
  5155. if ( matchedSelectors[ sel ] === undefined ) {
  5156. matchedSelectors[ sel ] = handleObj.needsContext ?
  5157. jQuery( sel, this ).index( cur ) > -1 :
  5158. jQuery.find( sel, this, null, [ cur ] ).length;
  5159. }
  5160. if ( matchedSelectors[ sel ] ) {
  5161. matchedHandlers.push( handleObj );
  5162. }
  5163. }
  5164. if ( matchedHandlers.length ) {
  5165. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  5166. }
  5167. }
  5168. }
  5169. }
  5170. // Add the remaining (directly-bound) handlers
  5171. cur = this;
  5172. if ( delegateCount < handlers.length ) {
  5173. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  5174. }
  5175. return handlerQueue;
  5176. },
  5177. addProp: function( name, hook ) {
  5178. Object.defineProperty( jQuery.Event.prototype, name, {
  5179. enumerable: true,
  5180. configurable: true,
  5181. get: isFunction( hook ) ?
  5182. function() {
  5183. if ( this.originalEvent ) {
  5184. return hook( this.originalEvent );
  5185. }
  5186. } :
  5187. function() {
  5188. if ( this.originalEvent ) {
  5189. return this.originalEvent[ name ];
  5190. }
  5191. },
  5192. set: function( value ) {
  5193. Object.defineProperty( this, name, {
  5194. enumerable: true,
  5195. configurable: true,
  5196. writable: true,
  5197. value: value
  5198. } );
  5199. }
  5200. } );
  5201. },
  5202. fix: function( originalEvent ) {
  5203. return originalEvent[ jQuery.expando ] ?
  5204. originalEvent :
  5205. new jQuery.Event( originalEvent );
  5206. },
  5207. special: {
  5208. load: {
  5209. // Prevent triggered image.load events from bubbling to window.load
  5210. noBubble: true
  5211. },
  5212. click: {
  5213. // Utilize native event to ensure correct state for checkable inputs
  5214. setup: function( data ) {
  5215. // For mutual compressibility with _default, replace `this` access with a local var.
  5216. // `|| data` is dead code meant only to preserve the variable through minification.
  5217. var el = this || data;
  5218. // Claim the first handler
  5219. if ( rcheckableType.test( el.type ) &&
  5220. el.click && nodeName( el, "input" ) ) {
  5221. // dataPriv.set( el, "click", ... )
  5222. leverageNative( el, "click", returnTrue );
  5223. }
  5224. // Return false to allow normal processing in the caller
  5225. return false;
  5226. },
  5227. trigger: function( data ) {
  5228. // For mutual compressibility with _default, replace `this` access with a local var.
  5229. // `|| data` is dead code meant only to preserve the variable through minification.
  5230. var el = this || data;
  5231. // Force setup before triggering a click
  5232. if ( rcheckableType.test( el.type ) &&
  5233. el.click && nodeName( el, "input" ) ) {
  5234. leverageNative( el, "click" );
  5235. }
  5236. // Return non-false to allow normal event-path propagation
  5237. return true;
  5238. },
  5239. // For cross-browser consistency, suppress native .click() on links
  5240. // Also prevent it if we're currently inside a leveraged native-event stack
  5241. _default: function( event ) {
  5242. var target = event.target;
  5243. return rcheckableType.test( target.type ) &&
  5244. target.click && nodeName( target, "input" ) &&
  5245. dataPriv.get( target, "click" ) ||
  5246. nodeName( target, "a" );
  5247. }
  5248. },
  5249. beforeunload: {
  5250. postDispatch: function( event ) {
  5251. // Support: Firefox 20+
  5252. // Firefox doesn't alert if the returnValue field is not set.
  5253. if ( event.result !== undefined && event.originalEvent ) {
  5254. event.originalEvent.returnValue = event.result;
  5255. }
  5256. }
  5257. }
  5258. }
  5259. };
  5260. // Ensure the presence of an event listener that handles manually-triggered
  5261. // synthetic events by interrupting progress until reinvoked in response to
  5262. // *native* events that it fires directly, ensuring that state changes have
  5263. // already occurred before other listeners are invoked.
  5264. function leverageNative( el, type, expectSync ) {
  5265. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  5266. if ( !expectSync ) {
  5267. if ( dataPriv.get( el, type ) === undefined ) {
  5268. jQuery.event.add( el, type, returnTrue );
  5269. }
  5270. return;
  5271. }
  5272. // Register the controller as a special universal handler for all event namespaces
  5273. dataPriv.set( el, type, false );
  5274. jQuery.event.add( el, type, {
  5275. namespace: false,
  5276. handler: function( event ) {
  5277. var notAsync, result,
  5278. saved = dataPriv.get( this, type );
  5279. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  5280. // Interrupt processing of the outer synthetic .trigger()ed event
  5281. // Saved data should be false in such cases, but might be a leftover capture object
  5282. // from an async native handler (gh-4350)
  5283. if ( !saved.length ) {
  5284. // Store arguments for use when handling the inner native event
  5285. // There will always be at least one argument (an event object), so this array
  5286. // will not be confused with a leftover capture object.
  5287. saved = slice.call( arguments );
  5288. dataPriv.set( this, type, saved );
  5289. // Trigger the native event and capture its result
  5290. // Support: IE <=9 - 11+
  5291. // focus() and blur() are asynchronous
  5292. notAsync = expectSync( this, type );
  5293. this[ type ]();
  5294. result = dataPriv.get( this, type );
  5295. if ( saved !== result || notAsync ) {
  5296. dataPriv.set( this, type, false );
  5297. } else {
  5298. result = {};
  5299. }
  5300. if ( saved !== result ) {
  5301. // Cancel the outer synthetic event
  5302. event.stopImmediatePropagation();
  5303. event.preventDefault();
  5304. return result.value;
  5305. }
  5306. // If this is an inner synthetic event for an event with a bubbling surrogate
  5307. // (focus or blur), assume that the surrogate already propagated from triggering the
  5308. // native event and prevent that from happening again here.
  5309. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  5310. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  5311. // less bad than duplication.
  5312. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  5313. event.stopPropagation();
  5314. }
  5315. // If this is a native event triggered above, everything is now in order
  5316. // Fire an inner synthetic event with the original arguments
  5317. } else if ( saved.length ) {
  5318. // ...and capture the result
  5319. dataPriv.set( this, type, {
  5320. value: jQuery.event.trigger(
  5321. // Support: IE <=9 - 11+
  5322. // Extend with the prototype to reset the above stopImmediatePropagation()
  5323. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  5324. saved.slice( 1 ),
  5325. this
  5326. )
  5327. } );
  5328. // Abort handling of the native event
  5329. event.stopImmediatePropagation();
  5330. }
  5331. }
  5332. } );
  5333. }
  5334. jQuery.removeEvent = function( elem, type, handle ) {
  5335. // This "if" is needed for plain objects
  5336. if ( elem.removeEventListener ) {
  5337. elem.removeEventListener( type, handle );
  5338. }
  5339. };
  5340. jQuery.Event = function( src, props ) {
  5341. // Allow instantiation without the 'new' keyword
  5342. if ( !( this instanceof jQuery.Event ) ) {
  5343. return new jQuery.Event( src, props );
  5344. }
  5345. // Event object
  5346. if ( src && src.type ) {
  5347. this.originalEvent = src;
  5348. this.type = src.type;
  5349. // Events bubbling up the document may have been marked as prevented
  5350. // by a handler lower down the tree; reflect the correct value.
  5351. this.isDefaultPrevented = src.defaultPrevented ||
  5352. src.defaultPrevented === undefined &&
  5353. // Support: Android <=2.3 only
  5354. src.returnValue === false ?
  5355. returnTrue :
  5356. returnFalse;
  5357. // Create target properties
  5358. // Support: Safari <=6 - 7 only
  5359. // Target should not be a text node (#504, #13143)
  5360. this.target = ( src.target && src.target.nodeType === 3 ) ?
  5361. src.target.parentNode :
  5362. src.target;
  5363. this.currentTarget = src.currentTarget;
  5364. this.relatedTarget = src.relatedTarget;
  5365. // Event type
  5366. } else {
  5367. this.type = src;
  5368. }
  5369. // Put explicitly provided properties onto the event object
  5370. if ( props ) {
  5371. jQuery.extend( this, props );
  5372. }
  5373. // Create a timestamp if incoming event doesn't have one
  5374. this.timeStamp = src && src.timeStamp || Date.now();
  5375. // Mark it as fixed
  5376. this[ jQuery.expando ] = true;
  5377. };
  5378. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  5379. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  5380. jQuery.Event.prototype = {
  5381. constructor: jQuery.Event,
  5382. isDefaultPrevented: returnFalse,
  5383. isPropagationStopped: returnFalse,
  5384. isImmediatePropagationStopped: returnFalse,
  5385. isSimulated: false,
  5386. preventDefault: function() {
  5387. var e = this.originalEvent;
  5388. this.isDefaultPrevented = returnTrue;
  5389. if ( e && !this.isSimulated ) {
  5390. e.preventDefault();
  5391. }
  5392. },
  5393. stopPropagation: function() {
  5394. var e = this.originalEvent;
  5395. this.isPropagationStopped = returnTrue;
  5396. if ( e && !this.isSimulated ) {
  5397. e.stopPropagation();
  5398. }
  5399. },
  5400. stopImmediatePropagation: function() {
  5401. var e = this.originalEvent;
  5402. this.isImmediatePropagationStopped = returnTrue;
  5403. if ( e && !this.isSimulated ) {
  5404. e.stopImmediatePropagation();
  5405. }
  5406. this.stopPropagation();
  5407. }
  5408. };
  5409. // Includes all common event props including KeyEvent and MouseEvent specific props
  5410. jQuery.each( {
  5411. altKey: true,
  5412. bubbles: true,
  5413. cancelable: true,
  5414. changedTouches: true,
  5415. ctrlKey: true,
  5416. detail: true,
  5417. eventPhase: true,
  5418. metaKey: true,
  5419. pageX: true,
  5420. pageY: true,
  5421. shiftKey: true,
  5422. view: true,
  5423. "char": true,
  5424. code: true,
  5425. charCode: true,
  5426. key: true,
  5427. keyCode: true,
  5428. button: true,
  5429. buttons: true,
  5430. clientX: true,
  5431. clientY: true,
  5432. offsetX: true,
  5433. offsetY: true,
  5434. pointerId: true,
  5435. pointerType: true,
  5436. screenX: true,
  5437. screenY: true,
  5438. targetTouches: true,
  5439. toElement: true,
  5440. touches: true,
  5441. which: function( event ) {
  5442. var button = event.button;
  5443. // Add which for key events
  5444. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  5445. return event.charCode != null ? event.charCode : event.keyCode;
  5446. }
  5447. // Add which for click: 1 === left; 2 === middle; 3 === right
  5448. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  5449. if ( button & 1 ) {
  5450. return 1;
  5451. }
  5452. if ( button & 2 ) {
  5453. return 3;
  5454. }
  5455. if ( button & 4 ) {
  5456. return 2;
  5457. }
  5458. return 0;
  5459. }
  5460. return event.which;
  5461. }
  5462. }, jQuery.event.addProp );
  5463. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  5464. jQuery.event.special[ type ] = {
  5465. // Utilize native event if possible so blur/focus sequence is correct
  5466. setup: function() {
  5467. // Claim the first handler
  5468. // dataPriv.set( this, "focus", ... )
  5469. // dataPriv.set( this, "blur", ... )
  5470. leverageNative( this, type, expectSync );
  5471. // Return false to allow normal processing in the caller
  5472. return false;
  5473. },
  5474. trigger: function() {
  5475. // Force setup before trigger
  5476. leverageNative( this, type );
  5477. // Return non-false to allow normal event-path propagation
  5478. return true;
  5479. },
  5480. delegateType: delegateType
  5481. };
  5482. } );
  5483. // Create mouseenter/leave events using mouseover/out and event-time checks
  5484. // so that event delegation works in jQuery.
  5485. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  5486. //
  5487. // Support: Safari 7 only
  5488. // Safari sends mouseenter too often; see:
  5489. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  5490. // for the description of the bug (it existed in older Chrome versions as well).
  5491. jQuery.each( {
  5492. mouseenter: "mouseover",
  5493. mouseleave: "mouseout",
  5494. pointerenter: "pointerover",
  5495. pointerleave: "pointerout"
  5496. }, function( orig, fix ) {
  5497. jQuery.event.special[ orig ] = {
  5498. delegateType: fix,
  5499. bindType: fix,
  5500. handle: function( event ) {
  5501. var ret,
  5502. target = this,
  5503. related = event.relatedTarget,
  5504. handleObj = event.handleObj;
  5505. // For mouseenter/leave call the handler if related is outside the target.
  5506. // NB: No relatedTarget if the mouse left/entered the browser window
  5507. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  5508. event.type = handleObj.origType;
  5509. ret = handleObj.handler.apply( this, arguments );
  5510. event.type = fix;
  5511. }
  5512. return ret;
  5513. }
  5514. };
  5515. } );
  5516. jQuery.fn.extend( {
  5517. on: function( types, selector, data, fn ) {
  5518. return on( this, types, selector, data, fn );
  5519. },
  5520. one: function( types, selector, data, fn ) {
  5521. return on( this, types, selector, data, fn, 1 );
  5522. },
  5523. off: function( types, selector, fn ) {
  5524. var handleObj, type;
  5525. if ( types && types.preventDefault && types.handleObj ) {
  5526. // ( event ) dispatched jQuery.Event
  5527. handleObj = types.handleObj;
  5528. jQuery( types.delegateTarget ).off(
  5529. handleObj.namespace ?
  5530. handleObj.origType + "." + handleObj.namespace :
  5531. handleObj.origType,
  5532. handleObj.selector,
  5533. handleObj.handler
  5534. );
  5535. return this;
  5536. }
  5537. if ( typeof types === "object" ) {
  5538. // ( types-object [, selector] )
  5539. for ( type in types ) {
  5540. this.off( type, selector, types[ type ] );
  5541. }
  5542. return this;
  5543. }
  5544. if ( selector === false || typeof selector === "function" ) {
  5545. // ( types [, fn] )
  5546. fn = selector;
  5547. selector = undefined;
  5548. }
  5549. if ( fn === false ) {
  5550. fn = returnFalse;
  5551. }
  5552. return this.each( function() {
  5553. jQuery.event.remove( this, types, fn, selector );
  5554. } );
  5555. }
  5556. } );
  5557. var
  5558. /* eslint-disable max-len */
  5559. // See https://github.com/eslint/eslint/issues/3229
  5560. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  5561. /* eslint-enable */
  5562. // Support: IE <=10 - 11, Edge 12 - 13 only
  5563. // In IE/Edge using regex groups here causes severe slowdowns.
  5564. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  5565. rnoInnerhtml = /<script|<style|<link/i,
  5566. // checked="checked" or checked
  5567. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  5568. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  5569. // Prefer a tbody over its parent table for containing new rows
  5570. function manipulationTarget( elem, content ) {
  5571. if ( nodeName( elem, "table" ) &&
  5572. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  5573. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  5574. }
  5575. return elem;
  5576. }
  5577. // Replace/restore the type attribute of script elements for safe DOM manipulation
  5578. function disableScript( elem ) {
  5579. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  5580. return elem;
  5581. }
  5582. function restoreScript( elem ) {
  5583. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  5584. elem.type = elem.type.slice( 5 );
  5585. } else {
  5586. elem.removeAttribute( "type" );
  5587. }
  5588. return elem;
  5589. }
  5590. function cloneCopyEvent( src, dest ) {
  5591. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  5592. if ( dest.nodeType !== 1 ) {
  5593. return;
  5594. }
  5595. // 1. Copy private data: events, handlers, etc.
  5596. if ( dataPriv.hasData( src ) ) {
  5597. pdataOld = dataPriv.access( src );
  5598. pdataCur = dataPriv.set( dest, pdataOld );
  5599. events = pdataOld.events;
  5600. if ( events ) {
  5601. delete pdataCur.handle;
  5602. pdataCur.events = {};
  5603. for ( type in events ) {
  5604. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  5605. jQuery.event.add( dest, type, events[ type ][ i ] );
  5606. }
  5607. }
  5608. }
  5609. }
  5610. // 2. Copy user data
  5611. if ( dataUser.hasData( src ) ) {
  5612. udataOld = dataUser.access( src );
  5613. udataCur = jQuery.extend( {}, udataOld );
  5614. dataUser.set( dest, udataCur );
  5615. }
  5616. }
  5617. // Fix IE bugs, see support tests
  5618. function fixInput( src, dest ) {
  5619. var nodeName = dest.nodeName.toLowerCase();
  5620. // Fails to persist the checked state of a cloned checkbox or radio button.
  5621. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  5622. dest.checked = src.checked;
  5623. // Fails to return the selected option to the default selected state when cloning options
  5624. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  5625. dest.defaultValue = src.defaultValue;
  5626. }
  5627. }
  5628. function domManip( collection, args, callback, ignored ) {
  5629. // Flatten any nested arrays
  5630. args = concat.apply( [], args );
  5631. var fragment, first, scripts, hasScripts, node, doc,
  5632. i = 0,
  5633. l = collection.length,
  5634. iNoClone = l - 1,
  5635. value = args[ 0 ],
  5636. valueIsFunction = isFunction( value );
  5637. // We can't cloneNode fragments that contain checked, in WebKit
  5638. if ( valueIsFunction ||
  5639. ( l > 1 && typeof value === "string" &&
  5640. !support.checkClone && rchecked.test( value ) ) ) {
  5641. return collection.each( function( index ) {
  5642. var self = collection.eq( index );
  5643. if ( valueIsFunction ) {
  5644. args[ 0 ] = value.call( this, index, self.html() );
  5645. }
  5646. domManip( self, args, callback, ignored );
  5647. } );
  5648. }
  5649. if ( l ) {
  5650. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  5651. first = fragment.firstChild;
  5652. if ( fragment.childNodes.length === 1 ) {
  5653. fragment = first;
  5654. }
  5655. // Require either new content or an interest in ignored elements to invoke the callback
  5656. if ( first || ignored ) {
  5657. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  5658. hasScripts = scripts.length;
  5659. // Use the original fragment for the last item
  5660. // instead of the first because it can end up
  5661. // being emptied incorrectly in certain situations (#8070).
  5662. for ( ; i < l; i++ ) {
  5663. node = fragment;
  5664. if ( i !== iNoClone ) {
  5665. node = jQuery.clone( node, true, true );
  5666. // Keep references to cloned scripts for later restoration
  5667. if ( hasScripts ) {
  5668. // Support: Android <=4.0 only, PhantomJS 1 only
  5669. // push.apply(_, arraylike) throws on ancient WebKit
  5670. jQuery.merge( scripts, getAll( node, "script" ) );
  5671. }
  5672. }
  5673. callback.call( collection[ i ], node, i );
  5674. }
  5675. if ( hasScripts ) {
  5676. doc = scripts[ scripts.length - 1 ].ownerDocument;
  5677. // Reenable scripts
  5678. jQuery.map( scripts, restoreScript );
  5679. // Evaluate executable scripts on first document insertion
  5680. for ( i = 0; i < hasScripts; i++ ) {
  5681. node = scripts[ i ];
  5682. if ( rscriptType.test( node.type || "" ) &&
  5683. !dataPriv.access( node, "globalEval" ) &&
  5684. jQuery.contains( doc, node ) ) {
  5685. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  5686. // Optional AJAX dependency, but won't run scripts if not present
  5687. if ( jQuery._evalUrl && !node.noModule ) {
  5688. jQuery._evalUrl( node.src, {
  5689. nonce: node.nonce || node.getAttribute( "nonce" )
  5690. } );
  5691. }
  5692. } else {
  5693. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  5694. }
  5695. }
  5696. }
  5697. }
  5698. }
  5699. }
  5700. return collection;
  5701. }
  5702. function remove( elem, selector, keepData ) {
  5703. var node,
  5704. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  5705. i = 0;
  5706. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  5707. if ( !keepData && node.nodeType === 1 ) {
  5708. jQuery.cleanData( getAll( node ) );
  5709. }
  5710. if ( node.parentNode ) {
  5711. if ( keepData && isAttached( node ) ) {
  5712. setGlobalEval( getAll( node, "script" ) );
  5713. }
  5714. node.parentNode.removeChild( node );
  5715. }
  5716. }
  5717. return elem;
  5718. }
  5719. jQuery.extend( {
  5720. htmlPrefilter: function( html ) {
  5721. return html.replace( rxhtmlTag, "<$1></$2>" );
  5722. },
  5723. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  5724. var i, l, srcElements, destElements,
  5725. clone = elem.cloneNode( true ),
  5726. inPage = isAttached( elem );
  5727. // Fix IE cloning issues
  5728. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  5729. !jQuery.isXMLDoc( elem ) ) {
  5730. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  5731. destElements = getAll( clone );
  5732. srcElements = getAll( elem );
  5733. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  5734. fixInput( srcElements[ i ], destElements[ i ] );
  5735. }
  5736. }
  5737. // Copy the events from the original to the clone
  5738. if ( dataAndEvents ) {
  5739. if ( deepDataAndEvents ) {
  5740. srcElements = srcElements || getAll( elem );
  5741. destElements = destElements || getAll( clone );
  5742. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  5743. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  5744. }
  5745. } else {
  5746. cloneCopyEvent( elem, clone );
  5747. }
  5748. }
  5749. // Preserve script evaluation history
  5750. destElements = getAll( clone, "script" );
  5751. if ( destElements.length > 0 ) {
  5752. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  5753. }
  5754. // Return the cloned set
  5755. return clone;
  5756. },
  5757. cleanData: function( elems ) {
  5758. var data, elem, type,
  5759. special = jQuery.event.special,
  5760. i = 0;
  5761. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  5762. if ( acceptData( elem ) ) {
  5763. if ( ( data = elem[ dataPriv.expando ] ) ) {
  5764. if ( data.events ) {
  5765. for ( type in data.events ) {
  5766. if ( special[ type ] ) {
  5767. jQuery.event.remove( elem, type );
  5768. // This is a shortcut to avoid jQuery.event.remove's overhead
  5769. } else {
  5770. jQuery.removeEvent( elem, type, data.handle );
  5771. }
  5772. }
  5773. }
  5774. // Support: Chrome <=35 - 45+
  5775. // Assign undefined instead of using delete, see Data#remove
  5776. elem[ dataPriv.expando ] = undefined;
  5777. }
  5778. if ( elem[ dataUser.expando ] ) {
  5779. // Support: Chrome <=35 - 45+
  5780. // Assign undefined instead of using delete, see Data#remove
  5781. elem[ dataUser.expando ] = undefined;
  5782. }
  5783. }
  5784. }
  5785. }
  5786. } );
  5787. jQuery.fn.extend( {
  5788. detach: function( selector ) {
  5789. return remove( this, selector, true );
  5790. },
  5791. remove: function( selector ) {
  5792. return remove( this, selector );
  5793. },
  5794. text: function( value ) {
  5795. return access( this, function( value ) {
  5796. return value === undefined ?
  5797. jQuery.text( this ) :
  5798. this.empty().each( function() {
  5799. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  5800. this.textContent = value;
  5801. }
  5802. } );
  5803. }, null, value, arguments.length );
  5804. },
  5805. append: function() {
  5806. return domManip( this, arguments, function( elem ) {
  5807. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  5808. var target = manipulationTarget( this, elem );
  5809. target.appendChild( elem );
  5810. }
  5811. } );
  5812. },
  5813. prepend: function() {
  5814. return domManip( this, arguments, function( elem ) {
  5815. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  5816. var target = manipulationTarget( this, elem );
  5817. target.insertBefore( elem, target.firstChild );
  5818. }
  5819. } );
  5820. },
  5821. before: function() {
  5822. return domManip( this, arguments, function( elem ) {
  5823. if ( this.parentNode ) {
  5824. this.parentNode.insertBefore( elem, this );
  5825. }
  5826. } );
  5827. },
  5828. after: function() {
  5829. return domManip( this, arguments, function( elem ) {
  5830. if ( this.parentNode ) {
  5831. this.parentNode.insertBefore( elem, this.nextSibling );
  5832. }
  5833. } );
  5834. },
  5835. empty: function() {
  5836. var elem,
  5837. i = 0;
  5838. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  5839. if ( elem.nodeType === 1 ) {
  5840. // Prevent memory leaks
  5841. jQuery.cleanData( getAll( elem, false ) );
  5842. // Remove any remaining nodes
  5843. elem.textContent = "";
  5844. }
  5845. }
  5846. return this;
  5847. },
  5848. clone: function( dataAndEvents, deepDataAndEvents ) {
  5849. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  5850. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  5851. return this.map( function() {
  5852. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  5853. } );
  5854. },
  5855. html: function( value ) {
  5856. return access( this, function( value ) {
  5857. var elem = this[ 0 ] || {},
  5858. i = 0,
  5859. l = this.length;
  5860. if ( value === undefined && elem.nodeType === 1 ) {
  5861. return elem.innerHTML;
  5862. }
  5863. // See if we can take a shortcut and just use innerHTML
  5864. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  5865. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  5866. value = jQuery.htmlPrefilter( value );
  5867. try {
  5868. for ( ; i < l; i++ ) {
  5869. elem = this[ i ] || {};
  5870. // Remove element nodes and prevent memory leaks
  5871. if ( elem.nodeType === 1 ) {
  5872. jQuery.cleanData( getAll( elem, false ) );
  5873. elem.innerHTML = value;
  5874. }
  5875. }
  5876. elem = 0;
  5877. // If using innerHTML throws an exception, use the fallback method
  5878. } catch ( e ) {}
  5879. }
  5880. if ( elem ) {
  5881. this.empty().append( value );
  5882. }
  5883. }, null, value, arguments.length );
  5884. },
  5885. replaceWith: function() {
  5886. var ignored = [];
  5887. // Make the changes, replacing each non-ignored context element with the new content
  5888. return domManip( this, arguments, function( elem ) {
  5889. var parent = this.parentNode;
  5890. if ( jQuery.inArray( this, ignored ) < 0 ) {
  5891. jQuery.cleanData( getAll( this ) );
  5892. if ( parent ) {
  5893. parent.replaceChild( elem, this );
  5894. }
  5895. }
  5896. // Force callback invocation
  5897. }, ignored );
  5898. }
  5899. } );
  5900. jQuery.each( {
  5901. appendTo: "append",
  5902. prependTo: "prepend",
  5903. insertBefore: "before",
  5904. insertAfter: "after",
  5905. replaceAll: "replaceWith"
  5906. }, function( name, original ) {
  5907. jQuery.fn[ name ] = function( selector ) {
  5908. var elems,
  5909. ret = [],
  5910. insert = jQuery( selector ),
  5911. last = insert.length - 1,
  5912. i = 0;
  5913. for ( ; i <= last; i++ ) {
  5914. elems = i === last ? this : this.clone( true );
  5915. jQuery( insert[ i ] )[ original ]( elems );
  5916. // Support: Android <=4.0 only, PhantomJS 1 only
  5917. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  5918. push.apply( ret, elems.get() );
  5919. }
  5920. return this.pushStack( ret );
  5921. };
  5922. } );
  5923. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  5924. var getStyles = function( elem ) {
  5925. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  5926. // IE throws on elements created in popups
  5927. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  5928. var view = elem.ownerDocument.defaultView;
  5929. if ( !view || !view.opener ) {
  5930. view = window;
  5931. }
  5932. return view.getComputedStyle( elem );
  5933. };
  5934. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  5935. ( function() {
  5936. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  5937. // so they're executed at the same time to save the second computation.
  5938. function computeStyleTests() {
  5939. // This is a singleton, we need to execute it only once
  5940. if ( !div ) {
  5941. return;
  5942. }
  5943. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  5944. "margin-top:1px;padding:0;border:0";
  5945. div.style.cssText =
  5946. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  5947. "margin:auto;border:1px;padding:1px;" +
  5948. "width:60%;top:1%";
  5949. documentElement.appendChild( container ).appendChild( div );
  5950. var divStyle = window.getComputedStyle( div );
  5951. pixelPositionVal = divStyle.top !== "1%";
  5952. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  5953. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  5954. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  5955. // Some styles come back with percentage values, even though they shouldn't
  5956. div.style.right = "60%";
  5957. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  5958. // Support: IE 9 - 11 only
  5959. // Detect misreporting of content dimensions for box-sizing:border-box elements
  5960. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  5961. // Support: IE 9 only
  5962. // Detect overflow:scroll screwiness (gh-3699)
  5963. // Support: Chrome <=64
  5964. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  5965. div.style.position = "absolute";
  5966. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  5967. documentElement.removeChild( container );
  5968. // Nullify the div so it wouldn't be stored in the memory and
  5969. // it will also be a sign that checks already performed
  5970. div = null;
  5971. }
  5972. function roundPixelMeasures( measure ) {
  5973. return Math.round( parseFloat( measure ) );
  5974. }
  5975. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  5976. reliableMarginLeftVal,
  5977. container = document.createElement( "div" ),
  5978. div = document.createElement( "div" );
  5979. // Finish early in limited (non-browser) environments
  5980. if ( !div.style ) {
  5981. return;
  5982. }
  5983. // Support: IE <=9 - 11 only
  5984. // Style of cloned element affects source element cloned (#8908)
  5985. div.style.backgroundClip = "content-box";
  5986. div.cloneNode( true ).style.backgroundClip = "";
  5987. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  5988. jQuery.extend( support, {
  5989. boxSizingReliable: function() {
  5990. computeStyleTests();
  5991. return boxSizingReliableVal;
  5992. },
  5993. pixelBoxStyles: function() {
  5994. computeStyleTests();
  5995. return pixelBoxStylesVal;
  5996. },
  5997. pixelPosition: function() {
  5998. computeStyleTests();
  5999. return pixelPositionVal;
  6000. },
  6001. reliableMarginLeft: function() {
  6002. computeStyleTests();
  6003. return reliableMarginLeftVal;
  6004. },
  6005. scrollboxSize: function() {
  6006. computeStyleTests();
  6007. return scrollboxSizeVal;
  6008. }
  6009. } );
  6010. } )();
  6011. function curCSS( elem, name, computed ) {
  6012. var width, minWidth, maxWidth, ret,
  6013. // Support: Firefox 51+
  6014. // Retrieving style before computed somehow
  6015. // fixes an issue with getting wrong values
  6016. // on detached elements
  6017. style = elem.style;
  6018. computed = computed || getStyles( elem );
  6019. // getPropertyValue is needed for:
  6020. // .css('filter') (IE 9 only, #12537)
  6021. // .css('--customProperty) (#3144)
  6022. if ( computed ) {
  6023. ret = computed.getPropertyValue( name ) || computed[ name ];
  6024. if ( ret === "" && !isAttached( elem ) ) {
  6025. ret = jQuery.style( elem, name );
  6026. }
  6027. // A tribute to the "awesome hack by Dean Edwards"
  6028. // Android Browser returns percentage for some values,
  6029. // but width seems to be reliably pixels.
  6030. // This is against the CSSOM draft spec:
  6031. // https://drafts.csswg.org/cssom/#resolved-values
  6032. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  6033. // Remember the original values
  6034. width = style.width;
  6035. minWidth = style.minWidth;
  6036. maxWidth = style.maxWidth;
  6037. // Put in the new values to get a computed value out
  6038. style.minWidth = style.maxWidth = style.width = ret;
  6039. ret = computed.width;
  6040. // Revert the changed values
  6041. style.width = width;
  6042. style.minWidth = minWidth;
  6043. style.maxWidth = maxWidth;
  6044. }
  6045. }
  6046. return ret !== undefined ?
  6047. // Support: IE <=9 - 11 only
  6048. // IE returns zIndex value as an integer.
  6049. ret + "" :
  6050. ret;
  6051. }
  6052. function addGetHookIf( conditionFn, hookFn ) {
  6053. // Define the hook, we'll check on the first run if it's really needed.
  6054. return {
  6055. get: function() {
  6056. if ( conditionFn() ) {
  6057. // Hook not needed (or it's not possible to use it due
  6058. // to missing dependency), remove it.
  6059. delete this.get;
  6060. return;
  6061. }
  6062. // Hook needed; redefine it so that the support test is not executed again.
  6063. return ( this.get = hookFn ).apply( this, arguments );
  6064. }
  6065. };
  6066. }
  6067. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  6068. emptyStyle = document.createElement( "div" ).style,
  6069. vendorProps = {};
  6070. // Return a vendor-prefixed property or undefined
  6071. function vendorPropName( name ) {
  6072. // Check for vendor prefixed names
  6073. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  6074. i = cssPrefixes.length;
  6075. while ( i-- ) {
  6076. name = cssPrefixes[ i ] + capName;
  6077. if ( name in emptyStyle ) {
  6078. return name;
  6079. }
  6080. }
  6081. }
  6082. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  6083. function finalPropName( name ) {
  6084. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  6085. if ( final ) {
  6086. return final;
  6087. }
  6088. if ( name in emptyStyle ) {
  6089. return name;
  6090. }
  6091. return vendorProps[ name ] = vendorPropName( name ) || name;
  6092. }
  6093. var
  6094. // Swappable if display is none or starts with table
  6095. // except "table", "table-cell", or "table-caption"
  6096. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  6097. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  6098. rcustomProp = /^--/,
  6099. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  6100. cssNormalTransform = {
  6101. letterSpacing: "0",
  6102. fontWeight: "400"
  6103. };
  6104. function setPositiveNumber( elem, value, subtract ) {
  6105. // Any relative (+/-) values have already been
  6106. // normalized at this point
  6107. var matches = rcssNum.exec( value );
  6108. return matches ?
  6109. // Guard against undefined "subtract", e.g., when used as in cssHooks
  6110. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  6111. value;
  6112. }
  6113. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  6114. var i = dimension === "width" ? 1 : 0,
  6115. extra = 0,
  6116. delta = 0;
  6117. // Adjustment may not be necessary
  6118. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  6119. return 0;
  6120. }
  6121. for ( ; i < 4; i += 2 ) {
  6122. // Both box models exclude margin
  6123. if ( box === "margin" ) {
  6124. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  6125. }
  6126. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  6127. if ( !isBorderBox ) {
  6128. // Add padding
  6129. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  6130. // For "border" or "margin", add border
  6131. if ( box !== "padding" ) {
  6132. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  6133. // But still keep track of it otherwise
  6134. } else {
  6135. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  6136. }
  6137. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  6138. // "padding" or "margin"
  6139. } else {
  6140. // For "content", subtract padding
  6141. if ( box === "content" ) {
  6142. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  6143. }
  6144. // For "content" or "padding", subtract border
  6145. if ( box !== "margin" ) {
  6146. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  6147. }
  6148. }
  6149. }
  6150. // Account for positive content-box scroll gutter when requested by providing computedVal
  6151. if ( !isBorderBox && computedVal >= 0 ) {
  6152. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  6153. // Assuming integer scroll gutter, subtract the rest and round down
  6154. delta += Math.max( 0, Math.ceil(
  6155. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  6156. computedVal -
  6157. delta -
  6158. extra -
  6159. 0.5
  6160. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  6161. // Use an explicit zero to avoid NaN (gh-3964)
  6162. ) ) || 0;
  6163. }
  6164. return delta;
  6165. }
  6166. function getWidthOrHeight( elem, dimension, extra ) {
  6167. // Start with computed style
  6168. var styles = getStyles( elem ),
  6169. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  6170. // Fake content-box until we know it's needed to know the true value.
  6171. boxSizingNeeded = !support.boxSizingReliable() || extra,
  6172. isBorderBox = boxSizingNeeded &&
  6173. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  6174. valueIsBorderBox = isBorderBox,
  6175. val = curCSS( elem, dimension, styles ),
  6176. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  6177. // Support: Firefox <=54
  6178. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  6179. if ( rnumnonpx.test( val ) ) {
  6180. if ( !extra ) {
  6181. return val;
  6182. }
  6183. val = "auto";
  6184. }
  6185. // Fall back to offsetWidth/offsetHeight when value is "auto"
  6186. // This happens for inline elements with no explicit setting (gh-3571)
  6187. // Support: Android <=4.1 - 4.3 only
  6188. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  6189. // Support: IE 9-11 only
  6190. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  6191. // We use getClientRects() to check for hidden/disconnected.
  6192. // In those cases, the computed value can be trusted to be border-box
  6193. if ( ( !support.boxSizingReliable() && isBorderBox ||
  6194. val === "auto" ||
  6195. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  6196. elem.getClientRects().length ) {
  6197. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  6198. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  6199. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  6200. // retrieved value as a content box dimension.
  6201. valueIsBorderBox = offsetProp in elem;
  6202. if ( valueIsBorderBox ) {
  6203. val = elem[ offsetProp ];
  6204. }
  6205. }
  6206. // Normalize "" and auto
  6207. val = parseFloat( val ) || 0;
  6208. // Adjust for the element's box model
  6209. return ( val +
  6210. boxModelAdjustment(
  6211. elem,
  6212. dimension,
  6213. extra || ( isBorderBox ? "border" : "content" ),
  6214. valueIsBorderBox,
  6215. styles,
  6216. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  6217. val
  6218. )
  6219. ) + "px";
  6220. }
  6221. jQuery.extend( {
  6222. // Add in style property hooks for overriding the default
  6223. // behavior of getting and setting a style property
  6224. cssHooks: {
  6225. opacity: {
  6226. get: function( elem, computed ) {
  6227. if ( computed ) {
  6228. // We should always get a number back from opacity
  6229. var ret = curCSS( elem, "opacity" );
  6230. return ret === "" ? "1" : ret;
  6231. }
  6232. }
  6233. }
  6234. },
  6235. // Don't automatically add "px" to these possibly-unitless properties
  6236. cssNumber: {
  6237. "animationIterationCount": true,
  6238. "columnCount": true,
  6239. "fillOpacity": true,
  6240. "flexGrow": true,
  6241. "flexShrink": true,
  6242. "fontWeight": true,
  6243. "gridArea": true,
  6244. "gridColumn": true,
  6245. "gridColumnEnd": true,
  6246. "gridColumnStart": true,
  6247. "gridRow": true,
  6248. "gridRowEnd": true,
  6249. "gridRowStart": true,
  6250. "lineHeight": true,
  6251. "opacity": true,
  6252. "order": true,
  6253. "orphans": true,
  6254. "widows": true,
  6255. "zIndex": true,
  6256. "zoom": true
  6257. },
  6258. // Add in properties whose names you wish to fix before
  6259. // setting or getting the value
  6260. cssProps: {},
  6261. // Get and set the style property on a DOM Node
  6262. style: function( elem, name, value, extra ) {
  6263. // Don't set styles on text and comment nodes
  6264. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  6265. return;
  6266. }
  6267. // Make sure that we're working with the right name
  6268. var ret, type, hooks,
  6269. origName = camelCase( name ),
  6270. isCustomProp = rcustomProp.test( name ),
  6271. style = elem.style;
  6272. // Make sure that we're working with the right name. We don't
  6273. // want to query the value if it is a CSS custom property
  6274. // since they are user-defined.
  6275. if ( !isCustomProp ) {
  6276. name = finalPropName( origName );
  6277. }
  6278. // Gets hook for the prefixed version, then unprefixed version
  6279. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  6280. // Check if we're setting a value
  6281. if ( value !== undefined ) {
  6282. type = typeof value;
  6283. // Convert "+=" or "-=" to relative numbers (#7345)
  6284. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  6285. value = adjustCSS( elem, name, ret );
  6286. // Fixes bug #9237
  6287. type = "number";
  6288. }
  6289. // Make sure that null and NaN values aren't set (#7116)
  6290. if ( value == null || value !== value ) {
  6291. return;
  6292. }
  6293. // If a number was passed in, add the unit (except for certain CSS properties)
  6294. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  6295. // "px" to a few hardcoded values.
  6296. if ( type === "number" && !isCustomProp ) {
  6297. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  6298. }
  6299. // background-* props affect original clone's values
  6300. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  6301. style[ name ] = "inherit";
  6302. }
  6303. // If a hook was provided, use that value, otherwise just set the specified value
  6304. if ( !hooks || !( "set" in hooks ) ||
  6305. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  6306. if ( isCustomProp ) {
  6307. style.setProperty( name, value );
  6308. } else {
  6309. style[ name ] = value;
  6310. }
  6311. }
  6312. } else {
  6313. // If a hook was provided get the non-computed value from there
  6314. if ( hooks && "get" in hooks &&
  6315. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  6316. return ret;
  6317. }
  6318. // Otherwise just get the value from the style object
  6319. return style[ name ];
  6320. }
  6321. },
  6322. css: function( elem, name, extra, styles ) {
  6323. var val, num, hooks,
  6324. origName = camelCase( name ),
  6325. isCustomProp = rcustomProp.test( name );
  6326. // Make sure that we're working with the right name. We don't
  6327. // want to modify the value if it is a CSS custom property
  6328. // since they are user-defined.
  6329. if ( !isCustomProp ) {
  6330. name = finalPropName( origName );
  6331. }
  6332. // Try prefixed name followed by the unprefixed name
  6333. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  6334. // If a hook was provided get the computed value from there
  6335. if ( hooks && "get" in hooks ) {
  6336. val = hooks.get( elem, true, extra );
  6337. }
  6338. // Otherwise, if a way to get the computed value exists, use that
  6339. if ( val === undefined ) {
  6340. val = curCSS( elem, name, styles );
  6341. }
  6342. // Convert "normal" to computed value
  6343. if ( val === "normal" && name in cssNormalTransform ) {
  6344. val = cssNormalTransform[ name ];
  6345. }
  6346. // Make numeric if forced or a qualifier was provided and val looks numeric
  6347. if ( extra === "" || extra ) {
  6348. num = parseFloat( val );
  6349. return extra === true || isFinite( num ) ? num || 0 : val;
  6350. }
  6351. return val;
  6352. }
  6353. } );
  6354. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  6355. jQuery.cssHooks[ dimension ] = {
  6356. get: function( elem, computed, extra ) {
  6357. if ( computed ) {
  6358. // Certain elements can have dimension info if we invisibly show them
  6359. // but it must have a current display style that would benefit
  6360. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  6361. // Support: Safari 8+
  6362. // Table columns in Safari have non-zero offsetWidth & zero
  6363. // getBoundingClientRect().width unless display is changed.
  6364. // Support: IE <=11 only
  6365. // Running getBoundingClientRect on a disconnected node
  6366. // in IE throws an error.
  6367. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  6368. swap( elem, cssShow, function() {
  6369. return getWidthOrHeight( elem, dimension, extra );
  6370. } ) :
  6371. getWidthOrHeight( elem, dimension, extra );
  6372. }
  6373. },
  6374. set: function( elem, value, extra ) {
  6375. var matches,
  6376. styles = getStyles( elem ),
  6377. // Only read styles.position if the test has a chance to fail
  6378. // to avoid forcing a reflow.
  6379. scrollboxSizeBuggy = !support.scrollboxSize() &&
  6380. styles.position === "absolute",
  6381. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  6382. boxSizingNeeded = scrollboxSizeBuggy || extra,
  6383. isBorderBox = boxSizingNeeded &&
  6384. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  6385. subtract = extra ?
  6386. boxModelAdjustment(
  6387. elem,
  6388. dimension,
  6389. extra,
  6390. isBorderBox,
  6391. styles
  6392. ) :
  6393. 0;
  6394. // Account for unreliable border-box dimensions by comparing offset* to computed and
  6395. // faking a content-box to get border and padding (gh-3699)
  6396. if ( isBorderBox && scrollboxSizeBuggy ) {
  6397. subtract -= Math.ceil(
  6398. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  6399. parseFloat( styles[ dimension ] ) -
  6400. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  6401. 0.5
  6402. );
  6403. }
  6404. // Convert to pixels if value adjustment is needed
  6405. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  6406. ( matches[ 3 ] || "px" ) !== "px" ) {
  6407. elem.style[ dimension ] = value;
  6408. value = jQuery.css( elem, dimension );
  6409. }
  6410. return setPositiveNumber( elem, value, subtract );
  6411. }
  6412. };
  6413. } );
  6414. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  6415. function( elem, computed ) {
  6416. if ( computed ) {
  6417. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  6418. elem.getBoundingClientRect().left -
  6419. swap( elem, { marginLeft: 0 }, function() {
  6420. return elem.getBoundingClientRect().left;
  6421. } )
  6422. ) + "px";
  6423. }
  6424. }
  6425. );
  6426. // These hooks are used by animate to expand properties
  6427. jQuery.each( {
  6428. margin: "",
  6429. padding: "",
  6430. border: "Width"
  6431. }, function( prefix, suffix ) {
  6432. jQuery.cssHooks[ prefix + suffix ] = {
  6433. expand: function( value ) {
  6434. var i = 0,
  6435. expanded = {},
  6436. // Assumes a single number if not a string
  6437. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  6438. for ( ; i < 4; i++ ) {
  6439. expanded[ prefix + cssExpand[ i ] + suffix ] =
  6440. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  6441. }
  6442. return expanded;
  6443. }
  6444. };
  6445. if ( prefix !== "margin" ) {
  6446. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  6447. }
  6448. } );
  6449. jQuery.fn.extend( {
  6450. css: function( name, value ) {
  6451. return access( this, function( elem, name, value ) {
  6452. var styles, len,
  6453. map = {},
  6454. i = 0;
  6455. if ( Array.isArray( name ) ) {
  6456. styles = getStyles( elem );
  6457. len = name.length;
  6458. for ( ; i < len; i++ ) {
  6459. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  6460. }
  6461. return map;
  6462. }
  6463. return value !== undefined ?
  6464. jQuery.style( elem, name, value ) :
  6465. jQuery.css( elem, name );
  6466. }, name, value, arguments.length > 1 );
  6467. }
  6468. } );
  6469. function Tween( elem, options, prop, end, easing ) {
  6470. return new Tween.prototype.init( elem, options, prop, end, easing );
  6471. }
  6472. jQuery.Tween = Tween;
  6473. Tween.prototype = {
  6474. constructor: Tween,
  6475. init: function( elem, options, prop, end, easing, unit ) {
  6476. this.elem = elem;
  6477. this.prop = prop;
  6478. this.easing = easing || jQuery.easing._default;
  6479. this.options = options;
  6480. this.start = this.now = this.cur();
  6481. this.end = end;
  6482. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  6483. },
  6484. cur: function() {
  6485. var hooks = Tween.propHooks[ this.prop ];
  6486. return hooks && hooks.get ?
  6487. hooks.get( this ) :
  6488. Tween.propHooks._default.get( this );
  6489. },
  6490. run: function( percent ) {
  6491. var eased,
  6492. hooks = Tween.propHooks[ this.prop ];
  6493. if ( this.options.duration ) {
  6494. this.pos = eased = jQuery.easing[ this.easing ](
  6495. percent, this.options.duration * percent, 0, 1, this.options.duration
  6496. );
  6497. } else {
  6498. this.pos = eased = percent;
  6499. }
  6500. this.now = ( this.end - this.start ) * eased + this.start;
  6501. if ( this.options.step ) {
  6502. this.options.step.call( this.elem, this.now, this );
  6503. }
  6504. if ( hooks && hooks.set ) {
  6505. hooks.set( this );
  6506. } else {
  6507. Tween.propHooks._default.set( this );
  6508. }
  6509. return this;
  6510. }
  6511. };
  6512. Tween.prototype.init.prototype = Tween.prototype;
  6513. Tween.propHooks = {
  6514. _default: {
  6515. get: function( tween ) {
  6516. var result;
  6517. // Use a property on the element directly when it is not a DOM element,
  6518. // or when there is no matching style property that exists.
  6519. if ( tween.elem.nodeType !== 1 ||
  6520. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  6521. return tween.elem[ tween.prop ];
  6522. }
  6523. // Passing an empty string as a 3rd parameter to .css will automatically
  6524. // attempt a parseFloat and fallback to a string if the parse fails.
  6525. // Simple values such as "10px" are parsed to Float;
  6526. // complex values such as "rotate(1rad)" are returned as-is.
  6527. result = jQuery.css( tween.elem, tween.prop, "" );
  6528. // Empty strings, null, undefined and "auto" are converted to 0.
  6529. return !result || result === "auto" ? 0 : result;
  6530. },
  6531. set: function( tween ) {
  6532. // Use step hook for back compat.
  6533. // Use cssHook if its there.
  6534. // Use .style if available and use plain properties where available.
  6535. if ( jQuery.fx.step[ tween.prop ] ) {
  6536. jQuery.fx.step[ tween.prop ]( tween );
  6537. } else if ( tween.elem.nodeType === 1 && (
  6538. jQuery.cssHooks[ tween.prop ] ||
  6539. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  6540. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  6541. } else {
  6542. tween.elem[ tween.prop ] = tween.now;
  6543. }
  6544. }
  6545. }
  6546. };
  6547. // Support: IE <=9 only
  6548. // Panic based approach to setting things on disconnected nodes
  6549. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  6550. set: function( tween ) {
  6551. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  6552. tween.elem[ tween.prop ] = tween.now;
  6553. }
  6554. }
  6555. };
  6556. jQuery.easing = {
  6557. linear: function( p ) {
  6558. return p;
  6559. },
  6560. swing: function( p ) {
  6561. return 0.5 - Math.cos( p * Math.PI ) / 2;
  6562. },
  6563. _default: "swing"
  6564. };
  6565. jQuery.fx = Tween.prototype.init;
  6566. // Back compat <1.8 extension point
  6567. jQuery.fx.step = {};
  6568. var
  6569. fxNow, inProgress,
  6570. rfxtypes = /^(?:toggle|show|hide)$/,
  6571. rrun = /queueHooks$/;
  6572. function schedule() {
  6573. if ( inProgress ) {
  6574. if ( document.hidden === false && window.requestAnimationFrame ) {
  6575. window.requestAnimationFrame( schedule );
  6576. } else {
  6577. window.setTimeout( schedule, jQuery.fx.interval );
  6578. }
  6579. jQuery.fx.tick();
  6580. }
  6581. }
  6582. // Animations created synchronously will run synchronously
  6583. function createFxNow() {
  6584. window.setTimeout( function() {
  6585. fxNow = undefined;
  6586. } );
  6587. return ( fxNow = Date.now() );
  6588. }
  6589. // Generate parameters to create a standard animation
  6590. function genFx( type, includeWidth ) {
  6591. var which,
  6592. i = 0,
  6593. attrs = { height: type };
  6594. // If we include width, step value is 1 to do all cssExpand values,
  6595. // otherwise step value is 2 to skip over Left and Right
  6596. includeWidth = includeWidth ? 1 : 0;
  6597. for ( ; i < 4; i += 2 - includeWidth ) {
  6598. which = cssExpand[ i ];
  6599. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  6600. }
  6601. if ( includeWidth ) {
  6602. attrs.opacity = attrs.width = type;
  6603. }
  6604. return attrs;
  6605. }
  6606. function createTween( value, prop, animation ) {
  6607. var tween,
  6608. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  6609. index = 0,
  6610. length = collection.length;
  6611. for ( ; index < length; index++ ) {
  6612. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  6613. // We're done with this property
  6614. return tween;
  6615. }
  6616. }
  6617. }
  6618. function defaultPrefilter( elem, props, opts ) {
  6619. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  6620. isBox = "width" in props || "height" in props,
  6621. anim = this,
  6622. orig = {},
  6623. style = elem.style,
  6624. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  6625. dataShow = dataPriv.get( elem, "fxshow" );
  6626. // Queue-skipping animations hijack the fx hooks
  6627. if ( !opts.queue ) {
  6628. hooks = jQuery._queueHooks( elem, "fx" );
  6629. if ( hooks.unqueued == null ) {
  6630. hooks.unqueued = 0;
  6631. oldfire = hooks.empty.fire;
  6632. hooks.empty.fire = function() {
  6633. if ( !hooks.unqueued ) {
  6634. oldfire();
  6635. }
  6636. };
  6637. }
  6638. hooks.unqueued++;
  6639. anim.always( function() {
  6640. // Ensure the complete handler is called before this completes
  6641. anim.always( function() {
  6642. hooks.unqueued--;
  6643. if ( !jQuery.queue( elem, "fx" ).length ) {
  6644. hooks.empty.fire();
  6645. }
  6646. } );
  6647. } );
  6648. }
  6649. // Detect show/hide animations
  6650. for ( prop in props ) {
  6651. value = props[ prop ];
  6652. if ( rfxtypes.test( value ) ) {
  6653. delete props[ prop ];
  6654. toggle = toggle || value === "toggle";
  6655. if ( value === ( hidden ? "hide" : "show" ) ) {
  6656. // Pretend to be hidden if this is a "show" and
  6657. // there is still data from a stopped show/hide
  6658. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  6659. hidden = true;
  6660. // Ignore all other no-op show/hide data
  6661. } else {
  6662. continue;
  6663. }
  6664. }
  6665. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  6666. }
  6667. }
  6668. // Bail out if this is a no-op like .hide().hide()
  6669. propTween = !jQuery.isEmptyObject( props );
  6670. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  6671. return;
  6672. }
  6673. // Restrict "overflow" and "display" styles during box animations
  6674. if ( isBox && elem.nodeType === 1 ) {
  6675. // Support: IE <=9 - 11, Edge 12 - 15
  6676. // Record all 3 overflow attributes because IE does not infer the shorthand
  6677. // from identically-valued overflowX and overflowY and Edge just mirrors
  6678. // the overflowX value there.
  6679. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  6680. // Identify a display type, preferring old show/hide data over the CSS cascade
  6681. restoreDisplay = dataShow && dataShow.display;
  6682. if ( restoreDisplay == null ) {
  6683. restoreDisplay = dataPriv.get( elem, "display" );
  6684. }
  6685. display = jQuery.css( elem, "display" );
  6686. if ( display === "none" ) {
  6687. if ( restoreDisplay ) {
  6688. display = restoreDisplay;
  6689. } else {
  6690. // Get nonempty value(s) by temporarily forcing visibility
  6691. showHide( [ elem ], true );
  6692. restoreDisplay = elem.style.display || restoreDisplay;
  6693. display = jQuery.css( elem, "display" );
  6694. showHide( [ elem ] );
  6695. }
  6696. }
  6697. // Animate inline elements as inline-block
  6698. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  6699. if ( jQuery.css( elem, "float" ) === "none" ) {
  6700. // Restore the original display value at the end of pure show/hide animations
  6701. if ( !propTween ) {
  6702. anim.done( function() {
  6703. style.display = restoreDisplay;
  6704. } );
  6705. if ( restoreDisplay == null ) {
  6706. display = style.display;
  6707. restoreDisplay = display === "none" ? "" : display;
  6708. }
  6709. }
  6710. style.display = "inline-block";
  6711. }
  6712. }
  6713. }
  6714. if ( opts.overflow ) {
  6715. style.overflow = "hidden";
  6716. anim.always( function() {
  6717. style.overflow = opts.overflow[ 0 ];
  6718. style.overflowX = opts.overflow[ 1 ];
  6719. style.overflowY = opts.overflow[ 2 ];
  6720. } );
  6721. }
  6722. // Implement show/hide animations
  6723. propTween = false;
  6724. for ( prop in orig ) {
  6725. // General show/hide setup for this element animation
  6726. if ( !propTween ) {
  6727. if ( dataShow ) {
  6728. if ( "hidden" in dataShow ) {
  6729. hidden = dataShow.hidden;
  6730. }
  6731. } else {
  6732. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  6733. }
  6734. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  6735. if ( toggle ) {
  6736. dataShow.hidden = !hidden;
  6737. }
  6738. // Show elements before animating them
  6739. if ( hidden ) {
  6740. showHide( [ elem ], true );
  6741. }
  6742. /* eslint-disable no-loop-func */
  6743. anim.done( function() {
  6744. /* eslint-enable no-loop-func */
  6745. // The final step of a "hide" animation is actually hiding the element
  6746. if ( !hidden ) {
  6747. showHide( [ elem ] );
  6748. }
  6749. dataPriv.remove( elem, "fxshow" );
  6750. for ( prop in orig ) {
  6751. jQuery.style( elem, prop, orig[ prop ] );
  6752. }
  6753. } );
  6754. }
  6755. // Per-property setup
  6756. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  6757. if ( !( prop in dataShow ) ) {
  6758. dataShow[ prop ] = propTween.start;
  6759. if ( hidden ) {
  6760. propTween.end = propTween.start;
  6761. propTween.start = 0;
  6762. }
  6763. }
  6764. }
  6765. }
  6766. function propFilter( props, specialEasing ) {
  6767. var index, name, easing, value, hooks;
  6768. // camelCase, specialEasing and expand cssHook pass
  6769. for ( index in props ) {
  6770. name = camelCase( index );
  6771. easing = specialEasing[ name ];
  6772. value = props[ index ];
  6773. if ( Array.isArray( value ) ) {
  6774. easing = value[ 1 ];
  6775. value = props[ index ] = value[ 0 ];
  6776. }
  6777. if ( index !== name ) {
  6778. props[ name ] = value;
  6779. delete props[ index ];
  6780. }
  6781. hooks = jQuery.cssHooks[ name ];
  6782. if ( hooks && "expand" in hooks ) {
  6783. value = hooks.expand( value );
  6784. delete props[ name ];
  6785. // Not quite $.extend, this won't overwrite existing keys.
  6786. // Reusing 'index' because we have the correct "name"
  6787. for ( index in value ) {
  6788. if ( !( index in props ) ) {
  6789. props[ index ] = value[ index ];
  6790. specialEasing[ index ] = easing;
  6791. }
  6792. }
  6793. } else {
  6794. specialEasing[ name ] = easing;
  6795. }
  6796. }
  6797. }
  6798. function Animation( elem, properties, options ) {
  6799. var result,
  6800. stopped,
  6801. index = 0,
  6802. length = Animation.prefilters.length,
  6803. deferred = jQuery.Deferred().always( function() {
  6804. // Don't match elem in the :animated selector
  6805. delete tick.elem;
  6806. } ),
  6807. tick = function() {
  6808. if ( stopped ) {
  6809. return false;
  6810. }
  6811. var currentTime = fxNow || createFxNow(),
  6812. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  6813. // Support: Android 2.3 only
  6814. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  6815. temp = remaining / animation.duration || 0,
  6816. percent = 1 - temp,
  6817. index = 0,
  6818. length = animation.tweens.length;
  6819. for ( ; index < length; index++ ) {
  6820. animation.tweens[ index ].run( percent );
  6821. }
  6822. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  6823. // If there's more to do, yield
  6824. if ( percent < 1 && length ) {
  6825. return remaining;
  6826. }
  6827. // If this was an empty animation, synthesize a final progress notification
  6828. if ( !length ) {
  6829. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  6830. }
  6831. // Resolve the animation and report its conclusion
  6832. deferred.resolveWith( elem, [ animation ] );
  6833. return false;
  6834. },
  6835. animation = deferred.promise( {
  6836. elem: elem,
  6837. props: jQuery.extend( {}, properties ),
  6838. opts: jQuery.extend( true, {
  6839. specialEasing: {},
  6840. easing: jQuery.easing._default
  6841. }, options ),
  6842. originalProperties: properties,
  6843. originalOptions: options,
  6844. startTime: fxNow || createFxNow(),
  6845. duration: options.duration,
  6846. tweens: [],
  6847. createTween: function( prop, end ) {
  6848. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  6849. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  6850. animation.tweens.push( tween );
  6851. return tween;
  6852. },
  6853. stop: function( gotoEnd ) {
  6854. var index = 0,
  6855. // If we are going to the end, we want to run all the tweens
  6856. // otherwise we skip this part
  6857. length = gotoEnd ? animation.tweens.length : 0;
  6858. if ( stopped ) {
  6859. return this;
  6860. }
  6861. stopped = true;
  6862. for ( ; index < length; index++ ) {
  6863. animation.tweens[ index ].run( 1 );
  6864. }
  6865. // Resolve when we played the last frame; otherwise, reject
  6866. if ( gotoEnd ) {
  6867. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  6868. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  6869. } else {
  6870. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  6871. }
  6872. return this;
  6873. }
  6874. } ),
  6875. props = animation.props;
  6876. propFilter( props, animation.opts.specialEasing );
  6877. for ( ; index < length; index++ ) {
  6878. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  6879. if ( result ) {
  6880. if ( isFunction( result.stop ) ) {
  6881. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  6882. result.stop.bind( result );
  6883. }
  6884. return result;
  6885. }
  6886. }
  6887. jQuery.map( props, createTween, animation );
  6888. if ( isFunction( animation.opts.start ) ) {
  6889. animation.opts.start.call( elem, animation );
  6890. }
  6891. // Attach callbacks from options
  6892. animation
  6893. .progress( animation.opts.progress )
  6894. .done( animation.opts.done, animation.opts.complete )
  6895. .fail( animation.opts.fail )
  6896. .always( animation.opts.always );
  6897. jQuery.fx.timer(
  6898. jQuery.extend( tick, {
  6899. elem: elem,
  6900. anim: animation,
  6901. queue: animation.opts.queue
  6902. } )
  6903. );
  6904. return animation;
  6905. }
  6906. jQuery.Animation = jQuery.extend( Animation, {
  6907. tweeners: {
  6908. "*": [ function( prop, value ) {
  6909. var tween = this.createTween( prop, value );
  6910. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  6911. return tween;
  6912. } ]
  6913. },
  6914. tweener: function( props, callback ) {
  6915. if ( isFunction( props ) ) {
  6916. callback = props;
  6917. props = [ "*" ];
  6918. } else {
  6919. props = props.match( rnothtmlwhite );
  6920. }
  6921. var prop,
  6922. index = 0,
  6923. length = props.length;
  6924. for ( ; index < length; index++ ) {
  6925. prop = props[ index ];
  6926. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  6927. Animation.tweeners[ prop ].unshift( callback );
  6928. }
  6929. },
  6930. prefilters: [ defaultPrefilter ],
  6931. prefilter: function( callback, prepend ) {
  6932. if ( prepend ) {
  6933. Animation.prefilters.unshift( callback );
  6934. } else {
  6935. Animation.prefilters.push( callback );
  6936. }
  6937. }
  6938. } );
  6939. jQuery.speed = function( speed, easing, fn ) {
  6940. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  6941. complete: fn || !fn && easing ||
  6942. isFunction( speed ) && speed,
  6943. duration: speed,
  6944. easing: fn && easing || easing && !isFunction( easing ) && easing
  6945. };
  6946. // Go to the end state if fx are off
  6947. if ( jQuery.fx.off ) {
  6948. opt.duration = 0;
  6949. } else {
  6950. if ( typeof opt.duration !== "number" ) {
  6951. if ( opt.duration in jQuery.fx.speeds ) {
  6952. opt.duration = jQuery.fx.speeds[ opt.duration ];
  6953. } else {
  6954. opt.duration = jQuery.fx.speeds._default;
  6955. }
  6956. }
  6957. }
  6958. // Normalize opt.queue - true/undefined/null -> "fx"
  6959. if ( opt.queue == null || opt.queue === true ) {
  6960. opt.queue = "fx";
  6961. }
  6962. // Queueing
  6963. opt.old = opt.complete;
  6964. opt.complete = function() {
  6965. if ( isFunction( opt.old ) ) {
  6966. opt.old.call( this );
  6967. }
  6968. if ( opt.queue ) {
  6969. jQuery.dequeue( this, opt.queue );
  6970. }
  6971. };
  6972. return opt;
  6973. };
  6974. jQuery.fn.extend( {
  6975. fadeTo: function( speed, to, easing, callback ) {
  6976. // Show any hidden elements after setting opacity to 0
  6977. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  6978. // Animate to the value specified
  6979. .end().animate( { opacity: to }, speed, easing, callback );
  6980. },
  6981. animate: function( prop, speed, easing, callback ) {
  6982. var empty = jQuery.isEmptyObject( prop ),
  6983. optall = jQuery.speed( speed, easing, callback ),
  6984. doAnimation = function() {
  6985. // Operate on a copy of prop so per-property easing won't be lost
  6986. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  6987. // Empty animations, or finishing resolves immediately
  6988. if ( empty || dataPriv.get( this, "finish" ) ) {
  6989. anim.stop( true );
  6990. }
  6991. };
  6992. doAnimation.finish = doAnimation;
  6993. return empty || optall.queue === false ?
  6994. this.each( doAnimation ) :
  6995. this.queue( optall.queue, doAnimation );
  6996. },
  6997. stop: function( type, clearQueue, gotoEnd ) {
  6998. var stopQueue = function( hooks ) {
  6999. var stop = hooks.stop;
  7000. delete hooks.stop;
  7001. stop( gotoEnd );
  7002. };
  7003. if ( typeof type !== "string" ) {
  7004. gotoEnd = clearQueue;
  7005. clearQueue = type;
  7006. type = undefined;
  7007. }
  7008. if ( clearQueue && type !== false ) {
  7009. this.queue( type || "fx", [] );
  7010. }
  7011. return this.each( function() {
  7012. var dequeue = true,
  7013. index = type != null && type + "queueHooks",
  7014. timers = jQuery.timers,
  7015. data = dataPriv.get( this );
  7016. if ( index ) {
  7017. if ( data[ index ] && data[ index ].stop ) {
  7018. stopQueue( data[ index ] );
  7019. }
  7020. } else {
  7021. for ( index in data ) {
  7022. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  7023. stopQueue( data[ index ] );
  7024. }
  7025. }
  7026. }
  7027. for ( index = timers.length; index--; ) {
  7028. if ( timers[ index ].elem === this &&
  7029. ( type == null || timers[ index ].queue === type ) ) {
  7030. timers[ index ].anim.stop( gotoEnd );
  7031. dequeue = false;
  7032. timers.splice( index, 1 );
  7033. }
  7034. }
  7035. // Start the next in the queue if the last step wasn't forced.
  7036. // Timers currently will call their complete callbacks, which
  7037. // will dequeue but only if they were gotoEnd.
  7038. if ( dequeue || !gotoEnd ) {
  7039. jQuery.dequeue( this, type );
  7040. }
  7041. } );
  7042. },
  7043. finish: function( type ) {
  7044. if ( type !== false ) {
  7045. type = type || "fx";
  7046. }
  7047. return this.each( function() {
  7048. var index,
  7049. data = dataPriv.get( this ),
  7050. queue = data[ type + "queue" ],
  7051. hooks = data[ type + "queueHooks" ],
  7052. timers = jQuery.timers,
  7053. length = queue ? queue.length : 0;
  7054. // Enable finishing flag on private data
  7055. data.finish = true;
  7056. // Empty the queue first
  7057. jQuery.queue( this, type, [] );
  7058. if ( hooks && hooks.stop ) {
  7059. hooks.stop.call( this, true );
  7060. }
  7061. // Look for any active animations, and finish them
  7062. for ( index = timers.length; index--; ) {
  7063. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  7064. timers[ index ].anim.stop( true );
  7065. timers.splice( index, 1 );
  7066. }
  7067. }
  7068. // Look for any animations in the old queue and finish them
  7069. for ( index = 0; index < length; index++ ) {
  7070. if ( queue[ index ] && queue[ index ].finish ) {
  7071. queue[ index ].finish.call( this );
  7072. }
  7073. }
  7074. // Turn off finishing flag
  7075. delete data.finish;
  7076. } );
  7077. }
  7078. } );
  7079. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  7080. var cssFn = jQuery.fn[ name ];
  7081. jQuery.fn[ name ] = function( speed, easing, callback ) {
  7082. return speed == null || typeof speed === "boolean" ?
  7083. cssFn.apply( this, arguments ) :
  7084. this.animate( genFx( name, true ), speed, easing, callback );
  7085. };
  7086. } );
  7087. // Generate shortcuts for custom animations
  7088. jQuery.each( {
  7089. slideDown: genFx( "show" ),
  7090. slideUp: genFx( "hide" ),
  7091. slideToggle: genFx( "toggle" ),
  7092. fadeIn: { opacity: "show" },
  7093. fadeOut: { opacity: "hide" },
  7094. fadeToggle: { opacity: "toggle" }
  7095. }, function( name, props ) {
  7096. jQuery.fn[ name ] = function( speed, easing, callback ) {
  7097. return this.animate( props, speed, easing, callback );
  7098. };
  7099. } );
  7100. jQuery.timers = [];
  7101. jQuery.fx.tick = function() {
  7102. var timer,
  7103. i = 0,
  7104. timers = jQuery.timers;
  7105. fxNow = Date.now();
  7106. for ( ; i < timers.length; i++ ) {
  7107. timer = timers[ i ];
  7108. // Run the timer and safely remove it when done (allowing for external removal)
  7109. if ( !timer() && timers[ i ] === timer ) {
  7110. timers.splice( i--, 1 );
  7111. }
  7112. }
  7113. if ( !timers.length ) {
  7114. jQuery.fx.stop();
  7115. }
  7116. fxNow = undefined;
  7117. };
  7118. jQuery.fx.timer = function( timer ) {
  7119. jQuery.timers.push( timer );
  7120. jQuery.fx.start();
  7121. };
  7122. jQuery.fx.interval = 13;
  7123. jQuery.fx.start = function() {
  7124. if ( inProgress ) {
  7125. return;
  7126. }
  7127. inProgress = true;
  7128. schedule();
  7129. };
  7130. jQuery.fx.stop = function() {
  7131. inProgress = null;
  7132. };
  7133. jQuery.fx.speeds = {
  7134. slow: 600,
  7135. fast: 200,
  7136. // Default speed
  7137. _default: 400
  7138. };
  7139. // Based off of the plugin by Clint Helfers, with permission.
  7140. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  7141. jQuery.fn.delay = function( time, type ) {
  7142. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  7143. type = type || "fx";
  7144. return this.queue( type, function( next, hooks ) {
  7145. var timeout = window.setTimeout( next, time );
  7146. hooks.stop = function() {
  7147. window.clearTimeout( timeout );
  7148. };
  7149. } );
  7150. };
  7151. ( function() {
  7152. var input = document.createElement( "input" ),
  7153. select = document.createElement( "select" ),
  7154. opt = select.appendChild( document.createElement( "option" ) );
  7155. input.type = "checkbox";
  7156. // Support: Android <=4.3 only
  7157. // Default value for a checkbox should be "on"
  7158. support.checkOn = input.value !== "";
  7159. // Support: IE <=11 only
  7160. // Must access selectedIndex to make default options select
  7161. support.optSelected = opt.selected;
  7162. // Support: IE <=11 only
  7163. // An input loses its value after becoming a radio
  7164. input = document.createElement( "input" );
  7165. input.value = "t";
  7166. input.type = "radio";
  7167. support.radioValue = input.value === "t";
  7168. } )();
  7169. var boolHook,
  7170. attrHandle = jQuery.expr.attrHandle;
  7171. jQuery.fn.extend( {
  7172. attr: function( name, value ) {
  7173. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  7174. },
  7175. removeAttr: function( name ) {
  7176. return this.each( function() {
  7177. jQuery.removeAttr( this, name );
  7178. } );
  7179. }
  7180. } );
  7181. jQuery.extend( {
  7182. attr: function( elem, name, value ) {
  7183. var ret, hooks,
  7184. nType = elem.nodeType;
  7185. // Don't get/set attributes on text, comment and attribute nodes
  7186. if ( nType === 3 || nType === 8 || nType === 2 ) {
  7187. return;
  7188. }
  7189. // Fallback to prop when attributes are not supported
  7190. if ( typeof elem.getAttribute === "undefined" ) {
  7191. return jQuery.prop( elem, name, value );
  7192. }
  7193. // Attribute hooks are determined by the lowercase version
  7194. // Grab necessary hook if one is defined
  7195. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  7196. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  7197. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  7198. }
  7199. if ( value !== undefined ) {
  7200. if ( value === null ) {
  7201. jQuery.removeAttr( elem, name );
  7202. return;
  7203. }
  7204. if ( hooks && "set" in hooks &&
  7205. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  7206. return ret;
  7207. }
  7208. elem.setAttribute( name, value + "" );
  7209. return value;
  7210. }
  7211. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  7212. return ret;
  7213. }
  7214. ret = jQuery.find.attr( elem, name );
  7215. // Non-existent attributes return null, we normalize to undefined
  7216. return ret == null ? undefined : ret;
  7217. },
  7218. attrHooks: {
  7219. type: {
  7220. set: function( elem, value ) {
  7221. if ( !support.radioValue && value === "radio" &&
  7222. nodeName( elem, "input" ) ) {
  7223. var val = elem.value;
  7224. elem.setAttribute( "type", value );
  7225. if ( val ) {
  7226. elem.value = val;
  7227. }
  7228. return value;
  7229. }
  7230. }
  7231. }
  7232. },
  7233. removeAttr: function( elem, value ) {
  7234. var name,
  7235. i = 0,
  7236. // Attribute names can contain non-HTML whitespace characters
  7237. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  7238. attrNames = value && value.match( rnothtmlwhite );
  7239. if ( attrNames && elem.nodeType === 1 ) {
  7240. while ( ( name = attrNames[ i++ ] ) ) {
  7241. elem.removeAttribute( name );
  7242. }
  7243. }
  7244. }
  7245. } );
  7246. // Hooks for boolean attributes
  7247. boolHook = {
  7248. set: function( elem, value, name ) {
  7249. if ( value === false ) {
  7250. // Remove boolean attributes when set to false
  7251. jQuery.removeAttr( elem, name );
  7252. } else {
  7253. elem.setAttribute( name, name );
  7254. }
  7255. return name;
  7256. }
  7257. };
  7258. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  7259. var getter = attrHandle[ name ] || jQuery.find.attr;
  7260. attrHandle[ name ] = function( elem, name, isXML ) {
  7261. var ret, handle,
  7262. lowercaseName = name.toLowerCase();
  7263. if ( !isXML ) {
  7264. // Avoid an infinite loop by temporarily removing this function from the getter
  7265. handle = attrHandle[ lowercaseName ];
  7266. attrHandle[ lowercaseName ] = ret;
  7267. ret = getter( elem, name, isXML ) != null ?
  7268. lowercaseName :
  7269. null;
  7270. attrHandle[ lowercaseName ] = handle;
  7271. }
  7272. return ret;
  7273. };
  7274. } );
  7275. var rfocusable = /^(?:input|select|textarea|button)$/i,
  7276. rclickable = /^(?:a|area)$/i;
  7277. jQuery.fn.extend( {
  7278. prop: function( name, value ) {
  7279. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  7280. },
  7281. removeProp: function( name ) {
  7282. return this.each( function() {
  7283. delete this[ jQuery.propFix[ name ] || name ];
  7284. } );
  7285. }
  7286. } );
  7287. jQuery.extend( {
  7288. prop: function( elem, name, value ) {
  7289. var ret, hooks,
  7290. nType = elem.nodeType;
  7291. // Don't get/set properties on text, comment and attribute nodes
  7292. if ( nType === 3 || nType === 8 || nType === 2 ) {
  7293. return;
  7294. }
  7295. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  7296. // Fix name and attach hooks
  7297. name = jQuery.propFix[ name ] || name;
  7298. hooks = jQuery.propHooks[ name ];
  7299. }
  7300. if ( value !== undefined ) {
  7301. if ( hooks && "set" in hooks &&
  7302. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  7303. return ret;
  7304. }
  7305. return ( elem[ name ] = value );
  7306. }
  7307. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  7308. return ret;
  7309. }
  7310. return elem[ name ];
  7311. },
  7312. propHooks: {
  7313. tabIndex: {
  7314. get: function( elem ) {
  7315. // Support: IE <=9 - 11 only
  7316. // elem.tabIndex doesn't always return the
  7317. // correct value when it hasn't been explicitly set
  7318. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  7319. // Use proper attribute retrieval(#12072)
  7320. var tabindex = jQuery.find.attr( elem, "tabindex" );
  7321. if ( tabindex ) {
  7322. return parseInt( tabindex, 10 );
  7323. }
  7324. if (
  7325. rfocusable.test( elem.nodeName ) ||
  7326. rclickable.test( elem.nodeName ) &&
  7327. elem.href
  7328. ) {
  7329. return 0;
  7330. }
  7331. return -1;
  7332. }
  7333. }
  7334. },
  7335. propFix: {
  7336. "for": "htmlFor",
  7337. "class": "className"
  7338. }
  7339. } );
  7340. // Support: IE <=11 only
  7341. // Accessing the selectedIndex property
  7342. // forces the browser to respect setting selected
  7343. // on the option
  7344. // The getter ensures a default option is selected
  7345. // when in an optgroup
  7346. // eslint rule "no-unused-expressions" is disabled for this code
  7347. // since it considers such accessions noop
  7348. if ( !support.optSelected ) {
  7349. jQuery.propHooks.selected = {
  7350. get: function( elem ) {
  7351. /* eslint no-unused-expressions: "off" */
  7352. var parent = elem.parentNode;
  7353. if ( parent && parent.parentNode ) {
  7354. parent.parentNode.selectedIndex;
  7355. }
  7356. return null;
  7357. },
  7358. set: function( elem ) {
  7359. /* eslint no-unused-expressions: "off" */
  7360. var parent = elem.parentNode;
  7361. if ( parent ) {
  7362. parent.selectedIndex;
  7363. if ( parent.parentNode ) {
  7364. parent.parentNode.selectedIndex;
  7365. }
  7366. }
  7367. }
  7368. };
  7369. }
  7370. jQuery.each( [
  7371. "tabIndex",
  7372. "readOnly",
  7373. "maxLength",
  7374. "cellSpacing",
  7375. "cellPadding",
  7376. "rowSpan",
  7377. "colSpan",
  7378. "useMap",
  7379. "frameBorder",
  7380. "contentEditable"
  7381. ], function() {
  7382. jQuery.propFix[ this.toLowerCase() ] = this;
  7383. } );
  7384. // Strip and collapse whitespace according to HTML spec
  7385. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  7386. function stripAndCollapse( value ) {
  7387. var tokens = value.match( rnothtmlwhite ) || [];
  7388. return tokens.join( " " );
  7389. }
  7390. function getClass( elem ) {
  7391. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  7392. }
  7393. function classesToArray( value ) {
  7394. if ( Array.isArray( value ) ) {
  7395. return value;
  7396. }
  7397. if ( typeof value === "string" ) {
  7398. return value.match( rnothtmlwhite ) || [];
  7399. }
  7400. return [];
  7401. }
  7402. jQuery.fn.extend( {
  7403. addClass: function( value ) {
  7404. var classes, elem, cur, curValue, clazz, j, finalValue,
  7405. i = 0;
  7406. if ( isFunction( value ) ) {
  7407. return this.each( function( j ) {
  7408. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  7409. } );
  7410. }
  7411. classes = classesToArray( value );
  7412. if ( classes.length ) {
  7413. while ( ( elem = this[ i++ ] ) ) {
  7414. curValue = getClass( elem );
  7415. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  7416. if ( cur ) {
  7417. j = 0;
  7418. while ( ( clazz = classes[ j++ ] ) ) {
  7419. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  7420. cur += clazz + " ";
  7421. }
  7422. }
  7423. // Only assign if different to avoid unneeded rendering.
  7424. finalValue = stripAndCollapse( cur );
  7425. if ( curValue !== finalValue ) {
  7426. elem.setAttribute( "class", finalValue );
  7427. }
  7428. }
  7429. }
  7430. }
  7431. return this;
  7432. },
  7433. removeClass: function( value ) {
  7434. var classes, elem, cur, curValue, clazz, j, finalValue,
  7435. i = 0;
  7436. if ( isFunction( value ) ) {
  7437. return this.each( function( j ) {
  7438. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  7439. } );
  7440. }
  7441. if ( !arguments.length ) {
  7442. return this.attr( "class", "" );
  7443. }
  7444. classes = classesToArray( value );
  7445. if ( classes.length ) {
  7446. while ( ( elem = this[ i++ ] ) ) {
  7447. curValue = getClass( elem );
  7448. // This expression is here for better compressibility (see addClass)
  7449. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  7450. if ( cur ) {
  7451. j = 0;
  7452. while ( ( clazz = classes[ j++ ] ) ) {
  7453. // Remove *all* instances
  7454. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  7455. cur = cur.replace( " " + clazz + " ", " " );
  7456. }
  7457. }
  7458. // Only assign if different to avoid unneeded rendering.
  7459. finalValue = stripAndCollapse( cur );
  7460. if ( curValue !== finalValue ) {
  7461. elem.setAttribute( "class", finalValue );
  7462. }
  7463. }
  7464. }
  7465. }
  7466. return this;
  7467. },
  7468. toggleClass: function( value, stateVal ) {
  7469. var type = typeof value,
  7470. isValidValue = type === "string" || Array.isArray( value );
  7471. if ( typeof stateVal === "boolean" && isValidValue ) {
  7472. return stateVal ? this.addClass( value ) : this.removeClass( value );
  7473. }
  7474. if ( isFunction( value ) ) {
  7475. return this.each( function( i ) {
  7476. jQuery( this ).toggleClass(
  7477. value.call( this, i, getClass( this ), stateVal ),
  7478. stateVal
  7479. );
  7480. } );
  7481. }
  7482. return this.each( function() {
  7483. var className, i, self, classNames;
  7484. if ( isValidValue ) {
  7485. // Toggle individual class names
  7486. i = 0;
  7487. self = jQuery( this );
  7488. classNames = classesToArray( value );
  7489. while ( ( className = classNames[ i++ ] ) ) {
  7490. // Check each className given, space separated list
  7491. if ( self.hasClass( className ) ) {
  7492. self.removeClass( className );
  7493. } else {
  7494. self.addClass( className );
  7495. }
  7496. }
  7497. // Toggle whole class name
  7498. } else if ( value === undefined || type === "boolean" ) {
  7499. className = getClass( this );
  7500. if ( className ) {
  7501. // Store className if set
  7502. dataPriv.set( this, "__className__", className );
  7503. }
  7504. // If the element has a class name or if we're passed `false`,
  7505. // then remove the whole classname (if there was one, the above saved it).
  7506. // Otherwise bring back whatever was previously saved (if anything),
  7507. // falling back to the empty string if nothing was stored.
  7508. if ( this.setAttribute ) {
  7509. this.setAttribute( "class",
  7510. className || value === false ?
  7511. "" :
  7512. dataPriv.get( this, "__className__" ) || ""
  7513. );
  7514. }
  7515. }
  7516. } );
  7517. },
  7518. hasClass: function( selector ) {
  7519. var className, elem,
  7520. i = 0;
  7521. className = " " + selector + " ";
  7522. while ( ( elem = this[ i++ ] ) ) {
  7523. if ( elem.nodeType === 1 &&
  7524. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  7525. return true;
  7526. }
  7527. }
  7528. return false;
  7529. }
  7530. } );
  7531. var rreturn = /\r/g;
  7532. jQuery.fn.extend( {
  7533. val: function( value ) {
  7534. var hooks, ret, valueIsFunction,
  7535. elem = this[ 0 ];
  7536. if ( !arguments.length ) {
  7537. if ( elem ) {
  7538. hooks = jQuery.valHooks[ elem.type ] ||
  7539. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  7540. if ( hooks &&
  7541. "get" in hooks &&
  7542. ( ret = hooks.get( elem, "value" ) ) !== undefined
  7543. ) {
  7544. return ret;
  7545. }
  7546. ret = elem.value;
  7547. // Handle most common string cases
  7548. if ( typeof ret === "string" ) {
  7549. return ret.replace( rreturn, "" );
  7550. }
  7551. // Handle cases where value is null/undef or number
  7552. return ret == null ? "" : ret;
  7553. }
  7554. return;
  7555. }
  7556. valueIsFunction = isFunction( value );
  7557. return this.each( function( i ) {
  7558. var val;
  7559. if ( this.nodeType !== 1 ) {
  7560. return;
  7561. }
  7562. if ( valueIsFunction ) {
  7563. val = value.call( this, i, jQuery( this ).val() );
  7564. } else {
  7565. val = value;
  7566. }
  7567. // Treat null/undefined as ""; convert numbers to string
  7568. if ( val == null ) {
  7569. val = "";
  7570. } else if ( typeof val === "number" ) {
  7571. val += "";
  7572. } else if ( Array.isArray( val ) ) {
  7573. val = jQuery.map( val, function( value ) {
  7574. return value == null ? "" : value + "";
  7575. } );
  7576. }
  7577. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  7578. // If set returns undefined, fall back to normal setting
  7579. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  7580. this.value = val;
  7581. }
  7582. } );
  7583. }
  7584. } );
  7585. jQuery.extend( {
  7586. valHooks: {
  7587. option: {
  7588. get: function( elem ) {
  7589. var val = jQuery.find.attr( elem, "value" );
  7590. return val != null ?
  7591. val :
  7592. // Support: IE <=10 - 11 only
  7593. // option.text throws exceptions (#14686, #14858)
  7594. // Strip and collapse whitespace
  7595. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  7596. stripAndCollapse( jQuery.text( elem ) );
  7597. }
  7598. },
  7599. select: {
  7600. get: function( elem ) {
  7601. var value, option, i,
  7602. options = elem.options,
  7603. index = elem.selectedIndex,
  7604. one = elem.type === "select-one",
  7605. values = one ? null : [],
  7606. max = one ? index + 1 : options.length;
  7607. if ( index < 0 ) {
  7608. i = max;
  7609. } else {
  7610. i = one ? index : 0;
  7611. }
  7612. // Loop through all the selected options
  7613. for ( ; i < max; i++ ) {
  7614. option = options[ i ];
  7615. // Support: IE <=9 only
  7616. // IE8-9 doesn't update selected after form reset (#2551)
  7617. if ( ( option.selected || i === index ) &&
  7618. // Don't return options that are disabled or in a disabled optgroup
  7619. !option.disabled &&
  7620. ( !option.parentNode.disabled ||
  7621. !nodeName( option.parentNode, "optgroup" ) ) ) {
  7622. // Get the specific value for the option
  7623. value = jQuery( option ).val();
  7624. // We don't need an array for one selects
  7625. if ( one ) {
  7626. return value;
  7627. }
  7628. // Multi-Selects return an array
  7629. values.push( value );
  7630. }
  7631. }
  7632. return values;
  7633. },
  7634. set: function( elem, value ) {
  7635. var optionSet, option,
  7636. options = elem.options,
  7637. values = jQuery.makeArray( value ),
  7638. i = options.length;
  7639. while ( i-- ) {
  7640. option = options[ i ];
  7641. /* eslint-disable no-cond-assign */
  7642. if ( option.selected =
  7643. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  7644. ) {
  7645. optionSet = true;
  7646. }
  7647. /* eslint-enable no-cond-assign */
  7648. }
  7649. // Force browsers to behave consistently when non-matching value is set
  7650. if ( !optionSet ) {
  7651. elem.selectedIndex = -1;
  7652. }
  7653. return values;
  7654. }
  7655. }
  7656. }
  7657. } );
  7658. // Radios and checkboxes getter/setter
  7659. jQuery.each( [ "radio", "checkbox" ], function() {
  7660. jQuery.valHooks[ this ] = {
  7661. set: function( elem, value ) {
  7662. if ( Array.isArray( value ) ) {
  7663. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  7664. }
  7665. }
  7666. };
  7667. if ( !support.checkOn ) {
  7668. jQuery.valHooks[ this ].get = function( elem ) {
  7669. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  7670. };
  7671. }
  7672. } );
  7673. // Return jQuery for attributes-only inclusion
  7674. support.focusin = "onfocusin" in window;
  7675. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  7676. stopPropagationCallback = function( e ) {
  7677. e.stopPropagation();
  7678. };
  7679. jQuery.extend( jQuery.event, {
  7680. trigger: function( event, data, elem, onlyHandlers ) {
  7681. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  7682. eventPath = [ elem || document ],
  7683. type = hasOwn.call( event, "type" ) ? event.type : event,
  7684. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  7685. cur = lastElement = tmp = elem = elem || document;
  7686. // Don't do events on text and comment nodes
  7687. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  7688. return;
  7689. }
  7690. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  7691. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  7692. return;
  7693. }
  7694. if ( type.indexOf( "." ) > -1 ) {
  7695. // Namespaced trigger; create a regexp to match event type in handle()
  7696. namespaces = type.split( "." );
  7697. type = namespaces.shift();
  7698. namespaces.sort();
  7699. }
  7700. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  7701. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  7702. event = event[ jQuery.expando ] ?
  7703. event :
  7704. new jQuery.Event( type, typeof event === "object" && event );
  7705. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  7706. event.isTrigger = onlyHandlers ? 2 : 3;
  7707. event.namespace = namespaces.join( "." );
  7708. event.rnamespace = event.namespace ?
  7709. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  7710. null;
  7711. // Clean up the event in case it is being reused
  7712. event.result = undefined;
  7713. if ( !event.target ) {
  7714. event.target = elem;
  7715. }
  7716. // Clone any incoming data and prepend the event, creating the handler arg list
  7717. data = data == null ?
  7718. [ event ] :
  7719. jQuery.makeArray( data, [ event ] );
  7720. // Allow special events to draw outside the lines
  7721. special = jQuery.event.special[ type ] || {};
  7722. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  7723. return;
  7724. }
  7725. // Determine event propagation path in advance, per W3C events spec (#9951)
  7726. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  7727. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  7728. bubbleType = special.delegateType || type;
  7729. if ( !rfocusMorph.test( bubbleType + type ) ) {
  7730. cur = cur.parentNode;
  7731. }
  7732. for ( ; cur; cur = cur.parentNode ) {
  7733. eventPath.push( cur );
  7734. tmp = cur;
  7735. }
  7736. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  7737. if ( tmp === ( elem.ownerDocument || document ) ) {
  7738. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  7739. }
  7740. }
  7741. // Fire handlers on the event path
  7742. i = 0;
  7743. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  7744. lastElement = cur;
  7745. event.type = i > 1 ?
  7746. bubbleType :
  7747. special.bindType || type;
  7748. // jQuery handler
  7749. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  7750. dataPriv.get( cur, "handle" );
  7751. if ( handle ) {
  7752. handle.apply( cur, data );
  7753. }
  7754. // Native handler
  7755. handle = ontype && cur[ ontype ];
  7756. if ( handle && handle.apply && acceptData( cur ) ) {
  7757. event.result = handle.apply( cur, data );
  7758. if ( event.result === false ) {
  7759. event.preventDefault();
  7760. }
  7761. }
  7762. }
  7763. event.type = type;
  7764. // If nobody prevented the default action, do it now
  7765. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  7766. if ( ( !special._default ||
  7767. special._default.apply( eventPath.pop(), data ) === false ) &&
  7768. acceptData( elem ) ) {
  7769. // Call a native DOM method on the target with the same name as the event.
  7770. // Don't do default actions on window, that's where global variables be (#6170)
  7771. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  7772. // Don't re-trigger an onFOO event when we call its FOO() method
  7773. tmp = elem[ ontype ];
  7774. if ( tmp ) {
  7775. elem[ ontype ] = null;
  7776. }
  7777. // Prevent re-triggering of the same event, since we already bubbled it above
  7778. jQuery.event.triggered = type;
  7779. if ( event.isPropagationStopped() ) {
  7780. lastElement.addEventListener( type, stopPropagationCallback );
  7781. }
  7782. elem[ type ]();
  7783. if ( event.isPropagationStopped() ) {
  7784. lastElement.removeEventListener( type, stopPropagationCallback );
  7785. }
  7786. jQuery.event.triggered = undefined;
  7787. if ( tmp ) {
  7788. elem[ ontype ] = tmp;
  7789. }
  7790. }
  7791. }
  7792. }
  7793. return event.result;
  7794. },
  7795. // Piggyback on a donor event to simulate a different one
  7796. // Used only for `focus(in | out)` events
  7797. simulate: function( type, elem, event ) {
  7798. var e = jQuery.extend(
  7799. new jQuery.Event(),
  7800. event,
  7801. {
  7802. type: type,
  7803. isSimulated: true
  7804. }
  7805. );
  7806. jQuery.event.trigger( e, null, elem );
  7807. }
  7808. } );
  7809. jQuery.fn.extend( {
  7810. trigger: function( type, data ) {
  7811. return this.each( function() {
  7812. jQuery.event.trigger( type, data, this );
  7813. } );
  7814. },
  7815. triggerHandler: function( type, data ) {
  7816. var elem = this[ 0 ];
  7817. if ( elem ) {
  7818. return jQuery.event.trigger( type, data, elem, true );
  7819. }
  7820. }
  7821. } );
  7822. // Support: Firefox <=44
  7823. // Firefox doesn't have focus(in | out) events
  7824. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  7825. //
  7826. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  7827. // focus(in | out) events fire after focus & blur events,
  7828. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  7829. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  7830. if ( !support.focusin ) {
  7831. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  7832. // Attach a single capturing handler on the document while someone wants focusin/focusout
  7833. var handler = function( event ) {
  7834. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  7835. };
  7836. jQuery.event.special[ fix ] = {
  7837. setup: function() {
  7838. var doc = this.ownerDocument || this,
  7839. attaches = dataPriv.access( doc, fix );
  7840. if ( !attaches ) {
  7841. doc.addEventListener( orig, handler, true );
  7842. }
  7843. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  7844. },
  7845. teardown: function() {
  7846. var doc = this.ownerDocument || this,
  7847. attaches = dataPriv.access( doc, fix ) - 1;
  7848. if ( !attaches ) {
  7849. doc.removeEventListener( orig, handler, true );
  7850. dataPriv.remove( doc, fix );
  7851. } else {
  7852. dataPriv.access( doc, fix, attaches );
  7853. }
  7854. }
  7855. };
  7856. } );
  7857. }
  7858. var location = window.location;
  7859. var nonce = Date.now();
  7860. var rquery = ( /\?/ );
  7861. // Cross-browser xml parsing
  7862. jQuery.parseXML = function( data ) {
  7863. var xml;
  7864. if ( !data || typeof data !== "string" ) {
  7865. return null;
  7866. }
  7867. // Support: IE 9 - 11 only
  7868. // IE throws on parseFromString with invalid input.
  7869. try {
  7870. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  7871. } catch ( e ) {
  7872. xml = undefined;
  7873. }
  7874. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  7875. jQuery.error( "Invalid XML: " + data );
  7876. }
  7877. return xml;
  7878. };
  7879. var
  7880. rbracket = /\[\]$/,
  7881. rCRLF = /\r?\n/g,
  7882. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  7883. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  7884. function buildParams( prefix, obj, traditional, add ) {
  7885. var name;
  7886. if ( Array.isArray( obj ) ) {
  7887. // Serialize array item.
  7888. jQuery.each( obj, function( i, v ) {
  7889. if ( traditional || rbracket.test( prefix ) ) {
  7890. // Treat each array item as a scalar.
  7891. add( prefix, v );
  7892. } else {
  7893. // Item is non-scalar (array or object), encode its numeric index.
  7894. buildParams(
  7895. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  7896. v,
  7897. traditional,
  7898. add
  7899. );
  7900. }
  7901. } );
  7902. } else if ( !traditional && toType( obj ) === "object" ) {
  7903. // Serialize object item.
  7904. for ( name in obj ) {
  7905. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  7906. }
  7907. } else {
  7908. // Serialize scalar item.
  7909. add( prefix, obj );
  7910. }
  7911. }
  7912. // Serialize an array of form elements or a set of
  7913. // key/values into a query string
  7914. jQuery.param = function( a, traditional ) {
  7915. var prefix,
  7916. s = [],
  7917. add = function( key, valueOrFunction ) {
  7918. // If value is a function, invoke it and use its return value
  7919. var value = isFunction( valueOrFunction ) ?
  7920. valueOrFunction() :
  7921. valueOrFunction;
  7922. s[ s.length ] = encodeURIComponent( key ) + "=" +
  7923. encodeURIComponent( value == null ? "" : value );
  7924. };
  7925. if ( a == null ) {
  7926. return "";
  7927. }
  7928. // If an array was passed in, assume that it is an array of form elements.
  7929. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  7930. // Serialize the form elements
  7931. jQuery.each( a, function() {
  7932. add( this.name, this.value );
  7933. } );
  7934. } else {
  7935. // If traditional, encode the "old" way (the way 1.3.2 or older
  7936. // did it), otherwise encode params recursively.
  7937. for ( prefix in a ) {
  7938. buildParams( prefix, a[ prefix ], traditional, add );
  7939. }
  7940. }
  7941. // Return the resulting serialization
  7942. return s.join( "&" );
  7943. };
  7944. jQuery.fn.extend( {
  7945. serialize: function() {
  7946. return jQuery.param( this.serializeArray() );
  7947. },
  7948. serializeArray: function() {
  7949. return this.map( function() {
  7950. // Can add propHook for "elements" to filter or add form elements
  7951. var elements = jQuery.prop( this, "elements" );
  7952. return elements ? jQuery.makeArray( elements ) : this;
  7953. } )
  7954. .filter( function() {
  7955. var type = this.type;
  7956. // Use .is( ":disabled" ) so that fieldset[disabled] works
  7957. return this.name && !jQuery( this ).is( ":disabled" ) &&
  7958. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  7959. ( this.checked || !rcheckableType.test( type ) );
  7960. } )
  7961. .map( function( i, elem ) {
  7962. var val = jQuery( this ).val();
  7963. if ( val == null ) {
  7964. return null;
  7965. }
  7966. if ( Array.isArray( val ) ) {
  7967. return jQuery.map( val, function( val ) {
  7968. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  7969. } );
  7970. }
  7971. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  7972. } ).get();
  7973. }
  7974. } );
  7975. var
  7976. r20 = /%20/g,
  7977. rhash = /#.*$/,
  7978. rantiCache = /([?&])_=[^&]*/,
  7979. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  7980. // #7653, #8125, #8152: local protocol detection
  7981. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  7982. rnoContent = /^(?:GET|HEAD)$/,
  7983. rprotocol = /^\/\//,
  7984. /* Prefilters
  7985. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  7986. * 2) These are called:
  7987. * - BEFORE asking for a transport
  7988. * - AFTER param serialization (s.data is a string if s.processData is true)
  7989. * 3) key is the dataType
  7990. * 4) the catchall symbol "*" can be used
  7991. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  7992. */
  7993. prefilters = {},
  7994. /* Transports bindings
  7995. * 1) key is the dataType
  7996. * 2) the catchall symbol "*" can be used
  7997. * 3) selection will start with transport dataType and THEN go to "*" if needed
  7998. */
  7999. transports = {},
  8000. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  8001. allTypes = "*/".concat( "*" ),
  8002. // Anchor tag for parsing the document origin
  8003. originAnchor = document.createElement( "a" );
  8004. originAnchor.href = location.href;
  8005. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  8006. function addToPrefiltersOrTransports( structure ) {
  8007. // dataTypeExpression is optional and defaults to "*"
  8008. return function( dataTypeExpression, func ) {
  8009. if ( typeof dataTypeExpression !== "string" ) {
  8010. func = dataTypeExpression;
  8011. dataTypeExpression = "*";
  8012. }
  8013. var dataType,
  8014. i = 0,
  8015. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  8016. if ( isFunction( func ) ) {
  8017. // For each dataType in the dataTypeExpression
  8018. while ( ( dataType = dataTypes[ i++ ] ) ) {
  8019. // Prepend if requested
  8020. if ( dataType[ 0 ] === "+" ) {
  8021. dataType = dataType.slice( 1 ) || "*";
  8022. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  8023. // Otherwise append
  8024. } else {
  8025. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  8026. }
  8027. }
  8028. }
  8029. };
  8030. }
  8031. // Base inspection function for prefilters and transports
  8032. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  8033. var inspected = {},
  8034. seekingTransport = ( structure === transports );
  8035. function inspect( dataType ) {
  8036. var selected;
  8037. inspected[ dataType ] = true;
  8038. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  8039. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  8040. if ( typeof dataTypeOrTransport === "string" &&
  8041. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  8042. options.dataTypes.unshift( dataTypeOrTransport );
  8043. inspect( dataTypeOrTransport );
  8044. return false;
  8045. } else if ( seekingTransport ) {
  8046. return !( selected = dataTypeOrTransport );
  8047. }
  8048. } );
  8049. return selected;
  8050. }
  8051. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  8052. }
  8053. // A special extend for ajax options
  8054. // that takes "flat" options (not to be deep extended)
  8055. // Fixes #9887
  8056. function ajaxExtend( target, src ) {
  8057. var key, deep,
  8058. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  8059. for ( key in src ) {
  8060. if ( src[ key ] !== undefined ) {
  8061. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  8062. }
  8063. }
  8064. if ( deep ) {
  8065. jQuery.extend( true, target, deep );
  8066. }
  8067. return target;
  8068. }
  8069. /* Handles responses to an ajax request:
  8070. * - finds the right dataType (mediates between content-type and expected dataType)
  8071. * - returns the corresponding response
  8072. */
  8073. function ajaxHandleResponses( s, jqXHR, responses ) {
  8074. var ct, type, finalDataType, firstDataType,
  8075. contents = s.contents,
  8076. dataTypes = s.dataTypes;
  8077. // Remove auto dataType and get content-type in the process
  8078. while ( dataTypes[ 0 ] === "*" ) {
  8079. dataTypes.shift();
  8080. if ( ct === undefined ) {
  8081. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  8082. }
  8083. }
  8084. // Check if we're dealing with a known content-type
  8085. if ( ct ) {
  8086. for ( type in contents ) {
  8087. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  8088. dataTypes.unshift( type );
  8089. break;
  8090. }
  8091. }
  8092. }
  8093. // Check to see if we have a response for the expected dataType
  8094. if ( dataTypes[ 0 ] in responses ) {
  8095. finalDataType = dataTypes[ 0 ];
  8096. } else {
  8097. // Try convertible dataTypes
  8098. for ( type in responses ) {
  8099. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  8100. finalDataType = type;
  8101. break;
  8102. }
  8103. if ( !firstDataType ) {
  8104. firstDataType = type;
  8105. }
  8106. }
  8107. // Or just use first one
  8108. finalDataType = finalDataType || firstDataType;
  8109. }
  8110. // If we found a dataType
  8111. // We add the dataType to the list if needed
  8112. // and return the corresponding response
  8113. if ( finalDataType ) {
  8114. if ( finalDataType !== dataTypes[ 0 ] ) {
  8115. dataTypes.unshift( finalDataType );
  8116. }
  8117. return responses[ finalDataType ];
  8118. }
  8119. }
  8120. /* Chain conversions given the request and the original response
  8121. * Also sets the responseXXX fields on the jqXHR instance
  8122. */
  8123. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  8124. var conv2, current, conv, tmp, prev,
  8125. converters = {},
  8126. // Work with a copy of dataTypes in case we need to modify it for conversion
  8127. dataTypes = s.dataTypes.slice();
  8128. // Create converters map with lowercased keys
  8129. if ( dataTypes[ 1 ] ) {
  8130. for ( conv in s.converters ) {
  8131. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  8132. }
  8133. }
  8134. current = dataTypes.shift();
  8135. // Convert to each sequential dataType
  8136. while ( current ) {
  8137. if ( s.responseFields[ current ] ) {
  8138. jqXHR[ s.responseFields[ current ] ] = response;
  8139. }
  8140. // Apply the dataFilter if provided
  8141. if ( !prev && isSuccess && s.dataFilter ) {
  8142. response = s.dataFilter( response, s.dataType );
  8143. }
  8144. prev = current;
  8145. current = dataTypes.shift();
  8146. if ( current ) {
  8147. // There's only work to do if current dataType is non-auto
  8148. if ( current === "*" ) {
  8149. current = prev;
  8150. // Convert response if prev dataType is non-auto and differs from current
  8151. } else if ( prev !== "*" && prev !== current ) {
  8152. // Seek a direct converter
  8153. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  8154. // If none found, seek a pair
  8155. if ( !conv ) {
  8156. for ( conv2 in converters ) {
  8157. // If conv2 outputs current
  8158. tmp = conv2.split( " " );
  8159. if ( tmp[ 1 ] === current ) {
  8160. // If prev can be converted to accepted input
  8161. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  8162. converters[ "* " + tmp[ 0 ] ];
  8163. if ( conv ) {
  8164. // Condense equivalence converters
  8165. if ( conv === true ) {
  8166. conv = converters[ conv2 ];
  8167. // Otherwise, insert the intermediate dataType
  8168. } else if ( converters[ conv2 ] !== true ) {
  8169. current = tmp[ 0 ];
  8170. dataTypes.unshift( tmp[ 1 ] );
  8171. }
  8172. break;
  8173. }
  8174. }
  8175. }
  8176. }
  8177. // Apply converter (if not an equivalence)
  8178. if ( conv !== true ) {
  8179. // Unless errors are allowed to bubble, catch and return them
  8180. if ( conv && s.throws ) {
  8181. response = conv( response );
  8182. } else {
  8183. try {
  8184. response = conv( response );
  8185. } catch ( e ) {
  8186. return {
  8187. state: "parsererror",
  8188. error: conv ? e : "No conversion from " + prev + " to " + current
  8189. };
  8190. }
  8191. }
  8192. }
  8193. }
  8194. }
  8195. }
  8196. return { state: "success", data: response };
  8197. }
  8198. jQuery.extend( {
  8199. // Counter for holding the number of active queries
  8200. active: 0,
  8201. // Last-Modified header cache for next request
  8202. lastModified: {},
  8203. etag: {},
  8204. ajaxSettings: {
  8205. url: location.href,
  8206. type: "GET",
  8207. isLocal: rlocalProtocol.test( location.protocol ),
  8208. global: true,
  8209. processData: true,
  8210. async: true,
  8211. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  8212. /*
  8213. timeout: 0,
  8214. data: null,
  8215. dataType: null,
  8216. username: null,
  8217. password: null,
  8218. cache: null,
  8219. throws: false,
  8220. traditional: false,
  8221. headers: {},
  8222. */
  8223. accepts: {
  8224. "*": allTypes,
  8225. text: "text/plain",
  8226. html: "text/html",
  8227. xml: "application/xml, text/xml",
  8228. json: "application/json, text/javascript"
  8229. },
  8230. contents: {
  8231. xml: /\bxml\b/,
  8232. html: /\bhtml/,
  8233. json: /\bjson\b/
  8234. },
  8235. responseFields: {
  8236. xml: "responseXML",
  8237. text: "responseText",
  8238. json: "responseJSON"
  8239. },
  8240. // Data converters
  8241. // Keys separate source (or catchall "*") and destination types with a single space
  8242. converters: {
  8243. // Convert anything to text
  8244. "* text": String,
  8245. // Text to html (true = no transformation)
  8246. "text html": true,
  8247. // Evaluate text as a json expression
  8248. "text json": JSON.parse,
  8249. // Parse text as xml
  8250. "text xml": jQuery.parseXML
  8251. },
  8252. // For options that shouldn't be deep extended:
  8253. // you can add your own custom options here if
  8254. // and when you create one that shouldn't be
  8255. // deep extended (see ajaxExtend)
  8256. flatOptions: {
  8257. url: true,
  8258. context: true
  8259. }
  8260. },
  8261. // Creates a full fledged settings object into target
  8262. // with both ajaxSettings and settings fields.
  8263. // If target is omitted, writes into ajaxSettings.
  8264. ajaxSetup: function( target, settings ) {
  8265. return settings ?
  8266. // Building a settings object
  8267. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  8268. // Extending ajaxSettings
  8269. ajaxExtend( jQuery.ajaxSettings, target );
  8270. },
  8271. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  8272. ajaxTransport: addToPrefiltersOrTransports( transports ),
  8273. // Main method
  8274. ajax: function( url, options ) {
  8275. // If url is an object, simulate pre-1.5 signature
  8276. if ( typeof url === "object" ) {
  8277. options = url;
  8278. url = undefined;
  8279. }
  8280. // Force options to be an object
  8281. options = options || {};
  8282. var transport,
  8283. // URL without anti-cache param
  8284. cacheURL,
  8285. // Response headers
  8286. responseHeadersString,
  8287. responseHeaders,
  8288. // timeout handle
  8289. timeoutTimer,
  8290. // Url cleanup var
  8291. urlAnchor,
  8292. // Request state (becomes false upon send and true upon completion)
  8293. completed,
  8294. // To know if global events are to be dispatched
  8295. fireGlobals,
  8296. // Loop variable
  8297. i,
  8298. // uncached part of the url
  8299. uncached,
  8300. // Create the final options object
  8301. s = jQuery.ajaxSetup( {}, options ),
  8302. // Callbacks context
  8303. callbackContext = s.context || s,
  8304. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  8305. globalEventContext = s.context &&
  8306. ( callbackContext.nodeType || callbackContext.jquery ) ?
  8307. jQuery( callbackContext ) :
  8308. jQuery.event,
  8309. // Deferreds
  8310. deferred = jQuery.Deferred(),
  8311. completeDeferred = jQuery.Callbacks( "once memory" ),
  8312. // Status-dependent callbacks
  8313. statusCode = s.statusCode || {},
  8314. // Headers (they are sent all at once)
  8315. requestHeaders = {},
  8316. requestHeadersNames = {},
  8317. // Default abort message
  8318. strAbort = "canceled",
  8319. // Fake xhr
  8320. jqXHR = {
  8321. readyState: 0,
  8322. // Builds headers hashtable if needed
  8323. getResponseHeader: function( key ) {
  8324. var match;
  8325. if ( completed ) {
  8326. if ( !responseHeaders ) {
  8327. responseHeaders = {};
  8328. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  8329. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  8330. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  8331. .concat( match[ 2 ] );
  8332. }
  8333. }
  8334. match = responseHeaders[ key.toLowerCase() + " " ];
  8335. }
  8336. return match == null ? null : match.join( ", " );
  8337. },
  8338. // Raw string
  8339. getAllResponseHeaders: function() {
  8340. return completed ? responseHeadersString : null;
  8341. },
  8342. // Caches the header
  8343. setRequestHeader: function( name, value ) {
  8344. if ( completed == null ) {
  8345. name = requestHeadersNames[ name.toLowerCase() ] =
  8346. requestHeadersNames[ name.toLowerCase() ] || name;
  8347. requestHeaders[ name ] = value;
  8348. }
  8349. return this;
  8350. },
  8351. // Overrides response content-type header
  8352. overrideMimeType: function( type ) {
  8353. if ( completed == null ) {
  8354. s.mimeType = type;
  8355. }
  8356. return this;
  8357. },
  8358. // Status-dependent callbacks
  8359. statusCode: function( map ) {
  8360. var code;
  8361. if ( map ) {
  8362. if ( completed ) {
  8363. // Execute the appropriate callbacks
  8364. jqXHR.always( map[ jqXHR.status ] );
  8365. } else {
  8366. // Lazy-add the new callbacks in a way that preserves old ones
  8367. for ( code in map ) {
  8368. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  8369. }
  8370. }
  8371. }
  8372. return this;
  8373. },
  8374. // Cancel the request
  8375. abort: function( statusText ) {
  8376. var finalText = statusText || strAbort;
  8377. if ( transport ) {
  8378. transport.abort( finalText );
  8379. }
  8380. done( 0, finalText );
  8381. return this;
  8382. }
  8383. };
  8384. // Attach deferreds
  8385. deferred.promise( jqXHR );
  8386. // Add protocol if not provided (prefilters might expect it)
  8387. // Handle falsy url in the settings object (#10093: consistency with old signature)
  8388. // We also use the url parameter if available
  8389. s.url = ( ( url || s.url || location.href ) + "" )
  8390. .replace( rprotocol, location.protocol + "//" );
  8391. // Alias method option to type as per ticket #12004
  8392. s.type = options.method || options.type || s.method || s.type;
  8393. // Extract dataTypes list
  8394. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  8395. // A cross-domain request is in order when the origin doesn't match the current origin.
  8396. if ( s.crossDomain == null ) {
  8397. urlAnchor = document.createElement( "a" );
  8398. // Support: IE <=8 - 11, Edge 12 - 15
  8399. // IE throws exception on accessing the href property if url is malformed,
  8400. // e.g. http://example.com:80x/
  8401. try {
  8402. urlAnchor.href = s.url;
  8403. // Support: IE <=8 - 11 only
  8404. // Anchor's host property isn't correctly set when s.url is relative
  8405. urlAnchor.href = urlAnchor.href;
  8406. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  8407. urlAnchor.protocol + "//" + urlAnchor.host;
  8408. } catch ( e ) {
  8409. // If there is an error parsing the URL, assume it is crossDomain,
  8410. // it can be rejected by the transport if it is invalid
  8411. s.crossDomain = true;
  8412. }
  8413. }
  8414. // Convert data if not already a string
  8415. if ( s.data && s.processData && typeof s.data !== "string" ) {
  8416. s.data = jQuery.param( s.data, s.traditional );
  8417. }
  8418. // Apply prefilters
  8419. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  8420. // If request was aborted inside a prefilter, stop there
  8421. if ( completed ) {
  8422. return jqXHR;
  8423. }
  8424. // We can fire global events as of now if asked to
  8425. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  8426. fireGlobals = jQuery.event && s.global;
  8427. // Watch for a new set of requests
  8428. if ( fireGlobals && jQuery.active++ === 0 ) {
  8429. jQuery.event.trigger( "ajaxStart" );
  8430. }
  8431. // Uppercase the type
  8432. s.type = s.type.toUpperCase();
  8433. // Determine if request has content
  8434. s.hasContent = !rnoContent.test( s.type );
  8435. // Save the URL in case we're toying with the If-Modified-Since
  8436. // and/or If-None-Match header later on
  8437. // Remove hash to simplify url manipulation
  8438. cacheURL = s.url.replace( rhash, "" );
  8439. // More options handling for requests with no content
  8440. if ( !s.hasContent ) {
  8441. // Remember the hash so we can put it back
  8442. uncached = s.url.slice( cacheURL.length );
  8443. // If data is available and should be processed, append data to url
  8444. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  8445. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  8446. // #9682: remove data so that it's not used in an eventual retry
  8447. delete s.data;
  8448. }
  8449. // Add or update anti-cache param if needed
  8450. if ( s.cache === false ) {
  8451. cacheURL = cacheURL.replace( rantiCache, "$1" );
  8452. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  8453. }
  8454. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  8455. s.url = cacheURL + uncached;
  8456. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  8457. } else if ( s.data && s.processData &&
  8458. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  8459. s.data = s.data.replace( r20, "+" );
  8460. }
  8461. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  8462. if ( s.ifModified ) {
  8463. if ( jQuery.lastModified[ cacheURL ] ) {
  8464. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  8465. }
  8466. if ( jQuery.etag[ cacheURL ] ) {
  8467. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  8468. }
  8469. }
  8470. // Set the correct header, if data is being sent
  8471. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  8472. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  8473. }
  8474. // Set the Accepts header for the server, depending on the dataType
  8475. jqXHR.setRequestHeader(
  8476. "Accept",
  8477. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  8478. s.accepts[ s.dataTypes[ 0 ] ] +
  8479. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  8480. s.accepts[ "*" ]
  8481. );
  8482. // Check for headers option
  8483. for ( i in s.headers ) {
  8484. jqXHR.setRequestHeader( i, s.headers[ i ] );
  8485. }
  8486. // Allow custom headers/mimetypes and early abort
  8487. if ( s.beforeSend &&
  8488. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  8489. // Abort if not done already and return
  8490. return jqXHR.abort();
  8491. }
  8492. // Aborting is no longer a cancellation
  8493. strAbort = "abort";
  8494. // Install callbacks on deferreds
  8495. completeDeferred.add( s.complete );
  8496. jqXHR.done( s.success );
  8497. jqXHR.fail( s.error );
  8498. // Get transport
  8499. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  8500. // If no transport, we auto-abort
  8501. if ( !transport ) {
  8502. done( -1, "No Transport" );
  8503. } else {
  8504. jqXHR.readyState = 1;
  8505. // Send global event
  8506. if ( fireGlobals ) {
  8507. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  8508. }
  8509. // If request was aborted inside ajaxSend, stop there
  8510. if ( completed ) {
  8511. return jqXHR;
  8512. }
  8513. // Timeout
  8514. if ( s.async && s.timeout > 0 ) {
  8515. timeoutTimer = window.setTimeout( function() {
  8516. jqXHR.abort( "timeout" );
  8517. }, s.timeout );
  8518. }
  8519. try {
  8520. completed = false;
  8521. transport.send( requestHeaders, done );
  8522. } catch ( e ) {
  8523. // Rethrow post-completion exceptions
  8524. if ( completed ) {
  8525. throw e;
  8526. }
  8527. // Propagate others as results
  8528. done( -1, e );
  8529. }
  8530. }
  8531. // Callback for when everything is done
  8532. function done( status, nativeStatusText, responses, headers ) {
  8533. var isSuccess, success, error, response, modified,
  8534. statusText = nativeStatusText;
  8535. // Ignore repeat invocations
  8536. if ( completed ) {
  8537. return;
  8538. }
  8539. completed = true;
  8540. // Clear timeout if it exists
  8541. if ( timeoutTimer ) {
  8542. window.clearTimeout( timeoutTimer );
  8543. }
  8544. // Dereference transport for early garbage collection
  8545. // (no matter how long the jqXHR object will be used)
  8546. transport = undefined;
  8547. // Cache response headers
  8548. responseHeadersString = headers || "";
  8549. // Set readyState
  8550. jqXHR.readyState = status > 0 ? 4 : 0;
  8551. // Determine if successful
  8552. isSuccess = status >= 200 && status < 300 || status === 304;
  8553. // Get response data
  8554. if ( responses ) {
  8555. response = ajaxHandleResponses( s, jqXHR, responses );
  8556. }
  8557. // Convert no matter what (that way responseXXX fields are always set)
  8558. response = ajaxConvert( s, response, jqXHR, isSuccess );
  8559. // If successful, handle type chaining
  8560. if ( isSuccess ) {
  8561. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  8562. if ( s.ifModified ) {
  8563. modified = jqXHR.getResponseHeader( "Last-Modified" );
  8564. if ( modified ) {
  8565. jQuery.lastModified[ cacheURL ] = modified;
  8566. }
  8567. modified = jqXHR.getResponseHeader( "etag" );
  8568. if ( modified ) {
  8569. jQuery.etag[ cacheURL ] = modified;
  8570. }
  8571. }
  8572. // if no content
  8573. if ( status === 204 || s.type === "HEAD" ) {
  8574. statusText = "nocontent";
  8575. // if not modified
  8576. } else if ( status === 304 ) {
  8577. statusText = "notmodified";
  8578. // If we have data, let's convert it
  8579. } else {
  8580. statusText = response.state;
  8581. success = response.data;
  8582. error = response.error;
  8583. isSuccess = !error;
  8584. }
  8585. } else {
  8586. // Extract error from statusText and normalize for non-aborts
  8587. error = statusText;
  8588. if ( status || !statusText ) {
  8589. statusText = "error";
  8590. if ( status < 0 ) {
  8591. status = 0;
  8592. }
  8593. }
  8594. }
  8595. // Set data for the fake xhr object
  8596. jqXHR.status = status;
  8597. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  8598. // Success/Error
  8599. if ( isSuccess ) {
  8600. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  8601. } else {
  8602. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  8603. }
  8604. // Status-dependent callbacks
  8605. jqXHR.statusCode( statusCode );
  8606. statusCode = undefined;
  8607. if ( fireGlobals ) {
  8608. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  8609. [ jqXHR, s, isSuccess ? success : error ] );
  8610. }
  8611. // Complete
  8612. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  8613. if ( fireGlobals ) {
  8614. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  8615. // Handle the global AJAX counter
  8616. if ( !( --jQuery.active ) ) {
  8617. jQuery.event.trigger( "ajaxStop" );
  8618. }
  8619. }
  8620. }
  8621. return jqXHR;
  8622. },
  8623. getJSON: function( url, data, callback ) {
  8624. return jQuery.get( url, data, callback, "json" );
  8625. },
  8626. getScript: function( url, callback ) {
  8627. return jQuery.get( url, undefined, callback, "script" );
  8628. }
  8629. } );
  8630. jQuery.each( [ "get", "post" ], function( i, method ) {
  8631. jQuery[ method ] = function( url, data, callback, type ) {
  8632. // Shift arguments if data argument was omitted
  8633. if ( isFunction( data ) ) {
  8634. type = type || callback;
  8635. callback = data;
  8636. data = undefined;
  8637. }
  8638. // The url can be an options object (which then must have .url)
  8639. return jQuery.ajax( jQuery.extend( {
  8640. url: url,
  8641. type: method,
  8642. dataType: type,
  8643. data: data,
  8644. success: callback
  8645. }, jQuery.isPlainObject( url ) && url ) );
  8646. };
  8647. } );
  8648. jQuery._evalUrl = function( url, options ) {
  8649. return jQuery.ajax( {
  8650. url: url,
  8651. // Make this explicit, since user can override this through ajaxSetup (#11264)
  8652. type: "GET",
  8653. dataType: "script",
  8654. cache: true,
  8655. async: false,
  8656. global: false,
  8657. // Only evaluate the response if it is successful (gh-4126)
  8658. // dataFilter is not invoked for failure responses, so using it instead
  8659. // of the default converter is kludgy but it works.
  8660. converters: {
  8661. "text script": function() {}
  8662. },
  8663. dataFilter: function( response ) {
  8664. jQuery.globalEval( response, options );
  8665. }
  8666. } );
  8667. };
  8668. jQuery.fn.extend( {
  8669. wrapAll: function( html ) {
  8670. var wrap;
  8671. if ( this[ 0 ] ) {
  8672. if ( isFunction( html ) ) {
  8673. html = html.call( this[ 0 ] );
  8674. }
  8675. // The elements to wrap the target around
  8676. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  8677. if ( this[ 0 ].parentNode ) {
  8678. wrap.insertBefore( this[ 0 ] );
  8679. }
  8680. wrap.map( function() {
  8681. var elem = this;
  8682. while ( elem.firstElementChild ) {
  8683. elem = elem.firstElementChild;
  8684. }
  8685. return elem;
  8686. } ).append( this );
  8687. }
  8688. return this;
  8689. },
  8690. wrapInner: function( html ) {
  8691. if ( isFunction( html ) ) {
  8692. return this.each( function( i ) {
  8693. jQuery( this ).wrapInner( html.call( this, i ) );
  8694. } );
  8695. }
  8696. return this.each( function() {
  8697. var self = jQuery( this ),
  8698. contents = self.contents();
  8699. if ( contents.length ) {
  8700. contents.wrapAll( html );
  8701. } else {
  8702. self.append( html );
  8703. }
  8704. } );
  8705. },
  8706. wrap: function( html ) {
  8707. var htmlIsFunction = isFunction( html );
  8708. return this.each( function( i ) {
  8709. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  8710. } );
  8711. },
  8712. unwrap: function( selector ) {
  8713. this.parent( selector ).not( "body" ).each( function() {
  8714. jQuery( this ).replaceWith( this.childNodes );
  8715. } );
  8716. return this;
  8717. }
  8718. } );
  8719. jQuery.expr.pseudos.hidden = function( elem ) {
  8720. return !jQuery.expr.pseudos.visible( elem );
  8721. };
  8722. jQuery.expr.pseudos.visible = function( elem ) {
  8723. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  8724. };
  8725. jQuery.ajaxSettings.xhr = function() {
  8726. try {
  8727. return new window.XMLHttpRequest();
  8728. } catch ( e ) {}
  8729. };
  8730. var xhrSuccessStatus = {
  8731. // File protocol always yields status code 0, assume 200
  8732. 0: 200,
  8733. // Support: IE <=9 only
  8734. // #1450: sometimes IE returns 1223 when it should be 204
  8735. 1223: 204
  8736. },
  8737. xhrSupported = jQuery.ajaxSettings.xhr();
  8738. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  8739. support.ajax = xhrSupported = !!xhrSupported;
  8740. jQuery.ajaxTransport( function( options ) {
  8741. var callback, errorCallback;
  8742. // Cross domain only allowed if supported through XMLHttpRequest
  8743. if ( support.cors || xhrSupported && !options.crossDomain ) {
  8744. return {
  8745. send: function( headers, complete ) {
  8746. var i,
  8747. xhr = options.xhr();
  8748. xhr.open(
  8749. options.type,
  8750. options.url,
  8751. options.async,
  8752. options.username,
  8753. options.password
  8754. );
  8755. // Apply custom fields if provided
  8756. if ( options.xhrFields ) {
  8757. for ( i in options.xhrFields ) {
  8758. xhr[ i ] = options.xhrFields[ i ];
  8759. }
  8760. }
  8761. // Override mime type if needed
  8762. if ( options.mimeType && xhr.overrideMimeType ) {
  8763. xhr.overrideMimeType( options.mimeType );
  8764. }
  8765. // X-Requested-With header
  8766. // For cross-domain requests, seeing as conditions for a preflight are
  8767. // akin to a jigsaw puzzle, we simply never set it to be sure.
  8768. // (it can always be set on a per-request basis or even using ajaxSetup)
  8769. // For same-domain requests, won't change header if already provided.
  8770. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  8771. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  8772. }
  8773. // Set headers
  8774. for ( i in headers ) {
  8775. xhr.setRequestHeader( i, headers[ i ] );
  8776. }
  8777. // Callback
  8778. callback = function( type ) {
  8779. return function() {
  8780. if ( callback ) {
  8781. callback = errorCallback = xhr.onload =
  8782. xhr.onerror = xhr.onabort = xhr.ontimeout =
  8783. xhr.onreadystatechange = null;
  8784. if ( type === "abort" ) {
  8785. xhr.abort();
  8786. } else if ( type === "error" ) {
  8787. // Support: IE <=9 only
  8788. // On a manual native abort, IE9 throws
  8789. // errors on any property access that is not readyState
  8790. if ( typeof xhr.status !== "number" ) {
  8791. complete( 0, "error" );
  8792. } else {
  8793. complete(
  8794. // File: protocol always yields status 0; see #8605, #14207
  8795. xhr.status,
  8796. xhr.statusText
  8797. );
  8798. }
  8799. } else {
  8800. complete(
  8801. xhrSuccessStatus[ xhr.status ] || xhr.status,
  8802. xhr.statusText,
  8803. // Support: IE <=9 only
  8804. // IE9 has no XHR2 but throws on binary (trac-11426)
  8805. // For XHR2 non-text, let the caller handle it (gh-2498)
  8806. ( xhr.responseType || "text" ) !== "text" ||
  8807. typeof xhr.responseText !== "string" ?
  8808. { binary: xhr.response } :
  8809. { text: xhr.responseText },
  8810. xhr.getAllResponseHeaders()
  8811. );
  8812. }
  8813. }
  8814. };
  8815. };
  8816. // Listen to events
  8817. xhr.onload = callback();
  8818. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  8819. // Support: IE 9 only
  8820. // Use onreadystatechange to replace onabort
  8821. // to handle uncaught aborts
  8822. if ( xhr.onabort !== undefined ) {
  8823. xhr.onabort = errorCallback;
  8824. } else {
  8825. xhr.onreadystatechange = function() {
  8826. // Check readyState before timeout as it changes
  8827. if ( xhr.readyState === 4 ) {
  8828. // Allow onerror to be called first,
  8829. // but that will not handle a native abort
  8830. // Also, save errorCallback to a variable
  8831. // as xhr.onerror cannot be accessed
  8832. window.setTimeout( function() {
  8833. if ( callback ) {
  8834. errorCallback();
  8835. }
  8836. } );
  8837. }
  8838. };
  8839. }
  8840. // Create the abort callback
  8841. callback = callback( "abort" );
  8842. try {
  8843. // Do send the request (this may raise an exception)
  8844. xhr.send( options.hasContent && options.data || null );
  8845. } catch ( e ) {
  8846. // #14683: Only rethrow if this hasn't been notified as an error yet
  8847. if ( callback ) {
  8848. throw e;
  8849. }
  8850. }
  8851. },
  8852. abort: function() {
  8853. if ( callback ) {
  8854. callback();
  8855. }
  8856. }
  8857. };
  8858. }
  8859. } );
  8860. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  8861. jQuery.ajaxPrefilter( function( s ) {
  8862. if ( s.crossDomain ) {
  8863. s.contents.script = false;
  8864. }
  8865. } );
  8866. // Install script dataType
  8867. jQuery.ajaxSetup( {
  8868. accepts: {
  8869. script: "text/javascript, application/javascript, " +
  8870. "application/ecmascript, application/x-ecmascript"
  8871. },
  8872. contents: {
  8873. script: /\b(?:java|ecma)script\b/
  8874. },
  8875. converters: {
  8876. "text script": function( text ) {
  8877. jQuery.globalEval( text );
  8878. return text;
  8879. }
  8880. }
  8881. } );
  8882. // Handle cache's special case and crossDomain
  8883. jQuery.ajaxPrefilter( "script", function( s ) {
  8884. if ( s.cache === undefined ) {
  8885. s.cache = false;
  8886. }
  8887. if ( s.crossDomain ) {
  8888. s.type = "GET";
  8889. }
  8890. } );
  8891. // Bind script tag hack transport
  8892. jQuery.ajaxTransport( "script", function( s ) {
  8893. // This transport only deals with cross domain or forced-by-attrs requests
  8894. if ( s.crossDomain || s.scriptAttrs ) {
  8895. var script, callback;
  8896. return {
  8897. send: function( _, complete ) {
  8898. script = jQuery( "<script>" )
  8899. .attr( s.scriptAttrs || {} )
  8900. .prop( { charset: s.scriptCharset, src: s.url } )
  8901. .on( "load error", callback = function( evt ) {
  8902. script.remove();
  8903. callback = null;
  8904. if ( evt ) {
  8905. complete( evt.type === "error" ? 404 : 200, evt.type );
  8906. }
  8907. } );
  8908. // Use native DOM manipulation to avoid our domManip AJAX trickery
  8909. document.head.appendChild( script[ 0 ] );
  8910. },
  8911. abort: function() {
  8912. if ( callback ) {
  8913. callback();
  8914. }
  8915. }
  8916. };
  8917. }
  8918. } );
  8919. var oldCallbacks = [],
  8920. rjsonp = /(=)\?(?=&|$)|\?\?/;
  8921. // Default jsonp settings
  8922. jQuery.ajaxSetup( {
  8923. jsonp: "callback",
  8924. jsonpCallback: function() {
  8925. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  8926. this[ callback ] = true;
  8927. return callback;
  8928. }
  8929. } );
  8930. // Detect, normalize options and install callbacks for jsonp requests
  8931. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  8932. var callbackName, overwritten, responseContainer,
  8933. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  8934. "url" :
  8935. typeof s.data === "string" &&
  8936. ( s.contentType || "" )
  8937. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  8938. rjsonp.test( s.data ) && "data"
  8939. );
  8940. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  8941. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  8942. // Get callback name, remembering preexisting value associated with it
  8943. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  8944. s.jsonpCallback() :
  8945. s.jsonpCallback;
  8946. // Insert callback into url or form data
  8947. if ( jsonProp ) {
  8948. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  8949. } else if ( s.jsonp !== false ) {
  8950. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  8951. }
  8952. // Use data converter to retrieve json after script execution
  8953. s.converters[ "script json" ] = function() {
  8954. if ( !responseContainer ) {
  8955. jQuery.error( callbackName + " was not called" );
  8956. }
  8957. return responseContainer[ 0 ];
  8958. };
  8959. // Force json dataType
  8960. s.dataTypes[ 0 ] = "json";
  8961. // Install callback
  8962. overwritten = window[ callbackName ];
  8963. window[ callbackName ] = function() {
  8964. responseContainer = arguments;
  8965. };
  8966. // Clean-up function (fires after converters)
  8967. jqXHR.always( function() {
  8968. // If previous value didn't exist - remove it
  8969. if ( overwritten === undefined ) {
  8970. jQuery( window ).removeProp( callbackName );
  8971. // Otherwise restore preexisting value
  8972. } else {
  8973. window[ callbackName ] = overwritten;
  8974. }
  8975. // Save back as free
  8976. if ( s[ callbackName ] ) {
  8977. // Make sure that re-using the options doesn't screw things around
  8978. s.jsonpCallback = originalSettings.jsonpCallback;
  8979. // Save the callback name for future use
  8980. oldCallbacks.push( callbackName );
  8981. }
  8982. // Call if it was a function and we have a response
  8983. if ( responseContainer && isFunction( overwritten ) ) {
  8984. overwritten( responseContainer[ 0 ] );
  8985. }
  8986. responseContainer = overwritten = undefined;
  8987. } );
  8988. // Delegate to script
  8989. return "script";
  8990. }
  8991. } );
  8992. // Support: Safari 8 only
  8993. // In Safari 8 documents created via document.implementation.createHTMLDocument
  8994. // collapse sibling forms: the second one becomes a child of the first one.
  8995. // Because of that, this security measure has to be disabled in Safari 8.
  8996. // https://bugs.webkit.org/show_bug.cgi?id=137337
  8997. support.createHTMLDocument = ( function() {
  8998. var body = document.implementation.createHTMLDocument( "" ).body;
  8999. body.innerHTML = "<form></form><form></form>";
  9000. return body.childNodes.length === 2;
  9001. } )();
  9002. // Argument "data" should be string of html
  9003. // context (optional): If specified, the fragment will be created in this context,
  9004. // defaults to document
  9005. // keepScripts (optional): If true, will include scripts passed in the html string
  9006. jQuery.parseHTML = function( data, context, keepScripts ) {
  9007. if ( typeof data !== "string" ) {
  9008. return [];
  9009. }
  9010. if ( typeof context === "boolean" ) {
  9011. keepScripts = context;
  9012. context = false;
  9013. }
  9014. var base, parsed, scripts;
  9015. if ( !context ) {
  9016. // Stop scripts or inline event handlers from being executed immediately
  9017. // by using document.implementation
  9018. if ( support.createHTMLDocument ) {
  9019. context = document.implementation.createHTMLDocument( "" );
  9020. // Set the base href for the created document
  9021. // so any parsed elements with URLs
  9022. // are based on the document's URL (gh-2965)
  9023. base = context.createElement( "base" );
  9024. base.href = document.location.href;
  9025. context.head.appendChild( base );
  9026. } else {
  9027. context = document;
  9028. }
  9029. }
  9030. parsed = rsingleTag.exec( data );
  9031. scripts = !keepScripts && [];
  9032. // Single tag
  9033. if ( parsed ) {
  9034. return [ context.createElement( parsed[ 1 ] ) ];
  9035. }
  9036. parsed = buildFragment( [ data ], context, scripts );
  9037. if ( scripts && scripts.length ) {
  9038. jQuery( scripts ).remove();
  9039. }
  9040. return jQuery.merge( [], parsed.childNodes );
  9041. };
  9042. /**
  9043. * Load a url into a page
  9044. */
  9045. jQuery.fn.load = function( url, params, callback ) {
  9046. var selector, type, response,
  9047. self = this,
  9048. off = url.indexOf( " " );
  9049. if ( off > -1 ) {
  9050. selector = stripAndCollapse( url.slice( off ) );
  9051. url = url.slice( 0, off );
  9052. }
  9053. // If it's a function
  9054. if ( isFunction( params ) ) {
  9055. // We assume that it's the callback
  9056. callback = params;
  9057. params = undefined;
  9058. // Otherwise, cloud a param string
  9059. } else if ( params && typeof params === "object" ) {
  9060. type = "POST";
  9061. }
  9062. // If we have elements to modify, make the request
  9063. if ( self.length > 0 ) {
  9064. jQuery.ajax( {
  9065. url: url,
  9066. // If "type" variable is undefined, then "GET" method will be used.
  9067. // Make value of this field explicit since
  9068. // user can override it through ajaxSetup method
  9069. type: type || "GET",
  9070. dataType: "html",
  9071. data: params
  9072. } ).done( function( responseText ) {
  9073. // Save response for use in complete callback
  9074. response = arguments;
  9075. self.html( selector ?
  9076. // If a selector was specified, locate the right elements in a dummy div
  9077. // Exclude scripts to avoid IE 'Permission Denied' errors
  9078. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  9079. // Otherwise use the full result
  9080. responseText );
  9081. // If the request succeeds, this function gets "data", "status", "jqXHR"
  9082. // but they are ignored because response was set above.
  9083. // If it fails, this function gets "jqXHR", "status", "error"
  9084. } ).always( callback && function( jqXHR, status ) {
  9085. self.each( function() {
  9086. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  9087. } );
  9088. } );
  9089. }
  9090. return this;
  9091. };
  9092. // Attach a bunch of functions for handling common AJAX events
  9093. jQuery.each( [
  9094. "ajaxStart",
  9095. "ajaxStop",
  9096. "ajaxComplete",
  9097. "ajaxError",
  9098. "ajaxSuccess",
  9099. "ajaxSend"
  9100. ], function( i, type ) {
  9101. jQuery.fn[ type ] = function( fn ) {
  9102. return this.on( type, fn );
  9103. };
  9104. } );
  9105. jQuery.expr.pseudos.animated = function( elem ) {
  9106. return jQuery.grep( jQuery.timers, function( fn ) {
  9107. return elem === fn.elem;
  9108. } ).length;
  9109. };
  9110. jQuery.offset = {
  9111. setOffset: function( elem, options, i ) {
  9112. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  9113. position = jQuery.css( elem, "position" ),
  9114. curElem = jQuery( elem ),
  9115. props = {};
  9116. // Set position first, in-case top/left are set even on static elem
  9117. if ( position === "static" ) {
  9118. elem.style.position = "relative";
  9119. }
  9120. curOffset = curElem.offset();
  9121. curCSSTop = jQuery.css( elem, "top" );
  9122. curCSSLeft = jQuery.css( elem, "left" );
  9123. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  9124. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  9125. // Need to be able to calculate position if either
  9126. // top or left is auto and position is either absolute or fixed
  9127. if ( calculatePosition ) {
  9128. curPosition = curElem.position();
  9129. curTop = curPosition.top;
  9130. curLeft = curPosition.left;
  9131. } else {
  9132. curTop = parseFloat( curCSSTop ) || 0;
  9133. curLeft = parseFloat( curCSSLeft ) || 0;
  9134. }
  9135. if ( isFunction( options ) ) {
  9136. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  9137. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  9138. }
  9139. if ( options.top != null ) {
  9140. props.top = ( options.top - curOffset.top ) + curTop;
  9141. }
  9142. if ( options.left != null ) {
  9143. props.left = ( options.left - curOffset.left ) + curLeft;
  9144. }
  9145. if ( "using" in options ) {
  9146. options.using.call( elem, props );
  9147. } else {
  9148. curElem.css( props );
  9149. }
  9150. }
  9151. };
  9152. jQuery.fn.extend( {
  9153. // offset() relates an element's border box to the document origin
  9154. offset: function( options ) {
  9155. // Preserve chaining for setter
  9156. if ( arguments.length ) {
  9157. return options === undefined ?
  9158. this :
  9159. this.each( function( i ) {
  9160. jQuery.offset.setOffset( this, options, i );
  9161. } );
  9162. }
  9163. var rect, win,
  9164. elem = this[ 0 ];
  9165. if ( !elem ) {
  9166. return;
  9167. }
  9168. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  9169. // Support: IE <=11 only
  9170. // Running getBoundingClientRect on a
  9171. // disconnected node in IE throws an error
  9172. if ( !elem.getClientRects().length ) {
  9173. return { top: 0, left: 0 };
  9174. }
  9175. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  9176. rect = elem.getBoundingClientRect();
  9177. win = elem.ownerDocument.defaultView;
  9178. return {
  9179. top: rect.top + win.pageYOffset,
  9180. left: rect.left + win.pageXOffset
  9181. };
  9182. },
  9183. // position() relates an element's margin box to its offset parent's padding box
  9184. // This corresponds to the behavior of CSS absolute positioning
  9185. position: function() {
  9186. if ( !this[ 0 ] ) {
  9187. return;
  9188. }
  9189. var offsetParent, offset, doc,
  9190. elem = this[ 0 ],
  9191. parentOffset = { top: 0, left: 0 };
  9192. // position:fixed elements are offset from the viewport, which itself always has zero offset
  9193. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  9194. // Assume position:fixed implies availability of getBoundingClientRect
  9195. offset = elem.getBoundingClientRect();
  9196. } else {
  9197. offset = this.offset();
  9198. // Account for the *real* offset parent, which can be the document or its root element
  9199. // when a statically positioned element is identified
  9200. doc = elem.ownerDocument;
  9201. offsetParent = elem.offsetParent || doc.documentElement;
  9202. while ( offsetParent &&
  9203. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  9204. jQuery.css( offsetParent, "position" ) === "static" ) {
  9205. offsetParent = offsetParent.parentNode;
  9206. }
  9207. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  9208. // Incorporate borders into its offset, since they are outside its content origin
  9209. parentOffset = jQuery( offsetParent ).offset();
  9210. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  9211. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  9212. }
  9213. }
  9214. // Subtract parent offsets and element margins
  9215. return {
  9216. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  9217. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  9218. };
  9219. },
  9220. // This method will return documentElement in the following cases:
  9221. // 1) For the element inside the iframe without offsetParent, this method will return
  9222. // documentElement of the parent window
  9223. // 2) For the hidden or detached element
  9224. // 3) For body or html element, i.e. in case of the html node - it will return itself
  9225. //
  9226. // but those exceptions were never presented as a real life use-cases
  9227. // and might be considered as more preferable results.
  9228. //
  9229. // This logic, however, is not guaranteed and can change at any point in the future
  9230. offsetParent: function() {
  9231. return this.map( function() {
  9232. var offsetParent = this.offsetParent;
  9233. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  9234. offsetParent = offsetParent.offsetParent;
  9235. }
  9236. return offsetParent || documentElement;
  9237. } );
  9238. }
  9239. } );
  9240. // Create scrollLeft and scrollTop methods
  9241. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  9242. var top = "pageYOffset" === prop;
  9243. jQuery.fn[ method ] = function( val ) {
  9244. return access( this, function( elem, method, val ) {
  9245. // Coalesce documents and windows
  9246. var win;
  9247. if ( isWindow( elem ) ) {
  9248. win = elem;
  9249. } else if ( elem.nodeType === 9 ) {
  9250. win = elem.defaultView;
  9251. }
  9252. if ( val === undefined ) {
  9253. return win ? win[ prop ] : elem[ method ];
  9254. }
  9255. if ( win ) {
  9256. win.scrollTo(
  9257. !top ? val : win.pageXOffset,
  9258. top ? val : win.pageYOffset
  9259. );
  9260. } else {
  9261. elem[ method ] = val;
  9262. }
  9263. }, method, val, arguments.length );
  9264. };
  9265. } );
  9266. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  9267. // Add the top/left cssHooks using jQuery.fn.position
  9268. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  9269. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  9270. // getComputedStyle returns percent when specified for top/left/bottom/right;
  9271. // rather than make the css module depend on the offset module, just check for it here
  9272. jQuery.each( [ "top", "left" ], function( i, prop ) {
  9273. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  9274. function( elem, computed ) {
  9275. if ( computed ) {
  9276. computed = curCSS( elem, prop );
  9277. // If curCSS returns percentage, fallback to offset
  9278. return rnumnonpx.test( computed ) ?
  9279. jQuery( elem ).position()[ prop ] + "px" :
  9280. computed;
  9281. }
  9282. }
  9283. );
  9284. } );
  9285. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  9286. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  9287. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  9288. function( defaultExtra, funcName ) {
  9289. // Margin is only for outerHeight, outerWidth
  9290. jQuery.fn[ funcName ] = function( margin, value ) {
  9291. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  9292. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  9293. return access( this, function( elem, type, value ) {
  9294. var doc;
  9295. if ( isWindow( elem ) ) {
  9296. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  9297. return funcName.indexOf( "outer" ) === 0 ?
  9298. elem[ "inner" + name ] :
  9299. elem.document.documentElement[ "client" + name ];
  9300. }
  9301. // Get document width or height
  9302. if ( elem.nodeType === 9 ) {
  9303. doc = elem.documentElement;
  9304. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  9305. // whichever is greatest
  9306. return Math.max(
  9307. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  9308. elem.body[ "offset" + name ], doc[ "offset" + name ],
  9309. doc[ "client" + name ]
  9310. );
  9311. }
  9312. return value === undefined ?
  9313. // Get width or height on the element, requesting but not forcing parseFloat
  9314. jQuery.css( elem, type, extra ) :
  9315. // Set width or height on the element
  9316. jQuery.style( elem, type, value, extra );
  9317. }, type, chainable ? margin : undefined, chainable );
  9318. };
  9319. } );
  9320. } );
  9321. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  9322. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  9323. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  9324. function( i, name ) {
  9325. // Handle event binding
  9326. jQuery.fn[ name ] = function( data, fn ) {
  9327. return arguments.length > 0 ?
  9328. this.on( name, null, data, fn ) :
  9329. this.trigger( name );
  9330. };
  9331. } );
  9332. jQuery.fn.extend( {
  9333. hover: function( fnOver, fnOut ) {
  9334. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  9335. }
  9336. } );
  9337. jQuery.fn.extend( {
  9338. bind: function( types, data, fn ) {
  9339. return this.on( types, null, data, fn );
  9340. },
  9341. unbind: function( types, fn ) {
  9342. return this.off( types, null, fn );
  9343. },
  9344. delegate: function( selector, types, data, fn ) {
  9345. return this.on( types, selector, data, fn );
  9346. },
  9347. undelegate: function( selector, types, fn ) {
  9348. // ( namespace ) or ( selector, types [, fn] )
  9349. return arguments.length === 1 ?
  9350. this.off( selector, "**" ) :
  9351. this.off( types, selector || "**", fn );
  9352. }
  9353. } );
  9354. // Bind a function to a context, optionally partially applying any
  9355. // arguments.
  9356. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  9357. // However, it is not slated for removal any time soon
  9358. jQuery.proxy = function( fn, context ) {
  9359. var tmp, args, proxy;
  9360. if ( typeof context === "string" ) {
  9361. tmp = fn[ context ];
  9362. context = fn;
  9363. fn = tmp;
  9364. }
  9365. // Quick check to determine if target is callable, in the spec
  9366. // this throws a TypeError, but we will just return undefined.
  9367. if ( !isFunction( fn ) ) {
  9368. return undefined;
  9369. }
  9370. // Simulated bind
  9371. args = slice.call( arguments, 2 );
  9372. proxy = function() {
  9373. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  9374. };
  9375. // Set the guid of unique handler to the same of original handler, so it can be removed
  9376. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  9377. return proxy;
  9378. };
  9379. jQuery.holdReady = function( hold ) {
  9380. if ( hold ) {
  9381. jQuery.readyWait++;
  9382. } else {
  9383. jQuery.ready( true );
  9384. }
  9385. };
  9386. jQuery.isArray = Array.isArray;
  9387. jQuery.parseJSON = JSON.parse;
  9388. jQuery.nodeName = nodeName;
  9389. jQuery.isFunction = isFunction;
  9390. jQuery.isWindow = isWindow;
  9391. jQuery.camelCase = camelCase;
  9392. jQuery.type = toType;
  9393. jQuery.now = Date.now;
  9394. jQuery.isNumeric = function( obj ) {
  9395. // As of jQuery 3.0, isNumeric is limited to
  9396. // strings and numbers (primitives or objects)
  9397. // that can be coerced to finite numbers (gh-2662)
  9398. var type = jQuery.type( obj );
  9399. return ( type === "number" || type === "string" ) &&
  9400. // parseFloat NaNs numeric-cast false positives ("")
  9401. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  9402. // subtraction forces infinities to NaN
  9403. !isNaN( obj - parseFloat( obj ) );
  9404. };
  9405. // Register as a named AMD module, since jQuery can be concatenated with other
  9406. // files that may use define, but not via a proper concatenation script that
  9407. // understands anonymous AMD modules. A named AMD is safest and most robust
  9408. // way to register. Lowercase jquery is used because AMD module names are
  9409. // derived from file names, and jQuery is normally delivered in a lowercase
  9410. // file name. Do this after creating the global so that if an AMD module wants
  9411. // to call noConflict to hide this version of jQuery, it will work.
  9412. // Note that for maximum portability, libraries that are not jQuery should
  9413. // declare themselves as anonymous modules, and avoid setting a global if an
  9414. // AMD loader is present. jQuery is a special case. For more information, see
  9415. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  9416. if ( typeof define === "function" && define.amd ) {
  9417. define( "jquery", [], function() {
  9418. return jQuery;
  9419. } );
  9420. }
  9421. var
  9422. // Map over jQuery in case of overwrite
  9423. _jQuery = window.jQuery,
  9424. // Map over the $ in case of overwrite
  9425. _$ = window.$;
  9426. jQuery.noConflict = function( deep ) {
  9427. if ( window.$ === jQuery ) {
  9428. window.$ = _$;
  9429. }
  9430. if ( deep && window.jQuery === jQuery ) {
  9431. window.jQuery = _jQuery;
  9432. }
  9433. return jQuery;
  9434. };
  9435. // Expose jQuery and $ identifiers, even in AMD
  9436. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  9437. // and CommonJS for browser emulators (#13566)
  9438. if ( !noGlobal ) {
  9439. window.jQuery = window.$ = jQuery;
  9440. }
  9441. return jQuery;
  9442. } );
  9443. /*! jQuery UI - v1.11.4 - 2016-03-02
  9444. * http://jqueryui.com
  9445. * Includes: core.js, widget.js, mouse.js, draggable.js, droppable.js, sortable.js, effect.js, effect-slide.js
  9446. * Copyright jQuery Foundation and other contributors; Licensed MIT */
  9447. (function( factory ) {
  9448. if ( typeof define === "function" && define.amd ) {
  9449. // AMD. Register as an anonymous module.
  9450. define([ "jquery" ], factory );
  9451. } else {
  9452. // Browser globals
  9453. factory( jQuery );
  9454. }
  9455. }(function( $ ) {
  9456. /*!
  9457. * jQuery UI Core 1.11.4
  9458. * http://jqueryui.com
  9459. *
  9460. * Copyright jQuery Foundation and other contributors
  9461. * Released under the MIT license.
  9462. * http://jquery.org/license
  9463. *
  9464. * http://api.jqueryui.com/category/ui-core/
  9465. */
  9466. // $.ui might exist from components with no dependencies, e.g., $.ui.position
  9467. $.ui = $.ui || {};
  9468. $.extend( $.ui, {
  9469. version: "1.11.4",
  9470. keyCode: {
  9471. BACKSPACE: 8,
  9472. COMMA: 188,
  9473. DELETE: 46,
  9474. DOWN: 40,
  9475. END: 35,
  9476. ENTER: 13,
  9477. ESCAPE: 27,
  9478. HOME: 36,
  9479. LEFT: 37,
  9480. PAGE_DOWN: 34,
  9481. PAGE_UP: 33,
  9482. PERIOD: 190,
  9483. RIGHT: 39,
  9484. SPACE: 32,
  9485. TAB: 9,
  9486. UP: 38
  9487. }
  9488. });
  9489. // plugins
  9490. $.fn.extend({
  9491. scrollParent: function( includeHidden ) {
  9492. var position = this.css( "position" ),
  9493. excludeStaticParent = position === "absolute",
  9494. overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
  9495. scrollParent = this.parents().filter( function() {
  9496. var parent = $( this );
  9497. if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
  9498. return false;
  9499. }
  9500. return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) );
  9501. }).eq( 0 );
  9502. return position === "fixed" || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent;
  9503. },
  9504. uniqueId: (function() {
  9505. var uuid = 0;
  9506. return function() {
  9507. return this.each(function() {
  9508. if ( !this.id ) {
  9509. this.id = "ui-id-" + ( ++uuid );
  9510. }
  9511. });
  9512. };
  9513. })(),
  9514. removeUniqueId: function() {
  9515. return this.each(function() {
  9516. if ( /^ui-id-\d+$/.test( this.id ) ) {
  9517. $( this ).removeAttr( "id" );
  9518. }
  9519. });
  9520. }
  9521. });
  9522. // selectors
  9523. function focusable( element, isTabIndexNotNaN ) {
  9524. var map, mapName, img,
  9525. nodeName = element.nodeName.toLowerCase();
  9526. if ( "area" === nodeName ) {
  9527. map = element.parentNode;
  9528. mapName = map.name;
  9529. if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
  9530. return false;
  9531. }
  9532. img = $( "img[usemap='#" + mapName + "']" )[ 0 ];
  9533. return !!img && visible( img );
  9534. }
  9535. return ( /^(input|select|textarea|button|object)$/.test( nodeName ) ?
  9536. !element.disabled :
  9537. "a" === nodeName ?
  9538. element.href || isTabIndexNotNaN :
  9539. isTabIndexNotNaN) &&
  9540. // the element and all of its ancestors must be visible
  9541. visible( element );
  9542. }
  9543. function visible( element ) {
  9544. return $.expr.filters.visible( element ) &&
  9545. !$( element ).parents().addBack().filter(function() {
  9546. return $.css( this, "visibility" ) === "hidden";
  9547. }).length;
  9548. }
  9549. $.extend( $.expr[ ":" ], {
  9550. data: $.expr.createPseudo ?
  9551. $.expr.createPseudo(function( dataName ) {
  9552. return function( elem ) {
  9553. return !!$.data( elem, dataName );
  9554. };
  9555. }) :
  9556. // support: jQuery <1.8
  9557. function( elem, i, match ) {
  9558. return !!$.data( elem, match[ 3 ] );
  9559. },
  9560. focusable: function( element ) {
  9561. return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
  9562. },
  9563. tabbable: function( element ) {
  9564. var tabIndex = $.attr( element, "tabindex" ),
  9565. isTabIndexNaN = isNaN( tabIndex );
  9566. return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
  9567. }
  9568. });
  9569. // support: jQuery <1.8
  9570. if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
  9571. $.each( [ "Width", "Height" ], function( i, name ) {
  9572. var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
  9573. type = name.toLowerCase(),
  9574. orig = {
  9575. innerWidth: $.fn.innerWidth,
  9576. innerHeight: $.fn.innerHeight,
  9577. outerWidth: $.fn.outerWidth,
  9578. outerHeight: $.fn.outerHeight
  9579. };
  9580. function reduce( elem, size, border, margin ) {
  9581. $.each( side, function() {
  9582. size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
  9583. if ( border ) {
  9584. size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
  9585. }
  9586. if ( margin ) {
  9587. size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
  9588. }
  9589. });
  9590. return size;
  9591. }
  9592. $.fn[ "inner" + name ] = function( size ) {
  9593. if ( size === undefined ) {
  9594. return orig[ "inner" + name ].call( this );
  9595. }
  9596. return this.each(function() {
  9597. $( this ).css( type, reduce( this, size ) + "px" );
  9598. });
  9599. };
  9600. $.fn[ "outer" + name] = function( size, margin ) {
  9601. if ( typeof size !== "number" ) {
  9602. return orig[ "outer" + name ].call( this, size );
  9603. }
  9604. return this.each(function() {
  9605. $( this).css( type, reduce( this, size, true, margin ) + "px" );
  9606. });
  9607. };
  9608. });
  9609. }
  9610. // support: jQuery <1.8
  9611. if ( !$.fn.addBack ) {
  9612. $.fn.addBack = function( selector ) {
  9613. return this.add( selector == null ?
  9614. this.prevObject : this.prevObject.filter( selector )
  9615. );
  9616. };
  9617. }
  9618. // support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
  9619. if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
  9620. $.fn.removeData = (function( removeData ) {
  9621. return function( key ) {
  9622. if ( arguments.length ) {
  9623. return removeData.call( this, $.camelCase( key ) );
  9624. } else {
  9625. return removeData.call( this );
  9626. }
  9627. };
  9628. })( $.fn.removeData );
  9629. }
  9630. // deprecated
  9631. $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
  9632. $.fn.extend({
  9633. focus: (function( orig ) {
  9634. return function( delay, fn ) {
  9635. return typeof delay === "number" ?
  9636. this.each(function() {
  9637. var elem = this;
  9638. setTimeout(function() {
  9639. $( elem ).focus();
  9640. if ( fn ) {
  9641. fn.call( elem );
  9642. }
  9643. }, delay );
  9644. }) :
  9645. orig.apply( this, arguments );
  9646. };
  9647. })( $.fn.focus ),
  9648. disableSelection: (function() {
  9649. var eventType = "onselectstart" in document.createElement( "div" ) ?
  9650. "selectstart" :
  9651. "mousedown";
  9652. return function() {
  9653. return this.bind( eventType + ".ui-disableSelection", function( event ) {
  9654. event.preventDefault();
  9655. });
  9656. };
  9657. })(),
  9658. enableSelection: function() {
  9659. return this.unbind( ".ui-disableSelection" );
  9660. },
  9661. zIndex: function( zIndex ) {
  9662. if ( zIndex !== undefined ) {
  9663. return this.css( "zIndex", zIndex );
  9664. }
  9665. if ( this.length ) {
  9666. var elem = $( this[ 0 ] ), position, value;
  9667. while ( elem.length && elem[ 0 ] !== document ) {
  9668. // Ignore z-index if position is set to a value where z-index is ignored by the browser
  9669. // This makes behavior of this function consistent across browsers
  9670. // WebKit always returns auto if the element is positioned
  9671. position = elem.css( "position" );
  9672. if ( position === "absolute" || position === "relative" || position === "fixed" ) {
  9673. // IE returns 0 when zIndex is not specified
  9674. // other browsers return a string
  9675. // we ignore the case of nested elements with an explicit value of 0
  9676. // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
  9677. value = parseInt( elem.css( "zIndex" ), 10 );
  9678. if ( !isNaN( value ) && value !== 0 ) {
  9679. return value;
  9680. }
  9681. }
  9682. elem = elem.parent();
  9683. }
  9684. }
  9685. return 0;
  9686. }
  9687. });
  9688. // $.ui.plugin is deprecated. Use $.widget() extensions instead.
  9689. $.ui.plugin = {
  9690. add: function( module, option, set ) {
  9691. var i,
  9692. proto = $.ui[ module ].prototype;
  9693. for ( i in set ) {
  9694. proto.plugins[ i ] = proto.plugins[ i ] || [];
  9695. proto.plugins[ i ].push( [ option, set[ i ] ] );
  9696. }
  9697. },
  9698. call: function( instance, name, args, allowDisconnected ) {
  9699. var i,
  9700. set = instance.plugins[ name ];
  9701. if ( !set ) {
  9702. return;
  9703. }
  9704. if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) ) {
  9705. return;
  9706. }
  9707. for ( i = 0; i < set.length; i++ ) {
  9708. if ( instance.options[ set[ i ][ 0 ] ] ) {
  9709. set[ i ][ 1 ].apply( instance.element, args );
  9710. }
  9711. }
  9712. }
  9713. };
  9714. /*!
  9715. * jQuery UI Widget 1.11.4
  9716. * http://jqueryui.com
  9717. *
  9718. * Copyright jQuery Foundation and other contributors
  9719. * Released under the MIT license.
  9720. * http://jquery.org/license
  9721. *
  9722. * http://api.jqueryui.com/jQuery.widget/
  9723. */
  9724. var widget_uuid = 0,
  9725. widget_slice = Array.prototype.slice;
  9726. $.cleanData = (function( orig ) {
  9727. return function( elems ) {
  9728. var events, elem, i;
  9729. for ( i = 0; (elem = elems[i]) != null; i++ ) {
  9730. try {
  9731. // Only trigger remove when necessary to save time
  9732. events = $._data( elem, "events" );
  9733. if ( events && events.remove ) {
  9734. $( elem ).triggerHandler( "remove" );
  9735. }
  9736. // http://bugs.jquery.com/ticket/8235
  9737. } catch ( e ) {}
  9738. }
  9739. orig( elems );
  9740. };
  9741. })( $.cleanData );
  9742. $.widget = function( name, base, prototype ) {
  9743. var fullName, existingConstructor, constructor, basePrototype,
  9744. // proxiedPrototype allows the provided prototype to remain unmodified
  9745. // so that it can be used as a mixin for multiple widgets (#8876)
  9746. proxiedPrototype = {},
  9747. namespace = name.split( "." )[ 0 ];
  9748. name = name.split( "." )[ 1 ];
  9749. fullName = namespace + "-" + name;
  9750. if ( !prototype ) {
  9751. prototype = base;
  9752. base = $.Widget;
  9753. }
  9754. // create selector for plugin
  9755. $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
  9756. return !!$.data( elem, fullName );
  9757. };
  9758. $[ namespace ] = $[ namespace ] || {};
  9759. existingConstructor = $[ namespace ][ name ];
  9760. constructor = $[ namespace ][ name ] = function( options, element ) {
  9761. // allow instantiation without "new" keyword
  9762. if ( !this._createWidget ) {
  9763. return new constructor( options, element );
  9764. }
  9765. // allow instantiation without initializing for simple inheritance
  9766. // must use "new" keyword (the code above always passes args)
  9767. if ( arguments.length ) {
  9768. this._createWidget( options, element );
  9769. }
  9770. };
  9771. // extend with the existing constructor to carry over any static properties
  9772. $.extend( constructor, existingConstructor, {
  9773. version: prototype.version,
  9774. // copy the object used to create the prototype in case we need to
  9775. // redefine the widget later
  9776. _proto: $.extend( {}, prototype ),
  9777. // track widgets that inherit from this widget in case this widget is
  9778. // redefined after a widget inherits from it
  9779. _childConstructors: []
  9780. });
  9781. basePrototype = new base();
  9782. // we need to make the options hash a property directly on the new instance
  9783. // otherwise we'll modify the options hash on the prototype that we're
  9784. // inheriting from
  9785. basePrototype.options = $.widget.extend( {}, basePrototype.options );
  9786. $.each( prototype, function( prop, value ) {
  9787. if ( !$.isFunction( value ) ) {
  9788. proxiedPrototype[ prop ] = value;
  9789. return;
  9790. }
  9791. proxiedPrototype[ prop ] = (function() {
  9792. var _super = function() {
  9793. return base.prototype[ prop ].apply( this, arguments );
  9794. },
  9795. _superApply = function( args ) {
  9796. return base.prototype[ prop ].apply( this, args );
  9797. };
  9798. return function() {
  9799. var __super = this._super,
  9800. __superApply = this._superApply,
  9801. returnValue;
  9802. this._super = _super;
  9803. this._superApply = _superApply;
  9804. returnValue = value.apply( this, arguments );
  9805. this._super = __super;
  9806. this._superApply = __superApply;
  9807. return returnValue;
  9808. };
  9809. })();
  9810. });
  9811. constructor.prototype = $.widget.extend( basePrototype, {
  9812. // TODO: remove support for widgetEventPrefix
  9813. // always use the name + a colon as the prefix, e.g., draggable:start
  9814. // don't prefix for widgets that aren't DOM-based
  9815. widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
  9816. }, proxiedPrototype, {
  9817. constructor: constructor,
  9818. namespace: namespace,
  9819. widgetName: name,
  9820. widgetFullName: fullName
  9821. });
  9822. // If this widget is being redefined then we need to find all widgets that
  9823. // are inheriting from it and redefine all of them so that they inherit from
  9824. // the new version of this widget. We're essentially trying to replace one
  9825. // level in the prototype chain.
  9826. if ( existingConstructor ) {
  9827. $.each( existingConstructor._childConstructors, function( i, child ) {
  9828. var childPrototype = child.prototype;
  9829. // redefine the child widget using the same prototype that was
  9830. // originally used, but inherit from the new version of the base
  9831. $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
  9832. });
  9833. // remove the list of existing child constructors from the old constructor
  9834. // so the old child constructors can be garbage collected
  9835. delete existingConstructor._childConstructors;
  9836. } else {
  9837. base._childConstructors.push( constructor );
  9838. }
  9839. $.widget.bridge( name, constructor );
  9840. return constructor;
  9841. };
  9842. $.widget.extend = function( target ) {
  9843. var input = widget_slice.call( arguments, 1 ),
  9844. inputIndex = 0,
  9845. inputLength = input.length,
  9846. key,
  9847. value;
  9848. for ( ; inputIndex < inputLength; inputIndex++ ) {
  9849. for ( key in input[ inputIndex ] ) {
  9850. value = input[ inputIndex ][ key ];
  9851. if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
  9852. // Clone objects
  9853. if ( $.isPlainObject( value ) ) {
  9854. target[ key ] = $.isPlainObject( target[ key ] ) ?
  9855. $.widget.extend( {}, target[ key ], value ) :
  9856. // Don't extend strings, arrays, etc. with objects
  9857. $.widget.extend( {}, value );
  9858. // Copy everything else by reference
  9859. } else {
  9860. target[ key ] = value;
  9861. }
  9862. }
  9863. }
  9864. }
  9865. return target;
  9866. };
  9867. $.widget.bridge = function( name, object ) {
  9868. var fullName = object.prototype.widgetFullName || name;
  9869. $.fn[ name ] = function( options ) {
  9870. var isMethodCall = typeof options === "string",
  9871. args = widget_slice.call( arguments, 1 ),
  9872. returnValue = this;
  9873. if ( isMethodCall ) {
  9874. this.each(function() {
  9875. var methodValue,
  9876. instance = $.data( this, fullName );
  9877. if ( options === "instance" ) {
  9878. returnValue = instance;
  9879. return false;
  9880. }
  9881. if ( !instance ) {
  9882. return $.error( "cannot call methods on " + name + " prior to initialization; " +
  9883. "attempted to call method '" + options + "'" );
  9884. }
  9885. if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
  9886. return $.error( "no such method '" + options + "' for " + name + " widget instance" );
  9887. }
  9888. methodValue = instance[ options ].apply( instance, args );
  9889. if ( methodValue !== instance && methodValue !== undefined ) {
  9890. returnValue = methodValue && methodValue.jquery ?
  9891. returnValue.pushStack( methodValue.get() ) :
  9892. methodValue;
  9893. return false;
  9894. }
  9895. });
  9896. } else {
  9897. // Allow multiple hashes to be passed on init
  9898. if ( args.length ) {
  9899. options = $.widget.extend.apply( null, [ options ].concat(args) );
  9900. }
  9901. this.each(function() {
  9902. var instance = $.data( this, fullName );
  9903. if ( instance ) {
  9904. instance.option( options || {} );
  9905. if ( instance._init ) {
  9906. instance._init();
  9907. }
  9908. } else {
  9909. $.data( this, fullName, new object( options, this ) );
  9910. }
  9911. });
  9912. }
  9913. return returnValue;
  9914. };
  9915. };
  9916. $.Widget = function( /* options, element */ ) {};
  9917. $.Widget._childConstructors = [];
  9918. $.Widget.prototype = {
  9919. widgetName: "widget",
  9920. widgetEventPrefix: "",
  9921. defaultElement: "<div>",
  9922. options: {
  9923. disabled: false,
  9924. // callbacks
  9925. create: null
  9926. },
  9927. _createWidget: function( options, element ) {
  9928. element = $( element || this.defaultElement || this )[ 0 ];
  9929. this.element = $( element );
  9930. this.uuid = widget_uuid++;
  9931. this.eventNamespace = "." + this.widgetName + this.uuid;
  9932. this.bindings = $();
  9933. this.hoverable = $();
  9934. this.focusable = $();
  9935. if ( element !== this ) {
  9936. $.data( element, this.widgetFullName, this );
  9937. this._on( true, this.element, {
  9938. remove: function( event ) {
  9939. if ( event.target === element ) {
  9940. this.destroy();
  9941. }
  9942. }
  9943. });
  9944. this.document = $( element.style ?
  9945. // element within the document
  9946. element.ownerDocument :
  9947. // element is window or document
  9948. element.document || element );
  9949. this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
  9950. }
  9951. this.options = $.widget.extend( {},
  9952. this.options,
  9953. this._getCreateOptions(),
  9954. options );
  9955. this._create();
  9956. this._trigger( "create", null, this._getCreateEventData() );
  9957. this._init();
  9958. },
  9959. _getCreateOptions: $.noop,
  9960. _getCreateEventData: $.noop,
  9961. _create: $.noop,
  9962. _init: $.noop,
  9963. destroy: function() {
  9964. this._destroy();
  9965. // we can probably remove the unbind calls in 2.0
  9966. // all event bindings should go through this._on()
  9967. this.element
  9968. .unbind( this.eventNamespace )
  9969. .removeData( this.widgetFullName )
  9970. // support: jquery <1.6.3
  9971. // http://bugs.jquery.com/ticket/9413
  9972. .removeData( $.camelCase( this.widgetFullName ) );
  9973. this.widget()
  9974. .unbind( this.eventNamespace )
  9975. .removeAttr( "aria-disabled" )
  9976. .removeClass(
  9977. this.widgetFullName + "-disabled " +
  9978. "ui-state-disabled" );
  9979. // clean up events and states
  9980. this.bindings.unbind( this.eventNamespace );
  9981. this.hoverable.removeClass( "ui-state-hover" );
  9982. this.focusable.removeClass( "ui-state-focus" );
  9983. },
  9984. _destroy: $.noop,
  9985. widget: function() {
  9986. return this.element;
  9987. },
  9988. option: function( key, value ) {
  9989. var options = key,
  9990. parts,
  9991. curOption,
  9992. i;
  9993. if ( arguments.length === 0 ) {
  9994. // don't return a reference to the internal hash
  9995. return $.widget.extend( {}, this.options );
  9996. }
  9997. if ( typeof key === "string" ) {
  9998. // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
  9999. options = {};
  10000. parts = key.split( "." );
  10001. key = parts.shift();
  10002. if ( parts.length ) {
  10003. curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
  10004. for ( i = 0; i < parts.length - 1; i++ ) {
  10005. curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
  10006. curOption = curOption[ parts[ i ] ];
  10007. }
  10008. key = parts.pop();
  10009. if ( arguments.length === 1 ) {
  10010. return curOption[ key ] === undefined ? null : curOption[ key ];
  10011. }
  10012. curOption[ key ] = value;
  10013. } else {
  10014. if ( arguments.length === 1 ) {
  10015. return this.options[ key ] === undefined ? null : this.options[ key ];
  10016. }
  10017. options[ key ] = value;
  10018. }
  10019. }
  10020. this._setOptions( options );
  10021. return this;
  10022. },
  10023. _setOptions: function( options ) {
  10024. var key;
  10025. for ( key in options ) {
  10026. this._setOption( key, options[ key ] );
  10027. }
  10028. return this;
  10029. },
  10030. _setOption: function( key, value ) {
  10031. this.options[ key ] = value;
  10032. if ( key === "disabled" ) {
  10033. this.widget()
  10034. .toggleClass( this.widgetFullName + "-disabled", !!value );
  10035. // If the widget is becoming disabled, then nothing is interactive
  10036. if ( value ) {
  10037. this.hoverable.removeClass( "ui-state-hover" );
  10038. this.focusable.removeClass( "ui-state-focus" );
  10039. }
  10040. }
  10041. return this;
  10042. },
  10043. enable: function() {
  10044. return this._setOptions({ disabled: false });
  10045. },
  10046. disable: function() {
  10047. return this._setOptions({ disabled: true });
  10048. },
  10049. _on: function( suppressDisabledCheck, element, handlers ) {
  10050. var delegateElement,
  10051. instance = this;
  10052. // no suppressDisabledCheck flag, shuffle arguments
  10053. if ( typeof suppressDisabledCheck !== "boolean" ) {
  10054. handlers = element;
  10055. element = suppressDisabledCheck;
  10056. suppressDisabledCheck = false;
  10057. }
  10058. // no element argument, shuffle and use this.element
  10059. if ( !handlers ) {
  10060. handlers = element;
  10061. element = this.element;
  10062. delegateElement = this.widget();
  10063. } else {
  10064. element = delegateElement = $( element );
  10065. this.bindings = this.bindings.add( element );
  10066. }
  10067. $.each( handlers, function( event, handler ) {
  10068. function handlerProxy() {
  10069. // allow widgets to customize the disabled handling
  10070. // - disabled as an array instead of boolean
  10071. // - disabled class as method for disabling individual parts
  10072. if ( !suppressDisabledCheck &&
  10073. ( instance.options.disabled === true ||
  10074. $( this ).hasClass( "ui-state-disabled" ) ) ) {
  10075. return;
  10076. }
  10077. return ( typeof handler === "string" ? instance[ handler ] : handler )
  10078. .apply( instance, arguments );
  10079. }
  10080. // copy the guid so direct unbinding works
  10081. if ( typeof handler !== "string" ) {
  10082. handlerProxy.guid = handler.guid =
  10083. handler.guid || handlerProxy.guid || $.guid++;
  10084. }
  10085. var match = event.match( /^([\w:-]*)\s*(.*)$/ ),
  10086. eventName = match[1] + instance.eventNamespace,
  10087. selector = match[2];
  10088. if ( selector ) {
  10089. delegateElement.delegate( selector, eventName, handlerProxy );
  10090. } else {
  10091. element.bind( eventName, handlerProxy );
  10092. }
  10093. });
  10094. },
  10095. _off: function( element, eventName ) {
  10096. eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) +
  10097. this.eventNamespace;
  10098. element.unbind( eventName ).undelegate( eventName );
  10099. // Clear the stack to avoid memory leaks (#10056)
  10100. this.bindings = $( this.bindings.not( element ).get() );
  10101. this.focusable = $( this.focusable.not( element ).get() );
  10102. this.hoverable = $( this.hoverable.not( element ).get() );
  10103. },
  10104. _delay: function( handler, delay ) {
  10105. function handlerProxy() {
  10106. return ( typeof handler === "string" ? instance[ handler ] : handler )
  10107. .apply( instance, arguments );
  10108. }
  10109. var instance = this;
  10110. return setTimeout( handlerProxy, delay || 0 );
  10111. },
  10112. _hoverable: function( element ) {
  10113. this.hoverable = this.hoverable.add( element );
  10114. this._on( element, {
  10115. mouseenter: function( event ) {
  10116. $( event.currentTarget ).addClass( "ui-state-hover" );
  10117. },
  10118. mouseleave: function( event ) {
  10119. $( event.currentTarget ).removeClass( "ui-state-hover" );
  10120. }
  10121. });
  10122. },
  10123. _focusable: function( element ) {
  10124. this.focusable = this.focusable.add( element );
  10125. this._on( element, {
  10126. focusin: function( event ) {
  10127. $( event.currentTarget ).addClass( "ui-state-focus" );
  10128. },
  10129. focusout: function( event ) {
  10130. $( event.currentTarget ).removeClass( "ui-state-focus" );
  10131. }
  10132. });
  10133. },
  10134. _trigger: function( type, event, data ) {
  10135. var prop, orig,
  10136. callback = this.options[ type ];
  10137. data = data || {};
  10138. event = $.Event( event );
  10139. event.type = ( type === this.widgetEventPrefix ?
  10140. type :
  10141. this.widgetEventPrefix + type ).toLowerCase();
  10142. // the original event may come from any element
  10143. // so we need to reset the target on the new event
  10144. event.target = this.element[ 0 ];
  10145. // copy original event properties over to the new event
  10146. orig = event.originalEvent;
  10147. if ( orig ) {
  10148. for ( prop in orig ) {
  10149. if ( !( prop in event ) ) {
  10150. event[ prop ] = orig[ prop ];
  10151. }
  10152. }
  10153. }
  10154. this.element.trigger( event, data );
  10155. return !( $.isFunction( callback ) &&
  10156. callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
  10157. event.isDefaultPrevented() );
  10158. }
  10159. };
  10160. $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
  10161. $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
  10162. if ( typeof options === "string" ) {
  10163. options = { effect: options };
  10164. }
  10165. var hasOptions,
  10166. effectName = !options ?
  10167. method :
  10168. options === true || typeof options === "number" ?
  10169. defaultEffect :
  10170. options.effect || defaultEffect;
  10171. options = options || {};
  10172. if ( typeof options === "number" ) {
  10173. options = { duration: options };
  10174. }
  10175. hasOptions = !$.isEmptyObject( options );
  10176. options.complete = callback;
  10177. if ( options.delay ) {
  10178. element.delay( options.delay );
  10179. }
  10180. if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
  10181. element[ method ]( options );
  10182. } else if ( effectName !== method && element[ effectName ] ) {
  10183. element[ effectName ]( options.duration, options.easing, callback );
  10184. } else {
  10185. element.queue(function( next ) {
  10186. $( this )[ method ]();
  10187. if ( callback ) {
  10188. callback.call( element[ 0 ] );
  10189. }
  10190. next();
  10191. });
  10192. }
  10193. };
  10194. });
  10195. var widget = $.widget;
  10196. /*!
  10197. * jQuery UI Mouse 1.11.4
  10198. * http://jqueryui.com
  10199. *
  10200. * Copyright jQuery Foundation and other contributors
  10201. * Released under the MIT license.
  10202. * http://jquery.org/license
  10203. *
  10204. * http://api.jqueryui.com/mouse/
  10205. */
  10206. var mouseHandled = false;
  10207. $( document ).mouseup( function() {
  10208. mouseHandled = false;
  10209. });
  10210. var mouse = $.widget("ui.mouse", {
  10211. version: "1.11.4",
  10212. options: {
  10213. cancel: "input,textarea,button,select,option",
  10214. distance: 1,
  10215. delay: 0
  10216. },
  10217. _mouseInit: function() {
  10218. var that = this;
  10219. this.element
  10220. .bind("mousedown." + this.widgetName, function(event) {
  10221. return that._mouseDown(event);
  10222. })
  10223. .bind("click." + this.widgetName, function(event) {
  10224. if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
  10225. $.removeData(event.target, that.widgetName + ".preventClickEvent");
  10226. event.stopImmediatePropagation();
  10227. return false;
  10228. }
  10229. });
  10230. this.started = false;
  10231. },
  10232. // TODO: make sure destroying one instance of mouse doesn't mess with
  10233. // other instances of mouse
  10234. _mouseDestroy: function() {
  10235. this.element.unbind("." + this.widgetName);
  10236. if ( this._mouseMoveDelegate ) {
  10237. this.document
  10238. .unbind("mousemove." + this.widgetName, this._mouseMoveDelegate)
  10239. .unbind("mouseup." + this.widgetName, this._mouseUpDelegate);
  10240. }
  10241. },
  10242. _mouseDown: function(event) {
  10243. // don't let more than one widget handle mouseStart
  10244. if ( mouseHandled ) {
  10245. return;
  10246. }
  10247. this._mouseMoved = false;
  10248. // we may have missed mouseup (out of window)
  10249. (this._mouseStarted && this._mouseUp(event));
  10250. this._mouseDownEvent = event;
  10251. var that = this,
  10252. btnIsLeft = (event.which === 1),
  10253. // event.target.nodeName works around a bug in IE 8 with
  10254. // disabled inputs (#7620)
  10255. elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
  10256. if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
  10257. return true;
  10258. }
  10259. this.mouseDelayMet = !this.options.delay;
  10260. if (!this.mouseDelayMet) {
  10261. this._mouseDelayTimer = setTimeout(function() {
  10262. that.mouseDelayMet = true;
  10263. }, this.options.delay);
  10264. }
  10265. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  10266. this._mouseStarted = (this._mouseStart(event) !== false);
  10267. if (!this._mouseStarted) {
  10268. event.preventDefault();
  10269. return true;
  10270. }
  10271. }
  10272. // Click event may never have fired (Gecko & Opera)
  10273. if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
  10274. $.removeData(event.target, this.widgetName + ".preventClickEvent");
  10275. }
  10276. // these delegates are required to keep context
  10277. this._mouseMoveDelegate = function(event) {
  10278. return that._mouseMove(event);
  10279. };
  10280. this._mouseUpDelegate = function(event) {
  10281. return that._mouseUp(event);
  10282. };
  10283. this.document
  10284. .bind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
  10285. .bind( "mouseup." + this.widgetName, this._mouseUpDelegate );
  10286. event.preventDefault();
  10287. mouseHandled = true;
  10288. return true;
  10289. },
  10290. _mouseMove: function(event) {
  10291. // Only check for mouseups outside the document if you've moved inside the document
  10292. // at least once. This prevents the firing of mouseup in the case of IE<9, which will
  10293. // fire a mousemove event if content is placed under the cursor. See #7778
  10294. // Support: IE <9
  10295. if ( this._mouseMoved ) {
  10296. // IE mouseup check - mouseup happened when mouse was out of window
  10297. if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) {
  10298. return this._mouseUp(event);
  10299. // Iframe mouseup check - mouseup occurred in another document
  10300. } else if ( !event.which ) {
  10301. return this._mouseUp( event );
  10302. }
  10303. }
  10304. if ( event.which || event.button ) {
  10305. this._mouseMoved = true;
  10306. }
  10307. if (this._mouseStarted) {
  10308. this._mouseDrag(event);
  10309. return event.preventDefault();
  10310. }
  10311. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  10312. this._mouseStarted =
  10313. (this._mouseStart(this._mouseDownEvent, event) !== false);
  10314. (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
  10315. }
  10316. return !this._mouseStarted;
  10317. },
  10318. _mouseUp: function(event) {
  10319. this.document
  10320. .unbind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
  10321. .unbind( "mouseup." + this.widgetName, this._mouseUpDelegate );
  10322. if (this._mouseStarted) {
  10323. this._mouseStarted = false;
  10324. if (event.target === this._mouseDownEvent.target) {
  10325. $.data(event.target, this.widgetName + ".preventClickEvent", true);
  10326. }
  10327. this._mouseStop(event);
  10328. }
  10329. mouseHandled = false;
  10330. return false;
  10331. },
  10332. _mouseDistanceMet: function(event) {
  10333. return (Math.max(
  10334. Math.abs(this._mouseDownEvent.pageX - event.pageX),
  10335. Math.abs(this._mouseDownEvent.pageY - event.pageY)
  10336. ) >= this.options.distance
  10337. );
  10338. },
  10339. _mouseDelayMet: function(/* event */) {
  10340. return this.mouseDelayMet;
  10341. },
  10342. // These are placeholder methods, to be overriden by extending plugin
  10343. _mouseStart: function(/* event */) {},
  10344. _mouseDrag: function(/* event */) {},
  10345. _mouseStop: function(/* event */) {},
  10346. _mouseCapture: function(/* event */) { return true; }
  10347. });
  10348. /*!
  10349. * jQuery UI Draggable 1.11.4
  10350. * http://jqueryui.com
  10351. *
  10352. * Copyright jQuery Foundation and other contributors
  10353. * Released under the MIT license.
  10354. * http://jquery.org/license
  10355. *
  10356. * http://api.jqueryui.com/draggable/
  10357. */
  10358. $.widget("ui.draggable", $.ui.mouse, {
  10359. version: "1.11.4",
  10360. widgetEventPrefix: "drag",
  10361. options: {
  10362. addClasses: true,
  10363. appendTo: "parent",
  10364. axis: false,
  10365. connectToSortable: false,
  10366. containment: false,
  10367. cursor: "auto",
  10368. cursorAt: false,
  10369. grid: false,
  10370. handle: false,
  10371. helper: "original",
  10372. iframeFix: false,
  10373. opacity: false,
  10374. refreshPositions: false,
  10375. revert: false,
  10376. revertDuration: 500,
  10377. scope: "default",
  10378. scroll: true,
  10379. scrollSensitivity: 20,
  10380. scrollSpeed: 20,
  10381. snap: false,
  10382. snapMode: "both",
  10383. snapTolerance: 20,
  10384. stack: false,
  10385. zIndex: false,
  10386. // callbacks
  10387. drag: null,
  10388. start: null,
  10389. stop: null
  10390. },
  10391. _create: function() {
  10392. if ( this.options.helper === "original" ) {
  10393. this._setPositionRelative();
  10394. }
  10395. if (this.options.addClasses){
  10396. this.element.addClass("ui-draggable");
  10397. }
  10398. if (this.options.disabled){
  10399. this.element.addClass("ui-draggable-disabled");
  10400. }
  10401. this._setHandleClassName();
  10402. this._mouseInit();
  10403. },
  10404. _setOption: function( key, value ) {
  10405. this._super( key, value );
  10406. if ( key === "handle" ) {
  10407. this._removeHandleClassName();
  10408. this._setHandleClassName();
  10409. }
  10410. },
  10411. _destroy: function() {
  10412. if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) {
  10413. this.destroyOnClear = true;
  10414. return;
  10415. }
  10416. this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" );
  10417. this._removeHandleClassName();
  10418. this._mouseDestroy();
  10419. },
  10420. _mouseCapture: function(event) {
  10421. var o = this.options;
  10422. this._blurActiveElement( event );
  10423. // among others, prevent a drag on a resizable-handle
  10424. if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) {
  10425. return false;
  10426. }
  10427. //Quit if we're not on a valid handle
  10428. this.handle = this._getHandle(event);
  10429. if (!this.handle) {
  10430. return false;
  10431. }
  10432. this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix );
  10433. return true;
  10434. },
  10435. _blockFrames: function( selector ) {
  10436. this.iframeBlocks = this.document.find( selector ).map(function() {
  10437. var iframe = $( this );
  10438. return $( "<div>" )
  10439. .css( "position", "absolute" )
  10440. .appendTo( iframe.parent() )
  10441. .outerWidth( iframe.outerWidth() )
  10442. .outerHeight( iframe.outerHeight() )
  10443. .offset( iframe.offset() )[ 0 ];
  10444. });
  10445. },
  10446. _unblockFrames: function() {
  10447. if ( this.iframeBlocks ) {
  10448. this.iframeBlocks.remove();
  10449. delete this.iframeBlocks;
  10450. }
  10451. },
  10452. _blurActiveElement: function( event ) {
  10453. var document = this.document[ 0 ];
  10454. // Only need to blur if the event occurred on the draggable itself, see #10527
  10455. if ( !this.handleElement.is( event.target ) ) {
  10456. return;
  10457. }
  10458. // support: IE9
  10459. // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
  10460. try {
  10461. // Support: IE9, IE10
  10462. // If the <body> is blurred, IE will switch windows, see #9520
  10463. if ( document.activeElement && document.activeElement.nodeName.toLowerCase() !== "body" ) {
  10464. // Blur any element that currently has focus, see #4261
  10465. $( document.activeElement ).blur();
  10466. }
  10467. } catch ( error ) {}
  10468. },
  10469. _mouseStart: function(event) {
  10470. var o = this.options;
  10471. //Create and append the visible helper
  10472. this.helper = this._createHelper(event);
  10473. this.helper.addClass("ui-draggable-dragging");
  10474. //Cache the helper size
  10475. this._cacheHelperProportions();
  10476. //If ddmanager is used for droppables, set the global draggable
  10477. if ($.ui.ddmanager) {
  10478. $.ui.ddmanager.current = this;
  10479. }
  10480. /*
  10481. * - Position generation -
  10482. * This block generates everything position related - it's the core of draggables.
  10483. */
  10484. //Cache the margins of the original element
  10485. this._cacheMargins();
  10486. //Store the helper's css position
  10487. this.cssPosition = this.helper.css( "position" );
  10488. this.scrollParent = this.helper.scrollParent( true );
  10489. this.offsetParent = this.helper.offsetParent();
  10490. this.hasFixedAncestor = this.helper.parents().filter(function() {
  10491. return $( this ).css( "position" ) === "fixed";
  10492. }).length > 0;
  10493. //The element's absolute position on the page minus margins
  10494. this.positionAbs = this.element.offset();
  10495. this._refreshOffsets( event );
  10496. //Generate the original position
  10497. this.originalPosition = this.position = this._generatePosition( event, false );
  10498. this.originalPageX = event.pageX;
  10499. this.originalPageY = event.pageY;
  10500. //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
  10501. (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
  10502. //Set a containment if given in the options
  10503. this._setContainment();
  10504. //Trigger event + callbacks
  10505. if (this._trigger("start", event) === false) {
  10506. this._clear();
  10507. return false;
  10508. }
  10509. //Recache the helper size
  10510. this._cacheHelperProportions();
  10511. //Prepare the droppable offsets
  10512. if ($.ui.ddmanager && !o.dropBehaviour) {
  10513. $.ui.ddmanager.prepareOffsets(this, event);
  10514. }
  10515. // Reset helper's right/bottom css if they're set and set explicit width/height instead
  10516. // as this prevents resizing of elements with right/bottom set (see #7772)
  10517. this._normalizeRightBottom();
  10518. this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
  10519. //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
  10520. if ( $.ui.ddmanager ) {
  10521. $.ui.ddmanager.dragStart(this, event);
  10522. }
  10523. return true;
  10524. },
  10525. _refreshOffsets: function( event ) {
  10526. this.offset = {
  10527. top: this.positionAbs.top - this.margins.top,
  10528. left: this.positionAbs.left - this.margins.left,
  10529. scroll: false,
  10530. parent: this._getParentOffset(),
  10531. relative: this._getRelativeOffset()
  10532. };
  10533. this.offset.click = {
  10534. left: event.pageX - this.offset.left,
  10535. top: event.pageY - this.offset.top
  10536. };
  10537. },
  10538. _mouseDrag: function(event, noPropagation) {
  10539. // reset any necessary cached properties (see #5009)
  10540. if ( this.hasFixedAncestor ) {
  10541. this.offset.parent = this._getParentOffset();
  10542. }
  10543. //Compute the helpers position
  10544. this.position = this._generatePosition( event, true );
  10545. this.positionAbs = this._convertPositionTo("absolute");
  10546. //Call plugins and callbacks and use the resulting position if something is returned
  10547. if (!noPropagation) {
  10548. var ui = this._uiHash();
  10549. if (this._trigger("drag", event, ui) === false) {
  10550. this._mouseUp({});
  10551. return false;
  10552. }
  10553. this.position = ui.position;
  10554. }
  10555. this.helper[ 0 ].style.left = this.position.left + "px";
  10556. this.helper[ 0 ].style.top = this.position.top + "px";
  10557. if ($.ui.ddmanager) {
  10558. $.ui.ddmanager.drag(this, event);
  10559. }
  10560. return false;
  10561. },
  10562. _mouseStop: function(event) {
  10563. //If we are using droppables, inform the manager about the drop
  10564. var that = this,
  10565. dropped = false;
  10566. if ($.ui.ddmanager && !this.options.dropBehaviour) {
  10567. dropped = $.ui.ddmanager.drop(this, event);
  10568. }
  10569. //if a drop comes from outside (a sortable)
  10570. if (this.dropped) {
  10571. dropped = this.dropped;
  10572. this.dropped = false;
  10573. }
  10574. if ((this.options.revert === "invalid" && !dropped) || (this.options.revert === "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
  10575. $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
  10576. if (that._trigger("stop", event) !== false) {
  10577. that._clear();
  10578. }
  10579. });
  10580. } else {
  10581. if (this._trigger("stop", event) !== false) {
  10582. this._clear();
  10583. }
  10584. }
  10585. return false;
  10586. },
  10587. _mouseUp: function( event ) {
  10588. this._unblockFrames();
  10589. //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
  10590. if ( $.ui.ddmanager ) {
  10591. $.ui.ddmanager.dragStop(this, event);
  10592. }
  10593. // Only need to focus if the event occurred on the draggable itself, see #10527
  10594. if ( this.handleElement.is( event.target ) ) {
  10595. // The interaction is over; whether or not the click resulted in a drag, focus the element
  10596. this.element.focus();
  10597. }
  10598. return $.ui.mouse.prototype._mouseUp.call(this, event);
  10599. },
  10600. cancel: function() {
  10601. if (this.helper.is(".ui-draggable-dragging")) {
  10602. this._mouseUp({});
  10603. } else {
  10604. this._clear();
  10605. }
  10606. return this;
  10607. },
  10608. _getHandle: function(event) {
  10609. return this.options.handle ?
  10610. !!$( event.target ).closest( this.element.find( this.options.handle ) ).length :
  10611. true;
  10612. },
  10613. _setHandleClassName: function() {
  10614. this.handleElement = this.options.handle ?
  10615. this.element.find( this.options.handle ) : this.element;
  10616. this.handleElement.addClass( "ui-draggable-handle" );
  10617. },
  10618. _removeHandleClassName: function() {
  10619. this.handleElement.removeClass( "ui-draggable-handle" );
  10620. },
  10621. _createHelper: function(event) {
  10622. var o = this.options,
  10623. helperIsFunction = $.isFunction( o.helper ),
  10624. helper = helperIsFunction ?
  10625. $( o.helper.apply( this.element[ 0 ], [ event ] ) ) :
  10626. ( o.helper === "clone" ?
  10627. this.element.clone().removeAttr( "id" ) :
  10628. this.element );
  10629. if (!helper.parents("body").length) {
  10630. helper.appendTo((o.appendTo === "parent" ? this.element[0].parentNode : o.appendTo));
  10631. }
  10632. // http://bugs.jqueryui.com/ticket/9446
  10633. // a helper function can return the original element
  10634. // which wouldn't have been set to relative in _create
  10635. if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) {
  10636. this._setPositionRelative();
  10637. }
  10638. if (helper[0] !== this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) {
  10639. helper.css("position", "absolute");
  10640. }
  10641. return helper;
  10642. },
  10643. _setPositionRelative: function() {
  10644. if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) {
  10645. this.element[ 0 ].style.position = "relative";
  10646. }
  10647. },
  10648. _adjustOffsetFromHelper: function(obj) {
  10649. if (typeof obj === "string") {
  10650. obj = obj.split(" ");
  10651. }
  10652. if ($.isArray(obj)) {
  10653. obj = { left: +obj[0], top: +obj[1] || 0 };
  10654. }
  10655. if ("left" in obj) {
  10656. this.offset.click.left = obj.left + this.margins.left;
  10657. }
  10658. if ("right" in obj) {
  10659. this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  10660. }
  10661. if ("top" in obj) {
  10662. this.offset.click.top = obj.top + this.margins.top;
  10663. }
  10664. if ("bottom" in obj) {
  10665. this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  10666. }
  10667. },
  10668. _isRootNode: function( element ) {
  10669. return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ];
  10670. },
  10671. _getParentOffset: function() {
  10672. //Get the offsetParent and cache its position
  10673. var po = this.offsetParent.offset(),
  10674. document = this.document[ 0 ];
  10675. // This is a special case where we need to modify a offset calculated on start, since the following happened:
  10676. // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
  10677. // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
  10678. // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
  10679. if (this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
  10680. po.left += this.scrollParent.scrollLeft();
  10681. po.top += this.scrollParent.scrollTop();
  10682. }
  10683. if ( this._isRootNode( this.offsetParent[ 0 ] ) ) {
  10684. po = { top: 0, left: 0 };
  10685. }
  10686. return {
  10687. top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0),
  10688. left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0)
  10689. };
  10690. },
  10691. _getRelativeOffset: function() {
  10692. if ( this.cssPosition !== "relative" ) {
  10693. return { top: 0, left: 0 };
  10694. }
  10695. var p = this.element.position(),
  10696. scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
  10697. return {
  10698. top: p.top - ( parseInt(this.helper.css( "top" ), 10) || 0 ) + ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ),
  10699. left: p.left - ( parseInt(this.helper.css( "left" ), 10) || 0 ) + ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 )
  10700. };
  10701. },
  10702. _cacheMargins: function() {
  10703. this.margins = {
  10704. left: (parseInt(this.element.css("marginLeft"), 10) || 0),
  10705. top: (parseInt(this.element.css("marginTop"), 10) || 0),
  10706. right: (parseInt(this.element.css("marginRight"), 10) || 0),
  10707. bottom: (parseInt(this.element.css("marginBottom"), 10) || 0)
  10708. };
  10709. },
  10710. _cacheHelperProportions: function() {
  10711. this.helperProportions = {
  10712. width: this.helper.outerWidth(),
  10713. height: this.helper.outerHeight()
  10714. };
  10715. },
  10716. _setContainment: function() {
  10717. var isUserScrollable, c, ce,
  10718. o = this.options,
  10719. document = this.document[ 0 ];
  10720. this.relativeContainer = null;
  10721. if ( !o.containment ) {
  10722. this.containment = null;
  10723. return;
  10724. }
  10725. if ( o.containment === "window" ) {
  10726. this.containment = [
  10727. $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
  10728. $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top,
  10729. $( window ).scrollLeft() + $( window ).width() - this.helperProportions.width - this.margins.left,
  10730. $( window ).scrollTop() + ( $( window ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top
  10731. ];
  10732. return;
  10733. }
  10734. if ( o.containment === "document") {
  10735. this.containment = [
  10736. 0,
  10737. 0,
  10738. $( document ).width() - this.helperProportions.width - this.margins.left,
  10739. ( $( document ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top
  10740. ];
  10741. return;
  10742. }
  10743. if ( o.containment.constructor === Array ) {
  10744. this.containment = o.containment;
  10745. return;
  10746. }
  10747. if ( o.containment === "parent" ) {
  10748. o.containment = this.helper[ 0 ].parentNode;
  10749. }
  10750. c = $( o.containment );
  10751. ce = c[ 0 ];
  10752. if ( !ce ) {
  10753. return;
  10754. }
  10755. isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) );
  10756. this.containment = [
  10757. ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ),
  10758. ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ),
  10759. ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
  10760. ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) -
  10761. ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) -
  10762. this.helperProportions.width -
  10763. this.margins.left -
  10764. this.margins.right,
  10765. ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
  10766. ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) -
  10767. ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) -
  10768. this.helperProportions.height -
  10769. this.margins.top -
  10770. this.margins.bottom
  10771. ];
  10772. this.relativeContainer = c;
  10773. },
  10774. _convertPositionTo: function(d, pos) {
  10775. if (!pos) {
  10776. pos = this.position;
  10777. }
  10778. var mod = d === "absolute" ? 1 : -1,
  10779. scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
  10780. return {
  10781. top: (
  10782. pos.top + // The absolute mouse position
  10783. this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
  10784. this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border)
  10785. ( ( this.cssPosition === "fixed" ? -this.offset.scroll.top : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod)
  10786. ),
  10787. left: (
  10788. pos.left + // The absolute mouse position
  10789. this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
  10790. this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border)
  10791. ( ( this.cssPosition === "fixed" ? -this.offset.scroll.left : ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod)
  10792. )
  10793. };
  10794. },
  10795. _generatePosition: function( event, constrainPosition ) {
  10796. var containment, co, top, left,
  10797. o = this.options,
  10798. scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ),
  10799. pageX = event.pageX,
  10800. pageY = event.pageY;
  10801. // Cache the scroll
  10802. if ( !scrollIsRootNode || !this.offset.scroll ) {
  10803. this.offset.scroll = {
  10804. top: this.scrollParent.scrollTop(),
  10805. left: this.scrollParent.scrollLeft()
  10806. };
  10807. }
  10808. /*
  10809. * - Position constraining -
  10810. * Constrain the position to a mix of grid, containment.
  10811. */
  10812. // If we are not dragging yet, we won't check for options
  10813. if ( constrainPosition ) {
  10814. if ( this.containment ) {
  10815. if ( this.relativeContainer ){
  10816. co = this.relativeContainer.offset();
  10817. containment = [
  10818. this.containment[ 0 ] + co.left,
  10819. this.containment[ 1 ] + co.top,
  10820. this.containment[ 2 ] + co.left,
  10821. this.containment[ 3 ] + co.top
  10822. ];
  10823. } else {
  10824. containment = this.containment;
  10825. }
  10826. if (event.pageX - this.offset.click.left < containment[0]) {
  10827. pageX = containment[0] + this.offset.click.left;
  10828. }
  10829. if (event.pageY - this.offset.click.top < containment[1]) {
  10830. pageY = containment[1] + this.offset.click.top;
  10831. }
  10832. if (event.pageX - this.offset.click.left > containment[2]) {
  10833. pageX = containment[2] + this.offset.click.left;
  10834. }
  10835. if (event.pageY - this.offset.click.top > containment[3]) {
  10836. pageY = containment[3] + this.offset.click.top;
  10837. }
  10838. }
  10839. if (o.grid) {
  10840. //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
  10841. top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
  10842. pageY = containment ? ((top - this.offset.click.top >= containment[1] || top - this.offset.click.top > containment[3]) ? top : ((top - this.offset.click.top >= containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
  10843. left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
  10844. pageX = containment ? ((left - this.offset.click.left >= containment[0] || left - this.offset.click.left > containment[2]) ? left : ((left - this.offset.click.left >= containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
  10845. }
  10846. if ( o.axis === "y" ) {
  10847. pageX = this.originalPageX;
  10848. }
  10849. if ( o.axis === "x" ) {
  10850. pageY = this.originalPageY;
  10851. }
  10852. }
  10853. return {
  10854. top: (
  10855. pageY - // The absolute mouse position
  10856. this.offset.click.top - // Click offset (relative to the element)
  10857. this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent
  10858. this.offset.parent.top + // The offsetParent's offset without borders (offset + border)
  10859. ( this.cssPosition === "fixed" ? -this.offset.scroll.top : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) )
  10860. ),
  10861. left: (
  10862. pageX - // The absolute mouse position
  10863. this.offset.click.left - // Click offset (relative to the element)
  10864. this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent
  10865. this.offset.parent.left + // The offsetParent's offset without borders (offset + border)
  10866. ( this.cssPosition === "fixed" ? -this.offset.scroll.left : ( scrollIsRootNode ? 0 : this.offset.scroll.left ) )
  10867. )
  10868. };
  10869. },
  10870. _clear: function() {
  10871. this.helper.removeClass("ui-draggable-dragging");
  10872. if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) {
  10873. this.helper.remove();
  10874. }
  10875. this.helper = null;
  10876. this.cancelHelperRemoval = false;
  10877. if ( this.destroyOnClear ) {
  10878. this.destroy();
  10879. }
  10880. },
  10881. _normalizeRightBottom: function() {
  10882. if ( this.options.axis !== "y" && this.helper.css( "right" ) !== "auto" ) {
  10883. this.helper.width( this.helper.width() );
  10884. this.helper.css( "right", "auto" );
  10885. }
  10886. if ( this.options.axis !== "x" && this.helper.css( "bottom" ) !== "auto" ) {
  10887. this.helper.height( this.helper.height() );
  10888. this.helper.css( "bottom", "auto" );
  10889. }
  10890. },
  10891. // From now on bulk stuff - mainly helpers
  10892. _trigger: function( type, event, ui ) {
  10893. ui = ui || this._uiHash();
  10894. $.ui.plugin.call( this, type, [ event, ui, this ], true );
  10895. // Absolute position and offset (see #6884 ) have to be recalculated after plugins
  10896. if ( /^(drag|start|stop)/.test( type ) ) {
  10897. this.positionAbs = this._convertPositionTo( "absolute" );
  10898. ui.offset = this.positionAbs;
  10899. }
  10900. return $.Widget.prototype._trigger.call( this, type, event, ui );
  10901. },
  10902. plugins: {},
  10903. _uiHash: function() {
  10904. return {
  10905. helper: this.helper,
  10906. position: this.position,
  10907. originalPosition: this.originalPosition,
  10908. offset: this.positionAbs
  10909. };
  10910. }
  10911. });
  10912. $.ui.plugin.add( "draggable", "connectToSortable", {
  10913. start: function( event, ui, draggable ) {
  10914. var uiSortable = $.extend( {}, ui, {
  10915. item: draggable.element
  10916. });
  10917. draggable.sortables = [];
  10918. $( draggable.options.connectToSortable ).each(function() {
  10919. var sortable = $( this ).sortable( "instance" );
  10920. if ( sortable && !sortable.options.disabled ) {
  10921. draggable.sortables.push( sortable );
  10922. // refreshPositions is called at drag start to refresh the containerCache
  10923. // which is used in drag. This ensures it's initialized and synchronized
  10924. // with any changes that might have happened on the page since initialization.
  10925. sortable.refreshPositions();
  10926. sortable._trigger("activate", event, uiSortable);
  10927. }
  10928. });
  10929. },
  10930. stop: function( event, ui, draggable ) {
  10931. var uiSortable = $.extend( {}, ui, {
  10932. item: draggable.element
  10933. });
  10934. draggable.cancelHelperRemoval = false;
  10935. $.each( draggable.sortables, function() {
  10936. var sortable = this;
  10937. if ( sortable.isOver ) {
  10938. sortable.isOver = 0;
  10939. // Allow this sortable to handle removing the helper
  10940. draggable.cancelHelperRemoval = true;
  10941. sortable.cancelHelperRemoval = false;
  10942. // Use _storedCSS To restore properties in the sortable,
  10943. // as this also handles revert (#9675) since the draggable
  10944. // may have modified them in unexpected ways (#8809)
  10945. sortable._storedCSS = {
  10946. position: sortable.placeholder.css( "position" ),
  10947. top: sortable.placeholder.css( "top" ),
  10948. left: sortable.placeholder.css( "left" )
  10949. };
  10950. sortable._mouseStop(event);
  10951. // Once drag has ended, the sortable should return to using
  10952. // its original helper, not the shared helper from draggable
  10953. sortable.options.helper = sortable.options._helper;
  10954. } else {
  10955. // Prevent this Sortable from removing the helper.
  10956. // However, don't set the draggable to remove the helper
  10957. // either as another connected Sortable may yet handle the removal.
  10958. sortable.cancelHelperRemoval = true;
  10959. sortable._trigger( "deactivate", event, uiSortable );
  10960. }
  10961. });
  10962. },
  10963. drag: function( event, ui, draggable ) {
  10964. $.each( draggable.sortables, function() {
  10965. var innermostIntersecting = false,
  10966. sortable = this;
  10967. // Copy over variables that sortable's _intersectsWith uses
  10968. sortable.positionAbs = draggable.positionAbs;
  10969. sortable.helperProportions = draggable.helperProportions;
  10970. sortable.offset.click = draggable.offset.click;
  10971. if ( sortable._intersectsWith( sortable.containerCache ) ) {
  10972. innermostIntersecting = true;
  10973. $.each( draggable.sortables, function() {
  10974. // Copy over variables that sortable's _intersectsWith uses
  10975. this.positionAbs = draggable.positionAbs;
  10976. this.helperProportions = draggable.helperProportions;
  10977. this.offset.click = draggable.offset.click;
  10978. if ( this !== sortable &&
  10979. this._intersectsWith( this.containerCache ) &&
  10980. $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) {
  10981. innermostIntersecting = false;
  10982. }
  10983. return innermostIntersecting;
  10984. });
  10985. }
  10986. if ( innermostIntersecting ) {
  10987. // If it intersects, we use a little isOver variable and set it once,
  10988. // so that the move-in stuff gets fired only once.
  10989. if ( !sortable.isOver ) {
  10990. sortable.isOver = 1;
  10991. // Store draggable's parent in case we need to reappend to it later.
  10992. draggable._parent = ui.helper.parent();
  10993. sortable.currentItem = ui.helper
  10994. .appendTo( sortable.element )
  10995. .data( "ui-sortable-item", true );
  10996. // Store helper option to later restore it
  10997. sortable.options._helper = sortable.options.helper;
  10998. sortable.options.helper = function() {
  10999. return ui.helper[ 0 ];
  11000. };
  11001. // Fire the start events of the sortable with our passed browser event,
  11002. // and our own helper (so it doesn't create a new one)
  11003. event.target = sortable.currentItem[ 0 ];
  11004. sortable._mouseCapture( event, true );
  11005. sortable._mouseStart( event, true, true );
  11006. // Because the browser event is way off the new appended portlet,
  11007. // modify necessary variables to reflect the changes
  11008. sortable.offset.click.top = draggable.offset.click.top;
  11009. sortable.offset.click.left = draggable.offset.click.left;
  11010. sortable.offset.parent.left -= draggable.offset.parent.left -
  11011. sortable.offset.parent.left;
  11012. sortable.offset.parent.top -= draggable.offset.parent.top -
  11013. sortable.offset.parent.top;
  11014. draggable._trigger( "toSortable", event );
  11015. // Inform draggable that the helper is in a valid drop zone,
  11016. // used solely in the revert option to handle "valid/invalid".
  11017. draggable.dropped = sortable.element;
  11018. // Need to refreshPositions of all sortables in the case that
  11019. // adding to one sortable changes the location of the other sortables (#9675)
  11020. $.each( draggable.sortables, function() {
  11021. this.refreshPositions();
  11022. });
  11023. // hack so receive/update callbacks work (mostly)
  11024. draggable.currentItem = draggable.element;
  11025. sortable.fromOutside = draggable;
  11026. }
  11027. if ( sortable.currentItem ) {
  11028. sortable._mouseDrag( event );
  11029. // Copy the sortable's position because the draggable's can potentially reflect
  11030. // a relative position, while sortable is always absolute, which the dragged
  11031. // element has now become. (#8809)
  11032. ui.position = sortable.position;
  11033. }
  11034. } else {
  11035. // If it doesn't intersect with the sortable, and it intersected before,
  11036. // we fake the drag stop of the sortable, but make sure it doesn't remove
  11037. // the helper by using cancelHelperRemoval.
  11038. if ( sortable.isOver ) {
  11039. sortable.isOver = 0;
  11040. sortable.cancelHelperRemoval = true;
  11041. // Calling sortable's mouseStop would trigger a revert,
  11042. // so revert must be temporarily false until after mouseStop is called.
  11043. sortable.options._revert = sortable.options.revert;
  11044. sortable.options.revert = false;
  11045. sortable._trigger( "out", event, sortable._uiHash( sortable ) );
  11046. sortable._mouseStop( event, true );
  11047. // restore sortable behaviors that were modfied
  11048. // when the draggable entered the sortable area (#9481)
  11049. sortable.options.revert = sortable.options._revert;
  11050. sortable.options.helper = sortable.options._helper;
  11051. if ( sortable.placeholder ) {
  11052. sortable.placeholder.remove();
  11053. }
  11054. // Restore and recalculate the draggable's offset considering the sortable
  11055. // may have modified them in unexpected ways. (#8809, #10669)
  11056. ui.helper.appendTo( draggable._parent );
  11057. draggable._refreshOffsets( event );
  11058. ui.position = draggable._generatePosition( event, true );
  11059. draggable._trigger( "fromSortable", event );
  11060. // Inform draggable that the helper is no longer in a valid drop zone
  11061. draggable.dropped = false;
  11062. // Need to refreshPositions of all sortables just in case removing
  11063. // from one sortable changes the location of other sortables (#9675)
  11064. $.each( draggable.sortables, function() {
  11065. this.refreshPositions();
  11066. });
  11067. }
  11068. }
  11069. });
  11070. }
  11071. });
  11072. $.ui.plugin.add("draggable", "cursor", {
  11073. start: function( event, ui, instance ) {
  11074. var t = $( "body" ),
  11075. o = instance.options;
  11076. if (t.css("cursor")) {
  11077. o._cursor = t.css("cursor");
  11078. }
  11079. t.css("cursor", o.cursor);
  11080. },
  11081. stop: function( event, ui, instance ) {
  11082. var o = instance.options;
  11083. if (o._cursor) {
  11084. $("body").css("cursor", o._cursor);
  11085. }
  11086. }
  11087. });
  11088. $.ui.plugin.add("draggable", "opacity", {
  11089. start: function( event, ui, instance ) {
  11090. var t = $( ui.helper ),
  11091. o = instance.options;
  11092. if (t.css("opacity")) {
  11093. o._opacity = t.css("opacity");
  11094. }
  11095. t.css("opacity", o.opacity);
  11096. },
  11097. stop: function( event, ui, instance ) {
  11098. var o = instance.options;
  11099. if (o._opacity) {
  11100. $(ui.helper).css("opacity", o._opacity);
  11101. }
  11102. }
  11103. });
  11104. $.ui.plugin.add("draggable", "scroll", {
  11105. start: function( event, ui, i ) {
  11106. if ( !i.scrollParentNotHidden ) {
  11107. i.scrollParentNotHidden = i.helper.scrollParent( false );
  11108. }
  11109. if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] && i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) {
  11110. i.overflowOffset = i.scrollParentNotHidden.offset();
  11111. }
  11112. },
  11113. drag: function( event, ui, i ) {
  11114. var o = i.options,
  11115. scrolled = false,
  11116. scrollParent = i.scrollParentNotHidden[ 0 ],
  11117. document = i.document[ 0 ];
  11118. if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) {
  11119. if ( !o.axis || o.axis !== "x" ) {
  11120. if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY < o.scrollSensitivity ) {
  11121. scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed;
  11122. } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) {
  11123. scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed;
  11124. }
  11125. }
  11126. if ( !o.axis || o.axis !== "y" ) {
  11127. if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX < o.scrollSensitivity ) {
  11128. scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed;
  11129. } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) {
  11130. scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed;
  11131. }
  11132. }
  11133. } else {
  11134. if (!o.axis || o.axis !== "x") {
  11135. if (event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
  11136. scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
  11137. } else if ($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) {
  11138. scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
  11139. }
  11140. }
  11141. if (!o.axis || o.axis !== "y") {
  11142. if (event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
  11143. scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
  11144. } else if ($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {
  11145. scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
  11146. }
  11147. }
  11148. }
  11149. if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
  11150. $.ui.ddmanager.prepareOffsets(i, event);
  11151. }
  11152. }
  11153. });
  11154. $.ui.plugin.add("draggable", "snap", {
  11155. start: function( event, ui, i ) {
  11156. var o = i.options;
  11157. i.snapElements = [];
  11158. $(o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap).each(function() {
  11159. var $t = $(this),
  11160. $o = $t.offset();
  11161. if (this !== i.element[0]) {
  11162. i.snapElements.push({
  11163. item: this,
  11164. width: $t.outerWidth(), height: $t.outerHeight(),
  11165. top: $o.top, left: $o.left
  11166. });
  11167. }
  11168. });
  11169. },
  11170. drag: function( event, ui, inst ) {
  11171. var ts, bs, ls, rs, l, r, t, b, i, first,
  11172. o = inst.options,
  11173. d = o.snapTolerance,
  11174. x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
  11175. y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
  11176. for (i = inst.snapElements.length - 1; i >= 0; i--){
  11177. l = inst.snapElements[i].left - inst.margins.left;
  11178. r = l + inst.snapElements[i].width;
  11179. t = inst.snapElements[i].top - inst.margins.top;
  11180. b = t + inst.snapElements[i].height;
  11181. if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || !$.contains( inst.snapElements[ i ].item.ownerDocument, inst.snapElements[ i ].item ) ) {
  11182. if (inst.snapElements[i].snapping) {
  11183. (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
  11184. }
  11185. inst.snapElements[i].snapping = false;
  11186. continue;
  11187. }
  11188. if (o.snapMode !== "inner") {
  11189. ts = Math.abs(t - y2) <= d;
  11190. bs = Math.abs(b - y1) <= d;
  11191. ls = Math.abs(l - x2) <= d;
  11192. rs = Math.abs(r - x1) <= d;
  11193. if (ts) {
  11194. ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top;
  11195. }
  11196. if (bs) {
  11197. ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top;
  11198. }
  11199. if (ls) {
  11200. ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left;
  11201. }
  11202. if (rs) {
  11203. ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left;
  11204. }
  11205. }
  11206. first = (ts || bs || ls || rs);
  11207. if (o.snapMode !== "outer") {
  11208. ts = Math.abs(t - y1) <= d;
  11209. bs = Math.abs(b - y2) <= d;
  11210. ls = Math.abs(l - x1) <= d;
  11211. rs = Math.abs(r - x2) <= d;
  11212. if (ts) {
  11213. ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top;
  11214. }
  11215. if (bs) {
  11216. ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top;
  11217. }
  11218. if (ls) {
  11219. ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left;
  11220. }
  11221. if (rs) {
  11222. ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left;
  11223. }
  11224. }
  11225. if (!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) {
  11226. (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
  11227. }
  11228. inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
  11229. }
  11230. }
  11231. });
  11232. $.ui.plugin.add("draggable", "stack", {
  11233. start: function( event, ui, instance ) {
  11234. var min,
  11235. o = instance.options,
  11236. group = $.makeArray($(o.stack)).sort(function(a, b) {
  11237. return (parseInt($(a).css("zIndex"), 10) || 0) - (parseInt($(b).css("zIndex"), 10) || 0);
  11238. });
  11239. if (!group.length) { return; }
  11240. min = parseInt($(group[0]).css("zIndex"), 10) || 0;
  11241. $(group).each(function(i) {
  11242. $(this).css("zIndex", min + i);
  11243. });
  11244. this.css("zIndex", (min + group.length));
  11245. }
  11246. });
  11247. $.ui.plugin.add("draggable", "zIndex", {
  11248. start: function( event, ui, instance ) {
  11249. var t = $( ui.helper ),
  11250. o = instance.options;
  11251. if (t.css("zIndex")) {
  11252. o._zIndex = t.css("zIndex");
  11253. }
  11254. t.css("zIndex", o.zIndex);
  11255. },
  11256. stop: function( event, ui, instance ) {
  11257. var o = instance.options;
  11258. if (o._zIndex) {
  11259. $(ui.helper).css("zIndex", o._zIndex);
  11260. }
  11261. }
  11262. });
  11263. var draggable = $.ui.draggable;
  11264. /*!
  11265. * jQuery UI Droppable 1.11.4
  11266. * http://jqueryui.com
  11267. *
  11268. * Copyright jQuery Foundation and other contributors
  11269. * Released under the MIT license.
  11270. * http://jquery.org/license
  11271. *
  11272. * http://api.jqueryui.com/droppable/
  11273. */
  11274. $.widget( "ui.droppable", {
  11275. version: "1.11.4",
  11276. widgetEventPrefix: "drop",
  11277. options: {
  11278. accept: "*",
  11279. activeClass: false,
  11280. addClasses: true,
  11281. greedy: false,
  11282. hoverClass: false,
  11283. scope: "default",
  11284. tolerance: "intersect",
  11285. // callbacks
  11286. activate: null,
  11287. deactivate: null,
  11288. drop: null,
  11289. out: null,
  11290. over: null
  11291. },
  11292. _create: function() {
  11293. var proportions,
  11294. o = this.options,
  11295. accept = o.accept;
  11296. this.isover = false;
  11297. this.isout = true;
  11298. this.accept = $.isFunction( accept ) ? accept : function( d ) {
  11299. return d.is( accept );
  11300. };
  11301. this.proportions = function( /* valueToWrite */ ) {
  11302. if ( arguments.length ) {
  11303. // Store the droppable's proportions
  11304. proportions = arguments[ 0 ];
  11305. } else {
  11306. // Retrieve or derive the droppable's proportions
  11307. return proportions ?
  11308. proportions :
  11309. proportions = {
  11310. width: this.element[ 0 ].offsetWidth,
  11311. height: this.element[ 0 ].offsetHeight
  11312. };
  11313. }
  11314. };
  11315. this._addToManager( o.scope );
  11316. o.addClasses && this.element.addClass( "ui-droppable" );
  11317. },
  11318. _addToManager: function( scope ) {
  11319. // Add the reference and positions to the manager
  11320. $.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || [];
  11321. $.ui.ddmanager.droppables[ scope ].push( this );
  11322. },
  11323. _splice: function( drop ) {
  11324. var i = 0;
  11325. for ( ; i < drop.length; i++ ) {
  11326. if ( drop[ i ] === this ) {
  11327. drop.splice( i, 1 );
  11328. }
  11329. }
  11330. },
  11331. _destroy: function() {
  11332. var drop = $.ui.ddmanager.droppables[ this.options.scope ];
  11333. this._splice( drop );
  11334. this.element.removeClass( "ui-droppable ui-droppable-disabled" );
  11335. },
  11336. _setOption: function( key, value ) {
  11337. if ( key === "accept" ) {
  11338. this.accept = $.isFunction( value ) ? value : function( d ) {
  11339. return d.is( value );
  11340. };
  11341. } else if ( key === "scope" ) {
  11342. var drop = $.ui.ddmanager.droppables[ this.options.scope ];
  11343. this._splice( drop );
  11344. this._addToManager( value );
  11345. }
  11346. this._super( key, value );
  11347. },
  11348. _activate: function( event ) {
  11349. var draggable = $.ui.ddmanager.current;
  11350. if ( this.options.activeClass ) {
  11351. this.element.addClass( this.options.activeClass );
  11352. }
  11353. if ( draggable ){
  11354. this._trigger( "activate", event, this.ui( draggable ) );
  11355. }
  11356. },
  11357. _deactivate: function( event ) {
  11358. var draggable = $.ui.ddmanager.current;
  11359. if ( this.options.activeClass ) {
  11360. this.element.removeClass( this.options.activeClass );
  11361. }
  11362. if ( draggable ){
  11363. this._trigger( "deactivate", event, this.ui( draggable ) );
  11364. }
  11365. },
  11366. _over: function( event ) {
  11367. var draggable = $.ui.ddmanager.current;
  11368. // Bail if draggable and droppable are same element
  11369. if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
  11370. return;
  11371. }
  11372. if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
  11373. if ( this.options.hoverClass ) {
  11374. this.element.addClass( this.options.hoverClass );
  11375. }
  11376. this._trigger( "over", event, this.ui( draggable ) );
  11377. }
  11378. },
  11379. _out: function( event ) {
  11380. var draggable = $.ui.ddmanager.current;
  11381. // Bail if draggable and droppable are same element
  11382. if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
  11383. return;
  11384. }
  11385. if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
  11386. if ( this.options.hoverClass ) {
  11387. this.element.removeClass( this.options.hoverClass );
  11388. }
  11389. this._trigger( "out", event, this.ui( draggable ) );
  11390. }
  11391. },
  11392. _drop: function( event, custom ) {
  11393. var draggable = custom || $.ui.ddmanager.current,
  11394. childrenIntersection = false;
  11395. // Bail if draggable and droppable are same element
  11396. if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
  11397. return false;
  11398. }
  11399. this.element.find( ":data(ui-droppable)" ).not( ".ui-draggable-dragging" ).each(function() {
  11400. var inst = $( this ).droppable( "instance" );
  11401. if (
  11402. inst.options.greedy &&
  11403. !inst.options.disabled &&
  11404. inst.options.scope === draggable.options.scope &&
  11405. inst.accept.call( inst.element[ 0 ], ( draggable.currentItem || draggable.element ) ) &&
  11406. $.ui.intersect( draggable, $.extend( inst, { offset: inst.element.offset() } ), inst.options.tolerance, event )
  11407. ) { childrenIntersection = true; return false; }
  11408. });
  11409. if ( childrenIntersection ) {
  11410. return false;
  11411. }
  11412. if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
  11413. if ( this.options.activeClass ) {
  11414. this.element.removeClass( this.options.activeClass );
  11415. }
  11416. if ( this.options.hoverClass ) {
  11417. this.element.removeClass( this.options.hoverClass );
  11418. }
  11419. this._trigger( "drop", event, this.ui( draggable ) );
  11420. return this.element;
  11421. }
  11422. return false;
  11423. },
  11424. ui: function( c ) {
  11425. return {
  11426. draggable: ( c.currentItem || c.element ),
  11427. helper: c.helper,
  11428. position: c.position,
  11429. offset: c.positionAbs
  11430. };
  11431. }
  11432. });
  11433. $.ui.intersect = (function() {
  11434. function isOverAxis( x, reference, size ) {
  11435. return ( x >= reference ) && ( x < ( reference + size ) );
  11436. }
  11437. return function( draggable, droppable, toleranceMode, event ) {
  11438. if ( !droppable.offset ) {
  11439. return false;
  11440. }
  11441. var x1 = ( draggable.positionAbs || draggable.position.absolute ).left + draggable.margins.left,
  11442. y1 = ( draggable.positionAbs || draggable.position.absolute ).top + draggable.margins.top,
  11443. x2 = x1 + draggable.helperProportions.width,
  11444. y2 = y1 + draggable.helperProportions.height,
  11445. l = droppable.offset.left,
  11446. t = droppable.offset.top,
  11447. r = l + droppable.proportions().width,
  11448. b = t + droppable.proportions().height;
  11449. switch ( toleranceMode ) {
  11450. case "fit":
  11451. return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b );
  11452. case "intersect":
  11453. return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half
  11454. x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half
  11455. t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half
  11456. y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half
  11457. case "pointer":
  11458. return isOverAxis( event.pageY, t, droppable.proportions().height ) && isOverAxis( event.pageX, l, droppable.proportions().width );
  11459. case "touch":
  11460. return (
  11461. ( y1 >= t && y1 <= b ) || // Top edge touching
  11462. ( y2 >= t && y2 <= b ) || // Bottom edge touching
  11463. ( y1 < t && y2 > b ) // Surrounded vertically
  11464. ) && (
  11465. ( x1 >= l && x1 <= r ) || // Left edge touching
  11466. ( x2 >= l && x2 <= r ) || // Right edge touching
  11467. ( x1 < l && x2 > r ) // Surrounded horizontally
  11468. );
  11469. default:
  11470. return false;
  11471. }
  11472. };
  11473. })();
  11474. /*
  11475. This manager tracks offsets of draggables and droppables
  11476. */
  11477. $.ui.ddmanager = {
  11478. current: null,
  11479. droppables: { "default": [] },
  11480. prepareOffsets: function( t, event ) {
  11481. var i, j,
  11482. m = $.ui.ddmanager.droppables[ t.options.scope ] || [],
  11483. type = event ? event.type : null, // workaround for #2317
  11484. list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack();
  11485. droppablesLoop: for ( i = 0; i < m.length; i++ ) {
  11486. // No disabled and non-accepted
  11487. if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ], ( t.currentItem || t.element ) ) ) ) {
  11488. continue;
  11489. }
  11490. // Filter out elements in the current dragged item
  11491. for ( j = 0; j < list.length; j++ ) {
  11492. if ( list[ j ] === m[ i ].element[ 0 ] ) {
  11493. m[ i ].proportions().height = 0;
  11494. continue droppablesLoop;
  11495. }
  11496. }
  11497. m[ i ].visible = m[ i ].element.css( "display" ) !== "none";
  11498. if ( !m[ i ].visible ) {
  11499. continue;
  11500. }
  11501. // Activate the droppable if used directly from draggables
  11502. if ( type === "mousedown" ) {
  11503. m[ i ]._activate.call( m[ i ], event );
  11504. }
  11505. m[ i ].offset = m[ i ].element.offset();
  11506. m[ i ].proportions({ width: m[ i ].element[ 0 ].offsetWidth, height: m[ i ].element[ 0 ].offsetHeight });
  11507. }
  11508. },
  11509. drop: function( draggable, event ) {
  11510. var dropped = false;
  11511. // Create a copy of the droppables in case the list changes during the drop (#9116)
  11512. $.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() {
  11513. if ( !this.options ) {
  11514. return;
  11515. }
  11516. if ( !this.options.disabled && this.visible && $.ui.intersect( draggable, this, this.options.tolerance, event ) ) {
  11517. dropped = this._drop.call( this, event ) || dropped;
  11518. }
  11519. if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
  11520. this.isout = true;
  11521. this.isover = false;
  11522. this._deactivate.call( this, event );
  11523. }
  11524. });
  11525. return dropped;
  11526. },
  11527. dragStart: function( draggable, event ) {
  11528. // Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
  11529. draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() {
  11530. if ( !draggable.options.refreshPositions ) {
  11531. $.ui.ddmanager.prepareOffsets( draggable, event );
  11532. }
  11533. });
  11534. },
  11535. drag: function( draggable, event ) {
  11536. // If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
  11537. if ( draggable.options.refreshPositions ) {
  11538. $.ui.ddmanager.prepareOffsets( draggable, event );
  11539. }
  11540. // Run through all droppables and check their positions based on specific tolerance options
  11541. $.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() {
  11542. if ( this.options.disabled || this.greedyChild || !this.visible ) {
  11543. return;
  11544. }
  11545. var parentInstance, scope, parent,
  11546. intersects = $.ui.intersect( draggable, this, this.options.tolerance, event ),
  11547. c = !intersects && this.isover ? "isout" : ( intersects && !this.isover ? "isover" : null );
  11548. if ( !c ) {
  11549. return;
  11550. }
  11551. if ( this.options.greedy ) {
  11552. // find droppable parents with same scope
  11553. scope = this.options.scope;
  11554. parent = this.element.parents( ":data(ui-droppable)" ).filter(function() {
  11555. return $( this ).droppable( "instance" ).options.scope === scope;
  11556. });
  11557. if ( parent.length ) {
  11558. parentInstance = $( parent[ 0 ] ).droppable( "instance" );
  11559. parentInstance.greedyChild = ( c === "isover" );
  11560. }
  11561. }
  11562. // we just moved into a greedy child
  11563. if ( parentInstance && c === "isover" ) {
  11564. parentInstance.isover = false;
  11565. parentInstance.isout = true;
  11566. parentInstance._out.call( parentInstance, event );
  11567. }
  11568. this[ c ] = true;
  11569. this[c === "isout" ? "isover" : "isout"] = false;
  11570. this[c === "isover" ? "_over" : "_out"].call( this, event );
  11571. // we just moved out of a greedy child
  11572. if ( parentInstance && c === "isout" ) {
  11573. parentInstance.isout = false;
  11574. parentInstance.isover = true;
  11575. parentInstance._over.call( parentInstance, event );
  11576. }
  11577. });
  11578. },
  11579. dragStop: function( draggable, event ) {
  11580. draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" );
  11581. // Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
  11582. if ( !draggable.options.refreshPositions ) {
  11583. $.ui.ddmanager.prepareOffsets( draggable, event );
  11584. }
  11585. }
  11586. };
  11587. var droppable = $.ui.droppable;
  11588. /*!
  11589. * jQuery UI Sortable 1.11.4
  11590. * http://jqueryui.com
  11591. *
  11592. * Copyright jQuery Foundation and other contributors
  11593. * Released under the MIT license.
  11594. * http://jquery.org/license
  11595. *
  11596. * http://api.jqueryui.com/sortable/
  11597. */
  11598. var sortable = $.widget("ui.sortable", $.ui.mouse, {
  11599. version: "1.11.4",
  11600. widgetEventPrefix: "sort",
  11601. ready: false,
  11602. options: {
  11603. appendTo: "parent",
  11604. axis: false,
  11605. connectWith: false,
  11606. containment: false,
  11607. cursor: "auto",
  11608. cursorAt: false,
  11609. dropOnEmpty: true,
  11610. forcePlaceholderSize: false,
  11611. forceHelperSize: false,
  11612. grid: false,
  11613. handle: false,
  11614. helper: "original",
  11615. items: "> *",
  11616. opacity: false,
  11617. placeholder: false,
  11618. revert: false,
  11619. scroll: true,
  11620. scrollSensitivity: 20,
  11621. scrollSpeed: 20,
  11622. scope: "default",
  11623. tolerance: "intersect",
  11624. zIndex: 1000,
  11625. // callbacks
  11626. activate: null,
  11627. beforeStop: null,
  11628. change: null,
  11629. deactivate: null,
  11630. out: null,
  11631. over: null,
  11632. receive: null,
  11633. remove: null,
  11634. sort: null,
  11635. start: null,
  11636. stop: null,
  11637. update: null
  11638. },
  11639. _isOverAxis: function( x, reference, size ) {
  11640. return ( x >= reference ) && ( x < ( reference + size ) );
  11641. },
  11642. _isFloating: function( item ) {
  11643. return (/left|right/).test(item.css("float")) || (/inline|table-cell/).test(item.css("display"));
  11644. },
  11645. _create: function() {
  11646. this.containerCache = {};
  11647. this.element.addClass("ui-sortable");
  11648. //Get the items
  11649. this.refresh();
  11650. //Let's determine the parent's offset
  11651. this.offset = this.element.offset();
  11652. //Initialize mouse events for interaction
  11653. this._mouseInit();
  11654. this._setHandleClassName();
  11655. //We're ready to go
  11656. this.ready = true;
  11657. },
  11658. _setOption: function( key, value ) {
  11659. this._super( key, value );
  11660. if ( key === "handle" ) {
  11661. this._setHandleClassName();
  11662. }
  11663. },
  11664. _setHandleClassName: function() {
  11665. this.element.find( ".ui-sortable-handle" ).removeClass( "ui-sortable-handle" );
  11666. $.each( this.items, function() {
  11667. ( this.instance.options.handle ?
  11668. this.item.find( this.instance.options.handle ) : this.item )
  11669. .addClass( "ui-sortable-handle" );
  11670. });
  11671. },
  11672. _destroy: function() {
  11673. this.element
  11674. .removeClass( "ui-sortable ui-sortable-disabled" )
  11675. .find( ".ui-sortable-handle" )
  11676. .removeClass( "ui-sortable-handle" );
  11677. this._mouseDestroy();
  11678. for ( var i = this.items.length - 1; i >= 0; i-- ) {
  11679. this.items[i].item.removeData(this.widgetName + "-item");
  11680. }
  11681. return this;
  11682. },
  11683. _mouseCapture: function(event, overrideHandle) {
  11684. var currentItem = null,
  11685. validHandle = false,
  11686. that = this;
  11687. if (this.reverting) {
  11688. return false;
  11689. }
  11690. if(this.options.disabled || this.options.type === "static") {
  11691. return false;
  11692. }
  11693. //We have to refresh the items data once first
  11694. this._refreshItems(event);
  11695. //Find out if the clicked node (or one of its parents) is a actual item in this.items
  11696. $(event.target).parents().each(function() {
  11697. if($.data(this, that.widgetName + "-item") === that) {
  11698. currentItem = $(this);
  11699. return false;
  11700. }
  11701. });
  11702. if($.data(event.target, that.widgetName + "-item") === that) {
  11703. currentItem = $(event.target);
  11704. }
  11705. if(!currentItem) {
  11706. return false;
  11707. }
  11708. if(this.options.handle && !overrideHandle) {
  11709. $(this.options.handle, currentItem).find("*").addBack().each(function() {
  11710. if(this === event.target) {
  11711. validHandle = true;
  11712. }
  11713. });
  11714. if(!validHandle) {
  11715. return false;
  11716. }
  11717. }
  11718. this.currentItem = currentItem;
  11719. this._removeCurrentsFromItems();
  11720. return true;
  11721. },
  11722. _mouseStart: function(event, overrideHandle, noActivation) {
  11723. var i, body,
  11724. o = this.options;
  11725. this.currentContainer = this;
  11726. //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
  11727. this.refreshPositions();
  11728. //Create and append the visible helper
  11729. this.helper = this._createHelper(event);
  11730. //Cache the helper size
  11731. this._cacheHelperProportions();
  11732. /*
  11733. * - Position generation -
  11734. * This block generates everything position related - it's the core of draggables.
  11735. */
  11736. //Cache the margins of the original element
  11737. this._cacheMargins();
  11738. //Get the next scrolling parent
  11739. this.scrollParent = this.helper.scrollParent();
  11740. //The element's absolute position on the page minus margins
  11741. this.offset = this.currentItem.offset();
  11742. this.offset = {
  11743. top: this.offset.top - this.margins.top,
  11744. left: this.offset.left - this.margins.left
  11745. };
  11746. $.extend(this.offset, {
  11747. click: { //Where the click happened, relative to the element
  11748. left: event.pageX - this.offset.left,
  11749. top: event.pageY - this.offset.top
  11750. },
  11751. parent: this._getParentOffset(),
  11752. relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
  11753. });
  11754. // Only after we got the offset, we can change the helper's position to absolute
  11755. // TODO: Still need to figure out a way to make relative sorting possible
  11756. this.helper.css("position", "absolute");
  11757. this.cssPosition = this.helper.css("position");
  11758. //Generate the original position
  11759. this.originalPosition = this._generatePosition(event);
  11760. this.originalPageX = event.pageX;
  11761. this.originalPageY = event.pageY;
  11762. //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
  11763. (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
  11764. //Cache the former DOM position
  11765. this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
  11766. //If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way
  11767. if(this.helper[0] !== this.currentItem[0]) {
  11768. this.currentItem.hide();
  11769. }
  11770. //Create the placeholder
  11771. this._createPlaceholder();
  11772. //Set a containment if given in the options
  11773. if(o.containment) {
  11774. this._setContainment();
  11775. }
  11776. if( o.cursor && o.cursor !== "auto" ) { // cursor option
  11777. body = this.document.find( "body" );
  11778. // support: IE
  11779. this.storedCursor = body.css( "cursor" );
  11780. body.css( "cursor", o.cursor );
  11781. this.storedStylesheet = $( "<style>*{ cursor: "+o.cursor+" !important; }</style>" ).appendTo( body );
  11782. }
  11783. if(o.opacity) { // opacity option
  11784. if (this.helper.css("opacity")) {
  11785. this._storedOpacity = this.helper.css("opacity");
  11786. }
  11787. this.helper.css("opacity", o.opacity);
  11788. }
  11789. if(o.zIndex) { // zIndex option
  11790. if (this.helper.css("zIndex")) {
  11791. this._storedZIndex = this.helper.css("zIndex");
  11792. }
  11793. this.helper.css("zIndex", o.zIndex);
  11794. }
  11795. //Prepare scrolling
  11796. if(this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") {
  11797. this.overflowOffset = this.scrollParent.offset();
  11798. }
  11799. //Call callbacks
  11800. this._trigger("start", event, this._uiHash());
  11801. //Recache the helper size
  11802. if(!this._preserveHelperProportions) {
  11803. this._cacheHelperProportions();
  11804. }
  11805. //Post "activate" events to possible containers
  11806. if( !noActivation ) {
  11807. for ( i = this.containers.length - 1; i >= 0; i-- ) {
  11808. this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) );
  11809. }
  11810. }
  11811. //Prepare possible droppables
  11812. if($.ui.ddmanager) {
  11813. $.ui.ddmanager.current = this;
  11814. }
  11815. if ($.ui.ddmanager && !o.dropBehaviour) {
  11816. $.ui.ddmanager.prepareOffsets(this, event);
  11817. }
  11818. this.dragging = true;
  11819. this.helper.addClass("ui-sortable-helper");
  11820. this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
  11821. return true;
  11822. },
  11823. _mouseDrag: function(event) {
  11824. var i, item, itemElement, intersection,
  11825. o = this.options,
  11826. scrolled = false;
  11827. //Compute the helpers position
  11828. this.position = this._generatePosition(event);
  11829. this.positionAbs = this._convertPositionTo("absolute");
  11830. if (!this.lastPositionAbs) {
  11831. this.lastPositionAbs = this.positionAbs;
  11832. }
  11833. //Do scrolling
  11834. if(this.options.scroll) {
  11835. if(this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") {
  11836. if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
  11837. this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
  11838. } else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) {
  11839. this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
  11840. }
  11841. if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {
  11842. this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
  11843. } else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) {
  11844. this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
  11845. }
  11846. } else {
  11847. if(event.pageY - this.document.scrollTop() < o.scrollSensitivity) {
  11848. scrolled = this.document.scrollTop(this.document.scrollTop() - o.scrollSpeed);
  11849. } else if(this.window.height() - (event.pageY - this.document.scrollTop()) < o.scrollSensitivity) {
  11850. scrolled = this.document.scrollTop(this.document.scrollTop() + o.scrollSpeed);
  11851. }
  11852. if(event.pageX - this.document.scrollLeft() < o.scrollSensitivity) {
  11853. scrolled = this.document.scrollLeft(this.document.scrollLeft() - o.scrollSpeed);
  11854. } else if(this.window.width() - (event.pageX - this.document.scrollLeft()) < o.scrollSensitivity) {
  11855. scrolled = this.document.scrollLeft(this.document.scrollLeft() + o.scrollSpeed);
  11856. }
  11857. }
  11858. if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
  11859. $.ui.ddmanager.prepareOffsets(this, event);
  11860. }
  11861. }
  11862. //Regenerate the absolute position used for position checks
  11863. this.positionAbs = this._convertPositionTo("absolute");
  11864. //Set the helper position
  11865. if(!this.options.axis || this.options.axis !== "y") {
  11866. this.helper[0].style.left = this.position.left+"px";
  11867. }
  11868. if(!this.options.axis || this.options.axis !== "x") {
  11869. this.helper[0].style.top = this.position.top+"px";
  11870. }
  11871. //Rearrange
  11872. for (i = this.items.length - 1; i >= 0; i--) {
  11873. //Cache variables and intersection, continue if no intersection
  11874. item = this.items[i];
  11875. itemElement = item.item[0];
  11876. intersection = this._intersectsWithPointer(item);
  11877. if (!intersection) {
  11878. continue;
  11879. }
  11880. // Only put the placeholder inside the current Container, skip all
  11881. // items from other containers. This works because when moving
  11882. // an item from one container to another the
  11883. // currentContainer is switched before the placeholder is moved.
  11884. //
  11885. // Without this, moving items in "sub-sortables" can cause
  11886. // the placeholder to jitter between the outer and inner container.
  11887. if (item.instance !== this.currentContainer) {
  11888. continue;
  11889. }
  11890. // cannot intersect with itself
  11891. // no useless actions that have been done before
  11892. // no action if the item moved is the parent of the item checked
  11893. if (itemElement !== this.currentItem[0] &&
  11894. this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement &&
  11895. !$.contains(this.placeholder[0], itemElement) &&
  11896. (this.options.type === "semi-dynamic" ? !$.contains(this.element[0], itemElement) : true)
  11897. ) {
  11898. this.direction = intersection === 1 ? "down" : "up";
  11899. if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) {
  11900. this._rearrange(event, item);
  11901. } else {
  11902. break;
  11903. }
  11904. this._trigger("change", event, this._uiHash());
  11905. break;
  11906. }
  11907. }
  11908. //Post events to containers
  11909. this._contactContainers(event);
  11910. //Interconnect with droppables
  11911. if($.ui.ddmanager) {
  11912. $.ui.ddmanager.drag(this, event);
  11913. }
  11914. //Call callbacks
  11915. this._trigger("sort", event, this._uiHash());
  11916. this.lastPositionAbs = this.positionAbs;
  11917. return false;
  11918. },
  11919. _mouseStop: function(event, noPropagation) {
  11920. if(!event) {
  11921. return;
  11922. }
  11923. //If we are using droppables, inform the manager about the drop
  11924. if ($.ui.ddmanager && !this.options.dropBehaviour) {
  11925. $.ui.ddmanager.drop(this, event);
  11926. }
  11927. if(this.options.revert) {
  11928. var that = this,
  11929. cur = this.placeholder.offset(),
  11930. axis = this.options.axis,
  11931. animation = {};
  11932. if ( !axis || axis === "x" ) {
  11933. animation.left = cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollLeft);
  11934. }
  11935. if ( !axis || axis === "y" ) {
  11936. animation.top = cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollTop);
  11937. }
  11938. this.reverting = true;
  11939. $(this.helper).animate( animation, parseInt(this.options.revert, 10) || 500, function() {
  11940. that._clear(event);
  11941. });
  11942. } else {
  11943. this._clear(event, noPropagation);
  11944. }
  11945. return false;
  11946. },
  11947. cancel: function() {
  11948. if(this.dragging) {
  11949. this._mouseUp({ target: null });
  11950. if(this.options.helper === "original") {
  11951. this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
  11952. } else {
  11953. this.currentItem.show();
  11954. }
  11955. //Post deactivating events to containers
  11956. for (var i = this.containers.length - 1; i >= 0; i--){
  11957. this.containers[i]._trigger("deactivate", null, this._uiHash(this));
  11958. if(this.containers[i].containerCache.over) {
  11959. this.containers[i]._trigger("out", null, this._uiHash(this));
  11960. this.containers[i].containerCache.over = 0;
  11961. }
  11962. }
  11963. }
  11964. if (this.placeholder) {
  11965. //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
  11966. if(this.placeholder[0].parentNode) {
  11967. this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
  11968. }
  11969. if(this.options.helper !== "original" && this.helper && this.helper[0].parentNode) {
  11970. this.helper.remove();
  11971. }
  11972. $.extend(this, {
  11973. helper: null,
  11974. dragging: false,
  11975. reverting: false,
  11976. _noFinalSort: null
  11977. });
  11978. if(this.domPosition.prev) {
  11979. $(this.domPosition.prev).after(this.currentItem);
  11980. } else {
  11981. $(this.domPosition.parent).prepend(this.currentItem);
  11982. }
  11983. }
  11984. return this;
  11985. },
  11986. serialize: function(o) {
  11987. var items = this._getItemsAsjQuery(o && o.connected),
  11988. str = [];
  11989. o = o || {};
  11990. $(items).each(function() {
  11991. var res = ($(o.item || this).attr(o.attribute || "id") || "").match(o.expression || (/(.+)[\-=_](.+)/));
  11992. if (res) {
  11993. str.push((o.key || res[1]+"[]")+"="+(o.key && o.expression ? res[1] : res[2]));
  11994. }
  11995. });
  11996. if(!str.length && o.key) {
  11997. str.push(o.key + "=");
  11998. }
  11999. return str.join("&");
  12000. },
  12001. toArray: function(o) {
  12002. var items = this._getItemsAsjQuery(o && o.connected),
  12003. ret = [];
  12004. o = o || {};
  12005. items.each(function() { ret.push($(o.item || this).attr(o.attribute || "id") || ""); });
  12006. return ret;
  12007. },
  12008. /* Be careful with the following core functions */
  12009. _intersectsWith: function(item) {
  12010. var x1 = this.positionAbs.left,
  12011. x2 = x1 + this.helperProportions.width,
  12012. y1 = this.positionAbs.top,
  12013. y2 = y1 + this.helperProportions.height,
  12014. l = item.left,
  12015. r = l + item.width,
  12016. t = item.top,
  12017. b = t + item.height,
  12018. dyClick = this.offset.click.top,
  12019. dxClick = this.offset.click.left,
  12020. isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && ( y1 + dyClick ) < b ),
  12021. isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && ( x1 + dxClick ) < r ),
  12022. isOverElement = isOverElementHeight && isOverElementWidth;
  12023. if ( this.options.tolerance === "pointer" ||
  12024. this.options.forcePointerForContainers ||
  12025. (this.options.tolerance !== "pointer" && this.helperProportions[this.floating ? "width" : "height"] > item[this.floating ? "width" : "height"])
  12026. ) {
  12027. return isOverElement;
  12028. } else {
  12029. return (l < x1 + (this.helperProportions.width / 2) && // Right Half
  12030. x2 - (this.helperProportions.width / 2) < r && // Left Half
  12031. t < y1 + (this.helperProportions.height / 2) && // Bottom Half
  12032. y2 - (this.helperProportions.height / 2) < b ); // Top Half
  12033. }
  12034. },
  12035. _intersectsWithPointer: function(item) {
  12036. var isOverElementHeight = (this.options.axis === "x") || this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
  12037. isOverElementWidth = (this.options.axis === "y") || this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
  12038. isOverElement = isOverElementHeight && isOverElementWidth,
  12039. verticalDirection = this._getDragVerticalDirection(),
  12040. horizontalDirection = this._getDragHorizontalDirection();
  12041. if (!isOverElement) {
  12042. return false;
  12043. }
  12044. return this.floating ?
  12045. ( ((horizontalDirection && horizontalDirection === "right") || verticalDirection === "down") ? 2 : 1 )
  12046. : ( verticalDirection && (verticalDirection === "down" ? 2 : 1) );
  12047. },
  12048. _intersectsWithSides: function(item) {
  12049. var isOverBottomHalf = this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
  12050. isOverRightHalf = this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
  12051. verticalDirection = this._getDragVerticalDirection(),
  12052. horizontalDirection = this._getDragHorizontalDirection();
  12053. if (this.floating && horizontalDirection) {
  12054. return ((horizontalDirection === "right" && isOverRightHalf) || (horizontalDirection === "left" && !isOverRightHalf));
  12055. } else {
  12056. return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || (verticalDirection === "up" && !isOverBottomHalf));
  12057. }
  12058. },
  12059. _getDragVerticalDirection: function() {
  12060. var delta = this.positionAbs.top - this.lastPositionAbs.top;
  12061. return delta !== 0 && (delta > 0 ? "down" : "up");
  12062. },
  12063. _getDragHorizontalDirection: function() {
  12064. var delta = this.positionAbs.left - this.lastPositionAbs.left;
  12065. return delta !== 0 && (delta > 0 ? "right" : "left");
  12066. },
  12067. refresh: function(event) {
  12068. this._refreshItems(event);
  12069. this._setHandleClassName();
  12070. this.refreshPositions();
  12071. return this;
  12072. },
  12073. _connectWith: function() {
  12074. var options = this.options;
  12075. return options.connectWith.constructor === String ? [options.connectWith] : options.connectWith;
  12076. },
  12077. _getItemsAsjQuery: function(connected) {
  12078. var i, j, cur, inst,
  12079. items = [],
  12080. queries = [],
  12081. connectWith = this._connectWith();
  12082. if(connectWith && connected) {
  12083. for (i = connectWith.length - 1; i >= 0; i--){
  12084. cur = $(connectWith[i], this.document[0]);
  12085. for ( j = cur.length - 1; j >= 0; j--){
  12086. inst = $.data(cur[j], this.widgetFullName);
  12087. if(inst && inst !== this && !inst.options.disabled) {
  12088. queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), inst]);
  12089. }
  12090. }
  12091. }
  12092. }
  12093. queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]);
  12094. function addItems() {
  12095. items.push( this );
  12096. }
  12097. for (i = queries.length - 1; i >= 0; i--){
  12098. queries[i][0].each( addItems );
  12099. }
  12100. return $(items);
  12101. },
  12102. _removeCurrentsFromItems: function() {
  12103. var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
  12104. this.items = $.grep(this.items, function (item) {
  12105. for (var j=0; j < list.length; j++) {
  12106. if(list[j] === item.item[0]) {
  12107. return false;
  12108. }
  12109. }
  12110. return true;
  12111. });
  12112. },
  12113. _refreshItems: function(event) {
  12114. this.items = [];
  12115. this.containers = [this];
  12116. var i, j, cur, inst, targetData, _queries, item, queriesLength,
  12117. items = this.items,
  12118. queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]],
  12119. connectWith = this._connectWith();
  12120. if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
  12121. for (i = connectWith.length - 1; i >= 0; i--){
  12122. cur = $(connectWith[i], this.document[0]);
  12123. for (j = cur.length - 1; j >= 0; j--){
  12124. inst = $.data(cur[j], this.widgetFullName);
  12125. if(inst && inst !== this && !inst.options.disabled) {
  12126. queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
  12127. this.containers.push(inst);
  12128. }
  12129. }
  12130. }
  12131. }
  12132. for (i = queries.length - 1; i >= 0; i--) {
  12133. targetData = queries[i][1];
  12134. _queries = queries[i][0];
  12135. for (j=0, queriesLength = _queries.length; j < queriesLength; j++) {
  12136. item = $(_queries[j]);
  12137. item.data(this.widgetName + "-item", targetData); // Data for target checking (mouse manager)
  12138. items.push({
  12139. item: item,
  12140. instance: targetData,
  12141. width: 0, height: 0,
  12142. left: 0, top: 0
  12143. });
  12144. }
  12145. }
  12146. },
  12147. refreshPositions: function(fast) {
  12148. // Determine whether items are being displayed horizontally
  12149. this.floating = this.items.length ?
  12150. this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :
  12151. false;
  12152. //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
  12153. if(this.offsetParent && this.helper) {
  12154. this.offset.parent = this._getParentOffset();
  12155. }
  12156. var i, item, t, p;
  12157. for (i = this.items.length - 1; i >= 0; i--){
  12158. item = this.items[i];
  12159. //We ignore calculating positions of all connected containers when we're not over them
  12160. if(item.instance !== this.currentContainer && this.currentContainer && item.item[0] !== this.currentItem[0]) {
  12161. continue;
  12162. }
  12163. t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
  12164. if (!fast) {
  12165. item.width = t.outerWidth();
  12166. item.height = t.outerHeight();
  12167. }
  12168. p = t.offset();
  12169. item.left = p.left;
  12170. item.top = p.top;
  12171. }
  12172. if(this.options.custom && this.options.custom.refreshContainers) {
  12173. this.options.custom.refreshContainers.call(this);
  12174. } else {
  12175. for (i = this.containers.length - 1; i >= 0; i--){
  12176. p = this.containers[i].element.offset();
  12177. this.containers[i].containerCache.left = p.left;
  12178. this.containers[i].containerCache.top = p.top;
  12179. this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
  12180. this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
  12181. }
  12182. }
  12183. return this;
  12184. },
  12185. _createPlaceholder: function(that) {
  12186. that = that || this;
  12187. var className,
  12188. o = that.options;
  12189. if(!o.placeholder || o.placeholder.constructor === String) {
  12190. className = o.placeholder;
  12191. o.placeholder = {
  12192. element: function() {
  12193. var nodeName = that.currentItem[0].nodeName.toLowerCase(),
  12194. element = $( "<" + nodeName + ">", that.document[0] )
  12195. .addClass(className || that.currentItem[0].className+" ui-sortable-placeholder")
  12196. .removeClass("ui-sortable-helper");
  12197. if ( nodeName === "tbody" ) {
  12198. that._createTrPlaceholder(
  12199. that.currentItem.find( "tr" ).eq( 0 ),
  12200. $( "<tr>", that.document[ 0 ] ).appendTo( element )
  12201. );
  12202. } else if ( nodeName === "tr" ) {
  12203. that._createTrPlaceholder( that.currentItem, element );
  12204. } else if ( nodeName === "img" ) {
  12205. element.attr( "src", that.currentItem.attr( "src" ) );
  12206. }
  12207. if ( !className ) {
  12208. element.css( "visibility", "hidden" );
  12209. }
  12210. return element;
  12211. },
  12212. update: function(container, p) {
  12213. // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
  12214. // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
  12215. if(className && !o.forcePlaceholderSize) {
  12216. return;
  12217. }
  12218. //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
  12219. if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop")||0, 10) - parseInt(that.currentItem.css("paddingBottom")||0, 10)); }
  12220. if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft")||0, 10) - parseInt(that.currentItem.css("paddingRight")||0, 10)); }
  12221. }
  12222. };
  12223. }
  12224. //Create the placeholder
  12225. that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem));
  12226. //Append it after the actual current item
  12227. that.currentItem.after(that.placeholder);
  12228. //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
  12229. o.placeholder.update(that, that.placeholder);
  12230. },
  12231. _createTrPlaceholder: function( sourceTr, targetTr ) {
  12232. var that = this;
  12233. sourceTr.children().each(function() {
  12234. $( "<td>&#160;</td>", that.document[ 0 ] )
  12235. .attr( "colspan", $( this ).attr( "colspan" ) || 1 )
  12236. .appendTo( targetTr );
  12237. });
  12238. },
  12239. _contactContainers: function(event) {
  12240. var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, floating, axis,
  12241. innermostContainer = null,
  12242. innermostIndex = null;
  12243. // get innermost container that intersects with item
  12244. for (i = this.containers.length - 1; i >= 0; i--) {
  12245. // never consider a container that's located within the item itself
  12246. if($.contains(this.currentItem[0], this.containers[i].element[0])) {
  12247. continue;
  12248. }
  12249. if(this._intersectsWith(this.containers[i].containerCache)) {
  12250. // if we've already found a container and it's more "inner" than this, then continue
  12251. if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) {
  12252. continue;
  12253. }
  12254. innermostContainer = this.containers[i];
  12255. innermostIndex = i;
  12256. } else {
  12257. // container doesn't intersect. trigger "out" event if necessary
  12258. if(this.containers[i].containerCache.over) {
  12259. this.containers[i]._trigger("out", event, this._uiHash(this));
  12260. this.containers[i].containerCache.over = 0;
  12261. }
  12262. }
  12263. }
  12264. // if no intersecting containers found, return
  12265. if(!innermostContainer) {
  12266. return;
  12267. }
  12268. // move the item into the container if it's not there already
  12269. if(this.containers.length === 1) {
  12270. if (!this.containers[innermostIndex].containerCache.over) {
  12271. this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
  12272. this.containers[innermostIndex].containerCache.over = 1;
  12273. }
  12274. } else {
  12275. //When entering a new container, we will find the item with the least distance and append our item near it
  12276. dist = 10000;
  12277. itemWithLeastDistance = null;
  12278. floating = innermostContainer.floating || this._isFloating(this.currentItem);
  12279. posProperty = floating ? "left" : "top";
  12280. sizeProperty = floating ? "width" : "height";
  12281. axis = floating ? "clientX" : "clientY";
  12282. for (j = this.items.length - 1; j >= 0; j--) {
  12283. if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) {
  12284. continue;
  12285. }
  12286. if(this.items[j].item[0] === this.currentItem[0]) {
  12287. continue;
  12288. }
  12289. cur = this.items[j].item.offset()[posProperty];
  12290. nearBottom = false;
  12291. if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) {
  12292. nearBottom = true;
  12293. }
  12294. if ( Math.abs( event[ axis ] - cur ) < dist ) {
  12295. dist = Math.abs( event[ axis ] - cur );
  12296. itemWithLeastDistance = this.items[ j ];
  12297. this.direction = nearBottom ? "up": "down";
  12298. }
  12299. }
  12300. //Check if dropOnEmpty is enabled
  12301. if(!itemWithLeastDistance && !this.options.dropOnEmpty) {
  12302. return;
  12303. }
  12304. if(this.currentContainer === this.containers[innermostIndex]) {
  12305. if ( !this.currentContainer.containerCache.over ) {
  12306. this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() );
  12307. this.currentContainer.containerCache.over = 1;
  12308. }
  12309. return;
  12310. }
  12311. itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
  12312. this._trigger("change", event, this._uiHash());
  12313. this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
  12314. this.currentContainer = this.containers[innermostIndex];
  12315. //Update the placeholder
  12316. this.options.placeholder.update(this.currentContainer, this.placeholder);
  12317. this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
  12318. this.containers[innermostIndex].containerCache.over = 1;
  12319. }
  12320. },
  12321. _createHelper: function(event) {
  12322. var o = this.options,
  12323. helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper === "clone" ? this.currentItem.clone() : this.currentItem);
  12324. //Add the helper to the DOM if that didn't happen already
  12325. if(!helper.parents("body").length) {
  12326. $(o.appendTo !== "parent" ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
  12327. }
  12328. if(helper[0] === this.currentItem[0]) {
  12329. this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") };
  12330. }
  12331. if(!helper[0].style.width || o.forceHelperSize) {
  12332. helper.width(this.currentItem.width());
  12333. }
  12334. if(!helper[0].style.height || o.forceHelperSize) {
  12335. helper.height(this.currentItem.height());
  12336. }
  12337. return helper;
  12338. },
  12339. _adjustOffsetFromHelper: function(obj) {
  12340. if (typeof obj === "string") {
  12341. obj = obj.split(" ");
  12342. }
  12343. if ($.isArray(obj)) {
  12344. obj = {left: +obj[0], top: +obj[1] || 0};
  12345. }
  12346. if ("left" in obj) {
  12347. this.offset.click.left = obj.left + this.margins.left;
  12348. }
  12349. if ("right" in obj) {
  12350. this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  12351. }
  12352. if ("top" in obj) {
  12353. this.offset.click.top = obj.top + this.margins.top;
  12354. }
  12355. if ("bottom" in obj) {
  12356. this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  12357. }
  12358. },
  12359. _getParentOffset: function() {
  12360. //Get the offsetParent and cache its position
  12361. this.offsetParent = this.helper.offsetParent();
  12362. var po = this.offsetParent.offset();
  12363. // This is a special case where we need to modify a offset calculated on start, since the following happened:
  12364. // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
  12365. // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
  12366. // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
  12367. if(this.cssPosition === "absolute" && this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) {
  12368. po.left += this.scrollParent.scrollLeft();
  12369. po.top += this.scrollParent.scrollTop();
  12370. }
  12371. // This needs to be actually done for all browsers, since pageX/pageY includes this information
  12372. // with an ugly IE fix
  12373. if( this.offsetParent[0] === this.document[0].body || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) {
  12374. po = { top: 0, left: 0 };
  12375. }
  12376. return {
  12377. top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
  12378. left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
  12379. };
  12380. },
  12381. _getRelativeOffset: function() {
  12382. if(this.cssPosition === "relative") {
  12383. var p = this.currentItem.position();
  12384. return {
  12385. top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
  12386. left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
  12387. };
  12388. } else {
  12389. return { top: 0, left: 0 };
  12390. }
  12391. },
  12392. _cacheMargins: function() {
  12393. this.margins = {
  12394. left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
  12395. top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
  12396. };
  12397. },
  12398. _cacheHelperProportions: function() {
  12399. this.helperProportions = {
  12400. width: this.helper.outerWidth(),
  12401. height: this.helper.outerHeight()
  12402. };
  12403. },
  12404. _setContainment: function() {
  12405. var ce, co, over,
  12406. o = this.options;
  12407. if(o.containment === "parent") {
  12408. o.containment = this.helper[0].parentNode;
  12409. }
  12410. if(o.containment === "document" || o.containment === "window") {
  12411. this.containment = [
  12412. 0 - this.offset.relative.left - this.offset.parent.left,
  12413. 0 - this.offset.relative.top - this.offset.parent.top,
  12414. o.containment === "document" ? this.document.width() : this.window.width() - this.helperProportions.width - this.margins.left,
  12415. (o.containment === "document" ? this.document.width() : this.window.height() || this.document[0].body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
  12416. ];
  12417. }
  12418. if(!(/^(document|window|parent)$/).test(o.containment)) {
  12419. ce = $(o.containment)[0];
  12420. co = $(o.containment).offset();
  12421. over = ($(ce).css("overflow") !== "hidden");
  12422. this.containment = [
  12423. co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
  12424. co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
  12425. co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
  12426. co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
  12427. ];
  12428. }
  12429. },
  12430. _convertPositionTo: function(d, pos) {
  12431. if(!pos) {
  12432. pos = this.position;
  12433. }
  12434. var mod = d === "absolute" ? 1 : -1,
  12435. scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent,
  12436. scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
  12437. return {
  12438. top: (
  12439. pos.top + // The absolute mouse position
  12440. this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
  12441. this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border)
  12442. ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
  12443. ),
  12444. left: (
  12445. pos.left + // The absolute mouse position
  12446. this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
  12447. this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border)
  12448. ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
  12449. )
  12450. };
  12451. },
  12452. _generatePosition: function(event) {
  12453. var top, left,
  12454. o = this.options,
  12455. pageX = event.pageX,
  12456. pageY = event.pageY,
  12457. scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
  12458. // This is another very weird special case that only happens for relative elements:
  12459. // 1. If the css position is relative
  12460. // 2. and the scroll parent is the document or similar to the offset parent
  12461. // we have to refresh the relative offset during the scroll so there are no jumps
  12462. if(this.cssPosition === "relative" && !(this.scrollParent[0] !== this.document[0] && this.scrollParent[0] !== this.offsetParent[0])) {
  12463. this.offset.relative = this._getRelativeOffset();
  12464. }
  12465. /*
  12466. * - Position constraining -
  12467. * Constrain the position to a mix of grid, containment.
  12468. */
  12469. if(this.originalPosition) { //If we are not dragging yet, we won't check for options
  12470. if(this.containment) {
  12471. if(event.pageX - this.offset.click.left < this.containment[0]) {
  12472. pageX = this.containment[0] + this.offset.click.left;
  12473. }
  12474. if(event.pageY - this.offset.click.top < this.containment[1]) {
  12475. pageY = this.containment[1] + this.offset.click.top;
  12476. }
  12477. if(event.pageX - this.offset.click.left > this.containment[2]) {
  12478. pageX = this.containment[2] + this.offset.click.left;
  12479. }
  12480. if(event.pageY - this.offset.click.top > this.containment[3]) {
  12481. pageY = this.containment[3] + this.offset.click.top;
  12482. }
  12483. }
  12484. if(o.grid) {
  12485. top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
  12486. pageY = this.containment ? ( (top - this.offset.click.top >= this.containment[1] && top - this.offset.click.top <= this.containment[3]) ? top : ((top - this.offset.click.top >= this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
  12487. left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
  12488. pageX = this.containment ? ( (left - this.offset.click.left >= this.containment[0] && left - this.offset.click.left <= this.containment[2]) ? left : ((left - this.offset.click.left >= this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
  12489. }
  12490. }
  12491. return {
  12492. top: (
  12493. pageY - // The absolute mouse position
  12494. this.offset.click.top - // Click offset (relative to the element)
  12495. this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent
  12496. this.offset.parent.top + // The offsetParent's offset without borders (offset + border)
  12497. ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
  12498. ),
  12499. left: (
  12500. pageX - // The absolute mouse position
  12501. this.offset.click.left - // Click offset (relative to the element)
  12502. this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent
  12503. this.offset.parent.left + // The offsetParent's offset without borders (offset + border)
  12504. ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
  12505. )
  12506. };
  12507. },
  12508. _rearrange: function(event, i, a, hardRefresh) {
  12509. a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction === "down" ? i.item[0] : i.item[0].nextSibling));
  12510. //Various things done here to improve the performance:
  12511. // 1. we create a setTimeout, that calls refreshPositions
  12512. // 2. on the instance, we have a counter variable, that get's higher after every append
  12513. // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
  12514. // 4. this lets only the last addition to the timeout stack through
  12515. this.counter = this.counter ? ++this.counter : 1;
  12516. var counter = this.counter;
  12517. this._delay(function() {
  12518. if(counter === this.counter) {
  12519. this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
  12520. }
  12521. });
  12522. },
  12523. _clear: function(event, noPropagation) {
  12524. this.reverting = false;
  12525. // We delay all events that have to be triggered to after the point where the placeholder has been removed and
  12526. // everything else normalized again
  12527. var i,
  12528. delayedTriggers = [];
  12529. // We first have to update the dom position of the actual currentItem
  12530. // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
  12531. if(!this._noFinalSort && this.currentItem.parent().length) {
  12532. this.placeholder.before(this.currentItem);
  12533. }
  12534. this._noFinalSort = null;
  12535. if(this.helper[0] === this.currentItem[0]) {
  12536. for(i in this._storedCSS) {
  12537. if(this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") {
  12538. this._storedCSS[i] = "";
  12539. }
  12540. }
  12541. this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
  12542. } else {
  12543. this.currentItem.show();
  12544. }
  12545. if(this.fromOutside && !noPropagation) {
  12546. delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
  12547. }
  12548. if((this.fromOutside || this.domPosition.prev !== this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) {
  12549. delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
  12550. }
  12551. // Check if the items Container has Changed and trigger appropriate
  12552. // events.
  12553. if (this !== this.currentContainer) {
  12554. if(!noPropagation) {
  12555. delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
  12556. delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
  12557. delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
  12558. }
  12559. }
  12560. //Post events to containers
  12561. function delayEvent( type, instance, container ) {
  12562. return function( event ) {
  12563. container._trigger( type, event, instance._uiHash( instance ) );
  12564. };
  12565. }
  12566. for (i = this.containers.length - 1; i >= 0; i--){
  12567. if (!noPropagation) {
  12568. delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) );
  12569. }
  12570. if(this.containers[i].containerCache.over) {
  12571. delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) );
  12572. this.containers[i].containerCache.over = 0;
  12573. }
  12574. }
  12575. //Do what was originally in plugins
  12576. if ( this.storedCursor ) {
  12577. this.document.find( "body" ).css( "cursor", this.storedCursor );
  12578. this.storedStylesheet.remove();
  12579. }
  12580. if(this._storedOpacity) {
  12581. this.helper.css("opacity", this._storedOpacity);
  12582. }
  12583. if(this._storedZIndex) {
  12584. this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex);
  12585. }
  12586. this.dragging = false;
  12587. if(!noPropagation) {
  12588. this._trigger("beforeStop", event, this._uiHash());
  12589. }
  12590. //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
  12591. this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
  12592. if ( !this.cancelHelperRemoval ) {
  12593. if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
  12594. this.helper.remove();
  12595. }
  12596. this.helper = null;
  12597. }
  12598. if(!noPropagation) {
  12599. for (i=0; i < delayedTriggers.length; i++) {
  12600. delayedTriggers[i].call(this, event);
  12601. } //Trigger all delayed events
  12602. this._trigger("stop", event, this._uiHash());
  12603. }
  12604. this.fromOutside = false;
  12605. return !this.cancelHelperRemoval;
  12606. },
  12607. _trigger: function() {
  12608. if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
  12609. this.cancel();
  12610. }
  12611. },
  12612. _uiHash: function(_inst) {
  12613. var inst = _inst || this;
  12614. return {
  12615. helper: inst.helper,
  12616. placeholder: inst.placeholder || $([]),
  12617. position: inst.position,
  12618. originalPosition: inst.originalPosition,
  12619. offset: inst.positionAbs,
  12620. item: inst.currentItem,
  12621. sender: _inst ? _inst.element : null
  12622. };
  12623. }
  12624. });
  12625. /*!
  12626. * jQuery UI Effects 1.11.4
  12627. * http://jqueryui.com
  12628. *
  12629. * Copyright jQuery Foundation and other contributors
  12630. * Released under the MIT license.
  12631. * http://jquery.org/license
  12632. *
  12633. * http://api.jqueryui.com/category/effects-core/
  12634. */
  12635. var dataSpace = "ui-effects-",
  12636. // Create a local jQuery because jQuery Color relies on it and the
  12637. // global may not exist with AMD and a custom cloud (#10199)
  12638. jQuery = $;
  12639. $.effects = {
  12640. effect: {}
  12641. };
  12642. /*!
  12643. * jQuery Color Animations v2.1.2
  12644. * https://github.com/jquery/jquery-color
  12645. *
  12646. * Copyright 2014 jQuery Foundation and other contributors
  12647. * Released under the MIT license.
  12648. * http://jquery.org/license
  12649. *
  12650. * Date: Wed Jan 16 08:47:09 2013 -0600
  12651. */
  12652. (function( jQuery, undefined ) {
  12653. var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
  12654. // plusequals test for += 100 -= 100
  12655. rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
  12656. // a set of RE's that can match strings and generate color tuples.
  12657. stringParsers = [ {
  12658. re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  12659. parse: function( execResult ) {
  12660. return [
  12661. execResult[ 1 ],
  12662. execResult[ 2 ],
  12663. execResult[ 3 ],
  12664. execResult[ 4 ]
  12665. ];
  12666. }
  12667. }, {
  12668. re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  12669. parse: function( execResult ) {
  12670. return [
  12671. execResult[ 1 ] * 2.55,
  12672. execResult[ 2 ] * 2.55,
  12673. execResult[ 3 ] * 2.55,
  12674. execResult[ 4 ]
  12675. ];
  12676. }
  12677. }, {
  12678. // this regex ignores A-F because it's compared against an already lowercased string
  12679. re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
  12680. parse: function( execResult ) {
  12681. return [
  12682. parseInt( execResult[ 1 ], 16 ),
  12683. parseInt( execResult[ 2 ], 16 ),
  12684. parseInt( execResult[ 3 ], 16 )
  12685. ];
  12686. }
  12687. }, {
  12688. // this regex ignores A-F because it's compared against an already lowercased string
  12689. re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
  12690. parse: function( execResult ) {
  12691. return [
  12692. parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
  12693. parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
  12694. parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
  12695. ];
  12696. }
  12697. }, {
  12698. re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  12699. space: "hsla",
  12700. parse: function( execResult ) {
  12701. return [
  12702. execResult[ 1 ],
  12703. execResult[ 2 ] / 100,
  12704. execResult[ 3 ] / 100,
  12705. execResult[ 4 ]
  12706. ];
  12707. }
  12708. } ],
  12709. // jQuery.Color( )
  12710. color = jQuery.Color = function( color, green, blue, alpha ) {
  12711. return new jQuery.Color.fn.parse( color, green, blue, alpha );
  12712. },
  12713. spaces = {
  12714. rgba: {
  12715. props: {
  12716. red: {
  12717. idx: 0,
  12718. type: "byte"
  12719. },
  12720. green: {
  12721. idx: 1,
  12722. type: "byte"
  12723. },
  12724. blue: {
  12725. idx: 2,
  12726. type: "byte"
  12727. }
  12728. }
  12729. },
  12730. hsla: {
  12731. props: {
  12732. hue: {
  12733. idx: 0,
  12734. type: "degrees"
  12735. },
  12736. saturation: {
  12737. idx: 1,
  12738. type: "percent"
  12739. },
  12740. lightness: {
  12741. idx: 2,
  12742. type: "percent"
  12743. }
  12744. }
  12745. }
  12746. },
  12747. propTypes = {
  12748. "byte": {
  12749. floor: true,
  12750. max: 255
  12751. },
  12752. "percent": {
  12753. max: 1
  12754. },
  12755. "degrees": {
  12756. mod: 360,
  12757. floor: true
  12758. }
  12759. },
  12760. support = color.support = {},
  12761. // element for support tests
  12762. supportElem = jQuery( "<p>" )[ 0 ],
  12763. // colors = jQuery.Color.names
  12764. colors,
  12765. // local aliases of functions called often
  12766. each = jQuery.each;
  12767. // determine rgba support immediately
  12768. supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
  12769. support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
  12770. // define cache name and alpha properties
  12771. // for rgba and hsla spaces
  12772. each( spaces, function( spaceName, space ) {
  12773. space.cache = "_" + spaceName;
  12774. space.props.alpha = {
  12775. idx: 3,
  12776. type: "percent",
  12777. def: 1
  12778. };
  12779. });
  12780. function clamp( value, prop, allowEmpty ) {
  12781. var type = propTypes[ prop.type ] || {};
  12782. if ( value == null ) {
  12783. return (allowEmpty || !prop.def) ? null : prop.def;
  12784. }
  12785. // ~~ is an short way of doing floor for positive numbers
  12786. value = type.floor ? ~~value : parseFloat( value );
  12787. // IE will pass in empty strings as value for alpha,
  12788. // which will hit this case
  12789. if ( isNaN( value ) ) {
  12790. return prop.def;
  12791. }
  12792. if ( type.mod ) {
  12793. // we add mod before modding to make sure that negatives values
  12794. // get converted properly: -10 -> 350
  12795. return (value + type.mod) % type.mod;
  12796. }
  12797. // for now all property types without mod have min and max
  12798. return 0 > value ? 0 : type.max < value ? type.max : value;
  12799. }
  12800. function stringParse( string ) {
  12801. var inst = color(),
  12802. rgba = inst._rgba = [];
  12803. string = string.toLowerCase();
  12804. each( stringParsers, function( i, parser ) {
  12805. var parsed,
  12806. match = parser.re.exec( string ),
  12807. values = match && parser.parse( match ),
  12808. spaceName = parser.space || "rgba";
  12809. if ( values ) {
  12810. parsed = inst[ spaceName ]( values );
  12811. // if this was an rgba parse the assignment might happen twice
  12812. // oh well....
  12813. inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
  12814. rgba = inst._rgba = parsed._rgba;
  12815. // exit each( stringParsers ) here because we matched
  12816. return false;
  12817. }
  12818. });
  12819. // Found a stringParser that handled it
  12820. if ( rgba.length ) {
  12821. // if this came from a parsed string, force "transparent" when alpha is 0
  12822. // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
  12823. if ( rgba.join() === "0,0,0,0" ) {
  12824. jQuery.extend( rgba, colors.transparent );
  12825. }
  12826. return inst;
  12827. }
  12828. // named colors
  12829. return colors[ string ];
  12830. }
  12831. color.fn = jQuery.extend( color.prototype, {
  12832. parse: function( red, green, blue, alpha ) {
  12833. if ( red === undefined ) {
  12834. this._rgba = [ null, null, null, null ];
  12835. return this;
  12836. }
  12837. if ( red.jquery || red.nodeType ) {
  12838. red = jQuery( red ).css( green );
  12839. green = undefined;
  12840. }
  12841. var inst = this,
  12842. type = jQuery.type( red ),
  12843. rgba = this._rgba = [];
  12844. // more than 1 argument specified - assume ( red, green, blue, alpha )
  12845. if ( green !== undefined ) {
  12846. red = [ red, green, blue, alpha ];
  12847. type = "array";
  12848. }
  12849. if ( type === "string" ) {
  12850. return this.parse( stringParse( red ) || colors._default );
  12851. }
  12852. if ( type === "array" ) {
  12853. each( spaces.rgba.props, function( key, prop ) {
  12854. rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
  12855. });
  12856. return this;
  12857. }
  12858. if ( type === "object" ) {
  12859. if ( red instanceof color ) {
  12860. each( spaces, function( spaceName, space ) {
  12861. if ( red[ space.cache ] ) {
  12862. inst[ space.cache ] = red[ space.cache ].slice();
  12863. }
  12864. });
  12865. } else {
  12866. each( spaces, function( spaceName, space ) {
  12867. var cache = space.cache;
  12868. each( space.props, function( key, prop ) {
  12869. // if the cache doesn't exist, and we know how to convert
  12870. if ( !inst[ cache ] && space.to ) {
  12871. // if the value was null, we don't need to copy it
  12872. // if the key was alpha, we don't need to copy it either
  12873. if ( key === "alpha" || red[ key ] == null ) {
  12874. return;
  12875. }
  12876. inst[ cache ] = space.to( inst._rgba );
  12877. }
  12878. // this is the only case where we allow nulls for ALL properties.
  12879. // call clamp with alwaysAllowEmpty
  12880. inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
  12881. });
  12882. // everything defined but alpha?
  12883. if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
  12884. // use the default of 1
  12885. inst[ cache ][ 3 ] = 1;
  12886. if ( space.from ) {
  12887. inst._rgba = space.from( inst[ cache ] );
  12888. }
  12889. }
  12890. });
  12891. }
  12892. return this;
  12893. }
  12894. },
  12895. is: function( compare ) {
  12896. var is = color( compare ),
  12897. same = true,
  12898. inst = this;
  12899. each( spaces, function( _, space ) {
  12900. var localCache,
  12901. isCache = is[ space.cache ];
  12902. if (isCache) {
  12903. localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
  12904. each( space.props, function( _, prop ) {
  12905. if ( isCache[ prop.idx ] != null ) {
  12906. same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
  12907. return same;
  12908. }
  12909. });
  12910. }
  12911. return same;
  12912. });
  12913. return same;
  12914. },
  12915. _space: function() {
  12916. var used = [],
  12917. inst = this;
  12918. each( spaces, function( spaceName, space ) {
  12919. if ( inst[ space.cache ] ) {
  12920. used.push( spaceName );
  12921. }
  12922. });
  12923. return used.pop();
  12924. },
  12925. transition: function( other, distance ) {
  12926. var end = color( other ),
  12927. spaceName = end._space(),
  12928. space = spaces[ spaceName ],
  12929. startColor = this.alpha() === 0 ? color( "transparent" ) : this,
  12930. start = startColor[ space.cache ] || space.to( startColor._rgba ),
  12931. result = start.slice();
  12932. end = end[ space.cache ];
  12933. each( space.props, function( key, prop ) {
  12934. var index = prop.idx,
  12935. startValue = start[ index ],
  12936. endValue = end[ index ],
  12937. type = propTypes[ prop.type ] || {};
  12938. // if null, don't override start value
  12939. if ( endValue === null ) {
  12940. return;
  12941. }
  12942. // if null - use end
  12943. if ( startValue === null ) {
  12944. result[ index ] = endValue;
  12945. } else {
  12946. if ( type.mod ) {
  12947. if ( endValue - startValue > type.mod / 2 ) {
  12948. startValue += type.mod;
  12949. } else if ( startValue - endValue > type.mod / 2 ) {
  12950. startValue -= type.mod;
  12951. }
  12952. }
  12953. result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
  12954. }
  12955. });
  12956. return this[ spaceName ]( result );
  12957. },
  12958. blend: function( opaque ) {
  12959. // if we are already opaque - return ourself
  12960. if ( this._rgba[ 3 ] === 1 ) {
  12961. return this;
  12962. }
  12963. var rgb = this._rgba.slice(),
  12964. a = rgb.pop(),
  12965. blend = color( opaque )._rgba;
  12966. return color( jQuery.map( rgb, function( v, i ) {
  12967. return ( 1 - a ) * blend[ i ] + a * v;
  12968. }));
  12969. },
  12970. toRgbaString: function() {
  12971. var prefix = "rgba(",
  12972. rgba = jQuery.map( this._rgba, function( v, i ) {
  12973. return v == null ? ( i > 2 ? 1 : 0 ) : v;
  12974. });
  12975. if ( rgba[ 3 ] === 1 ) {
  12976. rgba.pop();
  12977. prefix = "rgb(";
  12978. }
  12979. return prefix + rgba.join() + ")";
  12980. },
  12981. toHslaString: function() {
  12982. var prefix = "hsla(",
  12983. hsla = jQuery.map( this.hsla(), function( v, i ) {
  12984. if ( v == null ) {
  12985. v = i > 2 ? 1 : 0;
  12986. }
  12987. // catch 1 and 2
  12988. if ( i && i < 3 ) {
  12989. v = Math.round( v * 100 ) + "%";
  12990. }
  12991. return v;
  12992. });
  12993. if ( hsla[ 3 ] === 1 ) {
  12994. hsla.pop();
  12995. prefix = "hsl(";
  12996. }
  12997. return prefix + hsla.join() + ")";
  12998. },
  12999. toHexString: function( includeAlpha ) {
  13000. var rgba = this._rgba.slice(),
  13001. alpha = rgba.pop();
  13002. if ( includeAlpha ) {
  13003. rgba.push( ~~( alpha * 255 ) );
  13004. }
  13005. return "#" + jQuery.map( rgba, function( v ) {
  13006. // default to 0 when nulls exist
  13007. v = ( v || 0 ).toString( 16 );
  13008. return v.length === 1 ? "0" + v : v;
  13009. }).join("");
  13010. },
  13011. toString: function() {
  13012. return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
  13013. }
  13014. });
  13015. color.fn.parse.prototype = color.fn;
  13016. // hsla conversions adapted from:
  13017. // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
  13018. function hue2rgb( p, q, h ) {
  13019. h = ( h + 1 ) % 1;
  13020. if ( h * 6 < 1 ) {
  13021. return p + ( q - p ) * h * 6;
  13022. }
  13023. if ( h * 2 < 1) {
  13024. return q;
  13025. }
  13026. if ( h * 3 < 2 ) {
  13027. return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6;
  13028. }
  13029. return p;
  13030. }
  13031. spaces.hsla.to = function( rgba ) {
  13032. if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
  13033. return [ null, null, null, rgba[ 3 ] ];
  13034. }
  13035. var r = rgba[ 0 ] / 255,
  13036. g = rgba[ 1 ] / 255,
  13037. b = rgba[ 2 ] / 255,
  13038. a = rgba[ 3 ],
  13039. max = Math.max( r, g, b ),
  13040. min = Math.min( r, g, b ),
  13041. diff = max - min,
  13042. add = max + min,
  13043. l = add * 0.5,
  13044. h, s;
  13045. if ( min === max ) {
  13046. h = 0;
  13047. } else if ( r === max ) {
  13048. h = ( 60 * ( g - b ) / diff ) + 360;
  13049. } else if ( g === max ) {
  13050. h = ( 60 * ( b - r ) / diff ) + 120;
  13051. } else {
  13052. h = ( 60 * ( r - g ) / diff ) + 240;
  13053. }
  13054. // chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
  13055. // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
  13056. if ( diff === 0 ) {
  13057. s = 0;
  13058. } else if ( l <= 0.5 ) {
  13059. s = diff / add;
  13060. } else {
  13061. s = diff / ( 2 - add );
  13062. }
  13063. return [ Math.round(h) % 360, s, l, a == null ? 1 : a ];
  13064. };
  13065. spaces.hsla.from = function( hsla ) {
  13066. if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
  13067. return [ null, null, null, hsla[ 3 ] ];
  13068. }
  13069. var h = hsla[ 0 ] / 360,
  13070. s = hsla[ 1 ],
  13071. l = hsla[ 2 ],
  13072. a = hsla[ 3 ],
  13073. q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
  13074. p = 2 * l - q;
  13075. return [
  13076. Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
  13077. Math.round( hue2rgb( p, q, h ) * 255 ),
  13078. Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
  13079. a
  13080. ];
  13081. };
  13082. each( spaces, function( spaceName, space ) {
  13083. var props = space.props,
  13084. cache = space.cache,
  13085. to = space.to,
  13086. from = space.from;
  13087. // makes rgba() and hsla()
  13088. color.fn[ spaceName ] = function( value ) {
  13089. // generate a cache for this space if it doesn't exist
  13090. if ( to && !this[ cache ] ) {
  13091. this[ cache ] = to( this._rgba );
  13092. }
  13093. if ( value === undefined ) {
  13094. return this[ cache ].slice();
  13095. }
  13096. var ret,
  13097. type = jQuery.type( value ),
  13098. arr = ( type === "array" || type === "object" ) ? value : arguments,
  13099. local = this[ cache ].slice();
  13100. each( props, function( key, prop ) {
  13101. var val = arr[ type === "object" ? key : prop.idx ];
  13102. if ( val == null ) {
  13103. val = local[ prop.idx ];
  13104. }
  13105. local[ prop.idx ] = clamp( val, prop );
  13106. });
  13107. if ( from ) {
  13108. ret = color( from( local ) );
  13109. ret[ cache ] = local;
  13110. return ret;
  13111. } else {
  13112. return color( local );
  13113. }
  13114. };
  13115. // makes red() green() blue() alpha() hue() saturation() lightness()
  13116. each( props, function( key, prop ) {
  13117. // alpha is included in more than one space
  13118. if ( color.fn[ key ] ) {
  13119. return;
  13120. }
  13121. color.fn[ key ] = function( value ) {
  13122. var vtype = jQuery.type( value ),
  13123. fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
  13124. local = this[ fn ](),
  13125. cur = local[ prop.idx ],
  13126. match;
  13127. if ( vtype === "undefined" ) {
  13128. return cur;
  13129. }
  13130. if ( vtype === "function" ) {
  13131. value = value.call( this, cur );
  13132. vtype = jQuery.type( value );
  13133. }
  13134. if ( value == null && prop.empty ) {
  13135. return this;
  13136. }
  13137. if ( vtype === "string" ) {
  13138. match = rplusequals.exec( value );
  13139. if ( match ) {
  13140. value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
  13141. }
  13142. }
  13143. local[ prop.idx ] = value;
  13144. return this[ fn ]( local );
  13145. };
  13146. });
  13147. });
  13148. // add cssHook and .fx.step function for each named hook.
  13149. // accept a space separated string of properties
  13150. color.hook = function( hook ) {
  13151. var hooks = hook.split( " " );
  13152. each( hooks, function( i, hook ) {
  13153. jQuery.cssHooks[ hook ] = {
  13154. set: function( elem, value ) {
  13155. var parsed, curElem,
  13156. backgroundColor = "";
  13157. if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) {
  13158. value = color( parsed || value );
  13159. if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
  13160. curElem = hook === "backgroundColor" ? elem.parentNode : elem;
  13161. while (
  13162. (backgroundColor === "" || backgroundColor === "transparent") &&
  13163. curElem && curElem.style
  13164. ) {
  13165. try {
  13166. backgroundColor = jQuery.css( curElem, "backgroundColor" );
  13167. curElem = curElem.parentNode;
  13168. } catch ( e ) {
  13169. }
  13170. }
  13171. value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
  13172. backgroundColor :
  13173. "_default" );
  13174. }
  13175. value = value.toRgbaString();
  13176. }
  13177. try {
  13178. elem.style[ hook ] = value;
  13179. } catch ( e ) {
  13180. // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
  13181. }
  13182. }
  13183. };
  13184. jQuery.fx.step[ hook ] = function( fx ) {
  13185. if ( !fx.colorInit ) {
  13186. fx.start = color( fx.elem, hook );
  13187. fx.end = color( fx.end );
  13188. fx.colorInit = true;
  13189. }
  13190. jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
  13191. };
  13192. });
  13193. };
  13194. color.hook( stepHooks );
  13195. jQuery.cssHooks.borderColor = {
  13196. expand: function( value ) {
  13197. var expanded = {};
  13198. each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
  13199. expanded[ "border" + part + "Color" ] = value;
  13200. });
  13201. return expanded;
  13202. }
  13203. };
  13204. // Basic color names only.
  13205. // Usage of any of the other color names requires adding yourself or including
  13206. // jquery.color.svg-names.js.
  13207. colors = jQuery.Color.names = {
  13208. // 4.1. Basic color keywords
  13209. aqua: "#00ffff",
  13210. black: "#000000",
  13211. blue: "#0000ff",
  13212. fuchsia: "#ff00ff",
  13213. gray: "#808080",
  13214. green: "#008000",
  13215. lime: "#00ff00",
  13216. maroon: "#800000",
  13217. navy: "#000080",
  13218. olive: "#808000",
  13219. purple: "#800080",
  13220. red: "#ff0000",
  13221. silver: "#c0c0c0",
  13222. teal: "#008080",
  13223. white: "#ffffff",
  13224. yellow: "#ffff00",
  13225. // 4.2.3. "transparent" color keyword
  13226. transparent: [ null, null, null, 0 ],
  13227. _default: "#ffffff"
  13228. };
  13229. })( jQuery );
  13230. /******************************************************************************/
  13231. /****************************** CLASS ANIMATIONS ******************************/
  13232. /******************************************************************************/
  13233. (function() {
  13234. var classAnimationActions = [ "add", "remove", "toggle" ],
  13235. shorthandStyles = {
  13236. border: 1,
  13237. borderBottom: 1,
  13238. borderColor: 1,
  13239. borderLeft: 1,
  13240. borderRight: 1,
  13241. borderTop: 1,
  13242. borderWidth: 1,
  13243. margin: 1,
  13244. padding: 1
  13245. };
  13246. $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) {
  13247. $.fx.step[ prop ] = function( fx ) {
  13248. if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
  13249. jQuery.style( fx.elem, prop, fx.end );
  13250. fx.setAttr = true;
  13251. }
  13252. };
  13253. });
  13254. function getElementStyles( elem ) {
  13255. var key, len,
  13256. style = elem.ownerDocument.defaultView ?
  13257. elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
  13258. elem.currentStyle,
  13259. styles = {};
  13260. if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
  13261. len = style.length;
  13262. while ( len-- ) {
  13263. key = style[ len ];
  13264. if ( typeof style[ key ] === "string" ) {
  13265. styles[ $.camelCase( key ) ] = style[ key ];
  13266. }
  13267. }
  13268. // support: Opera, IE <9
  13269. } else {
  13270. for ( key in style ) {
  13271. if ( typeof style[ key ] === "string" ) {
  13272. styles[ key ] = style[ key ];
  13273. }
  13274. }
  13275. }
  13276. return styles;
  13277. }
  13278. function styleDifference( oldStyle, newStyle ) {
  13279. var diff = {},
  13280. name, value;
  13281. for ( name in newStyle ) {
  13282. value = newStyle[ name ];
  13283. if ( oldStyle[ name ] !== value ) {
  13284. if ( !shorthandStyles[ name ] ) {
  13285. if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
  13286. diff[ name ] = value;
  13287. }
  13288. }
  13289. }
  13290. }
  13291. return diff;
  13292. }
  13293. // support: jQuery <1.8
  13294. if ( !$.fn.addBack ) {
  13295. $.fn.addBack = function( selector ) {
  13296. return this.add( selector == null ?
  13297. this.prevObject : this.prevObject.filter( selector )
  13298. );
  13299. };
  13300. }
  13301. $.effects.animateClass = function( value, duration, easing, callback ) {
  13302. var o = $.speed( duration, easing, callback );
  13303. return this.queue( function() {
  13304. var animated = $( this ),
  13305. baseClass = animated.attr( "class" ) || "",
  13306. applyClassChange,
  13307. allAnimations = o.children ? animated.find( "*" ).addBack() : animated;
  13308. // map the animated objects to store the original styles.
  13309. allAnimations = allAnimations.map(function() {
  13310. var el = $( this );
  13311. return {
  13312. el: el,
  13313. start: getElementStyles( this )
  13314. };
  13315. });
  13316. // apply class change
  13317. applyClassChange = function() {
  13318. $.each( classAnimationActions, function(i, action) {
  13319. if ( value[ action ] ) {
  13320. animated[ action + "Class" ]( value[ action ] );
  13321. }
  13322. });
  13323. };
  13324. applyClassChange();
  13325. // map all animated objects again - calculate new styles and diff
  13326. allAnimations = allAnimations.map(function() {
  13327. this.end = getElementStyles( this.el[ 0 ] );
  13328. this.diff = styleDifference( this.start, this.end );
  13329. return this;
  13330. });
  13331. // apply original class
  13332. animated.attr( "class", baseClass );
  13333. // map all animated objects again - this time collecting a promise
  13334. allAnimations = allAnimations.map(function() {
  13335. var styleInfo = this,
  13336. dfd = $.Deferred(),
  13337. opts = $.extend({}, o, {
  13338. queue: false,
  13339. complete: function() {
  13340. dfd.resolve( styleInfo );
  13341. }
  13342. });
  13343. this.el.animate( this.diff, opts );
  13344. return dfd.promise();
  13345. });
  13346. // once all animations have completed:
  13347. $.when.apply( $, allAnimations.get() ).done(function() {
  13348. // set the final class
  13349. applyClassChange();
  13350. // for each animated element,
  13351. // clear all css properties that were animated
  13352. $.each( arguments, function() {
  13353. var el = this.el;
  13354. $.each( this.diff, function(key) {
  13355. el.css( key, "" );
  13356. });
  13357. });
  13358. // this is guarnteed to be there if you use jQuery.speed()
  13359. // it also handles dequeuing the next anim...
  13360. o.complete.call( animated[ 0 ] );
  13361. });
  13362. });
  13363. };
  13364. $.fn.extend({
  13365. addClass: (function( orig ) {
  13366. return function( classNames, speed, easing, callback ) {
  13367. return speed ?
  13368. $.effects.animateClass.call( this,
  13369. { add: classNames }, speed, easing, callback ) :
  13370. orig.apply( this, arguments );
  13371. };
  13372. })( $.fn.addClass ),
  13373. removeClass: (function( orig ) {
  13374. return function( classNames, speed, easing, callback ) {
  13375. return arguments.length > 1 ?
  13376. $.effects.animateClass.call( this,
  13377. { remove: classNames }, speed, easing, callback ) :
  13378. orig.apply( this, arguments );
  13379. };
  13380. })( $.fn.removeClass ),
  13381. toggleClass: (function( orig ) {
  13382. return function( classNames, force, speed, easing, callback ) {
  13383. if ( typeof force === "boolean" || force === undefined ) {
  13384. if ( !speed ) {
  13385. // without speed parameter
  13386. return orig.apply( this, arguments );
  13387. } else {
  13388. return $.effects.animateClass.call( this,
  13389. (force ? { add: classNames } : { remove: classNames }),
  13390. speed, easing, callback );
  13391. }
  13392. } else {
  13393. // without force parameter
  13394. return $.effects.animateClass.call( this,
  13395. { toggle: classNames }, force, speed, easing );
  13396. }
  13397. };
  13398. })( $.fn.toggleClass ),
  13399. switchClass: function( remove, add, speed, easing, callback) {
  13400. return $.effects.animateClass.call( this, {
  13401. add: add,
  13402. remove: remove
  13403. }, speed, easing, callback );
  13404. }
  13405. });
  13406. })();
  13407. /******************************************************************************/
  13408. /*********************************** EFFECTS **********************************/
  13409. /******************************************************************************/
  13410. (function() {
  13411. $.extend( $.effects, {
  13412. version: "1.11.4",
  13413. // Saves a set of properties in a data storage
  13414. save: function( element, set ) {
  13415. for ( var i = 0; i < set.length; i++ ) {
  13416. if ( set[ i ] !== null ) {
  13417. element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
  13418. }
  13419. }
  13420. },
  13421. // Restores a set of previously saved properties from a data storage
  13422. restore: function( element, set ) {
  13423. var val, i;
  13424. for ( i = 0; i < set.length; i++ ) {
  13425. if ( set[ i ] !== null ) {
  13426. val = element.data( dataSpace + set[ i ] );
  13427. // support: jQuery 1.6.2
  13428. // http://bugs.jquery.com/ticket/9917
  13429. // jQuery 1.6.2 incorrectly returns undefined for any falsy value.
  13430. // We can't differentiate between "" and 0 here, so we just assume
  13431. // empty string since it's likely to be a more common value...
  13432. if ( val === undefined ) {
  13433. val = "";
  13434. }
  13435. element.css( set[ i ], val );
  13436. }
  13437. }
  13438. },
  13439. setMode: function( el, mode ) {
  13440. if (mode === "toggle") {
  13441. mode = el.is( ":hidden" ) ? "show" : "hide";
  13442. }
  13443. return mode;
  13444. },
  13445. // Translates a [top,left] array into a baseline value
  13446. // this should be a little more flexible in the future to handle a string & hash
  13447. getBaseline: function( origin, original ) {
  13448. var y, x;
  13449. switch ( origin[ 0 ] ) {
  13450. case "top": y = 0; break;
  13451. case "middle": y = 0.5; break;
  13452. case "bottom": y = 1; break;
  13453. default: y = origin[ 0 ] / original.height;
  13454. }
  13455. switch ( origin[ 1 ] ) {
  13456. case "left": x = 0; break;
  13457. case "center": x = 0.5; break;
  13458. case "right": x = 1; break;
  13459. default: x = origin[ 1 ] / original.width;
  13460. }
  13461. return {
  13462. x: x,
  13463. y: y
  13464. };
  13465. },
  13466. // Wraps the element around a wrapper that copies position properties
  13467. createWrapper: function( element ) {
  13468. // if the element is already wrapped, return it
  13469. if ( element.parent().is( ".ui-effects-wrapper" )) {
  13470. return element.parent();
  13471. }
  13472. // wrap the element
  13473. var props = {
  13474. width: element.outerWidth(true),
  13475. height: element.outerHeight(true),
  13476. "float": element.css( "float" )
  13477. },
  13478. wrapper = $( "<div></div>" )
  13479. .addClass( "ui-effects-wrapper" )
  13480. .css({
  13481. fontSize: "100%",
  13482. background: "transparent",
  13483. border: "none",
  13484. margin: 0,
  13485. padding: 0
  13486. }),
  13487. // Store the size in case width/height are defined in % - Fixes #5245
  13488. size = {
  13489. width: element.width(),
  13490. height: element.height()
  13491. },
  13492. active = document.activeElement;
  13493. // support: Firefox
  13494. // Firefox incorrectly exposes anonymous content
  13495. // https://bugzilla.mozilla.org/show_bug.cgi?id=561664
  13496. try {
  13497. active.id;
  13498. } catch ( e ) {
  13499. active = document.body;
  13500. }
  13501. element.wrap( wrapper );
  13502. // Fixes #7595 - Elements lose focus when wrapped.
  13503. if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
  13504. $( active ).focus();
  13505. }
  13506. wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element
  13507. // transfer positioning properties to the wrapper
  13508. if ( element.css( "position" ) === "static" ) {
  13509. wrapper.css({ position: "relative" });
  13510. element.css({ position: "relative" });
  13511. } else {
  13512. $.extend( props, {
  13513. position: element.css( "position" ),
  13514. zIndex: element.css( "z-index" )
  13515. });
  13516. $.each([ "top", "left", "bottom", "right" ], function(i, pos) {
  13517. props[ pos ] = element.css( pos );
  13518. if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
  13519. props[ pos ] = "auto";
  13520. }
  13521. });
  13522. element.css({
  13523. position: "relative",
  13524. top: 0,
  13525. left: 0,
  13526. right: "auto",
  13527. bottom: "auto"
  13528. });
  13529. }
  13530. element.css(size);
  13531. return wrapper.css( props ).show();
  13532. },
  13533. removeWrapper: function( element ) {
  13534. var active = document.activeElement;
  13535. if ( element.parent().is( ".ui-effects-wrapper" ) ) {
  13536. element.parent().replaceWith( element );
  13537. // Fixes #7595 - Elements lose focus when wrapped.
  13538. if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
  13539. $( active ).focus();
  13540. }
  13541. }
  13542. return element;
  13543. },
  13544. setTransition: function( element, list, factor, value ) {
  13545. value = value || {};
  13546. $.each( list, function( i, x ) {
  13547. var unit = element.cssUnit( x );
  13548. if ( unit[ 0 ] > 0 ) {
  13549. value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
  13550. }
  13551. });
  13552. return value;
  13553. }
  13554. });
  13555. // return an effect options object for the given parameters:
  13556. function _normalizeArguments( effect, options, speed, callback ) {
  13557. // allow passing all options as the first parameter
  13558. if ( $.isPlainObject( effect ) ) {
  13559. options = effect;
  13560. effect = effect.effect;
  13561. }
  13562. // convert to an object
  13563. effect = { effect: effect };
  13564. // catch (effect, null, ...)
  13565. if ( options == null ) {
  13566. options = {};
  13567. }
  13568. // catch (effect, callback)
  13569. if ( $.isFunction( options ) ) {
  13570. callback = options;
  13571. speed = null;
  13572. options = {};
  13573. }
  13574. // catch (effect, speed, ?)
  13575. if ( typeof options === "number" || $.fx.speeds[ options ] ) {
  13576. callback = speed;
  13577. speed = options;
  13578. options = {};
  13579. }
  13580. // catch (effect, options, callback)
  13581. if ( $.isFunction( speed ) ) {
  13582. callback = speed;
  13583. speed = null;
  13584. }
  13585. // add options to effect
  13586. if ( options ) {
  13587. $.extend( effect, options );
  13588. }
  13589. speed = speed || options.duration;
  13590. effect.duration = $.fx.off ? 0 :
  13591. typeof speed === "number" ? speed :
  13592. speed in $.fx.speeds ? $.fx.speeds[ speed ] :
  13593. $.fx.speeds._default;
  13594. effect.complete = callback || options.complete;
  13595. return effect;
  13596. }
  13597. function standardAnimationOption( option ) {
  13598. // Valid standard speeds (nothing, number, named speed)
  13599. if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) {
  13600. return true;
  13601. }
  13602. // Invalid strings - treat as "normal" speed
  13603. if ( typeof option === "string" && !$.effects.effect[ option ] ) {
  13604. return true;
  13605. }
  13606. // Complete callback
  13607. if ( $.isFunction( option ) ) {
  13608. return true;
  13609. }
  13610. // Options hash (but not naming an effect)
  13611. if ( typeof option === "object" && !option.effect ) {
  13612. return true;
  13613. }
  13614. // Didn't match any standard API
  13615. return false;
  13616. }
  13617. $.fn.extend({
  13618. effect: function( /* effect, options, speed, callback */ ) {
  13619. var args = _normalizeArguments.apply( this, arguments ),
  13620. mode = args.mode,
  13621. queue = args.queue,
  13622. effectMethod = $.effects.effect[ args.effect ];
  13623. if ( $.fx.off || !effectMethod ) {
  13624. // delegate to the original method (e.g., .show()) if possible
  13625. if ( mode ) {
  13626. return this[ mode ]( args.duration, args.complete );
  13627. } else {
  13628. return this.each( function() {
  13629. if ( args.complete ) {
  13630. args.complete.call( this );
  13631. }
  13632. });
  13633. }
  13634. }
  13635. function run( next ) {
  13636. var elem = $( this ),
  13637. complete = args.complete,
  13638. mode = args.mode;
  13639. function done() {
  13640. if ( $.isFunction( complete ) ) {
  13641. complete.call( elem[0] );
  13642. }
  13643. if ( $.isFunction( next ) ) {
  13644. next();
  13645. }
  13646. }
  13647. // If the element already has the correct final state, delegate to
  13648. // the core methods so the internal tracking of "olddisplay" works.
  13649. if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
  13650. elem[ mode ]();
  13651. done();
  13652. } else {
  13653. effectMethod.call( elem[0], args, done );
  13654. }
  13655. }
  13656. return queue === false ? this.each( run ) : this.queue( queue || "fx", run );
  13657. },
  13658. show: (function( orig ) {
  13659. return function( option ) {
  13660. if ( standardAnimationOption( option ) ) {
  13661. return orig.apply( this, arguments );
  13662. } else {
  13663. var args = _normalizeArguments.apply( this, arguments );
  13664. args.mode = "show";
  13665. return this.effect.call( this, args );
  13666. }
  13667. };
  13668. })( $.fn.show ),
  13669. hide: (function( orig ) {
  13670. return function( option ) {
  13671. if ( standardAnimationOption( option ) ) {
  13672. return orig.apply( this, arguments );
  13673. } else {
  13674. var args = _normalizeArguments.apply( this, arguments );
  13675. args.mode = "hide";
  13676. return this.effect.call( this, args );
  13677. }
  13678. };
  13679. })( $.fn.hide ),
  13680. toggle: (function( orig ) {
  13681. return function( option ) {
  13682. if ( standardAnimationOption( option ) || typeof option === "boolean" ) {
  13683. return orig.apply( this, arguments );
  13684. } else {
  13685. var args = _normalizeArguments.apply( this, arguments );
  13686. args.mode = "toggle";
  13687. return this.effect.call( this, args );
  13688. }
  13689. };
  13690. })( $.fn.toggle ),
  13691. // helper functions
  13692. cssUnit: function(key) {
  13693. var style = this.css( key ),
  13694. val = [];
  13695. $.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
  13696. if ( style.indexOf( unit ) > 0 ) {
  13697. val = [ parseFloat( style ), unit ];
  13698. }
  13699. });
  13700. return val;
  13701. }
  13702. });
  13703. })();
  13704. /******************************************************************************/
  13705. /*********************************** EASING ***********************************/
  13706. /******************************************************************************/
  13707. (function() {
  13708. // based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
  13709. var baseEasings = {};
  13710. $.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
  13711. baseEasings[ name ] = function( p ) {
  13712. return Math.pow( p, i + 2 );
  13713. };
  13714. });
  13715. $.extend( baseEasings, {
  13716. Sine: function( p ) {
  13717. return 1 - Math.cos( p * Math.PI / 2 );
  13718. },
  13719. Circ: function( p ) {
  13720. return 1 - Math.sqrt( 1 - p * p );
  13721. },
  13722. Elastic: function( p ) {
  13723. return p === 0 || p === 1 ? p :
  13724. -Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 );
  13725. },
  13726. Back: function( p ) {
  13727. return p * p * ( 3 * p - 2 );
  13728. },
  13729. Bounce: function( p ) {
  13730. var pow2,
  13731. bounce = 4;
  13732. while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
  13733. return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
  13734. }
  13735. });
  13736. $.each( baseEasings, function( name, easeIn ) {
  13737. $.easing[ "easeIn" + name ] = easeIn;
  13738. $.easing[ "easeOut" + name ] = function( p ) {
  13739. return 1 - easeIn( 1 - p );
  13740. };
  13741. $.easing[ "easeInOut" + name ] = function( p ) {
  13742. return p < 0.5 ?
  13743. easeIn( p * 2 ) / 2 :
  13744. 1 - easeIn( p * -2 + 2 ) / 2;
  13745. };
  13746. });
  13747. })();
  13748. var effect = $.effects;
  13749. /*!
  13750. * jQuery UI Effects Slide 1.11.4
  13751. * http://jqueryui.com
  13752. *
  13753. * Copyright jQuery Foundation and other contributors
  13754. * Released under the MIT license.
  13755. * http://jquery.org/license
  13756. *
  13757. * http://api.jqueryui.com/slide-effect/
  13758. */
  13759. /*var effectSlide = $.effects.effect.slide = function( o, done ) {
  13760. // Create element
  13761. var el = $( this ),
  13762. props = [ "position", "top", "bottom", "left", "right", "width", "height" ],
  13763. mode = $.effects.setMode( el, o.mode || "show" ),
  13764. show = mode === "show",
  13765. direction = o.direction || "left",
  13766. ref = (direction === "up" || direction === "down") ? "top" : "left",
  13767. positiveMotion = (direction === "up" || direction === "left"),
  13768. distance,
  13769. animation = {};
  13770. // Adjust
  13771. $.effects.save( el, props );
  13772. el.show();
  13773. distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true );
  13774. $.effects.createWrapper( el ).css({
  13775. overflow: "hidden"
  13776. });
  13777. if ( show ) {
  13778. el.css( ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance );
  13779. }
  13780. // Animation
  13781. animation[ ref ] = ( show ?
  13782. ( positiveMotion ? "+=" : "-=") :
  13783. ( positiveMotion ? "-=" : "+=")) +
  13784. distance;
  13785. // Animate
  13786. el.animate( animation, {
  13787. queue: false,
  13788. duration: o.duration,
  13789. easing: o.easing,
  13790. complete: function() {
  13791. if ( mode === "hide" ) {
  13792. el.hide();
  13793. }
  13794. $.effects.restore( el, props );
  13795. $.effects.removeWrapper( el );
  13796. done();
  13797. }
  13798. });
  13799. };
  13800. */
  13801. }));
  13802. /**!
  13803. * @fileOverview Kickass library to create and place poppers near their reference elements.
  13804. * @version 1.15.0
  13805. * @license
  13806. * Copyright (c) 2016 Federico Zivolo and contributors
  13807. *
  13808. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13809. * of this software and associated documentation files (the "Software"), to deal
  13810. * in the Software without restriction, including without limitation the rights
  13811. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13812. * copies of the Software, and to permit persons to whom the Software is
  13813. * furnished to do so, subject to the following conditions:
  13814. *
  13815. * The above copyright notice and this permission notice shall be included in all
  13816. * copies or substantial portions of the Software.
  13817. *
  13818. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13819. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13820. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13821. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  13822. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  13823. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  13824. * SOFTWARE.
  13825. */
  13826. (function (global, factory) {
  13827. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  13828. typeof define === 'function' && define.amd ? define(factory) :
  13829. (global.Popper = factory());
  13830. }(this, (function () { 'use strict';
  13831. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
  13832. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  13833. var timeoutDuration = 0;
  13834. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  13835. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  13836. timeoutDuration = 1;
  13837. break;
  13838. }
  13839. }
  13840. function microtaskDebounce(fn) {
  13841. var called = false;
  13842. return function () {
  13843. if (called) {
  13844. return;
  13845. }
  13846. called = true;
  13847. window.Promise.resolve().then(function () {
  13848. called = false;
  13849. fn();
  13850. });
  13851. };
  13852. }
  13853. function taskDebounce(fn) {
  13854. var scheduled = false;
  13855. return function () {
  13856. if (!scheduled) {
  13857. scheduled = true;
  13858. setTimeout(function () {
  13859. scheduled = false;
  13860. fn();
  13861. }, timeoutDuration);
  13862. }
  13863. };
  13864. }
  13865. var supportsMicroTasks = isBrowser && window.Promise;
  13866. /**
  13867. * Create a debounced version of a method, that's asynchronously deferred
  13868. * but called in the minimum time possible.
  13869. *
  13870. * @method
  13871. * @memberof Popper.Utils
  13872. * @argument {Function} fn
  13873. * @returns {Function}
  13874. */
  13875. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  13876. /**
  13877. * Check if the given variable is a function
  13878. * @method
  13879. * @memberof Popper.Utils
  13880. * @argument {Any} functionToCheck - variable to check
  13881. * @returns {Boolean} answer to: is a function?
  13882. */
  13883. function isFunction(functionToCheck) {
  13884. var getType = {};
  13885. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  13886. }
  13887. /**
  13888. * Get CSS computed property of the given element
  13889. * @method
  13890. * @memberof Popper.Utils
  13891. * @argument {Eement} element
  13892. * @argument {String} property
  13893. */
  13894. function getStyleComputedProperty(element, property) {
  13895. if (element.nodeType !== 1) {
  13896. return [];
  13897. }
  13898. // NOTE: 1 DOM access here
  13899. var window = element.ownerDocument.defaultView;
  13900. var css = window.getComputedStyle(element, null);
  13901. return property ? css[property] : css;
  13902. }
  13903. /**
  13904. * Returns the parentNode or the host of the element
  13905. * @method
  13906. * @memberof Popper.Utils
  13907. * @argument {Element} element
  13908. * @returns {Element} parent
  13909. */
  13910. function getParentNode(element) {
  13911. if (element.nodeName === 'HTML') {
  13912. return element;
  13913. }
  13914. return element.parentNode || element.host;
  13915. }
  13916. /**
  13917. * Returns the scrolling parent of the given element
  13918. * @method
  13919. * @memberof Popper.Utils
  13920. * @argument {Element} element
  13921. * @returns {Element} scroll parent
  13922. */
  13923. function getScrollParent(element) {
  13924. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  13925. if (!element) {
  13926. return document.body;
  13927. }
  13928. switch (element.nodeName) {
  13929. case 'HTML':
  13930. case 'BODY':
  13931. return element.ownerDocument.body;
  13932. case '#document':
  13933. return element.body;
  13934. }
  13935. // Firefox want us to check `-x` and `-y` variations as well
  13936. var _getStyleComputedProp = getStyleComputedProperty(element),
  13937. overflow = _getStyleComputedProp.overflow,
  13938. overflowX = _getStyleComputedProp.overflowX,
  13939. overflowY = _getStyleComputedProp.overflowY;
  13940. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  13941. return element;
  13942. }
  13943. return getScrollParent(getParentNode(element));
  13944. }
  13945. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  13946. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  13947. /**
  13948. * Determines if the browser is Internet Explorer
  13949. * @method
  13950. * @memberof Popper.Utils
  13951. * @param {Number} version to check
  13952. * @returns {Boolean} isIE
  13953. */
  13954. function isIE(version) {
  13955. if (version === 11) {
  13956. return isIE11;
  13957. }
  13958. if (version === 10) {
  13959. return isIE10;
  13960. }
  13961. return isIE11 || isIE10;
  13962. }
  13963. /**
  13964. * Returns the offset parent of the given element
  13965. * @method
  13966. * @memberof Popper.Utils
  13967. * @argument {Element} element
  13968. * @returns {Element} offset parent
  13969. */
  13970. function getOffsetParent(element) {
  13971. if (!element) {
  13972. return document.documentElement;
  13973. }
  13974. var noOffsetParent = isIE(10) ? document.body : null;
  13975. // NOTE: 1 DOM access here
  13976. var offsetParent = element.offsetParent || null;
  13977. // Skip hidden elements which don't have an offsetParent
  13978. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  13979. offsetParent = (element = element.nextElementSibling).offsetParent;
  13980. }
  13981. var nodeName = offsetParent && offsetParent.nodeName;
  13982. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  13983. return element ? element.ownerDocument.documentElement : document.documentElement;
  13984. }
  13985. // .offsetParent will return the closest TH, TD or TABLE in case
  13986. // no offsetParent is present, I hate this job...
  13987. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  13988. return getOffsetParent(offsetParent);
  13989. }
  13990. return offsetParent;
  13991. }
  13992. function isOffsetContainer(element) {
  13993. var nodeName = element.nodeName;
  13994. if (nodeName === 'BODY') {
  13995. return false;
  13996. }
  13997. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  13998. }
  13999. /**
  14000. * Finds the root node (document, shadowDOM root) of the given element
  14001. * @method
  14002. * @memberof Popper.Utils
  14003. * @argument {Element} node
  14004. * @returns {Element} root node
  14005. */
  14006. function getRoot(node) {
  14007. if (node.parentNode !== null) {
  14008. return getRoot(node.parentNode);
  14009. }
  14010. return node;
  14011. }
  14012. /**
  14013. * Finds the offset parent common to the two provided nodes
  14014. * @method
  14015. * @memberof Popper.Utils
  14016. * @argument {Element} element1
  14017. * @argument {Element} element2
  14018. * @returns {Element} common offset parent
  14019. */
  14020. function findCommonOffsetParent(element1, element2) {
  14021. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  14022. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  14023. return document.documentElement;
  14024. }
  14025. // Here we make sure to give as "start" the element that comes first in the DOM
  14026. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  14027. var start = order ? element1 : element2;
  14028. var end = order ? element2 : element1;
  14029. // Get common ancestor container
  14030. var range = document.createRange();
  14031. range.setStart(start, 0);
  14032. range.setEnd(end, 0);
  14033. var commonAncestorContainer = range.commonAncestorContainer;
  14034. // Both nodes are inside #document
  14035. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  14036. if (isOffsetContainer(commonAncestorContainer)) {
  14037. return commonAncestorContainer;
  14038. }
  14039. return getOffsetParent(commonAncestorContainer);
  14040. }
  14041. // one of the nodes is inside shadowDOM, find which one
  14042. var element1root = getRoot(element1);
  14043. if (element1root.host) {
  14044. return findCommonOffsetParent(element1root.host, element2);
  14045. } else {
  14046. return findCommonOffsetParent(element1, getRoot(element2).host);
  14047. }
  14048. }
  14049. /**
  14050. * Gets the scroll value of the given element in the given side (top and left)
  14051. * @method
  14052. * @memberof Popper.Utils
  14053. * @argument {Element} element
  14054. * @argument {String} side `top` or `left`
  14055. * @returns {number} amount of scrolled pixels
  14056. */
  14057. function getScroll(element) {
  14058. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  14059. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  14060. var nodeName = element.nodeName;
  14061. if (nodeName === 'BODY' || nodeName === 'HTML') {
  14062. var html = element.ownerDocument.documentElement;
  14063. var scrollingElement = element.ownerDocument.scrollingElement || html;
  14064. return scrollingElement[upperSide];
  14065. }
  14066. return element[upperSide];
  14067. }
  14068. /*
  14069. * Sum or subtract the element scroll values (left and top) from a given rect object
  14070. * @method
  14071. * @memberof Popper.Utils
  14072. * @param {Object} rect - Rect object you want to change
  14073. * @param {HTMLElement} element - The element from the function reads the scroll values
  14074. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  14075. * @return {Object} rect - The modifier rect object
  14076. */
  14077. function includeScroll(rect, element) {
  14078. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  14079. var scrollTop = getScroll(element, 'top');
  14080. var scrollLeft = getScroll(element, 'left');
  14081. var modifier = subtract ? -1 : 1;
  14082. rect.top += scrollTop * modifier;
  14083. rect.bottom += scrollTop * modifier;
  14084. rect.left += scrollLeft * modifier;
  14085. rect.right += scrollLeft * modifier;
  14086. return rect;
  14087. }
  14088. /*
  14089. * Helper to detect borders of a given element
  14090. * @method
  14091. * @memberof Popper.Utils
  14092. * @param {CSSStyleDeclaration} styles
  14093. * Result of `getStyleComputedProperty` on the given element
  14094. * @param {String} axis - `x` or `y`
  14095. * @return {number} borders - The borders size of the given axis
  14096. */
  14097. function getBordersSize(styles, axis) {
  14098. var sideA = axis === 'x' ? 'Left' : 'Top';
  14099. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  14100. return parseFloat(styles['border' + sideA + 'Width'], 10) + parseFloat(styles['border' + sideB + 'Width'], 10);
  14101. }
  14102. function getSize(axis, body, html, computedStyle) {
  14103. return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0);
  14104. }
  14105. function getWindowSizes(document) {
  14106. var body = document.body;
  14107. var html = document.documentElement;
  14108. var computedStyle = isIE(10) && getComputedStyle(html);
  14109. return {
  14110. height: getSize('Height', body, html, computedStyle),
  14111. width: getSize('Width', body, html, computedStyle)
  14112. };
  14113. }
  14114. var classCallCheck = function (instance, Constructor) {
  14115. if (!(instance instanceof Constructor)) {
  14116. throw new TypeError("Cannot call a class as a function");
  14117. }
  14118. };
  14119. var createClass = function () {
  14120. function defineProperties(target, props) {
  14121. for (var i = 0; i < props.length; i++) {
  14122. var descriptor = props[i];
  14123. descriptor.enumerable = descriptor.enumerable || false;
  14124. descriptor.configurable = true;
  14125. if ("value" in descriptor) descriptor.writable = true;
  14126. Object.defineProperty(target, descriptor.key, descriptor);
  14127. }
  14128. }
  14129. return function (Constructor, protoProps, staticProps) {
  14130. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  14131. if (staticProps) defineProperties(Constructor, staticProps);
  14132. return Constructor;
  14133. };
  14134. }();
  14135. var defineProperty = function (obj, key, value) {
  14136. if (key in obj) {
  14137. Object.defineProperty(obj, key, {
  14138. value: value,
  14139. enumerable: true,
  14140. configurable: true,
  14141. writable: true
  14142. });
  14143. } else {
  14144. obj[key] = value;
  14145. }
  14146. return obj;
  14147. };
  14148. var _extends = Object.assign || function (target) {
  14149. for (var i = 1; i < arguments.length; i++) {
  14150. var source = arguments[i];
  14151. for (var key in source) {
  14152. if (Object.prototype.hasOwnProperty.call(source, key)) {
  14153. target[key] = source[key];
  14154. }
  14155. }
  14156. }
  14157. return target;
  14158. };
  14159. /**
  14160. * Given element offsets, generate an output similar to getBoundingClientRect
  14161. * @method
  14162. * @memberof Popper.Utils
  14163. * @argument {Object} offsets
  14164. * @returns {Object} ClientRect like output
  14165. */
  14166. function getClientRect(offsets) {
  14167. return _extends({}, offsets, {
  14168. right: offsets.left + offsets.width,
  14169. bottom: offsets.top + offsets.height
  14170. });
  14171. }
  14172. /**
  14173. * Get bounding client rect of given element
  14174. * @method
  14175. * @memberof Popper.Utils
  14176. * @param {HTMLElement} element
  14177. * @return {Object} client rect
  14178. */
  14179. function getBoundingClientRect(element) {
  14180. var rect = {};
  14181. // IE10 10 FIX: Please, don't ask, the element isn't
  14182. // considered in DOM in some circumstances...
  14183. // This isn't reproducible in IE10 compatibility mode of IE11
  14184. try {
  14185. if (isIE(10)) {
  14186. rect = element.getBoundingClientRect();
  14187. var scrollTop = getScroll(element, 'top');
  14188. var scrollLeft = getScroll(element, 'left');
  14189. rect.top += scrollTop;
  14190. rect.left += scrollLeft;
  14191. rect.bottom += scrollTop;
  14192. rect.right += scrollLeft;
  14193. } else {
  14194. rect = element.getBoundingClientRect();
  14195. }
  14196. } catch (e) {}
  14197. var result = {
  14198. left: rect.left,
  14199. top: rect.top,
  14200. width: rect.right - rect.left,
  14201. height: rect.bottom - rect.top
  14202. };
  14203. // subtract scrollbar size from sizes
  14204. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  14205. var width = sizes.width || element.clientWidth || result.right - result.left;
  14206. var height = sizes.height || element.clientHeight || result.bottom - result.top;
  14207. var horizScrollbar = element.offsetWidth - width;
  14208. var vertScrollbar = element.offsetHeight - height;
  14209. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  14210. // we make this check conditional for performance reasons
  14211. if (horizScrollbar || vertScrollbar) {
  14212. var styles = getStyleComputedProperty(element);
  14213. horizScrollbar -= getBordersSize(styles, 'x');
  14214. vertScrollbar -= getBordersSize(styles, 'y');
  14215. result.width -= horizScrollbar;
  14216. result.height -= vertScrollbar;
  14217. }
  14218. return getClientRect(result);
  14219. }
  14220. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  14221. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  14222. var isIE10 = isIE(10);
  14223. var isHTML = parent.nodeName === 'HTML';
  14224. var childrenRect = getBoundingClientRect(children);
  14225. var parentRect = getBoundingClientRect(parent);
  14226. var scrollParent = getScrollParent(children);
  14227. var styles = getStyleComputedProperty(parent);
  14228. var borderTopWidth = parseFloat(styles.borderTopWidth, 10);
  14229. var borderLeftWidth = parseFloat(styles.borderLeftWidth, 10);
  14230. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  14231. if (fixedPosition && isHTML) {
  14232. parentRect.top = Math.max(parentRect.top, 0);
  14233. parentRect.left = Math.max(parentRect.left, 0);
  14234. }
  14235. var offsets = getClientRect({
  14236. top: childrenRect.top - parentRect.top - borderTopWidth,
  14237. left: childrenRect.left - parentRect.left - borderLeftWidth,
  14238. width: childrenRect.width,
  14239. height: childrenRect.height
  14240. });
  14241. offsets.marginTop = 0;
  14242. offsets.marginLeft = 0;
  14243. // Subtract margins of documentElement in case it's being used as parent
  14244. // we do this only on HTML because it's the only element that behaves
  14245. // differently when margins are applied to it. The margins are included in
  14246. // the box of the documentElement, in the other cases not.
  14247. if (!isIE10 && isHTML) {
  14248. var marginTop = parseFloat(styles.marginTop, 10);
  14249. var marginLeft = parseFloat(styles.marginLeft, 10);
  14250. offsets.top -= borderTopWidth - marginTop;
  14251. offsets.bottom -= borderTopWidth - marginTop;
  14252. offsets.left -= borderLeftWidth - marginLeft;
  14253. offsets.right -= borderLeftWidth - marginLeft;
  14254. // Attach marginTop and marginLeft because in some circumstances we may need them
  14255. offsets.marginTop = marginTop;
  14256. offsets.marginLeft = marginLeft;
  14257. }
  14258. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  14259. offsets = includeScroll(offsets, parent);
  14260. }
  14261. return offsets;
  14262. }
  14263. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  14264. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  14265. var html = element.ownerDocument.documentElement;
  14266. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  14267. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  14268. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  14269. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  14270. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  14271. var offset = {
  14272. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  14273. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  14274. width: width,
  14275. height: height
  14276. };
  14277. return getClientRect(offset);
  14278. }
  14279. /**
  14280. * Check if the given element is fixed or is inside a fixed parent
  14281. * @method
  14282. * @memberof Popper.Utils
  14283. * @argument {Element} element
  14284. * @argument {Element} customContainer
  14285. * @returns {Boolean} answer to "isFixed?"
  14286. */
  14287. function isFixed(element) {
  14288. var nodeName = element.nodeName;
  14289. if (nodeName === 'BODY' || nodeName === 'HTML') {
  14290. return false;
  14291. }
  14292. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  14293. return true;
  14294. }
  14295. var parentNode = getParentNode(element);
  14296. if (!parentNode) {
  14297. return false;
  14298. }
  14299. return isFixed(parentNode);
  14300. }
  14301. /**
  14302. * Finds the first parent of an element that has a transformed property defined
  14303. * @method
  14304. * @memberof Popper.Utils
  14305. * @argument {Element} element
  14306. * @returns {Element} first transformed parent or documentElement
  14307. */
  14308. function getFixedPositionOffsetParent(element) {
  14309. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  14310. if (!element || !element.parentElement || isIE()) {
  14311. return document.documentElement;
  14312. }
  14313. var el = element.parentElement;
  14314. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  14315. el = el.parentElement;
  14316. }
  14317. return el || document.documentElement;
  14318. }
  14319. /**
  14320. * Computed the boundaries limits and return them
  14321. * @method
  14322. * @memberof Popper.Utils
  14323. * @param {HTMLElement} popper
  14324. * @param {HTMLElement} reference
  14325. * @param {number} padding
  14326. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  14327. * @param {Boolean} fixedPosition - Is in fixed position mode
  14328. * @returns {Object} Coordinates of the boundaries
  14329. */
  14330. function getBoundaries(popper, reference, padding, boundariesElement) {
  14331. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  14332. // NOTE: 1 DOM access here
  14333. var boundaries = { top: 0, left: 0 };
  14334. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference);
  14335. // Handle viewport case
  14336. if (boundariesElement === 'viewport') {
  14337. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  14338. } else {
  14339. // Handle other cases based on DOM element used as boundaries
  14340. var boundariesNode = void 0;
  14341. if (boundariesElement === 'scrollParent') {
  14342. boundariesNode = getScrollParent(getParentNode(reference));
  14343. if (boundariesNode.nodeName === 'BODY') {
  14344. boundariesNode = popper.ownerDocument.documentElement;
  14345. }
  14346. } else if (boundariesElement === 'window') {
  14347. boundariesNode = popper.ownerDocument.documentElement;
  14348. } else {
  14349. boundariesNode = boundariesElement;
  14350. }
  14351. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  14352. // In case of HTML, we need a different computation
  14353. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  14354. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  14355. height = _getWindowSizes.height,
  14356. width = _getWindowSizes.width;
  14357. boundaries.top += offsets.top - offsets.marginTop;
  14358. boundaries.bottom = height + offsets.top;
  14359. boundaries.left += offsets.left - offsets.marginLeft;
  14360. boundaries.right = width + offsets.left;
  14361. } else {
  14362. // for all the other DOM elements, this one is good
  14363. boundaries = offsets;
  14364. }
  14365. }
  14366. // Add paddings
  14367. padding = padding || 0;
  14368. var isPaddingNumber = typeof padding === 'number';
  14369. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  14370. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  14371. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  14372. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  14373. return boundaries;
  14374. }
  14375. function getArea(_ref) {
  14376. var width = _ref.width,
  14377. height = _ref.height;
  14378. return width * height;
  14379. }
  14380. /**
  14381. * Utility used to transform the `auto` placement to the placement with more
  14382. * available space.
  14383. * @method
  14384. * @memberof Popper.Utils
  14385. * @argument {Object} data - The data object generated by update method
  14386. * @argument {Object} options - Modifiers configuration and options
  14387. * @returns {Object} The data object, properly modified
  14388. */
  14389. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  14390. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  14391. if (placement.indexOf('auto') === -1) {
  14392. return placement;
  14393. }
  14394. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  14395. var rects = {
  14396. top: {
  14397. width: boundaries.width,
  14398. height: refRect.top - boundaries.top
  14399. },
  14400. right: {
  14401. width: boundaries.right - refRect.right,
  14402. height: boundaries.height
  14403. },
  14404. bottom: {
  14405. width: boundaries.width,
  14406. height: boundaries.bottom - refRect.bottom
  14407. },
  14408. left: {
  14409. width: refRect.left - boundaries.left,
  14410. height: boundaries.height
  14411. }
  14412. };
  14413. var sortedAreas = Object.keys(rects).map(function (key) {
  14414. return _extends({
  14415. key: key
  14416. }, rects[key], {
  14417. area: getArea(rects[key])
  14418. });
  14419. }).sort(function (a, b) {
  14420. return b.area - a.area;
  14421. });
  14422. var filteredAreas = sortedAreas.filter(function (_ref2) {
  14423. var width = _ref2.width,
  14424. height = _ref2.height;
  14425. return width >= popper.clientWidth && height >= popper.clientHeight;
  14426. });
  14427. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  14428. var variation = placement.split('-')[1];
  14429. return computedPlacement + (variation ? '-' + variation : '');
  14430. }
  14431. /**
  14432. * Get offsets to the reference element
  14433. * @method
  14434. * @memberof Popper.Utils
  14435. * @param {Object} state
  14436. * @param {Element} popper - the popper element
  14437. * @param {Element} reference - the reference element (the popper will be relative to this)
  14438. * @param {Element} fixedPosition - is in fixed position mode
  14439. * @returns {Object} An object containing the offsets which will be applied to the popper
  14440. */
  14441. function getReferenceOffsets(state, popper, reference) {
  14442. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  14443. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference);
  14444. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  14445. }
  14446. /**
  14447. * Get the outer sizes of the given element (offset size + margins)
  14448. * @method
  14449. * @memberof Popper.Utils
  14450. * @argument {Element} element
  14451. * @returns {Object} object containing width and height properties
  14452. */
  14453. function getOuterSizes(element) {
  14454. var window = element.ownerDocument.defaultView;
  14455. var styles = window.getComputedStyle(element);
  14456. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  14457. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  14458. var result = {
  14459. width: element.offsetWidth + y,
  14460. height: element.offsetHeight + x
  14461. };
  14462. return result;
  14463. }
  14464. /**
  14465. * Get the opposite placement of the given one
  14466. * @method
  14467. * @memberof Popper.Utils
  14468. * @argument {String} placement
  14469. * @returns {String} flipped placement
  14470. */
  14471. function getOppositePlacement(placement) {
  14472. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  14473. return placement.replace(/left|right|bottom|top/g, function (matched) {
  14474. return hash[matched];
  14475. });
  14476. }
  14477. /**
  14478. * Get offsets to the popper
  14479. * @method
  14480. * @memberof Popper.Utils
  14481. * @param {Object} position - CSS position the Popper will get applied
  14482. * @param {HTMLElement} popper - the popper element
  14483. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  14484. * @param {String} placement - one of the valid placement options
  14485. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  14486. */
  14487. function getPopperOffsets(popper, referenceOffsets, placement) {
  14488. placement = placement.split('-')[0];
  14489. // Get popper node sizes
  14490. var popperRect = getOuterSizes(popper);
  14491. // Add position, width and height to our offsets object
  14492. var popperOffsets = {
  14493. width: popperRect.width,
  14494. height: popperRect.height
  14495. };
  14496. // depending by the popper placement we have to compute its offsets slightly differently
  14497. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  14498. var mainSide = isHoriz ? 'top' : 'left';
  14499. var secondarySide = isHoriz ? 'left' : 'top';
  14500. var measurement = isHoriz ? 'height' : 'width';
  14501. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  14502. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  14503. if (placement === secondarySide) {
  14504. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  14505. } else {
  14506. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  14507. }
  14508. return popperOffsets;
  14509. }
  14510. /**
  14511. * Mimics the `find` method of Array
  14512. * @method
  14513. * @memberof Popper.Utils
  14514. * @argument {Array} arr
  14515. * @argument prop
  14516. * @argument value
  14517. * @returns index or -1
  14518. */
  14519. function find(arr, check) {
  14520. // use native find if supported
  14521. if (Array.prototype.find) {
  14522. return arr.find(check);
  14523. }
  14524. // use `filter` to obtain the same behavior of `find`
  14525. return arr.filter(check)[0];
  14526. }
  14527. /**
  14528. * Return the index of the matching object
  14529. * @method
  14530. * @memberof Popper.Utils
  14531. * @argument {Array} arr
  14532. * @argument prop
  14533. * @argument value
  14534. * @returns index or -1
  14535. */
  14536. function findIndex(arr, prop, value) {
  14537. // use native findIndex if supported
  14538. if (Array.prototype.findIndex) {
  14539. return arr.findIndex(function (cur) {
  14540. return cur[prop] === value;
  14541. });
  14542. }
  14543. // use `find` + `indexOf` if `findIndex` isn't supported
  14544. var match = find(arr, function (obj) {
  14545. return obj[prop] === value;
  14546. });
  14547. return arr.indexOf(match);
  14548. }
  14549. /**
  14550. * Loop trough the list of modifiers and run them in order,
  14551. * each of them will then edit the data object.
  14552. * @method
  14553. * @memberof Popper.Utils
  14554. * @param {dataObject} data
  14555. * @param {Array} modifiers
  14556. * @param {String} ends - Optional modifier name used as stopper
  14557. * @returns {dataObject}
  14558. */
  14559. function runModifiers(modifiers, data, ends) {
  14560. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  14561. modifiersToRun.forEach(function (modifier) {
  14562. if (modifier['function']) {
  14563. // eslint-disable-line dot-notation
  14564. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  14565. }
  14566. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  14567. if (modifier.enabled && isFunction(fn)) {
  14568. // Add properties to offsets to make them a complete clientRect object
  14569. // we do this before each modifier to make sure the previous one doesn't
  14570. // mess with these values
  14571. data.offsets.popper = getClientRect(data.offsets.popper);
  14572. data.offsets.reference = getClientRect(data.offsets.reference);
  14573. data = fn(data, modifier);
  14574. }
  14575. });
  14576. return data;
  14577. }
  14578. /**
  14579. * Updates the position of the popper, computing the new offsets and applying
  14580. * the new style.<br />
  14581. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  14582. * @method
  14583. * @memberof Popper
  14584. */
  14585. function update() {
  14586. // if popper is destroyed, don't perform any further update
  14587. if (this.state.isDestroyed) {
  14588. return;
  14589. }
  14590. var data = {
  14591. instance: this,
  14592. styles: {},
  14593. arrowStyles: {},
  14594. attributes: {},
  14595. flipped: false,
  14596. offsets: {}
  14597. };
  14598. // compute reference element offsets
  14599. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  14600. // compute auto placement, store placement inside the data object,
  14601. // modifiers will be able to edit `placement` if needed
  14602. // and refer to originalPlacement to know the original value
  14603. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  14604. // store the computed placement inside `originalPlacement`
  14605. data.originalPlacement = data.placement;
  14606. data.positionFixed = this.options.positionFixed;
  14607. // compute the popper offsets
  14608. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  14609. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  14610. // run the modifiers
  14611. data = runModifiers(this.modifiers, data);
  14612. // the first `update` will call `onCreate` callback
  14613. // the other ones will call `onUpdate` callback
  14614. if (!this.state.isCreated) {
  14615. this.state.isCreated = true;
  14616. this.options.onCreate(data);
  14617. } else {
  14618. this.options.onUpdate(data);
  14619. }
  14620. }
  14621. /**
  14622. * Helper used to know if the given modifier is enabled.
  14623. * @method
  14624. * @memberof Popper.Utils
  14625. * @returns {Boolean}
  14626. */
  14627. function isModifierEnabled(modifiers, modifierName) {
  14628. return modifiers.some(function (_ref) {
  14629. var name = _ref.name,
  14630. enabled = _ref.enabled;
  14631. return enabled && name === modifierName;
  14632. });
  14633. }
  14634. /**
  14635. * Get the prefixed supported property name
  14636. * @method
  14637. * @memberof Popper.Utils
  14638. * @argument {String} property (camelCase)
  14639. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  14640. */
  14641. function getSupportedPropertyName(property) {
  14642. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  14643. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  14644. for (var i = 0; i < prefixes.length; i++) {
  14645. var prefix = prefixes[i];
  14646. var toCheck = prefix ? '' + prefix + upperProp : property;
  14647. if (typeof document.body.style[toCheck] !== 'undefined') {
  14648. return toCheck;
  14649. }
  14650. }
  14651. return null;
  14652. }
  14653. /**
  14654. * Destroys the popper.
  14655. * @method
  14656. * @memberof Popper
  14657. */
  14658. function destroy() {
  14659. this.state.isDestroyed = true;
  14660. // touch DOM only if `applyStyle` modifier is enabled
  14661. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  14662. this.popper.removeAttribute('x-placement');
  14663. this.popper.style.position = '';
  14664. this.popper.style.top = '';
  14665. this.popper.style.left = '';
  14666. this.popper.style.right = '';
  14667. this.popper.style.bottom = '';
  14668. this.popper.style.willChange = '';
  14669. this.popper.style[getSupportedPropertyName('transform')] = '';
  14670. }
  14671. this.disableEventListeners();
  14672. // remove the popper if user explicity asked for the deletion on destroy
  14673. // do not use `remove` because IE11 doesn't support it
  14674. if (this.options.removeOnDestroy) {
  14675. this.popper.parentNode.removeChild(this.popper);
  14676. }
  14677. return this;
  14678. }
  14679. /**
  14680. * Get the window associated with the element
  14681. * @argument {Element} element
  14682. * @returns {Window}
  14683. */
  14684. function getWindow(element) {
  14685. var ownerDocument = element.ownerDocument;
  14686. return ownerDocument ? ownerDocument.defaultView : window;
  14687. }
  14688. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  14689. var isBody = scrollParent.nodeName === 'BODY';
  14690. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  14691. target.addEventListener(event, callback, { passive: true });
  14692. if (!isBody) {
  14693. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  14694. }
  14695. scrollParents.push(target);
  14696. }
  14697. /**
  14698. * Setup needed event listeners used to update the popper position
  14699. * @method
  14700. * @memberof Popper.Utils
  14701. * @private
  14702. */
  14703. function setupEventListeners(reference, options, state, updateBound) {
  14704. // Resize event listener on window
  14705. state.updateBound = updateBound;
  14706. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  14707. // Scroll event listener on scroll parents
  14708. var scrollElement = getScrollParent(reference);
  14709. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  14710. state.scrollElement = scrollElement;
  14711. state.eventsEnabled = true;
  14712. return state;
  14713. }
  14714. /**
  14715. * It will add resize/scroll events and start recalculating
  14716. * position of the popper element when they are triggered.
  14717. * @method
  14718. * @memberof Popper
  14719. */
  14720. function enableEventListeners() {
  14721. if (!this.state.eventsEnabled) {
  14722. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  14723. }
  14724. }
  14725. /**
  14726. * Remove event listeners used to update the popper position
  14727. * @method
  14728. * @memberof Popper.Utils
  14729. * @private
  14730. */
  14731. function removeEventListeners(reference, state) {
  14732. // Remove resize event listener on window
  14733. getWindow(reference).removeEventListener('resize', state.updateBound);
  14734. // Remove scroll event listener on scroll parents
  14735. state.scrollParents.forEach(function (target) {
  14736. target.removeEventListener('scroll', state.updateBound);
  14737. });
  14738. // Reset state
  14739. state.updateBound = null;
  14740. state.scrollParents = [];
  14741. state.scrollElement = null;
  14742. state.eventsEnabled = false;
  14743. return state;
  14744. }
  14745. /**
  14746. * It will remove resize/scroll events and won't recalculate popper position
  14747. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  14748. * unless you call `update` method manually.
  14749. * @method
  14750. * @memberof Popper
  14751. */
  14752. function disableEventListeners() {
  14753. if (this.state.eventsEnabled) {
  14754. cancelAnimationFrame(this.scheduleUpdate);
  14755. this.state = removeEventListeners(this.reference, this.state);
  14756. }
  14757. }
  14758. /**
  14759. * Tells if a given input is a number
  14760. * @method
  14761. * @memberof Popper.Utils
  14762. * @param {*} input to check
  14763. * @return {Boolean}
  14764. */
  14765. function isNumeric(n) {
  14766. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  14767. }
  14768. /**
  14769. * Set the style to the given popper
  14770. * @method
  14771. * @memberof Popper.Utils
  14772. * @argument {Element} element - Element to apply the style to
  14773. * @argument {Object} styles
  14774. * Object with a list of properties and values which will be applied to the element
  14775. */
  14776. function setStyles(element, styles) {
  14777. Object.keys(styles).forEach(function (prop) {
  14778. var unit = '';
  14779. // add unit if the value is numeric and is one of the following
  14780. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  14781. unit = 'px';
  14782. }
  14783. element.style[prop] = styles[prop] + unit;
  14784. });
  14785. }
  14786. /**
  14787. * Set the attributes to the given popper
  14788. * @method
  14789. * @memberof Popper.Utils
  14790. * @argument {Element} element - Element to apply the attributes to
  14791. * @argument {Object} styles
  14792. * Object with a list of properties and values which will be applied to the element
  14793. */
  14794. function setAttributes(element, attributes) {
  14795. Object.keys(attributes).forEach(function (prop) {
  14796. var value = attributes[prop];
  14797. if (value !== false) {
  14798. element.setAttribute(prop, attributes[prop]);
  14799. } else {
  14800. element.removeAttribute(prop);
  14801. }
  14802. });
  14803. }
  14804. /**
  14805. * @function
  14806. * @memberof Modifiers
  14807. * @argument {Object} data - The data object generated by `update` method
  14808. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  14809. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  14810. * @argument {Object} options - Modifiers configuration and options
  14811. * @returns {Object} The same data object
  14812. */
  14813. function applyStyle(data) {
  14814. // any property present in `data.styles` will be applied to the popper,
  14815. // in this way we can make the 3rd party modifiers add custom styles to it
  14816. // Be aware, modifiers could override the properties defined in the previous
  14817. // lines of this modifier!
  14818. setStyles(data.instance.popper, data.styles);
  14819. // any property present in `data.attributes` will be applied to the popper,
  14820. // they will be set as HTML attributes of the element
  14821. setAttributes(data.instance.popper, data.attributes);
  14822. // if arrowElement is defined and arrowStyles has some properties
  14823. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  14824. setStyles(data.arrowElement, data.arrowStyles);
  14825. }
  14826. return data;
  14827. }
  14828. /**
  14829. * Set the x-placement attribute before everything else because it could be used
  14830. * to add margins to the popper margins needs to be calculated to get the
  14831. * correct popper offsets.
  14832. * @method
  14833. * @memberof Popper.modifiers
  14834. * @param {HTMLElement} reference - The reference element used to position the popper
  14835. * @param {HTMLElement} popper - The HTML element used as popper
  14836. * @param {Object} options - Popper.js options
  14837. */
  14838. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  14839. // compute reference element offsets
  14840. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  14841. // compute auto placement, store placement inside the data object,
  14842. // modifiers will be able to edit `placement` if needed
  14843. // and refer to originalPlacement to know the original value
  14844. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  14845. popper.setAttribute('x-placement', placement);
  14846. // Apply `position` to popper before anything else because
  14847. // without the position applied we can't guarantee correct computations
  14848. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  14849. return options;
  14850. }
  14851. /**
  14852. * @function
  14853. * @memberof Popper.Utils
  14854. * @argument {Object} data - The data object generated by `update` method
  14855. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  14856. * @returns {Object} The popper's position offsets rounded
  14857. *
  14858. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  14859. * good as it can be within reason.
  14860. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  14861. *
  14862. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  14863. * as well on High DPI screens).
  14864. *
  14865. * Firefox prefers no rounding for positioning and does not have blurriness on
  14866. * high DPI screens.
  14867. *
  14868. * Only horizontal placement and left/right values need to be considered.
  14869. */
  14870. function getRoundedOffsets(data, shouldRound) {
  14871. var _data$offsets = data.offsets,
  14872. popper = _data$offsets.popper,
  14873. reference = _data$offsets.reference;
  14874. var round = Math.round,
  14875. floor = Math.floor;
  14876. var noRound = function noRound(v) {
  14877. return v;
  14878. };
  14879. var referenceWidth = round(reference.width);
  14880. var popperWidth = round(popper.width);
  14881. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  14882. var isVariation = data.placement.indexOf('-') !== -1;
  14883. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  14884. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  14885. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  14886. var verticalToInteger = !shouldRound ? noRound : round;
  14887. return {
  14888. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  14889. top: verticalToInteger(popper.top),
  14890. bottom: verticalToInteger(popper.bottom),
  14891. right: horizontalToInteger(popper.right)
  14892. };
  14893. }
  14894. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  14895. /**
  14896. * @function
  14897. * @memberof Modifiers
  14898. * @argument {Object} data - The data object generated by `update` method
  14899. * @argument {Object} options - Modifiers configuration and options
  14900. * @returns {Object} The data object, properly modified
  14901. */
  14902. function computeStyle(data, options) {
  14903. var x = options.x,
  14904. y = options.y;
  14905. var popper = data.offsets.popper;
  14906. // Remove this legacy support in Popper.js v2
  14907. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  14908. return modifier.name === 'applyStyle';
  14909. }).gpuAcceleration;
  14910. if (legacyGpuAccelerationOption !== undefined) {
  14911. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  14912. }
  14913. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  14914. var offsetParent = getOffsetParent(data.instance.popper);
  14915. var offsetParentRect = getBoundingClientRect(offsetParent);
  14916. // Styles
  14917. var styles = {
  14918. position: popper.position
  14919. };
  14920. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  14921. var sideA = x === 'bottom' ? 'top' : 'bottom';
  14922. var sideB = y === 'right' ? 'left' : 'right';
  14923. // if gpuAcceleration is set to `true` and transform is supported,
  14924. // we use `translate3d` to apply the position to the popper we
  14925. // automatically use the supported prefixed version if needed
  14926. var prefixedProperty = getSupportedPropertyName('transform');
  14927. // now, let's make a step back and look at this code closely (wtf?)
  14928. // If the content of the popper grows once it's been positioned, it
  14929. // may happen that the popper gets misplaced because of the new content
  14930. // overflowing its reference element
  14931. // To avoid this problem, we provide two options (x and y), which allow
  14932. // the consumer to define the offset origin.
  14933. // If we position a popper on top of a reference element, we can set
  14934. // `x` to `top` to make the popper grow towards its top instead of
  14935. // its bottom.
  14936. var left = void 0,
  14937. top = void 0;
  14938. if (sideA === 'bottom') {
  14939. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  14940. // and not the bottom of the html element
  14941. if (offsetParent.nodeName === 'HTML') {
  14942. top = -offsetParent.clientHeight + offsets.bottom;
  14943. } else {
  14944. top = -offsetParentRect.height + offsets.bottom;
  14945. }
  14946. } else {
  14947. top = offsets.top;
  14948. }
  14949. if (sideB === 'right') {
  14950. if (offsetParent.nodeName === 'HTML') {
  14951. left = -offsetParent.clientWidth + offsets.right;
  14952. } else {
  14953. left = -offsetParentRect.width + offsets.right;
  14954. }
  14955. } else {
  14956. left = offsets.left;
  14957. }
  14958. if (gpuAcceleration && prefixedProperty) {
  14959. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  14960. styles[sideA] = 0;
  14961. styles[sideB] = 0;
  14962. styles.willChange = 'transform';
  14963. } else {
  14964. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  14965. var invertTop = sideA === 'bottom' ? -1 : 1;
  14966. var invertLeft = sideB === 'right' ? -1 : 1;
  14967. styles[sideA] = top * invertTop;
  14968. styles[sideB] = left * invertLeft;
  14969. styles.willChange = sideA + ', ' + sideB;
  14970. }
  14971. // Attributes
  14972. var attributes = {
  14973. 'x-placement': data.placement
  14974. };
  14975. // Update `data` attributes, styles and arrowStyles
  14976. data.attributes = _extends({}, attributes, data.attributes);
  14977. data.styles = _extends({}, styles, data.styles);
  14978. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  14979. return data;
  14980. }
  14981. /**
  14982. * Helper used to know if the given modifier depends from another one.<br />
  14983. * It checks if the needed modifier is listed and enabled.
  14984. * @method
  14985. * @memberof Popper.Utils
  14986. * @param {Array} modifiers - list of modifiers
  14987. * @param {String} requestingName - name of requesting modifier
  14988. * @param {String} requestedName - name of requested modifier
  14989. * @returns {Boolean}
  14990. */
  14991. function isModifierRequired(modifiers, requestingName, requestedName) {
  14992. var requesting = find(modifiers, function (_ref) {
  14993. var name = _ref.name;
  14994. return name === requestingName;
  14995. });
  14996. var isRequired = !!requesting && modifiers.some(function (modifier) {
  14997. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  14998. });
  14999. if (!isRequired) {
  15000. var _requesting = '`' + requestingName + '`';
  15001. var requested = '`' + requestedName + '`';
  15002. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  15003. }
  15004. return isRequired;
  15005. }
  15006. /**
  15007. * @function
  15008. * @memberof Modifiers
  15009. * @argument {Object} data - The data object generated by update method
  15010. * @argument {Object} options - Modifiers configuration and options
  15011. * @returns {Object} The data object, properly modified
  15012. */
  15013. function arrow(data, options) {
  15014. var _data$offsets$arrow;
  15015. // arrow depends on keepTogether in order to work
  15016. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  15017. return data;
  15018. }
  15019. var arrowElement = options.element;
  15020. // if arrowElement is a string, suppose it's a CSS selector
  15021. if (typeof arrowElement === 'string') {
  15022. arrowElement = data.instance.popper.querySelector(arrowElement);
  15023. // if arrowElement is not found, don't run the modifier
  15024. if (!arrowElement) {
  15025. return data;
  15026. }
  15027. } else {
  15028. // if the arrowElement isn't a query selector we must check that the
  15029. // provided DOM node is child of its popper node
  15030. if (!data.instance.popper.contains(arrowElement)) {
  15031. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  15032. return data;
  15033. }
  15034. }
  15035. var placement = data.placement.split('-')[0];
  15036. var _data$offsets = data.offsets,
  15037. popper = _data$offsets.popper,
  15038. reference = _data$offsets.reference;
  15039. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  15040. var len = isVertical ? 'height' : 'width';
  15041. var sideCapitalized = isVertical ? 'Top' : 'Left';
  15042. var side = sideCapitalized.toLowerCase();
  15043. var altSide = isVertical ? 'left' : 'top';
  15044. var opSide = isVertical ? 'bottom' : 'right';
  15045. var arrowElementSize = getOuterSizes(arrowElement)[len];
  15046. //
  15047. // extends keepTogether behavior making sure the popper and its
  15048. // reference have enough pixels in conjunction
  15049. //
  15050. // top/left side
  15051. if (reference[opSide] - arrowElementSize < popper[side]) {
  15052. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  15053. }
  15054. // bottom/right side
  15055. if (reference[side] + arrowElementSize > popper[opSide]) {
  15056. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  15057. }
  15058. data.offsets.popper = getClientRect(data.offsets.popper);
  15059. // compute center of the popper
  15060. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  15061. // Compute the sideValue using the updated popper offsets
  15062. // take popper margin in account because we don't have this info available
  15063. var css = getStyleComputedProperty(data.instance.popper);
  15064. var popperMarginSide = parseFloat(css['margin' + sideCapitalized], 10);
  15065. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width'], 10);
  15066. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  15067. // prevent arrowElement from being placed not contiguously to its popper
  15068. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  15069. data.arrowElement = arrowElement;
  15070. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  15071. return data;
  15072. }
  15073. /**
  15074. * Get the opposite placement variation of the given one
  15075. * @method
  15076. * @memberof Popper.Utils
  15077. * @argument {String} placement variation
  15078. * @returns {String} flipped placement variation
  15079. */
  15080. function getOppositeVariation(variation) {
  15081. if (variation === 'end') {
  15082. return 'start';
  15083. } else if (variation === 'start') {
  15084. return 'end';
  15085. }
  15086. return variation;
  15087. }
  15088. /**
  15089. * List of accepted placements to use as values of the `placement` option.<br />
  15090. * Valid placements are:
  15091. * - `auto`
  15092. * - `top`
  15093. * - `right`
  15094. * - `bottom`
  15095. * - `left`
  15096. *
  15097. * Each placement can have a variation from this list:
  15098. * - `-start`
  15099. * - `-end`
  15100. *
  15101. * Variations are interpreted easily if you think of them as the left to right
  15102. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  15103. * is right.<br />
  15104. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  15105. *
  15106. * Some valid examples are:
  15107. * - `top-end` (on top of reference, right aligned)
  15108. * - `right-start` (on right of reference, top aligned)
  15109. * - `bottom` (on bottom, centered)
  15110. * - `auto-end` (on the side with more space available, alignment depends by placement)
  15111. *
  15112. * @static
  15113. * @type {Array}
  15114. * @enum {String}
  15115. * @readonly
  15116. * @method placements
  15117. * @memberof Popper
  15118. */
  15119. var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];
  15120. // Get rid of `auto` `auto-start` and `auto-end`
  15121. var validPlacements = placements.slice(3);
  15122. /**
  15123. * Given an initial placement, returns all the subsequent placements
  15124. * clockwise (or counter-clockwise).
  15125. *
  15126. * @method
  15127. * @memberof Popper.Utils
  15128. * @argument {String} placement - A valid placement (it accepts variations)
  15129. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  15130. * @returns {Array} placements including their variations
  15131. */
  15132. function clockwise(placement) {
  15133. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  15134. var index = validPlacements.indexOf(placement);
  15135. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  15136. return counter ? arr.reverse() : arr;
  15137. }
  15138. var BEHAVIORS = {
  15139. FLIP: 'flip',
  15140. CLOCKWISE: 'clockwise',
  15141. COUNTERCLOCKWISE: 'counterclockwise'
  15142. };
  15143. /**
  15144. * @function
  15145. * @memberof Modifiers
  15146. * @argument {Object} data - The data object generated by update method
  15147. * @argument {Object} options - Modifiers configuration and options
  15148. * @returns {Object} The data object, properly modified
  15149. */
  15150. function flip(data, options) {
  15151. // if `inner` modifier is enabled, we can't use the `flip` modifier
  15152. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  15153. return data;
  15154. }
  15155. if (data.flipped && data.placement === data.originalPlacement) {
  15156. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  15157. return data;
  15158. }
  15159. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  15160. var placement = data.placement.split('-')[0];
  15161. var placementOpposite = getOppositePlacement(placement);
  15162. var variation = data.placement.split('-')[1] || '';
  15163. var flipOrder = [];
  15164. switch (options.behavior) {
  15165. case BEHAVIORS.FLIP:
  15166. flipOrder = [placement, placementOpposite];
  15167. break;
  15168. case BEHAVIORS.CLOCKWISE:
  15169. flipOrder = clockwise(placement);
  15170. break;
  15171. case BEHAVIORS.COUNTERCLOCKWISE:
  15172. flipOrder = clockwise(placement, true);
  15173. break;
  15174. default:
  15175. flipOrder = options.behavior;
  15176. }
  15177. flipOrder.forEach(function (step, index) {
  15178. if (placement !== step || flipOrder.length === index + 1) {
  15179. return data;
  15180. }
  15181. placement = data.placement.split('-')[0];
  15182. placementOpposite = getOppositePlacement(placement);
  15183. var popperOffsets = data.offsets.popper;
  15184. var refOffsets = data.offsets.reference;
  15185. // using floor because the reference offsets may contain decimals we are not going to consider here
  15186. var floor = Math.floor;
  15187. var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom);
  15188. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  15189. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  15190. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  15191. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  15192. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  15193. // flip the variation if required
  15194. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  15195. // flips variation if reference element overflows boundaries
  15196. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  15197. // flips variation if popper content overflows boundaries
  15198. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  15199. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  15200. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  15201. // this boolean to detect any flip loop
  15202. data.flipped = true;
  15203. if (overlapsRef || overflowsBoundaries) {
  15204. placement = flipOrder[index + 1];
  15205. }
  15206. if (flippedVariation) {
  15207. variation = getOppositeVariation(variation);
  15208. }
  15209. data.placement = placement + (variation ? '-' + variation : '');
  15210. // this object contains `position`, we want to preserve it along with
  15211. // any additional property we may add in the future
  15212. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  15213. data = runModifiers(data.instance.modifiers, data, 'flip');
  15214. }
  15215. });
  15216. return data;
  15217. }
  15218. /**
  15219. * @function
  15220. * @memberof Modifiers
  15221. * @argument {Object} data - The data object generated by update method
  15222. * @argument {Object} options - Modifiers configuration and options
  15223. * @returns {Object} The data object, properly modified
  15224. */
  15225. function keepTogether(data) {
  15226. var _data$offsets = data.offsets,
  15227. popper = _data$offsets.popper,
  15228. reference = _data$offsets.reference;
  15229. var placement = data.placement.split('-')[0];
  15230. var floor = Math.floor;
  15231. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  15232. var side = isVertical ? 'right' : 'bottom';
  15233. var opSide = isVertical ? 'left' : 'top';
  15234. var measurement = isVertical ? 'width' : 'height';
  15235. if (popper[side] < floor(reference[opSide])) {
  15236. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  15237. }
  15238. if (popper[opSide] > floor(reference[side])) {
  15239. data.offsets.popper[opSide] = floor(reference[side]);
  15240. }
  15241. return data;
  15242. }
  15243. /**
  15244. * Converts a string containing value + unit into a px value number
  15245. * @function
  15246. * @memberof {modifiers~offset}
  15247. * @private
  15248. * @argument {String} str - Value + unit string
  15249. * @argument {String} measurement - `height` or `width`
  15250. * @argument {Object} popperOffsets
  15251. * @argument {Object} referenceOffsets
  15252. * @returns {Number|String}
  15253. * Value in pixels, or original string if no values were extracted
  15254. */
  15255. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  15256. // separate value from unit
  15257. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  15258. var value = +split[1];
  15259. var unit = split[2];
  15260. // If it's not a number it's an operator, I guess
  15261. if (!value) {
  15262. return str;
  15263. }
  15264. if (unit.indexOf('%') === 0) {
  15265. var element = void 0;
  15266. switch (unit) {
  15267. case '%p':
  15268. element = popperOffsets;
  15269. break;
  15270. case '%':
  15271. case '%r':
  15272. default:
  15273. element = referenceOffsets;
  15274. }
  15275. var rect = getClientRect(element);
  15276. return rect[measurement] / 100 * value;
  15277. } else if (unit === 'vh' || unit === 'vw') {
  15278. // if is a vh or vw, we calculate the size based on the viewport
  15279. var size = void 0;
  15280. if (unit === 'vh') {
  15281. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  15282. } else {
  15283. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  15284. }
  15285. return size / 100 * value;
  15286. } else {
  15287. // if is an explicit pixel unit, we get rid of the unit and keep the value
  15288. // if is an implicit unit, it's px, and we return just the value
  15289. return value;
  15290. }
  15291. }
  15292. /**
  15293. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  15294. * @function
  15295. * @memberof {modifiers~offset}
  15296. * @private
  15297. * @argument {String} offset
  15298. * @argument {Object} popperOffsets
  15299. * @argument {Object} referenceOffsets
  15300. * @argument {String} basePlacement
  15301. * @returns {Array} a two cells array with x and y offsets in numbers
  15302. */
  15303. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  15304. var offsets = [0, 0];
  15305. // Use height if placement is left or right and index is 0 otherwise use width
  15306. // in this way the first offset will use an axis and the second one
  15307. // will use the other one
  15308. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  15309. // Split the offset string to obtain a list of values and operands
  15310. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  15311. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  15312. return frag.trim();
  15313. });
  15314. // Detect if the offset string contains a pair of values or a single one
  15315. // they could be separated by comma or space
  15316. var divider = fragments.indexOf(find(fragments, function (frag) {
  15317. return frag.search(/,|\s/) !== -1;
  15318. }));
  15319. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  15320. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  15321. }
  15322. // If divider is found, we divide the list of values and operands to divide
  15323. // them by ofset X and Y.
  15324. var splitRegex = /\s*,\s*|\s+/;
  15325. var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments];
  15326. // Convert the values with units to absolute pixels to allow our computations
  15327. ops = ops.map(function (op, index) {
  15328. // Most of the units rely on the orientation of the popper
  15329. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  15330. var mergeWithPrevious = false;
  15331. return op
  15332. // This aggregates any `+` or `-` sign that aren't considered operators
  15333. // e.g.: 10 + +5 => [10, +, +5]
  15334. .reduce(function (a, b) {
  15335. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  15336. a[a.length - 1] = b;
  15337. mergeWithPrevious = true;
  15338. return a;
  15339. } else if (mergeWithPrevious) {
  15340. a[a.length - 1] += b;
  15341. mergeWithPrevious = false;
  15342. return a;
  15343. } else {
  15344. return a.concat(b);
  15345. }
  15346. }, [])
  15347. // Here we convert the string values into number values (in px)
  15348. .map(function (str) {
  15349. return toValue(str, measurement, popperOffsets, referenceOffsets);
  15350. });
  15351. });
  15352. // Loop trough the offsets arrays and execute the operations
  15353. ops.forEach(function (op, index) {
  15354. op.forEach(function (frag, index2) {
  15355. if (isNumeric(frag)) {
  15356. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  15357. }
  15358. });
  15359. });
  15360. return offsets;
  15361. }
  15362. /**
  15363. * @function
  15364. * @memberof Modifiers
  15365. * @argument {Object} data - The data object generated by update method
  15366. * @argument {Object} options - Modifiers configuration and options
  15367. * @argument {Number|String} options.offset=0
  15368. * The offset value as described in the modifier description
  15369. * @returns {Object} The data object, properly modified
  15370. */
  15371. function offset(data, _ref) {
  15372. var offset = _ref.offset;
  15373. var placement = data.placement,
  15374. _data$offsets = data.offsets,
  15375. popper = _data$offsets.popper,
  15376. reference = _data$offsets.reference;
  15377. var basePlacement = placement.split('-')[0];
  15378. var offsets = void 0;
  15379. if (isNumeric(+offset)) {
  15380. offsets = [+offset, 0];
  15381. } else {
  15382. offsets = parseOffset(offset, popper, reference, basePlacement);
  15383. }
  15384. if (basePlacement === 'left') {
  15385. popper.top += offsets[0];
  15386. popper.left -= offsets[1];
  15387. } else if (basePlacement === 'right') {
  15388. popper.top += offsets[0];
  15389. popper.left += offsets[1];
  15390. } else if (basePlacement === 'top') {
  15391. popper.left += offsets[0];
  15392. popper.top -= offsets[1];
  15393. } else if (basePlacement === 'bottom') {
  15394. popper.left += offsets[0];
  15395. popper.top += offsets[1];
  15396. }
  15397. data.popper = popper;
  15398. return data;
  15399. }
  15400. /**
  15401. * @function
  15402. * @memberof Modifiers
  15403. * @argument {Object} data - The data object generated by `update` method
  15404. * @argument {Object} options - Modifiers configuration and options
  15405. * @returns {Object} The data object, properly modified
  15406. */
  15407. function preventOverflow(data, options) {
  15408. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  15409. // If offsetParent is the reference element, we really want to
  15410. // go one step up and use the next offsetParent as reference to
  15411. // avoid to make this modifier completely useless and look like broken
  15412. if (data.instance.reference === boundariesElement) {
  15413. boundariesElement = getOffsetParent(boundariesElement);
  15414. }
  15415. // NOTE: DOM access here
  15416. // resets the popper's position so that the document size can be calculated excluding
  15417. // the size of the popper element itself
  15418. var transformProp = getSupportedPropertyName('transform');
  15419. var popperStyles = data.instance.popper.style; // assignment to help minification
  15420. var top = popperStyles.top,
  15421. left = popperStyles.left,
  15422. transform = popperStyles[transformProp];
  15423. popperStyles.top = '';
  15424. popperStyles.left = '';
  15425. popperStyles[transformProp] = '';
  15426. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  15427. // NOTE: DOM access here
  15428. // restores the original style properties after the offsets have been computed
  15429. popperStyles.top = top;
  15430. popperStyles.left = left;
  15431. popperStyles[transformProp] = transform;
  15432. options.boundaries = boundaries;
  15433. var order = options.priority;
  15434. var popper = data.offsets.popper;
  15435. var check = {
  15436. primary: function primary(placement) {
  15437. var value = popper[placement];
  15438. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  15439. value = Math.max(popper[placement], boundaries[placement]);
  15440. }
  15441. return defineProperty({}, placement, value);
  15442. },
  15443. secondary: function secondary(placement) {
  15444. var mainSide = placement === 'right' ? 'left' : 'top';
  15445. var value = popper[mainSide];
  15446. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  15447. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  15448. }
  15449. return defineProperty({}, mainSide, value);
  15450. }
  15451. };
  15452. order.forEach(function (placement) {
  15453. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  15454. popper = _extends({}, popper, check[side](placement));
  15455. });
  15456. data.offsets.popper = popper;
  15457. return data;
  15458. }
  15459. /**
  15460. * @function
  15461. * @memberof Modifiers
  15462. * @argument {Object} data - The data object generated by `update` method
  15463. * @argument {Object} options - Modifiers configuration and options
  15464. * @returns {Object} The data object, properly modified
  15465. */
  15466. function shift(data) {
  15467. var placement = data.placement;
  15468. var basePlacement = placement.split('-')[0];
  15469. var shiftvariation = placement.split('-')[1];
  15470. // if shift shiftvariation is specified, run the modifier
  15471. if (shiftvariation) {
  15472. var _data$offsets = data.offsets,
  15473. reference = _data$offsets.reference,
  15474. popper = _data$offsets.popper;
  15475. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  15476. var side = isVertical ? 'left' : 'top';
  15477. var measurement = isVertical ? 'width' : 'height';
  15478. var shiftOffsets = {
  15479. start: defineProperty({}, side, reference[side]),
  15480. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  15481. };
  15482. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  15483. }
  15484. return data;
  15485. }
  15486. /**
  15487. * @function
  15488. * @memberof Modifiers
  15489. * @argument {Object} data - The data object generated by update method
  15490. * @argument {Object} options - Modifiers configuration and options
  15491. * @returns {Object} The data object, properly modified
  15492. */
  15493. function hide(data) {
  15494. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  15495. return data;
  15496. }
  15497. var refRect = data.offsets.reference;
  15498. var bound = find(data.instance.modifiers, function (modifier) {
  15499. return modifier.name === 'preventOverflow';
  15500. }).boundaries;
  15501. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  15502. // Avoid unnecessary DOM access if visibility hasn't changed
  15503. if (data.hide === true) {
  15504. return data;
  15505. }
  15506. data.hide = true;
  15507. data.attributes['x-out-of-boundaries'] = '';
  15508. } else {
  15509. // Avoid unnecessary DOM access if visibility hasn't changed
  15510. if (data.hide === false) {
  15511. return data;
  15512. }
  15513. data.hide = false;
  15514. data.attributes['x-out-of-boundaries'] = false;
  15515. }
  15516. return data;
  15517. }
  15518. /**
  15519. * @function
  15520. * @memberof Modifiers
  15521. * @argument {Object} data - The data object generated by `update` method
  15522. * @argument {Object} options - Modifiers configuration and options
  15523. * @returns {Object} The data object, properly modified
  15524. */
  15525. function inner(data) {
  15526. var placement = data.placement;
  15527. var basePlacement = placement.split('-')[0];
  15528. var _data$offsets = data.offsets,
  15529. popper = _data$offsets.popper,
  15530. reference = _data$offsets.reference;
  15531. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  15532. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  15533. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  15534. data.placement = getOppositePlacement(placement);
  15535. data.offsets.popper = getClientRect(popper);
  15536. return data;
  15537. }
  15538. /**
  15539. * Modifier function, each modifier can have a function of this type assigned
  15540. * to its `fn` property.<br />
  15541. * These functions will be called on each update, this means that you must
  15542. * make sure they are performant enough to avoid performance bottlenecks.
  15543. *
  15544. * @function ModifierFn
  15545. * @argument {dataObject} data - The data object generated by `update` method
  15546. * @argument {Object} options - Modifiers configuration and options
  15547. * @returns {dataObject} The data object, properly modified
  15548. */
  15549. /**
  15550. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  15551. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  15552. * needed by the library.
  15553. *
  15554. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  15555. * All the other properties are configurations that could be tweaked.
  15556. * @namespace modifiers
  15557. */
  15558. var modifiers = {
  15559. /**
  15560. * Modifier used to shift the popper on the start or end of its reference
  15561. * element.<br />
  15562. * It will read the variation of the `placement` property.<br />
  15563. * It can be one either `-end` or `-start`.
  15564. * @memberof modifiers
  15565. * @inner
  15566. */
  15567. shift: {
  15568. /** @prop {number} order=100 - Index used to define the order of execution */
  15569. order: 100,
  15570. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  15571. enabled: true,
  15572. /** @prop {ModifierFn} */
  15573. fn: shift
  15574. },
  15575. /**
  15576. * The `offset` modifier can shift your popper on both its axis.
  15577. *
  15578. * It accepts the following units:
  15579. * - `px` or unit-less, interpreted as pixels
  15580. * - `%` or `%r`, percentage relative to the length of the reference element
  15581. * - `%p`, percentage relative to the length of the popper element
  15582. * - `vw`, CSS viewport width unit
  15583. * - `vh`, CSS viewport height unit
  15584. *
  15585. * For length is intended the main axis relative to the placement of the popper.<br />
  15586. * This means that if the placement is `top` or `bottom`, the length will be the
  15587. * `width`. In case of `left` or `right`, it will be the `height`.
  15588. *
  15589. * You can provide a single value (as `Number` or `String`), or a pair of values
  15590. * as `String` divided by a comma or one (or more) white spaces.<br />
  15591. * The latter is a deprecated method because it leads to confusion and will be
  15592. * removed in v2.<br />
  15593. * Additionally, it accepts additions and subtractions between different units.
  15594. * Note that multiplications and divisions aren't supported.
  15595. *
  15596. * Valid examples are:
  15597. * ```
  15598. * 10
  15599. * '10%'
  15600. * '10, 10'
  15601. * '10%, 10'
  15602. * '10 + 10%'
  15603. * '10 - 5vh + 3%'
  15604. * '-10px + 5vh, 5px - 6%'
  15605. * ```
  15606. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  15607. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  15608. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  15609. *
  15610. * @memberof modifiers
  15611. * @inner
  15612. */
  15613. offset: {
  15614. /** @prop {number} order=200 - Index used to define the order of execution */
  15615. order: 200,
  15616. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  15617. enabled: true,
  15618. /** @prop {ModifierFn} */
  15619. fn: offset,
  15620. /** @prop {Number|String} offset=0
  15621. * The offset value as described in the modifier description
  15622. */
  15623. offset: 0
  15624. },
  15625. /**
  15626. * Modifier used to prevent the popper from being positioned outside the boundary.
  15627. *
  15628. * A scenario exists where the reference itself is not within the boundaries.<br />
  15629. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  15630. * In this case we need to decide whether the popper should either:
  15631. *
  15632. * - detach from the reference and remain "trapped" in the boundaries, or
  15633. * - if it should ignore the boundary and "escape with its reference"
  15634. *
  15635. * When `escapeWithReference` is set to`true` and reference is completely
  15636. * outside its boundaries, the popper will overflow (or completely leave)
  15637. * the boundaries in order to remain attached to the edge of the reference.
  15638. *
  15639. * @memberof modifiers
  15640. * @inner
  15641. */
  15642. preventOverflow: {
  15643. /** @prop {number} order=300 - Index used to define the order of execution */
  15644. order: 300,
  15645. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  15646. enabled: true,
  15647. /** @prop {ModifierFn} */
  15648. fn: preventOverflow,
  15649. /**
  15650. * @prop {Array} [priority=['left','right','top','bottom']]
  15651. * Popper will try to prevent overflow following these priorities by default,
  15652. * then, it could overflow on the left and on top of the `boundariesElement`
  15653. */
  15654. priority: ['left', 'right', 'top', 'bottom'],
  15655. /**
  15656. * @prop {number} padding=5
  15657. * Amount of pixel used to define a minimum distance between the boundaries
  15658. * and the popper. This makes sure the popper always has a little padding
  15659. * between the edges of its container
  15660. */
  15661. padding: 5,
  15662. /**
  15663. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  15664. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  15665. * `viewport` or any DOM element.
  15666. */
  15667. boundariesElement: 'scrollParent'
  15668. },
  15669. /**
  15670. * Modifier used to make sure the reference and its popper stay near each other
  15671. * without leaving any gap between the two. Especially useful when the arrow is
  15672. * enabled and you want to ensure that it points to its reference element.
  15673. * It cares only about the first axis. You can still have poppers with margin
  15674. * between the popper and its reference element.
  15675. * @memberof modifiers
  15676. * @inner
  15677. */
  15678. keepTogether: {
  15679. /** @prop {number} order=400 - Index used to define the order of execution */
  15680. order: 400,
  15681. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  15682. enabled: true,
  15683. /** @prop {ModifierFn} */
  15684. fn: keepTogether
  15685. },
  15686. /**
  15687. * This modifier is used to move the `arrowElement` of the popper to make
  15688. * sure it is positioned between the reference element and its popper element.
  15689. * It will read the outer size of the `arrowElement` node to detect how many
  15690. * pixels of conjunction are needed.
  15691. *
  15692. * It has no effect if no `arrowElement` is provided.
  15693. * @memberof modifiers
  15694. * @inner
  15695. */
  15696. arrow: {
  15697. /** @prop {number} order=500 - Index used to define the order of execution */
  15698. order: 500,
  15699. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  15700. enabled: true,
  15701. /** @prop {ModifierFn} */
  15702. fn: arrow,
  15703. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  15704. element: '[x-arrow]'
  15705. },
  15706. /**
  15707. * Modifier used to flip the popper's placement when it starts to overlap its
  15708. * reference element.
  15709. *
  15710. * Requires the `preventOverflow` modifier before it in order to work.
  15711. *
  15712. * **NOTE:** this modifier will interrupt the current update cycle and will
  15713. * restart it if it detects the need to flip the placement.
  15714. * @memberof modifiers
  15715. * @inner
  15716. */
  15717. flip: {
  15718. /** @prop {number} order=600 - Index used to define the order of execution */
  15719. order: 600,
  15720. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  15721. enabled: true,
  15722. /** @prop {ModifierFn} */
  15723. fn: flip,
  15724. /**
  15725. * @prop {String|Array} behavior='flip'
  15726. * The behavior used to change the popper's placement. It can be one of
  15727. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  15728. * placements (with optional variations)
  15729. */
  15730. behavior: 'flip',
  15731. /**
  15732. * @prop {number} padding=5
  15733. * The popper will flip if it hits the edges of the `boundariesElement`
  15734. */
  15735. padding: 5,
  15736. /**
  15737. * @prop {String|HTMLElement} boundariesElement='viewport'
  15738. * The element which will define the boundaries of the popper position.
  15739. * The popper will never be placed outside of the defined boundaries
  15740. * (except if `keepTogether` is enabled)
  15741. */
  15742. boundariesElement: 'viewport',
  15743. /**
  15744. * @prop {Boolean} flipVariations=false
  15745. * The popper will switch placement variation between `-start` and `-end` when
  15746. * the reference element overlaps its boundaries.
  15747. *
  15748. * The original placement should have a set variation.
  15749. */
  15750. flipVariations: false,
  15751. /**
  15752. * @prop {Boolean} flipVariationsByContent=false
  15753. * The popper will switch placement variation between `-start` and `-end` when
  15754. * the popper element overlaps its reference boundaries.
  15755. *
  15756. * The original placement should have a set variation.
  15757. */
  15758. flipVariationsByContent: false
  15759. },
  15760. /**
  15761. * Modifier used to make the popper flow toward the inner of the reference element.
  15762. * By default, when this modifier is disabled, the popper will be placed outside
  15763. * the reference element.
  15764. * @memberof modifiers
  15765. * @inner
  15766. */
  15767. inner: {
  15768. /** @prop {number} order=700 - Index used to define the order of execution */
  15769. order: 700,
  15770. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  15771. enabled: false,
  15772. /** @prop {ModifierFn} */
  15773. fn: inner
  15774. },
  15775. /**
  15776. * Modifier used to hide the popper when its reference element is outside of the
  15777. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  15778. * be used to hide with a CSS selector the popper when its reference is
  15779. * out of boundaries.
  15780. *
  15781. * Requires the `preventOverflow` modifier before it in order to work.
  15782. * @memberof modifiers
  15783. * @inner
  15784. */
  15785. hide: {
  15786. /** @prop {number} order=800 - Index used to define the order of execution */
  15787. order: 800,
  15788. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  15789. enabled: true,
  15790. /** @prop {ModifierFn} */
  15791. fn: hide
  15792. },
  15793. /**
  15794. * Computes the style that will be applied to the popper element to gets
  15795. * properly positioned.
  15796. *
  15797. * Note that this modifier will not touch the DOM, it just prepares the styles
  15798. * so that `applyStyle` modifier can apply it. This separation is useful
  15799. * in case you need to replace `applyStyle` with a custom implementation.
  15800. *
  15801. * This modifier has `850` as `order` value to maintain backward compatibility
  15802. * with previous versions of Popper.js. Expect the modifiers ordering method
  15803. * to change in future major versions of the library.
  15804. *
  15805. * @memberof modifiers
  15806. * @inner
  15807. */
  15808. computeStyle: {
  15809. /** @prop {number} order=850 - Index used to define the order of execution */
  15810. order: 850,
  15811. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  15812. enabled: true,
  15813. /** @prop {ModifierFn} */
  15814. fn: computeStyle,
  15815. /**
  15816. * @prop {Boolean} gpuAcceleration=true
  15817. * If true, it uses the CSS 3D transformation to position the popper.
  15818. * Otherwise, it will use the `top` and `left` properties
  15819. */
  15820. gpuAcceleration: true,
  15821. /**
  15822. * @prop {string} [x='bottom']
  15823. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  15824. * Change this if your popper should grow in a direction different from `bottom`
  15825. */
  15826. x: 'bottom',
  15827. /**
  15828. * @prop {string} [x='left']
  15829. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  15830. * Change this if your popper should grow in a direction different from `right`
  15831. */
  15832. y: 'right'
  15833. },
  15834. /**
  15835. * Applies the computed styles to the popper element.
  15836. *
  15837. * All the DOM manipulations are limited to this modifier. This is useful in case
  15838. * you want to integrate Popper.js inside a framework or view library and you
  15839. * want to delegate all the DOM manipulations to it.
  15840. *
  15841. * Note that if you disable this modifier, you must make sure the popper element
  15842. * has its position set to `absolute` before Popper.js can do its work!
  15843. *
  15844. * Just disable this modifier and define your own to achieve the desired effect.
  15845. *
  15846. * @memberof modifiers
  15847. * @inner
  15848. */
  15849. applyStyle: {
  15850. /** @prop {number} order=900 - Index used to define the order of execution */
  15851. order: 900,
  15852. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  15853. enabled: true,
  15854. /** @prop {ModifierFn} */
  15855. fn: applyStyle,
  15856. /** @prop {Function} */
  15857. onLoad: applyStyleOnLoad,
  15858. /**
  15859. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  15860. * @prop {Boolean} gpuAcceleration=true
  15861. * If true, it uses the CSS 3D transformation to position the popper.
  15862. * Otherwise, it will use the `top` and `left` properties
  15863. */
  15864. gpuAcceleration: undefined
  15865. }
  15866. };
  15867. /**
  15868. * The `dataObject` is an object containing all the information used by Popper.js.
  15869. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  15870. * @name dataObject
  15871. * @property {Object} data.instance The Popper.js instance
  15872. * @property {String} data.placement Placement applied to popper
  15873. * @property {String} data.originalPlacement Placement originally defined on init
  15874. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  15875. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  15876. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  15877. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  15878. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  15879. * @property {Object} data.boundaries Offsets of the popper boundaries
  15880. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  15881. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  15882. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  15883. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  15884. */
  15885. /**
  15886. * Default options provided to Popper.js constructor.<br />
  15887. * These can be overridden using the `options` argument of Popper.js.<br />
  15888. * To override an option, simply pass an object with the same
  15889. * structure of the `options` object, as the 3rd argument. For example:
  15890. * ```
  15891. * new Popper(ref, pop, {
  15892. * modifiers: {
  15893. * preventOverflow: { enabled: false }
  15894. * }
  15895. * })
  15896. * ```
  15897. * @type {Object}
  15898. * @static
  15899. * @memberof Popper
  15900. */
  15901. var Defaults = {
  15902. /**
  15903. * Popper's placement.
  15904. * @prop {Popper.placements} placement='bottom'
  15905. */
  15906. placement: 'bottom',
  15907. /**
  15908. * Set this to true if you want popper to position it self in 'fixed' mode
  15909. * @prop {Boolean} positionFixed=false
  15910. */
  15911. positionFixed: false,
  15912. /**
  15913. * Whether events (resize, scroll) are initially enabled.
  15914. * @prop {Boolean} eventsEnabled=true
  15915. */
  15916. eventsEnabled: true,
  15917. /**
  15918. * Set to true if you want to automatically remove the popper when
  15919. * you call the `destroy` method.
  15920. * @prop {Boolean} removeOnDestroy=false
  15921. */
  15922. removeOnDestroy: false,
  15923. /**
  15924. * Callback called when the popper is created.<br />
  15925. * By default, it is set to no-op.<br />
  15926. * Access Popper.js instance with `data.instance`.
  15927. * @prop {onCreate}
  15928. */
  15929. onCreate: function onCreate() {},
  15930. /**
  15931. * Callback called when the popper is updated. This callback is not called
  15932. * on the initialization/creation of the popper, but only on subsequent
  15933. * updates.<br />
  15934. * By default, it is set to no-op.<br />
  15935. * Access Popper.js instance with `data.instance`.
  15936. * @prop {onUpdate}
  15937. */
  15938. onUpdate: function onUpdate() {},
  15939. /**
  15940. * List of modifiers used to modify the offsets before they are applied to the popper.
  15941. * They provide most of the functionalities of Popper.js.
  15942. * @prop {modifiers}
  15943. */
  15944. modifiers: modifiers
  15945. };
  15946. /**
  15947. * @callback onCreate
  15948. * @param {dataObject} data
  15949. */
  15950. /**
  15951. * @callback onUpdate
  15952. * @param {dataObject} data
  15953. */
  15954. // Utils
  15955. // Methods
  15956. var Popper = function () {
  15957. /**
  15958. * Creates a new Popper.js instance.
  15959. * @class Popper
  15960. * @param {Element|referenceObject} reference - The reference element used to position the popper
  15961. * @param {Element} popper - The HTML / XML element used as the popper
  15962. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  15963. * @return {Object} instance - The generated Popper.js instance
  15964. */
  15965. function Popper(reference, popper) {
  15966. var _this = this;
  15967. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  15968. classCallCheck(this, Popper);
  15969. this.scheduleUpdate = function () {
  15970. return requestAnimationFrame(_this.update);
  15971. };
  15972. // make update() debounced, so that it only runs at most once-per-tick
  15973. this.update = debounce(this.update.bind(this));
  15974. // with {} we create a new object with the options inside it
  15975. this.options = _extends({}, Popper.Defaults, options);
  15976. // init state
  15977. this.state = {
  15978. isDestroyed: false,
  15979. isCreated: false,
  15980. scrollParents: []
  15981. };
  15982. // get reference and popper elements (allow jQuery wrappers)
  15983. this.reference = reference && reference.jquery ? reference[0] : reference;
  15984. this.popper = popper && popper.jquery ? popper[0] : popper;
  15985. // Deep merge modifiers options
  15986. this.options.modifiers = {};
  15987. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  15988. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  15989. });
  15990. // Refactoring modifiers' list (Object => Array)
  15991. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  15992. return _extends({
  15993. name: name
  15994. }, _this.options.modifiers[name]);
  15995. })
  15996. // sort the modifiers by order
  15997. .sort(function (a, b) {
  15998. return a.order - b.order;
  15999. });
  16000. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  16001. // such code is executed in the same order of its modifier
  16002. // they could add new properties to their options configuration
  16003. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  16004. this.modifiers.forEach(function (modifierOptions) {
  16005. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  16006. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  16007. }
  16008. });
  16009. // fire the first update to position the popper in the right place
  16010. this.update();
  16011. var eventsEnabled = this.options.eventsEnabled;
  16012. if (eventsEnabled) {
  16013. // setup event listeners, they will take care of update the position in specific situations
  16014. this.enableEventListeners();
  16015. }
  16016. this.state.eventsEnabled = eventsEnabled;
  16017. }
  16018. // We can't use class properties because they don't get listed in the
  16019. // class prototype and break stuff like Sinon stubs
  16020. createClass(Popper, [{
  16021. key: 'update',
  16022. value: function update$$1() {
  16023. return update.call(this);
  16024. }
  16025. }, {
  16026. key: 'destroy',
  16027. value: function destroy$$1() {
  16028. return destroy.call(this);
  16029. }
  16030. }, {
  16031. key: 'enableEventListeners',
  16032. value: function enableEventListeners$$1() {
  16033. return enableEventListeners.call(this);
  16034. }
  16035. }, {
  16036. key: 'disableEventListeners',
  16037. value: function disableEventListeners$$1() {
  16038. return disableEventListeners.call(this);
  16039. }
  16040. /**
  16041. * Schedules an update. It will run on the next UI update available.
  16042. * @method scheduleUpdate
  16043. * @memberof Popper
  16044. */
  16045. /**
  16046. * Collection of utilities useful when writing custom modifiers.
  16047. * Starting from version 1.7, this method is available only if you
  16048. * include `popper-utils.js` before `popper.js`.
  16049. *
  16050. * **DEPRECATION**: This way to access PopperUtils is deprecated
  16051. * and will be removed in v2! Use the PopperUtils module directly instead.
  16052. * Due to the high instability of the methods contained in Utils, we can't
  16053. * guarantee them to follow semver. Use them at your own risk!
  16054. * @static
  16055. * @private
  16056. * @type {Object}
  16057. * @deprecated since version 1.8
  16058. * @member Utils
  16059. * @memberof Popper
  16060. */
  16061. }]);
  16062. return Popper;
  16063. }();
  16064. /**
  16065. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  16066. * and lets you use it as replacement of a real DOM node.<br />
  16067. * You can use this method to position a popper relatively to a set of coordinates
  16068. * in case you don't have a DOM node to use as reference.
  16069. *
  16070. * ```
  16071. * new Popper(referenceObject, popperNode);
  16072. * ```
  16073. *
  16074. * NB: This feature isn't supported in Internet Explorer 10.
  16075. * @name referenceObject
  16076. * @property {Function} data.getBoundingClientRect
  16077. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  16078. * @property {number} data.clientWidth
  16079. * An ES6 getter that will return the width of the virtual reference element.
  16080. * @property {number} data.clientHeight
  16081. * An ES6 getter that will return the height of the virtual reference element.
  16082. */
  16083. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  16084. Popper.placements = placements;
  16085. Popper.Defaults = Defaults;
  16086. return Popper;
  16087. })));
  16088. //# sourceMappingURL=popper.js.map
  16089. /*!
  16090. * Bootstrap v4.3.1 (https://getbootstrap.com/)
  16091. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  16092. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  16093. */
  16094. (function (global, factory) {
  16095. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery'), require('popper.js')) :
  16096. typeof define === 'function' && define.amd ? define(['exports', 'jquery', 'popper.js'], factory) :
  16097. (global = global || self, factory(global.bootstrap = {}, global.jQuery, global.Popper));
  16098. }(this, function (exports, $, Popper) { 'use strict';
  16099. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  16100. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  16101. function _defineProperties(target, props) {
  16102. for (var i = 0; i < props.length; i++) {
  16103. var descriptor = props[i];
  16104. descriptor.enumerable = descriptor.enumerable || false;
  16105. descriptor.configurable = true;
  16106. if ("value" in descriptor) descriptor.writable = true;
  16107. Object.defineProperty(target, descriptor.key, descriptor);
  16108. }
  16109. }
  16110. function _createClass(Constructor, protoProps, staticProps) {
  16111. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  16112. if (staticProps) _defineProperties(Constructor, staticProps);
  16113. return Constructor;
  16114. }
  16115. function _defineProperty(obj, key, value) {
  16116. if (key in obj) {
  16117. Object.defineProperty(obj, key, {
  16118. value: value,
  16119. enumerable: true,
  16120. configurable: true,
  16121. writable: true
  16122. });
  16123. } else {
  16124. obj[key] = value;
  16125. }
  16126. return obj;
  16127. }
  16128. function _objectSpread(target) {
  16129. for (var i = 1; i < arguments.length; i++) {
  16130. var source = arguments[i] != null ? arguments[i] : {};
  16131. var ownKeys = Object.keys(source);
  16132. if (typeof Object.getOwnPropertySymbols === 'function') {
  16133. ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
  16134. return Object.getOwnPropertyDescriptor(source, sym).enumerable;
  16135. }));
  16136. }
  16137. ownKeys.forEach(function (key) {
  16138. _defineProperty(target, key, source[key]);
  16139. });
  16140. }
  16141. return target;
  16142. }
  16143. function _inheritsLoose(subClass, superClass) {
  16144. subClass.prototype = Object.create(superClass.prototype);
  16145. subClass.prototype.constructor = subClass;
  16146. subClass.__proto__ = superClass;
  16147. }
  16148. /**
  16149. * --------------------------------------------------------------------------
  16150. * Bootstrap (v4.3.1): util.js
  16151. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  16152. * --------------------------------------------------------------------------
  16153. */
  16154. /**
  16155. * ------------------------------------------------------------------------
  16156. * Private TransitionEnd Helpers
  16157. * ------------------------------------------------------------------------
  16158. */
  16159. var TRANSITION_END = 'transitionend';
  16160. var MAX_UID = 1000000;
  16161. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  16162. function toType(obj) {
  16163. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  16164. }
  16165. function getSpecialTransitionEndEvent() {
  16166. return {
  16167. bindType: TRANSITION_END,
  16168. delegateType: TRANSITION_END,
  16169. handle: function handle(event) {
  16170. if ($(event.target).is(this)) {
  16171. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  16172. }
  16173. return undefined; // eslint-disable-line no-undefined
  16174. }
  16175. };
  16176. }
  16177. function transitionEndEmulator(duration) {
  16178. var _this = this;
  16179. var called = false;
  16180. $(this).one(Util.TRANSITION_END, function () {
  16181. called = true;
  16182. });
  16183. setTimeout(function () {
  16184. if (!called) {
  16185. Util.triggerTransitionEnd(_this);
  16186. }
  16187. }, duration);
  16188. return this;
  16189. }
  16190. function setTransitionEndSupport() {
  16191. $.fn.emulateTransitionEnd = transitionEndEmulator;
  16192. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  16193. }
  16194. /**
  16195. * --------------------------------------------------------------------------
  16196. * Public Util Api
  16197. * --------------------------------------------------------------------------
  16198. */
  16199. var Util = {
  16200. TRANSITION_END: 'bsTransitionEnd',
  16201. getUID: function getUID(prefix) {
  16202. do {
  16203. // eslint-disable-next-line no-bitwise
  16204. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  16205. } while (document.getElementById(prefix));
  16206. return prefix;
  16207. },
  16208. getSelectorFromElement: function getSelectorFromElement(element) {
  16209. var selector = element.getAttribute('data-target');
  16210. if (!selector || selector === '#') {
  16211. var hrefAttr = element.getAttribute('href');
  16212. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  16213. }
  16214. try {
  16215. return document.querySelector(selector) ? selector : null;
  16216. } catch (err) {
  16217. return null;
  16218. }
  16219. },
  16220. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  16221. if (!element) {
  16222. return 0;
  16223. } // Get transition-duration of the element
  16224. var transitionDuration = $(element).css('transition-duration');
  16225. var transitionDelay = $(element).css('transition-delay');
  16226. var floatTransitionDuration = parseFloat(transitionDuration);
  16227. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  16228. if (!floatTransitionDuration && !floatTransitionDelay) {
  16229. return 0;
  16230. } // If multiple durations are defined, take the first
  16231. transitionDuration = transitionDuration.split(',')[0];
  16232. transitionDelay = transitionDelay.split(',')[0];
  16233. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  16234. },
  16235. reflow: function reflow(element) {
  16236. return element.offsetHeight;
  16237. },
  16238. triggerTransitionEnd: function triggerTransitionEnd(element) {
  16239. $(element).trigger(TRANSITION_END);
  16240. },
  16241. // TODO: Remove in v5
  16242. supportsTransitionEnd: function supportsTransitionEnd() {
  16243. return Boolean(TRANSITION_END);
  16244. },
  16245. isElement: function isElement(obj) {
  16246. return (obj[0] || obj).nodeType;
  16247. },
  16248. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  16249. for (var property in configTypes) {
  16250. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  16251. var expectedTypes = configTypes[property];
  16252. var value = config[property];
  16253. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  16254. if (!new RegExp(expectedTypes).test(valueType)) {
  16255. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  16256. }
  16257. }
  16258. }
  16259. },
  16260. findShadowRoot: function findShadowRoot(element) {
  16261. if (!document.documentElement.attachShadow) {
  16262. return null;
  16263. } // Can find the shadow root otherwise it'll return the document
  16264. if (typeof element.getRootNode === 'function') {
  16265. var root = element.getRootNode();
  16266. return root instanceof ShadowRoot ? root : null;
  16267. }
  16268. if (element instanceof ShadowRoot) {
  16269. return element;
  16270. } // when we don't find a shadow root
  16271. if (!element.parentNode) {
  16272. return null;
  16273. }
  16274. return Util.findShadowRoot(element.parentNode);
  16275. }
  16276. };
  16277. setTransitionEndSupport();
  16278. /**
  16279. * ------------------------------------------------------------------------
  16280. * Constants
  16281. * ------------------------------------------------------------------------
  16282. */
  16283. var NAME = 'alert';
  16284. var VERSION = '4.3.1';
  16285. var DATA_KEY = 'bs.alert';
  16286. var EVENT_KEY = "." + DATA_KEY;
  16287. var DATA_API_KEY = '.data-api';
  16288. var JQUERY_NO_CONFLICT = $.fn[NAME];
  16289. var Selector = {
  16290. DISMISS: '[data-dismiss="alert"]'
  16291. };
  16292. var Event = {
  16293. CLOSE: "close" + EVENT_KEY,
  16294. CLOSED: "closed" + EVENT_KEY,
  16295. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  16296. };
  16297. var ClassName = {
  16298. ALERT: 'alert',
  16299. FADE: 'fade',
  16300. SHOW: 'show'
  16301. /**
  16302. * ------------------------------------------------------------------------
  16303. * Class Definition
  16304. * ------------------------------------------------------------------------
  16305. */
  16306. };
  16307. var Alert =
  16308. /*#__PURE__*/
  16309. function () {
  16310. function Alert(element) {
  16311. this._element = element;
  16312. } // Getters
  16313. var _proto = Alert.prototype;
  16314. // Public
  16315. _proto.close = function close(element) {
  16316. var rootElement = this._element;
  16317. if (element) {
  16318. rootElement = this._getRootElement(element);
  16319. }
  16320. var customEvent = this._triggerCloseEvent(rootElement);
  16321. if (customEvent.isDefaultPrevented()) {
  16322. return;
  16323. }
  16324. this._removeElement(rootElement);
  16325. };
  16326. _proto.dispose = function dispose() {
  16327. $.removeData(this._element, DATA_KEY);
  16328. this._element = null;
  16329. } // Private
  16330. ;
  16331. _proto._getRootElement = function _getRootElement(element) {
  16332. var selector = Util.getSelectorFromElement(element);
  16333. var parent = false;
  16334. if (selector) {
  16335. parent = document.querySelector(selector);
  16336. }
  16337. if (!parent) {
  16338. parent = $(element).closest("." + ClassName.ALERT)[0];
  16339. }
  16340. return parent;
  16341. };
  16342. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  16343. var closeEvent = $.Event(Event.CLOSE);
  16344. $(element).trigger(closeEvent);
  16345. return closeEvent;
  16346. };
  16347. _proto._removeElement = function _removeElement(element) {
  16348. var _this = this;
  16349. $(element).removeClass(ClassName.SHOW);
  16350. if (!$(element).hasClass(ClassName.FADE)) {
  16351. this._destroyElement(element);
  16352. return;
  16353. }
  16354. var transitionDuration = Util.getTransitionDurationFromElement(element);
  16355. $(element).one(Util.TRANSITION_END, function (event) {
  16356. return _this._destroyElement(element, event);
  16357. }).emulateTransitionEnd(transitionDuration);
  16358. };
  16359. _proto._destroyElement = function _destroyElement(element) {
  16360. $(element).detach().trigger(Event.CLOSED).remove();
  16361. } // Static
  16362. ;
  16363. Alert._jQueryInterface = function _jQueryInterface(config) {
  16364. return this.each(function () {
  16365. var $element = $(this);
  16366. var data = $element.data(DATA_KEY);
  16367. if (!data) {
  16368. data = new Alert(this);
  16369. $element.data(DATA_KEY, data);
  16370. }
  16371. if (config === 'close') {
  16372. data[config](this);
  16373. }
  16374. });
  16375. };
  16376. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  16377. return function (event) {
  16378. if (event) {
  16379. event.preventDefault();
  16380. }
  16381. alertInstance.close(this);
  16382. };
  16383. };
  16384. _createClass(Alert, null, [{
  16385. key: "VERSION",
  16386. get: function get() {
  16387. return VERSION;
  16388. }
  16389. }]);
  16390. return Alert;
  16391. }();
  16392. /**
  16393. * ------------------------------------------------------------------------
  16394. * Data Api implementation
  16395. * ------------------------------------------------------------------------
  16396. */
  16397. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  16398. /**
  16399. * ------------------------------------------------------------------------
  16400. * jQuery
  16401. * ------------------------------------------------------------------------
  16402. */
  16403. $.fn[NAME] = Alert._jQueryInterface;
  16404. $.fn[NAME].Constructor = Alert;
  16405. $.fn[NAME].noConflict = function () {
  16406. $.fn[NAME] = JQUERY_NO_CONFLICT;
  16407. return Alert._jQueryInterface;
  16408. };
  16409. /**
  16410. * ------------------------------------------------------------------------
  16411. * Constants
  16412. * ------------------------------------------------------------------------
  16413. */
  16414. var NAME$1 = 'button';
  16415. var VERSION$1 = '4.3.1';
  16416. var DATA_KEY$1 = 'bs.button';
  16417. var EVENT_KEY$1 = "." + DATA_KEY$1;
  16418. var DATA_API_KEY$1 = '.data-api';
  16419. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  16420. var ClassName$1 = {
  16421. ACTIVE: 'active',
  16422. BUTTON: 'btn',
  16423. FOCUS: 'focus'
  16424. };
  16425. var Selector$1 = {
  16426. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  16427. DATA_TOGGLE: '[data-toggle="buttons"]',
  16428. INPUT: 'input:not([type="hidden"])',
  16429. ACTIVE: '.active',
  16430. BUTTON: '.btn'
  16431. };
  16432. var Event$1 = {
  16433. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  16434. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1)
  16435. /**
  16436. * ------------------------------------------------------------------------
  16437. * Class Definition
  16438. * ------------------------------------------------------------------------
  16439. */
  16440. };
  16441. var Button =
  16442. /*#__PURE__*/
  16443. function () {
  16444. function Button(element) {
  16445. this._element = element;
  16446. } // Getters
  16447. var _proto = Button.prototype;
  16448. // Public
  16449. _proto.toggle = function toggle() {
  16450. var triggerChangeEvent = true;
  16451. var addAriaPressed = true;
  16452. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLE)[0];
  16453. if (rootElement) {
  16454. var input = this._element.querySelector(Selector$1.INPUT);
  16455. if (input) {
  16456. if (input.type === 'radio') {
  16457. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  16458. triggerChangeEvent = false;
  16459. } else {
  16460. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  16461. if (activeElement) {
  16462. $(activeElement).removeClass(ClassName$1.ACTIVE);
  16463. }
  16464. }
  16465. }
  16466. if (triggerChangeEvent) {
  16467. if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) {
  16468. return;
  16469. }
  16470. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  16471. $(input).trigger('change');
  16472. }
  16473. input.focus();
  16474. addAriaPressed = false;
  16475. }
  16476. }
  16477. if (addAriaPressed) {
  16478. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  16479. }
  16480. if (triggerChangeEvent) {
  16481. $(this._element).toggleClass(ClassName$1.ACTIVE);
  16482. }
  16483. };
  16484. _proto.dispose = function dispose() {
  16485. $.removeData(this._element, DATA_KEY$1);
  16486. this._element = null;
  16487. } // Static
  16488. ;
  16489. Button._jQueryInterface = function _jQueryInterface(config) {
  16490. return this.each(function () {
  16491. var data = $(this).data(DATA_KEY$1);
  16492. if (!data) {
  16493. data = new Button(this);
  16494. $(this).data(DATA_KEY$1, data);
  16495. }
  16496. if (config === 'toggle') {
  16497. data[config]();
  16498. }
  16499. });
  16500. };
  16501. _createClass(Button, null, [{
  16502. key: "VERSION",
  16503. get: function get() {
  16504. return VERSION$1;
  16505. }
  16506. }]);
  16507. return Button;
  16508. }();
  16509. /**
  16510. * ------------------------------------------------------------------------
  16511. * Data Api implementation
  16512. * ------------------------------------------------------------------------
  16513. */
  16514. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  16515. event.preventDefault();
  16516. var button = event.target;
  16517. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  16518. button = $(button).closest(Selector$1.BUTTON);
  16519. }
  16520. Button._jQueryInterface.call($(button), 'toggle');
  16521. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  16522. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  16523. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  16524. });
  16525. /**
  16526. * ------------------------------------------------------------------------
  16527. * jQuery
  16528. * ------------------------------------------------------------------------
  16529. */
  16530. $.fn[NAME$1] = Button._jQueryInterface;
  16531. $.fn[NAME$1].Constructor = Button;
  16532. $.fn[NAME$1].noConflict = function () {
  16533. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  16534. return Button._jQueryInterface;
  16535. };
  16536. /**
  16537. * ------------------------------------------------------------------------
  16538. * Constants
  16539. * ------------------------------------------------------------------------
  16540. */
  16541. var NAME$2 = 'carousel';
  16542. var VERSION$2 = '4.3.1';
  16543. var DATA_KEY$2 = 'bs.carousel';
  16544. var EVENT_KEY$2 = "." + DATA_KEY$2;
  16545. var DATA_API_KEY$2 = '.data-api';
  16546. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  16547. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  16548. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  16549. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  16550. var SWIPE_THRESHOLD = 40;
  16551. var Default = {
  16552. interval: 5000,
  16553. keyboard: true,
  16554. slide: false,
  16555. pause: 'hover',
  16556. wrap: true,
  16557. touch: true
  16558. };
  16559. var DefaultType = {
  16560. interval: '(number|boolean)',
  16561. keyboard: 'boolean',
  16562. slide: '(boolean|string)',
  16563. pause: '(string|boolean)',
  16564. wrap: 'boolean',
  16565. touch: 'boolean'
  16566. };
  16567. var Direction = {
  16568. NEXT: 'next',
  16569. PREV: 'prev',
  16570. LEFT: 'left',
  16571. RIGHT: 'right'
  16572. };
  16573. var Event$2 = {
  16574. SLIDE: "slide" + EVENT_KEY$2,
  16575. SLID: "slid" + EVENT_KEY$2,
  16576. KEYDOWN: "keydown" + EVENT_KEY$2,
  16577. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  16578. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  16579. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  16580. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  16581. TOUCHEND: "touchend" + EVENT_KEY$2,
  16582. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  16583. POINTERUP: "pointerup" + EVENT_KEY$2,
  16584. DRAG_START: "dragstart" + EVENT_KEY$2,
  16585. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  16586. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  16587. };
  16588. var ClassName$2 = {
  16589. CAROUSEL: 'carousel',
  16590. ACTIVE: 'active',
  16591. SLIDE: 'slide',
  16592. RIGHT: 'carousel-item-right',
  16593. LEFT: 'carousel-item-left',
  16594. NEXT: 'carousel-item-next',
  16595. PREV: 'carousel-item-prev',
  16596. ITEM: 'carousel-item',
  16597. POINTER_EVENT: 'pointer-event'
  16598. };
  16599. var Selector$2 = {
  16600. ACTIVE: '.active',
  16601. ACTIVE_ITEM: '.active.carousel-item',
  16602. ITEM: '.carousel-item',
  16603. ITEM_IMG: '.carousel-item img',
  16604. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  16605. INDICATORS: '.carousel-indicators',
  16606. DATA_SLIDE: '[data-slide], [data-slide-to]',
  16607. DATA_RIDE: '[data-ride="carousel"]'
  16608. };
  16609. var PointerType = {
  16610. TOUCH: 'touch',
  16611. PEN: 'pen'
  16612. /**
  16613. * ------------------------------------------------------------------------
  16614. * Class Definition
  16615. * ------------------------------------------------------------------------
  16616. */
  16617. };
  16618. var Carousel =
  16619. /*#__PURE__*/
  16620. function () {
  16621. function Carousel(element, config) {
  16622. this._items = null;
  16623. this._interval = null;
  16624. this._activeElement = null;
  16625. this._isPaused = false;
  16626. this._isSliding = false;
  16627. this.touchTimeout = null;
  16628. this.touchStartX = 0;
  16629. this.touchDeltaX = 0;
  16630. this._config = this._getConfig(config);
  16631. this._element = element;
  16632. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  16633. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  16634. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  16635. this._addEventListeners();
  16636. } // Getters
  16637. var _proto = Carousel.prototype;
  16638. // Public
  16639. _proto.next = function next() {
  16640. if (!this._isSliding) {
  16641. this._slide(Direction.NEXT);
  16642. }
  16643. };
  16644. _proto.nextWhenVisible = function nextWhenVisible() {
  16645. // Don't call next when the page isn't visible
  16646. // or the carousel or its parent isn't visible
  16647. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  16648. this.next();
  16649. }
  16650. };
  16651. _proto.prev = function prev() {
  16652. if (!this._isSliding) {
  16653. this._slide(Direction.PREV);
  16654. }
  16655. };
  16656. _proto.pause = function pause(event) {
  16657. if (!event) {
  16658. this._isPaused = true;
  16659. }
  16660. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  16661. Util.triggerTransitionEnd(this._element);
  16662. this.cycle(true);
  16663. }
  16664. clearInterval(this._interval);
  16665. this._interval = null;
  16666. };
  16667. _proto.cycle = function cycle(event) {
  16668. if (!event) {
  16669. this._isPaused = false;
  16670. }
  16671. if (this._interval) {
  16672. clearInterval(this._interval);
  16673. this._interval = null;
  16674. }
  16675. if (this._config.interval && !this._isPaused) {
  16676. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  16677. }
  16678. };
  16679. _proto.to = function to(index) {
  16680. var _this = this;
  16681. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  16682. var activeIndex = this._getItemIndex(this._activeElement);
  16683. if (index > this._items.length - 1 || index < 0) {
  16684. return;
  16685. }
  16686. if (this._isSliding) {
  16687. $(this._element).one(Event$2.SLID, function () {
  16688. return _this.to(index);
  16689. });
  16690. return;
  16691. }
  16692. if (activeIndex === index) {
  16693. this.pause();
  16694. this.cycle();
  16695. return;
  16696. }
  16697. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  16698. this._slide(direction, this._items[index]);
  16699. };
  16700. _proto.dispose = function dispose() {
  16701. $(this._element).off(EVENT_KEY$2);
  16702. $.removeData(this._element, DATA_KEY$2);
  16703. this._items = null;
  16704. this._config = null;
  16705. this._element = null;
  16706. this._interval = null;
  16707. this._isPaused = null;
  16708. this._isSliding = null;
  16709. this._activeElement = null;
  16710. this._indicatorsElement = null;
  16711. } // Private
  16712. ;
  16713. _proto._getConfig = function _getConfig(config) {
  16714. config = _objectSpread({}, Default, config);
  16715. Util.typeCheckConfig(NAME$2, config, DefaultType);
  16716. return config;
  16717. };
  16718. _proto._handleSwipe = function _handleSwipe() {
  16719. var absDeltax = Math.abs(this.touchDeltaX);
  16720. if (absDeltax <= SWIPE_THRESHOLD) {
  16721. return;
  16722. }
  16723. var direction = absDeltax / this.touchDeltaX; // swipe left
  16724. if (direction > 0) {
  16725. this.prev();
  16726. } // swipe right
  16727. if (direction < 0) {
  16728. this.next();
  16729. }
  16730. };
  16731. _proto._addEventListeners = function _addEventListeners() {
  16732. var _this2 = this;
  16733. if (this._config.keyboard) {
  16734. $(this._element).on(Event$2.KEYDOWN, function (event) {
  16735. return _this2._keydown(event);
  16736. });
  16737. }
  16738. if (this._config.pause === 'hover') {
  16739. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  16740. return _this2.pause(event);
  16741. }).on(Event$2.MOUSELEAVE, function (event) {
  16742. return _this2.cycle(event);
  16743. });
  16744. }
  16745. if (this._config.touch) {
  16746. this._addTouchEventListeners();
  16747. }
  16748. };
  16749. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  16750. var _this3 = this;
  16751. if (!this._touchSupported) {
  16752. return;
  16753. }
  16754. var start = function start(event) {
  16755. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  16756. _this3.touchStartX = event.originalEvent.clientX;
  16757. } else if (!_this3._pointerEvent) {
  16758. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  16759. }
  16760. };
  16761. var move = function move(event) {
  16762. // ensure swiping with one touch and not pinching
  16763. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  16764. _this3.touchDeltaX = 0;
  16765. } else {
  16766. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  16767. }
  16768. };
  16769. var end = function end(event) {
  16770. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  16771. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  16772. }
  16773. _this3._handleSwipe();
  16774. if (_this3._config.pause === 'hover') {
  16775. // If it's a touch-enabled device, mouseenter/leave are fired as
  16776. // part of the mouse compatibility events on first tap - the carousel
  16777. // would stop cycling until user tapped out of it;
  16778. // here, we listen for touchend, explicitly pause the carousel
  16779. // (as if it's the second time we tap on it, mouseenter compat event
  16780. // is NOT fired) and after a timeout (to allow for mouse compatibility
  16781. // events to fire) we explicitly restart cycling
  16782. _this3.pause();
  16783. if (_this3.touchTimeout) {
  16784. clearTimeout(_this3.touchTimeout);
  16785. }
  16786. _this3.touchTimeout = setTimeout(function (event) {
  16787. return _this3.cycle(event);
  16788. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  16789. }
  16790. };
  16791. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  16792. return e.preventDefault();
  16793. });
  16794. if (this._pointerEvent) {
  16795. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  16796. return start(event);
  16797. });
  16798. $(this._element).on(Event$2.POINTERUP, function (event) {
  16799. return end(event);
  16800. });
  16801. this._element.classList.add(ClassName$2.POINTER_EVENT);
  16802. } else {
  16803. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  16804. return start(event);
  16805. });
  16806. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  16807. return move(event);
  16808. });
  16809. $(this._element).on(Event$2.TOUCHEND, function (event) {
  16810. return end(event);
  16811. });
  16812. }
  16813. };
  16814. _proto._keydown = function _keydown(event) {
  16815. if (/input|textarea/i.test(event.target.tagName)) {
  16816. return;
  16817. }
  16818. switch (event.which) {
  16819. case ARROW_LEFT_KEYCODE:
  16820. event.preventDefault();
  16821. this.prev();
  16822. break;
  16823. case ARROW_RIGHT_KEYCODE:
  16824. event.preventDefault();
  16825. this.next();
  16826. break;
  16827. default:
  16828. }
  16829. };
  16830. _proto._getItemIndex = function _getItemIndex(element) {
  16831. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  16832. return this._items.indexOf(element);
  16833. };
  16834. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  16835. var isNextDirection = direction === Direction.NEXT;
  16836. var isPrevDirection = direction === Direction.PREV;
  16837. var activeIndex = this._getItemIndex(activeElement);
  16838. var lastItemIndex = this._items.length - 1;
  16839. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  16840. if (isGoingToWrap && !this._config.wrap) {
  16841. return activeElement;
  16842. }
  16843. var delta = direction === Direction.PREV ? -1 : 1;
  16844. var itemIndex = (activeIndex + delta) % this._items.length;
  16845. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  16846. };
  16847. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  16848. var targetIndex = this._getItemIndex(relatedTarget);
  16849. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  16850. var slideEvent = $.Event(Event$2.SLIDE, {
  16851. relatedTarget: relatedTarget,
  16852. direction: eventDirectionName,
  16853. from: fromIndex,
  16854. to: targetIndex
  16855. });
  16856. $(this._element).trigger(slideEvent);
  16857. return slideEvent;
  16858. };
  16859. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  16860. if (this._indicatorsElement) {
  16861. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  16862. $(indicators).removeClass(ClassName$2.ACTIVE);
  16863. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  16864. if (nextIndicator) {
  16865. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  16866. }
  16867. }
  16868. };
  16869. _proto._slide = function _slide(direction, element) {
  16870. var _this4 = this;
  16871. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  16872. var activeElementIndex = this._getItemIndex(activeElement);
  16873. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  16874. var nextElementIndex = this._getItemIndex(nextElement);
  16875. var isCycling = Boolean(this._interval);
  16876. var directionalClassName;
  16877. var orderClassName;
  16878. var eventDirectionName;
  16879. if (direction === Direction.NEXT) {
  16880. directionalClassName = ClassName$2.LEFT;
  16881. orderClassName = ClassName$2.NEXT;
  16882. eventDirectionName = Direction.LEFT;
  16883. } else {
  16884. directionalClassName = ClassName$2.RIGHT;
  16885. orderClassName = ClassName$2.PREV;
  16886. eventDirectionName = Direction.RIGHT;
  16887. }
  16888. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  16889. this._isSliding = false;
  16890. return;
  16891. }
  16892. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  16893. if (slideEvent.isDefaultPrevented()) {
  16894. return;
  16895. }
  16896. if (!activeElement || !nextElement) {
  16897. // Some weirdness is happening, so we bail
  16898. return;
  16899. }
  16900. this._isSliding = true;
  16901. if (isCycling) {
  16902. this.pause();
  16903. }
  16904. this._setActiveIndicatorElement(nextElement);
  16905. var slidEvent = $.Event(Event$2.SLID, {
  16906. relatedTarget: nextElement,
  16907. direction: eventDirectionName,
  16908. from: activeElementIndex,
  16909. to: nextElementIndex
  16910. });
  16911. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  16912. $(nextElement).addClass(orderClassName);
  16913. Util.reflow(nextElement);
  16914. $(activeElement).addClass(directionalClassName);
  16915. $(nextElement).addClass(directionalClassName);
  16916. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  16917. if (nextElementInterval) {
  16918. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  16919. this._config.interval = nextElementInterval;
  16920. } else {
  16921. this._config.interval = this._config.defaultInterval || this._config.interval;
  16922. }
  16923. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  16924. $(activeElement).one(Util.TRANSITION_END, function () {
  16925. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  16926. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  16927. _this4._isSliding = false;
  16928. setTimeout(function () {
  16929. return $(_this4._element).trigger(slidEvent);
  16930. }, 0);
  16931. }).emulateTransitionEnd(transitionDuration);
  16932. } else {
  16933. $(activeElement).removeClass(ClassName$2.ACTIVE);
  16934. $(nextElement).addClass(ClassName$2.ACTIVE);
  16935. this._isSliding = false;
  16936. $(this._element).trigger(slidEvent);
  16937. }
  16938. if (isCycling) {
  16939. this.cycle();
  16940. }
  16941. } // Static
  16942. ;
  16943. Carousel._jQueryInterface = function _jQueryInterface(config) {
  16944. return this.each(function () {
  16945. var data = $(this).data(DATA_KEY$2);
  16946. var _config = _objectSpread({}, Default, $(this).data());
  16947. if (typeof config === 'object') {
  16948. _config = _objectSpread({}, _config, config);
  16949. }
  16950. var action = typeof config === 'string' ? config : _config.slide;
  16951. if (!data) {
  16952. data = new Carousel(this, _config);
  16953. $(this).data(DATA_KEY$2, data);
  16954. }
  16955. if (typeof config === 'number') {
  16956. data.to(config);
  16957. } else if (typeof action === 'string') {
  16958. if (typeof data[action] === 'undefined') {
  16959. throw new TypeError("No method named \"" + action + "\"");
  16960. }
  16961. data[action]();
  16962. } else if (_config.interval && _config.ride) {
  16963. data.pause();
  16964. data.cycle();
  16965. }
  16966. });
  16967. };
  16968. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  16969. var selector = Util.getSelectorFromElement(this);
  16970. if (!selector) {
  16971. return;
  16972. }
  16973. var target = $(selector)[0];
  16974. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  16975. return;
  16976. }
  16977. var config = _objectSpread({}, $(target).data(), $(this).data());
  16978. var slideIndex = this.getAttribute('data-slide-to');
  16979. if (slideIndex) {
  16980. config.interval = false;
  16981. }
  16982. Carousel._jQueryInterface.call($(target), config);
  16983. if (slideIndex) {
  16984. $(target).data(DATA_KEY$2).to(slideIndex);
  16985. }
  16986. event.preventDefault();
  16987. };
  16988. _createClass(Carousel, null, [{
  16989. key: "VERSION",
  16990. get: function get() {
  16991. return VERSION$2;
  16992. }
  16993. }, {
  16994. key: "Default",
  16995. get: function get() {
  16996. return Default;
  16997. }
  16998. }]);
  16999. return Carousel;
  17000. }();
  17001. /**
  17002. * ------------------------------------------------------------------------
  17003. * Data Api implementation
  17004. * ------------------------------------------------------------------------
  17005. */
  17006. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  17007. $(window).on(Event$2.LOAD_DATA_API, function () {
  17008. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  17009. for (var i = 0, len = carousels.length; i < len; i++) {
  17010. var $carousel = $(carousels[i]);
  17011. Carousel._jQueryInterface.call($carousel, $carousel.data());
  17012. }
  17013. });
  17014. /**
  17015. * ------------------------------------------------------------------------
  17016. * jQuery
  17017. * ------------------------------------------------------------------------
  17018. */
  17019. $.fn[NAME$2] = Carousel._jQueryInterface;
  17020. $.fn[NAME$2].Constructor = Carousel;
  17021. $.fn[NAME$2].noConflict = function () {
  17022. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  17023. return Carousel._jQueryInterface;
  17024. };
  17025. /**
  17026. * ------------------------------------------------------------------------
  17027. * Constants
  17028. * ------------------------------------------------------------------------
  17029. */
  17030. var NAME$3 = 'collapse';
  17031. var VERSION$3 = '4.3.1';
  17032. var DATA_KEY$3 = 'bs.collapse';
  17033. var EVENT_KEY$3 = "." + DATA_KEY$3;
  17034. var DATA_API_KEY$3 = '.data-api';
  17035. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  17036. var Default$1 = {
  17037. toggle: true,
  17038. parent: ''
  17039. };
  17040. var DefaultType$1 = {
  17041. toggle: 'boolean',
  17042. parent: '(string|element)'
  17043. };
  17044. var Event$3 = {
  17045. SHOW: "show" + EVENT_KEY$3,
  17046. SHOWN: "shown" + EVENT_KEY$3,
  17047. HIDE: "hide" + EVENT_KEY$3,
  17048. HIDDEN: "hidden" + EVENT_KEY$3,
  17049. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  17050. };
  17051. var ClassName$3 = {
  17052. SHOW: 'show',
  17053. COLLAPSE: 'collapse',
  17054. COLLAPSING: 'collapsing',
  17055. COLLAPSED: 'collapsed'
  17056. };
  17057. var Dimension = {
  17058. WIDTH: 'width',
  17059. HEIGHT: 'height'
  17060. };
  17061. var Selector$3 = {
  17062. ACTIVES: '.show, .collapsing',
  17063. DATA_TOGGLE: '[data-toggle="collapse"]'
  17064. /**
  17065. * ------------------------------------------------------------------------
  17066. * Class Definition
  17067. * ------------------------------------------------------------------------
  17068. */
  17069. };
  17070. var Collapse =
  17071. /*#__PURE__*/
  17072. function () {
  17073. function Collapse(element, config) {
  17074. this._isTransitioning = false;
  17075. this._element = element;
  17076. this._config = this._getConfig(config);
  17077. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  17078. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  17079. for (var i = 0, len = toggleList.length; i < len; i++) {
  17080. var elem = toggleList[i];
  17081. var selector = Util.getSelectorFromElement(elem);
  17082. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  17083. return foundElem === element;
  17084. });
  17085. if (selector !== null && filterElement.length > 0) {
  17086. this._selector = selector;
  17087. this._triggerArray.push(elem);
  17088. }
  17089. }
  17090. this._parent = this._config.parent ? this._getParent() : null;
  17091. if (!this._config.parent) {
  17092. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  17093. }
  17094. if (this._config.toggle) {
  17095. this.toggle();
  17096. }
  17097. } // Getters
  17098. var _proto = Collapse.prototype;
  17099. // Public
  17100. _proto.toggle = function toggle() {
  17101. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  17102. this.hide();
  17103. } else {
  17104. this.show();
  17105. }
  17106. };
  17107. _proto.show = function show() {
  17108. var _this = this;
  17109. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  17110. return;
  17111. }
  17112. var actives;
  17113. var activesData;
  17114. if (this._parent) {
  17115. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  17116. if (typeof _this._config.parent === 'string') {
  17117. return elem.getAttribute('data-parent') === _this._config.parent;
  17118. }
  17119. return elem.classList.contains(ClassName$3.COLLAPSE);
  17120. });
  17121. if (actives.length === 0) {
  17122. actives = null;
  17123. }
  17124. }
  17125. if (actives) {
  17126. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  17127. if (activesData && activesData._isTransitioning) {
  17128. return;
  17129. }
  17130. }
  17131. var startEvent = $.Event(Event$3.SHOW);
  17132. $(this._element).trigger(startEvent);
  17133. if (startEvent.isDefaultPrevented()) {
  17134. return;
  17135. }
  17136. if (actives) {
  17137. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  17138. if (!activesData) {
  17139. $(actives).data(DATA_KEY$3, null);
  17140. }
  17141. }
  17142. var dimension = this._getDimension();
  17143. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  17144. this._element.style[dimension] = 0;
  17145. if (this._triggerArray.length) {
  17146. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  17147. }
  17148. this.setTransitioning(true);
  17149. var complete = function complete() {
  17150. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  17151. _this._element.style[dimension] = '';
  17152. _this.setTransitioning(false);
  17153. $(_this._element).trigger(Event$3.SHOWN);
  17154. };
  17155. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  17156. var scrollSize = "scroll" + capitalizedDimension;
  17157. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  17158. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  17159. this._element.style[dimension] = this._element[scrollSize] + "px";
  17160. };
  17161. _proto.hide = function hide() {
  17162. var _this2 = this;
  17163. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  17164. return;
  17165. }
  17166. var startEvent = $.Event(Event$3.HIDE);
  17167. $(this._element).trigger(startEvent);
  17168. if (startEvent.isDefaultPrevented()) {
  17169. return;
  17170. }
  17171. var dimension = this._getDimension();
  17172. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  17173. Util.reflow(this._element);
  17174. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  17175. var triggerArrayLength = this._triggerArray.length;
  17176. if (triggerArrayLength > 0) {
  17177. for (var i = 0; i < triggerArrayLength; i++) {
  17178. var trigger = this._triggerArray[i];
  17179. var selector = Util.getSelectorFromElement(trigger);
  17180. if (selector !== null) {
  17181. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  17182. if (!$elem.hasClass(ClassName$3.SHOW)) {
  17183. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  17184. }
  17185. }
  17186. }
  17187. }
  17188. this.setTransitioning(true);
  17189. var complete = function complete() {
  17190. _this2.setTransitioning(false);
  17191. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  17192. };
  17193. this._element.style[dimension] = '';
  17194. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  17195. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  17196. };
  17197. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  17198. this._isTransitioning = isTransitioning;
  17199. };
  17200. _proto.dispose = function dispose() {
  17201. $.removeData(this._element, DATA_KEY$3);
  17202. this._config = null;
  17203. this._parent = null;
  17204. this._element = null;
  17205. this._triggerArray = null;
  17206. this._isTransitioning = null;
  17207. } // Private
  17208. ;
  17209. _proto._getConfig = function _getConfig(config) {
  17210. config = _objectSpread({}, Default$1, config);
  17211. config.toggle = Boolean(config.toggle); // Coerce string values
  17212. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  17213. return config;
  17214. };
  17215. _proto._getDimension = function _getDimension() {
  17216. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  17217. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  17218. };
  17219. _proto._getParent = function _getParent() {
  17220. var _this3 = this;
  17221. var parent;
  17222. if (Util.isElement(this._config.parent)) {
  17223. parent = this._config.parent; // It's a jQuery object
  17224. if (typeof this._config.parent.jquery !== 'undefined') {
  17225. parent = this._config.parent[0];
  17226. }
  17227. } else {
  17228. parent = document.querySelector(this._config.parent);
  17229. }
  17230. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  17231. var children = [].slice.call(parent.querySelectorAll(selector));
  17232. $(children).each(function (i, element) {
  17233. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  17234. });
  17235. return parent;
  17236. };
  17237. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  17238. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  17239. if (triggerArray.length) {
  17240. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  17241. }
  17242. } // Static
  17243. ;
  17244. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  17245. var selector = Util.getSelectorFromElement(element);
  17246. return selector ? document.querySelector(selector) : null;
  17247. };
  17248. Collapse._jQueryInterface = function _jQueryInterface(config) {
  17249. return this.each(function () {
  17250. var $this = $(this);
  17251. var data = $this.data(DATA_KEY$3);
  17252. var _config = _objectSpread({}, Default$1, $this.data(), typeof config === 'object' && config ? config : {});
  17253. if (!data && _config.toggle && /show|hide/.test(config)) {
  17254. _config.toggle = false;
  17255. }
  17256. if (!data) {
  17257. data = new Collapse(this, _config);
  17258. $this.data(DATA_KEY$3, data);
  17259. }
  17260. if (typeof config === 'string') {
  17261. if (typeof data[config] === 'undefined') {
  17262. throw new TypeError("No method named \"" + config + "\"");
  17263. }
  17264. data[config]();
  17265. }
  17266. });
  17267. };
  17268. _createClass(Collapse, null, [{
  17269. key: "VERSION",
  17270. get: function get() {
  17271. return VERSION$3;
  17272. }
  17273. }, {
  17274. key: "Default",
  17275. get: function get() {
  17276. return Default$1;
  17277. }
  17278. }]);
  17279. return Collapse;
  17280. }();
  17281. /**
  17282. * ------------------------------------------------------------------------
  17283. * Data Api implementation
  17284. * ------------------------------------------------------------------------
  17285. */
  17286. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  17287. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  17288. if (event.currentTarget.tagName === 'A') {
  17289. event.preventDefault();
  17290. }
  17291. var $trigger = $(this);
  17292. var selector = Util.getSelectorFromElement(this);
  17293. var selectors = [].slice.call(document.querySelectorAll(selector));
  17294. $(selectors).each(function () {
  17295. var $target = $(this);
  17296. var data = $target.data(DATA_KEY$3);
  17297. var config = data ? 'toggle' : $trigger.data();
  17298. Collapse._jQueryInterface.call($target, config);
  17299. });
  17300. });
  17301. /**
  17302. * ------------------------------------------------------------------------
  17303. * jQuery
  17304. * ------------------------------------------------------------------------
  17305. */
  17306. $.fn[NAME$3] = Collapse._jQueryInterface;
  17307. $.fn[NAME$3].Constructor = Collapse;
  17308. $.fn[NAME$3].noConflict = function () {
  17309. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  17310. return Collapse._jQueryInterface;
  17311. };
  17312. /**
  17313. * ------------------------------------------------------------------------
  17314. * Constants
  17315. * ------------------------------------------------------------------------
  17316. */
  17317. var NAME$4 = 'dropdown';
  17318. var VERSION$4 = '4.3.1';
  17319. var DATA_KEY$4 = 'bs.dropdown';
  17320. var EVENT_KEY$4 = "." + DATA_KEY$4;
  17321. var DATA_API_KEY$4 = '.data-api';
  17322. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  17323. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  17324. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  17325. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  17326. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  17327. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  17328. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  17329. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  17330. var Event$4 = {
  17331. HIDE: "hide" + EVENT_KEY$4,
  17332. HIDDEN: "hidden" + EVENT_KEY$4,
  17333. SHOW: "show" + EVENT_KEY$4,
  17334. SHOWN: "shown" + EVENT_KEY$4,
  17335. CLICK: "click" + EVENT_KEY$4,
  17336. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  17337. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  17338. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  17339. };
  17340. var ClassName$4 = {
  17341. DISABLED: 'disabled',
  17342. SHOW: 'show',
  17343. DROPUP: 'dropup',
  17344. DROPRIGHT: 'dropright',
  17345. DROPLEFT: 'dropleft',
  17346. MENURIGHT: 'dropdown-menu-right',
  17347. MENULEFT: 'dropdown-menu-left',
  17348. POSITION_STATIC: 'position-static'
  17349. };
  17350. var Selector$4 = {
  17351. DATA_TOGGLE: '[data-toggle="dropdown"]',
  17352. FORM_CHILD: '.dropdown form',
  17353. MENU: '.dropdown-menu',
  17354. NAVBAR_NAV: '.navbar-nav',
  17355. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  17356. };
  17357. var AttachmentMap = {
  17358. TOP: 'top-start',
  17359. TOPEND: 'top-end',
  17360. BOTTOM: 'bottom-start',
  17361. BOTTOMEND: 'bottom-end',
  17362. RIGHT: 'right-start',
  17363. RIGHTEND: 'right-end',
  17364. LEFT: 'left-start',
  17365. LEFTEND: 'left-end'
  17366. };
  17367. var Default$2 = {
  17368. offset: 0,
  17369. flip: true,
  17370. boundary: 'scrollParent',
  17371. reference: 'toggle',
  17372. display: 'dynamic'
  17373. };
  17374. var DefaultType$2 = {
  17375. offset: '(number|string|function)',
  17376. flip: 'boolean',
  17377. boundary: '(string|element)',
  17378. reference: '(string|element)',
  17379. display: 'string'
  17380. /**
  17381. * ------------------------------------------------------------------------
  17382. * Class Definition
  17383. * ------------------------------------------------------------------------
  17384. */
  17385. };
  17386. var Dropdown =
  17387. /*#__PURE__*/
  17388. function () {
  17389. function Dropdown(element, config) {
  17390. this._element = element;
  17391. this._popper = null;
  17392. this._config = this._getConfig(config);
  17393. this._menu = this._getMenuElement();
  17394. this._inNavbar = this._detectNavbar();
  17395. this._addEventListeners();
  17396. } // Getters
  17397. var _proto = Dropdown.prototype;
  17398. // Public
  17399. _proto.toggle = function toggle() {
  17400. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  17401. return;
  17402. }
  17403. var parent = Dropdown._getParentFromElement(this._element);
  17404. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  17405. Dropdown._clearMenus();
  17406. if (isActive) {
  17407. return;
  17408. }
  17409. var relatedTarget = {
  17410. relatedTarget: this._element
  17411. };
  17412. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  17413. $(parent).trigger(showEvent);
  17414. if (showEvent.isDefaultPrevented()) {
  17415. return;
  17416. } // Disable totally Popper.js for Dropdown in Navbar
  17417. if (!this._inNavbar) {
  17418. /**
  17419. * Check for Popper dependency
  17420. * Popper - https://popper.js.org
  17421. */
  17422. if (typeof Popper === 'undefined') {
  17423. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  17424. }
  17425. var referenceElement = this._element;
  17426. if (this._config.reference === 'parent') {
  17427. referenceElement = parent;
  17428. } else if (Util.isElement(this._config.reference)) {
  17429. referenceElement = this._config.reference; // Check if it's jQuery element
  17430. if (typeof this._config.reference.jquery !== 'undefined') {
  17431. referenceElement = this._config.reference[0];
  17432. }
  17433. } // If boundary is not `scrollParent`, then set position to `static`
  17434. // to allow the menu to "escape" the scroll parent's boundaries
  17435. // https://github.com/twbs/bootstrap/issues/24251
  17436. if (this._config.boundary !== 'scrollParent') {
  17437. $(parent).addClass(ClassName$4.POSITION_STATIC);
  17438. }
  17439. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  17440. } // If this is a touch-enabled device we add extra
  17441. // empty mouseover listeners to the body's immediate children;
  17442. // only needed because of broken event delegation on iOS
  17443. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  17444. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  17445. $(document.body).children().on('mouseover', null, $.noop);
  17446. }
  17447. this._element.focus();
  17448. this._element.setAttribute('aria-expanded', true);
  17449. $(this._menu).toggleClass(ClassName$4.SHOW);
  17450. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  17451. };
  17452. _proto.show = function show() {
  17453. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  17454. return;
  17455. }
  17456. var relatedTarget = {
  17457. relatedTarget: this._element
  17458. };
  17459. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  17460. var parent = Dropdown._getParentFromElement(this._element);
  17461. $(parent).trigger(showEvent);
  17462. if (showEvent.isDefaultPrevented()) {
  17463. return;
  17464. }
  17465. $(this._menu).toggleClass(ClassName$4.SHOW);
  17466. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  17467. };
  17468. _proto.hide = function hide() {
  17469. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  17470. return;
  17471. }
  17472. var relatedTarget = {
  17473. relatedTarget: this._element
  17474. };
  17475. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  17476. var parent = Dropdown._getParentFromElement(this._element);
  17477. $(parent).trigger(hideEvent);
  17478. if (hideEvent.isDefaultPrevented()) {
  17479. return;
  17480. }
  17481. $(this._menu).toggleClass(ClassName$4.SHOW);
  17482. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  17483. };
  17484. _proto.dispose = function dispose() {
  17485. $.removeData(this._element, DATA_KEY$4);
  17486. $(this._element).off(EVENT_KEY$4);
  17487. this._element = null;
  17488. this._menu = null;
  17489. if (this._popper !== null) {
  17490. this._popper.destroy();
  17491. this._popper = null;
  17492. }
  17493. };
  17494. _proto.update = function update() {
  17495. this._inNavbar = this._detectNavbar();
  17496. if (this._popper !== null) {
  17497. this._popper.scheduleUpdate();
  17498. }
  17499. } // Private
  17500. ;
  17501. _proto._addEventListeners = function _addEventListeners() {
  17502. var _this = this;
  17503. $(this._element).on(Event$4.CLICK, function (event) {
  17504. event.preventDefault();
  17505. event.stopPropagation();
  17506. _this.toggle();
  17507. });
  17508. };
  17509. _proto._getConfig = function _getConfig(config) {
  17510. config = _objectSpread({}, this.constructor.Default, $(this._element).data(), config);
  17511. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  17512. return config;
  17513. };
  17514. _proto._getMenuElement = function _getMenuElement() {
  17515. if (!this._menu) {
  17516. var parent = Dropdown._getParentFromElement(this._element);
  17517. if (parent) {
  17518. this._menu = parent.querySelector(Selector$4.MENU);
  17519. }
  17520. }
  17521. return this._menu;
  17522. };
  17523. _proto._getPlacement = function _getPlacement() {
  17524. var $parentDropdown = $(this._element.parentNode);
  17525. var placement = AttachmentMap.BOTTOM; // Handle dropup
  17526. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  17527. placement = AttachmentMap.TOP;
  17528. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  17529. placement = AttachmentMap.TOPEND;
  17530. }
  17531. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  17532. placement = AttachmentMap.RIGHT;
  17533. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  17534. placement = AttachmentMap.LEFT;
  17535. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  17536. placement = AttachmentMap.BOTTOMEND;
  17537. }
  17538. return placement;
  17539. };
  17540. _proto._detectNavbar = function _detectNavbar() {
  17541. return $(this._element).closest('.navbar').length > 0;
  17542. };
  17543. _proto._getOffset = function _getOffset() {
  17544. var _this2 = this;
  17545. var offset = {};
  17546. if (typeof this._config.offset === 'function') {
  17547. offset.fn = function (data) {
  17548. data.offsets = _objectSpread({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {});
  17549. return data;
  17550. };
  17551. } else {
  17552. offset.offset = this._config.offset;
  17553. }
  17554. return offset;
  17555. };
  17556. _proto._getPopperConfig = function _getPopperConfig() {
  17557. var popperConfig = {
  17558. placement: this._getPlacement(),
  17559. modifiers: {
  17560. offset: this._getOffset(),
  17561. flip: {
  17562. enabled: this._config.flip
  17563. },
  17564. preventOverflow: {
  17565. boundariesElement: this._config.boundary
  17566. }
  17567. } // Disable Popper.js if we have a static display
  17568. };
  17569. if (this._config.display === 'static') {
  17570. popperConfig.modifiers.applyStyle = {
  17571. enabled: false
  17572. };
  17573. }
  17574. return popperConfig;
  17575. } // Static
  17576. ;
  17577. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  17578. return this.each(function () {
  17579. var data = $(this).data(DATA_KEY$4);
  17580. var _config = typeof config === 'object' ? config : null;
  17581. if (!data) {
  17582. data = new Dropdown(this, _config);
  17583. $(this).data(DATA_KEY$4, data);
  17584. }
  17585. if (typeof config === 'string') {
  17586. if (typeof data[config] === 'undefined') {
  17587. throw new TypeError("No method named \"" + config + "\"");
  17588. }
  17589. data[config]();
  17590. }
  17591. });
  17592. };
  17593. Dropdown._clearMenus = function _clearMenus(event) {
  17594. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  17595. return;
  17596. }
  17597. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  17598. for (var i = 0, len = toggles.length; i < len; i++) {
  17599. var parent = Dropdown._getParentFromElement(toggles[i]);
  17600. var context = $(toggles[i]).data(DATA_KEY$4);
  17601. var relatedTarget = {
  17602. relatedTarget: toggles[i]
  17603. };
  17604. if (event && event.type === 'click') {
  17605. relatedTarget.clickEvent = event;
  17606. }
  17607. if (!context) {
  17608. continue;
  17609. }
  17610. var dropdownMenu = context._menu;
  17611. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  17612. continue;
  17613. }
  17614. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  17615. continue;
  17616. }
  17617. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  17618. $(parent).trigger(hideEvent);
  17619. if (hideEvent.isDefaultPrevented()) {
  17620. continue;
  17621. } // If this is a touch-enabled device we remove the extra
  17622. // empty mouseover listeners we added for iOS support
  17623. if ('ontouchstart' in document.documentElement) {
  17624. $(document.body).children().off('mouseover', null, $.noop);
  17625. }
  17626. toggles[i].setAttribute('aria-expanded', 'false');
  17627. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  17628. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  17629. }
  17630. };
  17631. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  17632. var parent;
  17633. var selector = Util.getSelectorFromElement(element);
  17634. if (selector) {
  17635. parent = document.querySelector(selector);
  17636. }
  17637. return parent || element.parentNode;
  17638. } // eslint-disable-next-line complexity
  17639. ;
  17640. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  17641. // If not input/textarea:
  17642. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  17643. // If input/textarea:
  17644. // - If space key => not a dropdown command
  17645. // - If key is other than escape
  17646. // - If key is not up or down => not a dropdown command
  17647. // - If trigger inside the menu => not a dropdown command
  17648. if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $(event.target).closest(Selector$4.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
  17649. return;
  17650. }
  17651. event.preventDefault();
  17652. event.stopPropagation();
  17653. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  17654. return;
  17655. }
  17656. var parent = Dropdown._getParentFromElement(this);
  17657. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  17658. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  17659. if (event.which === ESCAPE_KEYCODE) {
  17660. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  17661. $(toggle).trigger('focus');
  17662. }
  17663. $(this).trigger('click');
  17664. return;
  17665. }
  17666. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS));
  17667. if (items.length === 0) {
  17668. return;
  17669. }
  17670. var index = items.indexOf(event.target);
  17671. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  17672. // Up
  17673. index--;
  17674. }
  17675. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  17676. // Down
  17677. index++;
  17678. }
  17679. if (index < 0) {
  17680. index = 0;
  17681. }
  17682. items[index].focus();
  17683. };
  17684. _createClass(Dropdown, null, [{
  17685. key: "VERSION",
  17686. get: function get() {
  17687. return VERSION$4;
  17688. }
  17689. }, {
  17690. key: "Default",
  17691. get: function get() {
  17692. return Default$2;
  17693. }
  17694. }, {
  17695. key: "DefaultType",
  17696. get: function get() {
  17697. return DefaultType$2;
  17698. }
  17699. }]);
  17700. return Dropdown;
  17701. }();
  17702. /**
  17703. * ------------------------------------------------------------------------
  17704. * Data Api implementation
  17705. * ------------------------------------------------------------------------
  17706. */
  17707. $(document).on(Event$4.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event$4.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown._dataApiKeydownHandler).on(Event$4.CLICK_DATA_API + " " + Event$4.KEYUP_DATA_API, Dropdown._clearMenus).on(Event$4.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function (event) {
  17708. event.preventDefault();
  17709. event.stopPropagation();
  17710. Dropdown._jQueryInterface.call($(this), 'toggle');
  17711. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  17712. e.stopPropagation();
  17713. });
  17714. /**
  17715. * ------------------------------------------------------------------------
  17716. * jQuery
  17717. * ------------------------------------------------------------------------
  17718. */
  17719. $.fn[NAME$4] = Dropdown._jQueryInterface;
  17720. $.fn[NAME$4].Constructor = Dropdown;
  17721. $.fn[NAME$4].noConflict = function () {
  17722. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  17723. return Dropdown._jQueryInterface;
  17724. };
  17725. /**
  17726. * ------------------------------------------------------------------------
  17727. * Constants
  17728. * ------------------------------------------------------------------------
  17729. */
  17730. var NAME$5 = 'modal';
  17731. var VERSION$5 = '4.3.1';
  17732. var DATA_KEY$5 = 'bs.modal';
  17733. var EVENT_KEY$5 = "." + DATA_KEY$5;
  17734. var DATA_API_KEY$5 = '.data-api';
  17735. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  17736. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  17737. var Default$3 = {
  17738. backdrop: true,
  17739. keyboard: true,
  17740. focus: true,
  17741. show: true
  17742. };
  17743. var DefaultType$3 = {
  17744. backdrop: '(boolean|string)',
  17745. keyboard: 'boolean',
  17746. focus: 'boolean',
  17747. show: 'boolean'
  17748. };
  17749. var Event$5 = {
  17750. HIDE: "hide" + EVENT_KEY$5,
  17751. HIDDEN: "hidden" + EVENT_KEY$5,
  17752. SHOW: "show" + EVENT_KEY$5,
  17753. SHOWN: "shown" + EVENT_KEY$5,
  17754. FOCUSIN: "focusin" + EVENT_KEY$5,
  17755. RESIZE: "resize" + EVENT_KEY$5,
  17756. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  17757. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  17758. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  17759. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  17760. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  17761. };
  17762. var ClassName$5 = {
  17763. SCROLLABLE: 'modal-dialog-scrollable',
  17764. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  17765. BACKDROP: 'modal-backdrop',
  17766. OPEN: 'modal-open',
  17767. FADE: 'fade',
  17768. SHOW: 'show'
  17769. };
  17770. var Selector$5 = {
  17771. DIALOG: '.modal-dialog',
  17772. MODAL_BODY: '.modal-body',
  17773. DATA_TOGGLE: '[data-toggle="modal"]',
  17774. DATA_DISMISS: '[data-dismiss="modal"]',
  17775. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  17776. STICKY_CONTENT: '.sticky-top'
  17777. /**
  17778. * ------------------------------------------------------------------------
  17779. * Class Definition
  17780. * ------------------------------------------------------------------------
  17781. */
  17782. };
  17783. var Modal =
  17784. /*#__PURE__*/
  17785. function () {
  17786. function Modal(element, config) {
  17787. this._config = this._getConfig(config);
  17788. this._element = element;
  17789. this._dialog = element.querySelector(Selector$5.DIALOG);
  17790. this._backdrop = null;
  17791. this._isShown = false;
  17792. this._isBodyOverflowing = false;
  17793. this._ignoreBackdropClick = false;
  17794. this._isTransitioning = false;
  17795. this._scrollbarWidth = 0;
  17796. } // Getters
  17797. var _proto = Modal.prototype;
  17798. // Public
  17799. _proto.toggle = function toggle(relatedTarget) {
  17800. return this._isShown ? this.hide() : this.show(relatedTarget);
  17801. };
  17802. _proto.show = function show(relatedTarget) {
  17803. var _this = this;
  17804. if (this._isShown || this._isTransitioning) {
  17805. return;
  17806. }
  17807. if ($(this._element).hasClass(ClassName$5.FADE)) {
  17808. this._isTransitioning = true;
  17809. }
  17810. var showEvent = $.Event(Event$5.SHOW, {
  17811. relatedTarget: relatedTarget
  17812. });
  17813. $(this._element).trigger(showEvent);
  17814. if (this._isShown || showEvent.isDefaultPrevented()) {
  17815. return;
  17816. }
  17817. this._isShown = true;
  17818. this._checkScrollbar();
  17819. this._setScrollbar();
  17820. this._adjustDialog();
  17821. this._setEscapeEvent();
  17822. this._setResizeEvent();
  17823. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  17824. return _this.hide(event);
  17825. });
  17826. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  17827. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  17828. if ($(event.target).is(_this._element)) {
  17829. _this._ignoreBackdropClick = true;
  17830. }
  17831. });
  17832. });
  17833. this._showBackdrop(function () {
  17834. return _this._showElement(relatedTarget);
  17835. });
  17836. };
  17837. _proto.hide = function hide(event) {
  17838. var _this2 = this;
  17839. if (event) {
  17840. event.preventDefault();
  17841. }
  17842. if (!this._isShown || this._isTransitioning) {
  17843. return;
  17844. }
  17845. var hideEvent = $.Event(Event$5.HIDE);
  17846. $(this._element).trigger(hideEvent);
  17847. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  17848. return;
  17849. }
  17850. this._isShown = false;
  17851. var transition = $(this._element).hasClass(ClassName$5.FADE);
  17852. if (transition) {
  17853. this._isTransitioning = true;
  17854. }
  17855. this._setEscapeEvent();
  17856. this._setResizeEvent();
  17857. $(document).off(Event$5.FOCUSIN);
  17858. $(this._element).removeClass(ClassName$5.SHOW);
  17859. $(this._element).off(Event$5.CLICK_DISMISS);
  17860. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  17861. if (transition) {
  17862. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  17863. $(this._element).one(Util.TRANSITION_END, function (event) {
  17864. return _this2._hideModal(event);
  17865. }).emulateTransitionEnd(transitionDuration);
  17866. } else {
  17867. this._hideModal();
  17868. }
  17869. };
  17870. _proto.dispose = function dispose() {
  17871. [window, this._element, this._dialog].forEach(function (htmlElement) {
  17872. return $(htmlElement).off(EVENT_KEY$5);
  17873. });
  17874. /**
  17875. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  17876. * Do not move `document` in `htmlElements` array
  17877. * It will remove `Event.CLICK_DATA_API` event that should remain
  17878. */
  17879. $(document).off(Event$5.FOCUSIN);
  17880. $.removeData(this._element, DATA_KEY$5);
  17881. this._config = null;
  17882. this._element = null;
  17883. this._dialog = null;
  17884. this._backdrop = null;
  17885. this._isShown = null;
  17886. this._isBodyOverflowing = null;
  17887. this._ignoreBackdropClick = null;
  17888. this._isTransitioning = null;
  17889. this._scrollbarWidth = null;
  17890. };
  17891. _proto.handleUpdate = function handleUpdate() {
  17892. this._adjustDialog();
  17893. } // Private
  17894. ;
  17895. _proto._getConfig = function _getConfig(config) {
  17896. config = _objectSpread({}, Default$3, config);
  17897. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  17898. return config;
  17899. };
  17900. _proto._showElement = function _showElement(relatedTarget) {
  17901. var _this3 = this;
  17902. var transition = $(this._element).hasClass(ClassName$5.FADE);
  17903. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  17904. // Don't move modal's DOM position
  17905. document.body.appendChild(this._element);
  17906. }
  17907. this._element.style.display = 'block';
  17908. this._element.removeAttribute('aria-hidden');
  17909. this._element.setAttribute('aria-modal', true);
  17910. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE)) {
  17911. this._dialog.querySelector(Selector$5.MODAL_BODY).scrollTop = 0;
  17912. } else {
  17913. this._element.scrollTop = 0;
  17914. }
  17915. if (transition) {
  17916. Util.reflow(this._element);
  17917. }
  17918. $(this._element).addClass(ClassName$5.SHOW);
  17919. if (this._config.focus) {
  17920. this._enforceFocus();
  17921. }
  17922. var shownEvent = $.Event(Event$5.SHOWN, {
  17923. relatedTarget: relatedTarget
  17924. });
  17925. var transitionComplete = function transitionComplete() {
  17926. if (_this3._config.focus) {
  17927. _this3._element.focus();
  17928. }
  17929. _this3._isTransitioning = false;
  17930. $(_this3._element).trigger(shownEvent);
  17931. };
  17932. if (transition) {
  17933. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  17934. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  17935. } else {
  17936. transitionComplete();
  17937. }
  17938. };
  17939. _proto._enforceFocus = function _enforceFocus() {
  17940. var _this4 = this;
  17941. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  17942. .on(Event$5.FOCUSIN, function (event) {
  17943. if (document !== event.target && _this4._element !== event.target && $(_this4._element).has(event.target).length === 0) {
  17944. _this4._element.focus();
  17945. }
  17946. });
  17947. };
  17948. _proto._setEscapeEvent = function _setEscapeEvent() {
  17949. var _this5 = this;
  17950. if (this._isShown && this._config.keyboard) {
  17951. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  17952. if (event.which === ESCAPE_KEYCODE$1) {
  17953. event.preventDefault();
  17954. _this5.hide();
  17955. }
  17956. });
  17957. } else if (!this._isShown) {
  17958. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  17959. }
  17960. };
  17961. _proto._setResizeEvent = function _setResizeEvent() {
  17962. var _this6 = this;
  17963. if (this._isShown) {
  17964. $(window).on(Event$5.RESIZE, function (event) {
  17965. return _this6.handleUpdate(event);
  17966. });
  17967. } else {
  17968. $(window).off(Event$5.RESIZE);
  17969. }
  17970. };
  17971. _proto._hideModal = function _hideModal() {
  17972. var _this7 = this;
  17973. this._element.style.display = 'none';
  17974. this._element.setAttribute('aria-hidden', true);
  17975. this._element.removeAttribute('aria-modal');
  17976. this._isTransitioning = false;
  17977. this._showBackdrop(function () {
  17978. $(document.body).removeClass(ClassName$5.OPEN);
  17979. _this7._resetAdjustments();
  17980. _this7._resetScrollbar();
  17981. $(_this7._element).trigger(Event$5.HIDDEN);
  17982. });
  17983. };
  17984. _proto._removeBackdrop = function _removeBackdrop() {
  17985. if (this._backdrop) {
  17986. $(this._backdrop).remove();
  17987. this._backdrop = null;
  17988. }
  17989. };
  17990. _proto._showBackdrop = function _showBackdrop(callback) {
  17991. var _this8 = this;
  17992. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  17993. if (this._isShown && this._config.backdrop) {
  17994. this._backdrop = document.createElement('div');
  17995. this._backdrop.className = ClassName$5.BACKDROP;
  17996. if (animate) {
  17997. this._backdrop.classList.add(animate);
  17998. }
  17999. $(this._backdrop).appendTo(document.body);
  18000. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  18001. if (_this8._ignoreBackdropClick) {
  18002. _this8._ignoreBackdropClick = false;
  18003. return;
  18004. }
  18005. if (event.target !== event.currentTarget) {
  18006. return;
  18007. }
  18008. if (_this8._config.backdrop === 'static') {
  18009. _this8._element.focus();
  18010. } else {
  18011. _this8.hide();
  18012. }
  18013. });
  18014. if (animate) {
  18015. Util.reflow(this._backdrop);
  18016. }
  18017. $(this._backdrop).addClass(ClassName$5.SHOW);
  18018. if (!callback) {
  18019. return;
  18020. }
  18021. if (!animate) {
  18022. callback();
  18023. return;
  18024. }
  18025. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  18026. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  18027. } else if (!this._isShown && this._backdrop) {
  18028. $(this._backdrop).removeClass(ClassName$5.SHOW);
  18029. var callbackRemove = function callbackRemove() {
  18030. _this8._removeBackdrop();
  18031. if (callback) {
  18032. callback();
  18033. }
  18034. };
  18035. if ($(this._element).hasClass(ClassName$5.FADE)) {
  18036. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  18037. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  18038. } else {
  18039. callbackRemove();
  18040. }
  18041. } else if (callback) {
  18042. callback();
  18043. }
  18044. } // ----------------------------------------------------------------------
  18045. // the following methods are used to handle overflowing modals
  18046. // todo (fat): these should probably be refactored out of modal.js
  18047. // ----------------------------------------------------------------------
  18048. ;
  18049. _proto._adjustDialog = function _adjustDialog() {
  18050. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  18051. if (!this._isBodyOverflowing && isModalOverflowing) {
  18052. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  18053. }
  18054. if (this._isBodyOverflowing && !isModalOverflowing) {
  18055. this._element.style.paddingRight = this._scrollbarWidth + "px";
  18056. }
  18057. };
  18058. _proto._resetAdjustments = function _resetAdjustments() {
  18059. this._element.style.paddingLeft = '';
  18060. this._element.style.paddingRight = '';
  18061. };
  18062. _proto._checkScrollbar = function _checkScrollbar() {
  18063. var rect = document.body.getBoundingClientRect();
  18064. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  18065. this._scrollbarWidth = this._getScrollbarWidth();
  18066. };
  18067. _proto._setScrollbar = function _setScrollbar() {
  18068. var _this9 = this;
  18069. if (this._isBodyOverflowing) {
  18070. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  18071. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  18072. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  18073. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  18074. $(fixedContent).each(function (index, element) {
  18075. var actualPadding = element.style.paddingRight;
  18076. var calculatedPadding = $(element).css('padding-right');
  18077. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px");
  18078. }); // Adjust sticky content margin
  18079. $(stickyContent).each(function (index, element) {
  18080. var actualMargin = element.style.marginRight;
  18081. var calculatedMargin = $(element).css('margin-right');
  18082. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px");
  18083. }); // Adjust body padding
  18084. var actualPadding = document.body.style.paddingRight;
  18085. var calculatedPadding = $(document.body).css('padding-right');
  18086. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  18087. }
  18088. $(document.body).addClass(ClassName$5.OPEN);
  18089. };
  18090. _proto._resetScrollbar = function _resetScrollbar() {
  18091. // Restore fixed content padding
  18092. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  18093. $(fixedContent).each(function (index, element) {
  18094. var padding = $(element).data('padding-right');
  18095. $(element).removeData('padding-right');
  18096. element.style.paddingRight = padding ? padding : '';
  18097. }); // Restore sticky content
  18098. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  18099. $(elements).each(function (index, element) {
  18100. var margin = $(element).data('margin-right');
  18101. if (typeof margin !== 'undefined') {
  18102. $(element).css('margin-right', margin).removeData('margin-right');
  18103. }
  18104. }); // Restore body padding
  18105. var padding = $(document.body).data('padding-right');
  18106. $(document.body).removeData('padding-right');
  18107. document.body.style.paddingRight = padding ? padding : '';
  18108. };
  18109. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  18110. // thx d.walsh
  18111. var scrollDiv = document.createElement('div');
  18112. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  18113. document.body.appendChild(scrollDiv);
  18114. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  18115. document.body.removeChild(scrollDiv);
  18116. return scrollbarWidth;
  18117. } // Static
  18118. ;
  18119. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  18120. return this.each(function () {
  18121. var data = $(this).data(DATA_KEY$5);
  18122. var _config = _objectSpread({}, Default$3, $(this).data(), typeof config === 'object' && config ? config : {});
  18123. if (!data) {
  18124. data = new Modal(this, _config);
  18125. $(this).data(DATA_KEY$5, data);
  18126. }
  18127. if (typeof config === 'string') {
  18128. if (typeof data[config] === 'undefined') {
  18129. throw new TypeError("No method named \"" + config + "\"");
  18130. }
  18131. data[config](relatedTarget);
  18132. } else if (_config.show) {
  18133. data.show(relatedTarget);
  18134. }
  18135. });
  18136. };
  18137. _createClass(Modal, null, [{
  18138. key: "VERSION",
  18139. get: function get() {
  18140. return VERSION$5;
  18141. }
  18142. }, {
  18143. key: "Default",
  18144. get: function get() {
  18145. return Default$3;
  18146. }
  18147. }]);
  18148. return Modal;
  18149. }();
  18150. /**
  18151. * ------------------------------------------------------------------------
  18152. * Data Api implementation
  18153. * ------------------------------------------------------------------------
  18154. */
  18155. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  18156. var _this10 = this;
  18157. var target;
  18158. var selector = Util.getSelectorFromElement(this);
  18159. if (selector) {
  18160. target = document.querySelector(selector);
  18161. }
  18162. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread({}, $(target).data(), $(this).data());
  18163. if (this.tagName === 'A' || this.tagName === 'AREA') {
  18164. event.preventDefault();
  18165. }
  18166. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  18167. if (showEvent.isDefaultPrevented()) {
  18168. // Only register focus restorer if modal will actually get shown
  18169. return;
  18170. }
  18171. $target.one(Event$5.HIDDEN, function () {
  18172. if ($(_this10).is(':visible')) {
  18173. _this10.focus();
  18174. }
  18175. });
  18176. });
  18177. Modal._jQueryInterface.call($(target), config, this);
  18178. });
  18179. /**
  18180. * ------------------------------------------------------------------------
  18181. * jQuery
  18182. * ------------------------------------------------------------------------
  18183. */
  18184. $.fn[NAME$5] = Modal._jQueryInterface;
  18185. $.fn[NAME$5].Constructor = Modal;
  18186. $.fn[NAME$5].noConflict = function () {
  18187. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  18188. return Modal._jQueryInterface;
  18189. };
  18190. /**
  18191. * --------------------------------------------------------------------------
  18192. * Bootstrap (v4.3.1): tools/sanitizer.js
  18193. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  18194. * --------------------------------------------------------------------------
  18195. */
  18196. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  18197. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  18198. var DefaultWhitelist = {
  18199. // Global attributes allowed on any supplied element below.
  18200. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  18201. a: ['target', 'href', 'title', 'rel'],
  18202. area: [],
  18203. b: [],
  18204. br: [],
  18205. col: [],
  18206. code: [],
  18207. div: [],
  18208. em: [],
  18209. hr: [],
  18210. h1: [],
  18211. h2: [],
  18212. h3: [],
  18213. h4: [],
  18214. h5: [],
  18215. h6: [],
  18216. i: [],
  18217. img: ['src', 'alt', 'title', 'width', 'height'],
  18218. li: [],
  18219. ol: [],
  18220. p: [],
  18221. pre: [],
  18222. s: [],
  18223. small: [],
  18224. span: [],
  18225. sub: [],
  18226. sup: [],
  18227. strong: [],
  18228. u: [],
  18229. ul: []
  18230. /**
  18231. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  18232. *
  18233. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  18234. */
  18235. };
  18236. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  18237. /**
  18238. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  18239. *
  18240. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  18241. */
  18242. var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
  18243. function allowedAttribute(attr, allowedAttributeList) {
  18244. var attrName = attr.nodeName.toLowerCase();
  18245. if (allowedAttributeList.indexOf(attrName) !== -1) {
  18246. if (uriAttrs.indexOf(attrName) !== -1) {
  18247. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  18248. }
  18249. return true;
  18250. }
  18251. var regExp = allowedAttributeList.filter(function (attrRegex) {
  18252. return attrRegex instanceof RegExp;
  18253. }); // Check if a regular expression validates the attribute.
  18254. for (var i = 0, l = regExp.length; i < l; i++) {
  18255. if (attrName.match(regExp[i])) {
  18256. return true;
  18257. }
  18258. }
  18259. return false;
  18260. }
  18261. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  18262. if (unsafeHtml.length === 0) {
  18263. return unsafeHtml;
  18264. }
  18265. if (sanitizeFn && typeof sanitizeFn === 'function') {
  18266. return sanitizeFn(unsafeHtml);
  18267. }
  18268. var domParser = new window.DOMParser();
  18269. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  18270. var whitelistKeys = Object.keys(whiteList);
  18271. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  18272. var _loop = function _loop(i, len) {
  18273. var el = elements[i];
  18274. var elName = el.nodeName.toLowerCase();
  18275. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  18276. el.parentNode.removeChild(el);
  18277. return "continue";
  18278. }
  18279. var attributeList = [].slice.call(el.attributes);
  18280. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  18281. attributeList.forEach(function (attr) {
  18282. if (!allowedAttribute(attr, whitelistedAttributes)) {
  18283. el.removeAttribute(attr.nodeName);
  18284. }
  18285. });
  18286. };
  18287. for (var i = 0, len = elements.length; i < len; i++) {
  18288. var _ret = _loop(i, len);
  18289. if (_ret === "continue") continue;
  18290. }
  18291. return createdDocument.body.innerHTML;
  18292. }
  18293. /**
  18294. * ------------------------------------------------------------------------
  18295. * Constants
  18296. * ------------------------------------------------------------------------
  18297. */
  18298. var NAME$6 = 'tooltip';
  18299. var VERSION$6 = '4.3.1';
  18300. var DATA_KEY$6 = 'bs.tooltip';
  18301. var EVENT_KEY$6 = "." + DATA_KEY$6;
  18302. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  18303. var CLASS_PREFIX = 'bs-tooltip';
  18304. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  18305. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  18306. var DefaultType$4 = {
  18307. animation: 'boolean',
  18308. template: 'string',
  18309. title: '(string|element|function)',
  18310. trigger: 'string',
  18311. delay: '(number|object)',
  18312. html: 'boolean',
  18313. selector: '(string|boolean)',
  18314. placement: '(string|function)',
  18315. offset: '(number|string|function)',
  18316. container: '(string|element|boolean)',
  18317. fallbackPlacement: '(string|array)',
  18318. boundary: '(string|element)',
  18319. sanitize: 'boolean',
  18320. sanitizeFn: '(null|function)',
  18321. whiteList: 'object'
  18322. };
  18323. var AttachmentMap$1 = {
  18324. AUTO: 'auto',
  18325. TOP: 'top',
  18326. RIGHT: 'right',
  18327. BOTTOM: 'bottom',
  18328. LEFT: 'left'
  18329. };
  18330. var Default$4 = {
  18331. animation: true,
  18332. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  18333. trigger: 'hover focus',
  18334. title: '',
  18335. delay: 0,
  18336. html: false,
  18337. selector: false,
  18338. placement: 'top',
  18339. offset: 0,
  18340. container: false,
  18341. fallbackPlacement: 'flip',
  18342. boundary: 'scrollParent',
  18343. sanitize: true,
  18344. sanitizeFn: null,
  18345. whiteList: DefaultWhitelist
  18346. };
  18347. var HoverState = {
  18348. SHOW: 'show',
  18349. OUT: 'out'
  18350. };
  18351. var Event$6 = {
  18352. HIDE: "hide" + EVENT_KEY$6,
  18353. HIDDEN: "hidden" + EVENT_KEY$6,
  18354. SHOW: "show" + EVENT_KEY$6,
  18355. SHOWN: "shown" + EVENT_KEY$6,
  18356. INSERTED: "inserted" + EVENT_KEY$6,
  18357. CLICK: "click" + EVENT_KEY$6,
  18358. FOCUSIN: "focusin" + EVENT_KEY$6,
  18359. FOCUSOUT: "focusout" + EVENT_KEY$6,
  18360. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  18361. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  18362. };
  18363. var ClassName$6 = {
  18364. FADE: 'fade',
  18365. SHOW: 'show'
  18366. };
  18367. var Selector$6 = {
  18368. TOOLTIP: '.tooltip',
  18369. TOOLTIP_INNER: '.tooltip-inner',
  18370. ARROW: '.arrow'
  18371. };
  18372. var Trigger = {
  18373. HOVER: 'hover',
  18374. FOCUS: 'focus',
  18375. CLICK: 'click',
  18376. MANUAL: 'manual'
  18377. /**
  18378. * ------------------------------------------------------------------------
  18379. * Class Definition
  18380. * ------------------------------------------------------------------------
  18381. */
  18382. };
  18383. var Tooltip =
  18384. /*#__PURE__*/
  18385. function () {
  18386. function Tooltip(element, config) {
  18387. /**
  18388. * Check for Popper dependency
  18389. * Popper - https://popper.js.org
  18390. */
  18391. if (typeof Popper === 'undefined') {
  18392. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  18393. } // private
  18394. this._isEnabled = true;
  18395. this._timeout = 0;
  18396. this._hoverState = '';
  18397. this._activeTrigger = {};
  18398. this._popper = null; // Protected
  18399. this.element = element;
  18400. this.config = this._getConfig(config);
  18401. this.tip = null;
  18402. this._setListeners();
  18403. } // Getters
  18404. var _proto = Tooltip.prototype;
  18405. // Public
  18406. _proto.enable = function enable() {
  18407. this._isEnabled = true;
  18408. };
  18409. _proto.disable = function disable() {
  18410. this._isEnabled = false;
  18411. };
  18412. _proto.toggleEnabled = function toggleEnabled() {
  18413. this._isEnabled = !this._isEnabled;
  18414. };
  18415. _proto.toggle = function toggle(event) {
  18416. if (!this._isEnabled) {
  18417. return;
  18418. }
  18419. if (event) {
  18420. var dataKey = this.constructor.DATA_KEY;
  18421. var context = $(event.currentTarget).data(dataKey);
  18422. if (!context) {
  18423. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  18424. $(event.currentTarget).data(dataKey, context);
  18425. }
  18426. context._activeTrigger.click = !context._activeTrigger.click;
  18427. if (context._isWithActiveTrigger()) {
  18428. context._enter(null, context);
  18429. } else {
  18430. context._leave(null, context);
  18431. }
  18432. } else {
  18433. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  18434. this._leave(null, this);
  18435. return;
  18436. }
  18437. this._enter(null, this);
  18438. }
  18439. };
  18440. _proto.dispose = function dispose() {
  18441. clearTimeout(this._timeout);
  18442. $.removeData(this.element, this.constructor.DATA_KEY);
  18443. $(this.element).off(this.constructor.EVENT_KEY);
  18444. $(this.element).closest('.modal').off('hide.bs.modal');
  18445. if (this.tip) {
  18446. $(this.tip).remove();
  18447. }
  18448. this._isEnabled = null;
  18449. this._timeout = null;
  18450. this._hoverState = null;
  18451. this._activeTrigger = null;
  18452. if (this._popper !== null) {
  18453. this._popper.destroy();
  18454. }
  18455. this._popper = null;
  18456. this.element = null;
  18457. this.config = null;
  18458. this.tip = null;
  18459. };
  18460. _proto.show = function show() {
  18461. var _this = this;
  18462. if ($(this.element).css('display') === 'none') {
  18463. throw new Error('Please use show on visible elements');
  18464. }
  18465. var showEvent = $.Event(this.constructor.Event.SHOW);
  18466. if (this.isWithContent() && this._isEnabled) {
  18467. $(this.element).trigger(showEvent);
  18468. var shadowRoot = Util.findShadowRoot(this.element);
  18469. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  18470. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  18471. return;
  18472. }
  18473. var tip = this.getTipElement();
  18474. var tipId = Util.getUID(this.constructor.NAME);
  18475. tip.setAttribute('id', tipId);
  18476. this.element.setAttribute('aria-describedby', tipId);
  18477. this.setContent();
  18478. if (this.config.animation) {
  18479. $(tip).addClass(ClassName$6.FADE);
  18480. }
  18481. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  18482. var attachment = this._getAttachment(placement);
  18483. this.addAttachmentClass(attachment);
  18484. var container = this._getContainer();
  18485. $(tip).data(this.constructor.DATA_KEY, this);
  18486. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  18487. $(tip).appendTo(container);
  18488. }
  18489. $(this.element).trigger(this.constructor.Event.INSERTED);
  18490. this._popper = new Popper(this.element, tip, {
  18491. placement: attachment,
  18492. modifiers: {
  18493. offset: this._getOffset(),
  18494. flip: {
  18495. behavior: this.config.fallbackPlacement
  18496. },
  18497. arrow: {
  18498. element: Selector$6.ARROW
  18499. },
  18500. preventOverflow: {
  18501. boundariesElement: this.config.boundary
  18502. }
  18503. },
  18504. onCreate: function onCreate(data) {
  18505. if (data.originalPlacement !== data.placement) {
  18506. _this._handlePopperPlacementChange(data);
  18507. }
  18508. },
  18509. onUpdate: function onUpdate(data) {
  18510. return _this._handlePopperPlacementChange(data);
  18511. }
  18512. });
  18513. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  18514. // empty mouseover listeners to the body's immediate children;
  18515. // only needed because of broken event delegation on iOS
  18516. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  18517. if ('ontouchstart' in document.documentElement) {
  18518. $(document.body).children().on('mouseover', null, $.noop);
  18519. }
  18520. var complete = function complete() {
  18521. if (_this.config.animation) {
  18522. _this._fixTransition();
  18523. }
  18524. var prevHoverState = _this._hoverState;
  18525. _this._hoverState = null;
  18526. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  18527. if (prevHoverState === HoverState.OUT) {
  18528. _this._leave(null, _this);
  18529. }
  18530. };
  18531. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  18532. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  18533. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  18534. } else {
  18535. complete();
  18536. }
  18537. }
  18538. };
  18539. _proto.hide = function hide(callback) {
  18540. var _this2 = this;
  18541. var tip = this.getTipElement();
  18542. var hideEvent = $.Event(this.constructor.Event.HIDE);
  18543. var complete = function complete() {
  18544. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  18545. tip.parentNode.removeChild(tip);
  18546. }
  18547. _this2._cleanTipClass();
  18548. _this2.element.removeAttribute('aria-describedby');
  18549. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  18550. if (_this2._popper !== null) {
  18551. _this2._popper.destroy();
  18552. }
  18553. if (callback) {
  18554. callback();
  18555. }
  18556. };
  18557. $(this.element).trigger(hideEvent);
  18558. if (hideEvent.isDefaultPrevented()) {
  18559. return;
  18560. }
  18561. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  18562. // empty mouseover listeners we added for iOS support
  18563. if ('ontouchstart' in document.documentElement) {
  18564. $(document.body).children().off('mouseover', null, $.noop);
  18565. }
  18566. this._activeTrigger[Trigger.CLICK] = false;
  18567. this._activeTrigger[Trigger.FOCUS] = false;
  18568. this._activeTrigger[Trigger.HOVER] = false;
  18569. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  18570. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  18571. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  18572. } else {
  18573. complete();
  18574. }
  18575. this._hoverState = '';
  18576. };
  18577. _proto.update = function update() {
  18578. if (this._popper !== null) {
  18579. this._popper.scheduleUpdate();
  18580. }
  18581. } // Protected
  18582. ;
  18583. _proto.isWithContent = function isWithContent() {
  18584. return Boolean(this.getTitle());
  18585. };
  18586. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  18587. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  18588. };
  18589. _proto.getTipElement = function getTipElement() {
  18590. this.tip = this.tip || $(this.config.template)[0];
  18591. return this.tip;
  18592. };
  18593. _proto.setContent = function setContent() {
  18594. var tip = this.getTipElement();
  18595. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  18596. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  18597. };
  18598. _proto.setElementContent = function setElementContent($element, content) {
  18599. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  18600. // Content is a DOM node or a jQuery
  18601. if (this.config.html) {
  18602. if (!$(content).parent().is($element)) {
  18603. $element.empty().append(content);
  18604. }
  18605. } else {
  18606. $element.text($(content).text());
  18607. }
  18608. return;
  18609. }
  18610. if (this.config.html) {
  18611. if (this.config.sanitize) {
  18612. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  18613. }
  18614. $element.html(content);
  18615. } else {
  18616. $element.text(content);
  18617. }
  18618. };
  18619. _proto.getTitle = function getTitle() {
  18620. var title = this.element.getAttribute('data-original-title');
  18621. if (!title) {
  18622. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  18623. }
  18624. return title;
  18625. } // Private
  18626. ;
  18627. _proto._getOffset = function _getOffset() {
  18628. var _this3 = this;
  18629. var offset = {};
  18630. if (typeof this.config.offset === 'function') {
  18631. offset.fn = function (data) {
  18632. data.offsets = _objectSpread({}, data.offsets, _this3.config.offset(data.offsets, _this3.element) || {});
  18633. return data;
  18634. };
  18635. } else {
  18636. offset.offset = this.config.offset;
  18637. }
  18638. return offset;
  18639. };
  18640. _proto._getContainer = function _getContainer() {
  18641. if (this.config.container === false) {
  18642. return document.body;
  18643. }
  18644. if (Util.isElement(this.config.container)) {
  18645. return $(this.config.container);
  18646. }
  18647. return $(document).find(this.config.container);
  18648. };
  18649. _proto._getAttachment = function _getAttachment(placement) {
  18650. return AttachmentMap$1[placement.toUpperCase()];
  18651. };
  18652. _proto._setListeners = function _setListeners() {
  18653. var _this4 = this;
  18654. var triggers = this.config.trigger.split(' ');
  18655. triggers.forEach(function (trigger) {
  18656. if (trigger === 'click') {
  18657. $(_this4.element).on(_this4.constructor.Event.CLICK, _this4.config.selector, function (event) {
  18658. return _this4.toggle(event);
  18659. });
  18660. } else if (trigger !== Trigger.MANUAL) {
  18661. var eventIn = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSEENTER : _this4.constructor.Event.FOCUSIN;
  18662. var eventOut = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSELEAVE : _this4.constructor.Event.FOCUSOUT;
  18663. $(_this4.element).on(eventIn, _this4.config.selector, function (event) {
  18664. return _this4._enter(event);
  18665. }).on(eventOut, _this4.config.selector, function (event) {
  18666. return _this4._leave(event);
  18667. });
  18668. }
  18669. });
  18670. $(this.element).closest('.modal').on('hide.bs.modal', function () {
  18671. if (_this4.element) {
  18672. _this4.hide();
  18673. }
  18674. });
  18675. if (this.config.selector) {
  18676. this.config = _objectSpread({}, this.config, {
  18677. trigger: 'manual',
  18678. selector: ''
  18679. });
  18680. } else {
  18681. this._fixTitle();
  18682. }
  18683. };
  18684. _proto._fixTitle = function _fixTitle() {
  18685. var titleType = typeof this.element.getAttribute('data-original-title');
  18686. if (this.element.getAttribute('title') || titleType !== 'string') {
  18687. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  18688. this.element.setAttribute('title', '');
  18689. }
  18690. };
  18691. _proto._enter = function _enter(event, context) {
  18692. var dataKey = this.constructor.DATA_KEY;
  18693. context = context || $(event.currentTarget).data(dataKey);
  18694. if (!context) {
  18695. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  18696. $(event.currentTarget).data(dataKey, context);
  18697. }
  18698. if (event) {
  18699. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  18700. }
  18701. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  18702. context._hoverState = HoverState.SHOW;
  18703. return;
  18704. }
  18705. clearTimeout(context._timeout);
  18706. context._hoverState = HoverState.SHOW;
  18707. if (!context.config.delay || !context.config.delay.show) {
  18708. context.show();
  18709. return;
  18710. }
  18711. context._timeout = setTimeout(function () {
  18712. if (context._hoverState === HoverState.SHOW) {
  18713. context.show();
  18714. }
  18715. }, context.config.delay.show);
  18716. };
  18717. _proto._leave = function _leave(event, context) {
  18718. var dataKey = this.constructor.DATA_KEY;
  18719. context = context || $(event.currentTarget).data(dataKey);
  18720. if (!context) {
  18721. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  18722. $(event.currentTarget).data(dataKey, context);
  18723. }
  18724. if (event) {
  18725. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  18726. }
  18727. if (context._isWithActiveTrigger()) {
  18728. return;
  18729. }
  18730. clearTimeout(context._timeout);
  18731. context._hoverState = HoverState.OUT;
  18732. if (!context.config.delay || !context.config.delay.hide) {
  18733. context.hide();
  18734. return;
  18735. }
  18736. context._timeout = setTimeout(function () {
  18737. if (context._hoverState === HoverState.OUT) {
  18738. context.hide();
  18739. }
  18740. }, context.config.delay.hide);
  18741. };
  18742. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  18743. for (var trigger in this._activeTrigger) {
  18744. if (this._activeTrigger[trigger]) {
  18745. return true;
  18746. }
  18747. }
  18748. return false;
  18749. };
  18750. _proto._getConfig = function _getConfig(config) {
  18751. var dataAttributes = $(this.element).data();
  18752. Object.keys(dataAttributes).forEach(function (dataAttr) {
  18753. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  18754. delete dataAttributes[dataAttr];
  18755. }
  18756. });
  18757. config = _objectSpread({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {});
  18758. if (typeof config.delay === 'number') {
  18759. config.delay = {
  18760. show: config.delay,
  18761. hide: config.delay
  18762. };
  18763. }
  18764. if (typeof config.title === 'number') {
  18765. config.title = config.title.toString();
  18766. }
  18767. if (typeof config.content === 'number') {
  18768. config.content = config.content.toString();
  18769. }
  18770. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  18771. if (config.sanitize) {
  18772. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  18773. }
  18774. return config;
  18775. };
  18776. _proto._getDelegateConfig = function _getDelegateConfig() {
  18777. var config = {};
  18778. if (this.config) {
  18779. for (var key in this.config) {
  18780. if (this.constructor.Default[key] !== this.config[key]) {
  18781. config[key] = this.config[key];
  18782. }
  18783. }
  18784. }
  18785. return config;
  18786. };
  18787. _proto._cleanTipClass = function _cleanTipClass() {
  18788. var $tip = $(this.getTipElement());
  18789. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  18790. if (tabClass !== null && tabClass.length) {
  18791. $tip.removeClass(tabClass.join(''));
  18792. }
  18793. };
  18794. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  18795. var popperInstance = popperData.instance;
  18796. this.tip = popperInstance.popper;
  18797. this._cleanTipClass();
  18798. this.addAttachmentClass(this._getAttachment(popperData.placement));
  18799. };
  18800. _proto._fixTransition = function _fixTransition() {
  18801. var tip = this.getTipElement();
  18802. var initConfigAnimation = this.config.animation;
  18803. if (tip.getAttribute('x-placement') !== null) {
  18804. return;
  18805. }
  18806. $(tip).removeClass(ClassName$6.FADE);
  18807. this.config.animation = false;
  18808. this.hide();
  18809. this.show();
  18810. this.config.animation = initConfigAnimation;
  18811. } // Static
  18812. ;
  18813. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  18814. return this.each(function () {
  18815. var data = $(this).data(DATA_KEY$6);
  18816. var _config = typeof config === 'object' && config;
  18817. if (!data && /dispose|hide/.test(config)) {
  18818. return;
  18819. }
  18820. if (!data) {
  18821. data = new Tooltip(this, _config);
  18822. $(this).data(DATA_KEY$6, data);
  18823. }
  18824. if (typeof config === 'string') {
  18825. if (typeof data[config] === 'undefined') {
  18826. throw new TypeError("No method named \"" + config + "\"");
  18827. }
  18828. data[config]();
  18829. }
  18830. });
  18831. };
  18832. _createClass(Tooltip, null, [{
  18833. key: "VERSION",
  18834. get: function get() {
  18835. return VERSION$6;
  18836. }
  18837. }, {
  18838. key: "Default",
  18839. get: function get() {
  18840. return Default$4;
  18841. }
  18842. }, {
  18843. key: "NAME",
  18844. get: function get() {
  18845. return NAME$6;
  18846. }
  18847. }, {
  18848. key: "DATA_KEY",
  18849. get: function get() {
  18850. return DATA_KEY$6;
  18851. }
  18852. }, {
  18853. key: "Event",
  18854. get: function get() {
  18855. return Event$6;
  18856. }
  18857. }, {
  18858. key: "EVENT_KEY",
  18859. get: function get() {
  18860. return EVENT_KEY$6;
  18861. }
  18862. }, {
  18863. key: "DefaultType",
  18864. get: function get() {
  18865. return DefaultType$4;
  18866. }
  18867. }]);
  18868. return Tooltip;
  18869. }();
  18870. /**
  18871. * ------------------------------------------------------------------------
  18872. * jQuery
  18873. * ------------------------------------------------------------------------
  18874. */
  18875. $.fn[NAME$6] = Tooltip._jQueryInterface;
  18876. $.fn[NAME$6].Constructor = Tooltip;
  18877. $.fn[NAME$6].noConflict = function () {
  18878. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  18879. return Tooltip._jQueryInterface;
  18880. };
  18881. /**
  18882. * ------------------------------------------------------------------------
  18883. * Constants
  18884. * ------------------------------------------------------------------------
  18885. */
  18886. var NAME$7 = 'popover';
  18887. var VERSION$7 = '4.3.1';
  18888. var DATA_KEY$7 = 'bs.popover';
  18889. var EVENT_KEY$7 = "." + DATA_KEY$7;
  18890. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  18891. var CLASS_PREFIX$1 = 'bs-popover';
  18892. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  18893. var Default$5 = _objectSpread({}, Tooltip.Default, {
  18894. placement: 'right',
  18895. trigger: 'click',
  18896. content: '',
  18897. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  18898. });
  18899. var DefaultType$5 = _objectSpread({}, Tooltip.DefaultType, {
  18900. content: '(string|element|function)'
  18901. });
  18902. var ClassName$7 = {
  18903. FADE: 'fade',
  18904. SHOW: 'show'
  18905. };
  18906. var Selector$7 = {
  18907. TITLE: '.popover-header',
  18908. CONTENT: '.popover-body'
  18909. };
  18910. var Event$7 = {
  18911. HIDE: "hide" + EVENT_KEY$7,
  18912. HIDDEN: "hidden" + EVENT_KEY$7,
  18913. SHOW: "show" + EVENT_KEY$7,
  18914. SHOWN: "shown" + EVENT_KEY$7,
  18915. INSERTED: "inserted" + EVENT_KEY$7,
  18916. CLICK: "click" + EVENT_KEY$7,
  18917. FOCUSIN: "focusin" + EVENT_KEY$7,
  18918. FOCUSOUT: "focusout" + EVENT_KEY$7,
  18919. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  18920. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  18921. /**
  18922. * ------------------------------------------------------------------------
  18923. * Class Definition
  18924. * ------------------------------------------------------------------------
  18925. */
  18926. };
  18927. var Popover =
  18928. /*#__PURE__*/
  18929. function (_Tooltip) {
  18930. _inheritsLoose(Popover, _Tooltip);
  18931. function Popover() {
  18932. return _Tooltip.apply(this, arguments) || this;
  18933. }
  18934. var _proto = Popover.prototype;
  18935. // Overrides
  18936. _proto.isWithContent = function isWithContent() {
  18937. return this.getTitle() || this._getContent();
  18938. };
  18939. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  18940. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  18941. };
  18942. _proto.getTipElement = function getTipElement() {
  18943. this.tip = this.tip || $(this.config.template)[0];
  18944. return this.tip;
  18945. };
  18946. _proto.setContent = function setContent() {
  18947. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  18948. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  18949. var content = this._getContent();
  18950. if (typeof content === 'function') {
  18951. content = content.call(this.element);
  18952. }
  18953. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  18954. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  18955. } // Private
  18956. ;
  18957. _proto._getContent = function _getContent() {
  18958. return this.element.getAttribute('data-content') || this.config.content;
  18959. };
  18960. _proto._cleanTipClass = function _cleanTipClass() {
  18961. var $tip = $(this.getTipElement());
  18962. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  18963. if (tabClass !== null && tabClass.length > 0) {
  18964. $tip.removeClass(tabClass.join(''));
  18965. }
  18966. } // Static
  18967. ;
  18968. Popover._jQueryInterface = function _jQueryInterface(config) {
  18969. return this.each(function () {
  18970. var data = $(this).data(DATA_KEY$7);
  18971. var _config = typeof config === 'object' ? config : null;
  18972. if (!data && /dispose|hide/.test(config)) {
  18973. return;
  18974. }
  18975. if (!data) {
  18976. data = new Popover(this, _config);
  18977. $(this).data(DATA_KEY$7, data);
  18978. }
  18979. if (typeof config === 'string') {
  18980. if (typeof data[config] === 'undefined') {
  18981. throw new TypeError("No method named \"" + config + "\"");
  18982. }
  18983. data[config]();
  18984. }
  18985. });
  18986. };
  18987. _createClass(Popover, null, [{
  18988. key: "VERSION",
  18989. // Getters
  18990. get: function get() {
  18991. return VERSION$7;
  18992. }
  18993. }, {
  18994. key: "Default",
  18995. get: function get() {
  18996. return Default$5;
  18997. }
  18998. }, {
  18999. key: "NAME",
  19000. get: function get() {
  19001. return NAME$7;
  19002. }
  19003. }, {
  19004. key: "DATA_KEY",
  19005. get: function get() {
  19006. return DATA_KEY$7;
  19007. }
  19008. }, {
  19009. key: "Event",
  19010. get: function get() {
  19011. return Event$7;
  19012. }
  19013. }, {
  19014. key: "EVENT_KEY",
  19015. get: function get() {
  19016. return EVENT_KEY$7;
  19017. }
  19018. }, {
  19019. key: "DefaultType",
  19020. get: function get() {
  19021. return DefaultType$5;
  19022. }
  19023. }]);
  19024. return Popover;
  19025. }(Tooltip);
  19026. /**
  19027. * ------------------------------------------------------------------------
  19028. * jQuery
  19029. * ------------------------------------------------------------------------
  19030. */
  19031. $.fn[NAME$7] = Popover._jQueryInterface;
  19032. $.fn[NAME$7].Constructor = Popover;
  19033. $.fn[NAME$7].noConflict = function () {
  19034. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  19035. return Popover._jQueryInterface;
  19036. };
  19037. /**
  19038. * ------------------------------------------------------------------------
  19039. * Constants
  19040. * ------------------------------------------------------------------------
  19041. */
  19042. var NAME$8 = 'scrollspy';
  19043. var VERSION$8 = '4.3.1';
  19044. var DATA_KEY$8 = 'bs.scrollspy';
  19045. var EVENT_KEY$8 = "." + DATA_KEY$8;
  19046. var DATA_API_KEY$6 = '.data-api';
  19047. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  19048. var Default$6 = {
  19049. offset: 10,
  19050. method: 'auto',
  19051. target: ''
  19052. };
  19053. var DefaultType$6 = {
  19054. offset: 'number',
  19055. method: 'string',
  19056. target: '(string|element)'
  19057. };
  19058. var Event$8 = {
  19059. ACTIVATE: "activate" + EVENT_KEY$8,
  19060. SCROLL: "scroll" + EVENT_KEY$8,
  19061. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  19062. };
  19063. var ClassName$8 = {
  19064. DROPDOWN_ITEM: 'dropdown-item',
  19065. DROPDOWN_MENU: 'dropdown-menu',
  19066. ACTIVE: 'active'
  19067. };
  19068. var Selector$8 = {
  19069. DATA_SPY: '[data-spy="scroll"]',
  19070. ACTIVE: '.active',
  19071. NAV_LIST_GROUP: '.nav, .list-group',
  19072. NAV_LINKS: '.nav-link',
  19073. NAV_ITEMS: '.nav-item',
  19074. LIST_ITEMS: '.list-group-item',
  19075. DROPDOWN: '.dropdown',
  19076. DROPDOWN_ITEMS: '.dropdown-item',
  19077. DROPDOWN_TOGGLE: '.dropdown-toggle'
  19078. };
  19079. var OffsetMethod = {
  19080. OFFSET: 'offset',
  19081. POSITION: 'position'
  19082. /**
  19083. * ------------------------------------------------------------------------
  19084. * Class Definition
  19085. * ------------------------------------------------------------------------
  19086. */
  19087. };
  19088. var ScrollSpy =
  19089. /*#__PURE__*/
  19090. function () {
  19091. function ScrollSpy(element, config) {
  19092. var _this = this;
  19093. this._element = element;
  19094. this._scrollElement = element.tagName === 'BODY' ? window : element;
  19095. this._config = this._getConfig(config);
  19096. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  19097. this._offsets = [];
  19098. this._targets = [];
  19099. this._activeTarget = null;
  19100. this._scrollHeight = 0;
  19101. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  19102. return _this._process(event);
  19103. });
  19104. this.refresh();
  19105. this._process();
  19106. } // Getters
  19107. var _proto = ScrollSpy.prototype;
  19108. // Public
  19109. _proto.refresh = function refresh() {
  19110. var _this2 = this;
  19111. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  19112. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  19113. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  19114. this._offsets = [];
  19115. this._targets = [];
  19116. this._scrollHeight = this._getScrollHeight();
  19117. var targets = [].slice.call(document.querySelectorAll(this._selector));
  19118. targets.map(function (element) {
  19119. var target;
  19120. var targetSelector = Util.getSelectorFromElement(element);
  19121. if (targetSelector) {
  19122. target = document.querySelector(targetSelector);
  19123. }
  19124. if (target) {
  19125. var targetBCR = target.getBoundingClientRect();
  19126. if (targetBCR.width || targetBCR.height) {
  19127. // TODO (fat): remove sketch reliance on jQuery position/offset
  19128. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  19129. }
  19130. }
  19131. return null;
  19132. }).filter(function (item) {
  19133. return item;
  19134. }).sort(function (a, b) {
  19135. return a[0] - b[0];
  19136. }).forEach(function (item) {
  19137. _this2._offsets.push(item[0]);
  19138. _this2._targets.push(item[1]);
  19139. });
  19140. };
  19141. _proto.dispose = function dispose() {
  19142. $.removeData(this._element, DATA_KEY$8);
  19143. $(this._scrollElement).off(EVENT_KEY$8);
  19144. this._element = null;
  19145. this._scrollElement = null;
  19146. this._config = null;
  19147. this._selector = null;
  19148. this._offsets = null;
  19149. this._targets = null;
  19150. this._activeTarget = null;
  19151. this._scrollHeight = null;
  19152. } // Private
  19153. ;
  19154. _proto._getConfig = function _getConfig(config) {
  19155. config = _objectSpread({}, Default$6, typeof config === 'object' && config ? config : {});
  19156. if (typeof config.target !== 'string') {
  19157. var id = $(config.target).attr('id');
  19158. if (!id) {
  19159. id = Util.getUID(NAME$8);
  19160. $(config.target).attr('id', id);
  19161. }
  19162. config.target = "#" + id;
  19163. }
  19164. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  19165. return config;
  19166. };
  19167. _proto._getScrollTop = function _getScrollTop() {
  19168. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  19169. };
  19170. _proto._getScrollHeight = function _getScrollHeight() {
  19171. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  19172. };
  19173. _proto._getOffsetHeight = function _getOffsetHeight() {
  19174. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  19175. };
  19176. _proto._process = function _process() {
  19177. var scrollTop = this._getScrollTop() + this._config.offset;
  19178. var scrollHeight = this._getScrollHeight();
  19179. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  19180. if (this._scrollHeight !== scrollHeight) {
  19181. this.refresh();
  19182. }
  19183. if (scrollTop >= maxScroll) {
  19184. var target = this._targets[this._targets.length - 1];
  19185. if (this._activeTarget !== target) {
  19186. this._activate(target);
  19187. }
  19188. return;
  19189. }
  19190. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  19191. this._activeTarget = null;
  19192. this._clear();
  19193. return;
  19194. }
  19195. var offsetLength = this._offsets.length;
  19196. for (var i = offsetLength; i--;) {
  19197. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  19198. if (isActiveTarget) {
  19199. this._activate(this._targets[i]);
  19200. }
  19201. }
  19202. };
  19203. _proto._activate = function _activate(target) {
  19204. this._activeTarget = target;
  19205. this._clear();
  19206. var queries = this._selector.split(',').map(function (selector) {
  19207. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  19208. });
  19209. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  19210. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  19211. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  19212. $link.addClass(ClassName$8.ACTIVE);
  19213. } else {
  19214. // Set triggered link as active
  19215. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  19216. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  19217. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_LINKS + ", " + Selector$8.LIST_ITEMS).addClass(ClassName$8.ACTIVE); // Handle special case when .nav-link is inside .nav-item
  19218. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  19219. }
  19220. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  19221. relatedTarget: target
  19222. });
  19223. };
  19224. _proto._clear = function _clear() {
  19225. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  19226. return node.classList.contains(ClassName$8.ACTIVE);
  19227. }).forEach(function (node) {
  19228. return node.classList.remove(ClassName$8.ACTIVE);
  19229. });
  19230. } // Static
  19231. ;
  19232. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  19233. return this.each(function () {
  19234. var data = $(this).data(DATA_KEY$8);
  19235. var _config = typeof config === 'object' && config;
  19236. if (!data) {
  19237. data = new ScrollSpy(this, _config);
  19238. $(this).data(DATA_KEY$8, data);
  19239. }
  19240. if (typeof config === 'string') {
  19241. if (typeof data[config] === 'undefined') {
  19242. throw new TypeError("No method named \"" + config + "\"");
  19243. }
  19244. data[config]();
  19245. }
  19246. });
  19247. };
  19248. _createClass(ScrollSpy, null, [{
  19249. key: "VERSION",
  19250. get: function get() {
  19251. return VERSION$8;
  19252. }
  19253. }, {
  19254. key: "Default",
  19255. get: function get() {
  19256. return Default$6;
  19257. }
  19258. }]);
  19259. return ScrollSpy;
  19260. }();
  19261. /**
  19262. * ------------------------------------------------------------------------
  19263. * Data Api implementation
  19264. * ------------------------------------------------------------------------
  19265. */
  19266. $(window).on(Event$8.LOAD_DATA_API, function () {
  19267. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  19268. var scrollSpysLength = scrollSpys.length;
  19269. for (var i = scrollSpysLength; i--;) {
  19270. var $spy = $(scrollSpys[i]);
  19271. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  19272. }
  19273. });
  19274. /**
  19275. * ------------------------------------------------------------------------
  19276. * jQuery
  19277. * ------------------------------------------------------------------------
  19278. */
  19279. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  19280. $.fn[NAME$8].Constructor = ScrollSpy;
  19281. $.fn[NAME$8].noConflict = function () {
  19282. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  19283. return ScrollSpy._jQueryInterface;
  19284. };
  19285. /**
  19286. * ------------------------------------------------------------------------
  19287. * Constants
  19288. * ------------------------------------------------------------------------
  19289. */
  19290. var NAME$9 = 'tab';
  19291. var VERSION$9 = '4.3.1';
  19292. var DATA_KEY$9 = 'bs.tab';
  19293. var EVENT_KEY$9 = "." + DATA_KEY$9;
  19294. var DATA_API_KEY$7 = '.data-api';
  19295. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  19296. var Event$9 = {
  19297. HIDE: "hide" + EVENT_KEY$9,
  19298. HIDDEN: "hidden" + EVENT_KEY$9,
  19299. SHOW: "show" + EVENT_KEY$9,
  19300. SHOWN: "shown" + EVENT_KEY$9,
  19301. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  19302. };
  19303. var ClassName$9 = {
  19304. DROPDOWN_MENU: 'dropdown-menu',
  19305. ACTIVE: 'active',
  19306. DISABLED: 'disabled',
  19307. FADE: 'fade',
  19308. SHOW: 'show'
  19309. };
  19310. var Selector$9 = {
  19311. DROPDOWN: '.dropdown',
  19312. NAV_LIST_GROUP: '.nav, .list-group',
  19313. ACTIVE: '.active',
  19314. ACTIVE_UL: '> li > .active',
  19315. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  19316. DROPDOWN_TOGGLE: '.dropdown-toggle',
  19317. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  19318. /**
  19319. * ------------------------------------------------------------------------
  19320. * Class Definition
  19321. * ------------------------------------------------------------------------
  19322. */
  19323. };
  19324. var Tab =
  19325. /*#__PURE__*/
  19326. function () {
  19327. function Tab(element) {
  19328. this._element = element;
  19329. } // Getters
  19330. var _proto = Tab.prototype;
  19331. // Public
  19332. _proto.show = function show() {
  19333. var _this = this;
  19334. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  19335. return;
  19336. }
  19337. var target;
  19338. var previous;
  19339. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  19340. var selector = Util.getSelectorFromElement(this._element);
  19341. if (listElement) {
  19342. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  19343. previous = $.makeArray($(listElement).find(itemSelector));
  19344. previous = previous[previous.length - 1];
  19345. }
  19346. var hideEvent = $.Event(Event$9.HIDE, {
  19347. relatedTarget: this._element
  19348. });
  19349. var showEvent = $.Event(Event$9.SHOW, {
  19350. relatedTarget: previous
  19351. });
  19352. if (previous) {
  19353. $(previous).trigger(hideEvent);
  19354. }
  19355. $(this._element).trigger(showEvent);
  19356. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  19357. return;
  19358. }
  19359. if (selector) {
  19360. target = document.querySelector(selector);
  19361. }
  19362. this._activate(this._element, listElement);
  19363. var complete = function complete() {
  19364. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  19365. relatedTarget: _this._element
  19366. });
  19367. var shownEvent = $.Event(Event$9.SHOWN, {
  19368. relatedTarget: previous
  19369. });
  19370. $(previous).trigger(hiddenEvent);
  19371. $(_this._element).trigger(shownEvent);
  19372. };
  19373. if (target) {
  19374. this._activate(target, target.parentNode, complete);
  19375. } else {
  19376. complete();
  19377. }
  19378. };
  19379. _proto.dispose = function dispose() {
  19380. $.removeData(this._element, DATA_KEY$9);
  19381. this._element = null;
  19382. } // Private
  19383. ;
  19384. _proto._activate = function _activate(element, container, callback) {
  19385. var _this2 = this;
  19386. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  19387. var active = activeElements[0];
  19388. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  19389. var complete = function complete() {
  19390. return _this2._transitionComplete(element, active, callback);
  19391. };
  19392. if (active && isTransitioning) {
  19393. var transitionDuration = Util.getTransitionDurationFromElement(active);
  19394. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  19395. } else {
  19396. complete();
  19397. }
  19398. };
  19399. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  19400. if (active) {
  19401. $(active).removeClass(ClassName$9.ACTIVE);
  19402. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  19403. if (dropdownChild) {
  19404. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  19405. }
  19406. if (active.getAttribute('role') === 'tab') {
  19407. active.setAttribute('aria-selected', false);
  19408. }
  19409. }
  19410. $(element).addClass(ClassName$9.ACTIVE);
  19411. if (element.getAttribute('role') === 'tab') {
  19412. element.setAttribute('aria-selected', true);
  19413. }
  19414. Util.reflow(element);
  19415. if (element.classList.contains(ClassName$9.FADE)) {
  19416. element.classList.add(ClassName$9.SHOW);
  19417. }
  19418. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  19419. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  19420. if (dropdownElement) {
  19421. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  19422. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  19423. }
  19424. element.setAttribute('aria-expanded', true);
  19425. }
  19426. if (callback) {
  19427. callback();
  19428. }
  19429. } // Static
  19430. ;
  19431. Tab._jQueryInterface = function _jQueryInterface(config) {
  19432. return this.each(function () {
  19433. var $this = $(this);
  19434. var data = $this.data(DATA_KEY$9);
  19435. if (!data) {
  19436. data = new Tab(this);
  19437. $this.data(DATA_KEY$9, data);
  19438. }
  19439. if (typeof config === 'string') {
  19440. if (typeof data[config] === 'undefined') {
  19441. throw new TypeError("No method named \"" + config + "\"");
  19442. }
  19443. data[config]();
  19444. }
  19445. });
  19446. };
  19447. _createClass(Tab, null, [{
  19448. key: "VERSION",
  19449. get: function get() {
  19450. return VERSION$9;
  19451. }
  19452. }]);
  19453. return Tab;
  19454. }();
  19455. /**
  19456. * ------------------------------------------------------------------------
  19457. * Data Api implementation
  19458. * ------------------------------------------------------------------------
  19459. */
  19460. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  19461. event.preventDefault();
  19462. Tab._jQueryInterface.call($(this), 'show');
  19463. });
  19464. /**
  19465. * ------------------------------------------------------------------------
  19466. * jQuery
  19467. * ------------------------------------------------------------------------
  19468. */
  19469. $.fn[NAME$9] = Tab._jQueryInterface;
  19470. $.fn[NAME$9].Constructor = Tab;
  19471. $.fn[NAME$9].noConflict = function () {
  19472. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  19473. return Tab._jQueryInterface;
  19474. };
  19475. /**
  19476. * ------------------------------------------------------------------------
  19477. * Constants
  19478. * ------------------------------------------------------------------------
  19479. */
  19480. var NAME$a = 'toast';
  19481. var VERSION$a = '4.3.1';
  19482. var DATA_KEY$a = 'bs.toast';
  19483. var EVENT_KEY$a = "." + DATA_KEY$a;
  19484. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  19485. var Event$a = {
  19486. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  19487. HIDE: "hide" + EVENT_KEY$a,
  19488. HIDDEN: "hidden" + EVENT_KEY$a,
  19489. SHOW: "show" + EVENT_KEY$a,
  19490. SHOWN: "shown" + EVENT_KEY$a
  19491. };
  19492. var ClassName$a = {
  19493. FADE: 'fade',
  19494. HIDE: 'hide',
  19495. SHOW: 'show',
  19496. SHOWING: 'showing'
  19497. };
  19498. var DefaultType$7 = {
  19499. animation: 'boolean',
  19500. autohide: 'boolean',
  19501. delay: 'number'
  19502. };
  19503. var Default$7 = {
  19504. animation: true,
  19505. autohide: true,
  19506. delay: 500
  19507. };
  19508. var Selector$a = {
  19509. DATA_DISMISS: '[data-dismiss="toast"]'
  19510. /**
  19511. * ------------------------------------------------------------------------
  19512. * Class Definition
  19513. * ------------------------------------------------------------------------
  19514. */
  19515. };
  19516. var Toast =
  19517. /*#__PURE__*/
  19518. function () {
  19519. function Toast(element, config) {
  19520. this._element = element;
  19521. this._config = this._getConfig(config);
  19522. this._timeout = null;
  19523. this._setListeners();
  19524. } // Getters
  19525. var _proto = Toast.prototype;
  19526. // Public
  19527. _proto.show = function show() {
  19528. var _this = this;
  19529. $(this._element).trigger(Event$a.SHOW);
  19530. if (this._config.animation) {
  19531. this._element.classList.add(ClassName$a.FADE);
  19532. }
  19533. var complete = function complete() {
  19534. _this._element.classList.remove(ClassName$a.SHOWING);
  19535. _this._element.classList.add(ClassName$a.SHOW);
  19536. $(_this._element).trigger(Event$a.SHOWN);
  19537. if (_this._config.autohide) {
  19538. _this.hide();
  19539. }
  19540. };
  19541. this._element.classList.remove(ClassName$a.HIDE);
  19542. this._element.classList.add(ClassName$a.SHOWING);
  19543. if (this._config.animation) {
  19544. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  19545. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  19546. } else {
  19547. complete();
  19548. }
  19549. };
  19550. _proto.hide = function hide(withoutTimeout) {
  19551. var _this2 = this;
  19552. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  19553. return;
  19554. }
  19555. $(this._element).trigger(Event$a.HIDE);
  19556. if (withoutTimeout) {
  19557. this._close();
  19558. } else {
  19559. this._timeout = setTimeout(function () {
  19560. _this2._close();
  19561. }, this._config.delay);
  19562. }
  19563. };
  19564. _proto.dispose = function dispose() {
  19565. clearTimeout(this._timeout);
  19566. this._timeout = null;
  19567. if (this._element.classList.contains(ClassName$a.SHOW)) {
  19568. this._element.classList.remove(ClassName$a.SHOW);
  19569. }
  19570. $(this._element).off(Event$a.CLICK_DISMISS);
  19571. $.removeData(this._element, DATA_KEY$a);
  19572. this._element = null;
  19573. this._config = null;
  19574. } // Private
  19575. ;
  19576. _proto._getConfig = function _getConfig(config) {
  19577. config = _objectSpread({}, Default$7, $(this._element).data(), typeof config === 'object' && config ? config : {});
  19578. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  19579. return config;
  19580. };
  19581. _proto._setListeners = function _setListeners() {
  19582. var _this3 = this;
  19583. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  19584. return _this3.hide(true);
  19585. });
  19586. };
  19587. _proto._close = function _close() {
  19588. var _this4 = this;
  19589. var complete = function complete() {
  19590. _this4._element.classList.add(ClassName$a.HIDE);
  19591. $(_this4._element).trigger(Event$a.HIDDEN);
  19592. };
  19593. this._element.classList.remove(ClassName$a.SHOW);
  19594. if (this._config.animation) {
  19595. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  19596. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  19597. } else {
  19598. complete();
  19599. }
  19600. } // Static
  19601. ;
  19602. Toast._jQueryInterface = function _jQueryInterface(config) {
  19603. return this.each(function () {
  19604. var $element = $(this);
  19605. var data = $element.data(DATA_KEY$a);
  19606. var _config = typeof config === 'object' && config;
  19607. if (!data) {
  19608. data = new Toast(this, _config);
  19609. $element.data(DATA_KEY$a, data);
  19610. }
  19611. if (typeof config === 'string') {
  19612. if (typeof data[config] === 'undefined') {
  19613. throw new TypeError("No method named \"" + config + "\"");
  19614. }
  19615. data[config](this);
  19616. }
  19617. });
  19618. };
  19619. _createClass(Toast, null, [{
  19620. key: "VERSION",
  19621. get: function get() {
  19622. return VERSION$a;
  19623. }
  19624. }, {
  19625. key: "DefaultType",
  19626. get: function get() {
  19627. return DefaultType$7;
  19628. }
  19629. }, {
  19630. key: "Default",
  19631. get: function get() {
  19632. return Default$7;
  19633. }
  19634. }]);
  19635. return Toast;
  19636. }();
  19637. /**
  19638. * ------------------------------------------------------------------------
  19639. * jQuery
  19640. * ------------------------------------------------------------------------
  19641. */
  19642. $.fn[NAME$a] = Toast._jQueryInterface;
  19643. $.fn[NAME$a].Constructor = Toast;
  19644. $.fn[NAME$a].noConflict = function () {
  19645. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  19646. return Toast._jQueryInterface;
  19647. };
  19648. /**
  19649. * --------------------------------------------------------------------------
  19650. * Bootstrap (v4.3.1): index.js
  19651. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  19652. * --------------------------------------------------------------------------
  19653. */
  19654. (function () {
  19655. if (typeof $ === 'undefined') {
  19656. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  19657. }
  19658. var version = $.fn.jquery.split(' ')[0].split('.');
  19659. var minMajor = 1;
  19660. var ltMajor = 2;
  19661. var minMinor = 9;
  19662. var minPatch = 1;
  19663. var maxMajor = 4;
  19664. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  19665. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  19666. }
  19667. })();
  19668. exports.Util = Util;
  19669. exports.Alert = Alert;
  19670. exports.Button = Button;
  19671. exports.Carousel = Carousel;
  19672. exports.Collapse = Collapse;
  19673. exports.Dropdown = Dropdown;
  19674. exports.Modal = Modal;
  19675. exports.Popover = Popover;
  19676. exports.Scrollspy = ScrollSpy;
  19677. exports.Tab = Tab;
  19678. exports.Toast = Toast;
  19679. exports.Tooltip = Tooltip;
  19680. Object.defineProperty(exports, '__esModule', { value: true });
  19681. }));
  19682. //# sourceMappingURL=bootstrap.js.map
  19683. /*! @preserve
  19684. * bootbox.js
  19685. * version: 5.1.1
  19686. * author: Nick Payne <nick@kurai.co.uk>
  19687. * license: MIT
  19688. * http://bootboxjs.com/
  19689. */
  19690. (function (root, factory) {
  19691. 'use strict';
  19692. if (typeof define === 'function' && define.amd) {
  19693. // AMD
  19694. define(['jquery'], factory);
  19695. } else if (typeof exports === 'object') {
  19696. // Node, CommonJS-like
  19697. module.exports = factory(require('jquery'));
  19698. } else {
  19699. // Browser globals (root is window)
  19700. root.bootbox = factory(root.jQuery);
  19701. }
  19702. }(this, function init($, undefined) {
  19703. 'use strict';
  19704. // Polyfills Object.keys, if necessary.
  19705. // @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys
  19706. if (!Object.keys) {
  19707. Object.keys = (function () {
  19708. var hasOwnProperty = Object.prototype.hasOwnProperty,
  19709. hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'),
  19710. dontEnums = [
  19711. 'toString',
  19712. 'toLocaleString',
  19713. 'valueOf',
  19714. 'hasOwnProperty',
  19715. 'isPrototypeOf',
  19716. 'propertyIsEnumerable',
  19717. 'constructor'
  19718. ],
  19719. dontEnumsLength = dontEnums.length;
  19720. return function (obj) {
  19721. if (typeof obj !== 'function' && (typeof obj !== 'object' || obj === null)) {
  19722. throw new TypeError('Object.keys called on non-object');
  19723. }
  19724. var result = [], prop, i;
  19725. for (prop in obj) {
  19726. if (hasOwnProperty.call(obj, prop)) {
  19727. result.push(prop);
  19728. }
  19729. }
  19730. if (hasDontEnumBug) {
  19731. for (i = 0; i < dontEnumsLength; i++) {
  19732. if (hasOwnProperty.call(obj, dontEnums[i])) {
  19733. result.push(dontEnums[i]);
  19734. }
  19735. }
  19736. }
  19737. return result;
  19738. };
  19739. }());
  19740. }
  19741. var exports = {};
  19742. var VERSION = '5.0.0';
  19743. exports.VERSION = VERSION;
  19744. var locales = {};
  19745. var templates = {
  19746. dialog:
  19747. '<div class="bootbox modal" tabindex="-1" role="dialog" aria-hidden="true">' +
  19748. '<div class="modal-dialog">' +
  19749. '<div class="modal-content">' +
  19750. '<div class="modal-body"><div class="bootbox-body"></div></div>' +
  19751. '</div>' +
  19752. '</div>' +
  19753. '</div>',
  19754. header:
  19755. '<div class="modal-header">' +
  19756. '<h5 class="modal-title"></h5>' +
  19757. '</div>',
  19758. footer:
  19759. '<div class="modal-footer"></div>',
  19760. closeButton:
  19761. '<button type="button" class="bootbox-close-button close" aria-hidden="true">&times;</button>',
  19762. form:
  19763. '<form class="bootbox-form"></form>',
  19764. button:
  19765. '<button type="button" class="btn"></button>',
  19766. option:
  19767. '<option></option>',
  19768. promptMessage:
  19769. '<div class="bootbox-prompt-message"></div>',
  19770. inputs: {
  19771. text:
  19772. '<input class="bootbox-input bootbox-input-text form-control" autocomplete="off" type="text" />',
  19773. textarea:
  19774. '<textarea class="bootbox-input bootbox-input-textarea form-control"></textarea>',
  19775. email:
  19776. '<input class="bootbox-input bootbox-input-email form-control" autocomplete="off" type="email" />',
  19777. select:
  19778. '<select class="bootbox-input bootbox-input-select form-control"></select>',
  19779. checkbox:
  19780. '<div class="form-check checkbox"><label class="form-check-label"><input class="form-check-input bootbox-input bootbox-input-checkbox" type="checkbox" /></label></div>',
  19781. radio:
  19782. '<div class="form-check radio"><label class="form-check-label"><input class="form-check-input bootbox-input bootbox-input-radio" type="radio" name="bootbox-radio" /></label></div>',
  19783. date:
  19784. '<input class="bootbox-input bootbox-input-date form-control" autocomplete="off" type="date" />',
  19785. time:
  19786. '<input class="bootbox-input bootbox-input-time form-control" autocomplete="off" type="time" />',
  19787. number:
  19788. '<input class="bootbox-input bootbox-input-number form-control" autocomplete="off" type="number" />',
  19789. password:
  19790. '<input class="bootbox-input bootbox-input-password form-control" autocomplete="off" type="password" />',
  19791. range:
  19792. '<input class="bootbox-input bootbox-input-range form-control-range" autocomplete="off" type="range" />'
  19793. }
  19794. };
  19795. var defaults = {
  19796. // default language
  19797. locale: 'en',
  19798. // show backdrop or not. Default to static so user has to interact with dialog
  19799. backdrop: 'static',
  19800. // animate the modal in/out
  19801. animate: true,
  19802. // additional class string applied to the top level dialog
  19803. className: null,
  19804. // whether or not to include a close button
  19805. closeButton: true,
  19806. // show the dialog immediately by default
  19807. show: true,
  19808. // dialog container
  19809. container: 'body',
  19810. // default value (used by the prompt helper)
  19811. value: '',
  19812. // default input type (used by the prompt helper)
  19813. inputType: 'text',
  19814. // switch button order from cancel/confirm (default) to confirm/cancel
  19815. swapButtonOrder: false,
  19816. // center modal vertically in page
  19817. centerVertical: false,
  19818. // Append "multiple" property to the select when using the "prompt" helper
  19819. multiple: false,
  19820. // Automatically scroll modal content when height exceeds viewport height
  19821. scrollable: false
  19822. };
  19823. // PUBLIC FUNCTIONS
  19824. // *************************************************************************************************************
  19825. // Return all currently registered locales, or a specific locale if "name" is defined
  19826. exports.locales = function (name) {
  19827. return name ? locales[name] : locales;
  19828. };
  19829. // Register localized strings for the OK, Confirm, and Cancel buttons
  19830. exports.addLocale = function (name, values) {
  19831. $.each(['OK', 'CANCEL', 'CONFIRM'], function (_, v) {
  19832. if (!values[v]) {
  19833. throw new Error('Please supply a translation for "' + v + '"');
  19834. }
  19835. });
  19836. locales[name] = {
  19837. OK: values.OK,
  19838. CANCEL: values.CANCEL,
  19839. CONFIRM: values.CONFIRM
  19840. };
  19841. return exports;
  19842. };
  19843. // Remove a previously-registered locale
  19844. exports.removeLocale = function (name) {
  19845. if (name !== 'en') {
  19846. delete locales[name];
  19847. }
  19848. else {
  19849. throw new Error('"en" is used as the default and fallback locale and cannot be removed.');
  19850. }
  19851. return exports;
  19852. };
  19853. // Set the default locale
  19854. exports.setLocale = function (name) {
  19855. return exports.setDefaults('locale', name);
  19856. };
  19857. // Override default value(s) of Bootbox.
  19858. exports.setDefaults = function () {
  19859. var values = {};
  19860. if (arguments.length === 2) {
  19861. // allow passing of single key/value...
  19862. values[arguments[0]] = arguments[1];
  19863. } else {
  19864. // ... and as an object too
  19865. values = arguments[0];
  19866. }
  19867. $.extend(defaults, values);
  19868. return exports;
  19869. };
  19870. exports.setTemplates = function () {
  19871. var values = {};
  19872. if (arguments.length === 3) {
  19873. // allow passing of {key1: {key2: value}} as setTemplates(key1, key2, value)...
  19874. values[arguments[0]] = {};
  19875. values[arguments[0]][arguments[1]] = arguments[2];
  19876. } else if (arguments.length === 2) {
  19877. // ...or allow passing of {key: value} as setTemplates(key, value)...
  19878. values[arguments[0]] = arguments[1];
  19879. } else {
  19880. // ... and as an object too setTemplates(value)
  19881. values = arguments[0];
  19882. }
  19883. $.extend(templates, values);
  19884. };
  19885. // Hides all currently active Bootbox modals
  19886. exports.hideAll = function () {
  19887. $('.bootbox').modal('hide');
  19888. return exports;
  19889. };
  19890. // Allows the base init() function to be overridden
  19891. exports.init = function (_$) {
  19892. return init(_$ || $);
  19893. };
  19894. // CORE HELPER FUNCTIONS
  19895. // *************************************************************************************************************
  19896. // Core dialog function
  19897. exports.dialog = function (options) {
  19898. if ($.fn.modal === undefined) {
  19899. throw new Error(
  19900. '"$.fn.modal" is not defined; please double check you have included ' +
  19901. 'the Bootstrap JavaScript library. See http://getbootstrap.com/javascript/ ' +
  19902. 'for more details.'
  19903. );
  19904. }
  19905. options = sanitize(options);
  19906. if ($.fn.modal.Constructor.VERSION) {
  19907. options.fullBootstrapVersion = $.fn.modal.Constructor.VERSION;
  19908. var i = options.fullBootstrapVersion.indexOf('.');
  19909. options.bootstrap = options.fullBootstrapVersion.substring(0, i);
  19910. }
  19911. else {
  19912. // Assuming version 2.3.2, as that was the last "supported" 2.x version
  19913. options.bootstrap = '2';
  19914. options.fullBootstrapVersion = '2.3.2';
  19915. console.warn('Bootbox will *mostly* work with Bootstrap 2, but we do not officially support it. Please upgrade, if possible.');
  19916. }
  19917. var dialog = $(templates.dialog);
  19918. var innerDialog = dialog.find('.modal-dialog');
  19919. var body = dialog.find('.modal-body');
  19920. var header = $(templates.header);
  19921. var footer = $(templates.footer);
  19922. var buttons = options.buttons;
  19923. var callbacks = {
  19924. onEscape: options.onEscape
  19925. };
  19926. body.find('.bootbox-body').html(options.message);
  19927. // Only attempt to create buttons if at least one has
  19928. // been defined in the options object
  19929. if (getKeyLength(options.buttons) > 0) {
  19930. each(buttons, function (key, b) {
  19931. var button = $(templates.button);
  19932. button.data('bb-handler', key);
  19933. button.addClass(b.className);
  19934. switch(key)
  19935. {
  19936. case 'ok':
  19937. case 'confirm':
  19938. button.addClass('bootbox-accept');
  19939. break;
  19940. case 'cancel':
  19941. button.addClass('bootbox-cancel');
  19942. break;
  19943. }
  19944. button.html(b.label);
  19945. footer.append(button);
  19946. callbacks[key] = b.callback;
  19947. });
  19948. body.after(footer);
  19949. }
  19950. if (options.animate === true) {
  19951. dialog.addClass('fade');
  19952. }
  19953. if (options.className) {
  19954. dialog.addClass(options.className);
  19955. }
  19956. if (options.size) {
  19957. // Requires Bootstrap 3.1.0 or higher
  19958. if (options.fullBootstrapVersion.substring(0, 3) < '3.1') {
  19959. console.warn('"size" requires Bootstrap 3.1.0 or higher. You appear to be using ' + options.fullBootstrapVersion + '. Please upgrade to use this option.');
  19960. }
  19961. switch(options.size)
  19962. {
  19963. case 'small':
  19964. case 'sm':
  19965. innerDialog.addClass('modal-sm');
  19966. break;
  19967. case 'large':
  19968. case 'lg':
  19969. innerDialog.addClass('modal-lg');
  19970. break;
  19971. case 'xl':
  19972. case 'extra-large':
  19973. // Requires Bootstrap 4.2.0 or higher
  19974. if (options.fullBootstrapVersion.substring(0, 3) < '4.2') {
  19975. console.warn('Using size "xl"/"extra-large" requires Bootstrap 4.2.0 or higher. You appear to be using ' + options.fullBootstrapVersion + '. Please upgrade to use this option.');
  19976. }
  19977. innerDialog.addClass('modal-xl');
  19978. break;
  19979. }
  19980. }
  19981. if(options.scrollable){
  19982. // Requires Bootstrap 4.3.0 or higher
  19983. if (options.fullBootstrapVersion.substring(0, 3) < '4.3') {
  19984. console.warn('Using "scrollable" requires Bootstrap 4.3.0 or higher. You appear to be using ' + options.fullBootstrapVersion + '. Please upgrade to use this option.');
  19985. }
  19986. innerDialog.addClass('modal-dialog-scrollable');
  19987. }
  19988. if (options.title) {
  19989. body.before(header);
  19990. dialog.find('.modal-title').html(options.title);
  19991. }
  19992. if (options.closeButton) {
  19993. var closeButton = $(templates.closeButton);
  19994. if (options.title) {
  19995. if (options.bootstrap > 3) {
  19996. dialog.find('.modal-header').append(closeButton);
  19997. }
  19998. else {
  19999. dialog.find('.modal-header').prepend(closeButton);
  20000. }
  20001. } else {
  20002. closeButton.prependTo(body);
  20003. }
  20004. }
  20005. if(options.centerVertical){
  20006. // Requires Bootstrap 4.0.0-beta.3 or higher
  20007. if (options.fullBootstrapVersion < '4.0.0') {
  20008. console.warn('"centerVertical" requires Bootstrap 4.0.0-beta.3 or higher. You appear to be using ' + options.fullBootstrapVersion + '. Please upgrade to use this option.');
  20009. }
  20010. innerDialog.addClass('modal-dialog-centered');
  20011. }
  20012. // Bootstrap event listeners; these handle extra
  20013. // setup & teardown required after the underlying
  20014. // modal has performed certain actions.
  20015. // make sure we unbind any listeners once the dialog has definitively been dismissed
  20016. dialog.one('hide.bs.modal', function (e) {
  20017. if (e.target === this) {
  20018. dialog.off('escape.close.bb');
  20019. dialog.off('click');
  20020. }
  20021. });
  20022. dialog.one('hidden.bs.modal', function (e) {
  20023. // ensure we don't accidentally intercept hidden events triggered
  20024. // by children of the current dialog. We shouldn't need to handle this anymore,
  20025. // now that Bootstrap namespaces its events, but still worth doing.
  20026. if (e.target === this) {
  20027. dialog.remove();
  20028. }
  20029. });
  20030. dialog.one('shown.bs.modal', function () {
  20031. dialog.find('.bootbox-accept:first').trigger('focus');
  20032. });
  20033. // Bootbox event listeners; used to decouple some
  20034. // behaviours from their respective triggers
  20035. if (options.backdrop !== 'static') {
  20036. // A boolean true/false according to the Bootstrap docs
  20037. // should show a dialog the user can dismiss by clicking on
  20038. // the background.
  20039. // We always only ever pass static/false to the actual
  20040. // $.modal function because with "true" we can't trap
  20041. // this event (the .modal-backdrop swallows it)
  20042. // However, we still want to sort of respect true
  20043. // and invoke the escape mechanism instead
  20044. dialog.on('click.dismiss.bs.modal', function (e) {
  20045. // @NOTE: the target varies in >= 3.3.x releases since the modal backdrop
  20046. // moved *inside* the outer dialog rather than *alongside* it
  20047. if (dialog.children('.modal-backdrop').length) {
  20048. e.currentTarget = dialog.children('.modal-backdrop').get(0);
  20049. }
  20050. if (e.target !== e.currentTarget) {
  20051. return;
  20052. }
  20053. dialog.trigger('escape.close.bb');
  20054. });
  20055. }
  20056. dialog.on('escape.close.bb', function (e) {
  20057. // the if statement looks redundant but it isn't; without it
  20058. // if we *didn't* have an onEscape handler then processCallback
  20059. // would automatically dismiss the dialog
  20060. if (callbacks.onEscape) {
  20061. processCallback(e, dialog, callbacks.onEscape);
  20062. }
  20063. });
  20064. dialog.on('click', '.modal-footer button:not(.disabled)', function (e) {
  20065. var callbackKey = $(this).data('bb-handler');
  20066. processCallback(e, dialog, callbacks[callbackKey]);
  20067. });
  20068. dialog.on('click', '.bootbox-close-button', function (e) {
  20069. // onEscape might be falsy but that's fine; the fact is
  20070. // if the user has managed to click the close button we
  20071. // have to close the dialog, callback or not
  20072. processCallback(e, dialog, callbacks.onEscape);
  20073. });
  20074. dialog.on('keyup', function (e) {
  20075. if (e.which === 27) {
  20076. dialog.trigger('escape.close.bb');
  20077. }
  20078. });
  20079. // the remainder of this method simply deals with adding our
  20080. // dialogent to the DOM, augmenting it with Bootstrap's modal
  20081. // functionality and then giving the resulting object back
  20082. // to our caller
  20083. $(options.container).append(dialog);
  20084. dialog.modal({
  20085. backdrop: options.backdrop ? 'static' : false,
  20086. keyboard: false,
  20087. show: false
  20088. });
  20089. if (options.show) {
  20090. dialog.modal('show');
  20091. }
  20092. return dialog;
  20093. };
  20094. // Helper function to simulate the native alert() behavior. **NOTE**: This is non-blocking, so any
  20095. // code that must happen after the alert is dismissed should be placed within the callback function
  20096. // for this alert.
  20097. exports.alert = function () {
  20098. var options;
  20099. options = mergeDialogOptions('alert', ['ok'], ['message', 'callback'], arguments);
  20100. // @TODO: can this move inside exports.dialog when we're iterating over each
  20101. // button and checking its button.callback value instead?
  20102. if (options.callback && !$.isFunction(options.callback)) {
  20103. throw new Error('alert requires the "callback" property to be a function when provided');
  20104. }
  20105. // override the ok and escape callback to make sure they just invoke
  20106. // the single user-supplied one (if provided)
  20107. options.buttons.ok.callback = options.onEscape = function () {
  20108. if ($.isFunction(options.callback)) {
  20109. return options.callback.call(this);
  20110. }
  20111. return true;
  20112. };
  20113. return exports.dialog(options);
  20114. };
  20115. // Helper function to simulate the native confirm() behavior. **NOTE**: This is non-blocking, so any
  20116. // code that must happen after the confirm is dismissed should be placed within the callback function
  20117. // for this confirm.
  20118. exports.confirm = function () {
  20119. var options;
  20120. options = mergeDialogOptions('confirm', ['cancel', 'confirm'], ['message', 'callback'], arguments);
  20121. // confirm specific validation; they don't make sense without a callback so make
  20122. // sure it's present
  20123. if (!$.isFunction(options.callback)) {
  20124. throw new Error('confirm requires a callback');
  20125. }
  20126. // overrides; undo anything the user tried to set they shouldn't have
  20127. options.buttons.cancel.callback = options.onEscape = function () {
  20128. return options.callback.call(this, false);
  20129. };
  20130. options.buttons.confirm.callback = function () {
  20131. return options.callback.call(this, true);
  20132. };
  20133. return exports.dialog(options);
  20134. };
  20135. // Helper function to simulate the native prompt() behavior. **NOTE**: This is non-blocking, so any
  20136. // code that must happen after the prompt is dismissed should be placed within the callback function
  20137. // for this prompt.
  20138. exports.prompt = function () {
  20139. var options;
  20140. var promptDialog;
  20141. var form;
  20142. var input;
  20143. var shouldShow;
  20144. var inputOptions;
  20145. // we have to create our form first otherwise
  20146. // its value is undefined when gearing up our options
  20147. // @TODO this could be solved by allowing message to
  20148. // be a function instead...
  20149. form = $(templates.form);
  20150. // prompt defaults are more complex than others in that
  20151. // users can override more defaults
  20152. options = mergeDialogOptions('prompt', ['cancel', 'confirm'], ['title', 'callback'], arguments);
  20153. if (!options.value) {
  20154. options.value = defaults.value;
  20155. }
  20156. if (!options.inputType) {
  20157. options.inputType = defaults.inputType;
  20158. }
  20159. // capture the user's show value; we always set this to false before
  20160. // spawning the dialog to give us a chance to attach some handlers to
  20161. // it, but we need to make sure we respect a preference not to show it
  20162. shouldShow = (options.show === undefined) ? defaults.show : options.show;
  20163. // This is required prior to calling the dialog builder below - we need to
  20164. // add an event handler just before the prompt is shown
  20165. options.show = false;
  20166. // Handles the 'cancel' action
  20167. options.buttons.cancel.callback = options.onEscape = function () {
  20168. return options.callback.call(this, null);
  20169. };
  20170. // Prompt submitted - extract the prompt value. This requires a bit of work,
  20171. // given the different input types available.
  20172. options.buttons.confirm.callback = function () {
  20173. var value;
  20174. if (options.inputType === 'checkbox') {
  20175. value = input.find('input:checked').map(function () {
  20176. return $(this).val();
  20177. }).get();
  20178. } else if (options.inputType === 'radio') {
  20179. value = input.find('input:checked').val();
  20180. }
  20181. else {
  20182. if (input[0].checkValidity && !input[0].checkValidity()) {
  20183. // prevents button callback from being called
  20184. return false;
  20185. } else {
  20186. if (options.inputType === 'select' && options.multiple === true) {
  20187. value = input.find('option:selected').map(function () {
  20188. return $(this).val();
  20189. }).get();
  20190. }
  20191. else{
  20192. value = input.val();
  20193. }
  20194. }
  20195. }
  20196. return options.callback.call(this, value);
  20197. };
  20198. // prompt-specific validation
  20199. if (!options.title) {
  20200. throw new Error('prompt requires a title');
  20201. }
  20202. if (!$.isFunction(options.callback)) {
  20203. throw new Error('prompt requires a callback');
  20204. }
  20205. if (!templates.inputs[options.inputType]) {
  20206. throw new Error('Invalid prompt type');
  20207. }
  20208. // create the input based on the supplied type
  20209. input = $(templates.inputs[options.inputType]);
  20210. switch (options.inputType) {
  20211. case 'text':
  20212. case 'textarea':
  20213. case 'email':
  20214. case 'password':
  20215. input.val(options.value);
  20216. if (options.placeholder) {
  20217. input.attr('placeholder', options.placeholder);
  20218. }
  20219. if (options.pattern) {
  20220. input.attr('pattern', options.pattern);
  20221. }
  20222. if (options.maxlength) {
  20223. input.attr('maxlength', options.maxlength);
  20224. }
  20225. if (options.required) {
  20226. input.prop({ 'required': true });
  20227. }
  20228. if (options.rows && !isNaN(parseInt(options.rows))) {
  20229. if(options.inputType === 'textarea'){
  20230. input.attr({ 'rows': options.rows });
  20231. }
  20232. }
  20233. break;
  20234. case 'date':
  20235. case 'time':
  20236. case 'number':
  20237. case 'range':
  20238. input.val(options.value);
  20239. if (options.placeholder) {
  20240. input.attr('placeholder', options.placeholder);
  20241. }
  20242. if (options.pattern) {
  20243. input.attr('pattern', options.pattern);
  20244. }
  20245. if (options.required) {
  20246. input.prop({ 'required': true });
  20247. }
  20248. // These input types have extra attributes which affect their input validation.
  20249. // Warning: For most browsers, date inputs are buggy in their implementation of 'step', so
  20250. // this attribute will have no effect. Therefore, we don't set the attribute for date inputs.
  20251. // @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date#Setting_maximum_and_minimum_dates
  20252. if (options.inputType !== 'date') {
  20253. if (options.step) {
  20254. if (options.step === 'any' || (!isNaN(options.step) && parseInt(options.step) > 0)) {
  20255. input.attr('step', options.step);
  20256. }
  20257. else {
  20258. throw new Error('"step" must be a valid positive number or the value "any". See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-step for more information.');
  20259. }
  20260. }
  20261. }
  20262. if(minAndMaxAreValid(options.inputType, options.min, options.max)){
  20263. if(options.min !== undefined){
  20264. input.attr('min', options.min);
  20265. }
  20266. if(options.max !== undefined){
  20267. input.attr('max', options.max);
  20268. }
  20269. }
  20270. break;
  20271. case 'select':
  20272. var groups = {};
  20273. inputOptions = options.inputOptions || [];
  20274. if (!$.isArray(inputOptions)) {
  20275. throw new Error('Please pass an array of input options');
  20276. }
  20277. if (!inputOptions.length) {
  20278. throw new Error('prompt with "inputType" set to "select" requires at least one option');
  20279. }
  20280. // placeholder is not actually a valid attribute for select,
  20281. // but we'll allow it, assuming it might be used for a plugin
  20282. if (options.placeholder) {
  20283. input.attr('placeholder', options.placeholder);
  20284. }
  20285. if (options.required) {
  20286. input.prop({ 'required': true });
  20287. }
  20288. if (options.multiple) {
  20289. input.prop({ 'multiple': true });
  20290. }
  20291. each(inputOptions, function (_, option) {
  20292. // assume the element to attach to is the input...
  20293. var elem = input;
  20294. if (option.value === undefined || option.text === undefined) {
  20295. throw new Error('each option needs a "value" property and a "text" property');
  20296. }
  20297. // ... but override that element if this option sits in a group
  20298. if (option.group) {
  20299. // initialise group if necessary
  20300. if (!groups[option.group]) {
  20301. groups[option.group] = $('<optgroup />').attr('label', option.group);
  20302. }
  20303. elem = groups[option.group];
  20304. }
  20305. var o = $(templates.option);
  20306. o.attr('value', option.value).text(option.text);
  20307. elem.append(o);
  20308. });
  20309. each(groups, function (_, group) {
  20310. input.append(group);
  20311. });
  20312. // safe to set a select's value as per a normal input
  20313. input.val(options.value);
  20314. break;
  20315. case 'checkbox':
  20316. var checkboxValues = $.isArray(options.value) ? options.value : [options.value];
  20317. inputOptions = options.inputOptions || [];
  20318. if (!inputOptions.length) {
  20319. throw new Error('prompt with "inputType" set to "checkbox" requires at least one option');
  20320. }
  20321. // checkboxes have to nest within a containing element, so
  20322. // they break the rules a bit and we end up re-assigning
  20323. // our 'input' element to this container instead
  20324. input = $('<div class="bootbox-checkbox-list"></div>');
  20325. each(inputOptions, function (_, option) {
  20326. if (option.value === undefined || option.text === undefined) {
  20327. throw new Error('each option needs a "value" property and a "text" property');
  20328. }
  20329. var checkbox = $(templates.inputs[options.inputType]);
  20330. checkbox.find('input').attr('value', option.value);
  20331. checkbox.find('label').append('\n' + option.text);
  20332. // we've ensured values is an array so we can always iterate over it
  20333. each(checkboxValues, function (_, value) {
  20334. if (value === option.value) {
  20335. checkbox.find('input').prop('checked', true);
  20336. }
  20337. });
  20338. input.append(checkbox);
  20339. });
  20340. break;
  20341. case 'radio':
  20342. // Make sure that value is not an array (only a single radio can ever be checked)
  20343. if (options.value !== undefined && $.isArray(options.value)) {
  20344. throw new Error('prompt with "inputType" set to "radio" requires a single, non-array value for "value"');
  20345. }
  20346. inputOptions = options.inputOptions || [];
  20347. if (!inputOptions.length) {
  20348. throw new Error('prompt with "inputType" set to "radio" requires at least one option');
  20349. }
  20350. // Radiobuttons have to nest within a containing element, so
  20351. // they break the rules a bit and we end up re-assigning
  20352. // our 'input' element to this container instead
  20353. input = $('<div class="bootbox-radiobutton-list"></div>');
  20354. // Radiobuttons should always have an initial checked input checked in a "group".
  20355. // If value is undefined or doesn't match an input option, select the first radiobutton
  20356. var checkFirstRadio = true;
  20357. each(inputOptions, function (_, option) {
  20358. if (option.value === undefined || option.text === undefined) {
  20359. throw new Error('each option needs a "value" property and a "text" property');
  20360. }
  20361. var radio = $(templates.inputs[options.inputType]);
  20362. radio.find('input').attr('value', option.value);
  20363. radio.find('label').append('\n' + option.text);
  20364. if (options.value !== undefined) {
  20365. if (option.value === options.value) {
  20366. radio.find('input').prop('checked', true);
  20367. checkFirstRadio = false;
  20368. }
  20369. }
  20370. input.append(radio);
  20371. });
  20372. if (checkFirstRadio) {
  20373. input.find('input[type="radio"]').first().prop('checked', true);
  20374. }
  20375. break;
  20376. }
  20377. // now place it in our form
  20378. form.append(input);
  20379. form.on('submit', function (e) {
  20380. e.preventDefault();
  20381. // Fix for SammyJS (or similar JS routing library) hijacking the form post.
  20382. e.stopPropagation();
  20383. // @TODO can we actually click *the* button object instead?
  20384. // e.g. buttons.confirm.click() or similar
  20385. promptDialog.find('.bootbox-accept').trigger('click');
  20386. });
  20387. if ($.trim(options.message) !== '') {
  20388. // Add the form to whatever content the user may have added.
  20389. var message = $(templates.promptMessage).html(options.message);
  20390. form.prepend(message);
  20391. options.message = form;
  20392. }
  20393. else {
  20394. options.message = form;
  20395. }
  20396. // Generate the dialog
  20397. promptDialog = exports.dialog(options);
  20398. // clear the existing handler focusing the submit button...
  20399. promptDialog.off('shown.bs.modal');
  20400. // ...and replace it with one focusing our input, if possible
  20401. promptDialog.on('shown.bs.modal', function () {
  20402. // need the closure here since input isn't
  20403. // an object otherwise
  20404. input.focus();
  20405. });
  20406. if (shouldShow === true) {
  20407. promptDialog.modal('show');
  20408. }
  20409. return promptDialog;
  20410. };
  20411. // INTERNAL FUNCTIONS
  20412. // *************************************************************************************************************
  20413. // Map a flexible set of arguments into a single returned object
  20414. // If args.length is already one just return it, otherwise
  20415. // use the properties argument to map the unnamed args to
  20416. // object properties.
  20417. // So in the latter case:
  20418. // mapArguments(["foo", $.noop], ["message", "callback"])
  20419. // -> { message: "foo", callback: $.noop }
  20420. function mapArguments(args, properties) {
  20421. var argn = args.length;
  20422. var options = {};
  20423. if (argn < 1 || argn > 2) {
  20424. throw new Error('Invalid argument length');
  20425. }
  20426. if (argn === 2 || typeof args[0] === 'string') {
  20427. options[properties[0]] = args[0];
  20428. options[properties[1]] = args[1];
  20429. } else {
  20430. options = args[0];
  20431. }
  20432. return options;
  20433. }
  20434. // Merge a set of default dialog options with user supplied arguments
  20435. function mergeArguments(defaults, args, properties) {
  20436. return $.extend(
  20437. // deep merge
  20438. true,
  20439. // ensure the target is an empty, unreferenced object
  20440. {},
  20441. // the base options object for this type of dialog (often just buttons)
  20442. defaults,
  20443. // args could be an object or array; if it's an array properties will
  20444. // map it to a proper options object
  20445. mapArguments(
  20446. args,
  20447. properties
  20448. )
  20449. );
  20450. }
  20451. // This entry-level method makes heavy use of composition to take a simple
  20452. // range of inputs and return valid options suitable for passing to bootbox.dialog
  20453. function mergeDialogOptions(className, labels, properties, args) {
  20454. var locale;
  20455. if(args && args[0]){
  20456. locale = args[0].locale || defaults.locale;
  20457. var swapButtons = args[0].swapButtonOrder || defaults.swapButtonOrder;
  20458. if(swapButtons){
  20459. labels = labels.reverse();
  20460. }
  20461. }
  20462. // cloud up a base set of dialog properties
  20463. var baseOptions = {
  20464. className: 'bootbox-' + className,
  20465. buttons: createLabels(labels, locale)
  20466. };
  20467. // Ensure the buttons properties generated, *after* merging
  20468. // with user args are still valid against the supplied labels
  20469. return validateButtons(
  20470. // merge the generated base properties with user supplied arguments
  20471. mergeArguments(
  20472. baseOptions,
  20473. args,
  20474. // if args.length > 1, properties specify how each arg maps to an object key
  20475. properties
  20476. ),
  20477. labels
  20478. );
  20479. }
  20480. // Checks each button object to see if key is valid.
  20481. // This function will only be called by the alert, confirm, and prompt helpers.
  20482. function validateButtons(options, buttons) {
  20483. var allowedButtons = {};
  20484. each(buttons, function (key, value) {
  20485. allowedButtons[value] = true;
  20486. });
  20487. each(options.buttons, function (key) {
  20488. if (allowedButtons[key] === undefined) {
  20489. throw new Error('button key "' + key + '" is not allowed (options are ' + buttons.join(' ') + ')');
  20490. }
  20491. });
  20492. return options;
  20493. }
  20494. // From a given list of arguments, return a suitable object of button labels.
  20495. // All this does is normalise the given labels and translate them where possible.
  20496. // e.g. "ok", "confirm" -> { ok: "OK", cancel: "Annuleren" }
  20497. function createLabels(labels, locale) {
  20498. var buttons = {};
  20499. for (var i = 0, j = labels.length; i < j; i++) {
  20500. var argument = labels[i];
  20501. var key = argument.toLowerCase();
  20502. var value = argument.toUpperCase();
  20503. buttons[key] = {
  20504. label: getText(value, locale)
  20505. };
  20506. }
  20507. return buttons;
  20508. }
  20509. // Get localized text from a locale. Defaults to 'en' locale if no locale
  20510. // provided or a non-registered locale is requested
  20511. function getText(key, locale) {
  20512. var labels = locales[locale];
  20513. return labels ? labels[key] : locales.en[key];
  20514. }
  20515. // Filter and tidy up any user supplied parameters to this dialog.
  20516. // Also looks for any shorthands used and ensures that the options
  20517. // which are returned are all normalized properly
  20518. function sanitize(options) {
  20519. var buttons;
  20520. var total;
  20521. if (typeof options !== 'object') {
  20522. throw new Error('Please supply an object of options');
  20523. }
  20524. if (!options.message) {
  20525. throw new Error('"message" option must not be null or an empty string.');
  20526. }
  20527. // make sure any supplied options take precedence over defaults
  20528. options = $.extend({}, defaults, options);
  20529. // no buttons is still a valid dialog but it's cleaner to always have
  20530. // a buttons object to iterate over, even if it's empty
  20531. if (!options.buttons) {
  20532. options.buttons = {};
  20533. }
  20534. buttons = options.buttons;
  20535. total = getKeyLength(buttons);
  20536. each(buttons, function (key, button, index) {
  20537. if ($.isFunction(button)) {
  20538. // short form, assume value is our callback. Since button
  20539. // isn't an object it isn't a reference either so re-assign it
  20540. button = buttons[key] = {
  20541. callback: button
  20542. };
  20543. }
  20544. // before any further checks make sure by now button is the correct type
  20545. if ($.type(button) !== 'object') {
  20546. throw new Error('button with key "' + key + '" must be an object');
  20547. }
  20548. if (!button.label) {
  20549. // the lack of an explicit label means we'll assume the key is good enough
  20550. button.label = key;
  20551. }
  20552. if (!button.className) {
  20553. var isPrimary = false;
  20554. if(options.swapButtonOrder){
  20555. isPrimary = index === 0;
  20556. }
  20557. else{
  20558. isPrimary = index === total-1;
  20559. }
  20560. if (total <= 2 && isPrimary) {
  20561. // always add a primary to the main option in a one or two-button dialog
  20562. button.className = 'btn-primary';
  20563. } else {
  20564. // adding both classes allows us to target both BS3 and BS4 without needing to check the version
  20565. button.className = 'btn-secondary btn-default';
  20566. }
  20567. }
  20568. });
  20569. return options;
  20570. }
  20571. // Returns a count of the properties defined on the object
  20572. function getKeyLength(obj) {
  20573. return Object.keys(obj).length;
  20574. }
  20575. // Tiny wrapper function around jQuery.each; just adds index as the third parameter
  20576. function each(collection, iterator) {
  20577. var index = 0;
  20578. $.each(collection, function (key, value) {
  20579. iterator(key, value, index++);
  20580. });
  20581. }
  20582. // Handle the invoked dialog callback
  20583. function processCallback(e, dialog, callback) {
  20584. e.stopPropagation();
  20585. e.preventDefault();
  20586. // by default we assume a callback will get rid of the dialog,
  20587. // although it is given the opportunity to override this
  20588. // so, if the callback can be invoked and it *explicitly returns false*
  20589. // then we'll set a flag to keep the dialog active...
  20590. var preserveDialog = $.isFunction(callback) && callback.call(dialog, e) === false;
  20591. // ... otherwise we'll bin it
  20592. if (!preserveDialog) {
  20593. dialog.modal('hide');
  20594. }
  20595. }
  20596. // Validate `min` and `max` values based on the current `inputType` value
  20597. function minAndMaxAreValid(type, min, max){
  20598. var result = false;
  20599. var minValid = true;
  20600. var maxValid = true;
  20601. if (type === 'date') {
  20602. if (min !== undefined && !(minValid = dateIsValid(min))) {
  20603. console.warn('Browsers which natively support the "date" input type expect date values to be of the form "YYYY-MM-DD" (see ISO-8601 https://www.iso.org/iso-8601-date-and-time-format.html). Bootbox does not enforce this rule, but your min value may not be enforced by this browser.');
  20604. }
  20605. else if (max !== undefined && !(maxValid = dateIsValid(max))) {
  20606. console.warn('Browsers which natively support the "date" input type expect date values to be of the form "YYYY-MM-DD" (see ISO-8601 https://www.iso.org/iso-8601-date-and-time-format.html). Bootbox does not enforce this rule, but your max value may not be enforced by this browser.');
  20607. }
  20608. }
  20609. else if (type === 'time') {
  20610. if (min !== undefined && !(minValid = timeIsValid(min))) {
  20611. throw new Error('"min" is not a valid time. See https://www.w3.org/TR/2012/WD-html-markup-20120315/datatypes.html#form.data.time for more information.');
  20612. }
  20613. else if (max !== undefined && !(maxValid = timeIsValid(max))) {
  20614. throw new Error('"max" is not a valid time. See https://www.w3.org/TR/2012/WD-html-markup-20120315/datatypes.html#form.data.time for more information.');
  20615. }
  20616. }
  20617. else {
  20618. if (min !== undefined && isNaN(min)) {
  20619. throw new Error('"min" must be a valid number. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-min for more information.');
  20620. }
  20621. if (max !== undefined && isNaN(max)) {
  20622. throw new Error('"max" must be a valid number. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-max for more information.');
  20623. }
  20624. }
  20625. if(minValid && maxValid){
  20626. if(max <= min){
  20627. throw new Error('"max" must be greater than "min". See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-max for more information.');
  20628. }
  20629. else{
  20630. result = true;
  20631. }
  20632. }
  20633. return result;
  20634. }
  20635. function timeIsValid(value){
  20636. return /([01][0-9]|2[0-3]):[0-5][0-9]?:[0-5][0-9]/.test(value);
  20637. }
  20638. function dateIsValid(value){
  20639. return /(\d{4})-(\d{2})-(\d{2})/.test(value);
  20640. }
  20641. // Register the default locale
  20642. exports.addLocale('en', {
  20643. OK: 'OK',
  20644. CANCEL: 'Cancel',
  20645. CONFIRM: 'OK'
  20646. });
  20647. // The Bootbox object
  20648. return exports;
  20649. }));
  20650. bootbox.setTemplates({
  20651. dialog:
  20652. '<div class="bootbox modal" tabindex="-1" role="dialog" aria-hidden="true">' +
  20653. '<div class="modal-dialog">' +
  20654. '<div class="modal-content">' +
  20655. '<div class="modal-body"><div class="bootbox-body"></div></div>' +
  20656. '</div>' +
  20657. '</div>' +
  20658. '</div>',
  20659. header:
  20660. '<div class="modal-header">' +
  20661. '<h5 class="modal-title"></h5>' +
  20662. '</div>',
  20663. footer:
  20664. '<div class="modal-footer"></div>',
  20665. closeButton:
  20666. '<button type="button" class="bootbox-close-button close" aria-hidden="true"><i class="fal fa-times"></i></button>',
  20667. form:
  20668. '<form class="bootbox-form"></form>',
  20669. button:
  20670. '<button type="button" class="btn"></button>',
  20671. option:
  20672. '<option></option>',
  20673. promptMessage:
  20674. '<div class="bootbox-prompt-message"></div>',
  20675. inputs: {
  20676. text:
  20677. '<input class="bootbox-input bootbox-input-text form-control" autocomplete="off" type="text" />',
  20678. textarea:
  20679. '<textarea class="bootbox-input bootbox-input-textarea form-control"></textarea>',
  20680. email:
  20681. '<input class="bootbox-input bootbox-input-email form-control" autocomplete="off" type="email" />',
  20682. select:
  20683. '<select class="bootbox-input bootbox-input-select form-control"></select>',
  20684. checkbox:
  20685. '<div class="form-check checkbox"><label class="form-check-label"><input class="form-check-input bootbox-input bootbox-input-checkbox" type="checkbox" /></label></div>',
  20686. radio:
  20687. '<div class="form-check radio"><label class="form-check-label"><input class="form-check-input bootbox-input bootbox-input-radio" type="radio" name="bootbox-radio" /></label></div>',
  20688. date:
  20689. '<input class="bootbox-input bootbox-input-date form-control" autocomplete="off" type="date" />',
  20690. time:
  20691. '<input class="bootbox-input bootbox-input-time form-control" autocomplete="off" type="time" />',
  20692. number:
  20693. '<input class="bootbox-input bootbox-input-number form-control" autocomplete="off" type="number" />',
  20694. password:
  20695. '<input class="bootbox-input bootbox-input-password form-control" autocomplete="off" type="password" />',
  20696. range:
  20697. '<input class="bootbox-input bootbox-input-range form-control-range" autocomplete="off" type="range" />'
  20698. }
  20699. });
  20700. /**
  20701. * author: andreas johan virkus
  20702. * snippet url: https://gist.github.com/andreasvirkus/bfaedc839de0d46ffe4c
  20703. *
  20704. * Remove classes that have given prefix
  20705. * Example: You have an element with classes "apple juiceSmall juiceBig banana"
  20706. * You run:
  20707. * $elem.removeClassPrefix('juice');
  20708. * The resulting classes are "apple banana"
  20709. */
  20710. $.fn.removeClassPrefix = function (prefix) {
  20711. this.each( function ( i, it ) {
  20712. var classes = it.className.split(" ").map(function (item) {
  20713. return item.indexOf(prefix) === 0 ? "" : item;
  20714. });
  20715. it.className = classes.join(" ");
  20716. });
  20717. return this;
  20718. };
  20719. /**
  20720. * "http://dummy.com/?technology=jquery&blog=jquerybyexample".
  20721. * 1 var tech = getUrlParameter('technology');
  20722. * 2 var blog = getUrlParameter('blog');
  20723. * note: we are using this inside icon generator page
  20724. */
  20725. var getUrlParameter = function getUrlParameter(sParam) {
  20726. var sPageURL = decodeURIComponent(window.location.search.substring(1)),
  20727. sURLVariables = sPageURL.split('&'),
  20728. sParameterName,
  20729. i;
  20730. for (i = 0; i < sURLVariables.length; i++) {
  20731. sParameterName = sURLVariables[i].split('=');
  20732. if (sParameterName[0] === sParam) {
  20733. return sParameterName[1] === undefined ? true : sParameterName[1];
  20734. }
  20735. }
  20736. };
  20737. /**
  20738. * detect IE
  20739. * returns version of IE or false, if browser is not Internet Explorer
  20740. */
  20741. function detectIE() {
  20742. var ua = window.navigator.userAgent;
  20743. var msie = ua.indexOf('MSIE ');
  20744. if (msie > 0) {
  20745. // IE 10 or older => return version number
  20746. return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);
  20747. }
  20748. var trident = ua.indexOf('Trident/');
  20749. if (trident > 0) {
  20750. // IE 11 => return version number
  20751. var rv = ua.indexOf('rv:');
  20752. return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);
  20753. }
  20754. var edge = ua.indexOf('Edge/');
  20755. if (edge > 0) {
  20756. // Edge (IE 12+) => return version number
  20757. return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10);
  20758. }
  20759. // other browser
  20760. return false;
  20761. }
  20762. /*
  20763. * Toggle text
  20764. * $(".example").toggleText('Initial', 'Secondary');
  20765. * https://stackoverflow.com/questions/2155453/jquery-toggle-text
  20766. */
  20767. jQuery.fn.extend({
  20768. toggleText: function (a, b){
  20769. var that = this;
  20770. if (that.text() != a && that.text() != b){
  20771. that.text(a);
  20772. }
  20773. else
  20774. if (that.text() == a){
  20775. that.text(b);
  20776. }
  20777. else
  20778. if (that.text() == b){
  20779. that.text(a);
  20780. }
  20781. return this;
  20782. }
  20783. });
  20784. /*
  20785. * Convert RGB to HEX
  20786. * rgb2hex(hex_value)
  20787. */
  20788. function rgb2hex(rgb) {
  20789. /*rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
  20790. console.log(rgb+'ddd');
  20791. function hex(x) {
  20792. return ("0" + parseInt(x).toString(16)).slice(-2);
  20793. }
  20794. return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);*/
  20795. }
  20796. /*!
  20797. * jQuery throttle / debounce - v1.1 - 3/7/2010
  20798. * http://benalman.com/projects/jquery-throttle-debounce-plugin/
  20799. *
  20800. * Copyright (c) 2010 "Cowboy" Ben Alman
  20801. * Dual licensed under the MIT and GPL licenses.
  20802. * http://benalman.com/about/license/
  20803. */
  20804. // Script: jQuery throttle / debounce: Sometimes, less is more!
  20805. //
  20806. // *Version: 1.1, Last updated: 3/7/2010*
  20807. //
  20808. // Project Home - http://benalman.com/projects/jquery-throttle-debounce-plugin/
  20809. // GitHub - http://github.com/cowboy/jquery-throttle-debounce/
  20810. // Source - http://github.com/cowboy/jquery-throttle-debounce/raw/master/jquery.ba-throttle-debounce.js
  20811. // (Minified) - http://github.com/cowboy/jquery-throttle-debounce/raw/master/jquery.ba-throttle-debounce.min.js (0.7kb)
  20812. //
  20813. // About: License
  20814. //
  20815. // Copyright (c) 2010 "Cowboy" Ben Alman,
  20816. // Dual licensed under the MIT and GPL licenses.
  20817. // http://benalman.com/about/license/
  20818. //
  20819. // About: Examples
  20820. //
  20821. // These working examples, complete with fully commented code, illustrate a few
  20822. // ways in which this plugin can be used.
  20823. //
  20824. // Throttle - http://benalman.com/code/projects/jquery-throttle-debounce/examples/throttle/
  20825. // Debounce - http://benalman.com/code/projects/jquery-throttle-debounce/examples/debounce/
  20826. //
  20827. // About: Support and Testing
  20828. //
  20829. // Information about what version or versions of jQuery this plugin has been
  20830. // tested with, what browsers it has been tested in, and where the unit tests
  20831. // reside (so you can test it yourself).
  20832. //
  20833. // jQuery Versions - none, 1.3.2, 1.4.2
  20834. // Browsers Tested - Internet Explorer 6-8, Firefox 2-3.6, Safari 3-4, Chrome 4-5, Opera 9.6-10.1.
  20835. // Unit Tests - http://benalman.com/code/projects/jquery-throttle-debounce/unit/
  20836. //
  20837. // About: Release History
  20838. //
  20839. // 1.1 - (3/7/2010) Fixed a bug in <jQuery.throttle> where trailing callbacks
  20840. // executed later than they should. Reworked a fair amount of internal
  20841. // logic as well.
  20842. // 1.0 - (3/6/2010) Initial release as a stand-alone project. Migrated over
  20843. // from jquery-misc repo v0.4 to jquery-throttle repo v1.0, added the
  20844. // no_trailing throttle parameter and debounce functionality.
  20845. //
  20846. // Topic: Note for non-jQuery users
  20847. //
  20848. // jQuery isn't actually required for this plugin, because nothing internal
  20849. // uses any jQuery methods or properties. jQuery is just used as a namespace
  20850. // under which these methods can exist.
  20851. //
  20852. // Since jQuery isn't actually required for this plugin, if jQuery doesn't exist
  20853. // when this plugin is loaded, the method described below will be created in
  20854. // the `Cowboy` namespace. Usage will be exactly the same, but instead of
  20855. // $.method() or jQuery.method(), you'll need to use Cowboy.method().
  20856. (function(window,undefined){
  20857. '$:nomunge'; // Used by YUI compressor.
  20858. // Since jQuery really isn't required for this plugin, use `jQuery` as the
  20859. // namespace only if it already exists, otherwise use the `Cowboy` namespace,
  20860. // creating it if necessary.
  20861. var $ = window.jQuery || window.Cowboy || ( window.Cowboy = {} ),
  20862. // Internal method reference.
  20863. jq_throttle;
  20864. // Method: jQuery.throttle
  20865. //
  20866. // Throttle execution of a function. Especially useful for rate limiting
  20867. // execution of handlers on events like resize and scroll. If you want to
  20868. // rate-limit execution of a function to a single time, see the
  20869. // <jQuery.debounce> method.
  20870. //
  20871. // In this visualization, | is a throttled-function call and X is the actual
  20872. // callback execution:
  20873. //
  20874. // > Throttled with `no_trailing` specified as false or unspecified:
  20875. // > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
  20876. // > X X X X X X X X X X X X
  20877. // >
  20878. // > Throttled with `no_trailing` specified as true:
  20879. // > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
  20880. // > X X X X X X X X X X
  20881. //
  20882. // Usage:
  20883. //
  20884. // > var throttled = jQuery.throttle( delay, [ no_trailing, ] callback );
  20885. // >
  20886. // > jQuery('selector').bind( 'someevent', throttled );
  20887. // > jQuery('selector').unbind( 'someevent', throttled );
  20888. //
  20889. // This also works in jQuery 1.4+:
  20890. //
  20891. // > jQuery('selector').bind( 'someevent', jQuery.throttle( delay, [ no_trailing, ] callback ) );
  20892. // > jQuery('selector').unbind( 'someevent', callback );
  20893. //
  20894. // Arguments:
  20895. //
  20896. // delay - (Number) A zero-or-greater delay in milliseconds. For event
  20897. // callbacks, values around 100 or 250 (or even higher) are most useful.
  20898. // no_trailing - (Boolean) Optional, defaults to false. If no_trailing is
  20899. // true, callback will only execute every `delay` milliseconds while the
  20900. // throttled-function is being called. If no_trailing is false or
  20901. // unspecified, callback will be executed one final time after the last
  20902. // throttled-function call. (After the throttled-function has not been
  20903. // called for `delay` milliseconds, the internal counter is reset)
  20904. // callback - (Function) A function to be executed after delay milliseconds.
  20905. // The `this` context and all arguments are passed through, as-is, to
  20906. // `callback` when the throttled-function is executed.
  20907. //
  20908. // Returns:
  20909. //
  20910. // (Function) A new, throttled, function.
  20911. $.throttle = jq_throttle = function( delay, no_trailing, callback, debounce_mode ) {
  20912. // After wrapper has stopped being called, this timeout ensures that
  20913. // `callback` is executed at the proper times in `throttle` and `end`
  20914. // debounce modes.
  20915. var timeout_id,
  20916. // Keep track of the last time `callback` was executed.
  20917. last_exec = 0;
  20918. // `no_trailing` defaults to falsy.
  20919. if ( typeof no_trailing !== 'boolean' ) {
  20920. debounce_mode = callback;
  20921. callback = no_trailing;
  20922. no_trailing = undefined;
  20923. }
  20924. // The `wrapper` function encapsulates all of the throttling / debouncing
  20925. // functionality and when executed will limit the rate at which `callback`
  20926. // is executed.
  20927. function wrapper() {
  20928. var that = this,
  20929. elapsed = +new Date() - last_exec,
  20930. args = arguments;
  20931. // Execute `callback` and update the `last_exec` timestamp.
  20932. function exec() {
  20933. last_exec = +new Date();
  20934. callback.apply( that, args );
  20935. };
  20936. // If `debounce_mode` is true (at_begin) this is used to clear the flag
  20937. // to allow future `callback` executions.
  20938. function clear() {
  20939. timeout_id = undefined;
  20940. };
  20941. if ( debounce_mode && !timeout_id ) {
  20942. // Since `wrapper` is being called for the first time and
  20943. // `debounce_mode` is true (at_begin), execute `callback`.
  20944. exec();
  20945. }
  20946. // Clear any existing timeout.
  20947. timeout_id && clearTimeout( timeout_id );
  20948. if ( debounce_mode === undefined && elapsed > delay ) {
  20949. // In throttle mode, if `delay` time has been exceeded, execute
  20950. // `callback`.
  20951. exec();
  20952. } else if ( no_trailing !== true ) {
  20953. // In trailing throttle mode, since `delay` time has not been
  20954. // exceeded, schedule `callback` to execute `delay` ms after most
  20955. // recent execution.
  20956. //
  20957. // If `debounce_mode` is true (at_begin), schedule `clear` to execute
  20958. // after `delay` ms.
  20959. //
  20960. // If `debounce_mode` is false (at end), schedule `callback` to
  20961. // execute after `delay` ms.
  20962. timeout_id = setTimeout( debounce_mode ? clear : exec, debounce_mode === undefined ? delay - elapsed : delay );
  20963. }
  20964. };
  20965. // Set the guid of `wrapper` function to the same of original callback, so
  20966. // it can be removed in jQuery 1.4+ .unbind or .die by using the original
  20967. // callback as a reference.
  20968. if ( $.guid ) {
  20969. wrapper.guid = callback.guid = callback.guid || $.guid++;
  20970. }
  20971. // Return the wrapper function.
  20972. return wrapper;
  20973. };
  20974. // Method: jQuery.debounce
  20975. //
  20976. // Debounce execution of a function. Debouncing, unlike throttling,
  20977. // guarantees that a function is only executed a single time, either at the
  20978. // very beginning of a series of calls, or at the very end. If you want to
  20979. // simply rate-limit execution of a function, see the <jQuery.throttle>
  20980. // method.
  20981. //
  20982. // In this visualization, | is a debounced-function call and X is the actual
  20983. // callback execution:
  20984. //
  20985. // > Debounced with `at_begin` specified as false or unspecified:
  20986. // > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
  20987. // > X X
  20988. // >
  20989. // > Debounced with `at_begin` specified as true:
  20990. // > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
  20991. // > X X
  20992. //
  20993. // Usage:
  20994. //
  20995. // > var debounced = jQuery.debounce( delay, [ at_begin, ] callback );
  20996. // >
  20997. // > jQuery('selector').bind( 'someevent', debounced );
  20998. // > jQuery('selector').unbind( 'someevent', debounced );
  20999. //
  21000. // This also works in jQuery 1.4+:
  21001. //
  21002. // > jQuery('selector').bind( 'someevent', jQuery.debounce( delay, [ at_begin, ] callback ) );
  21003. // > jQuery('selector').unbind( 'someevent', callback );
  21004. //
  21005. // Arguments:
  21006. //
  21007. // delay - (Number) A zero-or-greater delay in milliseconds. For event
  21008. // callbacks, values around 100 or 250 (or even higher) are most useful.
  21009. // at_begin - (Boolean) Optional, defaults to false. If at_begin is false or
  21010. // unspecified, callback will only be executed `delay` milliseconds after
  21011. // the last debounced-function call. If at_begin is true, callback will be
  21012. // executed only at the first debounced-function call. (After the
  21013. // throttled-function has not been called for `delay` milliseconds, the
  21014. // internal counter is reset)
  21015. // callback - (Function) A function to be executed after delay milliseconds.
  21016. // The `this` context and all arguments are passed through, as-is, to
  21017. // `callback` when the debounced-function is executed.
  21018. //
  21019. // Returns:
  21020. //
  21021. // (Function) A new, debounced, function.
  21022. $.debounce = function( delay, at_begin, callback ) {
  21023. return callback === undefined
  21024. ? jq_throttle( delay, at_begin, false )
  21025. : jq_throttle( delay, callback, at_begin !== false );
  21026. };
  21027. })(this);
  21028. /*! Copyright (c) 2011 Piotr Rochala (http://rocha.la)
  21029. * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
  21030. * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
  21031. *
  21032. * Version: 1.3.8
  21033. *
  21034. */
  21035. (function($) {
  21036. $.fn.extend({
  21037. slimScroll: function(options) {
  21038. var defaults = {
  21039. // width in pixels of the visible scroll area
  21040. width : 'auto',
  21041. // height in pixels of the visible scroll area
  21042. height : '250px',
  21043. // width in pixels of the scrollbar and rail
  21044. size : '7px',
  21045. // scrollbar color, accepts any hex/color value
  21046. color: '#000',
  21047. // scrollbar position - left/right
  21048. position : 'right',
  21049. // distance in pixels between the side edge and the scrollbar
  21050. distance : '1px',
  21051. // default scroll position on load - top / bottom / $('selector')
  21052. start : 'top',
  21053. // sets scrollbar opacity
  21054. opacity : .4,
  21055. // enables always-on mode for the scrollbar
  21056. alwaysVisible : false,
  21057. // check if we should hide the scrollbar when user is hovering over
  21058. disableFadeOut : false,
  21059. // sets visibility of the rail
  21060. railVisible : false,
  21061. // sets rail color
  21062. railColor : '#333',
  21063. // sets rail opacity
  21064. railOpacity : .2,
  21065. // whether we should use jQuery UI Draggable to enable bar dragging
  21066. railDraggable : true,
  21067. // defautlt CSS class of the slimscroll rail
  21068. railClass : 'slimScrollRail',
  21069. // defautlt CSS class of the slimscroll bar
  21070. barClass : 'slimScrollBar',
  21071. // defautlt CSS class of the slimscroll wrapper
  21072. wrapperClass : 'slimScrollDiv',
  21073. // check if mousewheel should scroll the window if we reach top/bottom
  21074. allowPageScroll : false,
  21075. // scroll amount applied to each mouse wheel step
  21076. wheelStep : 20,
  21077. // scroll amount applied when user is using gestures
  21078. touchScrollStep : 200,
  21079. // sets border radius
  21080. borderRadius: '7px',
  21081. // sets border radius of the rail
  21082. railBorderRadius : '7px'
  21083. };
  21084. var o = $.extend(defaults, options);
  21085. // do it for every element that matches selector
  21086. this.each(function(){
  21087. var isOverPanel, isOverBar, isDragg, queueHide, touchDif,
  21088. barHeight, percentScroll, lastScroll,
  21089. divS = '<div></div>',
  21090. minBarHeight = 30,
  21091. releaseScroll = false;
  21092. // used in event handlers and for better minification
  21093. var me = $(this);
  21094. // ensure we are not binding it again
  21095. if (me.parent().hasClass(o.wrapperClass))
  21096. {
  21097. // start from last bar position
  21098. var offset = me.scrollTop();
  21099. // find bar and rail
  21100. bar = me.siblings('.' + o.barClass);
  21101. rail = me.siblings('.' + o.railClass);
  21102. getBarHeight();
  21103. // check if we should scroll existing instance
  21104. if ($.isPlainObject(options))
  21105. {
  21106. // Pass height: auto to an existing slimscroll object to force a resize after contents have changed
  21107. if ( 'height' in options && options.height == 'auto' ) {
  21108. me.parent().css('height', 'auto');
  21109. me.css('height', 'auto');
  21110. var height = me.parent().parent().height();
  21111. me.parent().css('height', height);
  21112. me.css('height', height);
  21113. } else if ('height' in options) {
  21114. var h = options.height;
  21115. me.parent().css('height', h);
  21116. me.css('height', h);
  21117. }
  21118. if ('scrollTo' in options)
  21119. {
  21120. // jump to a static point
  21121. offset = parseInt(o.scrollTo);
  21122. }
  21123. else if ('scrollBy' in options)
  21124. {
  21125. // jump by value pixels
  21126. offset += parseInt(o.scrollBy);
  21127. }
  21128. else if ('destroy' in options)
  21129. {
  21130. // remove slimscroll elements
  21131. bar.remove();
  21132. rail.remove();
  21133. me.unwrap();
  21134. return;
  21135. }
  21136. // scroll content by the given offset
  21137. scrollContent(offset, false, true);
  21138. }
  21139. return;
  21140. }
  21141. else if ($.isPlainObject(options))
  21142. {
  21143. if ('destroy' in options)
  21144. {
  21145. return;
  21146. }
  21147. }
  21148. // optionally set height to the parent's height
  21149. o.height = (o.height == 'auto') ? me.parent().height() : o.height;
  21150. // wrap content
  21151. var wrapper = $(divS)
  21152. .addClass(o.wrapperClass)
  21153. .css({
  21154. position: 'relative',
  21155. overflow: 'hidden',
  21156. width: o.width,
  21157. height: o.height
  21158. });
  21159. // update style for the div
  21160. me.css({
  21161. overflow: 'hidden',
  21162. width: o.width,
  21163. height: o.height
  21164. });
  21165. // create scrollbar rail
  21166. var rail = $(divS)
  21167. .addClass(o.railClass)
  21168. .css({
  21169. width: o.size,
  21170. height: '100%',
  21171. position: 'absolute',
  21172. top: 0,
  21173. display: (o.alwaysVisible && o.railVisible) ? 'block' : 'none',
  21174. 'border-radius': o.railBorderRadius,
  21175. background: o.railColor,
  21176. opacity: o.railOpacity,
  21177. zIndex: 90
  21178. });
  21179. // create scrollbar
  21180. var bar = $(divS)
  21181. .addClass(o.barClass)
  21182. .css({
  21183. background: o.color,
  21184. width: o.size,
  21185. position: 'absolute',
  21186. top: 0,
  21187. opacity: o.opacity,
  21188. display: o.alwaysVisible ? 'block' : 'none',
  21189. 'border-radius' : o.borderRadius,
  21190. BorderRadius: o.borderRadius,
  21191. MozBorderRadius: o.borderRadius,
  21192. WebkitBorderRadius: o.borderRadius,
  21193. zIndex: 99
  21194. });
  21195. // set position
  21196. var posCss = (o.position == 'right') ? { right: o.distance } : { left: o.distance };
  21197. rail.css(posCss);
  21198. bar.css(posCss);
  21199. // wrap it
  21200. me.wrap(wrapper);
  21201. // append to parent div
  21202. me.parent().append(bar);
  21203. me.parent().append(rail);
  21204. // make it draggable and no longer dependent on the jqueryUI
  21205. if (o.railDraggable){
  21206. bar.bind("mousedown", function(e) {
  21207. var $doc = $(document);
  21208. isDragg = true;
  21209. t = parseFloat(bar.css('top'));
  21210. pageY = e.pageY;
  21211. $doc.bind("mousemove.slimscroll", function(e){
  21212. currTop = t + e.pageY - pageY;
  21213. bar.css('top', currTop);
  21214. scrollContent(0, bar.position().top, false);// scroll content
  21215. });
  21216. $doc.bind("mouseup.slimscroll", function(e) {
  21217. isDragg = false;hideBar();
  21218. $doc.unbind('.slimscroll');
  21219. });
  21220. return false;
  21221. }).bind("selectstart.slimscroll", function(e){
  21222. e.stopPropagation();
  21223. e.preventDefault();
  21224. return false;
  21225. });
  21226. }
  21227. // on rail over
  21228. rail.hover(function(){
  21229. showBar();
  21230. }, function(){
  21231. hideBar();
  21232. });
  21233. // on bar over
  21234. bar.hover(function(){
  21235. isOverBar = true;
  21236. }, function(){
  21237. isOverBar = false;
  21238. });
  21239. // show on parent mouseover
  21240. me.hover(function(){
  21241. isOverPanel = true;
  21242. showBar();
  21243. hideBar();
  21244. }, function(){
  21245. isOverPanel = false;
  21246. hideBar();
  21247. });
  21248. // support for mobile
  21249. me.bind('touchstart', function(e,b){
  21250. if (e.originalEvent.touches.length)
  21251. {
  21252. // record where touch started
  21253. touchDif = e.originalEvent.touches[0].pageY;
  21254. }
  21255. });
  21256. me.bind('touchmove', function(e){
  21257. // prevent scrolling the page if necessary
  21258. if(!releaseScroll)
  21259. {
  21260. e.originalEvent.preventDefault();
  21261. }
  21262. if (e.originalEvent.touches.length)
  21263. {
  21264. // see how far user swiped
  21265. var diff = (touchDif - e.originalEvent.touches[0].pageY) / o.touchScrollStep;
  21266. // scroll content
  21267. scrollContent(diff, true);
  21268. touchDif = e.originalEvent.touches[0].pageY;
  21269. }
  21270. });
  21271. // set up initial height
  21272. getBarHeight();
  21273. // check start position
  21274. if (o.start === 'bottom')
  21275. {
  21276. // scroll content to bottom
  21277. bar.css({ top: me.outerHeight() - bar.outerHeight() });
  21278. scrollContent(0, true);
  21279. }
  21280. else if (o.start !== 'top')
  21281. {
  21282. // assume jQuery selector
  21283. scrollContent($(o.start).position().top, null, true);
  21284. // make sure bar stays hidden
  21285. if (!o.alwaysVisible) { bar.hide(); }
  21286. }
  21287. // attach scroll events
  21288. attachWheel(this);
  21289. function _onWheel(e)
  21290. {
  21291. // use mouse wheel only when mouse is over
  21292. if (!isOverPanel) { return; }
  21293. var e = e || window.event;
  21294. var delta = 0;
  21295. if (e.wheelDelta) { delta = -e.wheelDelta/120; }
  21296. if (e.detail) { delta = e.detail / 3; }
  21297. var target = e.target || e.srcTarget || e.srcElement;
  21298. if ($(target).closest('.' + o.wrapperClass).is(me.parent())) {
  21299. // scroll content
  21300. scrollContent(delta, true);
  21301. }
  21302. // stop window scroll
  21303. if (e.preventDefault && !releaseScroll) { e.preventDefault(); }
  21304. if (!releaseScroll) { e.returnValue = false; }
  21305. }
  21306. function scrollContent(y, isWheel, isJump)
  21307. {
  21308. releaseScroll = false;
  21309. var delta = y;
  21310. var maxTop = me.outerHeight() - bar.outerHeight();
  21311. if (isWheel)
  21312. {
  21313. // move bar with mouse wheel
  21314. delta = parseInt(bar.css('top')) + y * parseInt(o.wheelStep) / 100 * bar.outerHeight();
  21315. // move bar, make sure it doesn't go out
  21316. delta = Math.min(Math.max(delta, 0), maxTop);
  21317. // if scrolling down, make sure a fractional change to the
  21318. // scroll position isn't rounded away when the scrollbar's CSS is set
  21319. // this flooring of delta would happened automatically when
  21320. // bar.css is set below, but we floor here for clarity
  21321. delta = (y > 0) ? Math.ceil(delta) : Math.floor(delta);
  21322. // scroll the scrollbar
  21323. bar.css({ top: delta + 'px' });
  21324. }
  21325. // calculate actual scroll amount
  21326. percentScroll = parseInt(bar.css('top')) / (me.outerHeight() - bar.outerHeight());
  21327. delta = percentScroll * (me[0].scrollHeight - me.outerHeight());
  21328. if (isJump)
  21329. {
  21330. delta = y;
  21331. var offsetTop = delta / me[0].scrollHeight * me.outerHeight();
  21332. offsetTop = Math.min(Math.max(offsetTop, 0), maxTop);
  21333. bar.css({ top: offsetTop + 'px' });
  21334. }
  21335. // scroll content
  21336. me.scrollTop(delta);
  21337. // fire scrolling event
  21338. me.trigger('slimscrolling', ~~delta);
  21339. // ensure bar is visible
  21340. showBar();
  21341. // trigger hide when scroll is stopped
  21342. hideBar();
  21343. }
  21344. function attachWheel(target)
  21345. {
  21346. if (window.addEventListener)
  21347. {
  21348. target.addEventListener('DOMMouseScroll', _onWheel, false );
  21349. target.addEventListener('mousewheel', _onWheel, false );
  21350. }
  21351. else
  21352. {
  21353. document.attachEvent("onmousewheel", _onWheel)
  21354. }
  21355. }
  21356. function getBarHeight()
  21357. {
  21358. // calculate scrollbar height and make sure it is not too small
  21359. barHeight = Math.max((me.outerHeight() / me[0].scrollHeight) * me.outerHeight(), minBarHeight);
  21360. bar.css({ height: barHeight + 'px' });
  21361. // hide scrollbar if content is not long enough
  21362. var display = barHeight == me.outerHeight() ? 'none' : 'block';
  21363. bar.css({ display: display });
  21364. }
  21365. function showBar()
  21366. {
  21367. // recalculate bar height
  21368. getBarHeight();
  21369. clearTimeout(queueHide);
  21370. // when bar reached top or bottom
  21371. if (percentScroll == ~~percentScroll)
  21372. {
  21373. //release wheel
  21374. releaseScroll = o.allowPageScroll;
  21375. // publish approporiate event
  21376. if (lastScroll != percentScroll)
  21377. {
  21378. var msg = (~~percentScroll == 0) ? 'top' : 'bottom';
  21379. me.trigger('slimscroll', msg);
  21380. }
  21381. }
  21382. else
  21383. {
  21384. releaseScroll = false;
  21385. }
  21386. lastScroll = percentScroll;
  21387. // show only when required
  21388. if(barHeight >= me.outerHeight()) {
  21389. //allow window scroll
  21390. releaseScroll = true;
  21391. return;
  21392. }
  21393. bar.stop(true,true).fadeIn('fast');
  21394. if (o.railVisible) { rail.stop(true,true).fadeIn('fast'); }
  21395. }
  21396. function hideBar()
  21397. {
  21398. // only hide when options allow it
  21399. if (!o.alwaysVisible)
  21400. {
  21401. queueHide = setTimeout(function(){
  21402. if (!(o.disableFadeOut && isOverPanel) && !isOverBar && !isDragg)
  21403. {
  21404. bar.fadeOut('slow');
  21405. rail.fadeOut('slow');
  21406. }
  21407. }, 1000);
  21408. }
  21409. }
  21410. });
  21411. // maintain chainability
  21412. return this;
  21413. }
  21414. });
  21415. $.fn.extend({
  21416. slimscroll: $.fn.slimScroll
  21417. });
  21418. })(jQuery);
  21419. /*!
  21420. * Waves v0.7.6
  21421. * http://fian.my.id/Waves
  21422. *
  21423. * Copyright 2014-2018 Alfiana E. Sibuea and other contributors
  21424. * Released under the MIT license
  21425. * https://github.com/fians/Waves/blob/master/LICENSE
  21426. */
  21427. ;(function(window, factory) {
  21428. 'use strict';
  21429. // AMD. Register as an anonymous module. Wrap in function so we have access
  21430. // to root via `this`.
  21431. if (typeof define === 'function' && define.amd) {
  21432. define([], function() {
  21433. window.Waves = factory.call(window);
  21434. return window.Waves;
  21435. });
  21436. }
  21437. // Node. Does not work with strict CommonJS, but only CommonJS-like
  21438. // environments that support module.exports, like Node.
  21439. else if (typeof exports === 'object') {
  21440. module.exports = factory.call(window);
  21441. }
  21442. // Browser globals.
  21443. else {
  21444. window.Waves = factory.call(window);
  21445. }
  21446. })(typeof global === 'object' ? global : this, function() {
  21447. 'use strict';
  21448. var Waves = Waves || {};
  21449. var $$ = document.querySelectorAll.bind(document);
  21450. var toString = Object.prototype.toString;
  21451. var isTouchAvailable = 'ontouchstart' in window;
  21452. // Find exact position of element
  21453. function isWindow(obj) {
  21454. return obj !== null && obj === obj.window;
  21455. }
  21456. function getWindow(elem) {
  21457. return isWindow(elem) ? elem : elem.nodeType === 9 && elem.defaultView;
  21458. }
  21459. function isObject(value) {
  21460. var type = typeof value;
  21461. return type === 'function' || type === 'object' && !!value;
  21462. }
  21463. function isDOMNode(obj) {
  21464. return isObject(obj) && obj.nodeType > 0;
  21465. }
  21466. function getWavesElements(nodes) {
  21467. var stringRepr = toString.call(nodes);
  21468. if (stringRepr === '[object String]') {
  21469. return $$(nodes);
  21470. } else if (isObject(nodes) && /^\[object (Array|HTMLCollection|NodeList|Object)\]$/.test(stringRepr) && nodes.hasOwnProperty('length')) {
  21471. return nodes;
  21472. } else if (isDOMNode(nodes)) {
  21473. return [nodes];
  21474. }
  21475. return [];
  21476. }
  21477. function offset(elem) {
  21478. var docElem, win,
  21479. box = { top: 0, left: 0 },
  21480. doc = elem && elem.ownerDocument;
  21481. docElem = doc.documentElement;
  21482. if (typeof elem.getBoundingClientRect !== typeof undefined) {
  21483. box = elem.getBoundingClientRect();
  21484. }
  21485. win = getWindow(doc);
  21486. return {
  21487. top: box.top + win.pageYOffset - docElem.clientTop,
  21488. left: box.left + win.pageXOffset - docElem.clientLeft
  21489. };
  21490. }
  21491. function convertStyle(styleObj) {
  21492. var style = '';
  21493. for (var prop in styleObj) {
  21494. if (styleObj.hasOwnProperty(prop)) {
  21495. style += (prop + ':' + styleObj[prop] + ';');
  21496. }
  21497. }
  21498. return style;
  21499. }
  21500. var Effect = {
  21501. // Effect duration
  21502. duration: 750,
  21503. // Effect delay (check for scroll before showing effect)
  21504. delay: 200,
  21505. show: function(e, element, velocity) {
  21506. // Disable right click
  21507. if (e.button === 2) {
  21508. return false;
  21509. }
  21510. element = element || this;
  21511. // Create ripple
  21512. var ripple = document.createElement('div');
  21513. ripple.className = 'waves-ripple waves-rippling';
  21514. element.appendChild(ripple);
  21515. // Get click coordinate and element width
  21516. var pos = offset(element);
  21517. var relativeY = 0;
  21518. var relativeX = 0;
  21519. // Support for touch devices
  21520. if('touches' in e && e.touches.length) {
  21521. relativeY = (e.touches[0].pageY - pos.top);
  21522. relativeX = (e.touches[0].pageX - pos.left);
  21523. }
  21524. //Normal case
  21525. else {
  21526. relativeY = (e.pageY - pos.top);
  21527. relativeX = (e.pageX - pos.left);
  21528. }
  21529. // Support for synthetic events
  21530. relativeX = relativeX >= 0 ? relativeX : 0;
  21531. relativeY = relativeY >= 0 ? relativeY : 0;
  21532. var scale = 'scale(' + ((element.clientWidth / 100) * 3) + ')';
  21533. var translate = 'translate(0,0)';
  21534. if (velocity) {
  21535. translate = 'translate(' + (velocity.x) + 'px, ' + (velocity.y) + 'px)';
  21536. }
  21537. // Attach data to element
  21538. ripple.setAttribute('data-hold', Date.now());
  21539. ripple.setAttribute('data-x', relativeX);
  21540. ripple.setAttribute('data-y', relativeY);
  21541. ripple.setAttribute('data-scale', scale);
  21542. ripple.setAttribute('data-translate', translate);
  21543. // Set ripple position
  21544. var rippleStyle = {
  21545. top: relativeY + 'px',
  21546. left: relativeX + 'px'
  21547. };
  21548. ripple.classList.add('waves-notransition');
  21549. ripple.setAttribute('style', convertStyle(rippleStyle));
  21550. ripple.classList.remove('waves-notransition');
  21551. // Scale the ripple
  21552. rippleStyle['-webkit-transform'] = scale + ' ' + translate;
  21553. rippleStyle['-moz-transform'] = scale + ' ' + translate;
  21554. rippleStyle['-ms-transform'] = scale + ' ' + translate;
  21555. rippleStyle['-o-transform'] = scale + ' ' + translate;
  21556. rippleStyle.transform = scale + ' ' + translate;
  21557. rippleStyle.opacity = '1';
  21558. var duration = e.type === 'mousemove' ? 2500 : Effect.duration;
  21559. rippleStyle['-webkit-transition-duration'] = duration + 'ms';
  21560. rippleStyle['-moz-transition-duration'] = duration + 'ms';
  21561. rippleStyle['-o-transition-duration'] = duration + 'ms';
  21562. rippleStyle['transition-duration'] = duration + 'ms';
  21563. ripple.setAttribute('style', convertStyle(rippleStyle));
  21564. },
  21565. hide: function(e, element) {
  21566. element = element || this;
  21567. var ripples = element.getElementsByClassName('waves-rippling');
  21568. for (var i = 0, len = ripples.length; i < len; i++) {
  21569. removeRipple(e, element, ripples[i]);
  21570. }
  21571. if (isTouchAvailable) {
  21572. element.removeEventListener('touchend', Effect.hide);
  21573. element.removeEventListener('touchcancel', Effect.hide);
  21574. }
  21575. element.removeEventListener('mouseup', Effect.hide);
  21576. element.removeEventListener('mouseleave', Effect.hide);
  21577. }
  21578. };
  21579. /**
  21580. * Collection of wrapper for HTML element that only have single tag
  21581. * like <input> and <img>
  21582. */
  21583. var TagWrapper = {
  21584. // Wrap <input> tag so it can perform the effect
  21585. input: function(element) {
  21586. var parent = element.parentNode;
  21587. // If input already have parent just pass through
  21588. if (parent.tagName.toLowerCase() === 'i' && parent.classList.contains('waves-effect')) {
  21589. return;
  21590. }
  21591. // Put element class and style to the specified parent
  21592. var wrapper = document.createElement('i');
  21593. wrapper.className = element.className + ' waves-input-wrapper';
  21594. element.className = 'waves-button-input';
  21595. // Put element as child
  21596. parent.replaceChild(wrapper, element);
  21597. wrapper.appendChild(element);
  21598. // Apply element color and background color to wrapper
  21599. var elementStyle = window.getComputedStyle(element, null);
  21600. var color = elementStyle.color;
  21601. var backgroundColor = elementStyle.backgroundColor;
  21602. wrapper.setAttribute('style', 'color:' + color + ';background:' + backgroundColor);
  21603. element.setAttribute('style', 'background-color:rgba(0,0,0,0);');
  21604. },
  21605. // Wrap <img> tag so it can perform the effect
  21606. img: function(element) {
  21607. var parent = element.parentNode;
  21608. // If input already have parent just pass through
  21609. if (parent.tagName.toLowerCase() === 'i' && parent.classList.contains('waves-effect')) {
  21610. return;
  21611. }
  21612. // Put element as child
  21613. var wrapper = document.createElement('i');
  21614. parent.replaceChild(wrapper, element);
  21615. wrapper.appendChild(element);
  21616. }
  21617. };
  21618. /**
  21619. * Hide the effect and remove the ripple. Must be
  21620. * a separate function to pass the JSLint...
  21621. */
  21622. function removeRipple(e, el, ripple) {
  21623. // Check if the ripple still exist
  21624. if (!ripple) {
  21625. return;
  21626. }
  21627. ripple.classList.remove('waves-rippling');
  21628. var relativeX = ripple.getAttribute('data-x');
  21629. var relativeY = ripple.getAttribute('data-y');
  21630. var scale = ripple.getAttribute('data-scale');
  21631. var translate = ripple.getAttribute('data-translate');
  21632. // Get delay beetween mousedown and mouse leave
  21633. var diff = Date.now() - Number(ripple.getAttribute('data-hold'));
  21634. var delay = 350 - diff;
  21635. if (delay < 0) {
  21636. delay = 0;
  21637. }
  21638. if (e.type === 'mousemove') {
  21639. delay = 150;
  21640. }
  21641. // Fade out ripple after delay
  21642. var duration = e.type === 'mousemove' ? 2500 : Effect.duration;
  21643. setTimeout(function() {
  21644. var style = {
  21645. top: relativeY + 'px',
  21646. left: relativeX + 'px',
  21647. opacity: '0',
  21648. // Duration
  21649. '-webkit-transition-duration': duration + 'ms',
  21650. '-moz-transition-duration': duration + 'ms',
  21651. '-o-transition-duration': duration + 'ms',
  21652. 'transition-duration': duration + 'ms',
  21653. '-webkit-transform': scale + ' ' + translate,
  21654. '-moz-transform': scale + ' ' + translate,
  21655. '-ms-transform': scale + ' ' + translate,
  21656. '-o-transform': scale + ' ' + translate,
  21657. 'transform': scale + ' ' + translate
  21658. };
  21659. ripple.setAttribute('style', convertStyle(style));
  21660. setTimeout(function() {
  21661. try {
  21662. el.removeChild(ripple);
  21663. } catch (e) {
  21664. return false;
  21665. }
  21666. }, duration);
  21667. }, delay);
  21668. }
  21669. /**
  21670. * Disable mousedown event for 500ms during and after touch
  21671. */
  21672. var TouchHandler = {
  21673. /* uses an integer rather than bool so there's no issues with
  21674. * needing to clear timeouts if another touch event occurred
  21675. * within the 500ms. Cannot mouseup between touchstart and
  21676. * touchend, nor in the 500ms after touchend. */
  21677. touches: 0,
  21678. allowEvent: function(e) {
  21679. var allow = true;
  21680. if (/^(mousedown|mousemove)$/.test(e.type) && TouchHandler.touches) {
  21681. allow = false;
  21682. }
  21683. return allow;
  21684. },
  21685. registerEvent: function(e) {
  21686. var eType = e.type;
  21687. if (eType === 'touchstart') {
  21688. TouchHandler.touches += 1; // push
  21689. } else if (/^(touchend|touchcancel)$/.test(eType)) {
  21690. setTimeout(function() {
  21691. if (TouchHandler.touches) {
  21692. TouchHandler.touches -= 1; // pop after 500ms
  21693. }
  21694. }, 500);
  21695. }
  21696. }
  21697. };
  21698. /**
  21699. * Delegated click handler for .waves-effect element.
  21700. * returns null when .waves-effect element not in "click tree"
  21701. */
  21702. function getWavesEffectElement(e) {
  21703. if (TouchHandler.allowEvent(e) === false) {
  21704. return null;
  21705. }
  21706. var element = null;
  21707. var target = e.target || e.srcElement;
  21708. while (target.parentElement) {
  21709. if ( (!(target instanceof SVGElement)) && target.classList.contains('waves-effect')) {
  21710. element = target;
  21711. break;
  21712. }
  21713. target = target.parentElement;
  21714. }
  21715. return element;
  21716. }
  21717. /**
  21718. * Bubble the click and show effect if .waves-effect elem was found
  21719. */
  21720. function showEffect(e) {
  21721. // Disable effect if element has "disabled" property on it
  21722. // In some cases, the event is not triggered by the current element
  21723. // if (e.target.getAttribute('disabled') !== null) {
  21724. // return;
  21725. // }
  21726. var element = getWavesEffectElement(e);
  21727. if (element !== null) {
  21728. // Make it sure the element has either disabled property, disabled attribute or 'disabled' class
  21729. if (element.disabled || element.getAttribute('disabled') || element.classList.contains('disabled')) {
  21730. return;
  21731. }
  21732. TouchHandler.registerEvent(e);
  21733. if (e.type === 'touchstart' && Effect.delay) {
  21734. var hidden = false;
  21735. var timer = setTimeout(function () {
  21736. timer = null;
  21737. Effect.show(e, element);
  21738. }, Effect.delay);
  21739. var hideEffect = function(hideEvent) {
  21740. // if touch hasn't moved, and effect not yet started: start effect now
  21741. if (timer) {
  21742. clearTimeout(timer);
  21743. timer = null;
  21744. Effect.show(e, element);
  21745. }
  21746. if (!hidden) {
  21747. hidden = true;
  21748. Effect.hide(hideEvent, element);
  21749. }
  21750. removeListeners();
  21751. };
  21752. var touchMove = function(moveEvent) {
  21753. if (timer) {
  21754. clearTimeout(timer);
  21755. timer = null;
  21756. }
  21757. hideEffect(moveEvent);
  21758. removeListeners();
  21759. };
  21760. element.addEventListener('touchmove', touchMove, false);
  21761. element.addEventListener('touchend', hideEffect, false);
  21762. element.addEventListener('touchcancel', hideEffect, false);
  21763. var removeListeners = function() {
  21764. element.removeEventListener('touchmove', touchMove);
  21765. element.removeEventListener('touchend', hideEffect);
  21766. element.removeEventListener('touchcancel', hideEffect);
  21767. };
  21768. } else {
  21769. Effect.show(e, element);
  21770. if (isTouchAvailable) {
  21771. element.addEventListener('touchend', Effect.hide, false);
  21772. element.addEventListener('touchcancel', Effect.hide, false);
  21773. }
  21774. element.addEventListener('mouseup', Effect.hide, false);
  21775. element.addEventListener('mouseleave', Effect.hide, false);
  21776. }
  21777. }
  21778. }
  21779. Waves.init = function(options) {
  21780. var body = document.body;
  21781. options = options || {};
  21782. if ('duration' in options) {
  21783. Effect.duration = options.duration;
  21784. }
  21785. if ('delay' in options) {
  21786. Effect.delay = options.delay;
  21787. }
  21788. if (isTouchAvailable) {
  21789. body.addEventListener('touchstart', showEffect, false);
  21790. body.addEventListener('touchcancel', TouchHandler.registerEvent, false);
  21791. body.addEventListener('touchend', TouchHandler.registerEvent, false);
  21792. }
  21793. body.addEventListener('mousedown', showEffect, false);
  21794. };
  21795. /**
  21796. * Attach Waves to dynamically loaded inputs, or add .waves-effect and other
  21797. * waves classes to a set of elements. Set drag to true if the ripple mouseover
  21798. * or skimming effect should be applied to the elements.
  21799. */
  21800. Waves.attach = function(elements, classes) {
  21801. elements = getWavesElements(elements);
  21802. if (toString.call(classes) === '[object Array]') {
  21803. classes = classes.join(' ');
  21804. }
  21805. classes = classes ? ' ' + classes : '';
  21806. var element, tagName;
  21807. for (var i = 0, len = elements.length; i < len; i++) {
  21808. element = elements[i];
  21809. tagName = element.tagName.toLowerCase();
  21810. if (['input', 'img'].indexOf(tagName) !== -1) {
  21811. TagWrapper[tagName](element);
  21812. element = element.parentElement;
  21813. }
  21814. if (element.className.indexOf('waves-effect') === -1) {
  21815. element.className += ' waves-effect' + classes;
  21816. }
  21817. }
  21818. };
  21819. /**
  21820. * Cause a ripple to appear in an element via code.
  21821. */
  21822. Waves.ripple = function(elements, options) {
  21823. elements = getWavesElements(elements);
  21824. var elementsLen = elements.length;
  21825. options = options || {};
  21826. options.wait = options.wait || 0;
  21827. options.position = options.position || null; // default = centre of element
  21828. if (elementsLen) {
  21829. var element, pos, off, centre = {}, i = 0;
  21830. var mousedown = {
  21831. type: 'mousedown',
  21832. button: 1
  21833. };
  21834. var hideRipple = function(mouseup, element) {
  21835. return function() {
  21836. Effect.hide(mouseup, element);
  21837. };
  21838. };
  21839. for (; i < elementsLen; i++) {
  21840. element = elements[i];
  21841. pos = options.position || {
  21842. x: element.clientWidth / 2,
  21843. y: element.clientHeight / 2
  21844. };
  21845. off = offset(element);
  21846. centre.x = off.left + pos.x;
  21847. centre.y = off.top + pos.y;
  21848. mousedown.pageX = centre.x;
  21849. mousedown.pageY = centre.y;
  21850. Effect.show(mousedown, element);
  21851. if (options.wait >= 0 && options.wait !== null) {
  21852. var mouseup = {
  21853. type: 'mouseup',
  21854. button: 1
  21855. };
  21856. setTimeout(hideRipple(mouseup, element), options.wait);
  21857. }
  21858. }
  21859. }
  21860. };
  21861. /**
  21862. * Remove all ripples from an element.
  21863. */
  21864. Waves.calm = function(elements) {
  21865. elements = getWavesElements(elements);
  21866. var mouseup = {
  21867. type: 'mouseup',
  21868. button: 1
  21869. };
  21870. for (var i = 0, len = elements.length; i < len; i++) {
  21871. Effect.hide(mouseup, elements[i]);
  21872. }
  21873. };
  21874. /**
  21875. * Deprecated API fallback
  21876. */
  21877. Waves.displayEffect = function(options) {
  21878. console.error('Waves.displayEffect() has been deprecated and will be removed in future version. Please use Waves.init() to initialize Waves effect');
  21879. Waves.init(options);
  21880. };
  21881. return Waves;
  21882. });
  21883. /*!
  21884. * jQuery SmartPanels v1.0.0
  21885. *
  21886. * Copyright 2019, 2020 SmartAdmin WebApp
  21887. * Released under Marketplace License (see your license details for usage)
  21888. *
  21889. * Publish Date: 2018-01-01T17:42Z
  21890. */
  21891. (function ($, window, document, undefined) {
  21892. //"use strict";
  21893. var pluginName = 'smartPanel';
  21894. /**
  21895. * Check for touch support and set right click events.
  21896. **/
  21897. /*var clickEvent = (('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch ?
  21898. 'clickEvent' : 'click') + '.' + pluginName;*/
  21899. var clickEvent;
  21900. if (('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) {
  21901. clickEvent = 'click tap';
  21902. } else {
  21903. clickEvent = 'click';
  21904. }
  21905. function Plugin(element, options) {
  21906. /**
  21907. * Variables.
  21908. **/
  21909. this.obj = $(element);
  21910. this.o = $.extend({}, $.fn[pluginName].defaults, options);
  21911. this.objId = this.obj.attr('id');
  21912. this.panel = this.obj.find(this.o.panels);
  21913. this.storage = {enabled: this.o.localStorage};
  21914. this.initialized = false;
  21915. this.init();
  21916. }
  21917. Plugin.prototype = {
  21918. /**
  21919. * Function for the indicator image.
  21920. *
  21921. * @param:
  21922. **/
  21923. _runPanelLoader: function (elm) {
  21924. var self = this;
  21925. if (self.o.localStorage === true) {
  21926. elm.closest(self.o.panels)
  21927. .find('.panel-saving')
  21928. .stop(true, true)
  21929. .fadeIn(100)
  21930. .delay(600)
  21931. .fadeOut(100);
  21932. }
  21933. },
  21934. _loadKeys : function () {
  21935. var self = this;
  21936. var panel_url = self.o.pageKey || location.pathname;
  21937. self.storage.keySettings = 'smartPanel_settings_' + panel_url + '_' + self.objId;
  21938. self.storage.keyPosition = 'smartPanel_position_' + panel_url + '_' + self.objId;
  21939. },
  21940. /**
  21941. * Save all settings to the localStorage.
  21942. *
  21943. * @param:
  21944. **/
  21945. _savePanelSettings: function () {
  21946. var self = this;
  21947. var storage = self.storage;
  21948. self._loadKeys();
  21949. var storeSettings = self.obj.find(self.o.panels)
  21950. .map(function () {
  21951. var storeSettingsStr = {};
  21952. storeSettingsStr.id = $(this)
  21953. .attr('id');
  21954. storeSettingsStr.style = $(this)
  21955. .attr('data-panel-attstyle');
  21956. storeSettingsStr.locked = ($(this)
  21957. .hasClass('panel-locked') ? 1 : 0);
  21958. storeSettingsStr.collapsed = ($(this)
  21959. .hasClass('panel-collapsed') ? 1 : 0);
  21960. return storeSettingsStr;
  21961. }).get();
  21962. var storeSettingsObj = JSON.stringify({
  21963. 'panel': storeSettings
  21964. });
  21965. /* Place it in the storage(only if needed) */
  21966. if (storage.enabled && storage.getKeySettings != storeSettingsObj) {
  21967. localStorage.setItem(storage.keySettings, storeSettingsObj);
  21968. storage.getKeySettings = storeSettingsObj;
  21969. //if (myapp_config.debugState)
  21970. //console.log("storeSettingsObj:" + storeSettingsObj)
  21971. }
  21972. /**
  21973. * Run the callback function.
  21974. **/
  21975. if (typeof self.o.onSave == 'function') {
  21976. self.o.onSave.call(this, null, storeSettingsObj, storage.keySettings);
  21977. if (myapp_config.debugState)
  21978. console.log("keySettings: " + storage.keySettings)
  21979. }
  21980. },
  21981. /**
  21982. * Save positions to the localStorage.
  21983. *
  21984. * @param:
  21985. **/
  21986. _savePanelPosition: function () {
  21987. var self = this;
  21988. var storage = self.storage;
  21989. self._loadKeys();
  21990. var mainArr = self.obj.find(self.o.grid + '.sortable-grid')
  21991. .map(function () {
  21992. var subArr = $(this)
  21993. .children(self.o.panels)
  21994. .map(function () {
  21995. return {
  21996. 'id': $(this).attr('id')
  21997. };
  21998. }).get();
  21999. return {
  22000. 'section': subArr
  22001. };
  22002. }).get();
  22003. var storePositionObj = JSON.stringify({
  22004. 'grid': mainArr
  22005. });
  22006. /* Place it in the storage(only if needed) */
  22007. if (storage.enabled && storage.getKeyPosition != storePositionObj) {
  22008. localStorage.setItem(storage.keyPosition, storePositionObj);
  22009. storage.getKeyPosition = storePositionObj
  22010. }
  22011. /**
  22012. * Run the callback function.
  22013. **/
  22014. if (typeof self.o.onSave == 'function') {
  22015. self.o.onSave.call(this, storePositionObj, storage.keyPosition);
  22016. }
  22017. },
  22018. /**
  22019. * Code that we run at the start.
  22020. *
  22021. * @param:
  22022. **/
  22023. init: function () {
  22024. var self = this;
  22025. if (self.initialized) return;
  22026. self._initStorage(self.storage);
  22027. /**
  22028. * Force users to use an id(it's needed for the local storage).
  22029. **/
  22030. if (!$('#' + self.objId)
  22031. .length) {
  22032. //alert('Your panel ID is missing!');
  22033. if (typeof bootbox != 'undefined') {
  22034. bootbox.alert("Your panel ID is missing!");
  22035. } else {
  22036. alert('Your panel ID is missing!');
  22037. }
  22038. }
  22039. /**
  22040. * This will add an extra class that we use to store the
  22041. * panels in the right order.(savety)
  22042. **/
  22043. $(self.o.grid)
  22044. .each(function () {
  22045. if ($(this)
  22046. .find(self.o.panels)
  22047. .length) {
  22048. $(this)
  22049. .addClass('sortable-grid');
  22050. }
  22051. });
  22052. /**
  22053. * SET POSITION PANEL
  22054. **/
  22055. /**
  22056. * Run if data is present.
  22057. **/
  22058. if (self.storage.enabled && self.storage.getKeyPosition) {
  22059. var jsonPosition = JSON.parse(self.storage.getKeyPosition);
  22060. /**
  22061. * Loop the data, and put every panels on the right place.
  22062. **/
  22063. for (var key in jsonPosition.grid) {
  22064. var changeOrder = self.obj.find(self.o.grid + '.sortable-grid')
  22065. .eq(key);
  22066. for (var key2 in jsonPosition.grid[key].section) {
  22067. changeOrder.append($('#' + jsonPosition.grid[key].section[key2].id));
  22068. }
  22069. }
  22070. }
  22071. /**
  22072. * SET SETTINGS PANEL
  22073. **/
  22074. /**
  22075. * Run if data is present.
  22076. **/
  22077. if (self.storage.enabled && self.storage.getKeySettings) {
  22078. var jsonSettings = JSON.parse(self.storage.getKeySettings);
  22079. if (myapp_config.debugState)
  22080. console.log("Panel settings loaded: " + self.storage.getKeySettings)
  22081. /**
  22082. * Loop the data and hide/show the panels and set the inputs in
  22083. * panel to checked(if hidden) and add an indicator class to the div.
  22084. * Loop all labels and update the panel titles.
  22085. **/
  22086. for (var key in jsonSettings.panel) {
  22087. var panelId = $('#' + jsonSettings.panel[key].id);
  22088. /**
  22089. * Set a style(if present).
  22090. **/
  22091. if (jsonSettings.panel[key].style) {
  22092. panelId.attr('data-panel-attstyle', '' + jsonSettings.panel[key].style + '')
  22093. .children('.panel-hdr')
  22094. .removeClassPrefix('bg-')
  22095. .addClass(jsonSettings.panel[key].style);
  22096. }
  22097. /**
  22098. * Toggle content panel.
  22099. **/
  22100. if (jsonSettings.panel[key].collapsed == 1) {
  22101. panelId.addClass('panel-collapsed')
  22102. .children('.panel-container').addClass('collapse').removeClass('show');
  22103. }
  22104. /**
  22105. * Locked panel from sorting.
  22106. **/
  22107. if (jsonSettings.panel[key].locked == 1) {
  22108. panelId.addClass('panel-locked');
  22109. }
  22110. }
  22111. }
  22112. /**
  22113. * Format colors
  22114. **/
  22115. if (self.o.panelColors && self.o.colorButton) {
  22116. var formatedPanelColors = [];
  22117. for (var key in self.o.panelColors) {
  22118. formatedPanelColors.push('<a href="#" class="btn d-inline-block '+ self.o.panelColors[key] +' width-2 height-2 p-0 rounded-0 js-panel-color hover-effect-dot" data-panel-setstyle="'+ self.o.panelColors[key] +'" style="margin:1px;"></a>');
  22119. }
  22120. }
  22121. /**
  22122. * LOOP ALL PANELS
  22123. **/
  22124. self.panel.each(function () {
  22125. var tPanel = $(this),
  22126. closeButton,
  22127. fullscreenButton,
  22128. collapseButton,
  22129. lockedButton,
  22130. refreshButton,
  22131. colorButton,
  22132. resetButton,
  22133. customButton,
  22134. thisHeader = $(this).children('.panel-hdr'),
  22135. thisContainer = $(this).children('.panel-container');
  22136. /**
  22137. * Dont double wrap(check).
  22138. **/
  22139. if (!thisHeader.parent().attr('role')) {
  22140. /**
  22141. * Adding a helper class to all sortable panels, this will be
  22142. * used to find the panels that are sortable, it will skip the panels
  22143. * that have the dataset 'panels-sortable="false"' set to false.
  22144. **/
  22145. if (self.o.sortable === true && tPanel.data('panel-sortable') === undefined) {
  22146. tPanel.addClass('panel-sortable');
  22147. }
  22148. /**
  22149. * Add a close button to the panel header (if set to true)
  22150. **/
  22151. if (self.o.closeButton === true && tPanel.data('panel-close') === undefined) {
  22152. closeButton = '<a href="#" class="btn btn-panel hover-effect-dot js-panel-close" data-toggle="tooltip" data-offset="0,10" data-original-title="Close"></a>';
  22153. } else {
  22154. closeButton = '';
  22155. }
  22156. /**
  22157. * Add a fullscreen button to the panel header (if set to true).
  22158. **/
  22159. if (self.o.fullscreenButton === true && tPanel.data('panel-fullscreen') === undefined) {
  22160. fullscreenButton = '<a href="#" class="btn btn-panel hover-effect-dot js-panel-fullscreen" data-toggle="tooltip" data-offset="0,10" data-original-title="Fullscreen"></a>';
  22161. } else {
  22162. fullscreenButton = '';
  22163. }
  22164. /**
  22165. * Add a collapse button to the panel header (if set to true).
  22166. **/
  22167. if (self.o.collapseButton === true && tPanel.data('panel-collapsed') === undefined) {
  22168. collapseButton = '<a href="#" class="btn btn-panel hover-effect-dot js-panel-collapse" data-toggle="tooltip" data-offset="0,10" data-original-title="Collapse"></a>'
  22169. } else {
  22170. collapseButton = '';
  22171. }
  22172. /**
  22173. * Add a locked button to the panel header (if set to true).
  22174. **/
  22175. if (self.o.lockedButton === true && tPanel.data('panel-locked') === undefined) {
  22176. lockedButton = '<a href="#" class="dropdown-item js-panel-locked"><span data-i18n="drpdwn.lockpanel">' + self.o.lockedButtonLabel + '</span></a>'
  22177. } else {
  22178. lockedButton = '';
  22179. }
  22180. /**
  22181. * Add a refresh button to the panel header (if set to true).
  22182. **/
  22183. if (self.o.refreshButton === true && tPanel.data('panel-refresh') === undefined) {
  22184. refreshButton = '<a href="#" class="dropdown-item js-panel-refresh"><span data-i18n="drpdwn.refreshpanel">' + self.o.refreshButtonLabel + '</span></a>';
  22185. thisContainer.prepend(
  22186. '<div class="loader"><i class="fal fa-spinner-third fa-spin-4x fs-xxl"></i></div>'
  22187. );
  22188. //append** conflicts with panel > container > content:last child, so changed to prepend
  22189. } else {
  22190. refreshButton = '';
  22191. }
  22192. /**
  22193. * Add a color select button to the panel header (if set to true).
  22194. **/
  22195. if (self.o.colorButton === true && tPanel.data('panel-color') === undefined) {
  22196. colorButton = ' <div class="dropdown-multilevel dropdown-multilevel-left">\
  22197. <div class="dropdown-item">\
  22198. <span data-i18n="drpdwn.panelcolor">' + self.o.colorButtonLabel + '</span>\
  22199. </div>\
  22200. <div class="dropdown-menu d-flex flex-wrap" style="min-width: 9.5rem; width: 9.5rem; padding: 0.5rem">' + formatedPanelColors.join(" ") + '</div>\
  22201. </div>'
  22202. } else {
  22203. colorButton = '';
  22204. }
  22205. /**
  22206. * Add a reset widget button to the panel header (if set to true).
  22207. **/
  22208. if (self.o.resetButton === true && tPanel.data('panel-reset') === undefined) {
  22209. resetButton = '<div class="dropdown-divider m-0"></div><a href="#" class="dropdown-item js-panel-reset"><span data-i18n="drpdwn.resetpanel">' + self.o.resetButtonLabel + '</span></a>'
  22210. } else {
  22211. resetButton = '';
  22212. }
  22213. /**
  22214. * Add a custom button to the panel header (if set to true).
  22215. **/
  22216. if (self.o.customButton === true && tPanel.data('panel-custombutton') === undefined) {
  22217. customButton = '<a href="#" class="dropdown-item js-panel-custombutton pl-4"><span data-i18n="drpdwn.custombutton">' + self.o.customButtonLabel + '</span></a>'
  22218. } else {
  22219. customButton = '';
  22220. }
  22221. /**
  22222. * Append the image to the panel header.
  22223. **/
  22224. thisHeader.append(
  22225. '<div class="panel-saving mr-2" style="display:none"><i class="fal fa-spinner-third fa-spin-4x fs-xl"></i></div>'
  22226. );
  22227. /**
  22228. * Set the buttons order.
  22229. **/
  22230. var formatButtons = self.o.buttonOrder
  22231. .replace(/%close%/g, closeButton)
  22232. .replace(/%fullscreen%/g, fullscreenButton)
  22233. .replace(/%collapse%/g, collapseButton);
  22234. /**
  22235. * Add a button wrapper to the header.
  22236. **/
  22237. if (closeButton !== '' || fullscreenButton !== '' || collapseButton !== '') {
  22238. thisHeader.append('<div class="panel-toolbar">' + formatButtons + '</div>');
  22239. }
  22240. /**
  22241. * Set the dropdown buttons order.
  22242. **/
  22243. var formatDropdownButtons = self.o.buttonOrderDropdown
  22244. .replace(/%locked%/g, lockedButton)
  22245. .replace(/%color%/g, colorButton)
  22246. .replace(/%refresh%/g, refreshButton)
  22247. .replace(/%reset%/g, resetButton)
  22248. .replace(/%custom%/g, customButton);
  22249. /**
  22250. * Add a button wrapper to the header.
  22251. **/
  22252. if (lockedButton !== '' || colorButton !== '' || refreshButton !== '' || resetButton !== '' || customButton !== '') {
  22253. thisHeader.append('<div class="panel-toolbar"><a href="#" class="btn btn-toolbar-master" data-toggle="dropdown"><i class="fal fa-ellipsis-v"></i></a><div class="dropdown-menu dropdown-menu-animated dropdown-menu-right p-0">' + formatDropdownButtons + '</div></div>');
  22254. }
  22255. /**
  22256. * Adding roles to some parts.
  22257. **/
  22258. tPanel.attr('role', 'widget')
  22259. .children('div')
  22260. .attr('role', 'content')
  22261. .prev('.panel-hdr')
  22262. .attr('role', 'heading')
  22263. .children('.panel-toolbar')
  22264. .attr('role', 'menu');
  22265. }
  22266. });
  22267. /**
  22268. * SORTABLE
  22269. **/
  22270. /**
  22271. * jQuery UI soratble, this allows users to sort the panels.
  22272. * Notice that this part needs the jquery-ui core to work.
  22273. **/
  22274. if (self.o.sortable === true && jQuery.ui) {
  22275. var sortItem = self.obj.find(self.o.grid + '.sortable-grid')
  22276. .not('[data-panel-excludegrid]');
  22277. sortItem.sortable({
  22278. items: sortItem.find(self.o.panels + '.panel-sortable'),
  22279. connectWith: sortItem,
  22280. placeholder: self.o.placeholderClass,
  22281. cursor: 'move',
  22282. //revert: true,
  22283. opacity: self.o.opacity,
  22284. delay: 0,
  22285. revert: 350,
  22286. cancel: '.btn-panel, .panel-fullscreen .panel-fullscreen, .mod-panel-disable .panel-sortable, .panel-locked.panel-sortable',
  22287. zIndex: 10000,
  22288. handle: self.o.dragHandle,
  22289. forcePlaceholderSize: true,
  22290. forceHelperSize: true,
  22291. update: function (event, ui) {
  22292. /* run pre-loader in the panel */
  22293. self._runPanelLoader(ui.item.children());
  22294. /* store the positions of the plugins */
  22295. self._savePanelPosition();
  22296. /**
  22297. * Run the callback function.
  22298. **/
  22299. if (typeof self.o.onChange == 'function') {
  22300. self.o.onChange.call(this, ui.item);
  22301. }
  22302. }
  22303. }); //you can add }).disableSelection() if you don't want text to be selected accidently.
  22304. }
  22305. /**
  22306. * CLICKEVENTS
  22307. **/
  22308. self._clickEvents();
  22309. /**
  22310. * DELETE LOCAL STORAGE KEYS
  22311. **/
  22312. if (self.storage.enabled) {
  22313. // Delete the settings key.
  22314. $(self.o.deleteSettingsKey)
  22315. .on(clickEvent, this, function (e) {
  22316. var cleared = confirm(self.o.settingsKeyLabel);
  22317. if (cleared) {
  22318. localStorage.removeItem(keySettings);
  22319. }
  22320. e.preventDefault();
  22321. });
  22322. // Delete the position key.
  22323. $(self.o.deletePositionKey)
  22324. .on(clickEvent, this, function (e) {
  22325. var cleared = confirm(self.o.positionKeyLabel);
  22326. if (cleared) {
  22327. localStorage.removeItem(keyPosition);
  22328. }
  22329. e.preventDefault();
  22330. });
  22331. }
  22332. initialized = true;
  22333. },
  22334. /**
  22335. * Initialize storage.
  22336. *
  22337. * @param:
  22338. **/
  22339. _initStorage: function (storage) {
  22340. /**
  22341. * LOCALSTORAGE CHECK
  22342. **/
  22343. storage.enabled = storage.enabled && !! function () {
  22344. var result, uid = +new Date();
  22345. try {
  22346. localStorage.setItem(uid, uid);
  22347. result = localStorage.getItem(uid) == uid;
  22348. localStorage.removeItem(uid);
  22349. return result;
  22350. } catch (e) {}
  22351. }();
  22352. this._loadKeys();
  22353. if (storage.enabled) {
  22354. storage.getKeySettings = localStorage.getItem(storage.keySettings);
  22355. storage.getKeyPosition = localStorage.getItem(storage.keyPosition);
  22356. } // end if
  22357. },
  22358. /**
  22359. * Register all click events.
  22360. *
  22361. * @param:
  22362. **/
  22363. _clickEvents: function () {
  22364. var self = this;
  22365. var headers = self.panel.children('.panel-hdr');
  22366. /**
  22367. * Allow users to toggle collapse.
  22368. **/
  22369. headers.on(clickEvent, '.js-panel-collapse', function (e) {
  22370. var tPanel = $(this),
  22371. pPanel = tPanel.closest(self.o.panels);
  22372. /**
  22373. * Close tooltip
  22374. **/
  22375. if( typeof($.fn.tooltip) !== 'undefined' && $('[data-toggle="tooltip"]').length ){
  22376. $(this).tooltip('hide');
  22377. } else {
  22378. console.log("bs.tooltip is not loaded");
  22379. }
  22380. /**
  22381. * Run function for the indicator image.
  22382. **/
  22383. // pPanel.toggleClass("panel-collapsed");
  22384. pPanel.children('.panel-container').collapse('toggle')
  22385. .on('shown.bs.collapse', function() {
  22386. pPanel.removeClass('panel-collapsed');
  22387. self._savePanelSettings();
  22388. }).on('hidden.bs.collapse', function(){
  22389. pPanel.addClass('panel-collapsed');
  22390. self._savePanelSettings();
  22391. });
  22392. /*if (pPanel.hasClass('panel-collapsed')) {
  22393. pPanel.removeClass('panel-collapsed')
  22394. .children('.panel-container')
  22395. .slideDown(400, function () {
  22396. self._savePanelSettings();
  22397. });
  22398. } else {
  22399. pPanel.addClass('panel-collapsed')
  22400. .children('.panel-container')
  22401. .slideUp(400, function () {
  22402. self._savePanelSettings();
  22403. });
  22404. }*/
  22405. /**
  22406. * Run function for the indicator image.
  22407. **/
  22408. self._runPanelLoader(tPanel);
  22409. /**
  22410. * Run the callback function.
  22411. **/
  22412. if (typeof self.o.onCollapse == 'function') {
  22413. self.o.onCollapse.call(this, pPanel);
  22414. }
  22415. /**
  22416. * Lets save the setings.
  22417. **/
  22418. // self._savePanelSettings();
  22419. e.preventDefault();
  22420. });
  22421. /**
  22422. * Allow users to toggle fullscreen.
  22423. **/
  22424. headers.on(clickEvent, '.js-panel-fullscreen', function (e) {
  22425. var tPanel = $(this),
  22426. pPanel = tPanel.closest(self.o.panels);
  22427. /**
  22428. * Close tooltip
  22429. **/
  22430. if( typeof($.fn.tooltip) !== 'undefined' && $('[data-toggle="tooltip"]').length ){
  22431. $(this).tooltip('hide');
  22432. } else {
  22433. console.log("bs.tooltip is not loaded");
  22434. }
  22435. /**
  22436. * Run function for the indicator image.
  22437. **/
  22438. pPanel.toggleClass("panel-fullscreen");
  22439. myapp_config.root_.toggleClass('panel-fullscreen');
  22440. /**
  22441. * Run function for the indicator image.
  22442. **/
  22443. self._runPanelLoader(tPanel);
  22444. /**
  22445. * Run the callback function.
  22446. **/
  22447. if (typeof self.o.onFullscreen == 'function') {
  22448. self.o.onFullscreen.call(this, pPanel);
  22449. }
  22450. e.preventDefault();
  22451. });
  22452. /**
  22453. * Allow users to close the panel.
  22454. **/
  22455. headers.on(clickEvent, '.js-panel-close', function (e) {
  22456. var tPanel = $(this),
  22457. pPanel = tPanel.closest(self.o.panels),
  22458. pTitle = pPanel.children('.panel-hdr').children('h2').text().trim();
  22459. /**
  22460. * Close tooltip
  22461. **/
  22462. if( typeof($.fn.tooltip) !== 'undefined' && $('[data-toggle="tooltip"]').length ){
  22463. $(this).tooltip('hide');
  22464. } else {
  22465. console.log("bs.tooltip is not loaded");
  22466. }
  22467. var killPanel = function (){
  22468. /**
  22469. * Run function for the indicator image.
  22470. **/
  22471. pPanel.fadeOut(500,function(){
  22472. /* remove panel */
  22473. $(this).remove();
  22474. /**
  22475. * Run the callback function.
  22476. **/
  22477. if (typeof self.o.onClosepanel == 'function') {
  22478. self.o.onClosepanel.call(this, pPanel);
  22479. }
  22480. });
  22481. /**
  22482. * Run function for the indicator image.
  22483. **/
  22484. self._runPanelLoader(tPanel);
  22485. };
  22486. //backdrop sound
  22487. initApp.playSound('media/sound', 'messagebox')
  22488. if (typeof bootbox != 'undefined') {
  22489. bootbox.confirm({
  22490. title: "<i class='fal fa-times-circle text-danger mr-2'></i> Do you wish to delete panel <span class='fw-500'>&nbsp;'" +pTitle+"'&nbsp;</span>?",
  22491. message: "<span><strong>Warning:</strong> This action cannot be undone!</span>",
  22492. centerVertical: true,
  22493. swapButtonOrder: true,
  22494. buttons: {
  22495. confirm: {
  22496. label: 'Yes',
  22497. className: 'btn-danger shadow-0'
  22498. },
  22499. cancel: {
  22500. label: 'No',
  22501. className: 'btn-default'
  22502. }
  22503. },
  22504. className: "modal-alert",
  22505. closeButton: false,
  22506. callback: function (result) {
  22507. if (result == true) {
  22508. //close panel
  22509. killPanel();
  22510. }
  22511. }
  22512. });
  22513. } else {
  22514. if (confirm( 'Do you wish to delete panel ' + pTitle + '?' )) {
  22515. killPanel();
  22516. }
  22517. }
  22518. e.preventDefault();
  22519. });
  22520. /**
  22521. * Allow users to set widget style (color).
  22522. **/
  22523. headers.on(clickEvent, '.js-panel-color', function (e) {
  22524. var tPanel = $(this),
  22525. pPanel = tPanel.closest(self.o.panels),
  22526. selectedHdr = tPanel.closest('.panel-hdr'),
  22527. val = tPanel.data('panel-setstyle');
  22528. /**
  22529. * Run the callback function.
  22530. **/
  22531. selectedHdr.removeClassPrefix('bg-')
  22532. .addClass(val)
  22533. .closest('.panel')
  22534. .attr('data-panel-attstyle', '' + val + '');
  22535. /**
  22536. * Run the callback function.
  22537. **/
  22538. if (typeof self.o.onColor == 'function') {
  22539. self.o.onColor.call(this, pPanel);
  22540. }
  22541. /**
  22542. * Run function for the indicator image.
  22543. **/
  22544. self._runPanelLoader(tPanel);
  22545. /**
  22546. * Lets save the setings.
  22547. **/
  22548. self._savePanelSettings();
  22549. e.preventDefault();
  22550. });
  22551. /**
  22552. * Allow users to lock widget to grid - preventing draging.
  22553. **/
  22554. headers.on(clickEvent, '.js-panel-locked', function (e) {
  22555. var tPanel = $(this),
  22556. pPanel = tPanel.closest(self.o.panels);
  22557. /**
  22558. * Run function for the indicator image.
  22559. **/
  22560. pPanel.toggleClass('panel-locked');
  22561. /**
  22562. * Run function for the indicator image.
  22563. **/
  22564. self._runPanelLoader(tPanel);
  22565. /**
  22566. * Run the callback function.
  22567. **/
  22568. if (typeof self.o.onLocked == 'function') {
  22569. self.o.onLocked.call(this, pPanel);
  22570. }
  22571. /**
  22572. * Lets save the setings.
  22573. **/
  22574. self._savePanelSettings();
  22575. e.preventDefault();
  22576. });
  22577. /**
  22578. * Allow users to toggle refresh widget content.
  22579. **/
  22580. headers.on(clickEvent, '.js-panel-refresh', function (e) {
  22581. var tPanel = $(this),
  22582. pPanel = tPanel.closest(self.o.panels),
  22583. //pContainer = pPanel.children('.panel-container'),
  22584. dTimer = pPanel.attr('data-refresh-timer') || 1500;
  22585. /**
  22586. * Run function for the indicator image.
  22587. **/
  22588. pPanel.addClass('panel-refresh').children('.panel-container').addClass('enable-loader')
  22589. .stop(true, true)
  22590. .delay(dTimer).queue(function(){
  22591. //pContainer.removeClass('enable-spinner').dequeue();
  22592. pPanel.removeClass('panel-refresh').children('.panel-container').removeClass('enable-loader').dequeue();
  22593. console.log(pPanel.attr('id') + " refresh complete");
  22594. });
  22595. /**
  22596. * Run the callback function.
  22597. **/
  22598. if (typeof self.o.onRefresh == 'function') {
  22599. self.o.onRefresh.call(this, pPanel);
  22600. }
  22601. e.preventDefault();
  22602. });
  22603. /**
  22604. * Allow users to toggle reset widget settings.
  22605. **/
  22606. headers.on(clickEvent, '.js-panel-reset', function (e) {
  22607. var tPanel = $(this),
  22608. pPanel = tPanel.closest(self.o.panels),
  22609. selectedHdr = tPanel.closest('.panel-hdr');
  22610. /**
  22611. * Remove all setting classes.
  22612. **/
  22613. selectedHdr.removeClassPrefix('bg-')
  22614. .closest('.panel')
  22615. .removeClass('panel-collapsed panel-fullscreen panel-locked')
  22616. .attr('data-panel-attstyle', '')
  22617. .children('.panel-container').collapse('show');
  22618. /**
  22619. * Run function for the indicator image.
  22620. **/
  22621. self._runPanelLoader(tPanel);
  22622. /**
  22623. * Lets save the setings.
  22624. **/
  22625. self._savePanelSettings();
  22626. /**
  22627. * Run the callback function.
  22628. **/
  22629. if (typeof self.o.onReset == 'function') {
  22630. self.o.onReset.call(this, pPanel);
  22631. }
  22632. e.preventDefault();
  22633. });
  22634. headers = null;
  22635. },
  22636. /**
  22637. * Destroy.
  22638. *
  22639. * @param:
  22640. **/
  22641. destroy: function () {
  22642. var self = this,
  22643. namespace = '.' + pluginName,
  22644. sortItem = self.obj.find(self.o.grid + '.sortable-grid').not('[data-panel-excludegrid]');
  22645. self.panel.removeClass('panel-sortable');
  22646. sortItem.sortable('destroy');
  22647. self.panel.children('.panel-hdr').off(namespace);
  22648. $(self.o.deletePositionKey).off(namespace);
  22649. $(window).off(namespace);
  22650. self.obj.removeData(pluginName);
  22651. self.initialized = false;
  22652. }
  22653. };
  22654. $.fn[pluginName] = function (option) {
  22655. return this.each(function () {
  22656. var $this = $(this),
  22657. data = $this.data(pluginName);
  22658. if (!data) {
  22659. var options = typeof option == 'object' && option;
  22660. $this.data(pluginName, (data = new Plugin(this, options)));
  22661. }
  22662. if (typeof option == 'string') {
  22663. data[option]();
  22664. }
  22665. });
  22666. };
  22667. /**
  22668. * Default settings(dont change).
  22669. * You can globally override these options
  22670. * by using $.fn.pluginName.key = 'value';
  22671. **/
  22672. $.fn[pluginName].defaults = {
  22673. grid: '[class*="col-"]',
  22674. panels: '.panel',
  22675. placeholderClass: 'panel-placeholder',
  22676. dragHandle: '> .panel-hdr > h2',
  22677. localStorage: true,
  22678. onChange: function () {},
  22679. onSave: function () {},
  22680. opacity: 1,
  22681. deleteSettingsKey: '',
  22682. settingsKeyLabel: 'Reset settings?',
  22683. deletePositionKey: '',
  22684. positionKeyLabel: 'Reset position?',
  22685. sortable: true,
  22686. buttonOrder: '%collapse% %fullscreen% %close%',
  22687. buttonOrderDropdown: '%refresh% %locked% %color% %custom% %reset%',
  22688. customButton: false,
  22689. customButtonLabel: "Custom Label",
  22690. onCustom: function () {},
  22691. closeButton: true,
  22692. onClosepanel: function() {
  22693. if (myapp_config.debugState)
  22694. console.log($(this).closest(".panel").attr('id') + " onClosepanel")
  22695. },
  22696. fullscreenButton: true,
  22697. onFullscreen: function() {
  22698. if (myapp_config.debugState)
  22699. console.log($(this).closest(".panel").attr('id') + " onFullscreen")
  22700. },
  22701. collapseButton: true,
  22702. onCollapse: function() {
  22703. if (myapp_config.debugState)
  22704. console.log($(this).closest(".panel").attr('id') + " onCollapse")
  22705. },
  22706. lockedButton: true,
  22707. lockedButtonLabel: "Lock Position",
  22708. onLocked: function() {
  22709. if (myapp_config.debugState)
  22710. console.log($(this).closest(".panel").attr('id') + " onLocked")
  22711. },
  22712. refreshButton: true,
  22713. refreshButtonLabel: "Refresh Content",
  22714. onRefresh: function() {
  22715. if (myapp_config.debugState)
  22716. console.log($(this).closest(".panel").attr('id') + " onRefresh")
  22717. },
  22718. colorButton: true,
  22719. colorButtonLabel: "Panel Style",
  22720. onColor: function() {
  22721. if (myapp_config.debugState)
  22722. console.log($(this).closest(".panel").attr('id') + " onColor")
  22723. },
  22724. panelColors: ['bg-primary-700 bg-success-gradient',
  22725. 'bg-primary-500 bg-info-gradient',
  22726. 'bg-primary-600 bg-primary-gradient',
  22727. 'bg-info-600 bg-primray-gradient',
  22728. 'bg-info-600 bg-info-gradient',
  22729. 'bg-info-700 bg-success-gradient',
  22730. 'bg-success-900 bg-info-gradient',
  22731. 'bg-success-700 bg-primary-gradient',
  22732. 'bg-success-600 bg-success-gradient',
  22733. 'bg-danger-900 bg-info-gradient',
  22734. 'bg-fusion-400 bg-fusion-gradient',
  22735. 'bg-faded'],
  22736. resetButton: true,
  22737. resetButtonLabel: "Reset Panel",
  22738. onReset: function() {
  22739. if (myapp_config.debugState)
  22740. console.log( $(this).closest(".panel").attr('id') + " onReset callback" )
  22741. }
  22742. };
  22743. })(jQuery, window, document);