main.min.js 3.1 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387653886538965390653916539265393653946539565396653976539865399654006540165402654036540465405654066540765408654096541065411654126541365414654156541665417654186541965420654216542265423654246542565426654276542865429654306543165432654336543465435654366543765438654396544065441654426544365444654456544665447654486544965450654516545265453654546545565456654576545865459654606546165462654636546465465654666546765468654696547065471654726547365474654756547665477654786547965480654816548265483654846548565486654876548865489654906549165492654936549465495654966549765498654996550065501655026550365504655056550665507655086550965510655116551265513655146551565516655176551865519655206552165522655236552465525655266552765528655296553065531655326553365534655356553665537655386553965540655416554265543655446554565546655476554865549655506555165552655536555465555655566555765558655596556065561655626556365564655656556665567655686556965570655716557265573655746557565576655776557865579655806558165582655836558465585655866558765588655896559065591655926559365594655956559665597655986559965600656016560265603656046560565606656076560865609656106561165612656136561465615656166561765618656196562065621656226562365624656256562665627656286562965630656316563265633656346563565636656376563865639656406564165642656436564465645656466564765648656496565065651656526565365654656556565665657656586565965660656616566265663656646566565666656676566865669656706567165672656736567465675656766567765678656796568065681656826568365684656856568665687656886568965690656916569265693656946569565696656976569865699657006570165702657036570465705657066570765708657096571065711657126571365714657156571665717657186571965720657216572265723657246572565726657276572865729657306573165732657336573465735657366573765738657396574065741657426574365744657456574665747657486574965750657516575265753657546575565756657576575865759657606576165762657636576465765657666576765768657696577065771657726577365774657756577665777657786577965780657816578265783657846578565786657876578865789657906579165792657936579465795657966579765798657996580065801658026580365804658056580665807658086580965810658116581265813658146581565816658176581865819658206582165822658236582465825658266582765828658296583065831658326583365834658356583665837658386583965840658416584265843658446584565846658476584865849658506585165852658536585465855658566585765858658596586065861658626586365864658656586665867658686586965870658716587265873658746587565876658776587865879658806588165882658836588465885658866588765888658896589065891658926589365894658956589665897658986589965900659016590265903659046590565906659076590865909659106591165912659136591465915659166591765918659196592065921659226592365924659256592665927659286592965930659316593265933659346593565936659376593865939659406594165942659436594465945659466594765948659496595065951659526595365954659556595665957659586595965960659616596265963659646596565966659676596865969659706597165972659736597465975659766597765978659796598065981659826598365984659856598665987659886598965990659916599265993659946599565996659976599865999660006600166002660036600466005660066600766008660096601066011660126601366014660156601666017660186601966020660216602266023660246602566026660276602866029660306603166032660336603466035660366603766038660396604066041660426604366044660456604666047660486604966050660516605266053660546605566056660576605866059660606606166062660636606466065660666606766068660696607066071660726607366074660756607666077660786607966080660816608266083660846608566086660876608866089660906609166092660936609466095660966609766098660996610066101661026610366104661056610666107661086610966110661116611266113661146611566116661176611866119661206612166122661236612466125661266612766128661296613066131661326613366134661356613666137661386613966140661416614266143661446614566146661476614866149661506615166152661536615466155661566615766158661596616066161661626616366164661656616666167661686616966170661716617266173661746617566176661776617866179661806618166182661836618466185661866618766188661896619066191661926619366194661956619666197661986619966200662016620266203662046620566206662076620866209662106621166212662136621466215662166621766218662196622066221662226622366224662256622666227662286622966230662316623266233662346623566236662376623866239662406624166242662436624466245662466624766248662496625066251662526625366254662556625666257662586625966260662616626266263662646626566266662676626866269662706627166272662736627466275662766627766278662796628066281662826628366284662856628666287662886628966290662916629266293662946629566296662976629866299663006630166302663036630466305663066630766308663096631066311663126631366314663156631666317663186631966320663216632266323663246632566326663276632866329663306633166332663336633466335663366633766338663396634066341663426634366344663456634666347663486634966350663516635266353663546635566356663576635866359663606636166362663636636466365663666636766368663696637066371663726637366374663756637666377663786637966380663816638266383663846638566386663876638866389663906639166392663936639466395663966639766398663996640066401664026640366404664056640666407664086640966410664116641266413664146641566416664176641866419664206642166422664236642466425664266642766428664296643066431664326643366434664356643666437664386643966440664416644266443664446644566446664476644866449664506645166452664536645466455664566645766458664596646066461664626646366464664656646666467664686646966470664716647266473664746647566476664776647866479664806648166482664836648466485664866648766488664896649066491664926649366494664956649666497664986649966500665016650266503665046650566506665076650866509665106651166512665136651466515665166651766518665196652066521665226652366524665256652666527665286652966530665316653266533665346653566536665376653866539665406654166542665436654466545665466654766548665496655066551665526655366554665556655666557665586655966560665616656266563665646656566566665676656866569665706657166572665736657466575665766657766578665796658066581665826658366584665856658666587665886658966590665916659266593665946659566596665976659866599666006660166602666036660466605666066660766608666096661066611666126661366614666156661666617666186661966620666216662266623666246662566626666276662866629666306663166632666336663466635666366663766638666396664066641666426664366644666456664666647666486664966650666516665266653666546665566656666576665866659666606666166662666636666466665666666666766668666696667066671666726667366674666756667666677666786667966680666816668266683666846668566686666876668866689666906669166692666936669466695666966669766698666996670066701667026670366704667056670666707667086670966710667116671266713667146671566716667176671866719667206672166722667236672466725667266672766728667296673066731667326673366734667356673666737667386673966740667416674266743667446674566746667476674866749667506675166752667536675466755667566675766758667596676066761667626676366764667656676666767667686676966770667716677266773667746677566776667776677866779667806678166782667836678466785667866678766788667896679066791667926679366794667956679666797667986679966800668016680266803668046680566806668076680866809668106681166812668136681466815668166681766818668196682066821668226682366824668256682666827668286682966830668316683266833668346683566836668376683866839668406684166842668436684466845668466684766848668496685066851668526685366854668556685666857668586685966860668616686266863668646686566866668676686866869668706687166872668736687466875668766687766878668796688066881668826688366884668856688666887668886688966890668916689266893668946689566896668976689866899669006690166902669036690466905669066690766908669096691066911669126691366914669156691666917669186691966920669216692266923669246692566926669276692866929669306693166932669336693466935669366693766938669396694066941669426694366944669456694666947669486694966950669516695266953669546695566956669576695866959669606696166962669636696466965669666696766968669696697066971669726697366974669756697666977669786697966980669816698266983669846698566986669876698866989669906699166992669936699466995669966699766998669996700067001670026700367004670056700667007670086700967010670116701267013670146701567016670176701867019670206702167022670236702467025670266702767028670296703067031670326703367034670356703667037670386703967040670416704267043670446704567046670476704867049670506705167052670536705467055670566705767058670596706067061670626706367064670656706667067670686706967070670716707267073670746707567076670776707867079670806708167082670836708467085670866708767088670896709067091670926709367094670956709667097670986709967100671016710267103671046710567106671076710867109671106711167112671136711467115671166711767118671196712067121671226712367124671256712667127671286712967130671316713267133671346713567136671376713867139671406714167142671436714467145671466714767148671496715067151671526715367154671556715667157671586715967160671616716267163671646716567166671676716867169671706717167172671736717467175671766717767178671796718067181671826718367184671856718667187671886718967190671916719267193671946719567196671976719867199672006720167202672036720467205672066720767208672096721067211672126721367214672156721667217672186721967220672216722267223672246722567226672276722867229672306723167232672336723467235672366723767238672396724067241672426724367244672456724667247672486724967250672516725267253672546725567256672576725867259672606726167262672636726467265672666726767268672696727067271672726727367274672756727667277672786727967280672816728267283672846728567286672876728867289672906729167292672936729467295672966729767298672996730067301673026730367304673056730667307673086730967310673116731267313673146731567316673176731867319673206732167322673236732467325673266732767328673296733067331673326733367334673356733667337673386733967340673416734267343673446734567346673476734867349673506735167352673536735467355673566735767358673596736067361673626736367364673656736667367673686736967370673716737267373673746737567376673776737867379673806738167382673836738467385673866738767388673896739067391673926739367394673956739667397673986739967400674016740267403674046740567406674076740867409674106741167412674136741467415674166741767418674196742067421674226742367424674256742667427674286742967430674316743267433674346743567436674376743867439674406744167442674436744467445674466744767448674496745067451674526745367454674556745667457674586745967460674616746267463674646746567466674676746867469674706747167472674736747467475674766747767478674796748067481674826748367484674856748667487674886748967490674916749267493674946749567496674976749867499675006750167502675036750467505675066750767508675096751067511675126751367514675156751667517675186751967520675216752267523675246752567526675276752867529675306753167532675336753467535675366753767538675396754067541675426754367544675456754667547675486754967550675516755267553675546755567556675576755867559675606756167562675636756467565675666756767568675696757067571675726757367574675756757667577675786757967580675816758267583675846758567586675876758867589675906759167592675936759467595675966759767598675996760067601676026760367604676056760667607676086760967610676116761267613676146761567616676176761867619676206762167622676236762467625676266762767628676296763067631676326763367634676356763667637676386763967640676416764267643676446764567646676476764867649676506765167652676536765467655676566765767658676596766067661676626766367664676656766667667676686766967670676716767267673676746767567676676776767867679676806768167682676836768467685676866768767688676896769067691676926769367694676956769667697676986769967700677016770267703677046770567706677076770867709677106771167712677136771467715677166771767718677196772067721677226772367724677256772667727677286772967730677316773267733677346773567736677376773867739677406774167742677436774467745677466774767748677496775067751677526775367754677556775667757677586775967760677616776267763677646776567766677676776867769677706777167772677736777467775677766777767778677796778067781677826778367784677856778667787677886778967790677916779267793677946779567796677976779867799678006780167802678036780467805678066780767808678096781067811678126781367814678156781667817678186781967820678216782267823678246782567826678276782867829678306783167832678336783467835678366783767838678396784067841678426784367844678456784667847678486784967850678516785267853678546785567856678576785867859678606786167862678636786467865678666786767868678696787067871678726787367874678756787667877678786787967880678816788267883678846788567886678876788867889678906789167892678936789467895678966789767898678996790067901679026790367904679056790667907679086790967910679116791267913679146791567916679176791867919679206792167922679236792467925679266792767928679296793067931679326793367934679356793667937679386793967940679416794267943679446794567946679476794867949679506795167952679536795467955679566795767958679596796067961679626796367964679656796667967679686796967970679716797267973679746797567976679776797867979679806798167982679836798467985679866798767988679896799067991679926799367994679956799667997679986799968000680016800268003680046800568006680076800868009680106801168012680136801468015680166801768018680196802068021680226802368024680256802668027680286802968030680316803268033680346803568036680376803868039680406804168042680436804468045680466804768048680496805068051680526805368054680556805668057680586805968060680616806268063680646806568066680676806868069680706807168072680736807468075680766807768078680796808068081680826808368084680856808668087680886808968090680916809268093680946809568096680976809868099681006810168102681036810468105681066810768108681096811068111681126811368114681156811668117681186811968120681216812268123681246812568126681276812868129681306813168132681336813468135681366813768138681396814068141681426814368144681456814668147681486814968150681516815268153681546815568156681576815868159681606816168162681636816468165681666816768168681696817068171681726817368174681756817668177681786817968180681816818268183681846818568186681876818868189681906819168192681936819468195681966819768198681996820068201682026820368204682056820668207682086820968210682116821268213682146821568216682176821868219682206822168222682236822468225682266822768228682296823068231682326823368234682356823668237682386823968240682416824268243682446824568246682476824868249682506825168252682536825468255682566825768258682596826068261682626826368264682656826668267682686826968270682716827268273682746827568276682776827868279682806828168282682836828468285682866828768288682896829068291682926829368294682956829668297682986829968300683016830268303683046830568306683076830868309683106831168312683136831468315683166831768318683196832068321683226832368324683256832668327683286832968330683316833268333683346833568336683376833868339683406834168342683436834468345683466834768348683496835068351683526835368354683556835668357683586835968360683616836268363683646836568366683676836868369683706837168372683736837468375683766837768378683796838068381683826838368384683856838668387683886838968390683916839268393683946839568396683976839868399684006840168402684036840468405684066840768408684096841068411684126841368414684156841668417684186841968420684216842268423684246842568426684276842868429684306843168432684336843468435684366843768438684396844068441684426844368444684456844668447684486844968450684516845268453684546845568456684576845868459684606846168462684636846468465684666846768468684696847068471684726847368474684756847668477684786847968480684816848268483684846848568486684876848868489684906849168492684936849468495684966849768498684996850068501685026850368504685056850668507685086850968510685116851268513685146851568516685176851868519685206852168522685236852468525685266852768528685296853068531685326853368534685356853668537685386853968540685416854268543685446854568546685476854868549685506855168552685536855468555685566855768558685596856068561685626856368564685656856668567685686856968570685716857268573685746857568576685776857868579685806858168582685836858468585685866858768588685896859068591685926859368594685956859668597685986859968600686016860268603686046860568606686076860868609686106861168612686136861468615686166861768618686196862068621686226862368624686256862668627686286862968630686316863268633686346863568636686376863868639686406864168642686436864468645686466864768648686496865068651686526865368654686556865668657686586865968660686616866268663686646866568666686676866868669686706867168672686736867468675686766867768678686796868068681686826868368684686856868668687686886868968690686916869268693686946869568696686976869868699687006870168702687036870468705687066870768708687096871068711687126871368714687156871668717687186871968720687216872268723687246872568726687276872868729687306873168732687336873468735687366873768738687396874068741687426874368744687456874668747687486874968750687516875268753687546875568756687576875868759687606876168762687636876468765687666876768768687696877068771687726877368774687756877668777687786877968780687816878268783687846878568786687876878868789687906879168792687936879468795687966879768798687996880068801688026880368804688056880668807688086880968810688116881268813688146881568816688176881868819688206882168822688236882468825688266882768828688296883068831688326883368834688356883668837688386883968840688416884268843688446884568846688476884868849688506885168852688536885468855688566885768858688596886068861688626886368864688656886668867688686886968870688716887268873688746887568876688776887868879688806888168882688836888468885688866888768888688896889068891688926889368894688956889668897688986889968900689016890268903689046890568906689076890868909689106891168912689136891468915689166891768918689196892068921689226892368924689256892668927689286892968930689316893268933689346893568936689376893868939689406894168942689436894468945689466894768948689496895068951689526895368954689556895668957689586895968960689616896268963689646896568966689676896868969689706897168972689736897468975689766897768978689796898068981689826898368984689856898668987689886898968990689916899268993689946899568996689976899868999690006900169002690036900469005690066900769008690096901069011690126901369014690156901669017690186901969020690216902269023690246902569026690276902869029690306903169032690336903469035690366903769038690396904069041690426904369044690456904669047690486904969050690516905269053690546905569056690576905869059690606906169062690636906469065690666906769068690696907069071690726907369074690756907669077690786907969080690816908269083690846908569086690876908869089690906909169092690936909469095690966909769098690996910069101691026910369104691056910669107691086910969110691116911269113691146911569116691176911869119691206912169122691236912469125691266912769128691296913069131691326913369134691356913669137691386913969140691416914269143691446914569146691476914869149691506915169152691536915469155691566915769158691596916069161691626916369164691656916669167691686916969170691716917269173691746917569176691776917869179691806918169182691836918469185691866918769188691896919069191691926919369194691956919669197691986919969200692016920269203692046920569206692076920869209692106921169212692136921469215692166921769218692196922069221692226922369224692256922669227692286922969230692316923269233692346923569236692376923869239692406924169242692436924469245692466924769248692496925069251692526925369254692556925669257692586925969260692616926269263692646926569266692676926869269692706927169272692736927469275692766927769278692796928069281692826928369284692856928669287692886928969290692916929269293692946929569296692976929869299693006930169302693036930469305693066930769308693096931069311693126931369314693156931669317693186931969320693216932269323693246932569326693276932869329693306933169332693336933469335693366933769338693396934069341693426934369344693456934669347693486934969350693516935269353693546935569356693576935869359693606936169362693636936469365693666936769368693696937069371693726937369374693756937669377693786937969380693816938269383693846938569386693876938869389693906939169392693936939469395693966939769398693996940069401694026940369404694056940669407694086940969410694116941269413694146941569416694176941869419694206942169422694236942469425694266942769428694296943069431694326943369434694356943669437694386943969440694416944269443694446944569446694476944869449694506945169452694536945469455694566945769458694596946069461694626946369464694656946669467694686946969470694716947269473694746947569476694776947869479694806948169482694836948469485694866948769488694896949069491694926949369494694956949669497694986949969500695016950269503695046950569506695076950869509695106951169512695136951469515695166951769518695196952069521695226952369524695256952669527695286952969530695316953269533695346953569536695376953869539695406954169542695436954469545695466954769548695496955069551695526955369554695556955669557695586955969560695616956269563695646956569566695676956869569695706957169572695736957469575695766957769578695796958069581695826958369584695856958669587695886958969590695916959269593695946959569596695976959869599696006960169602696036960469605696066960769608696096961069611696126961369614696156961669617696186961969620696216962269623696246962569626696276962869629696306963169632696336963469635696366963769638696396964069641696426964369644696456964669647696486964969650696516965269653696546965569656696576965869659696606966169662696636966469665696666966769668696696967069671696726967369674696756967669677696786967969680696816968269683696846968569686696876968869689696906969169692696936969469695696966969769698696996970069701697026970369704697056970669707697086970969710697116971269713697146971569716697176971869719697206972169722697236972469725697266972769728697296973069731697326973369734697356973669737697386973969740697416974269743697446974569746697476974869749697506975169752697536975469755697566975769758697596976069761697626976369764697656976669767697686976969770697716977269773697746977569776697776977869779697806978169782697836978469785697866978769788697896979069791697926979369794697956979669797697986979969800698016980269803698046980569806698076980869809698106981169812698136981469815698166981769818698196982069821698226982369824698256982669827698286982969830698316983269833698346983569836698376983869839698406984169842698436984469845698466984769848698496985069851698526985369854698556985669857698586985969860698616986269863698646986569866698676986869869698706987169872698736987469875698766987769878698796988069881698826988369884698856988669887698886988969890698916989269893698946989569896698976989869899699006990169902699036990469905699066990769908699096991069911699126991369914699156991669917699186991969920699216992269923699246992569926699276992869929699306993169932699336993469935699366993769938699396994069941699426994369944699456994669947699486994969950699516995269953699546995569956699576995869959699606996169962699636996469965699666996769968699696997069971699726997369974699756997669977699786997969980699816998269983699846998569986699876998869989699906999169992699936999469995699966999769998699997000070001700027000370004700057000670007700087000970010700117001270013700147001570016700177001870019700207002170022700237002470025700267002770028700297003070031700327003370034700357003670037700387003970040700417004270043700447004570046700477004870049700507005170052700537005470055700567005770058700597006070061700627006370064700657006670067700687006970070700717007270073700747007570076700777007870079700807008170082700837008470085700867008770088700897009070091700927009370094700957009670097700987009970100701017010270103701047010570106701077010870109701107011170112701137011470115701167011770118701197012070121701227012370124701257012670127701287012970130701317013270133701347013570136701377013870139701407014170142701437014470145701467014770148701497015070151701527015370154701557015670157701587015970160701617016270163701647016570166701677016870169701707017170172701737017470175701767017770178701797018070181701827018370184701857018670187701887018970190701917019270193701947019570196701977019870199702007020170202702037020470205702067020770208702097021070211702127021370214702157021670217702187021970220702217022270223702247022570226702277022870229702307023170232702337023470235702367023770238702397024070241702427024370244702457024670247702487024970250702517025270253702547025570256702577025870259702607026170262702637026470265702667026770268702697027070271702727027370274702757027670277702787027970280702817028270283702847028570286702877028870289702907029170292702937029470295702967029770298702997030070301703027030370304703057030670307703087030970310703117031270313703147031570316703177031870319703207032170322703237032470325703267032770328703297033070331703327033370334703357033670337703387033970340703417034270343703447034570346703477034870349703507035170352703537035470355703567035770358703597036070361703627036370364703657036670367703687036970370703717037270373703747037570376703777037870379703807038170382703837038470385703867038770388703897039070391703927039370394703957039670397703987039970400704017040270403704047040570406704077040870409704107041170412704137041470415704167041770418704197042070421704227042370424704257042670427704287042970430704317043270433704347043570436704377043870439704407044170442704437044470445704467044770448704497045070451704527045370454704557045670457704587045970460704617046270463704647046570466704677046870469704707047170472704737047470475704767047770478704797048070481704827048370484704857048670487704887048970490704917049270493704947049570496704977049870499705007050170502705037050470505705067050770508705097051070511705127051370514705157051670517705187051970520705217052270523705247052570526705277052870529705307053170532705337053470535705367053770538705397054070541705427054370544705457054670547705487054970550705517055270553705547055570556705577055870559705607056170562705637056470565705667056770568705697057070571705727057370574705757057670577705787057970580705817058270583705847058570586705877058870589705907059170592705937059470595705967059770598705997060070601706027060370604706057060670607706087060970610706117061270613706147061570616706177061870619706207062170622706237062470625706267062770628706297063070631706327063370634706357063670637706387063970640706417064270643706447064570646706477064870649706507065170652706537065470655706567065770658706597066070661706627066370664706657066670667706687066970670706717067270673706747067570676706777067870679706807068170682706837068470685706867068770688706897069070691706927069370694706957069670697706987069970700707017070270703707047070570706707077070870709707107071170712707137071470715707167071770718707197072070721707227072370724707257072670727707287072970730707317073270733707347073570736707377073870739707407074170742707437074470745707467074770748707497075070751707527075370754707557075670757707587075970760707617076270763707647076570766707677076870769707707077170772707737077470775707767077770778707797078070781707827078370784707857078670787707887078970790707917079270793707947079570796707977079870799708007080170802708037080470805708067080770808708097081070811708127081370814708157081670817708187081970820708217082270823708247082570826708277082870829708307083170832708337083470835708367083770838708397084070841708427084370844708457084670847708487084970850708517085270853708547085570856708577085870859708607086170862708637086470865708667086770868708697087070871708727087370874708757087670877708787087970880708817088270883708847088570886708877088870889708907089170892708937089470895708967089770898708997090070901709027090370904709057090670907709087090970910709117091270913709147091570916709177091870919709207092170922709237092470925709267092770928709297093070931709327093370934709357093670937709387093970940709417094270943709447094570946709477094870949709507095170952709537095470955709567095770958709597096070961709627096370964709657096670967709687096970970709717097270973709747097570976709777097870979709807098170982709837098470985709867098770988709897099070991709927099370994709957099670997709987099971000710017100271003710047100571006710077100871009710107101171012710137101471015710167101771018710197102071021710227102371024710257102671027710287102971030710317103271033710347103571036710377103871039710407104171042710437104471045710467104771048710497105071051710527105371054710557105671057710587105971060710617106271063710647106571066710677106871069710707107171072710737107471075710767107771078710797108071081710827108371084710857108671087710887108971090710917109271093710947109571096710977109871099711007110171102711037110471105711067110771108711097111071111711127111371114711157111671117711187111971120711217112271123711247112571126711277112871129711307113171132711337113471135711367113771138711397114071141711427114371144711457114671147711487114971150711517115271153711547115571156711577115871159711607116171162711637116471165711667116771168711697117071171711727117371174711757117671177711787117971180711817118271183711847118571186711877118871189711907119171192711937119471195711967119771198711997120071201712027120371204712057120671207712087120971210712117121271213712147121571216712177121871219712207122171222712237122471225712267122771228712297123071231712327123371234712357123671237712387123971240712417124271243712447124571246712477124871249712507125171252712537125471255712567125771258712597126071261712627126371264712657126671267712687126971270712717127271273712747127571276712777127871279712807128171282712837128471285712867128771288712897129071291712927129371294712957129671297712987129971300713017130271303713047130571306713077130871309713107131171312713137131471315713167131771318713197132071321713227132371324713257132671327713287132971330713317133271333713347133571336713377133871339713407134171342713437134471345713467134771348713497135071351713527135371354713557135671357713587135971360713617136271363713647136571366713677136871369713707137171372713737137471375713767137771378713797138071381713827138371384713857138671387713887138971390713917139271393713947139571396713977139871399714007140171402714037140471405714067140771408714097141071411714127141371414714157141671417714187141971420714217142271423714247142571426714277142871429714307143171432714337143471435714367143771438714397144071441714427144371444714457144671447714487144971450714517145271453714547145571456714577145871459714607146171462714637146471465714667146771468714697147071471714727147371474714757147671477714787147971480714817148271483714847148571486714877148871489714907149171492714937149471495714967149771498714997150071501715027150371504715057150671507715087150971510715117151271513715147151571516715177151871519715207152171522715237152471525715267152771528715297153071531715327153371534715357153671537715387153971540715417154271543715447154571546715477154871549715507155171552715537155471555715567155771558715597156071561715627156371564715657156671567715687156971570715717157271573715747157571576715777157871579715807158171582715837158471585715867158771588715897159071591715927159371594715957159671597715987159971600716017160271603716047160571606716077160871609716107161171612716137161471615716167161771618716197162071621716227162371624716257162671627716287162971630716317163271633716347163571636716377163871639716407164171642716437164471645716467164771648716497165071651716527165371654716557165671657716587165971660716617166271663716647166571666716677166871669716707167171672716737167471675716767167771678716797168071681716827168371684716857168671687716887168971690716917169271693716947169571696716977169871699717007170171702717037170471705717067170771708717097171071711717127171371714717157171671717717187171971720717217172271723717247172571726717277172871729717307173171732717337173471735717367173771738717397174071741717427174371744717457174671747717487174971750717517175271753717547175571756717577175871759717607176171762717637176471765717667176771768717697177071771717727177371774717757177671777717787177971780717817178271783717847178571786717877178871789717907179171792717937179471795717967179771798717997180071801718027180371804718057180671807718087180971810718117181271813718147181571816718177181871819718207182171822718237182471825718267182771828718297183071831718327183371834718357183671837718387183971840718417184271843718447184571846718477184871849718507185171852718537185471855718567185771858718597186071861718627186371864718657186671867718687186971870718717187271873718747187571876718777187871879718807188171882718837188471885718867188771888718897189071891718927189371894718957189671897718987189971900719017190271903719047190571906719077190871909719107191171912719137191471915719167191771918719197192071921719227192371924719257192671927719287192971930719317193271933719347193571936719377193871939719407194171942719437194471945719467194771948719497195071951719527195371954719557195671957719587195971960719617196271963719647196571966719677196871969719707197171972719737197471975719767197771978719797198071981719827198371984719857198671987719887198971990719917199271993719947199571996719977199871999720007200172002720037200472005720067200772008720097201072011720127201372014720157201672017720187201972020720217202272023720247202572026720277202872029720307203172032720337203472035720367203772038720397204072041720427204372044720457204672047720487204972050720517205272053720547205572056720577205872059720607206172062720637206472065720667206772068720697207072071720727207372074720757207672077720787207972080720817208272083720847208572086720877208872089720907209172092720937209472095720967209772098720997210072101721027210372104721057210672107721087210972110721117211272113721147211572116721177211872119721207212172122721237212472125721267212772128721297213072131721327213372134721357213672137721387213972140721417214272143721447214572146721477214872149721507215172152721537215472155721567215772158721597216072161721627216372164721657216672167721687216972170721717217272173721747217572176721777217872179721807218172182721837218472185721867218772188721897219072191721927219372194721957219672197721987219972200722017220272203722047220572206722077220872209722107221172212722137221472215722167221772218722197222072221722227222372224722257222672227722287222972230722317223272233722347223572236722377223872239722407224172242722437224472245722467224772248722497225072251722527225372254722557225672257722587225972260722617226272263722647226572266722677226872269722707227172272722737227472275722767227772278722797228072281722827228372284722857228672287722887228972290722917229272293722947229572296722977229872299723007230172302723037230472305723067230772308723097231072311723127231372314723157231672317723187231972320723217232272323723247232572326723277232872329723307233172332723337233472335723367233772338723397234072341723427234372344723457234672347723487234972350723517235272353723547235572356723577235872359723607236172362723637236472365723667236772368723697237072371723727237372374723757237672377723787237972380723817238272383723847238572386723877238872389723907239172392723937239472395723967239772398723997240072401724027240372404724057240672407724087240972410724117241272413724147241572416724177241872419724207242172422724237242472425724267242772428724297243072431724327243372434724357243672437724387243972440724417244272443724447244572446724477244872449724507245172452724537245472455724567245772458724597246072461724627246372464724657246672467724687246972470724717247272473724747247572476724777247872479724807248172482724837248472485724867248772488724897249072491724927249372494724957249672497724987249972500725017250272503725047250572506725077250872509725107251172512725137251472515725167251772518725197252072521725227252372524725257252672527725287252972530725317253272533725347253572536725377253872539725407254172542725437254472545725467254772548725497255072551725527255372554725557255672557725587255972560725617256272563725647256572566725677256872569725707257172572725737257472575725767257772578725797258072581725827258372584725857258672587725887258972590725917259272593725947259572596725977259872599726007260172602726037260472605726067260772608726097261072611726127261372614726157261672617726187261972620726217262272623726247262572626726277262872629726307263172632726337263472635726367263772638726397264072641726427264372644726457264672647726487264972650726517265272653726547265572656726577265872659726607266172662726637266472665726667266772668726697267072671726727267372674726757267672677726787267972680726817268272683726847268572686726877268872689726907269172692726937269472695726967269772698726997270072701727027270372704727057270672707727087270972710727117271272713727147271572716727177271872719727207272172722727237272472725727267272772728727297273072731727327273372734727357273672737727387273972740727417274272743727447274572746727477274872749727507275172752727537275472755727567275772758727597276072761727627276372764727657276672767727687276972770727717277272773727747277572776727777277872779727807278172782727837278472785727867278772788727897279072791727927279372794727957279672797727987279972800728017280272803728047280572806728077280872809728107281172812728137281472815728167281772818728197282072821728227282372824728257282672827728287282972830728317283272833728347283572836728377283872839728407284172842728437284472845728467284772848728497285072851728527285372854728557285672857728587285972860728617286272863728647286572866728677286872869728707287172872728737287472875728767287772878728797288072881728827288372884728857288672887728887288972890728917289272893728947289572896728977289872899729007290172902729037290472905729067290772908729097291072911729127291372914729157291672917729187291972920729217292272923729247292572926729277292872929729307293172932729337293472935729367293772938729397294072941729427294372944729457294672947729487294972950729517295272953729547295572956729577295872959729607296172962729637296472965729667296772968729697297072971729727297372974729757297672977729787297972980729817298272983729847298572986729877298872989729907299172992729937299472995729967299772998729997300073001730027300373004730057300673007730087300973010730117301273013730147301573016730177301873019730207302173022730237302473025730267302773028730297303073031730327303373034730357303673037730387303973040730417304273043730447304573046730477304873049730507305173052730537305473055730567305773058730597306073061730627306373064730657306673067730687306973070730717307273073730747307573076730777307873079730807308173082730837308473085730867308773088730897309073091730927309373094730957309673097730987309973100731017310273103731047310573106731077310873109731107311173112731137311473115731167311773118731197312073121731227312373124731257312673127731287312973130731317313273133731347313573136731377313873139731407314173142731437314473145731467314773148731497315073151731527315373154731557315673157731587315973160731617316273163731647316573166731677316873169731707317173172731737317473175731767317773178731797318073181731827318373184731857318673187731887318973190731917319273193731947319573196731977319873199732007320173202732037320473205732067320773208732097321073211732127321373214732157321673217732187321973220732217322273223732247322573226732277322873229732307323173232732337323473235732367323773238732397324073241732427324373244732457324673247732487324973250732517325273253732547325573256732577325873259732607326173262732637326473265732667326773268732697327073271732727327373274732757327673277732787327973280732817328273283732847328573286732877328873289732907329173292732937329473295732967329773298732997330073301733027330373304733057330673307733087330973310733117331273313733147331573316733177331873319733207332173322733237332473325733267332773328733297333073331733327333373334733357333673337733387333973340733417334273343733447334573346733477334873349733507335173352733537335473355733567335773358733597336073361733627336373364733657336673367733687336973370733717337273373733747337573376733777337873379733807338173382733837338473385733867338773388733897339073391733927339373394733957339673397733987339973400734017340273403734047340573406734077340873409734107341173412734137341473415734167341773418734197342073421734227342373424734257342673427734287342973430734317343273433734347343573436734377343873439734407344173442734437344473445734467344773448734497345073451734527345373454734557345673457734587345973460734617346273463734647346573466734677346873469734707347173472734737347473475734767347773478734797348073481734827348373484734857348673487734887348973490734917349273493734947349573496734977349873499735007350173502735037350473505735067350773508735097351073511735127351373514735157351673517735187351973520735217352273523735247352573526735277352873529735307353173532735337353473535735367353773538735397354073541735427354373544735457354673547735487354973550735517355273553735547355573556735577355873559735607356173562735637356473565735667356773568735697357073571735727357373574735757357673577735787357973580735817358273583735847358573586735877358873589735907359173592735937359473595735967359773598735997360073601736027360373604736057360673607736087360973610736117361273613736147361573616736177361873619736207362173622736237362473625736267362773628736297363073631736327363373634736357363673637736387363973640736417364273643736447364573646736477364873649736507365173652736537365473655736567365773658736597366073661736627366373664736657366673667736687366973670736717367273673736747367573676736777367873679736807368173682736837368473685736867368773688736897369073691736927369373694736957369673697736987369973700737017370273703737047370573706737077370873709737107371173712737137371473715737167371773718737197372073721737227372373724737257372673727737287372973730737317373273733737347373573736737377373873739737407374173742737437374473745737467374773748737497375073751737527375373754737557375673757737587375973760737617376273763737647376573766737677376873769737707377173772737737377473775737767377773778737797378073781737827378373784737857378673787737887378973790737917379273793737947379573796737977379873799738007380173802738037380473805738067380773808738097381073811738127381373814738157381673817738187381973820738217382273823738247382573826738277382873829738307383173832738337383473835738367383773838738397384073841738427384373844738457384673847738487384973850738517385273853738547385573856738577385873859738607386173862738637386473865738667386773868738697387073871738727387373874738757387673877738787387973880738817388273883738847388573886738877388873889738907389173892738937389473895738967389773898738997390073901739027390373904739057390673907739087390973910739117391273913739147391573916739177391873919739207392173922739237392473925739267392773928739297393073931739327393373934739357393673937739387393973940739417394273943739447394573946739477394873949739507395173952739537395473955739567395773958739597396073961739627396373964739657396673967739687396973970739717397273973739747397573976739777397873979739807398173982739837398473985739867398773988739897399073991739927399373994739957399673997739987399974000740017400274003740047400574006740077400874009740107401174012740137401474015740167401774018740197402074021740227402374024740257402674027740287402974030740317403274033740347403574036740377403874039740407404174042740437404474045740467404774048740497405074051740527405374054740557405674057740587405974060740617406274063740647406574066740677406874069740707407174072740737407474075740767407774078740797408074081740827408374084740857408674087740887408974090740917409274093740947409574096740977409874099741007410174102741037410474105741067410774108741097411074111741127411374114741157411674117741187411974120741217412274123741247412574126741277412874129741307413174132741337413474135741367413774138741397414074141741427414374144741457414674147741487414974150741517415274153741547415574156741577415874159741607416174162741637416474165741667416774168741697417074171741727417374174741757417674177741787417974180741817418274183741847418574186741877418874189741907419174192741937419474195741967419774198741997420074201742027420374204742057420674207742087420974210742117421274213742147421574216742177421874219742207422174222742237422474225742267422774228742297423074231742327423374234742357423674237742387423974240742417424274243742447424574246742477424874249742507425174252742537425474255742567425774258742597426074261742627426374264742657426674267742687426974270742717427274273742747427574276742777427874279742807428174282742837428474285742867428774288742897429074291742927429374294742957429674297742987429974300743017430274303743047430574306743077430874309743107431174312743137431474315743167431774318743197432074321743227432374324743257432674327743287432974330743317433274333743347433574336743377433874339743407434174342743437434474345743467434774348743497435074351743527435374354743557435674357743587435974360743617436274363743647436574366743677436874369743707437174372743737437474375743767437774378743797438074381743827438374384743857438674387743887438974390743917439274393743947439574396743977439874399744007440174402744037440474405744067440774408744097441074411744127441374414744157441674417744187441974420744217442274423744247442574426744277442874429744307443174432744337443474435744367443774438744397444074441744427444374444744457444674447744487444974450744517445274453744547445574456744577445874459744607446174462744637446474465744667446774468744697447074471744727447374474744757447674477744787447974480744817448274483744847448574486744877448874489744907449174492744937449474495744967449774498744997450074501745027450374504745057450674507745087450974510745117451274513745147451574516745177451874519745207452174522745237452474525745267452774528745297453074531745327453374534745357453674537745387453974540745417454274543745447454574546745477454874549745507455174552745537455474555745567455774558745597456074561745627456374564745657456674567745687456974570745717457274573745747457574576745777457874579745807458174582745837458474585745867458774588745897459074591745927459374594745957459674597745987459974600746017460274603746047460574606746077460874609746107461174612746137461474615746167461774618746197462074621746227462374624746257462674627746287462974630746317463274633746347463574636746377463874639746407464174642746437464474645746467464774648746497465074651746527465374654746557465674657746587465974660746617466274663746647466574666746677466874669746707467174672746737467474675746767467774678746797468074681746827468374684746857468674687746887468974690746917469274693746947469574696746977469874699747007470174702747037470474705747067470774708747097471074711747127471374714747157471674717747187471974720747217472274723747247472574726747277472874729747307473174732747337473474735747367473774738747397474074741747427474374744747457474674747747487474974750747517475274753747547475574756747577475874759747607476174762747637476474765747667476774768747697477074771747727477374774747757477674777747787477974780747817478274783747847478574786747877478874789747907479174792747937479474795747967479774798747997480074801748027480374804748057480674807748087480974810748117481274813748147481574816748177481874819748207482174822748237482474825748267482774828748297483074831748327483374834748357483674837748387483974840748417484274843748447484574846748477484874849748507485174852748537485474855748567485774858748597486074861748627486374864748657486674867748687486974870748717487274873748747487574876748777487874879748807488174882748837488474885748867488774888748897489074891748927489374894748957489674897748987489974900749017490274903749047490574906749077490874909749107491174912749137491474915749167491774918749197492074921749227492374924749257492674927749287492974930749317493274933749347493574936749377493874939749407494174942749437494474945749467494774948749497495074951749527495374954749557495674957749587495974960749617496274963749647496574966749677496874969749707497174972749737497474975749767497774978749797498074981749827498374984749857498674987749887498974990749917499274993749947499574996749977499874999750007500175002750037500475005750067500775008750097501075011750127501375014750157501675017750187501975020750217502275023750247502575026750277502875029750307503175032750337503475035750367503775038750397504075041750427504375044750457504675047750487504975050750517505275053750547505575056750577505875059750607506175062750637506475065750667506775068750697507075071750727507375074750757507675077750787507975080750817508275083750847508575086750877508875089750907509175092750937509475095750967509775098750997510075101751027510375104751057510675107751087510975110751117511275113751147511575116751177511875119751207512175122751237512475125751267512775128751297513075131751327513375134751357513675137751387513975140751417514275143751447514575146751477514875149751507515175152751537515475155751567515775158751597516075161751627516375164751657516675167751687516975170751717517275173751747517575176751777517875179
  1. /*! jQuery v3.5.1 | (c) JS Foundation and other contributors | jquery.org/license */
  2. !function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.5.1",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0<t&&t-1 in e)}S.fn=S.prototype={jquery:f,constructor:S,length:0,toArray:function(){return s.call(this)},get:function(e){return null==e?s.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=S.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return S.each(this,e)},map:function(n){return this.pushStack(S.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(S.grep(this,function(e,t){return(t+1)%2}))},odd:function(){return this.pushStack(S.grep(this,function(e,t){return t%2}))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(0<=n&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:u,sort:t.sort,splice:t.splice},S.extend=S.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||m(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)r=e[t],"__proto__"!==t&&a!==r&&(l&&r&&(S.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||S.isPlainObject(n)?n:{},i=!1,a[t]=S.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},S.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==o.call(e))&&(!(t=r(e))||"function"==typeof(n=v.call(t,"constructor")&&t.constructor)&&a.call(n)===l)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t,n){b(e,{nonce:t&&t.nonce},n)},each:function(e,t){var n,r=0;if(p(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},makeArray:function(e,t){var n=t||[];return null!=e&&(p(Object(e))?S.merge(n,"string"==typeof e?[e]:e):u.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:i.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,a=!n;i<o;i++)!t(e[i],i)!==a&&r.push(e[i]);return r},map:function(e,t,n){var r,i,o=0,a=[];if(p(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&a.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&a.push(i);return g(a)},guid:1,support:y}),"function"==typeof Symbol&&(S.fn[Symbol.iterator]=t[Symbol.iterator]),S.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){n["[object "+t+"]"]=t.toLowerCase()});var d=function(n){var e,d,b,o,i,h,f,g,w,u,l,T,C,a,E,v,s,c,y,S="sizzle"+1*new Date,p=n.document,k=0,r=0,m=ue(),x=ue(),A=ue(),N=ue(),D=function(e,t){return e===t&&(l=!0),0},j={}.hasOwnProperty,t=[],q=t.pop,L=t.push,H=t.push,O=t.slice,P=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},R="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",I="(?:\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",W="\\["+M+"*("+I+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+I+"))|)"+M+"*\\]",F=":("+I+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+W+")*)|.*)\\)|)",B=new RegExp(M+"+","g"),$=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),_=new RegExp("^"+M+"*,"+M+"*"),z=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="<a id='"+S+"'></a><select id='"+S+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0<se(t,C,null,[e]).length},se.contains=function(e,t){return(e.ownerDocument||e)!=C&&T(e),y(e,t)},se.attr=function(e,t){(e.ownerDocument||e)!=C&&T(e);var n=b.attrHandle[t.toLowerCase()],r=n&&j.call(b.attrHandle,t.toLowerCase())?n(e,t,!E):void 0;return void 0!==r?r:d.attributes||!E?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},se.escape=function(e){return(e+"").replace(re,ie)},se.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},se.uniqueSort=function(e){var t,n=[],r=0,i=0;if(l=!d.detectDuplicates,u=!d.sortStable&&e.slice(0),e.sort(D),l){while(t=e[i++])t===e[i]&&(r=n.push(i));while(r--)e.splice(n[r],1)}return u=null,e},o=se.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else while(t=e[r++])n+=o(t);return n},(b=se.selectors={cacheLength:50,createPseudo:le,match:G,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1<t.indexOf(i):"$="===r?i&&t.slice(-i.length)===i:"~="===r?-1<(" "+t.replace(B," ")+" ").indexOf(i):"|="===r&&(t===i||t.slice(0,i.length+1)===i+"-"))}},CHILD:function(h,e,t,g,v){var y="nth"!==h.slice(0,3),m="last"!==h.slice(-4),x="of-type"===e;return 1===g&&0===v?function(e){return!!e.parentNode}:function(e,t,n){var r,i,o,a,s,u,l=y!==m?"nextSibling":"previousSibling",c=e.parentNode,f=x&&e.nodeName.toLowerCase(),p=!n&&!x,d=!1;if(c){if(y){while(l){a=e;while(a=a[l])if(x?a.nodeName.toLowerCase()===f:1===a.nodeType)return!1;u=l="only"===h&&!u&&"nextSibling"}return!0}if(u=[m?c.firstChild:c.lastChild],m&&p){d=(s=(r=(i=(o=(a=c)[S]||(a[S]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]||[])[0]===k&&r[1])&&r[2],a=s&&c.childNodes[s];while(a=++s&&a&&a[l]||(d=s=0)||u.pop())if(1===a.nodeType&&++d&&a===e){i[h]=[k,s,d];break}}else if(p&&(d=s=(r=(i=(o=(a=e)[S]||(a[S]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]||[])[0]===k&&r[1]),!1===d)while(a=++s&&a&&a[l]||(d=s=0)||u.pop())if((x?a.nodeName.toLowerCase()===f:1===a.nodeType)&&++d&&(p&&((i=(o=a[S]||(a[S]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]=[k,d]),a===e))break;return(d-=v)===g||d%g==0&&0<=d/g}}},PSEUDO:function(e,o){var t,a=b.pseudos[e]||b.setFilters[e.toLowerCase()]||se.error("unsupported pseudo: "+e);return a[S]?a(o):1<a.length?(t=[e,e,"",o],b.setFilters.hasOwnProperty(e.toLowerCase())?le(function(e,t){var n,r=a(e,o),i=r.length;while(i--)e[n=P(e,r[i])]=!(t[n]=r[i])}):function(e){return a(e,0,t)}):a}},pseudos:{not:le(function(e){var r=[],i=[],s=f(e.replace($,"$1"));return s[S]?le(function(e,t,n,r){var i,o=s(e,null,r,[]),a=e.length;while(a--)(i=o[a])&&(e[a]=!(t[a]=i))}):function(e,t,n){return r[0]=e,s(r,null,n,i),r[0]=null,!i.pop()}}),has:le(function(t){return function(e){return 0<se(t,e).length}}),contains:le(function(t){return t=t.replace(te,ne),function(e){return-1<(e.textContent||o(e)).indexOf(t)}}),lang:le(function(n){return V.test(n||"")||se.error("unsupported lang: "+n),n=n.replace(te,ne).toLowerCase(),function(e){var t;do{if(t=E?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(t=t.toLowerCase())===n||0===t.indexOf(n+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var t=n.location&&n.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===a},focus:function(e){return e===C.activeElement&&(!C.hasFocus||C.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:ge(!1),disabled:ge(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!b.pseudos.empty(e)},header:function(e){return J.test(e.nodeName)},input:function(e){return Q.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:ve(function(){return[0]}),last:ve(function(e,t){return[t-1]}),eq:ve(function(e,t,n){return[n<0?n+t:n]}),even:ve(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:ve(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:ve(function(e,t,n){for(var r=n<0?n+t:t<n?t:n;0<=--r;)e.push(r);return e}),gt:ve(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=b.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})b.pseudos[e]=de(e);for(e in{submit:!0,reset:!0})b.pseudos[e]=he(e);function me(){}function xe(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function be(s,e,t){var u=e.dir,l=e.next,c=l||u,f=t&&"parentNode"===c,p=r++;return e.first?function(e,t,n){while(e=e[u])if(1===e.nodeType||f)return s(e,t,n);return!1}:function(e,t,n){var r,i,o,a=[k,p];if(n){while(e=e[u])if((1===e.nodeType||f)&&s(e,t,n))return!0}else while(e=e[u])if(1===e.nodeType||f)if(i=(o=e[S]||(e[S]={}))[e.uniqueID]||(o[e.uniqueID]={}),l&&l===e.nodeName.toLowerCase())e=e[u]||e;else{if((r=i[c])&&r[0]===k&&r[1]===p)return a[2]=r[2];if((i[c]=a)[2]=s(e,t,n))return!0}return!1}}function we(i){return 1<i.length?function(e,t,n){var r=i.length;while(r--)if(!i[r](e,t,n))return!1;return!0}:i[0]}function Te(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function Ce(d,h,g,v,y,e){return v&&!v[S]&&(v=Ce(v)),y&&!y[S]&&(y=Ce(y,e)),le(function(e,t,n,r){var i,o,a,s=[],u=[],l=t.length,c=e||function(e,t,n){for(var r=0,i=t.length;r<i;r++)se(e,t[r],n);return n}(h||"*",n.nodeType?[n]:n,[]),f=!d||!e&&h?c:Te(c,s,d,n,r),p=g?y||(e?d:l||v)?[]:t:f;if(g&&g(f,p,n,r),v){i=Te(p,u),v(i,[],n,r),o=i.length;while(o--)(a=i[o])&&(p[u[o]]=!(f[u[o]]=a))}if(e){if(y||d){if(y){i=[],o=p.length;while(o--)(a=p[o])&&i.push(f[o]=a);y(null,p=[],i,r)}o=p.length;while(o--)(a=p[o])&&-1<(i=y?P(e,a):s[o])&&(e[i]=!(t[i]=a))}}else p=Te(p===t?p.splice(l,p.length):p),y?y(null,t,p,r):H.apply(t,p)})}function Ee(e){for(var i,t,n,r=e.length,o=b.relative[e[0].type],a=o||b.relative[" "],s=o?1:0,u=be(function(e){return e===i},a,!0),l=be(function(e){return-1<P(i,e)},a,!0),c=[function(e,t,n){var r=!o&&(n||t!==w)||((i=t).nodeType?u(e,t,n):l(e,t,n));return i=null,r}];s<r;s++)if(t=b.relative[e[s].type])c=[be(we(c),t)];else{if((t=b.filter[e[s].type].apply(null,e[s].matches))[S]){for(n=++s;n<r;n++)if(b.relative[e[n].type])break;return Ce(1<s&&we(c),1<s&&xe(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace($,"$1"),t,s<n&&Ee(e.slice(s,n)),n<r&&Ee(e=e.slice(n)),n<r&&xe(e))}c.push(t)}return we(c)}return me.prototype=b.filters=b.pseudos,b.setFilters=new me,h=se.tokenize=function(e,t){var n,r,i,o,a,s,u,l=x[e+" "];if(l)return t?0:l.slice(0);a=e,s=[],u=b.preFilter;while(a){for(o in n&&!(r=_.exec(a))||(r&&(a=a.slice(r[0].length)||a),s.push(i=[])),n=!1,(r=z.exec(a))&&(n=r.shift(),i.push({value:n,type:r[0].replace($," ")}),a=a.slice(n.length)),b.filter)!(r=G[o].exec(a))||u[o]&&!(r=u[o](r))||(n=r.shift(),i.push({value:n,type:o,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?se.error(e):x(e,s).slice(0)},f=se.compile=function(e,t){var n,v,y,m,x,r,i=[],o=[],a=A[e+" "];if(!a){t||(t=h(e)),n=t.length;while(n--)(a=Ee(t[n]))[S]?i.push(a):o.push(a);(a=A(e,(v=o,m=0<(y=i).length,x=0<v.length,r=function(e,t,n,r,i){var o,a,s,u=0,l="0",c=e&&[],f=[],p=w,d=e||x&&b.find.TAG("*",i),h=k+=null==p?1:Math.random()||.1,g=d.length;for(i&&(w=t==C||t||i);l!==g&&null!=(o=d[l]);l++){if(x&&o){a=0,t||o.ownerDocument==C||(T(o),n=!E);while(s=v[a++])if(s(o,t||C,n)){r.push(o);break}i&&(k=h)}m&&((o=!s&&o)&&u--,e&&c.push(o))}if(u+=l,m&&l!==u){a=0;while(s=y[a++])s(c,f,t,n);if(e){if(0<u)while(l--)c[l]||f[l]||(f[l]=q.call(r));f=Te(f)}H.apply(r,f),i&&!e&&0<f.length&&1<u+y.length&&se.uniqueSort(r)}return i&&(k=h,w=p),c},m?le(r):r))).selector=e}return a},g=se.select=function(e,t,n,r){var i,o,a,s,u,l="function"==typeof e&&e,c=!r&&h(e=l.selector||e);if(n=n||[],1===c.length){if(2<(o=c[0]=c[0].slice(0)).length&&"ID"===(a=o[0]).type&&9===t.nodeType&&E&&b.relative[o[1].type]){if(!(t=(b.find.ID(a.matches[0].replace(te,ne),t)||[])[0]))return n;l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}i=G.needsContext.test(e)?0:o.length;while(i--){if(a=o[i],b.relative[s=a.type])break;if((u=b.find[s])&&(r=u(a.matches[0].replace(te,ne),ee.test(o[0].type)&&ye(t.parentNode)||t))){if(o.splice(i,1),!(e=r.length&&xe(o)))return H.apply(n,r),n;break}}}return(l||f(e,c))(r,t,!E,n,!t||ee.test(e)&&ye(t.parentNode)||t),n},d.sortStable=S.split("").sort(D).join("")===S,d.detectDuplicates=!!l,T(),d.sortDetached=ce(function(e){return 1&e.compareDocumentPosition(C.createElement("fieldset"))}),ce(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||fe("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),d.attributes&&ce(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||fe("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ce(function(e){return null==e.getAttribute("disabled")})||fe(R,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),se}(C);S.find=d,S.expr=d.selectors,S.expr[":"]=S.expr.pseudos,S.uniqueSort=S.unique=d.uniqueSort,S.text=d.getText,S.isXMLDoc=d.isXML,S.contains=d.contains,S.escapeSelector=d.escape;var h=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&S(e).is(n))break;r.push(e)}return r},T=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},k=S.expr.match.needsContext;function A(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var N=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function D(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1<i.call(n,e)!==r}):S.filter(n,e,r)}S.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?S.find.matchesSelector(r,e)?[r]:[]:S.find.matches(e,S.grep(t,function(e){return 1===e.nodeType}))},S.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(S(e).filter(function(){for(t=0;t<r;t++)if(S.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)S.find(e,i[t],n);return 1<r?S.uniqueSort(n):n},filter:function(e){return this.pushStack(D(this,e||[],!1))},not:function(e){return this.pushStack(D(this,e||[],!0))},is:function(e){return!!D(this,"string"==typeof e&&k.test(e)?S(e):e||[],!1).length}});var j,q=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||j,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,j=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(S.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&S(e);if(!k.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?-1<a.index(n):1===n.nodeType&&S.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(1<o.length?S.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?i.call(S(e),this[0]):i.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(S.uniqueSort(S.merge(this.get(),S(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),S.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return h(e,"parentNode")},parentsUntil:function(e,t,n){return h(e,"parentNode",n)},next:function(e){return O(e,"nextSibling")},prev:function(e){return O(e,"previousSibling")},nextAll:function(e){return h(e,"nextSibling")},prevAll:function(e){return h(e,"previousSibling")},nextUntil:function(e,t,n){return h(e,"nextSibling",n)},prevUntil:function(e,t,n){return h(e,"previousSibling",n)},siblings:function(e){return T((e.parentNode||{}).firstChild,e)},children:function(e){return T(e.firstChild)},contents:function(e){return null!=e.contentDocument&&r(e.contentDocument)?e.contentDocument:(A(e,"template")&&(e=e.content||e),S.merge([],e.childNodes))}},function(r,i){S.fn[r]=function(e,t){var n=S.map(this,i,e);return"Until"!==r.slice(-5)&&(t=e),t&&"string"==typeof t&&(n=S.filter(t,n)),1<this.length&&(H[r]||S.uniqueSort(n),L.test(r)&&n.reverse()),this.pushStack(n)}});var P=/[^\x20\t\r\n\f]+/g;function R(e){return e}function M(e){throw e}function I(e,t,n,r){var i;try{e&&m(i=e.promise)?i.call(e).done(t).fail(n):e&&m(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}S.Callbacks=function(r){var e,n;r="string"==typeof r?(e=r,n={},S.each(e.match(P)||[],function(e,t){n[t]=!0}),n):S.extend({},r);var i,t,o,a,s=[],u=[],l=-1,c=function(){for(a=a||r.once,o=i=!0;u.length;l=-1){t=u.shift();while(++l<s.length)!1===s[l].apply(t[0],t[1])&&r.stopOnFalse&&(l=s.length,t=!1)}r.memory||(t=!1),i=!1,a&&(s=t?[]:"")},f={add:function(){return s&&(t&&!i&&(l=s.length-1,u.push(t)),function n(e){S.each(e,function(e,t){m(t)?r.unique&&f.has(t)||s.push(t):t&&t.length&&"string"!==w(t)&&n(t)})}(arguments),t&&!i&&c()),this},remove:function(){return S.each(arguments,function(e,t){var n;while(-1<(n=S.inArray(t,s,n)))s.splice(n,1),n<=l&&l--}),this},has:function(e){return e?-1<S.inArray(e,s):0<s.length},empty:function(){return s&&(s=[]),this},disable:function(){return a=u=[],s=t="",this},disabled:function(){return!s},lock:function(){return a=u=[],t||i||(s=t=""),this},locked:function(){return!!a},fireWith:function(e,t){return a||(t=[e,(t=t||[]).slice?t.slice():t],u.push(t),i||c()),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!o}};return f},S.extend({Deferred:function(e){var o=[["notify","progress",S.Callbacks("memory"),S.Callbacks("memory"),2],["resolve","done",S.Callbacks("once memory"),S.Callbacks("once memory"),0,"resolved"],["reject","fail",S.Callbacks("once memory"),S.Callbacks("once memory"),1,"rejected"]],i="pending",a={state:function(){return i},always:function(){return s.done(arguments).fail(arguments),this},"catch":function(e){return a.then(null,e)},pipe:function(){var i=arguments;return S.Deferred(function(r){S.each(o,function(e,t){var n=m(i[t[4]])&&i[t[4]];s[t[1]](function(){var e=n&&n.apply(this,arguments);e&&m(e.promise)?e.promise().progress(r.notify).done(r.resolve).fail(r.reject):r[t[0]+"With"](this,n?[e]:arguments)})}),i=null}).promise()},then:function(t,n,r){var u=0;function l(i,o,a,s){return function(){var n=this,r=arguments,e=function(){var e,t;if(!(i<u)){if((e=a.apply(n,r))===o.promise())throw new TypeError("Thenable self-resolution");t=e&&("object"==typeof e||"function"==typeof e)&&e.then,m(t)?s?t.call(e,l(u,o,R,s),l(u,o,M,s)):(u++,t.call(e,l(u,o,R,s),l(u,o,M,s),l(u,o,R,o.notifyWith))):(a!==R&&(n=void 0,r=[e]),(s||o.resolveWith)(n,r))}},t=s?e:function(){try{e()}catch(e){S.Deferred.exceptionHook&&S.Deferred.exceptionHook(e,t.stackTrace),u<=i+1&&(a!==M&&(n=void 0,r=[e]),o.rejectWith(n,r))}};i?t():(S.Deferred.getStackHook&&(t.stackTrace=S.Deferred.getStackHook()),C.setTimeout(t))}}return S.Deferred(function(e){o[0][3].add(l(0,e,m(r)?r:R,e.notifyWith)),o[1][3].add(l(0,e,m(t)?t:R)),o[2][3].add(l(0,e,m(n)?n:M))}).promise()},promise:function(e){return null!=e?S.extend(e,a):a}},s={};return S.each(o,function(e,t){var n=t[2],r=t[5];a[t[1]]=n.add,r&&n.add(function(){i=r},o[3-e][2].disable,o[3-e][3].disable,o[0][2].lock,o[0][3].lock),n.add(t[3].fire),s[t[0]]=function(){return s[t[0]+"With"](this===s?void 0:this,arguments),this},s[t[0]+"With"]=n.fireWith}),a.promise(s),e&&e.call(s,s),s},when:function(e){var n=arguments.length,t=n,r=Array(t),i=s.call(arguments),o=S.Deferred(),a=function(t){return function(e){r[t]=this,i[t]=1<arguments.length?s.call(arguments):e,--n||o.resolveWith(r,i)}};if(n<=1&&(I(e,o.done(a(t)).resolve,o.reject,!n),"pending"===o.state()||m(i[t]&&i[t].then)))return o.then();while(t--)I(i[t],a(t),o.reject);return o.promise()}});var W=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;S.Deferred.exceptionHook=function(e,t){C.console&&C.console.warn&&e&&W.test(e.name)&&C.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},S.readyException=function(e){C.setTimeout(function(){throw e})};var F=S.Deferred();function B(){E.removeEventListener("DOMContentLoaded",B),C.removeEventListener("load",B),S.ready()}S.fn.ready=function(e){return F.then(e)["catch"](function(e){S.readyException(e)}),this},S.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--S.readyWait:S.isReady)||(S.isReady=!0)!==e&&0<--S.readyWait||F.resolveWith(E,[S])}}),S.ready.then=F.then,"complete"===E.readyState||"loading"!==E.readyState&&!E.documentElement.doScroll?C.setTimeout(S.ready):(E.addEventListener("DOMContentLoaded",B),C.addEventListener("load",B));var $=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===w(n))for(s in i=!0,n)$(e,t,s,n[s],!0,o,a);else if(void 0!==r&&(i=!0,m(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(S(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},_=/^-ms-/,z=/-([a-z])/g;function U(e,t){return t.toUpperCase()}function X(e){return e.replace(_,"ms-").replace(z,U)}var V=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function G(){this.expando=S.expando+G.uid++}G.uid=1,G.prototype={cache:function(e){var t=e[this.expando];return t||(t={},V(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[X(t)]=n;else for(r in t)i[X(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][X(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(X):(t=X(t))in r?[t]:t.match(P)||[]).length;while(n--)delete r[t[n]]}(void 0===t||S.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!S.isEmptyObject(t)}};var Y=new G,Q=new G,J=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,K=/[A-Z]/g;function Z(e,t,n){var r,i;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(K,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n="true"===(i=n)||"false"!==i&&("null"===i?null:i===+i+""?+i:J.test(i)?JSON.parse(i):i)}catch(e){}Q.set(e,t,n)}else n=void 0;return n}S.extend({hasData:function(e){return Q.hasData(e)||Y.hasData(e)},data:function(e,t,n){return Q.access(e,t,n)},removeData:function(e,t){Q.remove(e,t)},_data:function(e,t,n){return Y.access(e,t,n)},_removeData:function(e,t){Y.remove(e,t)}}),S.fn.extend({data:function(n,e){var t,r,i,o=this[0],a=o&&o.attributes;if(void 0===n){if(this.length&&(i=Q.get(o),1===o.nodeType&&!Y.get(o,"hasDataAttrs"))){t=a.length;while(t--)a[t]&&0===(r=a[t].name).indexOf("data-")&&(r=X(r.slice(5)),Z(o,r,i[r]));Y.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof n?this.each(function(){Q.set(this,n)}):$(this,function(e){var t;if(o&&void 0===e)return void 0!==(t=Q.get(o,n))?t:void 0!==(t=Z(o,n))?t:void 0;this.each(function(){Q.set(this,n,e)})},null,e,1<arguments.length,null,!0)},removeData:function(e){return this.each(function(){Q.remove(this,e)})}}),S.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=Y.get(e,t),n&&(!r||Array.isArray(n)?r=Y.access(e,t,S.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=S.queue(e,t),r=n.length,i=n.shift(),o=S._queueHooks(e,t);"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,function(){S.dequeue(e,t)},o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return Y.get(e,n)||Y.access(e,n,{empty:S.Callbacks("once memory").add(function(){Y.remove(e,[t+"queue",n])})})}}),S.fn.extend({queue:function(t,n){var e=2;return"string"!=typeof t&&(n=t,t="fx",e--),arguments.length<e?S.queue(this[0],t):void 0===n?this:this.each(function(){var e=S.queue(this,t,n);S._queueHooks(this,t),"fx"===t&&"inprogress"!==e[0]&&S.dequeue(this,t)})},dequeue:function(e){return this.each(function(){S.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=S.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(a--)(n=Y.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var ee=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,te=new RegExp("^(?:([+-])=|)("+ee+")([a-z%]*)$","i"),ne=["Top","Right","Bottom","Left"],re=E.documentElement,ie=function(e){return S.contains(e.ownerDocument,e)},oe={composed:!0};re.getRootNode&&(ie=function(e){return S.contains(e.ownerDocument,e)||e.getRootNode(oe)===e.ownerDocument});var ae=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&ie(e)&&"none"===S.css(e,"display")};function se(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return S.css(e,t,"")},u=s(),l=n&&n[3]||(S.cssNumber[t]?"":"px"),c=e.nodeType&&(S.cssNumber[t]||"px"!==l&&+u)&&te.exec(S.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)S.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,S.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var ue={};function le(e,t){for(var n,r,i,o,a,s,u,l=[],c=0,f=e.length;c<f;c++)(r=e[c]).style&&(n=r.style.display,t?("none"===n&&(l[c]=Y.get(r,"display")||null,l[c]||(r.style.display="")),""===r.style.display&&ae(r)&&(l[c]=(u=a=o=void 0,a=(i=r).ownerDocument,s=i.nodeName,(u=ue[s])||(o=a.body.appendChild(a.createElement(s)),u=S.css(o,"display"),o.parentNode.removeChild(o),"none"===u&&(u="block"),ue[s]=u)))):"none"!==n&&(l[c]="none",Y.set(r,"display",n)));for(c=0;c<f;c++)null!=l[c]&&(e[c].style.display=l[c]);return e}S.fn.extend({show:function(){return le(this,!0)},hide:function(){return le(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){ae(this)?S(this).show():S(this).hide()})}});var ce,fe,pe=/^(?:checkbox|radio)$/i,de=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="<textarea>x</textarea>",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="<option></option>",y.option=!!ce.lastChild;var ge={thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n<r;n++)Y.set(e[n],"globalEval",!t||Y.get(t[n],"globalEval"))}ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td,y.option||(ge.optgroup=ge.option=[1,"<select multiple='multiple'>","</select>"]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if("object"===w(o))S.merge(p,o.nodeType?[o]:o);else if(me.test(o)){a=a||f.appendChild(t.createElement("div")),s=(de.exec(o)||["",""])[1].toLowerCase(),u=ge[s]||ge._default,a.innerHTML=u[1]+S.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;S.merge(p,a.childNodes),(a=f.firstChild).textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&-1<S.inArray(o,r))i&&i.push(o);else if(l=ie(o),a=ve(f.appendChild(o),"script"),l&&ye(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}var be=/^key/,we=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Te=/^([^.]*)(?:\.(.+)|)/;function Ce(){return!0}function Ee(){return!1}function Se(e,t){return e===function(){try{return E.activeElement}catch(e){}}()==("focus"===t)}function ke(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)ke(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Ee;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return S().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=S.guid++)),e.each(function(){S.event.add(this,t,i,r,n)})}function Ae(e,i,o){o?(Y.set(e,i,!1),S.event.add(e,i,{namespace:!1,handler:function(e){var t,n,r=Y.get(this,i);if(1&e.isTrigger&&this[i]){if(r.length)(S.event.special[i]||{}).delegateType&&e.stopPropagation();else if(r=s.call(arguments),Y.set(this,i,r),t=o(this,i),this[i](),r!==(n=Y.get(this,i))||t?Y.set(this,i,!1):n={},r!==n)return e.stopImmediatePropagation(),e.preventDefault(),n.value}else r.length&&(Y.set(this,i,{value:S.event.trigger(S.extend(r[0],S.Event.prototype),r.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Y.get(e,i)&&S.event.add(e,i,Ce)}S.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Y.get(t);if(V(t)){n.handler&&(n=(o=n).handler,i=o.selector),i&&S.find.matchesSelector(re,i),n.guid||(n.guid=S.guid++),(u=v.events)||(u=v.events=Object.create(null)),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof S&&S.event.triggered!==e.type?S.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(P)||[""]).length;while(l--)d=g=(s=Te.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=S.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=S.event.special[d]||{},c=S.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&S.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),S.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Y.hasData(e)&&Y.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(P)||[""]).length;while(l--)if(d=g=(s=Te.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=S.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||S.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)S.event.remove(e,d+t[l],n,r,!0);S.isEmptyObject(u)&&Y.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=new Array(arguments.length),u=S.event.fix(e),l=(Y.get(this,"events")||Object.create(null))[u.type]||[],c=S.event.special[u.type]||{};for(s[0]=u,t=1;t<arguments.length;t++)s[t]=arguments[t];if(u.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,u)){a=S.event.handlers.call(this,u,l),t=0;while((i=a[t++])&&!u.isPropagationStopped()){u.currentTarget=i.elem,n=0;while((o=i.handlers[n++])&&!u.isImmediatePropagationStopped())u.rnamespace&&!1!==o.namespace&&!u.rnamespace.test(o.namespace)||(u.handleObj=o,u.data=o.data,void 0!==(r=((S.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,s))&&!1===(u.result=r)&&(u.preventDefault(),u.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,u),u.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&1<=e.button))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?-1<S(i,this).index(l):S.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(t,e){Object.defineProperty(S.Event.prototype,t,{enumerable:!0,configurable:!0,get:m(e)?function(){if(this.originalEvent)return e(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[t]},set:function(e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e})}})},fix:function(e){return e[S.expando]?e:new S.Event(e)},special:{load:{noBubble:!0},click:{setup:function(e){var t=this||e;return pe.test(t.type)&&t.click&&A(t,"input")&&Ae(t,"click",Ce),!1},trigger:function(e){var t=this||e;return pe.test(t.type)&&t.click&&A(t,"input")&&Ae(t,"click"),!0},_default:function(e){var t=e.target;return pe.test(t.type)&&t.click&&A(t,"input")&&Y.get(t,"click")||A(t,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},S.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},S.Event=function(e,t){if(!(this instanceof S.Event))return new S.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Ce:Ee,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&S.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[S.expando]=!0},S.Event.prototype={constructor:S.Event,isDefaultPrevented:Ee,isPropagationStopped:Ee,isImmediatePropagationStopped:Ee,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Ce,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Ce,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Ce,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},S.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(e){var t=e.button;return null==e.which&&be.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&we.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},S.event.addProp),S.each({focus:"focusin",blur:"focusout"},function(e,t){S.event.special[e]={setup:function(){return Ae(this,e,Se),!1},trigger:function(){return Ae(this,e),!0},delegateType:t}}),S.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,i){S.event.special[e]={delegateType:i,bindType:i,handle:function(e){var t,n=e.relatedTarget,r=e.handleObj;return n&&(n===this||S.contains(this,n))||(e.type=r.origType,t=r.handler.apply(this,arguments),e.type=i),t}}}),S.fn.extend({on:function(e,t,n,r){return ke(this,e,t,n,r)},one:function(e,t,n,r){return ke(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,S(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=Ee),this.each(function(){S.event.remove(this,e,n,t)})}});var Ne=/<script|<style|<link/i,De=/checked\s*(?:[^=]|=\s*.checked.)/i,je=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function qe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function Le(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function He(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Oe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n<r;n++)S.event.add(t,i,s[i][n]);Q.hasData(e)&&(o=Q.access(e),a=S.extend({},o),Q.set(t,a))}}function Pe(n,r,i,o){r=g(r);var e,t,a,s,u,l,c=0,f=n.length,p=f-1,d=r[0],h=m(d);if(h||1<f&&"string"==typeof d&&!y.checkClone&&De.test(d))return n.each(function(e){var t=n.eq(e);h&&(r[0]=d.call(this,e,t.html())),Pe(t,r,i,o)});if(f&&(t=(e=xe(r,n[0].ownerDocument,!1,n,o)).firstChild,1===e.childNodes.length&&(e=t),t||o)){for(s=(a=S.map(ve(e,"script"),Le)).length;c<f;c++)u=e,c!==p&&(u=S.clone(u,!0,!0),s&&S.merge(a,ve(u,"script"))),i.call(n[c],u,c);if(s)for(l=a[a.length-1].ownerDocument,S.map(a,He),c=0;c<s;c++)u=a[c],he.test(u.type||"")&&!Y.access(u,"globalEval")&&S.contains(l,u)&&(u.src&&"module"!==(u.type||"").toLowerCase()?S._evalUrl&&!u.noModule&&S._evalUrl(u.src,{nonce:u.nonce||u.getAttribute("nonce")},l):b(u.textContent.replace(je,""),u,l))}return n}function Re(e,t,n){for(var r,i=t?S.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||S.cleanData(ve(r)),r.parentNode&&(n&&ie(r)&&ye(ve(r,"script")),r.parentNode.removeChild(r));return e}S.extend({htmlPrefilter:function(e){return e},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=ie(e);if(!(y.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||S.isXMLDoc(e)))for(a=ve(c),r=0,i=(o=ve(e)).length;r<i;r++)s=o[r],u=a[r],void 0,"input"===(l=u.nodeName.toLowerCase())&&pe.test(s.type)?u.checked=s.checked:"input"!==l&&"textarea"!==l||(u.defaultValue=s.defaultValue);if(t)if(n)for(o=o||ve(e),a=a||ve(c),r=0,i=o.length;r<i;r++)Oe(o[r],a[r]);else Oe(e,c);return 0<(a=ve(c,"script")).length&&ye(a,!f&&ve(e,"script")),c},cleanData:function(e){for(var t,n,r,i=S.event.special,o=0;void 0!==(n=e[o]);o++)if(V(n)){if(t=n[Y.expando]){if(t.events)for(r in t.events)i[r]?S.event.remove(n,r):S.removeEvent(n,r,t.handle);n[Y.expando]=void 0}n[Q.expando]&&(n[Q.expando]=void 0)}}}),S.fn.extend({detach:function(e){return Re(this,e,!0)},remove:function(e){return Re(this,e)},text:function(e){return $(this,function(e){return void 0===e?S.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Pe(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||qe(this,e).appendChild(e)})},prepend:function(){return Pe(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=qe(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Pe(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Pe(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(S.cleanData(ve(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return S.clone(this,e,t)})},html:function(e){return $(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ne.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=S.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(S.cleanData(ve(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var n=[];return Pe(this,arguments,function(e){var t=this.parentNode;S.inArray(this,n)<0&&(S.cleanData(ve(this)),t&&t.replaceChild(e,this))},n)}}),S.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,a){S.fn[e]=function(e){for(var t,n=[],r=S(e),i=r.length-1,o=0;o<=i;o++)t=o===i?this:this.clone(!0),S(r[o])[a](t),u.apply(n,t.get());return this.pushStack(n)}});var Me=new RegExp("^("+ee+")(?!px)[a-z%]+$","i"),Ie=function(e){var t=e.ownerDocument.defaultView;return t&&t.opener||(t=C),t.getComputedStyle(e)},We=function(e,t,n){var r,i,o={};for(i in t)o[i]=e.style[i],e.style[i]=t[i];for(i in r=n.call(e),t)e.style[i]=o[i];return r},Fe=new RegExp(ne.join("|"),"i");function Be(e,t,n){var r,i,o,a,s=e.style;return(n=n||Ie(e))&&(""!==(a=n.getPropertyValue(t)||n[t])||ie(e)||(a=S.style(e,t)),!y.pixelBoxStyles()&&Me.test(a)&&Fe.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o)),void 0!==a?a+"":a}function $e(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}!function(){function e(){if(l){u.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",l.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",re.appendChild(u).appendChild(l);var e=C.getComputedStyle(l);n="1%"!==e.top,s=12===t(e.marginLeft),l.style.right="60%",o=36===t(e.right),r=36===t(e.width),l.style.position="absolute",i=12===t(l.offsetWidth/3),re.removeChild(u),l=null}}function t(e){return Math.round(parseFloat(e))}var n,r,i,o,a,s,u=E.createElement("div"),l=E.createElement("div");l.style&&(l.style.backgroundClip="content-box",l.cloneNode(!0).style.backgroundClip="",y.clearCloneStyle="content-box"===l.style.backgroundClip,S.extend(y,{boxSizingReliable:function(){return e(),r},pixelBoxStyles:function(){return e(),o},pixelPosition:function(){return e(),n},reliableMarginLeft:function(){return e(),s},scrollboxSize:function(){return e(),i},reliableTrDimensions:function(){var e,t,n,r;return null==a&&(e=E.createElement("table"),t=E.createElement("tr"),n=E.createElement("div"),e.style.cssText="position:absolute;left:-11111px",t.style.height="1px",n.style.height="9px",re.appendChild(e).appendChild(t).appendChild(n),r=C.getComputedStyle(t),a=3<parseInt(r.height),re.removeChild(e)),a}}))}();var _e=["Webkit","Moz","ms"],ze=E.createElement("div").style,Ue={};function Xe(e){var t=S.cssProps[e]||Ue[e];return t||(e in ze?e:Ue[e]=function(e){var t=e[0].toUpperCase()+e.slice(1),n=_e.length;while(n--)if((e=_e[n]+t)in ze)return e}(e)||e)}var Ve=/^(none|table(?!-c[ea]).+)/,Ge=/^--/,Ye={position:"absolute",visibility:"hidden",display:"block"},Qe={letterSpacing:"0",fontWeight:"400"};function Je(e,t,n){var r=te.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function Ke(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(u+=S.css(e,n+ne[a],!0,i)),r?("content"===n&&(u-=S.css(e,"padding"+ne[a],!0,i)),"margin"!==n&&(u-=S.css(e,"border"+ne[a]+"Width",!0,i))):(u+=S.css(e,"padding"+ne[a],!0,i),"padding"!==n?u+=S.css(e,"border"+ne[a]+"Width",!0,i):s+=S.css(e,"border"+ne[a]+"Width",!0,i));return!r&&0<=o&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))||0),u}function Ze(e,t,n){var r=Ie(e),i=(!y.boxSizingReliable()||n)&&"border-box"===S.css(e,"boxSizing",!1,r),o=i,a=Be(e,t,r),s="offset"+t[0].toUpperCase()+t.slice(1);if(Me.test(a)){if(!n)return a;a="auto"}return(!y.boxSizingReliable()&&i||!y.reliableTrDimensions()&&A(e,"tr")||"auto"===a||!parseFloat(a)&&"inline"===S.css(e,"display",!1,r))&&e.getClientRects().length&&(i="border-box"===S.css(e,"boxSizing",!1,r),(o=s in e)&&(a=e[s])),(a=parseFloat(a)||0)+Ke(e,t,n||(i?"border":"content"),o,r,a)+"px"}function et(e,t,n,r,i){return new et.prototype.init(e,t,n,r,i)}S.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Be(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=X(t),u=Ge.test(t),l=e.style;if(u||(t=Xe(s)),a=S.cssHooks[t]||S.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"===(o=typeof n)&&(i=te.exec(n))&&i[1]&&(n=se(e,t,i),o="number"),null!=n&&n==n&&("number"!==o||u||(n+=i&&i[3]||(S.cssNumber[s]?"":"px")),y.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=X(t);return Ge.test(t)||(t=Xe(s)),(a=S.cssHooks[t]||S.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Be(e,t,r)),"normal"===i&&t in Qe&&(i=Qe[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),S.each(["height","width"],function(e,u){S.cssHooks[u]={get:function(e,t,n){if(t)return!Ve.test(S.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?Ze(e,u,n):We(e,Ye,function(){return Ze(e,u,n)})},set:function(e,t,n){var r,i=Ie(e),o=!y.scrollboxSize()&&"absolute"===i.position,a=(o||n)&&"border-box"===S.css(e,"boxSizing",!1,i),s=n?Ke(e,u,n,a,i):0;return a&&o&&(s-=Math.ceil(e["offset"+u[0].toUpperCase()+u.slice(1)]-parseFloat(i[u])-Ke(e,u,"border",!1,i)-.5)),s&&(r=te.exec(t))&&"px"!==(r[3]||"px")&&(e.style[u]=t,t=S.css(e,u)),Je(0,t,s)}}}),S.cssHooks.marginLeft=$e(y.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Be(e,"marginLeft"))||e.getBoundingClientRect().left-We(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),S.each({margin:"",padding:"",border:"Width"},function(i,o){S.cssHooks[i+o]={expand:function(e){for(var t=0,n={},r="string"==typeof e?e.split(" "):[e];t<4;t++)n[i+ne[t]+o]=r[t]||r[t-2]||r[0];return n}},"margin"!==i&&(S.cssHooks[i+o].set=Je)}),S.fn.extend({css:function(e,t){return $(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=Ie(e),i=t.length;a<i;a++)o[t[a]]=S.css(e,t[a],!1,r);return o}return void 0!==n?S.style(e,t,n):S.css(e,t)},e,t,1<arguments.length)}}),((S.Tween=et).prototype={constructor:et,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||S.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(S.cssNumber[n]?"":"px")},cur:function(){var e=et.propHooks[this.prop];return e&&e.get?e.get(this):et.propHooks._default.get(this)},run:function(e){var t,n=et.propHooks[this.prop];return this.options.duration?this.pos=t=S.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):et.propHooks._default.set(this),this}}).init.prototype=et.prototype,(et.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=S.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){S.fx.step[e.prop]?S.fx.step[e.prop](e):1!==e.elem.nodeType||!S.cssHooks[e.prop]&&null==e.elem.style[Xe(e.prop)]?e.elem[e.prop]=e.now:S.style(e.elem,e.prop,e.now+e.unit)}}}).scrollTop=et.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},S.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},S.fx=et.prototype.init,S.fx.step={};var tt,nt,rt,it,ot=/^(?:toggle|show|hide)$/,at=/queueHooks$/;function st(){nt&&(!1===E.hidden&&C.requestAnimationFrame?C.requestAnimationFrame(st):C.setTimeout(st,S.fx.interval),S.fx.tick())}function ut(){return C.setTimeout(function(){tt=void 0}),tt=Date.now()}function lt(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=ne[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function ct(e,t,n){for(var r,i=(ft.tweeners[t]||[]).concat(ft.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function ft(o,e,t){var n,a,r=0,i=ft.prefilters.length,s=S.Deferred().always(function(){delete u.elem}),u=function(){if(a)return!1;for(var e=tt||ut(),t=Math.max(0,l.startTime+l.duration-e),n=1-(t/l.duration||0),r=0,i=l.tweens.length;r<i;r++)l.tweens[r].run(n);return s.notifyWith(o,[l,n,t]),n<1&&i?t:(i||s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l]),!1)},l=s.promise({elem:o,props:S.extend({},e),opts:S.extend(!0,{specialEasing:{},easing:S.easing._default},t),originalProperties:e,originalOptions:t,startTime:tt||ut(),duration:t.duration,tweens:[],createTween:function(e,t){var n=S.Tween(o,l.opts,e,t,l.opts.specialEasing[e]||l.opts.easing);return l.tweens.push(n),n},stop:function(e){var t=0,n=e?l.tweens.length:0;if(a)return this;for(a=!0;t<n;t++)l.tweens[t].run(1);return e?(s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l,e])):s.rejectWith(o,[l,e]),this}}),c=l.props;for(!function(e,t){var n,r,i,o,a;for(n in e)if(i=t[r=X(n)],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=S.cssHooks[r])&&"expand"in a)for(n in o=a.expand(o),delete e[r],o)n in e||(e[n]=o[n],t[n]=i);else t[r]=i}(c,l.opts.specialEasing);r<i;r++)if(n=ft.prefilters[r].call(l,o,c,l.opts))return m(n.stop)&&(S._queueHooks(l.elem,l.opts.queue).stop=n.stop.bind(n)),n;return S.map(c,ct,l),m(l.opts.start)&&l.opts.start.call(o,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),S.fx.timer(S.extend(u,{elem:o,anim:l,queue:l.opts.queue})),l}S.Animation=S.extend(ft,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return se(n.elem,e,te.exec(t),n),n}]},tweener:function(e,t){m(e)?(t=e,e=["*"]):e=e.match(P);for(var n,r=0,i=e.length;r<i;r++)n=e[r],ft.tweeners[n]=ft.tweeners[n]||[],ft.tweeners[n].unshift(t)},prefilters:[function(e,t,n){var r,i,o,a,s,u,l,c,f="width"in t||"height"in t,p=this,d={},h=e.style,g=e.nodeType&&ae(e),v=Y.get(e,"fxshow");for(r in n.queue||(null==(a=S._queueHooks(e,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,S.queue(e,"fx").length||a.empty.fire()})})),t)if(i=t[r],ot.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!v||void 0===v[r])continue;g=!0}d[r]=v&&v[r]||S.style(e,r)}if((u=!S.isEmptyObject(t))||!S.isEmptyObject(d))for(r in f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=v&&v.display)&&(l=Y.get(e,"display")),"none"===(c=S.css(e,"display"))&&(l?c=l:(le([e],!0),l=e.style.display||l,c=S.css(e,"display"),le([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===S.css(e,"float")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1,d)u||(v?"hidden"in v&&(g=v.hidden):v=Y.access(e,"fxshow",{display:l}),o&&(v.hidden=!g),g&&le([e],!0),p.done(function(){for(r in g||le([e]),Y.remove(e,"fxshow"),d)S.style(e,r,d[r])})),u=ct(g?v[r]:0,r,p),r in v||(v[r]=u.start,g&&(u.end=u.start,u.start=0))}],prefilter:function(e,t){t?ft.prefilters.unshift(e):ft.prefilters.push(e)}}),S.speed=function(e,t,n){var r=e&&"object"==typeof e?S.extend({},e):{complete:n||!n&&t||m(e)&&e,duration:e,easing:n&&t||t&&!m(t)&&t};return S.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in S.fx.speeds?r.duration=S.fx.speeds[r.duration]:r.duration=S.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){m(r.old)&&r.old.call(this),r.queue&&S.dequeue(this,r.queue)},r},S.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ae).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(t,e,n,r){var i=S.isEmptyObject(t),o=S.speed(e,n,r),a=function(){var e=ft(this,S.extend({},t),o);(i||Y.get(this,"finish"))&&e.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(i,e,o){var a=function(e){var t=e.stop;delete e.stop,t(o)};return"string"!=typeof i&&(o=e,e=i,i=void 0),e&&this.queue(i||"fx",[]),this.each(function(){var e=!0,t=null!=i&&i+"queueHooks",n=S.timers,r=Y.get(this);if(t)r[t]&&r[t].stop&&a(r[t]);else for(t in r)r[t]&&r[t].stop&&at.test(t)&&a(r[t]);for(t=n.length;t--;)n[t].elem!==this||null!=i&&n[t].queue!==i||(n[t].anim.stop(o),e=!1,n.splice(t,1));!e&&o||S.dequeue(this,i)})},finish:function(a){return!1!==a&&(a=a||"fx"),this.each(function(){var e,t=Y.get(this),n=t[a+"queue"],r=t[a+"queueHooks"],i=S.timers,o=n?n.length:0;for(t.finish=!0,S.queue(this,a,[]),r&&r.stop&&r.stop.call(this,!0),e=i.length;e--;)i[e].elem===this&&i[e].queue===a&&(i[e].anim.stop(!0),i.splice(e,1));for(e=0;e<o;e++)n[e]&&n[e].finish&&n[e].finish.call(this);delete t.finish})}}),S.each(["toggle","show","hide"],function(e,r){var i=S.fn[r];S.fn[r]=function(e,t,n){return null==e||"boolean"==typeof e?i.apply(this,arguments):this.animate(lt(r,!0),e,t,n)}}),S.each({slideDown:lt("show"),slideUp:lt("hide"),slideToggle:lt("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,r){S.fn[e]=function(e,t,n){return this.animate(r,e,t,n)}}),S.timers=[],S.fx.tick=function(){var e,t=0,n=S.timers;for(tt=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||S.fx.stop(),tt=void 0},S.fx.timer=function(e){S.timers.push(e),S.fx.start()},S.fx.interval=13,S.fx.start=function(){nt||(nt=!0,st())},S.fx.stop=function(){nt=null},S.fx.speeds={slow:600,fast:200,_default:400},S.fn.delay=function(r,e){return r=S.fx&&S.fx.speeds[r]||r,e=e||"fx",this.queue(e,function(e,t){var n=C.setTimeout(e,r);t.stop=function(){C.clearTimeout(n)}})},rt=E.createElement("input"),it=E.createElement("select").appendChild(E.createElement("option")),rt.type="checkbox",y.checkOn=""!==rt.value,y.optSelected=it.selected,(rt=E.createElement("input")).value="t",rt.type="radio",y.radioValue="t"===rt.value;var pt,dt=S.expr.attrHandle;S.fn.extend({attr:function(e,t){return $(this,S.attr,e,t,1<arguments.length)},removeAttr:function(e){return this.each(function(){S.removeAttr(this,e)})}}),S.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?S.prop(e,t,n):(1===o&&S.isXMLDoc(e)||(i=S.attrHooks[t.toLowerCase()]||(S.expr.match.bool.test(t)?pt:void 0)),void 0!==n?null===n?void S.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=S.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!y.radioValue&&"radio"===t&&A(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(P);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),pt={set:function(e,t,n){return!1===t?S.removeAttr(e,n):e.setAttribute(n,n),n}},S.each(S.expr.match.bool.source.match(/\w+/g),function(e,t){var a=dt[t]||S.find.attr;dt[t]=function(e,t,n){var r,i,o=t.toLowerCase();return n||(i=dt[o],dt[o]=r,r=null!=a(e,t,n)?o:null,dt[o]=i),r}});var ht=/^(?:input|select|textarea|button)$/i,gt=/^(?:a|area)$/i;function vt(e){return(e.match(P)||[]).join(" ")}function yt(e){return e.getAttribute&&e.getAttribute("class")||""}function mt(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(P)||[]}S.fn.extend({prop:function(e,t){return $(this,S.prop,e,t,1<arguments.length)},removeProp:function(e){return this.each(function(){delete this[S.propFix[e]||e]})}}),S.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&S.isXMLDoc(e)||(t=S.propFix[t]||t,i=S.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=S.find.attr(e,"tabindex");return t?parseInt(t,10):ht.test(e.nodeName)||gt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),y.optSelected||(S.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),S.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){S.propFix[this.toLowerCase()]=this}),S.fn.extend({addClass:function(t){var e,n,r,i,o,a,s,u=0;if(m(t))return this.each(function(e){S(this).addClass(t.call(this,e,yt(this)))});if((e=mt(t)).length)while(n=this[u++])if(i=yt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=e[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},removeClass:function(t){var e,n,r,i,o,a,s,u=0;if(m(t))return this.each(function(e){S(this).removeClass(t.call(this,e,yt(this)))});if(!arguments.length)return this.attr("class","");if((e=mt(t)).length)while(n=this[u++])if(i=yt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=e[a++])while(-1<r.indexOf(" "+o+" "))r=r.replace(" "+o+" "," ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(i,t){var o=typeof i,a="string"===o||Array.isArray(i);return"boolean"==typeof t&&a?t?this.addClass(i):this.removeClass(i):m(i)?this.each(function(e){S(this).toggleClass(i.call(this,e,yt(this),t),t)}):this.each(function(){var e,t,n,r;if(a){t=0,n=S(this),r=mt(i);while(e=r[t++])n.hasClass(e)?n.removeClass(e):n.addClass(e)}else void 0!==i&&"boolean"!==o||((e=yt(this))&&Y.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||!1===i?"":Y.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&-1<(" "+vt(yt(n))+" ").indexOf(t))return!0;return!1}});var xt=/\r/g;S.fn.extend({val:function(n){var r,e,i,t=this[0];return arguments.length?(i=m(n),this.each(function(e){var t;1===this.nodeType&&(null==(t=i?n.call(this,e,S(this).val()):n)?t="":"number"==typeof t?t+="":Array.isArray(t)&&(t=S.map(t,function(e){return null==e?"":e+""})),(r=S.valHooks[this.type]||S.valHooks[this.nodeName.toLowerCase()])&&"set"in r&&void 0!==r.set(this,t,"value")||(this.value=t))})):t?(r=S.valHooks[t.type]||S.valHooks[t.nodeName.toLowerCase()])&&"get"in r&&void 0!==(e=r.get(t,"value"))?e:"string"==typeof(e=t.value)?e.replace(xt,""):null==e?"":e:void 0}}),S.extend({valHooks:{option:{get:function(e){var t=S.find.attr(e,"value");return null!=t?t:vt(S.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!A(n.parentNode,"optgroup"))){if(t=S(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=S.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=-1<S.inArray(S.valHooks.option.get(r),o))&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),S.each(["radio","checkbox"],function(){S.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=-1<S.inArray(S(e).val(),t)}},y.checkOn||(S.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),y.focusin="onfocusin"in C;var bt=/^(?:focusinfocus|focusoutblur)$/,wt=function(e){e.stopPropagation()};S.extend(S.event,{trigger:function(e,t,n,r){var i,o,a,s,u,l,c,f,p=[n||E],d=v.call(e,"type")?e.type:e,h=v.call(e,"namespace")?e.namespace.split("."):[];if(o=f=a=n=n||E,3!==n.nodeType&&8!==n.nodeType&&!bt.test(d+S.event.triggered)&&(-1<d.indexOf(".")&&(d=(h=d.split(".")).shift(),h.sort()),u=d.indexOf(":")<0&&"on"+d,(e=e[S.expando]?e:new S.Event(d,"object"==typeof e&&e)).isTrigger=r?2:3,e.namespace=h.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:S.makeArray(t,[e]),c=S.event.special[d]||{},r||!c.trigger||!1!==c.trigger.apply(n,t))){if(!r&&!c.noBubble&&!x(n)){for(s=c.delegateType||d,bt.test(s+d)||(o=o.parentNode);o;o=o.parentNode)p.push(o),a=o;a===(n.ownerDocument||E)&&p.push(a.defaultView||a.parentWindow||C)}i=0;while((o=p[i++])&&!e.isPropagationStopped())f=o,e.type=1<i?s:c.bindType||d,(l=(Y.get(o,"events")||Object.create(null))[e.type]&&Y.get(o,"handle"))&&l.apply(o,t),(l=u&&o[u])&&l.apply&&V(o)&&(e.result=l.apply(o,t),!1===e.result&&e.preventDefault());return e.type=d,r||e.isDefaultPrevented()||c._default&&!1!==c._default.apply(p.pop(),t)||!V(n)||u&&m(n[d])&&!x(n)&&((a=n[u])&&(n[u]=null),S.event.triggered=d,e.isPropagationStopped()&&f.addEventListener(d,wt),n[d](),e.isPropagationStopped()&&f.removeEventListener(d,wt),S.event.triggered=void 0,a&&(n[u]=a)),e.result}},simulate:function(e,t,n){var r=S.extend(new S.Event,n,{type:e,isSimulated:!0});S.event.trigger(r,null,t)}}),S.fn.extend({trigger:function(e,t){return this.each(function(){S.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return S.event.trigger(e,t,n,!0)}}),y.focusin||S.each({focus:"focusin",blur:"focusout"},function(n,r){var i=function(e){S.event.simulate(r,e.target,S.event.fix(e))};S.event.special[r]={setup:function(){var e=this.ownerDocument||this.document||this,t=Y.access(e,r);t||e.addEventListener(n,i,!0),Y.access(e,r,(t||0)+1)},teardown:function(){var e=this.ownerDocument||this.document||this,t=Y.access(e,r)-1;t?Y.access(e,r,t):(e.removeEventListener(n,i,!0),Y.remove(e,r))}}});var Tt=C.location,Ct={guid:Date.now()},Et=/\?/;S.parseXML=function(e){var t;if(!e||"string"!=typeof e)return null;try{t=(new C.DOMParser).parseFromString(e,"text/xml")}catch(e){t=void 0}return t&&!t.getElementsByTagName("parsererror").length||S.error("Invalid XML: "+e),t};var St=/\[\]$/,kt=/\r?\n/g,At=/^(?:submit|button|image|reset|file)$/i,Nt=/^(?:input|select|textarea|keygen)/i;function Dt(n,e,r,i){var t;if(Array.isArray(e))S.each(e,function(e,t){r||St.test(n)?i(n,t):Dt(n+"["+("object"==typeof t&&null!=t?e:"")+"]",t,r,i)});else if(r||"object"!==w(e))i(n,e);else for(t in e)Dt(n+"["+t+"]",e[t],r,i)}S.param=function(e,t){var n,r=[],i=function(e,t){var n=m(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!S.isPlainObject(e))S.each(e,function(){i(this.name,this.value)});else for(n in e)Dt(n,e[n],t,i);return r.join("&")},S.fn.extend({serialize:function(){return S.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=S.prop(this,"elements");return e?S.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!S(this).is(":disabled")&&Nt.test(this.nodeName)&&!At.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=S(this).val();return null==n?null:Array.isArray(n)?S.map(n,function(e){return{name:t.name,value:e.replace(kt,"\r\n")}}):{name:t.name,value:n.replace(kt,"\r\n")}}).get()}});var jt=/%20/g,qt=/#.*$/,Lt=/([?&])_=[^&]*/,Ht=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ot=/^(?:GET|HEAD)$/,Pt=/^\/\//,Rt={},Mt={},It="*/".concat("*"),Wt=E.createElement("a");function Ft(o){return function(e,t){"string"!=typeof e&&(t=e,e="*");var n,r=0,i=e.toLowerCase().match(P)||[];if(m(t))while(n=i[r++])"+"===n[0]?(n=n.slice(1)||"*",(o[n]=o[n]||[]).unshift(t)):(o[n]=o[n]||[]).push(t)}}function Bt(t,i,o,a){var s={},u=t===Mt;function l(e){var r;return s[e]=!0,S.each(t[e]||[],function(e,t){var n=t(i,o,a);return"string"!=typeof n||u||s[n]?u?!(r=n):void 0:(i.dataTypes.unshift(n),l(n),!1)}),r}return l(i.dataTypes[0])||!s["*"]&&l("*")}function $t(e,t){var n,r,i=S.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&S.extend(!0,e,r),e}Wt.href=Tt.href,S.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Tt.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Tt.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":It,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":S.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?$t($t(e,S.ajaxSettings),t):$t(S.ajaxSettings,e)},ajaxPrefilter:Ft(Rt),ajaxTransport:Ft(Mt),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var c,f,p,n,d,r,h,g,i,o,v=S.ajaxSetup({},t),y=v.context||v,m=v.context&&(y.nodeType||y.jquery)?S(y):S.event,x=S.Deferred(),b=S.Callbacks("once memory"),w=v.statusCode||{},a={},s={},u="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(h){if(!n){n={};while(t=Ht.exec(p))n[t[1].toLowerCase()+" "]=(n[t[1].toLowerCase()+" "]||[]).concat(t[2])}t=n[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return h?p:null},setRequestHeader:function(e,t){return null==h&&(e=s[e.toLowerCase()]=s[e.toLowerCase()]||e,a[e]=t),this},overrideMimeType:function(e){return null==h&&(v.mimeType=e),this},statusCode:function(e){var t;if(e)if(h)T.always(e[T.status]);else for(t in e)w[t]=[w[t],e[t]];return this},abort:function(e){var t=e||u;return c&&c.abort(t),l(0,t),this}};if(x.promise(T),v.url=((e||v.url||Tt.href)+"").replace(Pt,Tt.protocol+"//"),v.type=t.method||t.type||v.method||v.type,v.dataTypes=(v.dataType||"*").toLowerCase().match(P)||[""],null==v.crossDomain){r=E.createElement("a");try{r.href=v.url,r.href=r.href,v.crossDomain=Wt.protocol+"//"+Wt.host!=r.protocol+"//"+r.host}catch(e){v.crossDomain=!0}}if(v.data&&v.processData&&"string"!=typeof v.data&&(v.data=S.param(v.data,v.traditional)),Bt(Rt,v,t,T),h)return T;for(i in(g=S.event&&v.global)&&0==S.active++&&S.event.trigger("ajaxStart"),v.type=v.type.toUpperCase(),v.hasContent=!Ot.test(v.type),f=v.url.replace(qt,""),v.hasContent?v.data&&v.processData&&0===(v.contentType||"").indexOf("application/x-www-form-urlencoded")&&(v.data=v.data.replace(jt,"+")):(o=v.url.slice(f.length),v.data&&(v.processData||"string"==typeof v.data)&&(f+=(Et.test(f)?"&":"?")+v.data,delete v.data),!1===v.cache&&(f=f.replace(Lt,"$1"),o=(Et.test(f)?"&":"?")+"_="+Ct.guid+++o),v.url=f+o),v.ifModified&&(S.lastModified[f]&&T.setRequestHeader("If-Modified-Since",S.lastModified[f]),S.etag[f]&&T.setRequestHeader("If-None-Match",S.etag[f])),(v.data&&v.hasContent&&!1!==v.contentType||t.contentType)&&T.setRequestHeader("Content-Type",v.contentType),T.setRequestHeader("Accept",v.dataTypes[0]&&v.accepts[v.dataTypes[0]]?v.accepts[v.dataTypes[0]]+("*"!==v.dataTypes[0]?", "+It+"; q=0.01":""):v.accepts["*"]),v.headers)T.setRequestHeader(i,v.headers[i]);if(v.beforeSend&&(!1===v.beforeSend.call(y,T,v)||h))return T.abort();if(u="abort",b.add(v.complete),T.done(v.success),T.fail(v.error),c=Bt(Mt,v,t,T)){if(T.readyState=1,g&&m.trigger("ajaxSend",[T,v]),h)return T;v.async&&0<v.timeout&&(d=C.setTimeout(function(){T.abort("timeout")},v.timeout));try{h=!1,c.send(a,l)}catch(e){if(h)throw e;l(-1,e)}}else l(-1,"No Transport");function l(e,t,n,r){var i,o,a,s,u,l=t;h||(h=!0,d&&C.clearTimeout(d),c=void 0,p=r||"",T.readyState=0<e?4:0,i=200<=e&&e<300||304===e,n&&(s=function(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}(v,T,n)),!i&&-1<S.inArray("script",v.dataTypes)&&(v.converters["text script"]=function(){}),s=function(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}(v,s,T,i),i?(v.ifModified&&((u=T.getResponseHeader("Last-Modified"))&&(S.lastModified[f]=u),(u=T.getResponseHeader("etag"))&&(S.etag[f]=u)),204===e||"HEAD"===v.type?l="nocontent":304===e?l="notmodified":(l=s.state,o=s.data,i=!(a=s.error))):(a=l,!e&&l||(l="error",e<0&&(e=0))),T.status=e,T.statusText=(t||l)+"",i?x.resolveWith(y,[o,l,T]):x.rejectWith(y,[T,l,a]),T.statusCode(w),w=void 0,g&&m.trigger(i?"ajaxSuccess":"ajaxError",[T,v,i?o:a]),b.fireWith(y,[T,l]),g&&(m.trigger("ajaxComplete",[T,v]),--S.active||S.event.trigger("ajaxStop")))}return T},getJSON:function(e,t,n){return S.get(e,t,n,"json")},getScript:function(e,t){return S.get(e,void 0,t,"script")}}),S.each(["get","post"],function(e,i){S[i]=function(e,t,n,r){return m(t)&&(r=r||n,n=t,t=void 0),S.ajax(S.extend({url:e,type:i,dataType:r,data:t,success:n},S.isPlainObject(e)&&e))}}),S.ajaxPrefilter(function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")}),S._evalUrl=function(e,t,n){return S.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){S.globalEval(e,t,n)}})},S.fn.extend({wrapAll:function(e){var t;return this[0]&&(m(e)&&(e=e.call(this[0])),t=S(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(n){return m(n)?this.each(function(e){S(this).wrapInner(n.call(this,e))}):this.each(function(){var e=S(this),t=e.contents();t.length?t.wrapAll(n):e.append(n)})},wrap:function(t){var n=m(t);return this.each(function(e){S(this).wrapAll(n?t.call(this,e):t)})},unwrap:function(e){return this.parent(e).not("body").each(function(){S(this).replaceWith(this.childNodes)}),this}}),S.expr.pseudos.hidden=function(e){return!S.expr.pseudos.visible(e)},S.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},S.ajaxSettings.xhr=function(){try{return new C.XMLHttpRequest}catch(e){}};var _t={0:200,1223:204},zt=S.ajaxSettings.xhr();y.cors=!!zt&&"withCredentials"in zt,y.ajax=zt=!!zt,S.ajaxTransport(function(i){var o,a;if(y.cors||zt&&!i.crossDomain)return{send:function(e,t){var n,r=i.xhr();if(r.open(i.type,i.url,i.async,i.username,i.password),i.xhrFields)for(n in i.xhrFields)r[n]=i.xhrFields[n];for(n in i.mimeType&&r.overrideMimeType&&r.overrideMimeType(i.mimeType),i.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest"),e)r.setRequestHeader(n,e[n]);o=function(e){return function(){o&&(o=a=r.onload=r.onerror=r.onabort=r.ontimeout=r.onreadystatechange=null,"abort"===e?r.abort():"error"===e?"number"!=typeof r.status?t(0,"error"):t(r.status,r.statusText):t(_t[r.status]||r.status,r.statusText,"text"!==(r.responseType||"text")||"string"!=typeof r.responseText?{binary:r.response}:{text:r.responseText},r.getAllResponseHeaders()))}},r.onload=o(),a=r.onerror=r.ontimeout=o("error"),void 0!==r.onabort?r.onabort=a:r.onreadystatechange=function(){4===r.readyState&&C.setTimeout(function(){o&&a()})},o=o("abort");try{r.send(i.hasContent&&i.data||null)}catch(e){if(o)throw e}},abort:function(){o&&o()}}}),S.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),S.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return S.globalEval(e),e}}}),S.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),S.ajaxTransport("script",function(n){var r,i;if(n.crossDomain||n.scriptAttrs)return{send:function(e,t){r=S("<script>").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Ut,Xt=[],Vt=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Xt.pop()||S.expando+"_"+Ct.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Vt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Vt,"$1"+r):!1!==e.jsonp&&(e.url+=(Et.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Xt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Ut=E.implementation.createHTMLDocument("").body).innerHTML="<form></form><form></form>",2===Ut.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1<s&&(r=vt(e.slice(s)),e=e.slice(0,s)),m(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),0<a.length&&S.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?S("<div>").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):("number"==typeof f.top&&(f.top+="px"),"number"==typeof f.left&&(f.left+="px"),c.css(f))}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=$e(y.pixelPosition,function(e,t){if(t)return t=Be(e,n),Me.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0<arguments.length?this.on(n,null,e,t):this.trigger(n)}});var Gt=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;S.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),m(e))return r=s.call(arguments,2),(i=function(){return e.apply(t||this,r.concat(s.call(arguments)))}).guid=e.guid=e.guid||S.guid++,i},S.holdReady=function(e){e?S.readyWait++:S.ready(!0)},S.isArray=Array.isArray,S.parseJSON=JSON.parse,S.nodeName=A,S.isFunction=m,S.isWindow=x,S.camelCase=X,S.type=w,S.now=Date.now,S.isNumeric=function(e){var t=S.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},S.trim=function(e){return null==e?"":(e+"").replace(Gt,"")},"function"==typeof define&&define.amd&&define("jquery",[],function(){return S});var Yt=C.jQuery,Qt=C.$;return S.noConflict=function(e){return C.$===S&&(C.$=Qt),e&&C.jQuery===S&&(C.jQuery=Yt),S},"undefined"==typeof e&&(C.jQuery=C.$=S),S});
  3. // Copyright (c) Jupyter Development Team.
  4. // Distributed under the terms of the Modified BSD License.
  5. var Jupyter = Jupyter || {};
  6. var jprop = function(name, module_path){
  7. Object.defineProperty(Jupyter, name, {
  8. get: function() {
  9. console.warn('accessing `'+name+'` is deprecated. Use `requirejs("'+module_path+'")`');
  10. return requirejs(module_path);
  11. },
  12. enumerable: true,
  13. configurable: false
  14. });
  15. }
  16. var jglobal = function(name, module_path){
  17. Object.defineProperty(Jupyter, name, {
  18. get: function() {
  19. console.warn('accessing `'+name+'` is deprecated. Use `requirejs("'+module_path+'").'+name+'`');
  20. return requirejs(module_path)[name];
  21. },
  22. enumerable: true,
  23. configurable: false
  24. });
  25. }
  26. define('base/js/namespace',[],function(){
  27. "use strict";
  28. // expose modules
  29. jprop('utils','base/js/utils')
  30. jprop('mathjaxutils','base/js/mathjaxutils');
  31. //Jupyter.load_extensions = Jupyter.utils.load_extensions;
  32. //
  33. jprop('security','base/js/security');
  34. jprop('keyboard','base/js/keyboard');
  35. jprop('dialog','base/js/dialog');
  36. //// exposed constructors
  37. jglobal('CommManager','services/kernels/comm')
  38. jglobal('Comm','services/kernels/comm')
  39. jglobal('NotificationWidget','base/js/notificationwidget');
  40. jglobal('Kernel','services/kernels/kernel');
  41. jglobal('Session','services/sessions/session');
  42. jglobal('LoginWidget','auth/js/loginwidget');
  43. jglobal('Page','base/js/page');
  44. // notebook
  45. jglobal('TextCell','notebook/js/textcell');
  46. jglobal('OutputArea','notebook/js/outputarea');
  47. jglobal('KeyboardManager','notebook/js/keyboardmanager');
  48. jglobal('Completer','notebook/js/completer');
  49. jglobal('Notebook','notebook/js/notebook');
  50. jglobal('Tooltip','notebook/js/tooltip');
  51. jglobal('Toolbar','notebook/js/toolbar');
  52. jglobal('SaveWidget','notebook/js/savewidget');
  53. jglobal('Pager','notebook/js/pager');
  54. jglobal('QuickHelp','notebook/js/quickhelp');
  55. jglobal('MarkdownCell','notebook/js/textcell');
  56. jglobal('RawCell','notebook/js/textcell');
  57. jglobal('Cell','notebook/js/cell');
  58. jglobal('MainToolBar','notebook/js/maintoolbar');
  59. jglobal('NotebookNotificationArea','notebook/js/notificationarea');
  60. jglobal('NotebookTour', 'notebook/js/tour');
  61. jglobal('MenuBar', 'notebook/js/menubar');
  62. // tree
  63. jglobal('SessionList','tree/js/sessionlist');
  64. Jupyter.version = "1.0.0";
  65. Jupyter._target = '_blank';
  66. return Jupyter;
  67. });
  68. // deprecated since 4.0, remove in 5+
  69. var IPython = Jupyter;
  70. !function(n,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define("underscore",r):(n="undefined"!=typeof globalThis?globalThis:n||self,function(){var t=n._,e=n._=r();e.noConflict=function(){return n._=t,e}}())}(this,(function(){
  71. // Underscore.js 1.13.6
  72. // https://underscorejs.org
  73. // (c) 2009-2022 Jeremy Ashkenas, Julian Gonggrijp, and DocumentCloud and Investigative Reporters & Editors
  74. // Underscore may be freely distributed under the MIT license.
  75. var n="1.13.6",r="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||Function("return this")()||{},t=Array.prototype,e=Object.prototype,u="undefined"!=typeof Symbol?Symbol.prototype:null,o=t.push,i=t.slice,a=e.toString,f=e.hasOwnProperty,c="undefined"!=typeof ArrayBuffer,l="undefined"!=typeof DataView,s=Array.isArray,p=Object.keys,v=Object.create,h=c&&ArrayBuffer.isView,y=isNaN,d=isFinite,g=!{toString:null}.propertyIsEnumerable("toString"),b=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],m=Math.pow(2,53)-1;function j(n,r){return r=null==r?n.length-1:+r,function(){for(var t=Math.max(arguments.length-r,0),e=Array(t),u=0;u<t;u++)e[u]=arguments[u+r];switch(r){case 0:return n.call(this,e);case 1:return n.call(this,arguments[0],e);case 2:return n.call(this,arguments[0],arguments[1],e)}var o=Array(r+1);for(u=0;u<r;u++)o[u]=arguments[u];return o[r]=e,n.apply(this,o)}}function _(n){var r=typeof n;return"function"===r||"object"===r&&!!n}function w(n){return void 0===n}function A(n){return!0===n||!1===n||"[object Boolean]"===a.call(n)}function x(n){var r="[object "+n+"]";return function(n){return a.call(n)===r}}var S=x("String"),O=x("Number"),M=x("Date"),E=x("RegExp"),B=x("Error"),N=x("Symbol"),I=x("ArrayBuffer"),T=x("Function"),k=r.document&&r.document.childNodes;"function"!=typeof/./&&"object"!=typeof Int8Array&&"function"!=typeof k&&(T=function(n){return"function"==typeof n||!1});var D=T,R=x("Object"),F=l&&R(new DataView(new ArrayBuffer(8))),V="undefined"!=typeof Map&&R(new Map),P=x("DataView");var q=F?function(n){return null!=n&&D(n.getInt8)&&I(n.buffer)}:P,U=s||x("Array");function W(n,r){return null!=n&&f.call(n,r)}var z=x("Arguments");!function(){z(arguments)||(z=function(n){return W(n,"callee")})}();var L=z;function $(n){return O(n)&&y(n)}function C(n){return function(){return n}}function K(n){return function(r){var t=n(r);return"number"==typeof t&&t>=0&&t<=m}}function J(n){return function(r){return null==r?void 0:r[n]}}var G=J("byteLength"),H=K(G),Q=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;var X=c?function(n){return h?h(n)&&!q(n):H(n)&&Q.test(a.call(n))}:C(!1),Y=J("length");function Z(n,r){r=function(n){for(var r={},t=n.length,e=0;e<t;++e)r[n[e]]=!0;return{contains:function(n){return!0===r[n]},push:function(t){return r[t]=!0,n.push(t)}}}(r);var t=b.length,u=n.constructor,o=D(u)&&u.prototype||e,i="constructor";for(W(n,i)&&!r.contains(i)&&r.push(i);t--;)(i=b[t])in n&&n[i]!==o[i]&&!r.contains(i)&&r.push(i)}function nn(n){if(!_(n))return[];if(p)return p(n);var r=[];for(var t in n)W(n,t)&&r.push(t);return g&&Z(n,r),r}function rn(n,r){var t=nn(r),e=t.length;if(null==n)return!e;for(var u=Object(n),o=0;o<e;o++){var i=t[o];if(r[i]!==u[i]||!(i in u))return!1}return!0}function tn(n){return n instanceof tn?n:this instanceof tn?void(this._wrapped=n):new tn(n)}function en(n){return new Uint8Array(n.buffer||n,n.byteOffset||0,G(n))}tn.VERSION=n,tn.prototype.value=function(){return this._wrapped},tn.prototype.valueOf=tn.prototype.toJSON=tn.prototype.value,tn.prototype.toString=function(){return String(this._wrapped)};var un="[object DataView]";function on(n,r,t,e){if(n===r)return 0!==n||1/n==1/r;if(null==n||null==r)return!1;if(n!=n)return r!=r;var o=typeof n;return("function"===o||"object"===o||"object"==typeof r)&&function n(r,t,e,o){r instanceof tn&&(r=r._wrapped);t instanceof tn&&(t=t._wrapped);var i=a.call(r);if(i!==a.call(t))return!1;if(F&&"[object Object]"==i&&q(r)){if(!q(t))return!1;i=un}switch(i){case"[object RegExp]":case"[object String]":return""+r==""+t;case"[object Number]":return+r!=+r?+t!=+t:0==+r?1/+r==1/t:+r==+t;case"[object Date]":case"[object Boolean]":return+r==+t;case"[object Symbol]":return u.valueOf.call(r)===u.valueOf.call(t);case"[object ArrayBuffer]":case un:return n(en(r),en(t),e,o)}var f="[object Array]"===i;if(!f&&X(r)){if(G(r)!==G(t))return!1;if(r.buffer===t.buffer&&r.byteOffset===t.byteOffset)return!0;f=!0}if(!f){if("object"!=typeof r||"object"!=typeof t)return!1;var c=r.constructor,l=t.constructor;if(c!==l&&!(D(c)&&c instanceof c&&D(l)&&l instanceof l)&&"constructor"in r&&"constructor"in t)return!1}o=o||[];var s=(e=e||[]).length;for(;s--;)if(e[s]===r)return o[s]===t;if(e.push(r),o.push(t),f){if((s=r.length)!==t.length)return!1;for(;s--;)if(!on(r[s],t[s],e,o))return!1}else{var p,v=nn(r);if(s=v.length,nn(t).length!==s)return!1;for(;s--;)if(p=v[s],!W(t,p)||!on(r[p],t[p],e,o))return!1}return e.pop(),o.pop(),!0}(n,r,t,e)}function an(n){if(!_(n))return[];var r=[];for(var t in n)r.push(t);return g&&Z(n,r),r}function fn(n){var r=Y(n);return function(t){if(null==t)return!1;var e=an(t);if(Y(e))return!1;for(var u=0;u<r;u++)if(!D(t[n[u]]))return!1;return n!==hn||!D(t[cn])}}var cn="forEach",ln="has",sn=["clear","delete"],pn=["get",ln,"set"],vn=sn.concat(cn,pn),hn=sn.concat(pn),yn=["add"].concat(sn,cn,ln),dn=V?fn(vn):x("Map"),gn=V?fn(hn):x("WeakMap"),bn=V?fn(yn):x("Set"),mn=x("WeakSet");function jn(n){for(var r=nn(n),t=r.length,e=Array(t),u=0;u<t;u++)e[u]=n[r[u]];return e}function _n(n){for(var r={},t=nn(n),e=0,u=t.length;e<u;e++)r[n[t[e]]]=t[e];return r}function wn(n){var r=[];for(var t in n)D(n[t])&&r.push(t);return r.sort()}function An(n,r){return function(t){var e=arguments.length;if(r&&(t=Object(t)),e<2||null==t)return t;for(var u=1;u<e;u++)for(var o=arguments[u],i=n(o),a=i.length,f=0;f<a;f++){var c=i[f];r&&void 0!==t[c]||(t[c]=o[c])}return t}}var xn=An(an),Sn=An(nn),On=An(an,!0);function Mn(n){if(!_(n))return{};if(v)return v(n);var r=function(){};r.prototype=n;var t=new r;return r.prototype=null,t}function En(n){return U(n)?n:[n]}function Bn(n){return tn.toPath(n)}function Nn(n,r){for(var t=r.length,e=0;e<t;e++){if(null==n)return;n=n[r[e]]}return t?n:void 0}function In(n,r,t){var e=Nn(n,Bn(r));return w(e)?t:e}function Tn(n){return n}function kn(n){return n=Sn({},n),function(r){return rn(r,n)}}function Dn(n){return n=Bn(n),function(r){return Nn(r,n)}}function Rn(n,r,t){if(void 0===r)return n;switch(null==t?3:t){case 1:return function(t){return n.call(r,t)};case 3:return function(t,e,u){return n.call(r,t,e,u)};case 4:return function(t,e,u,o){return n.call(r,t,e,u,o)}}return function(){return n.apply(r,arguments)}}function Fn(n,r,t){return null==n?Tn:D(n)?Rn(n,r,t):_(n)&&!U(n)?kn(n):Dn(n)}function Vn(n,r){return Fn(n,r,1/0)}function Pn(n,r,t){return tn.iteratee!==Vn?tn.iteratee(n,r):Fn(n,r,t)}function qn(){}function Un(n,r){return null==r&&(r=n,n=0),n+Math.floor(Math.random()*(r-n+1))}tn.toPath=En,tn.iteratee=Vn;var Wn=Date.now||function(){return(new Date).getTime()};function zn(n){var r=function(r){return n[r]},t="(?:"+nn(n).join("|")+")",e=RegExp(t),u=RegExp(t,"g");return function(n){return n=null==n?"":""+n,e.test(n)?n.replace(u,r):n}}var Ln={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},$n=zn(Ln),Cn=zn(_n(Ln)),Kn=tn.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g},Jn=/(.)^/,Gn={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},Hn=/\\|'|\r|\n|\u2028|\u2029/g;function Qn(n){return"\\"+Gn[n]}var Xn=/^\s*(\w|\$)+\s*$/;var Yn=0;function Zn(n,r,t,e,u){if(!(e instanceof r))return n.apply(t,u);var o=Mn(n.prototype),i=n.apply(o,u);return _(i)?i:o}var nr=j((function(n,r){var t=nr.placeholder,e=function(){for(var u=0,o=r.length,i=Array(o),a=0;a<o;a++)i[a]=r[a]===t?arguments[u++]:r[a];for(;u<arguments.length;)i.push(arguments[u++]);return Zn(n,e,this,this,i)};return e}));nr.placeholder=tn;var rr=j((function(n,r,t){if(!D(n))throw new TypeError("Bind must be called on a function");var e=j((function(u){return Zn(n,e,r,this,t.concat(u))}));return e})),tr=K(Y);function er(n,r,t,e){if(e=e||[],r||0===r){if(r<=0)return e.concat(n)}else r=1/0;for(var u=e.length,o=0,i=Y(n);o<i;o++){var a=n[o];if(tr(a)&&(U(a)||L(a)))if(r>1)er(a,r-1,t,e),u=e.length;else for(var f=0,c=a.length;f<c;)e[u++]=a[f++];else t||(e[u++]=a)}return e}var ur=j((function(n,r){var t=(r=er(r,!1,!1)).length;if(t<1)throw new Error("bindAll must be passed function names");for(;t--;){var e=r[t];n[e]=rr(n[e],n)}return n}));var or=j((function(n,r,t){return setTimeout((function(){return n.apply(null,t)}),r)})),ir=nr(or,tn,1);function ar(n){return function(){return!n.apply(this,arguments)}}function fr(n,r){var t;return function(){return--n>0&&(t=r.apply(this,arguments)),n<=1&&(r=null),t}}var cr=nr(fr,2);function lr(n,r,t){r=Pn(r,t);for(var e,u=nn(n),o=0,i=u.length;o<i;o++)if(r(n[e=u[o]],e,n))return e}function sr(n){return function(r,t,e){t=Pn(t,e);for(var u=Y(r),o=n>0?0:u-1;o>=0&&o<u;o+=n)if(t(r[o],o,r))return o;return-1}}var pr=sr(1),vr=sr(-1);function hr(n,r,t,e){for(var u=(t=Pn(t,e,1))(r),o=0,i=Y(n);o<i;){var a=Math.floor((o+i)/2);t(n[a])<u?o=a+1:i=a}return o}function yr(n,r,t){return function(e,u,o){var a=0,f=Y(e);if("number"==typeof o)n>0?a=o>=0?o:Math.max(o+f,a):f=o>=0?Math.min(o+1,f):o+f+1;else if(t&&o&&f)return e[o=t(e,u)]===u?o:-1;if(u!=u)return(o=r(i.call(e,a,f),$))>=0?o+a:-1;for(o=n>0?a:f-1;o>=0&&o<f;o+=n)if(e[o]===u)return o;return-1}}var dr=yr(1,pr,hr),gr=yr(-1,vr);function br(n,r,t){var e=(tr(n)?pr:lr)(n,r,t);if(void 0!==e&&-1!==e)return n[e]}function mr(n,r,t){var e,u;if(r=Rn(r,t),tr(n))for(e=0,u=n.length;e<u;e++)r(n[e],e,n);else{var o=nn(n);for(e=0,u=o.length;e<u;e++)r(n[o[e]],o[e],n)}return n}function jr(n,r,t){r=Pn(r,t);for(var e=!tr(n)&&nn(n),u=(e||n).length,o=Array(u),i=0;i<u;i++){var a=e?e[i]:i;o[i]=r(n[a],a,n)}return o}function _r(n){var r=function(r,t,e,u){var o=!tr(r)&&nn(r),i=(o||r).length,a=n>0?0:i-1;for(u||(e=r[o?o[a]:a],a+=n);a>=0&&a<i;a+=n){var f=o?o[a]:a;e=t(e,r[f],f,r)}return e};return function(n,t,e,u){var o=arguments.length>=3;return r(n,Rn(t,u,4),e,o)}}var wr=_r(1),Ar=_r(-1);function xr(n,r,t){var e=[];return r=Pn(r,t),mr(n,(function(n,t,u){r(n,t,u)&&e.push(n)})),e}function Sr(n,r,t){r=Pn(r,t);for(var e=!tr(n)&&nn(n),u=(e||n).length,o=0;o<u;o++){var i=e?e[o]:o;if(!r(n[i],i,n))return!1}return!0}function Or(n,r,t){r=Pn(r,t);for(var e=!tr(n)&&nn(n),u=(e||n).length,o=0;o<u;o++){var i=e?e[o]:o;if(r(n[i],i,n))return!0}return!1}function Mr(n,r,t,e){return tr(n)||(n=jn(n)),("number"!=typeof t||e)&&(t=0),dr(n,r,t)>=0}var Er=j((function(n,r,t){var e,u;return D(r)?u=r:(r=Bn(r),e=r.slice(0,-1),r=r[r.length-1]),jr(n,(function(n){var o=u;if(!o){if(e&&e.length&&(n=Nn(n,e)),null==n)return;o=n[r]}return null==o?o:o.apply(n,t)}))}));function Br(n,r){return jr(n,Dn(r))}function Nr(n,r,t){var e,u,o=-1/0,i=-1/0;if(null==r||"number"==typeof r&&"object"!=typeof n[0]&&null!=n)for(var a=0,f=(n=tr(n)?n:jn(n)).length;a<f;a++)null!=(e=n[a])&&e>o&&(o=e);else r=Pn(r,t),mr(n,(function(n,t,e){((u=r(n,t,e))>i||u===-1/0&&o===-1/0)&&(o=n,i=u)}));return o}var Ir=/[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;function Tr(n){return n?U(n)?i.call(n):S(n)?n.match(Ir):tr(n)?jr(n,Tn):jn(n):[]}function kr(n,r,t){if(null==r||t)return tr(n)||(n=jn(n)),n[Un(n.length-1)];var e=Tr(n),u=Y(e);r=Math.max(Math.min(r,u),0);for(var o=u-1,i=0;i<r;i++){var a=Un(i,o),f=e[i];e[i]=e[a],e[a]=f}return e.slice(0,r)}function Dr(n,r){return function(t,e,u){var o=r?[[],[]]:{};return e=Pn(e,u),mr(t,(function(r,u){var i=e(r,u,t);n(o,r,i)})),o}}var Rr=Dr((function(n,r,t){W(n,t)?n[t].push(r):n[t]=[r]})),Fr=Dr((function(n,r,t){n[t]=r})),Vr=Dr((function(n,r,t){W(n,t)?n[t]++:n[t]=1})),Pr=Dr((function(n,r,t){n[t?0:1].push(r)}),!0);function qr(n,r,t){return r in t}var Ur=j((function(n,r){var t={},e=r[0];if(null==n)return t;D(e)?(r.length>1&&(e=Rn(e,r[1])),r=an(n)):(e=qr,r=er(r,!1,!1),n=Object(n));for(var u=0,o=r.length;u<o;u++){var i=r[u],a=n[i];e(a,i,n)&&(t[i]=a)}return t})),Wr=j((function(n,r){var t,e=r[0];return D(e)?(e=ar(e),r.length>1&&(t=r[1])):(r=jr(er(r,!1,!1),String),e=function(n,t){return!Mr(r,t)}),Ur(n,e,t)}));function zr(n,r,t){return i.call(n,0,Math.max(0,n.length-(null==r||t?1:r)))}function Lr(n,r,t){return null==n||n.length<1?null==r||t?void 0:[]:null==r||t?n[0]:zr(n,n.length-r)}function $r(n,r,t){return i.call(n,null==r||t?1:r)}var Cr=j((function(n,r){return r=er(r,!0,!0),xr(n,(function(n){return!Mr(r,n)}))})),Kr=j((function(n,r){return Cr(n,r)}));function Jr(n,r,t,e){A(r)||(e=t,t=r,r=!1),null!=t&&(t=Pn(t,e));for(var u=[],o=[],i=0,a=Y(n);i<a;i++){var f=n[i],c=t?t(f,i,n):f;r&&!t?(i&&o===c||u.push(f),o=c):t?Mr(o,c)||(o.push(c),u.push(f)):Mr(u,f)||u.push(f)}return u}var Gr=j((function(n){return Jr(er(n,!0,!0))}));function Hr(n){for(var r=n&&Nr(n,Y).length||0,t=Array(r),e=0;e<r;e++)t[e]=Br(n,e);return t}var Qr=j(Hr);function Xr(n,r){return n._chain?tn(r).chain():r}function Yr(n){return mr(wn(n),(function(r){var t=tn[r]=n[r];tn.prototype[r]=function(){var n=[this._wrapped];return o.apply(n,arguments),Xr(this,t.apply(tn,n))}})),tn}mr(["pop","push","reverse","shift","sort","splice","unshift"],(function(n){var r=t[n];tn.prototype[n]=function(){var t=this._wrapped;return null!=t&&(r.apply(t,arguments),"shift"!==n&&"splice"!==n||0!==t.length||delete t[0]),Xr(this,t)}})),mr(["concat","join","slice"],(function(n){var r=t[n];tn.prototype[n]=function(){var n=this._wrapped;return null!=n&&(n=r.apply(n,arguments)),Xr(this,n)}}));var Zr=Yr({__proto__:null,VERSION:n,restArguments:j,isObject:_,isNull:function(n){return null===n},isUndefined:w,isBoolean:A,isElement:function(n){return!(!n||1!==n.nodeType)},isString:S,isNumber:O,isDate:M,isRegExp:E,isError:B,isSymbol:N,isArrayBuffer:I,isDataView:q,isArray:U,isFunction:D,isArguments:L,isFinite:function(n){return!N(n)&&d(n)&&!isNaN(parseFloat(n))},isNaN:$,isTypedArray:X,isEmpty:function(n){if(null==n)return!0;var r=Y(n);return"number"==typeof r&&(U(n)||S(n)||L(n))?0===r:0===Y(nn(n))},isMatch:rn,isEqual:function(n,r){return on(n,r)},isMap:dn,isWeakMap:gn,isSet:bn,isWeakSet:mn,keys:nn,allKeys:an,values:jn,pairs:function(n){for(var r=nn(n),t=r.length,e=Array(t),u=0;u<t;u++)e[u]=[r[u],n[r[u]]];return e},invert:_n,functions:wn,methods:wn,extend:xn,extendOwn:Sn,assign:Sn,defaults:On,create:function(n,r){var t=Mn(n);return r&&Sn(t,r),t},clone:function(n){return _(n)?U(n)?n.slice():xn({},n):n},tap:function(n,r){return r(n),n},get:In,has:function(n,r){for(var t=(r=Bn(r)).length,e=0;e<t;e++){var u=r[e];if(!W(n,u))return!1;n=n[u]}return!!t},mapObject:function(n,r,t){r=Pn(r,t);for(var e=nn(n),u=e.length,o={},i=0;i<u;i++){var a=e[i];o[a]=r(n[a],a,n)}return o},identity:Tn,constant:C,noop:qn,toPath:En,property:Dn,propertyOf:function(n){return null==n?qn:function(r){return In(n,r)}},matcher:kn,matches:kn,times:function(n,r,t){var e=Array(Math.max(0,n));r=Rn(r,t,1);for(var u=0;u<n;u++)e[u]=r(u);return e},random:Un,now:Wn,escape:$n,unescape:Cn,templateSettings:Kn,template:function(n,r,t){!r&&t&&(r=t),r=On({},r,tn.templateSettings);var e=RegExp([(r.escape||Jn).source,(r.interpolate||Jn).source,(r.evaluate||Jn).source].join("|")+"|$","g"),u=0,o="__p+='";n.replace(e,(function(r,t,e,i,a){return o+=n.slice(u,a).replace(Hn,Qn),u=a+r.length,t?o+="'+\n((__t=("+t+"))==null?'':_.escape(__t))+\n'":e?o+="'+\n((__t=("+e+"))==null?'':__t)+\n'":i&&(o+="';\n"+i+"\n__p+='"),r})),o+="';\n";var i,a=r.variable;if(a){if(!Xn.test(a))throw new Error("variable is not a bare identifier: "+a)}else o="with(obj||{}){\n"+o+"}\n",a="obj";o="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{i=new Function(a,"_",o)}catch(n){throw n.source=o,n}var f=function(n){return i.call(this,n,tn)};return f.source="function("+a+"){\n"+o+"}",f},result:function(n,r,t){var e=(r=Bn(r)).length;if(!e)return D(t)?t.call(n):t;for(var u=0;u<e;u++){var o=null==n?void 0:n[r[u]];void 0===o&&(o=t,u=e),n=D(o)?o.call(n):o}return n},uniqueId:function(n){var r=++Yn+"";return n?n+r:r},chain:function(n){var r=tn(n);return r._chain=!0,r},iteratee:Vn,partial:nr,bind:rr,bindAll:ur,memoize:function(n,r){var t=function(e){var u=t.cache,o=""+(r?r.apply(this,arguments):e);return W(u,o)||(u[o]=n.apply(this,arguments)),u[o]};return t.cache={},t},delay:or,defer:ir,throttle:function(n,r,t){var e,u,o,i,a=0;t||(t={});var f=function(){a=!1===t.leading?0:Wn(),e=null,i=n.apply(u,o),e||(u=o=null)},c=function(){var c=Wn();a||!1!==t.leading||(a=c);var l=r-(c-a);return u=this,o=arguments,l<=0||l>r?(e&&(clearTimeout(e),e=null),a=c,i=n.apply(u,o),e||(u=o=null)):e||!1===t.trailing||(e=setTimeout(f,l)),i};return c.cancel=function(){clearTimeout(e),a=0,e=u=o=null},c},debounce:function(n,r,t){var e,u,o,i,a,f=function(){var c=Wn()-u;r>c?e=setTimeout(f,r-c):(e=null,t||(i=n.apply(a,o)),e||(o=a=null))},c=j((function(c){return a=this,o=c,u=Wn(),e||(e=setTimeout(f,r),t&&(i=n.apply(a,o))),i}));return c.cancel=function(){clearTimeout(e),e=o=a=null},c},wrap:function(n,r){return nr(r,n)},negate:ar,compose:function(){var n=arguments,r=n.length-1;return function(){for(var t=r,e=n[r].apply(this,arguments);t--;)e=n[t].call(this,e);return e}},after:function(n,r){return function(){if(--n<1)return r.apply(this,arguments)}},before:fr,once:cr,findKey:lr,findIndex:pr,findLastIndex:vr,sortedIndex:hr,indexOf:dr,lastIndexOf:gr,find:br,detect:br,findWhere:function(n,r){return br(n,kn(r))},each:mr,forEach:mr,map:jr,collect:jr,reduce:wr,foldl:wr,inject:wr,reduceRight:Ar,foldr:Ar,filter:xr,select:xr,reject:function(n,r,t){return xr(n,ar(Pn(r)),t)},every:Sr,all:Sr,some:Or,any:Or,contains:Mr,includes:Mr,include:Mr,invoke:Er,pluck:Br,where:function(n,r){return xr(n,kn(r))},max:Nr,min:function(n,r,t){var e,u,o=1/0,i=1/0;if(null==r||"number"==typeof r&&"object"!=typeof n[0]&&null!=n)for(var a=0,f=(n=tr(n)?n:jn(n)).length;a<f;a++)null!=(e=n[a])&&e<o&&(o=e);else r=Pn(r,t),mr(n,(function(n,t,e){((u=r(n,t,e))<i||u===1/0&&o===1/0)&&(o=n,i=u)}));return o},shuffle:function(n){return kr(n,1/0)},sample:kr,sortBy:function(n,r,t){var e=0;return r=Pn(r,t),Br(jr(n,(function(n,t,u){return{value:n,index:e++,criteria:r(n,t,u)}})).sort((function(n,r){var t=n.criteria,e=r.criteria;if(t!==e){if(t>e||void 0===t)return 1;if(t<e||void 0===e)return-1}return n.index-r.index})),"value")},groupBy:Rr,indexBy:Fr,countBy:Vr,partition:Pr,toArray:Tr,size:function(n){return null==n?0:tr(n)?n.length:nn(n).length},pick:Ur,omit:Wr,first:Lr,head:Lr,take:Lr,initial:zr,last:function(n,r,t){return null==n||n.length<1?null==r||t?void 0:[]:null==r||t?n[n.length-1]:$r(n,Math.max(0,n.length-r))},rest:$r,tail:$r,drop:$r,compact:function(n){return xr(n,Boolean)},flatten:function(n,r){return er(n,r,!1)},without:Kr,uniq:Jr,unique:Jr,union:Gr,intersection:function(n){for(var r=[],t=arguments.length,e=0,u=Y(n);e<u;e++){var o=n[e];if(!Mr(r,o)){var i;for(i=1;i<t&&Mr(arguments[i],o);i++);i===t&&r.push(o)}}return r},difference:Cr,unzip:Hr,transpose:Hr,zip:Qr,object:function(n,r){for(var t={},e=0,u=Y(n);e<u;e++)r?t[n[e]]=r[e]:t[n[e][0]]=n[e][1];return t},range:function(n,r,t){null==r&&(r=n||0,n=0),t||(t=r<n?-1:1);for(var e=Math.max(Math.ceil((r-n)/t),0),u=Array(e),o=0;o<e;o++,n+=t)u[o]=n;return u},chunk:function(n,r){if(null==r||r<1)return[];for(var t=[],e=0,u=n.length;e<u;)t.push(i.call(n,e,e+=r));return t},mixin:Yr,default:tn});return Zr._=Zr,Zr}));
  76. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  77. // Distributed under an MIT license: https://codemirror.net/LICENSE
  78. // This is CodeMirror (https://codemirror.net), a code editor
  79. // implemented in JavaScript on top of the browser's DOM.
  80. //
  81. // You can find some technical background for some of the code below
  82. // at http://marijnhaverbeke.nl/blog/#cm-internals .
  83. (function (global, factory) {
  84. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  85. typeof define === 'function' && define.amd ? define('codemirror/lib/codemirror',factory) :
  86. (global = global || self, global.CodeMirror = factory());
  87. }(this, (function () { 'use strict';
  88. // Kludges for bugs and behavior differences that can't be feature
  89. // detected are enabled based on userAgent etc sniffing.
  90. var userAgent = navigator.userAgent;
  91. var platform = navigator.platform;
  92. var gecko = /gecko\/\d/i.test(userAgent);
  93. var ie_upto10 = /MSIE \d/.test(userAgent);
  94. var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent);
  95. var edge = /Edge\/(\d+)/.exec(userAgent);
  96. var ie = ie_upto10 || ie_11up || edge;
  97. var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]);
  98. var webkit = !edge && /WebKit\//.test(userAgent);
  99. var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent);
  100. var chrome = !edge && /Chrome\//.test(userAgent);
  101. var presto = /Opera\//.test(userAgent);
  102. var safari = /Apple Computer/.test(navigator.vendor);
  103. var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent);
  104. var phantom = /PhantomJS/.test(userAgent);
  105. var ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent);
  106. var android = /Android/.test(userAgent);
  107. // This is woefully incomplete. Suggestions for alternative methods welcome.
  108. var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);
  109. var mac = ios || /Mac/.test(platform);
  110. var chromeOS = /\bCrOS\b/.test(userAgent);
  111. var windows = /win/i.test(platform);
  112. var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/);
  113. if (presto_version) { presto_version = Number(presto_version[1]); }
  114. if (presto_version && presto_version >= 15) { presto = false; webkit = true; }
  115. // Some browsers use the wrong event properties to signal cmd/ctrl on OS X
  116. var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));
  117. var captureRightClick = gecko || (ie && ie_version >= 9);
  118. function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*") }
  119. var rmClass = function(node, cls) {
  120. var current = node.className;
  121. var match = classTest(cls).exec(current);
  122. if (match) {
  123. var after = current.slice(match.index + match[0].length);
  124. node.className = current.slice(0, match.index) + (after ? match[1] + after : "");
  125. }
  126. };
  127. function removeChildren(e) {
  128. for (var count = e.childNodes.length; count > 0; --count)
  129. { e.removeChild(e.firstChild); }
  130. return e
  131. }
  132. function removeChildrenAndAdd(parent, e) {
  133. return removeChildren(parent).appendChild(e)
  134. }
  135. function elt(tag, content, className, style) {
  136. var e = document.createElement(tag);
  137. if (className) { e.className = className; }
  138. if (style) { e.style.cssText = style; }
  139. if (typeof content == "string") { e.appendChild(document.createTextNode(content)); }
  140. else if (content) { for (var i = 0; i < content.length; ++i) { e.appendChild(content[i]); } }
  141. return e
  142. }
  143. // wrapper for elt, which removes the elt from the accessibility tree
  144. function eltP(tag, content, className, style) {
  145. var e = elt(tag, content, className, style);
  146. e.setAttribute("role", "presentation");
  147. return e
  148. }
  149. var range;
  150. if (document.createRange) { range = function(node, start, end, endNode) {
  151. var r = document.createRange();
  152. r.setEnd(endNode || node, end);
  153. r.setStart(node, start);
  154. return r
  155. }; }
  156. else { range = function(node, start, end) {
  157. var r = document.body.createTextRange();
  158. try { r.moveToElementText(node.parentNode); }
  159. catch(e) { return r }
  160. r.collapse(true);
  161. r.moveEnd("character", end);
  162. r.moveStart("character", start);
  163. return r
  164. }; }
  165. function contains(parent, child) {
  166. if (child.nodeType == 3) // Android browser always returns false when child is a textnode
  167. { child = child.parentNode; }
  168. if (parent.contains)
  169. { return parent.contains(child) }
  170. do {
  171. if (child.nodeType == 11) { child = child.host; }
  172. if (child == parent) { return true }
  173. } while (child = child.parentNode)
  174. }
  175. function activeElt() {
  176. // IE and Edge may throw an "Unspecified Error" when accessing document.activeElement.
  177. // IE < 10 will throw when accessed while the page is loading or in an iframe.
  178. // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.
  179. var activeElement;
  180. try {
  181. activeElement = document.activeElement;
  182. } catch(e) {
  183. activeElement = document.body || null;
  184. }
  185. while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)
  186. { activeElement = activeElement.shadowRoot.activeElement; }
  187. return activeElement
  188. }
  189. function addClass(node, cls) {
  190. var current = node.className;
  191. if (!classTest(cls).test(current)) { node.className += (current ? " " : "") + cls; }
  192. }
  193. function joinClasses(a, b) {
  194. var as = a.split(" ");
  195. for (var i = 0; i < as.length; i++)
  196. { if (as[i] && !classTest(as[i]).test(b)) { b += " " + as[i]; } }
  197. return b
  198. }
  199. var selectInput = function(node) { node.select(); };
  200. if (ios) // Mobile Safari apparently has a bug where select() is broken.
  201. { selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; }; }
  202. else if (ie) // Suppress mysterious IE10 errors
  203. { selectInput = function(node) { try { node.select(); } catch(_e) {} }; }
  204. function bind(f) {
  205. var args = Array.prototype.slice.call(arguments, 1);
  206. return function(){return f.apply(null, args)}
  207. }
  208. function copyObj(obj, target, overwrite) {
  209. if (!target) { target = {}; }
  210. for (var prop in obj)
  211. { if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
  212. { target[prop] = obj[prop]; } }
  213. return target
  214. }
  215. // Counts the column offset in a string, taking tabs into account.
  216. // Used mostly to find indentation.
  217. function countColumn(string, end, tabSize, startIndex, startValue) {
  218. if (end == null) {
  219. end = string.search(/[^\s\u00a0]/);
  220. if (end == -1) { end = string.length; }
  221. }
  222. for (var i = startIndex || 0, n = startValue || 0;;) {
  223. var nextTab = string.indexOf("\t", i);
  224. if (nextTab < 0 || nextTab >= end)
  225. { return n + (end - i) }
  226. n += nextTab - i;
  227. n += tabSize - (n % tabSize);
  228. i = nextTab + 1;
  229. }
  230. }
  231. var Delayed = function() {
  232. this.id = null;
  233. this.f = null;
  234. this.time = 0;
  235. this.handler = bind(this.onTimeout, this);
  236. };
  237. Delayed.prototype.onTimeout = function (self) {
  238. self.id = 0;
  239. if (self.time <= +new Date) {
  240. self.f();
  241. } else {
  242. setTimeout(self.handler, self.time - +new Date);
  243. }
  244. };
  245. Delayed.prototype.set = function (ms, f) {
  246. this.f = f;
  247. var time = +new Date + ms;
  248. if (!this.id || time < this.time) {
  249. clearTimeout(this.id);
  250. this.id = setTimeout(this.handler, ms);
  251. this.time = time;
  252. }
  253. };
  254. function indexOf(array, elt) {
  255. for (var i = 0; i < array.length; ++i)
  256. { if (array[i] == elt) { return i } }
  257. return -1
  258. }
  259. // Number of pixels added to scroller and sizer to hide scrollbar
  260. var scrollerGap = 50;
  261. // Returned or thrown by various protocols to signal 'I'm not
  262. // handling this'.
  263. var Pass = {toString: function(){return "CodeMirror.Pass"}};
  264. // Reused option objects for setSelection & friends
  265. var sel_dontScroll = {scroll: false}, sel_mouse = {origin: "*mouse"}, sel_move = {origin: "+move"};
  266. // The inverse of countColumn -- find the offset that corresponds to
  267. // a particular column.
  268. function findColumn(string, goal, tabSize) {
  269. for (var pos = 0, col = 0;;) {
  270. var nextTab = string.indexOf("\t", pos);
  271. if (nextTab == -1) { nextTab = string.length; }
  272. var skipped = nextTab - pos;
  273. if (nextTab == string.length || col + skipped >= goal)
  274. { return pos + Math.min(skipped, goal - col) }
  275. col += nextTab - pos;
  276. col += tabSize - (col % tabSize);
  277. pos = nextTab + 1;
  278. if (col >= goal) { return pos }
  279. }
  280. }
  281. var spaceStrs = [""];
  282. function spaceStr(n) {
  283. while (spaceStrs.length <= n)
  284. { spaceStrs.push(lst(spaceStrs) + " "); }
  285. return spaceStrs[n]
  286. }
  287. function lst(arr) { return arr[arr.length-1] }
  288. function map(array, f) {
  289. var out = [];
  290. for (var i = 0; i < array.length; i++) { out[i] = f(array[i], i); }
  291. return out
  292. }
  293. function insertSorted(array, value, score) {
  294. var pos = 0, priority = score(value);
  295. while (pos < array.length && score(array[pos]) <= priority) { pos++; }
  296. array.splice(pos, 0, value);
  297. }
  298. function nothing() {}
  299. function createObj(base, props) {
  300. var inst;
  301. if (Object.create) {
  302. inst = Object.create(base);
  303. } else {
  304. nothing.prototype = base;
  305. inst = new nothing();
  306. }
  307. if (props) { copyObj(props, inst); }
  308. return inst
  309. }
  310. var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;
  311. function isWordCharBasic(ch) {
  312. return /\w/.test(ch) || ch > "\x80" &&
  313. (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))
  314. }
  315. function isWordChar(ch, helper) {
  316. if (!helper) { return isWordCharBasic(ch) }
  317. if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) { return true }
  318. return helper.test(ch)
  319. }
  320. function isEmpty(obj) {
  321. for (var n in obj) { if (obj.hasOwnProperty(n) && obj[n]) { return false } }
  322. return true
  323. }
  324. // Extending unicode characters. A series of a non-extending char +
  325. // any number of extending chars is treated as a single unit as far
  326. // as editing and measuring is concerned. This is not fully correct,
  327. // since some scripts/fonts/browsers also treat other configurations
  328. // of code points as a group.
  329. var extendingChars = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;
  330. function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) }
  331. // Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range.
  332. function skipExtendingChars(str, pos, dir) {
  333. while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir; }
  334. return pos
  335. }
  336. // Returns the value from the range [`from`; `to`] that satisfies
  337. // `pred` and is closest to `from`. Assumes that at least `to`
  338. // satisfies `pred`. Supports `from` being greater than `to`.
  339. function findFirst(pred, from, to) {
  340. // At any point we are certain `to` satisfies `pred`, don't know
  341. // whether `from` does.
  342. var dir = from > to ? -1 : 1;
  343. for (;;) {
  344. if (from == to) { return from }
  345. var midF = (from + to) / 2, mid = dir < 0 ? Math.ceil(midF) : Math.floor(midF);
  346. if (mid == from) { return pred(mid) ? from : to }
  347. if (pred(mid)) { to = mid; }
  348. else { from = mid + dir; }
  349. }
  350. }
  351. // BIDI HELPERS
  352. function iterateBidiSections(order, from, to, f) {
  353. if (!order) { return f(from, to, "ltr", 0) }
  354. var found = false;
  355. for (var i = 0; i < order.length; ++i) {
  356. var part = order[i];
  357. if (part.from < to && part.to > from || from == to && part.to == from) {
  358. f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr", i);
  359. found = true;
  360. }
  361. }
  362. if (!found) { f(from, to, "ltr"); }
  363. }
  364. var bidiOther = null;
  365. function getBidiPartAt(order, ch, sticky) {
  366. var found;
  367. bidiOther = null;
  368. for (var i = 0; i < order.length; ++i) {
  369. var cur = order[i];
  370. if (cur.from < ch && cur.to > ch) { return i }
  371. if (cur.to == ch) {
  372. if (cur.from != cur.to && sticky == "before") { found = i; }
  373. else { bidiOther = i; }
  374. }
  375. if (cur.from == ch) {
  376. if (cur.from != cur.to && sticky != "before") { found = i; }
  377. else { bidiOther = i; }
  378. }
  379. }
  380. return found != null ? found : bidiOther
  381. }
  382. // Bidirectional ordering algorithm
  383. // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm
  384. // that this (partially) implements.
  385. // One-char codes used for character types:
  386. // L (L): Left-to-Right
  387. // R (R): Right-to-Left
  388. // r (AL): Right-to-Left Arabic
  389. // 1 (EN): European Number
  390. // + (ES): European Number Separator
  391. // % (ET): European Number Terminator
  392. // n (AN): Arabic Number
  393. // , (CS): Common Number Separator
  394. // m (NSM): Non-Spacing Mark
  395. // b (BN): Boundary Neutral
  396. // s (B): Paragraph Separator
  397. // t (S): Segment Separator
  398. // w (WS): Whitespace
  399. // N (ON): Other Neutrals
  400. // Returns null if characters are ordered as they appear
  401. // (left-to-right), or an array of sections ({from, to, level}
  402. // objects) in the order in which they occur visually.
  403. var bidiOrdering = (function() {
  404. // Character types for codepoints 0 to 0xff
  405. var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";
  406. // Character types for codepoints 0x600 to 0x6f9
  407. var arabicTypes = "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";
  408. function charType(code) {
  409. if (code <= 0xf7) { return lowTypes.charAt(code) }
  410. else if (0x590 <= code && code <= 0x5f4) { return "R" }
  411. else if (0x600 <= code && code <= 0x6f9) { return arabicTypes.charAt(code - 0x600) }
  412. else if (0x6ee <= code && code <= 0x8ac) { return "r" }
  413. else if (0x2000 <= code && code <= 0x200b) { return "w" }
  414. else if (code == 0x200c) { return "b" }
  415. else { return "L" }
  416. }
  417. var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
  418. var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;
  419. function BidiSpan(level, from, to) {
  420. this.level = level;
  421. this.from = from; this.to = to;
  422. }
  423. return function(str, direction) {
  424. var outerType = direction == "ltr" ? "L" : "R";
  425. if (str.length == 0 || direction == "ltr" && !bidiRE.test(str)) { return false }
  426. var len = str.length, types = [];
  427. for (var i = 0; i < len; ++i)
  428. { types.push(charType(str.charCodeAt(i))); }
  429. // W1. Examine each non-spacing mark (NSM) in the level run, and
  430. // change the type of the NSM to the type of the previous
  431. // character. If the NSM is at the start of the level run, it will
  432. // get the type of sor.
  433. for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) {
  434. var type = types[i$1];
  435. if (type == "m") { types[i$1] = prev; }
  436. else { prev = type; }
  437. }
  438. // W2. Search backwards from each instance of a European number
  439. // until the first strong type (R, L, AL, or sor) is found. If an
  440. // AL is found, change the type of the European number to Arabic
  441. // number.
  442. // W3. Change all ALs to R.
  443. for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) {
  444. var type$1 = types[i$2];
  445. if (type$1 == "1" && cur == "r") { types[i$2] = "n"; }
  446. else if (isStrong.test(type$1)) { cur = type$1; if (type$1 == "r") { types[i$2] = "R"; } }
  447. }
  448. // W4. A single European separator between two European numbers
  449. // changes to a European number. A single common separator between
  450. // two numbers of the same type changes to that type.
  451. for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) {
  452. var type$2 = types[i$3];
  453. if (type$2 == "+" && prev$1 == "1" && types[i$3+1] == "1") { types[i$3] = "1"; }
  454. else if (type$2 == "," && prev$1 == types[i$3+1] &&
  455. (prev$1 == "1" || prev$1 == "n")) { types[i$3] = prev$1; }
  456. prev$1 = type$2;
  457. }
  458. // W5. A sequence of European terminators adjacent to European
  459. // numbers changes to all European numbers.
  460. // W6. Otherwise, separators and terminators change to Other
  461. // Neutral.
  462. for (var i$4 = 0; i$4 < len; ++i$4) {
  463. var type$3 = types[i$4];
  464. if (type$3 == ",") { types[i$4] = "N"; }
  465. else if (type$3 == "%") {
  466. var end = (void 0);
  467. for (end = i$4 + 1; end < len && types[end] == "%"; ++end) {}
  468. var replace = (i$4 && types[i$4-1] == "!") || (end < len && types[end] == "1") ? "1" : "N";
  469. for (var j = i$4; j < end; ++j) { types[j] = replace; }
  470. i$4 = end - 1;
  471. }
  472. }
  473. // W7. Search backwards from each instance of a European number
  474. // until the first strong type (R, L, or sor) is found. If an L is
  475. // found, then change the type of the European number to L.
  476. for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) {
  477. var type$4 = types[i$5];
  478. if (cur$1 == "L" && type$4 == "1") { types[i$5] = "L"; }
  479. else if (isStrong.test(type$4)) { cur$1 = type$4; }
  480. }
  481. // N1. A sequence of neutrals takes the direction of the
  482. // surrounding strong text if the text on both sides has the same
  483. // direction. European and Arabic numbers act as if they were R in
  484. // terms of their influence on neutrals. Start-of-level-run (sor)
  485. // and end-of-level-run (eor) are used at level run boundaries.
  486. // N2. Any remaining neutrals take the embedding direction.
  487. for (var i$6 = 0; i$6 < len; ++i$6) {
  488. if (isNeutral.test(types[i$6])) {
  489. var end$1 = (void 0);
  490. for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {}
  491. var before = (i$6 ? types[i$6-1] : outerType) == "L";
  492. var after = (end$1 < len ? types[end$1] : outerType) == "L";
  493. var replace$1 = before == after ? (before ? "L" : "R") : outerType;
  494. for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1; }
  495. i$6 = end$1 - 1;
  496. }
  497. }
  498. // Here we depart from the documented algorithm, in order to avoid
  499. // building up an actual levels array. Since there are only three
  500. // levels (0, 1, 2) in an implementation that doesn't take
  501. // explicit embedding into account, we can build up the order on
  502. // the fly, without following the level-based algorithm.
  503. var order = [], m;
  504. for (var i$7 = 0; i$7 < len;) {
  505. if (countsAsLeft.test(types[i$7])) {
  506. var start = i$7;
  507. for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {}
  508. order.push(new BidiSpan(0, start, i$7));
  509. } else {
  510. var pos = i$7, at = order.length, isRTL = direction == "rtl" ? 1 : 0;
  511. for (++i$7; i$7 < len && types[i$7] != "L"; ++i$7) {}
  512. for (var j$2 = pos; j$2 < i$7;) {
  513. if (countsAsNum.test(types[j$2])) {
  514. if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)); at += isRTL; }
  515. var nstart = j$2;
  516. for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {}
  517. order.splice(at, 0, new BidiSpan(2, nstart, j$2));
  518. at += isRTL;
  519. pos = j$2;
  520. } else { ++j$2; }
  521. }
  522. if (pos < i$7) { order.splice(at, 0, new BidiSpan(1, pos, i$7)); }
  523. }
  524. }
  525. if (direction == "ltr") {
  526. if (order[0].level == 1 && (m = str.match(/^\s+/))) {
  527. order[0].from = m[0].length;
  528. order.unshift(new BidiSpan(0, 0, m[0].length));
  529. }
  530. if (lst(order).level == 1 && (m = str.match(/\s+$/))) {
  531. lst(order).to -= m[0].length;
  532. order.push(new BidiSpan(0, len - m[0].length, len));
  533. }
  534. }
  535. return direction == "rtl" ? order.reverse() : order
  536. }
  537. })();
  538. // Get the bidi ordering for the given line (and cache it). Returns
  539. // false for lines that are fully left-to-right, and an array of
  540. // BidiSpan objects otherwise.
  541. function getOrder(line, direction) {
  542. var order = line.order;
  543. if (order == null) { order = line.order = bidiOrdering(line.text, direction); }
  544. return order
  545. }
  546. // EVENT HANDLING
  547. // Lightweight event framework. on/off also work on DOM nodes,
  548. // registering native DOM handlers.
  549. var noHandlers = [];
  550. var on = function(emitter, type, f) {
  551. if (emitter.addEventListener) {
  552. emitter.addEventListener(type, f, false);
  553. } else if (emitter.attachEvent) {
  554. emitter.attachEvent("on" + type, f);
  555. } else {
  556. var map = emitter._handlers || (emitter._handlers = {});
  557. map[type] = (map[type] || noHandlers).concat(f);
  558. }
  559. };
  560. function getHandlers(emitter, type) {
  561. return emitter._handlers && emitter._handlers[type] || noHandlers
  562. }
  563. function off(emitter, type, f) {
  564. if (emitter.removeEventListener) {
  565. emitter.removeEventListener(type, f, false);
  566. } else if (emitter.detachEvent) {
  567. emitter.detachEvent("on" + type, f);
  568. } else {
  569. var map = emitter._handlers, arr = map && map[type];
  570. if (arr) {
  571. var index = indexOf(arr, f);
  572. if (index > -1)
  573. { map[type] = arr.slice(0, index).concat(arr.slice(index + 1)); }
  574. }
  575. }
  576. }
  577. function signal(emitter, type /*, values...*/) {
  578. var handlers = getHandlers(emitter, type);
  579. if (!handlers.length) { return }
  580. var args = Array.prototype.slice.call(arguments, 2);
  581. for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args); }
  582. }
  583. // The DOM events that CodeMirror handles can be overridden by
  584. // registering a (non-DOM) handler on the editor for the event name,
  585. // and preventDefault-ing the event in that handler.
  586. function signalDOMEvent(cm, e, override) {
  587. if (typeof e == "string")
  588. { e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; }
  589. signal(cm, override || e.type, cm, e);
  590. return e_defaultPrevented(e) || e.codemirrorIgnore
  591. }
  592. function signalCursorActivity(cm) {
  593. var arr = cm._handlers && cm._handlers.cursorActivity;
  594. if (!arr) { return }
  595. var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []);
  596. for (var i = 0; i < arr.length; ++i) { if (indexOf(set, arr[i]) == -1)
  597. { set.push(arr[i]); } }
  598. }
  599. function hasHandler(emitter, type) {
  600. return getHandlers(emitter, type).length > 0
  601. }
  602. // Add on and off methods to a constructor's prototype, to make
  603. // registering events on such objects more convenient.
  604. function eventMixin(ctor) {
  605. ctor.prototype.on = function(type, f) {on(this, type, f);};
  606. ctor.prototype.off = function(type, f) {off(this, type, f);};
  607. }
  608. // Due to the fact that we still support jurassic IE versions, some
  609. // compatibility wrappers are needed.
  610. function e_preventDefault(e) {
  611. if (e.preventDefault) { e.preventDefault(); }
  612. else { e.returnValue = false; }
  613. }
  614. function e_stopPropagation(e) {
  615. if (e.stopPropagation) { e.stopPropagation(); }
  616. else { e.cancelBubble = true; }
  617. }
  618. function e_defaultPrevented(e) {
  619. return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false
  620. }
  621. function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}
  622. function e_target(e) {return e.target || e.srcElement}
  623. function e_button(e) {
  624. var b = e.which;
  625. if (b == null) {
  626. if (e.button & 1) { b = 1; }
  627. else if (e.button & 2) { b = 3; }
  628. else if (e.button & 4) { b = 2; }
  629. }
  630. if (mac && e.ctrlKey && b == 1) { b = 3; }
  631. return b
  632. }
  633. // Detect drag-and-drop
  634. var dragAndDrop = function() {
  635. // There is *some* kind of drag-and-drop support in IE6-8, but I
  636. // couldn't get it to work yet.
  637. if (ie && ie_version < 9) { return false }
  638. var div = elt('div');
  639. return "draggable" in div || "dragDrop" in div
  640. }();
  641. var zwspSupported;
  642. function zeroWidthElement(measure) {
  643. if (zwspSupported == null) {
  644. var test = elt("span", "\u200b");
  645. removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]));
  646. if (measure.firstChild.offsetHeight != 0)
  647. { zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8); }
  648. }
  649. var node = zwspSupported ? elt("span", "\u200b") :
  650. elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px");
  651. node.setAttribute("cm-text", "");
  652. return node
  653. }
  654. // Feature-detect IE's crummy client rect reporting for bidi text
  655. var badBidiRects;
  656. function hasBadBidiRects(measure) {
  657. if (badBidiRects != null) { return badBidiRects }
  658. var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA"));
  659. var r0 = range(txt, 0, 1).getBoundingClientRect();
  660. var r1 = range(txt, 1, 2).getBoundingClientRect();
  661. removeChildren(measure);
  662. if (!r0 || r0.left == r0.right) { return false } // Safari returns null in some cases (#2780)
  663. return badBidiRects = (r1.right - r0.right < 3)
  664. }
  665. // See if "".split is the broken IE version, if so, provide an
  666. // alternative way to split lines.
  667. var splitLinesAuto = "\n\nb".split(/\n/).length != 3 ? function (string) {
  668. var pos = 0, result = [], l = string.length;
  669. while (pos <= l) {
  670. var nl = string.indexOf("\n", pos);
  671. if (nl == -1) { nl = string.length; }
  672. var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl);
  673. var rt = line.indexOf("\r");
  674. if (rt != -1) {
  675. result.push(line.slice(0, rt));
  676. pos += rt + 1;
  677. } else {
  678. result.push(line);
  679. pos = nl + 1;
  680. }
  681. }
  682. return result
  683. } : function (string) { return string.split(/\r\n?|\n/); };
  684. var hasSelection = window.getSelection ? function (te) {
  685. try { return te.selectionStart != te.selectionEnd }
  686. catch(e) { return false }
  687. } : function (te) {
  688. var range;
  689. try {range = te.ownerDocument.selection.createRange();}
  690. catch(e) {}
  691. if (!range || range.parentElement() != te) { return false }
  692. return range.compareEndPoints("StartToEnd", range) != 0
  693. };
  694. var hasCopyEvent = (function () {
  695. var e = elt("div");
  696. if ("oncopy" in e) { return true }
  697. e.setAttribute("oncopy", "return;");
  698. return typeof e.oncopy == "function"
  699. })();
  700. var badZoomedRects = null;
  701. function hasBadZoomedRects(measure) {
  702. if (badZoomedRects != null) { return badZoomedRects }
  703. var node = removeChildrenAndAdd(measure, elt("span", "x"));
  704. var normal = node.getBoundingClientRect();
  705. var fromRange = range(node, 0, 1).getBoundingClientRect();
  706. return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1
  707. }
  708. // Known modes, by name and by MIME
  709. var modes = {}, mimeModes = {};
  710. // Extra arguments are stored as the mode's dependencies, which is
  711. // used by (legacy) mechanisms like loadmode.js to automatically
  712. // load a mode. (Preferred mechanism is the require/define calls.)
  713. function defineMode(name, mode) {
  714. if (arguments.length > 2)
  715. { mode.dependencies = Array.prototype.slice.call(arguments, 2); }
  716. modes[name] = mode;
  717. }
  718. function defineMIME(mime, spec) {
  719. mimeModes[mime] = spec;
  720. }
  721. // Given a MIME type, a {name, ...options} config object, or a name
  722. // string, return a mode config object.
  723. function resolveMode(spec) {
  724. if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
  725. spec = mimeModes[spec];
  726. } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
  727. var found = mimeModes[spec.name];
  728. if (typeof found == "string") { found = {name: found}; }
  729. spec = createObj(found, spec);
  730. spec.name = found.name;
  731. } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
  732. return resolveMode("application/xml")
  733. } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) {
  734. return resolveMode("application/json")
  735. }
  736. if (typeof spec == "string") { return {name: spec} }
  737. else { return spec || {name: "null"} }
  738. }
  739. // Given a mode spec (anything that resolveMode accepts), find and
  740. // initialize an actual mode object.
  741. function getMode(options, spec) {
  742. spec = resolveMode(spec);
  743. var mfactory = modes[spec.name];
  744. if (!mfactory) { return getMode(options, "text/plain") }
  745. var modeObj = mfactory(options, spec);
  746. if (modeExtensions.hasOwnProperty(spec.name)) {
  747. var exts = modeExtensions[spec.name];
  748. for (var prop in exts) {
  749. if (!exts.hasOwnProperty(prop)) { continue }
  750. if (modeObj.hasOwnProperty(prop)) { modeObj["_" + prop] = modeObj[prop]; }
  751. modeObj[prop] = exts[prop];
  752. }
  753. }
  754. modeObj.name = spec.name;
  755. if (spec.helperType) { modeObj.helperType = spec.helperType; }
  756. if (spec.modeProps) { for (var prop$1 in spec.modeProps)
  757. { modeObj[prop$1] = spec.modeProps[prop$1]; } }
  758. return modeObj
  759. }
  760. // This can be used to attach properties to mode objects from
  761. // outside the actual mode definition.
  762. var modeExtensions = {};
  763. function extendMode(mode, properties) {
  764. var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});
  765. copyObj(properties, exts);
  766. }
  767. function copyState(mode, state) {
  768. if (state === true) { return state }
  769. if (mode.copyState) { return mode.copyState(state) }
  770. var nstate = {};
  771. for (var n in state) {
  772. var val = state[n];
  773. if (val instanceof Array) { val = val.concat([]); }
  774. nstate[n] = val;
  775. }
  776. return nstate
  777. }
  778. // Given a mode and a state (for that mode), find the inner mode and
  779. // state at the position that the state refers to.
  780. function innerMode(mode, state) {
  781. var info;
  782. while (mode.innerMode) {
  783. info = mode.innerMode(state);
  784. if (!info || info.mode == mode) { break }
  785. state = info.state;
  786. mode = info.mode;
  787. }
  788. return info || {mode: mode, state: state}
  789. }
  790. function startState(mode, a1, a2) {
  791. return mode.startState ? mode.startState(a1, a2) : true
  792. }
  793. // STRING STREAM
  794. // Fed to the mode parsers, provides helper functions to make
  795. // parsers more succinct.
  796. var StringStream = function(string, tabSize, lineOracle) {
  797. this.pos = this.start = 0;
  798. this.string = string;
  799. this.tabSize = tabSize || 8;
  800. this.lastColumnPos = this.lastColumnValue = 0;
  801. this.lineStart = 0;
  802. this.lineOracle = lineOracle;
  803. };
  804. StringStream.prototype.eol = function () {return this.pos >= this.string.length};
  805. StringStream.prototype.sol = function () {return this.pos == this.lineStart};
  806. StringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined};
  807. StringStream.prototype.next = function () {
  808. if (this.pos < this.string.length)
  809. { return this.string.charAt(this.pos++) }
  810. };
  811. StringStream.prototype.eat = function (match) {
  812. var ch = this.string.charAt(this.pos);
  813. var ok;
  814. if (typeof match == "string") { ok = ch == match; }
  815. else { ok = ch && (match.test ? match.test(ch) : match(ch)); }
  816. if (ok) {++this.pos; return ch}
  817. };
  818. StringStream.prototype.eatWhile = function (match) {
  819. var start = this.pos;
  820. while (this.eat(match)){}
  821. return this.pos > start
  822. };
  823. StringStream.prototype.eatSpace = function () {
  824. var start = this.pos;
  825. while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) { ++this.pos; }
  826. return this.pos > start
  827. };
  828. StringStream.prototype.skipToEnd = function () {this.pos = this.string.length;};
  829. StringStream.prototype.skipTo = function (ch) {
  830. var found = this.string.indexOf(ch, this.pos);
  831. if (found > -1) {this.pos = found; return true}
  832. };
  833. StringStream.prototype.backUp = function (n) {this.pos -= n;};
  834. StringStream.prototype.column = function () {
  835. if (this.lastColumnPos < this.start) {
  836. this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);
  837. this.lastColumnPos = this.start;
  838. }
  839. return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
  840. };
  841. StringStream.prototype.indentation = function () {
  842. return countColumn(this.string, null, this.tabSize) -
  843. (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
  844. };
  845. StringStream.prototype.match = function (pattern, consume, caseInsensitive) {
  846. if (typeof pattern == "string") {
  847. var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; };
  848. var substr = this.string.substr(this.pos, pattern.length);
  849. if (cased(substr) == cased(pattern)) {
  850. if (consume !== false) { this.pos += pattern.length; }
  851. return true
  852. }
  853. } else {
  854. var match = this.string.slice(this.pos).match(pattern);
  855. if (match && match.index > 0) { return null }
  856. if (match && consume !== false) { this.pos += match[0].length; }
  857. return match
  858. }
  859. };
  860. StringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)};
  861. StringStream.prototype.hideFirstChars = function (n, inner) {
  862. this.lineStart += n;
  863. try { return inner() }
  864. finally { this.lineStart -= n; }
  865. };
  866. StringStream.prototype.lookAhead = function (n) {
  867. var oracle = this.lineOracle;
  868. return oracle && oracle.lookAhead(n)
  869. };
  870. StringStream.prototype.baseToken = function () {
  871. var oracle = this.lineOracle;
  872. return oracle && oracle.baseToken(this.pos)
  873. };
  874. // Find the line object corresponding to the given line number.
  875. function getLine(doc, n) {
  876. n -= doc.first;
  877. if (n < 0 || n >= doc.size) { throw new Error("There is no line " + (n + doc.first) + " in the document.") }
  878. var chunk = doc;
  879. while (!chunk.lines) {
  880. for (var i = 0;; ++i) {
  881. var child = chunk.children[i], sz = child.chunkSize();
  882. if (n < sz) { chunk = child; break }
  883. n -= sz;
  884. }
  885. }
  886. return chunk.lines[n]
  887. }
  888. // Get the part of a document between two positions, as an array of
  889. // strings.
  890. function getBetween(doc, start, end) {
  891. var out = [], n = start.line;
  892. doc.iter(start.line, end.line + 1, function (line) {
  893. var text = line.text;
  894. if (n == end.line) { text = text.slice(0, end.ch); }
  895. if (n == start.line) { text = text.slice(start.ch); }
  896. out.push(text);
  897. ++n;
  898. });
  899. return out
  900. }
  901. // Get the lines between from and to, as array of strings.
  902. function getLines(doc, from, to) {
  903. var out = [];
  904. doc.iter(from, to, function (line) { out.push(line.text); }); // iter aborts when callback returns truthy value
  905. return out
  906. }
  907. // Update the height of a line, propagating the height change
  908. // upwards to parent nodes.
  909. function updateLineHeight(line, height) {
  910. var diff = height - line.height;
  911. if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }
  912. }
  913. // Given a line object, find its line number by walking up through
  914. // its parent links.
  915. function lineNo(line) {
  916. if (line.parent == null) { return null }
  917. var cur = line.parent, no = indexOf(cur.lines, line);
  918. for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
  919. for (var i = 0;; ++i) {
  920. if (chunk.children[i] == cur) { break }
  921. no += chunk.children[i].chunkSize();
  922. }
  923. }
  924. return no + cur.first
  925. }
  926. // Find the line at the given vertical position, using the height
  927. // information in the document tree.
  928. function lineAtHeight(chunk, h) {
  929. var n = chunk.first;
  930. outer: do {
  931. for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) {
  932. var child = chunk.children[i$1], ch = child.height;
  933. if (h < ch) { chunk = child; continue outer }
  934. h -= ch;
  935. n += child.chunkSize();
  936. }
  937. return n
  938. } while (!chunk.lines)
  939. var i = 0;
  940. for (; i < chunk.lines.length; ++i) {
  941. var line = chunk.lines[i], lh = line.height;
  942. if (h < lh) { break }
  943. h -= lh;
  944. }
  945. return n + i
  946. }
  947. function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size}
  948. function lineNumberFor(options, i) {
  949. return String(options.lineNumberFormatter(i + options.firstLineNumber))
  950. }
  951. // A Pos instance represents a position within the text.
  952. function Pos(line, ch, sticky) {
  953. if ( sticky === void 0 ) sticky = null;
  954. if (!(this instanceof Pos)) { return new Pos(line, ch, sticky) }
  955. this.line = line;
  956. this.ch = ch;
  957. this.sticky = sticky;
  958. }
  959. // Compare two positions, return 0 if they are the same, a negative
  960. // number when a is less, and a positive number otherwise.
  961. function cmp(a, b) { return a.line - b.line || a.ch - b.ch }
  962. function equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 }
  963. function copyPos(x) {return Pos(x.line, x.ch)}
  964. function maxPos(a, b) { return cmp(a, b) < 0 ? b : a }
  965. function minPos(a, b) { return cmp(a, b) < 0 ? a : b }
  966. // Most of the external API clips given positions to make sure they
  967. // actually exist within the document.
  968. function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}
  969. function clipPos(doc, pos) {
  970. if (pos.line < doc.first) { return Pos(doc.first, 0) }
  971. var last = doc.first + doc.size - 1;
  972. if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) }
  973. return clipToLen(pos, getLine(doc, pos.line).text.length)
  974. }
  975. function clipToLen(pos, linelen) {
  976. var ch = pos.ch;
  977. if (ch == null || ch > linelen) { return Pos(pos.line, linelen) }
  978. else if (ch < 0) { return Pos(pos.line, 0) }
  979. else { return pos }
  980. }
  981. function clipPosArray(doc, array) {
  982. var out = [];
  983. for (var i = 0; i < array.length; i++) { out[i] = clipPos(doc, array[i]); }
  984. return out
  985. }
  986. var SavedContext = function(state, lookAhead) {
  987. this.state = state;
  988. this.lookAhead = lookAhead;
  989. };
  990. var Context = function(doc, state, line, lookAhead) {
  991. this.state = state;
  992. this.doc = doc;
  993. this.line = line;
  994. this.maxLookAhead = lookAhead || 0;
  995. this.baseTokens = null;
  996. this.baseTokenPos = 1;
  997. };
  998. Context.prototype.lookAhead = function (n) {
  999. var line = this.doc.getLine(this.line + n);
  1000. if (line != null && n > this.maxLookAhead) { this.maxLookAhead = n; }
  1001. return line
  1002. };
  1003. Context.prototype.baseToken = function (n) {
  1004. if (!this.baseTokens) { return null }
  1005. while (this.baseTokens[this.baseTokenPos] <= n)
  1006. { this.baseTokenPos += 2; }
  1007. var type = this.baseTokens[this.baseTokenPos + 1];
  1008. return {type: type && type.replace(/( |^)overlay .*/, ""),
  1009. size: this.baseTokens[this.baseTokenPos] - n}
  1010. };
  1011. Context.prototype.nextLine = function () {
  1012. this.line++;
  1013. if (this.maxLookAhead > 0) { this.maxLookAhead--; }
  1014. };
  1015. Context.fromSaved = function (doc, saved, line) {
  1016. if (saved instanceof SavedContext)
  1017. { return new Context(doc, copyState(doc.mode, saved.state), line, saved.lookAhead) }
  1018. else
  1019. { return new Context(doc, copyState(doc.mode, saved), line) }
  1020. };
  1021. Context.prototype.save = function (copy) {
  1022. var state = copy !== false ? copyState(this.doc.mode, this.state) : this.state;
  1023. return this.maxLookAhead > 0 ? new SavedContext(state, this.maxLookAhead) : state
  1024. };
  1025. // Compute a style array (an array starting with a mode generation
  1026. // -- for invalidation -- followed by pairs of end positions and
  1027. // style strings), which is used to highlight the tokens on the
  1028. // line.
  1029. function highlightLine(cm, line, context, forceToEnd) {
  1030. // A styles array always starts with a number identifying the
  1031. // mode/overlays that it is based on (for easy invalidation).
  1032. var st = [cm.state.modeGen], lineClasses = {};
  1033. // Compute the base array of styles
  1034. runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },
  1035. lineClasses, forceToEnd);
  1036. var state = context.state;
  1037. // Run overlays, adjust style array.
  1038. var loop = function ( o ) {
  1039. context.baseTokens = st;
  1040. var overlay = cm.state.overlays[o], i = 1, at = 0;
  1041. context.state = true;
  1042. runMode(cm, line.text, overlay.mode, context, function (end, style) {
  1043. var start = i;
  1044. // Ensure there's a token end at the current position, and that i points at it
  1045. while (at < end) {
  1046. var i_end = st[i];
  1047. if (i_end > end)
  1048. { st.splice(i, 1, end, st[i+1], i_end); }
  1049. i += 2;
  1050. at = Math.min(end, i_end);
  1051. }
  1052. if (!style) { return }
  1053. if (overlay.opaque) {
  1054. st.splice(start, i - start, end, "overlay " + style);
  1055. i = start + 2;
  1056. } else {
  1057. for (; start < i; start += 2) {
  1058. var cur = st[start+1];
  1059. st[start+1] = (cur ? cur + " " : "") + "overlay " + style;
  1060. }
  1061. }
  1062. }, lineClasses);
  1063. context.state = state;
  1064. context.baseTokens = null;
  1065. context.baseTokenPos = 1;
  1066. };
  1067. for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );
  1068. return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}
  1069. }
  1070. function getLineStyles(cm, line, updateFrontier) {
  1071. if (!line.styles || line.styles[0] != cm.state.modeGen) {
  1072. var context = getContextBefore(cm, lineNo(line));
  1073. var resetState = line.text.length > cm.options.maxHighlightLength && copyState(cm.doc.mode, context.state);
  1074. var result = highlightLine(cm, line, context);
  1075. if (resetState) { context.state = resetState; }
  1076. line.stateAfter = context.save(!resetState);
  1077. line.styles = result.styles;
  1078. if (result.classes) { line.styleClasses = result.classes; }
  1079. else if (line.styleClasses) { line.styleClasses = null; }
  1080. if (updateFrontier === cm.doc.highlightFrontier)
  1081. { cm.doc.modeFrontier = Math.max(cm.doc.modeFrontier, ++cm.doc.highlightFrontier); }
  1082. }
  1083. return line.styles
  1084. }
  1085. function getContextBefore(cm, n, precise) {
  1086. var doc = cm.doc, display = cm.display;
  1087. if (!doc.mode.startState) { return new Context(doc, true, n) }
  1088. var start = findStartLine(cm, n, precise);
  1089. var saved = start > doc.first && getLine(doc, start - 1).stateAfter;
  1090. var context = saved ? Context.fromSaved(doc, saved, start) : new Context(doc, startState(doc.mode), start);
  1091. doc.iter(start, n, function (line) {
  1092. processLine(cm, line.text, context);
  1093. var pos = context.line;
  1094. line.stateAfter = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo ? context.save() : null;
  1095. context.nextLine();
  1096. });
  1097. if (precise) { doc.modeFrontier = context.line; }
  1098. return context
  1099. }
  1100. // Lightweight form of highlight -- proceed over this line and
  1101. // update state, but don't save a style array. Used for lines that
  1102. // aren't currently visible.
  1103. function processLine(cm, text, context, startAt) {
  1104. var mode = cm.doc.mode;
  1105. var stream = new StringStream(text, cm.options.tabSize, context);
  1106. stream.start = stream.pos = startAt || 0;
  1107. if (text == "") { callBlankLine(mode, context.state); }
  1108. while (!stream.eol()) {
  1109. readToken(mode, stream, context.state);
  1110. stream.start = stream.pos;
  1111. }
  1112. }
  1113. function callBlankLine(mode, state) {
  1114. if (mode.blankLine) { return mode.blankLine(state) }
  1115. if (!mode.innerMode) { return }
  1116. var inner = innerMode(mode, state);
  1117. if (inner.mode.blankLine) { return inner.mode.blankLine(inner.state) }
  1118. }
  1119. function readToken(mode, stream, state, inner) {
  1120. for (var i = 0; i < 10; i++) {
  1121. if (inner) { inner[0] = innerMode(mode, state).mode; }
  1122. var style = mode.token(stream, state);
  1123. if (stream.pos > stream.start) { return style }
  1124. }
  1125. throw new Error("Mode " + mode.name + " failed to advance stream.")
  1126. }
  1127. var Token = function(stream, type, state) {
  1128. this.start = stream.start; this.end = stream.pos;
  1129. this.string = stream.current();
  1130. this.type = type || null;
  1131. this.state = state;
  1132. };
  1133. // Utility for getTokenAt and getLineTokens
  1134. function takeToken(cm, pos, precise, asArray) {
  1135. var doc = cm.doc, mode = doc.mode, style;
  1136. pos = clipPos(doc, pos);
  1137. var line = getLine(doc, pos.line), context = getContextBefore(cm, pos.line, precise);
  1138. var stream = new StringStream(line.text, cm.options.tabSize, context), tokens;
  1139. if (asArray) { tokens = []; }
  1140. while ((asArray || stream.pos < pos.ch) && !stream.eol()) {
  1141. stream.start = stream.pos;
  1142. style = readToken(mode, stream, context.state);
  1143. if (asArray) { tokens.push(new Token(stream, style, copyState(doc.mode, context.state))); }
  1144. }
  1145. return asArray ? tokens : new Token(stream, style, context.state)
  1146. }
  1147. function extractLineClasses(type, output) {
  1148. if (type) { for (;;) {
  1149. var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/);
  1150. if (!lineClass) { break }
  1151. type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length);
  1152. var prop = lineClass[1] ? "bgClass" : "textClass";
  1153. if (output[prop] == null)
  1154. { output[prop] = lineClass[2]; }
  1155. else if (!(new RegExp("(?:^|\\s)" + lineClass[2] + "(?:$|\\s)")).test(output[prop]))
  1156. { output[prop] += " " + lineClass[2]; }
  1157. } }
  1158. return type
  1159. }
  1160. // Run the given mode's parser over a line, calling f for each token.
  1161. function runMode(cm, text, mode, context, f, lineClasses, forceToEnd) {
  1162. var flattenSpans = mode.flattenSpans;
  1163. if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans; }
  1164. var curStart = 0, curStyle = null;
  1165. var stream = new StringStream(text, cm.options.tabSize, context), style;
  1166. var inner = cm.options.addModeClass && [null];
  1167. if (text == "") { extractLineClasses(callBlankLine(mode, context.state), lineClasses); }
  1168. while (!stream.eol()) {
  1169. if (stream.pos > cm.options.maxHighlightLength) {
  1170. flattenSpans = false;
  1171. if (forceToEnd) { processLine(cm, text, context, stream.pos); }
  1172. stream.pos = text.length;
  1173. style = null;
  1174. } else {
  1175. style = extractLineClasses(readToken(mode, stream, context.state, inner), lineClasses);
  1176. }
  1177. if (inner) {
  1178. var mName = inner[0].name;
  1179. if (mName) { style = "m-" + (style ? mName + " " + style : mName); }
  1180. }
  1181. if (!flattenSpans || curStyle != style) {
  1182. while (curStart < stream.start) {
  1183. curStart = Math.min(stream.start, curStart + 5000);
  1184. f(curStart, curStyle);
  1185. }
  1186. curStyle = style;
  1187. }
  1188. stream.start = stream.pos;
  1189. }
  1190. while (curStart < stream.pos) {
  1191. // Webkit seems to refuse to render text nodes longer than 57444
  1192. // characters, and returns inaccurate measurements in nodes
  1193. // starting around 5000 chars.
  1194. var pos = Math.min(stream.pos, curStart + 5000);
  1195. f(pos, curStyle);
  1196. curStart = pos;
  1197. }
  1198. }
  1199. // Finds the line to start with when starting a parse. Tries to
  1200. // find a line with a stateAfter, so that it can start with a
  1201. // valid state. If that fails, it returns the line with the
  1202. // smallest indentation, which tends to need the least context to
  1203. // parse correctly.
  1204. function findStartLine(cm, n, precise) {
  1205. var minindent, minline, doc = cm.doc;
  1206. var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);
  1207. for (var search = n; search > lim; --search) {
  1208. if (search <= doc.first) { return doc.first }
  1209. var line = getLine(doc, search - 1), after = line.stateAfter;
  1210. if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier))
  1211. { return search }
  1212. var indented = countColumn(line.text, null, cm.options.tabSize);
  1213. if (minline == null || minindent > indented) {
  1214. minline = search - 1;
  1215. minindent = indented;
  1216. }
  1217. }
  1218. return minline
  1219. }
  1220. function retreatFrontier(doc, n) {
  1221. doc.modeFrontier = Math.min(doc.modeFrontier, n);
  1222. if (doc.highlightFrontier < n - 10) { return }
  1223. var start = doc.first;
  1224. for (var line = n - 1; line > start; line--) {
  1225. var saved = getLine(doc, line).stateAfter;
  1226. // change is on 3
  1227. // state on line 1 looked ahead 2 -- so saw 3
  1228. // test 1 + 2 < 3 should cover this
  1229. if (saved && (!(saved instanceof SavedContext) || line + saved.lookAhead < n)) {
  1230. start = line + 1;
  1231. break
  1232. }
  1233. }
  1234. doc.highlightFrontier = Math.min(doc.highlightFrontier, start);
  1235. }
  1236. // Optimize some code when these features are not used.
  1237. var sawReadOnlySpans = false, sawCollapsedSpans = false;
  1238. function seeReadOnlySpans() {
  1239. sawReadOnlySpans = true;
  1240. }
  1241. function seeCollapsedSpans() {
  1242. sawCollapsedSpans = true;
  1243. }
  1244. // TEXTMARKER SPANS
  1245. function MarkedSpan(marker, from, to) {
  1246. this.marker = marker;
  1247. this.from = from; this.to = to;
  1248. }
  1249. // Search an array of spans for a span matching the given marker.
  1250. function getMarkedSpanFor(spans, marker) {
  1251. if (spans) { for (var i = 0; i < spans.length; ++i) {
  1252. var span = spans[i];
  1253. if (span.marker == marker) { return span }
  1254. } }
  1255. }
  1256. // Remove a span from an array, returning undefined if no spans are
  1257. // left (we don't store arrays for lines without spans).
  1258. function removeMarkedSpan(spans, span) {
  1259. var r;
  1260. for (var i = 0; i < spans.length; ++i)
  1261. { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }
  1262. return r
  1263. }
  1264. // Add a span to a line.
  1265. function addMarkedSpan(line, span) {
  1266. line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];
  1267. span.marker.attachLine(line);
  1268. }
  1269. // Used for the algorithm that adjusts markers for a change in the
  1270. // document. These functions cut an array of spans at a given
  1271. // character position, returning an array of remaining chunks (or
  1272. // undefined if nothing remains).
  1273. function markedSpansBefore(old, startCh, isInsert) {
  1274. var nw;
  1275. if (old) { for (var i = 0; i < old.length; ++i) {
  1276. var span = old[i], marker = span.marker;
  1277. var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);
  1278. if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) {
  1279. var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh)
  1280. ;(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to));
  1281. }
  1282. } }
  1283. return nw
  1284. }
  1285. function markedSpansAfter(old, endCh, isInsert) {
  1286. var nw;
  1287. if (old) { for (var i = 0; i < old.length; ++i) {
  1288. var span = old[i], marker = span.marker;
  1289. var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);
  1290. if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) {
  1291. var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh)
  1292. ;(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,
  1293. span.to == null ? null : span.to - endCh));
  1294. }
  1295. } }
  1296. return nw
  1297. }
  1298. // Given a change object, compute the new set of marker spans that
  1299. // cover the line in which the change took place. Removes spans
  1300. // entirely within the change, reconnects spans belonging to the
  1301. // same marker that appear on both sides of the change, and cuts off
  1302. // spans partially within the change. Returns an array of span
  1303. // arrays with one element for each line in (after) the change.
  1304. function stretchSpansOverChange(doc, change) {
  1305. if (change.full) { return null }
  1306. var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;
  1307. var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;
  1308. if (!oldFirst && !oldLast) { return null }
  1309. var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;
  1310. // Get the spans that 'stick out' on both sides
  1311. var first = markedSpansBefore(oldFirst, startCh, isInsert);
  1312. var last = markedSpansAfter(oldLast, endCh, isInsert);
  1313. // Next, merge those two ends
  1314. var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);
  1315. if (first) {
  1316. // Fix up .to properties of first
  1317. for (var i = 0; i < first.length; ++i) {
  1318. var span = first[i];
  1319. if (span.to == null) {
  1320. var found = getMarkedSpanFor(last, span.marker);
  1321. if (!found) { span.to = startCh; }
  1322. else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }
  1323. }
  1324. }
  1325. }
  1326. if (last) {
  1327. // Fix up .from in last (or move them into first in case of sameLine)
  1328. for (var i$1 = 0; i$1 < last.length; ++i$1) {
  1329. var span$1 = last[i$1];
  1330. if (span$1.to != null) { span$1.to += offset; }
  1331. if (span$1.from == null) {
  1332. var found$1 = getMarkedSpanFor(first, span$1.marker);
  1333. if (!found$1) {
  1334. span$1.from = offset;
  1335. if (sameLine) { (first || (first = [])).push(span$1); }
  1336. }
  1337. } else {
  1338. span$1.from += offset;
  1339. if (sameLine) { (first || (first = [])).push(span$1); }
  1340. }
  1341. }
  1342. }
  1343. // Make sure we didn't create any zero-length spans
  1344. if (first) { first = clearEmptySpans(first); }
  1345. if (last && last != first) { last = clearEmptySpans(last); }
  1346. var newMarkers = [first];
  1347. if (!sameLine) {
  1348. // Fill gap with whole-line-spans
  1349. var gap = change.text.length - 2, gapMarkers;
  1350. if (gap > 0 && first)
  1351. { for (var i$2 = 0; i$2 < first.length; ++i$2)
  1352. { if (first[i$2].to == null)
  1353. { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }
  1354. for (var i$3 = 0; i$3 < gap; ++i$3)
  1355. { newMarkers.push(gapMarkers); }
  1356. newMarkers.push(last);
  1357. }
  1358. return newMarkers
  1359. }
  1360. // Remove spans that are empty and don't have a clearWhenEmpty
  1361. // option of false.
  1362. function clearEmptySpans(spans) {
  1363. for (var i = 0; i < spans.length; ++i) {
  1364. var span = spans[i];
  1365. if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)
  1366. { spans.splice(i--, 1); }
  1367. }
  1368. if (!spans.length) { return null }
  1369. return spans
  1370. }
  1371. // Used to 'clip' out readOnly ranges when making a change.
  1372. function removeReadOnlyRanges(doc, from, to) {
  1373. var markers = null;
  1374. doc.iter(from.line, to.line + 1, function (line) {
  1375. if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
  1376. var mark = line.markedSpans[i].marker;
  1377. if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))
  1378. { (markers || (markers = [])).push(mark); }
  1379. } }
  1380. });
  1381. if (!markers) { return null }
  1382. var parts = [{from: from, to: to}];
  1383. for (var i = 0; i < markers.length; ++i) {
  1384. var mk = markers[i], m = mk.find(0);
  1385. for (var j = 0; j < parts.length; ++j) {
  1386. var p = parts[j];
  1387. if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue }
  1388. var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to);
  1389. if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)
  1390. { newParts.push({from: p.from, to: m.from}); }
  1391. if (dto > 0 || !mk.inclusiveRight && !dto)
  1392. { newParts.push({from: m.to, to: p.to}); }
  1393. parts.splice.apply(parts, newParts);
  1394. j += newParts.length - 3;
  1395. }
  1396. }
  1397. return parts
  1398. }
  1399. // Connect or disconnect spans from a line.
  1400. function detachMarkedSpans(line) {
  1401. var spans = line.markedSpans;
  1402. if (!spans) { return }
  1403. for (var i = 0; i < spans.length; ++i)
  1404. { spans[i].marker.detachLine(line); }
  1405. line.markedSpans = null;
  1406. }
  1407. function attachMarkedSpans(line, spans) {
  1408. if (!spans) { return }
  1409. for (var i = 0; i < spans.length; ++i)
  1410. { spans[i].marker.attachLine(line); }
  1411. line.markedSpans = spans;
  1412. }
  1413. // Helpers used when computing which overlapping collapsed span
  1414. // counts as the larger one.
  1415. function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 }
  1416. function extraRight(marker) { return marker.inclusiveRight ? 1 : 0 }
  1417. // Returns a number indicating which of two overlapping collapsed
  1418. // spans is larger (and thus includes the other). Falls back to
  1419. // comparing ids when the spans cover exactly the same range.
  1420. function compareCollapsedMarkers(a, b) {
  1421. var lenDiff = a.lines.length - b.lines.length;
  1422. if (lenDiff != 0) { return lenDiff }
  1423. var aPos = a.find(), bPos = b.find();
  1424. var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);
  1425. if (fromCmp) { return -fromCmp }
  1426. var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b);
  1427. if (toCmp) { return toCmp }
  1428. return b.id - a.id
  1429. }
  1430. // Find out whether a line ends or starts in a collapsed span. If
  1431. // so, return the marker for that span.
  1432. function collapsedSpanAtSide(line, start) {
  1433. var sps = sawCollapsedSpans && line.markedSpans, found;
  1434. if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
  1435. sp = sps[i];
  1436. if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&
  1437. (!found || compareCollapsedMarkers(found, sp.marker) < 0))
  1438. { found = sp.marker; }
  1439. } }
  1440. return found
  1441. }
  1442. function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) }
  1443. function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) }
  1444. function collapsedSpanAround(line, ch) {
  1445. var sps = sawCollapsedSpans && line.markedSpans, found;
  1446. if (sps) { for (var i = 0; i < sps.length; ++i) {
  1447. var sp = sps[i];
  1448. if (sp.marker.collapsed && (sp.from == null || sp.from < ch) && (sp.to == null || sp.to > ch) &&
  1449. (!found || compareCollapsedMarkers(found, sp.marker) < 0)) { found = sp.marker; }
  1450. } }
  1451. return found
  1452. }
  1453. // Test whether there exists a collapsed span that partially
  1454. // overlaps (covers the start or end, but not both) of a new span.
  1455. // Such overlap is not allowed.
  1456. function conflictingCollapsedRange(doc, lineNo, from, to, marker) {
  1457. var line = getLine(doc, lineNo);
  1458. var sps = sawCollapsedSpans && line.markedSpans;
  1459. if (sps) { for (var i = 0; i < sps.length; ++i) {
  1460. var sp = sps[i];
  1461. if (!sp.marker.collapsed) { continue }
  1462. var found = sp.marker.find(0);
  1463. var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);
  1464. var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);
  1465. if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }
  1466. if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||
  1467. fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))
  1468. { return true }
  1469. } }
  1470. }
  1471. // A visual line is a line as drawn on the screen. Folding, for
  1472. // example, can cause multiple logical lines to appear on the same
  1473. // visual line. This finds the start of the visual line that the
  1474. // given line is part of (usually that is the line itself).
  1475. function visualLine(line) {
  1476. var merged;
  1477. while (merged = collapsedSpanAtStart(line))
  1478. { line = merged.find(-1, true).line; }
  1479. return line
  1480. }
  1481. function visualLineEnd(line) {
  1482. var merged;
  1483. while (merged = collapsedSpanAtEnd(line))
  1484. { line = merged.find(1, true).line; }
  1485. return line
  1486. }
  1487. // Returns an array of logical lines that continue the visual line
  1488. // started by the argument, or undefined if there are no such lines.
  1489. function visualLineContinued(line) {
  1490. var merged, lines;
  1491. while (merged = collapsedSpanAtEnd(line)) {
  1492. line = merged.find(1, true).line
  1493. ;(lines || (lines = [])).push(line);
  1494. }
  1495. return lines
  1496. }
  1497. // Get the line number of the start of the visual line that the
  1498. // given line number is part of.
  1499. function visualLineNo(doc, lineN) {
  1500. var line = getLine(doc, lineN), vis = visualLine(line);
  1501. if (line == vis) { return lineN }
  1502. return lineNo(vis)
  1503. }
  1504. // Get the line number of the start of the next visual line after
  1505. // the given line.
  1506. function visualLineEndNo(doc, lineN) {
  1507. if (lineN > doc.lastLine()) { return lineN }
  1508. var line = getLine(doc, lineN), merged;
  1509. if (!lineIsHidden(doc, line)) { return lineN }
  1510. while (merged = collapsedSpanAtEnd(line))
  1511. { line = merged.find(1, true).line; }
  1512. return lineNo(line) + 1
  1513. }
  1514. // Compute whether a line is hidden. Lines count as hidden when they
  1515. // are part of a visual line that starts with another line, or when
  1516. // they are entirely covered by collapsed, non-widget span.
  1517. function lineIsHidden(doc, line) {
  1518. var sps = sawCollapsedSpans && line.markedSpans;
  1519. if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
  1520. sp = sps[i];
  1521. if (!sp.marker.collapsed) { continue }
  1522. if (sp.from == null) { return true }
  1523. if (sp.marker.widgetNode) { continue }
  1524. if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))
  1525. { return true }
  1526. } }
  1527. }
  1528. function lineIsHiddenInner(doc, line, span) {
  1529. if (span.to == null) {
  1530. var end = span.marker.find(1, true);
  1531. return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker))
  1532. }
  1533. if (span.marker.inclusiveRight && span.to == line.text.length)
  1534. { return true }
  1535. for (var sp = (void 0), i = 0; i < line.markedSpans.length; ++i) {
  1536. sp = line.markedSpans[i];
  1537. if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&
  1538. (sp.to == null || sp.to != span.from) &&
  1539. (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
  1540. lineIsHiddenInner(doc, line, sp)) { return true }
  1541. }
  1542. }
  1543. // Find the height above the given line.
  1544. function heightAtLine(lineObj) {
  1545. lineObj = visualLine(lineObj);
  1546. var h = 0, chunk = lineObj.parent;
  1547. for (var i = 0; i < chunk.lines.length; ++i) {
  1548. var line = chunk.lines[i];
  1549. if (line == lineObj) { break }
  1550. else { h += line.height; }
  1551. }
  1552. for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {
  1553. for (var i$1 = 0; i$1 < p.children.length; ++i$1) {
  1554. var cur = p.children[i$1];
  1555. if (cur == chunk) { break }
  1556. else { h += cur.height; }
  1557. }
  1558. }
  1559. return h
  1560. }
  1561. // Compute the character length of a line, taking into account
  1562. // collapsed ranges (see markText) that might hide parts, and join
  1563. // other lines onto it.
  1564. function lineLength(line) {
  1565. if (line.height == 0) { return 0 }
  1566. var len = line.text.length, merged, cur = line;
  1567. while (merged = collapsedSpanAtStart(cur)) {
  1568. var found = merged.find(0, true);
  1569. cur = found.from.line;
  1570. len += found.from.ch - found.to.ch;
  1571. }
  1572. cur = line;
  1573. while (merged = collapsedSpanAtEnd(cur)) {
  1574. var found$1 = merged.find(0, true);
  1575. len -= cur.text.length - found$1.from.ch;
  1576. cur = found$1.to.line;
  1577. len += cur.text.length - found$1.to.ch;
  1578. }
  1579. return len
  1580. }
  1581. // Find the longest line in the document.
  1582. function findMaxLine(cm) {
  1583. var d = cm.display, doc = cm.doc;
  1584. d.maxLine = getLine(doc, doc.first);
  1585. d.maxLineLength = lineLength(d.maxLine);
  1586. d.maxLineChanged = true;
  1587. doc.iter(function (line) {
  1588. var len = lineLength(line);
  1589. if (len > d.maxLineLength) {
  1590. d.maxLineLength = len;
  1591. d.maxLine = line;
  1592. }
  1593. });
  1594. }
  1595. // LINE DATA STRUCTURE
  1596. // Line objects. These hold state related to a line, including
  1597. // highlighting info (the styles array).
  1598. var Line = function(text, markedSpans, estimateHeight) {
  1599. this.text = text;
  1600. attachMarkedSpans(this, markedSpans);
  1601. this.height = estimateHeight ? estimateHeight(this) : 1;
  1602. };
  1603. Line.prototype.lineNo = function () { return lineNo(this) };
  1604. eventMixin(Line);
  1605. // Change the content (text, markers) of a line. Automatically
  1606. // invalidates cached information and tries to re-estimate the
  1607. // line's height.
  1608. function updateLine(line, text, markedSpans, estimateHeight) {
  1609. line.text = text;
  1610. if (line.stateAfter) { line.stateAfter = null; }
  1611. if (line.styles) { line.styles = null; }
  1612. if (line.order != null) { line.order = null; }
  1613. detachMarkedSpans(line);
  1614. attachMarkedSpans(line, markedSpans);
  1615. var estHeight = estimateHeight ? estimateHeight(line) : 1;
  1616. if (estHeight != line.height) { updateLineHeight(line, estHeight); }
  1617. }
  1618. // Detach a line from the document tree and its markers.
  1619. function cleanUpLine(line) {
  1620. line.parent = null;
  1621. detachMarkedSpans(line);
  1622. }
  1623. // Convert a style as returned by a mode (either null, or a string
  1624. // containing one or more styles) to a CSS style. This is cached,
  1625. // and also looks for line-wide styles.
  1626. var styleToClassCache = {}, styleToClassCacheWithMode = {};
  1627. function interpretTokenStyle(style, options) {
  1628. if (!style || /^\s*$/.test(style)) { return null }
  1629. var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;
  1630. return cache[style] ||
  1631. (cache[style] = style.replace(/\S+/g, "cm-$&"))
  1632. }
  1633. // Render the DOM representation of the text of a line. Also builds
  1634. // up a 'line map', which points at the DOM nodes that represent
  1635. // specific stretches of text, and is used by the measuring code.
  1636. // The returned object contains the DOM node, this map, and
  1637. // information about line-wide styles that were set by the mode.
  1638. function buildLineContent(cm, lineView) {
  1639. // The padding-right forces the element to have a 'border', which
  1640. // is needed on Webkit to be able to get line-level bounding
  1641. // rectangles for it (in measureChar).
  1642. var content = eltP("span", null, null, webkit ? "padding-right: .1px" : null);
  1643. var builder = {pre: eltP("pre", [content], "CodeMirror-line"), content: content,
  1644. col: 0, pos: 0, cm: cm,
  1645. trailingSpace: false,
  1646. splitSpaces: cm.getOption("lineWrapping")};
  1647. lineView.measure = {};
  1648. // Iterate over the logical lines that make up this visual line.
  1649. for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {
  1650. var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);
  1651. builder.pos = 0;
  1652. builder.addToken = buildToken;
  1653. // Optionally wire in some hacks into the token-rendering
  1654. // algorithm, to deal with browser quirks.
  1655. if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))
  1656. { builder.addToken = buildTokenBadBidi(builder.addToken, order); }
  1657. builder.map = [];
  1658. var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);
  1659. insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));
  1660. if (line.styleClasses) {
  1661. if (line.styleClasses.bgClass)
  1662. { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || ""); }
  1663. if (line.styleClasses.textClass)
  1664. { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || ""); }
  1665. }
  1666. // Ensure at least a single node is present, for measuring.
  1667. if (builder.map.length == 0)
  1668. { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }
  1669. // Store the map and a cache object for the current logical line
  1670. if (i == 0) {
  1671. lineView.measure.map = builder.map;
  1672. lineView.measure.cache = {};
  1673. } else {
  1674. (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)
  1675. ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});
  1676. }
  1677. }
  1678. // See issue #2901
  1679. if (webkit) {
  1680. var last = builder.content.lastChild;
  1681. if (/\bcm-tab\b/.test(last.className) || (last.querySelector && last.querySelector(".cm-tab")))
  1682. { builder.content.className = "cm-tab-wrap-hack"; }
  1683. }
  1684. signal(cm, "renderLine", cm, lineView.line, builder.pre);
  1685. if (builder.pre.className)
  1686. { builder.textClass = joinClasses(builder.pre.className, builder.textClass || ""); }
  1687. return builder
  1688. }
  1689. function defaultSpecialCharPlaceholder(ch) {
  1690. var token = elt("span", "\u2022", "cm-invalidchar");
  1691. token.title = "\\u" + ch.charCodeAt(0).toString(16);
  1692. token.setAttribute("aria-label", token.title);
  1693. return token
  1694. }
  1695. // Build up the DOM representation for a single token, and add it to
  1696. // the line map. Takes care to render special characters separately.
  1697. function buildToken(builder, text, style, startStyle, endStyle, css, attributes) {
  1698. if (!text) { return }
  1699. var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;
  1700. var special = builder.cm.state.specialChars, mustWrap = false;
  1701. var content;
  1702. if (!special.test(text)) {
  1703. builder.col += text.length;
  1704. content = document.createTextNode(displayText);
  1705. builder.map.push(builder.pos, builder.pos + text.length, content);
  1706. if (ie && ie_version < 9) { mustWrap = true; }
  1707. builder.pos += text.length;
  1708. } else {
  1709. content = document.createDocumentFragment();
  1710. var pos = 0;
  1711. while (true) {
  1712. special.lastIndex = pos;
  1713. var m = special.exec(text);
  1714. var skipped = m ? m.index - pos : text.length - pos;
  1715. if (skipped) {
  1716. var txt = document.createTextNode(displayText.slice(pos, pos + skipped));
  1717. if (ie && ie_version < 9) { content.appendChild(elt("span", [txt])); }
  1718. else { content.appendChild(txt); }
  1719. builder.map.push(builder.pos, builder.pos + skipped, txt);
  1720. builder.col += skipped;
  1721. builder.pos += skipped;
  1722. }
  1723. if (!m) { break }
  1724. pos += skipped + 1;
  1725. var txt$1 = (void 0);
  1726. if (m[0] == "\t") {
  1727. var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;
  1728. txt$1 = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab"));
  1729. txt$1.setAttribute("role", "presentation");
  1730. txt$1.setAttribute("cm-text", "\t");
  1731. builder.col += tabWidth;
  1732. } else if (m[0] == "\r" || m[0] == "\n") {
  1733. txt$1 = content.appendChild(elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar"));
  1734. txt$1.setAttribute("cm-text", m[0]);
  1735. builder.col += 1;
  1736. } else {
  1737. txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);
  1738. txt$1.setAttribute("cm-text", m[0]);
  1739. if (ie && ie_version < 9) { content.appendChild(elt("span", [txt$1])); }
  1740. else { content.appendChild(txt$1); }
  1741. builder.col += 1;
  1742. }
  1743. builder.map.push(builder.pos, builder.pos + 1, txt$1);
  1744. builder.pos++;
  1745. }
  1746. }
  1747. builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;
  1748. if (style || startStyle || endStyle || mustWrap || css || attributes) {
  1749. var fullStyle = style || "";
  1750. if (startStyle) { fullStyle += startStyle; }
  1751. if (endStyle) { fullStyle += endStyle; }
  1752. var token = elt("span", [content], fullStyle, css);
  1753. if (attributes) {
  1754. for (var attr in attributes) { if (attributes.hasOwnProperty(attr) && attr != "style" && attr != "class")
  1755. { token.setAttribute(attr, attributes[attr]); } }
  1756. }
  1757. return builder.content.appendChild(token)
  1758. }
  1759. builder.content.appendChild(content);
  1760. }
  1761. // Change some spaces to NBSP to prevent the browser from collapsing
  1762. // trailing spaces at the end of a line when rendering text (issue #1362).
  1763. function splitSpaces(text, trailingBefore) {
  1764. if (text.length > 1 && !/ /.test(text)) { return text }
  1765. var spaceBefore = trailingBefore, result = "";
  1766. for (var i = 0; i < text.length; i++) {
  1767. var ch = text.charAt(i);
  1768. if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))
  1769. { ch = "\u00a0"; }
  1770. result += ch;
  1771. spaceBefore = ch == " ";
  1772. }
  1773. return result
  1774. }
  1775. // Work around nonsense dimensions being reported for stretches of
  1776. // right-to-left text.
  1777. function buildTokenBadBidi(inner, order) {
  1778. return function (builder, text, style, startStyle, endStyle, css, attributes) {
  1779. style = style ? style + " cm-force-border" : "cm-force-border";
  1780. var start = builder.pos, end = start + text.length;
  1781. for (;;) {
  1782. // Find the part that overlaps with the start of this text
  1783. var part = (void 0);
  1784. for (var i = 0; i < order.length; i++) {
  1785. part = order[i];
  1786. if (part.to > start && part.from <= start) { break }
  1787. }
  1788. if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, css, attributes) }
  1789. inner(builder, text.slice(0, part.to - start), style, startStyle, null, css, attributes);
  1790. startStyle = null;
  1791. text = text.slice(part.to - start);
  1792. start = part.to;
  1793. }
  1794. }
  1795. }
  1796. function buildCollapsedSpan(builder, size, marker, ignoreWidget) {
  1797. var widget = !ignoreWidget && marker.widgetNode;
  1798. if (widget) { builder.map.push(builder.pos, builder.pos + size, widget); }
  1799. if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {
  1800. if (!widget)
  1801. { widget = builder.content.appendChild(document.createElement("span")); }
  1802. widget.setAttribute("cm-marker", marker.id);
  1803. }
  1804. if (widget) {
  1805. builder.cm.display.input.setUneditable(widget);
  1806. builder.content.appendChild(widget);
  1807. }
  1808. builder.pos += size;
  1809. builder.trailingSpace = false;
  1810. }
  1811. // Outputs a number of spans to make up a line, taking highlighting
  1812. // and marked text into account.
  1813. function insertLineContent(line, builder, styles) {
  1814. var spans = line.markedSpans, allText = line.text, at = 0;
  1815. if (!spans) {
  1816. for (var i$1 = 1; i$1 < styles.length; i$1+=2)
  1817. { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }
  1818. return
  1819. }
  1820. var len = allText.length, pos = 0, i = 1, text = "", style, css;
  1821. var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;
  1822. for (;;) {
  1823. if (nextChange == pos) { // Update current marker set
  1824. spanStyle = spanEndStyle = spanStartStyle = css = "";
  1825. attributes = null;
  1826. collapsed = null; nextChange = Infinity;
  1827. var foundBookmarks = [], endStyles = (void 0);
  1828. for (var j = 0; j < spans.length; ++j) {
  1829. var sp = spans[j], m = sp.marker;
  1830. if (m.type == "bookmark" && sp.from == pos && m.widgetNode) {
  1831. foundBookmarks.push(m);
  1832. } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {
  1833. if (sp.to != null && sp.to != pos && nextChange > sp.to) {
  1834. nextChange = sp.to;
  1835. spanEndStyle = "";
  1836. }
  1837. if (m.className) { spanStyle += " " + m.className; }
  1838. if (m.css) { css = (css ? css + ";" : "") + m.css; }
  1839. if (m.startStyle && sp.from == pos) { spanStartStyle += " " + m.startStyle; }
  1840. if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }
  1841. // support for the old title property
  1842. // https://github.com/codemirror/CodeMirror/pull/5673
  1843. if (m.title) { (attributes || (attributes = {})).title = m.title; }
  1844. if (m.attributes) {
  1845. for (var attr in m.attributes)
  1846. { (attributes || (attributes = {}))[attr] = m.attributes[attr]; }
  1847. }
  1848. if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))
  1849. { collapsed = sp; }
  1850. } else if (sp.from > pos && nextChange > sp.from) {
  1851. nextChange = sp.from;
  1852. }
  1853. }
  1854. if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)
  1855. { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += " " + endStyles[j$1]; } } }
  1856. if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)
  1857. { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }
  1858. if (collapsed && (collapsed.from || 0) == pos) {
  1859. buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,
  1860. collapsed.marker, collapsed.from == null);
  1861. if (collapsed.to == null) { return }
  1862. if (collapsed.to == pos) { collapsed = false; }
  1863. }
  1864. }
  1865. if (pos >= len) { break }
  1866. var upto = Math.min(len, nextChange);
  1867. while (true) {
  1868. if (text) {
  1869. var end = pos + text.length;
  1870. if (!collapsed) {
  1871. var tokenText = end > upto ? text.slice(0, upto - pos) : text;
  1872. builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,
  1873. spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", css, attributes);
  1874. }
  1875. if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}
  1876. pos = end;
  1877. spanStartStyle = "";
  1878. }
  1879. text = allText.slice(at, at = styles[i++]);
  1880. style = interpretTokenStyle(styles[i++], builder.cm.options);
  1881. }
  1882. }
  1883. }
  1884. // These objects are used to represent the visible (currently drawn)
  1885. // part of the document. A LineView may correspond to multiple
  1886. // logical lines, if those are connected by collapsed ranges.
  1887. function LineView(doc, line, lineN) {
  1888. // The starting line
  1889. this.line = line;
  1890. // Continuing lines, if any
  1891. this.rest = visualLineContinued(line);
  1892. // Number of logical lines in this visual line
  1893. this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;
  1894. this.node = this.text = null;
  1895. this.hidden = lineIsHidden(doc, line);
  1896. }
  1897. // Create a range of LineView objects for the given lines.
  1898. function buildViewArray(cm, from, to) {
  1899. var array = [], nextPos;
  1900. for (var pos = from; pos < to; pos = nextPos) {
  1901. var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);
  1902. nextPos = pos + view.size;
  1903. array.push(view);
  1904. }
  1905. return array
  1906. }
  1907. var operationGroup = null;
  1908. function pushOperation(op) {
  1909. if (operationGroup) {
  1910. operationGroup.ops.push(op);
  1911. } else {
  1912. op.ownsGroup = operationGroup = {
  1913. ops: [op],
  1914. delayedCallbacks: []
  1915. };
  1916. }
  1917. }
  1918. function fireCallbacksForOps(group) {
  1919. // Calls delayed callbacks and cursorActivity handlers until no
  1920. // new ones appear
  1921. var callbacks = group.delayedCallbacks, i = 0;
  1922. do {
  1923. for (; i < callbacks.length; i++)
  1924. { callbacks[i].call(null); }
  1925. for (var j = 0; j < group.ops.length; j++) {
  1926. var op = group.ops[j];
  1927. if (op.cursorActivityHandlers)
  1928. { while (op.cursorActivityCalled < op.cursorActivityHandlers.length)
  1929. { op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm); } }
  1930. }
  1931. } while (i < callbacks.length)
  1932. }
  1933. function finishOperation(op, endCb) {
  1934. var group = op.ownsGroup;
  1935. if (!group) { return }
  1936. try { fireCallbacksForOps(group); }
  1937. finally {
  1938. operationGroup = null;
  1939. endCb(group);
  1940. }
  1941. }
  1942. var orphanDelayedCallbacks = null;
  1943. // Often, we want to signal events at a point where we are in the
  1944. // middle of some work, but don't want the handler to start calling
  1945. // other methods on the editor, which might be in an inconsistent
  1946. // state or simply not expect any other events to happen.
  1947. // signalLater looks whether there are any handlers, and schedules
  1948. // them to be executed when the last operation ends, or, if no
  1949. // operation is active, when a timeout fires.
  1950. function signalLater(emitter, type /*, values...*/) {
  1951. var arr = getHandlers(emitter, type);
  1952. if (!arr.length) { return }
  1953. var args = Array.prototype.slice.call(arguments, 2), list;
  1954. if (operationGroup) {
  1955. list = operationGroup.delayedCallbacks;
  1956. } else if (orphanDelayedCallbacks) {
  1957. list = orphanDelayedCallbacks;
  1958. } else {
  1959. list = orphanDelayedCallbacks = [];
  1960. setTimeout(fireOrphanDelayed, 0);
  1961. }
  1962. var loop = function ( i ) {
  1963. list.push(function () { return arr[i].apply(null, args); });
  1964. };
  1965. for (var i = 0; i < arr.length; ++i)
  1966. loop( i );
  1967. }
  1968. function fireOrphanDelayed() {
  1969. var delayed = orphanDelayedCallbacks;
  1970. orphanDelayedCallbacks = null;
  1971. for (var i = 0; i < delayed.length; ++i) { delayed[i](); }
  1972. }
  1973. // When an aspect of a line changes, a string is added to
  1974. // lineView.changes. This updates the relevant part of the line's
  1975. // DOM structure.
  1976. function updateLineForChanges(cm, lineView, lineN, dims) {
  1977. for (var j = 0; j < lineView.changes.length; j++) {
  1978. var type = lineView.changes[j];
  1979. if (type == "text") { updateLineText(cm, lineView); }
  1980. else if (type == "gutter") { updateLineGutter(cm, lineView, lineN, dims); }
  1981. else if (type == "class") { updateLineClasses(cm, lineView); }
  1982. else if (type == "widget") { updateLineWidgets(cm, lineView, dims); }
  1983. }
  1984. lineView.changes = null;
  1985. }
  1986. // Lines with gutter elements, widgets or a background class need to
  1987. // be wrapped, and have the extra elements added to the wrapper div
  1988. function ensureLineWrapped(lineView) {
  1989. if (lineView.node == lineView.text) {
  1990. lineView.node = elt("div", null, null, "position: relative");
  1991. if (lineView.text.parentNode)
  1992. { lineView.text.parentNode.replaceChild(lineView.node, lineView.text); }
  1993. lineView.node.appendChild(lineView.text);
  1994. if (ie && ie_version < 8) { lineView.node.style.zIndex = 2; }
  1995. }
  1996. return lineView.node
  1997. }
  1998. function updateLineBackground(cm, lineView) {
  1999. var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass;
  2000. if (cls) { cls += " CodeMirror-linebackground"; }
  2001. if (lineView.background) {
  2002. if (cls) { lineView.background.className = cls; }
  2003. else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; }
  2004. } else if (cls) {
  2005. var wrap = ensureLineWrapped(lineView);
  2006. lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild);
  2007. cm.display.input.setUneditable(lineView.background);
  2008. }
  2009. }
  2010. // Wrapper around buildLineContent which will reuse the structure
  2011. // in display.externalMeasured when possible.
  2012. function getLineContent(cm, lineView) {
  2013. var ext = cm.display.externalMeasured;
  2014. if (ext && ext.line == lineView.line) {
  2015. cm.display.externalMeasured = null;
  2016. lineView.measure = ext.measure;
  2017. return ext.built
  2018. }
  2019. return buildLineContent(cm, lineView)
  2020. }
  2021. // Redraw the line's text. Interacts with the background and text
  2022. // classes because the mode may output tokens that influence these
  2023. // classes.
  2024. function updateLineText(cm, lineView) {
  2025. var cls = lineView.text.className;
  2026. var built = getLineContent(cm, lineView);
  2027. if (lineView.text == lineView.node) { lineView.node = built.pre; }
  2028. lineView.text.parentNode.replaceChild(built.pre, lineView.text);
  2029. lineView.text = built.pre;
  2030. if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {
  2031. lineView.bgClass = built.bgClass;
  2032. lineView.textClass = built.textClass;
  2033. updateLineClasses(cm, lineView);
  2034. } else if (cls) {
  2035. lineView.text.className = cls;
  2036. }
  2037. }
  2038. function updateLineClasses(cm, lineView) {
  2039. updateLineBackground(cm, lineView);
  2040. if (lineView.line.wrapClass)
  2041. { ensureLineWrapped(lineView).className = lineView.line.wrapClass; }
  2042. else if (lineView.node != lineView.text)
  2043. { lineView.node.className = ""; }
  2044. var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass;
  2045. lineView.text.className = textClass || "";
  2046. }
  2047. function updateLineGutter(cm, lineView, lineN, dims) {
  2048. if (lineView.gutter) {
  2049. lineView.node.removeChild(lineView.gutter);
  2050. lineView.gutter = null;
  2051. }
  2052. if (lineView.gutterBackground) {
  2053. lineView.node.removeChild(lineView.gutterBackground);
  2054. lineView.gutterBackground = null;
  2055. }
  2056. if (lineView.line.gutterClass) {
  2057. var wrap = ensureLineWrapped(lineView);
  2058. lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass,
  2059. ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px; width: " + (dims.gutterTotalWidth) + "px"));
  2060. cm.display.input.setUneditable(lineView.gutterBackground);
  2061. wrap.insertBefore(lineView.gutterBackground, lineView.text);
  2062. }
  2063. var markers = lineView.line.gutterMarkers;
  2064. if (cm.options.lineNumbers || markers) {
  2065. var wrap$1 = ensureLineWrapped(lineView);
  2066. var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px"));
  2067. cm.display.input.setUneditable(gutterWrap);
  2068. wrap$1.insertBefore(gutterWrap, lineView.text);
  2069. if (lineView.line.gutterClass)
  2070. { gutterWrap.className += " " + lineView.line.gutterClass; }
  2071. if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
  2072. { lineView.lineNumber = gutterWrap.appendChild(
  2073. elt("div", lineNumberFor(cm.options, lineN),
  2074. "CodeMirror-linenumber CodeMirror-gutter-elt",
  2075. ("left: " + (dims.gutterLeft["CodeMirror-linenumbers"]) + "px; width: " + (cm.display.lineNumInnerWidth) + "px"))); }
  2076. if (markers) { for (var k = 0; k < cm.display.gutterSpecs.length; ++k) {
  2077. var id = cm.display.gutterSpecs[k].className, found = markers.hasOwnProperty(id) && markers[id];
  2078. if (found)
  2079. { gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt",
  2080. ("left: " + (dims.gutterLeft[id]) + "px; width: " + (dims.gutterWidth[id]) + "px"))); }
  2081. } }
  2082. }
  2083. }
  2084. function updateLineWidgets(cm, lineView, dims) {
  2085. if (lineView.alignable) { lineView.alignable = null; }
  2086. var isWidget = classTest("CodeMirror-linewidget");
  2087. for (var node = lineView.node.firstChild, next = (void 0); node; node = next) {
  2088. next = node.nextSibling;
  2089. if (isWidget.test(node.className)) { lineView.node.removeChild(node); }
  2090. }
  2091. insertLineWidgets(cm, lineView, dims);
  2092. }
  2093. // Build a line's DOM representation from scratch
  2094. function buildLineElement(cm, lineView, lineN, dims) {
  2095. var built = getLineContent(cm, lineView);
  2096. lineView.text = lineView.node = built.pre;
  2097. if (built.bgClass) { lineView.bgClass = built.bgClass; }
  2098. if (built.textClass) { lineView.textClass = built.textClass; }
  2099. updateLineClasses(cm, lineView);
  2100. updateLineGutter(cm, lineView, lineN, dims);
  2101. insertLineWidgets(cm, lineView, dims);
  2102. return lineView.node
  2103. }
  2104. // A lineView may contain multiple logical lines (when merged by
  2105. // collapsed spans). The widgets for all of them need to be drawn.
  2106. function insertLineWidgets(cm, lineView, dims) {
  2107. insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);
  2108. if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
  2109. { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }
  2110. }
  2111. function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {
  2112. if (!line.widgets) { return }
  2113. var wrap = ensureLineWrapped(lineView);
  2114. for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
  2115. var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget" + (widget.className ? " " + widget.className : ""));
  2116. if (!widget.handleMouseEvents) { node.setAttribute("cm-ignore-events", "true"); }
  2117. positionLineWidget(widget, node, lineView, dims);
  2118. cm.display.input.setUneditable(node);
  2119. if (allowAbove && widget.above)
  2120. { wrap.insertBefore(node, lineView.gutter || lineView.text); }
  2121. else
  2122. { wrap.appendChild(node); }
  2123. signalLater(widget, "redraw");
  2124. }
  2125. }
  2126. function positionLineWidget(widget, node, lineView, dims) {
  2127. if (widget.noHScroll) {
  2128. (lineView.alignable || (lineView.alignable = [])).push(node);
  2129. var width = dims.wrapperWidth;
  2130. node.style.left = dims.fixedPos + "px";
  2131. if (!widget.coverGutter) {
  2132. width -= dims.gutterTotalWidth;
  2133. node.style.paddingLeft = dims.gutterTotalWidth + "px";
  2134. }
  2135. node.style.width = width + "px";
  2136. }
  2137. if (widget.coverGutter) {
  2138. node.style.zIndex = 5;
  2139. node.style.position = "relative";
  2140. if (!widget.noHScroll) { node.style.marginLeft = -dims.gutterTotalWidth + "px"; }
  2141. }
  2142. }
  2143. function widgetHeight(widget) {
  2144. if (widget.height != null) { return widget.height }
  2145. var cm = widget.doc.cm;
  2146. if (!cm) { return 0 }
  2147. if (!contains(document.body, widget.node)) {
  2148. var parentStyle = "position: relative;";
  2149. if (widget.coverGutter)
  2150. { parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;"; }
  2151. if (widget.noHScroll)
  2152. { parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;"; }
  2153. removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle));
  2154. }
  2155. return widget.height = widget.node.parentNode.offsetHeight
  2156. }
  2157. // Return true when the given mouse event happened in a widget
  2158. function eventInWidget(display, e) {
  2159. for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {
  2160. if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") ||
  2161. (n.parentNode == display.sizer && n != display.mover))
  2162. { return true }
  2163. }
  2164. }
  2165. // POSITION MEASUREMENT
  2166. function paddingTop(display) {return display.lineSpace.offsetTop}
  2167. function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight}
  2168. function paddingH(display) {
  2169. if (display.cachedPaddingH) { return display.cachedPaddingH }
  2170. var e = removeChildrenAndAdd(display.measure, elt("pre", "x", "CodeMirror-line-like"));
  2171. var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;
  2172. var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)};
  2173. if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data; }
  2174. return data
  2175. }
  2176. function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth }
  2177. function displayWidth(cm) {
  2178. return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth
  2179. }
  2180. function displayHeight(cm) {
  2181. return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight
  2182. }
  2183. // Ensure the lineView.wrapping.heights array is populated. This is
  2184. // an array of bottom offsets for the lines that make up a drawn
  2185. // line. When lineWrapping is on, there might be more than one
  2186. // height.
  2187. function ensureLineHeights(cm, lineView, rect) {
  2188. var wrapping = cm.options.lineWrapping;
  2189. var curWidth = wrapping && displayWidth(cm);
  2190. if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {
  2191. var heights = lineView.measure.heights = [];
  2192. if (wrapping) {
  2193. lineView.measure.width = curWidth;
  2194. var rects = lineView.text.firstChild.getClientRects();
  2195. for (var i = 0; i < rects.length - 1; i++) {
  2196. var cur = rects[i], next = rects[i + 1];
  2197. if (Math.abs(cur.bottom - next.bottom) > 2)
  2198. { heights.push((cur.bottom + next.top) / 2 - rect.top); }
  2199. }
  2200. }
  2201. heights.push(rect.bottom - rect.top);
  2202. }
  2203. }
  2204. // Find a line map (mapping character offsets to text nodes) and a
  2205. // measurement cache for the given line number. (A line view might
  2206. // contain multiple lines when collapsed ranges are present.)
  2207. function mapFromLineView(lineView, line, lineN) {
  2208. if (lineView.line == line)
  2209. { return {map: lineView.measure.map, cache: lineView.measure.cache} }
  2210. for (var i = 0; i < lineView.rest.length; i++)
  2211. { if (lineView.rest[i] == line)
  2212. { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }
  2213. for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)
  2214. { if (lineNo(lineView.rest[i$1]) > lineN)
  2215. { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }
  2216. }
  2217. // Render a line into the hidden node display.externalMeasured. Used
  2218. // when measurement is needed for a line that's not in the viewport.
  2219. function updateExternalMeasurement(cm, line) {
  2220. line = visualLine(line);
  2221. var lineN = lineNo(line);
  2222. var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);
  2223. view.lineN = lineN;
  2224. var built = view.built = buildLineContent(cm, view);
  2225. view.text = built.pre;
  2226. removeChildrenAndAdd(cm.display.lineMeasure, built.pre);
  2227. return view
  2228. }
  2229. // Get a {top, bottom, left, right} box (in line-local coordinates)
  2230. // for a given character.
  2231. function measureChar(cm, line, ch, bias) {
  2232. return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias)
  2233. }
  2234. // Find a line view that corresponds to the given line number.
  2235. function findViewForLine(cm, lineN) {
  2236. if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)
  2237. { return cm.display.view[findViewIndex(cm, lineN)] }
  2238. var ext = cm.display.externalMeasured;
  2239. if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)
  2240. { return ext }
  2241. }
  2242. // Measurement can be split in two steps, the set-up work that
  2243. // applies to the whole line, and the measurement of the actual
  2244. // character. Functions like coordsChar, that need to do a lot of
  2245. // measurements in a row, can thus ensure that the set-up work is
  2246. // only done once.
  2247. function prepareMeasureForLine(cm, line) {
  2248. var lineN = lineNo(line);
  2249. var view = findViewForLine(cm, lineN);
  2250. if (view && !view.text) {
  2251. view = null;
  2252. } else if (view && view.changes) {
  2253. updateLineForChanges(cm, view, lineN, getDimensions(cm));
  2254. cm.curOp.forceUpdate = true;
  2255. }
  2256. if (!view)
  2257. { view = updateExternalMeasurement(cm, line); }
  2258. var info = mapFromLineView(view, line, lineN);
  2259. return {
  2260. line: line, view: view, rect: null,
  2261. map: info.map, cache: info.cache, before: info.before,
  2262. hasHeights: false
  2263. }
  2264. }
  2265. // Given a prepared measurement object, measures the position of an
  2266. // actual character (or fetches it from the cache).
  2267. function measureCharPrepared(cm, prepared, ch, bias, varHeight) {
  2268. if (prepared.before) { ch = -1; }
  2269. var key = ch + (bias || ""), found;
  2270. if (prepared.cache.hasOwnProperty(key)) {
  2271. found = prepared.cache[key];
  2272. } else {
  2273. if (!prepared.rect)
  2274. { prepared.rect = prepared.view.text.getBoundingClientRect(); }
  2275. if (!prepared.hasHeights) {
  2276. ensureLineHeights(cm, prepared.view, prepared.rect);
  2277. prepared.hasHeights = true;
  2278. }
  2279. found = measureCharInner(cm, prepared, ch, bias);
  2280. if (!found.bogus) { prepared.cache[key] = found; }
  2281. }
  2282. return {left: found.left, right: found.right,
  2283. top: varHeight ? found.rtop : found.top,
  2284. bottom: varHeight ? found.rbottom : found.bottom}
  2285. }
  2286. var nullRect = {left: 0, right: 0, top: 0, bottom: 0};
  2287. function nodeAndOffsetInLineMap(map, ch, bias) {
  2288. var node, start, end, collapse, mStart, mEnd;
  2289. // First, search the line map for the text node corresponding to,
  2290. // or closest to, the target character.
  2291. for (var i = 0; i < map.length; i += 3) {
  2292. mStart = map[i];
  2293. mEnd = map[i + 1];
  2294. if (ch < mStart) {
  2295. start = 0; end = 1;
  2296. collapse = "left";
  2297. } else if (ch < mEnd) {
  2298. start = ch - mStart;
  2299. end = start + 1;
  2300. } else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) {
  2301. end = mEnd - mStart;
  2302. start = end - 1;
  2303. if (ch >= mEnd) { collapse = "right"; }
  2304. }
  2305. if (start != null) {
  2306. node = map[i + 2];
  2307. if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right"))
  2308. { collapse = bias; }
  2309. if (bias == "left" && start == 0)
  2310. { while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) {
  2311. node = map[(i -= 3) + 2];
  2312. collapse = "left";
  2313. } }
  2314. if (bias == "right" && start == mEnd - mStart)
  2315. { while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) {
  2316. node = map[(i += 3) + 2];
  2317. collapse = "right";
  2318. } }
  2319. break
  2320. }
  2321. }
  2322. return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd}
  2323. }
  2324. function getUsefulRect(rects, bias) {
  2325. var rect = nullRect;
  2326. if (bias == "left") { for (var i = 0; i < rects.length; i++) {
  2327. if ((rect = rects[i]).left != rect.right) { break }
  2328. } } else { for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) {
  2329. if ((rect = rects[i$1]).left != rect.right) { break }
  2330. } }
  2331. return rect
  2332. }
  2333. function measureCharInner(cm, prepared, ch, bias) {
  2334. var place = nodeAndOffsetInLineMap(prepared.map, ch, bias);
  2335. var node = place.node, start = place.start, end = place.end, collapse = place.collapse;
  2336. var rect;
  2337. if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.
  2338. for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned
  2339. while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { --start; }
  2340. while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { ++end; }
  2341. if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart)
  2342. { rect = node.parentNode.getBoundingClientRect(); }
  2343. else
  2344. { rect = getUsefulRect(range(node, start, end).getClientRects(), bias); }
  2345. if (rect.left || rect.right || start == 0) { break }
  2346. end = start;
  2347. start = start - 1;
  2348. collapse = "right";
  2349. }
  2350. if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect); }
  2351. } else { // If it is a widget, simply get the box for the whole widget.
  2352. if (start > 0) { collapse = bias = "right"; }
  2353. var rects;
  2354. if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)
  2355. { rect = rects[bias == "right" ? rects.length - 1 : 0]; }
  2356. else
  2357. { rect = node.getBoundingClientRect(); }
  2358. }
  2359. if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {
  2360. var rSpan = node.parentNode.getClientRects()[0];
  2361. if (rSpan)
  2362. { rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom}; }
  2363. else
  2364. { rect = nullRect; }
  2365. }
  2366. var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top;
  2367. var mid = (rtop + rbot) / 2;
  2368. var heights = prepared.view.measure.heights;
  2369. var i = 0;
  2370. for (; i < heights.length - 1; i++)
  2371. { if (mid < heights[i]) { break } }
  2372. var top = i ? heights[i - 1] : 0, bot = heights[i];
  2373. var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left,
  2374. right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left,
  2375. top: top, bottom: bot};
  2376. if (!rect.left && !rect.right) { result.bogus = true; }
  2377. if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; }
  2378. return result
  2379. }
  2380. // Work around problem with bounding client rects on ranges being
  2381. // returned incorrectly when zoomed on IE10 and below.
  2382. function maybeUpdateRectForZooming(measure, rect) {
  2383. if (!window.screen || screen.logicalXDPI == null ||
  2384. screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))
  2385. { return rect }
  2386. var scaleX = screen.logicalXDPI / screen.deviceXDPI;
  2387. var scaleY = screen.logicalYDPI / screen.deviceYDPI;
  2388. return {left: rect.left * scaleX, right: rect.right * scaleX,
  2389. top: rect.top * scaleY, bottom: rect.bottom * scaleY}
  2390. }
  2391. function clearLineMeasurementCacheFor(lineView) {
  2392. if (lineView.measure) {
  2393. lineView.measure.cache = {};
  2394. lineView.measure.heights = null;
  2395. if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
  2396. { lineView.measure.caches[i] = {}; } }
  2397. }
  2398. }
  2399. function clearLineMeasurementCache(cm) {
  2400. cm.display.externalMeasure = null;
  2401. removeChildren(cm.display.lineMeasure);
  2402. for (var i = 0; i < cm.display.view.length; i++)
  2403. { clearLineMeasurementCacheFor(cm.display.view[i]); }
  2404. }
  2405. function clearCaches(cm) {
  2406. clearLineMeasurementCache(cm);
  2407. cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;
  2408. if (!cm.options.lineWrapping) { cm.display.maxLineChanged = true; }
  2409. cm.display.lineNumChars = null;
  2410. }
  2411. function pageScrollX() {
  2412. // Work around https://bugs.chromium.org/p/chromium/issues/detail?id=489206
  2413. // which causes page_Offset and bounding client rects to use
  2414. // different reference viewports and invalidate our calculations.
  2415. if (chrome && android) { return -(document.body.getBoundingClientRect().left - parseInt(getComputedStyle(document.body).marginLeft)) }
  2416. return window.pageXOffset || (document.documentElement || document.body).scrollLeft
  2417. }
  2418. function pageScrollY() {
  2419. if (chrome && android) { return -(document.body.getBoundingClientRect().top - parseInt(getComputedStyle(document.body).marginTop)) }
  2420. return window.pageYOffset || (document.documentElement || document.body).scrollTop
  2421. }
  2422. function widgetTopHeight(lineObj) {
  2423. var height = 0;
  2424. if (lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above)
  2425. { height += widgetHeight(lineObj.widgets[i]); } } }
  2426. return height
  2427. }
  2428. // Converts a {top, bottom, left, right} box from line-local
  2429. // coordinates into another coordinate system. Context may be one of
  2430. // "line", "div" (display.lineDiv), "local"./null (editor), "window",
  2431. // or "page".
  2432. function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {
  2433. if (!includeWidgets) {
  2434. var height = widgetTopHeight(lineObj);
  2435. rect.top += height; rect.bottom += height;
  2436. }
  2437. if (context == "line") { return rect }
  2438. if (!context) { context = "local"; }
  2439. var yOff = heightAtLine(lineObj);
  2440. if (context == "local") { yOff += paddingTop(cm.display); }
  2441. else { yOff -= cm.display.viewOffset; }
  2442. if (context == "page" || context == "window") {
  2443. var lOff = cm.display.lineSpace.getBoundingClientRect();
  2444. yOff += lOff.top + (context == "window" ? 0 : pageScrollY());
  2445. var xOff = lOff.left + (context == "window" ? 0 : pageScrollX());
  2446. rect.left += xOff; rect.right += xOff;
  2447. }
  2448. rect.top += yOff; rect.bottom += yOff;
  2449. return rect
  2450. }
  2451. // Coverts a box from "div" coords to another coordinate system.
  2452. // Context may be "window", "page", "div", or "local"./null.
  2453. function fromCoordSystem(cm, coords, context) {
  2454. if (context == "div") { return coords }
  2455. var left = coords.left, top = coords.top;
  2456. // First move into "page" coordinate system
  2457. if (context == "page") {
  2458. left -= pageScrollX();
  2459. top -= pageScrollY();
  2460. } else if (context == "local" || !context) {
  2461. var localBox = cm.display.sizer.getBoundingClientRect();
  2462. left += localBox.left;
  2463. top += localBox.top;
  2464. }
  2465. var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();
  2466. return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}
  2467. }
  2468. function charCoords(cm, pos, context, lineObj, bias) {
  2469. if (!lineObj) { lineObj = getLine(cm.doc, pos.line); }
  2470. return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context)
  2471. }
  2472. // Returns a box for a given cursor position, which may have an
  2473. // 'other' property containing the position of the secondary cursor
  2474. // on a bidi boundary.
  2475. // A cursor Pos(line, char, "before") is on the same visual line as `char - 1`
  2476. // and after `char - 1` in writing order of `char - 1`
  2477. // A cursor Pos(line, char, "after") is on the same visual line as `char`
  2478. // and before `char` in writing order of `char`
  2479. // Examples (upper-case letters are RTL, lower-case are LTR):
  2480. // Pos(0, 1, ...)
  2481. // before after
  2482. // ab a|b a|b
  2483. // aB a|B aB|
  2484. // Ab |Ab A|b
  2485. // AB B|A B|A
  2486. // Every position after the last character on a line is considered to stick
  2487. // to the last character on the line.
  2488. function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {
  2489. lineObj = lineObj || getLine(cm.doc, pos.line);
  2490. if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }
  2491. function get(ch, right) {
  2492. var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight);
  2493. if (right) { m.left = m.right; } else { m.right = m.left; }
  2494. return intoCoordSystem(cm, lineObj, m, context)
  2495. }
  2496. var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;
  2497. if (ch >= lineObj.text.length) {
  2498. ch = lineObj.text.length;
  2499. sticky = "before";
  2500. } else if (ch <= 0) {
  2501. ch = 0;
  2502. sticky = "after";
  2503. }
  2504. if (!order) { return get(sticky == "before" ? ch - 1 : ch, sticky == "before") }
  2505. function getBidi(ch, partPos, invert) {
  2506. var part = order[partPos], right = part.level == 1;
  2507. return get(invert ? ch - 1 : ch, right != invert)
  2508. }
  2509. var partPos = getBidiPartAt(order, ch, sticky);
  2510. var other = bidiOther;
  2511. var val = getBidi(ch, partPos, sticky == "before");
  2512. if (other != null) { val.other = getBidi(ch, other, sticky != "before"); }
  2513. return val
  2514. }
  2515. // Used to cheaply estimate the coordinates for a position. Used for
  2516. // intermediate scroll updates.
  2517. function estimateCoords(cm, pos) {
  2518. var left = 0;
  2519. pos = clipPos(cm.doc, pos);
  2520. if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }
  2521. var lineObj = getLine(cm.doc, pos.line);
  2522. var top = heightAtLine(lineObj) + paddingTop(cm.display);
  2523. return {left: left, right: left, top: top, bottom: top + lineObj.height}
  2524. }
  2525. // Positions returned by coordsChar contain some extra information.
  2526. // xRel is the relative x position of the input coordinates compared
  2527. // to the found position (so xRel > 0 means the coordinates are to
  2528. // the right of the character position, for example). When outside
  2529. // is true, that means the coordinates lie outside the line's
  2530. // vertical range.
  2531. function PosWithInfo(line, ch, sticky, outside, xRel) {
  2532. var pos = Pos(line, ch, sticky);
  2533. pos.xRel = xRel;
  2534. if (outside) { pos.outside = outside; }
  2535. return pos
  2536. }
  2537. // Compute the character position closest to the given coordinates.
  2538. // Input must be lineSpace-local ("div" coordinate system).
  2539. function coordsChar(cm, x, y) {
  2540. var doc = cm.doc;
  2541. y += cm.display.viewOffset;
  2542. if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }
  2543. var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;
  2544. if (lineN > last)
  2545. { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }
  2546. if (x < 0) { x = 0; }
  2547. var lineObj = getLine(doc, lineN);
  2548. for (;;) {
  2549. var found = coordsCharInner(cm, lineObj, lineN, x, y);
  2550. var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));
  2551. if (!collapsed) { return found }
  2552. var rangeEnd = collapsed.find(1);
  2553. if (rangeEnd.line == lineN) { return rangeEnd }
  2554. lineObj = getLine(doc, lineN = rangeEnd.line);
  2555. }
  2556. }
  2557. function wrappedLineExtent(cm, lineObj, preparedMeasure, y) {
  2558. y -= widgetTopHeight(lineObj);
  2559. var end = lineObj.text.length;
  2560. var begin = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch - 1).bottom <= y; }, end, 0);
  2561. end = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch).top > y; }, begin, end);
  2562. return {begin: begin, end: end}
  2563. }
  2564. function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) {
  2565. if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }
  2566. var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), "line").top;
  2567. return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop)
  2568. }
  2569. // Returns true if the given side of a box is after the given
  2570. // coordinates, in top-to-bottom, left-to-right order.
  2571. function boxIsAfter(box, x, y, left) {
  2572. return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x
  2573. }
  2574. function coordsCharInner(cm, lineObj, lineNo, x, y) {
  2575. // Move y into line-local coordinate space
  2576. y -= heightAtLine(lineObj);
  2577. var preparedMeasure = prepareMeasureForLine(cm, lineObj);
  2578. // When directly calling `measureCharPrepared`, we have to adjust
  2579. // for the widgets at this line.
  2580. var widgetHeight = widgetTopHeight(lineObj);
  2581. var begin = 0, end = lineObj.text.length, ltr = true;
  2582. var order = getOrder(lineObj, cm.doc.direction);
  2583. // If the line isn't plain left-to-right text, first figure out
  2584. // which bidi section the coordinates fall into.
  2585. if (order) {
  2586. var part = (cm.options.lineWrapping ? coordsBidiPartWrapped : coordsBidiPart)
  2587. (cm, lineObj, lineNo, preparedMeasure, order, x, y);
  2588. ltr = part.level != 1;
  2589. // The awkward -1 offsets are needed because findFirst (called
  2590. // on these below) will treat its first bound as inclusive,
  2591. // second as exclusive, but we want to actually address the
  2592. // characters in the part's range
  2593. begin = ltr ? part.from : part.to - 1;
  2594. end = ltr ? part.to : part.from - 1;
  2595. }
  2596. // A binary search to find the first character whose bounding box
  2597. // starts after the coordinates. If we run across any whose box wrap
  2598. // the coordinates, store that.
  2599. var chAround = null, boxAround = null;
  2600. var ch = findFirst(function (ch) {
  2601. var box = measureCharPrepared(cm, preparedMeasure, ch);
  2602. box.top += widgetHeight; box.bottom += widgetHeight;
  2603. if (!boxIsAfter(box, x, y, false)) { return false }
  2604. if (box.top <= y && box.left <= x) {
  2605. chAround = ch;
  2606. boxAround = box;
  2607. }
  2608. return true
  2609. }, begin, end);
  2610. var baseX, sticky, outside = false;
  2611. // If a box around the coordinates was found, use that
  2612. if (boxAround) {
  2613. // Distinguish coordinates nearer to the left or right side of the box
  2614. var atLeft = x - boxAround.left < boxAround.right - x, atStart = atLeft == ltr;
  2615. ch = chAround + (atStart ? 0 : 1);
  2616. sticky = atStart ? "after" : "before";
  2617. baseX = atLeft ? boxAround.left : boxAround.right;
  2618. } else {
  2619. // (Adjust for extended bound, if necessary.)
  2620. if (!ltr && (ch == end || ch == begin)) { ch++; }
  2621. // To determine which side to associate with, get the box to the
  2622. // left of the character and compare it's vertical position to the
  2623. // coordinates
  2624. sticky = ch == 0 ? "after" : ch == lineObj.text.length ? "before" :
  2625. (measureCharPrepared(cm, preparedMeasure, ch - (ltr ? 1 : 0)).bottom + widgetHeight <= y) == ltr ?
  2626. "after" : "before";
  2627. // Now get accurate coordinates for this place, in order to get a
  2628. // base X position
  2629. var coords = cursorCoords(cm, Pos(lineNo, ch, sticky), "line", lineObj, preparedMeasure);
  2630. baseX = coords.left;
  2631. outside = y < coords.top ? -1 : y >= coords.bottom ? 1 : 0;
  2632. }
  2633. ch = skipExtendingChars(lineObj.text, ch, 1);
  2634. return PosWithInfo(lineNo, ch, sticky, outside, x - baseX)
  2635. }
  2636. function coordsBidiPart(cm, lineObj, lineNo, preparedMeasure, order, x, y) {
  2637. // Bidi parts are sorted left-to-right, and in a non-line-wrapping
  2638. // situation, we can take this ordering to correspond to the visual
  2639. // ordering. This finds the first part whose end is after the given
  2640. // coordinates.
  2641. var index = findFirst(function (i) {
  2642. var part = order[i], ltr = part.level != 1;
  2643. return boxIsAfter(cursorCoords(cm, Pos(lineNo, ltr ? part.to : part.from, ltr ? "before" : "after"),
  2644. "line", lineObj, preparedMeasure), x, y, true)
  2645. }, 0, order.length - 1);
  2646. var part = order[index];
  2647. // If this isn't the first part, the part's start is also after
  2648. // the coordinates, and the coordinates aren't on the same line as
  2649. // that start, move one part back.
  2650. if (index > 0) {
  2651. var ltr = part.level != 1;
  2652. var start = cursorCoords(cm, Pos(lineNo, ltr ? part.from : part.to, ltr ? "after" : "before"),
  2653. "line", lineObj, preparedMeasure);
  2654. if (boxIsAfter(start, x, y, true) && start.top > y)
  2655. { part = order[index - 1]; }
  2656. }
  2657. return part
  2658. }
  2659. function coordsBidiPartWrapped(cm, lineObj, _lineNo, preparedMeasure, order, x, y) {
  2660. // In a wrapped line, rtl text on wrapping boundaries can do things
  2661. // that don't correspond to the ordering in our `order` array at
  2662. // all, so a binary search doesn't work, and we want to return a
  2663. // part that only spans one line so that the binary search in
  2664. // coordsCharInner is safe. As such, we first find the extent of the
  2665. // wrapped line, and then do a flat search in which we discard any
  2666. // spans that aren't on the line.
  2667. var ref = wrappedLineExtent(cm, lineObj, preparedMeasure, y);
  2668. var begin = ref.begin;
  2669. var end = ref.end;
  2670. if (/\s/.test(lineObj.text.charAt(end - 1))) { end--; }
  2671. var part = null, closestDist = null;
  2672. for (var i = 0; i < order.length; i++) {
  2673. var p = order[i];
  2674. if (p.from >= end || p.to <= begin) { continue }
  2675. var ltr = p.level != 1;
  2676. var endX = measureCharPrepared(cm, preparedMeasure, ltr ? Math.min(end, p.to) - 1 : Math.max(begin, p.from)).right;
  2677. // Weigh against spans ending before this, so that they are only
  2678. // picked if nothing ends after
  2679. var dist = endX < x ? x - endX + 1e9 : endX - x;
  2680. if (!part || closestDist > dist) {
  2681. part = p;
  2682. closestDist = dist;
  2683. }
  2684. }
  2685. if (!part) { part = order[order.length - 1]; }
  2686. // Clip the part to the wrapped line.
  2687. if (part.from < begin) { part = {from: begin, to: part.to, level: part.level}; }
  2688. if (part.to > end) { part = {from: part.from, to: end, level: part.level}; }
  2689. return part
  2690. }
  2691. var measureText;
  2692. // Compute the default text height.
  2693. function textHeight(display) {
  2694. if (display.cachedTextHeight != null) { return display.cachedTextHeight }
  2695. if (measureText == null) {
  2696. measureText = elt("pre", null, "CodeMirror-line-like");
  2697. // Measure a bunch of lines, for browsers that compute
  2698. // fractional heights.
  2699. for (var i = 0; i < 49; ++i) {
  2700. measureText.appendChild(document.createTextNode("x"));
  2701. measureText.appendChild(elt("br"));
  2702. }
  2703. measureText.appendChild(document.createTextNode("x"));
  2704. }
  2705. removeChildrenAndAdd(display.measure, measureText);
  2706. var height = measureText.offsetHeight / 50;
  2707. if (height > 3) { display.cachedTextHeight = height; }
  2708. removeChildren(display.measure);
  2709. return height || 1
  2710. }
  2711. // Compute the default character width.
  2712. function charWidth(display) {
  2713. if (display.cachedCharWidth != null) { return display.cachedCharWidth }
  2714. var anchor = elt("span", "xxxxxxxxxx");
  2715. var pre = elt("pre", [anchor], "CodeMirror-line-like");
  2716. removeChildrenAndAdd(display.measure, pre);
  2717. var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;
  2718. if (width > 2) { display.cachedCharWidth = width; }
  2719. return width || 10
  2720. }
  2721. // Do a bulk-read of the DOM positions and sizes needed to draw the
  2722. // view, so that we don't interleave reading and writing to the DOM.
  2723. function getDimensions(cm) {
  2724. var d = cm.display, left = {}, width = {};
  2725. var gutterLeft = d.gutters.clientLeft;
  2726. for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
  2727. var id = cm.display.gutterSpecs[i].className;
  2728. left[id] = n.offsetLeft + n.clientLeft + gutterLeft;
  2729. width[id] = n.clientWidth;
  2730. }
  2731. return {fixedPos: compensateForHScroll(d),
  2732. gutterTotalWidth: d.gutters.offsetWidth,
  2733. gutterLeft: left,
  2734. gutterWidth: width,
  2735. wrapperWidth: d.wrapper.clientWidth}
  2736. }
  2737. // Computes display.scroller.scrollLeft + display.gutters.offsetWidth,
  2738. // but using getBoundingClientRect to get a sub-pixel-accurate
  2739. // result.
  2740. function compensateForHScroll(display) {
  2741. return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left
  2742. }
  2743. // Returns a function that estimates the height of a line, to use as
  2744. // first approximation until the line becomes visible (and is thus
  2745. // properly measurable).
  2746. function estimateHeight(cm) {
  2747. var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;
  2748. var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);
  2749. return function (line) {
  2750. if (lineIsHidden(cm.doc, line)) { return 0 }
  2751. var widgetsHeight = 0;
  2752. if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {
  2753. if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }
  2754. } }
  2755. if (wrapping)
  2756. { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }
  2757. else
  2758. { return widgetsHeight + th }
  2759. }
  2760. }
  2761. function estimateLineHeights(cm) {
  2762. var doc = cm.doc, est = estimateHeight(cm);
  2763. doc.iter(function (line) {
  2764. var estHeight = est(line);
  2765. if (estHeight != line.height) { updateLineHeight(line, estHeight); }
  2766. });
  2767. }
  2768. // Given a mouse event, find the corresponding position. If liberal
  2769. // is false, it checks whether a gutter or scrollbar was clicked,
  2770. // and returns null if it was. forRect is used by rectangular
  2771. // selections, and tries to estimate a character position even for
  2772. // coordinates beyond the right of the text.
  2773. function posFromMouse(cm, e, liberal, forRect) {
  2774. var display = cm.display;
  2775. if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") { return null }
  2776. var x, y, space = display.lineSpace.getBoundingClientRect();
  2777. // Fails unpredictably on IE[67] when mouse is dragged around quickly.
  2778. try { x = e.clientX - space.left; y = e.clientY - space.top; }
  2779. catch (e$1) { return null }
  2780. var coords = coordsChar(cm, x, y), line;
  2781. if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {
  2782. var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;
  2783. coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));
  2784. }
  2785. return coords
  2786. }
  2787. // Find the view element corresponding to a given line. Return null
  2788. // when the line isn't visible.
  2789. function findViewIndex(cm, n) {
  2790. if (n >= cm.display.viewTo) { return null }
  2791. n -= cm.display.viewFrom;
  2792. if (n < 0) { return null }
  2793. var view = cm.display.view;
  2794. for (var i = 0; i < view.length; i++) {
  2795. n -= view[i].size;
  2796. if (n < 0) { return i }
  2797. }
  2798. }
  2799. // Updates the display.view data structure for a given change to the
  2800. // document. From and to are in pre-change coordinates. Lendiff is
  2801. // the amount of lines added or subtracted by the change. This is
  2802. // used for changes that span multiple lines, or change the way
  2803. // lines are divided into visual lines. regLineChange (below)
  2804. // registers single-line changes.
  2805. function regChange(cm, from, to, lendiff) {
  2806. if (from == null) { from = cm.doc.first; }
  2807. if (to == null) { to = cm.doc.first + cm.doc.size; }
  2808. if (!lendiff) { lendiff = 0; }
  2809. var display = cm.display;
  2810. if (lendiff && to < display.viewTo &&
  2811. (display.updateLineNumbers == null || display.updateLineNumbers > from))
  2812. { display.updateLineNumbers = from; }
  2813. cm.curOp.viewChanged = true;
  2814. if (from >= display.viewTo) { // Change after
  2815. if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)
  2816. { resetView(cm); }
  2817. } else if (to <= display.viewFrom) { // Change before
  2818. if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {
  2819. resetView(cm);
  2820. } else {
  2821. display.viewFrom += lendiff;
  2822. display.viewTo += lendiff;
  2823. }
  2824. } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap
  2825. resetView(cm);
  2826. } else if (from <= display.viewFrom) { // Top overlap
  2827. var cut = viewCuttingPoint(cm, to, to + lendiff, 1);
  2828. if (cut) {
  2829. display.view = display.view.slice(cut.index);
  2830. display.viewFrom = cut.lineN;
  2831. display.viewTo += lendiff;
  2832. } else {
  2833. resetView(cm);
  2834. }
  2835. } else if (to >= display.viewTo) { // Bottom overlap
  2836. var cut$1 = viewCuttingPoint(cm, from, from, -1);
  2837. if (cut$1) {
  2838. display.view = display.view.slice(0, cut$1.index);
  2839. display.viewTo = cut$1.lineN;
  2840. } else {
  2841. resetView(cm);
  2842. }
  2843. } else { // Gap in the middle
  2844. var cutTop = viewCuttingPoint(cm, from, from, -1);
  2845. var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);
  2846. if (cutTop && cutBot) {
  2847. display.view = display.view.slice(0, cutTop.index)
  2848. .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))
  2849. .concat(display.view.slice(cutBot.index));
  2850. display.viewTo += lendiff;
  2851. } else {
  2852. resetView(cm);
  2853. }
  2854. }
  2855. var ext = display.externalMeasured;
  2856. if (ext) {
  2857. if (to < ext.lineN)
  2858. { ext.lineN += lendiff; }
  2859. else if (from < ext.lineN + ext.size)
  2860. { display.externalMeasured = null; }
  2861. }
  2862. }
  2863. // Register a change to a single line. Type must be one of "text",
  2864. // "gutter", "class", "widget"
  2865. function regLineChange(cm, line, type) {
  2866. cm.curOp.viewChanged = true;
  2867. var display = cm.display, ext = cm.display.externalMeasured;
  2868. if (ext && line >= ext.lineN && line < ext.lineN + ext.size)
  2869. { display.externalMeasured = null; }
  2870. if (line < display.viewFrom || line >= display.viewTo) { return }
  2871. var lineView = display.view[findViewIndex(cm, line)];
  2872. if (lineView.node == null) { return }
  2873. var arr = lineView.changes || (lineView.changes = []);
  2874. if (indexOf(arr, type) == -1) { arr.push(type); }
  2875. }
  2876. // Clear the view.
  2877. function resetView(cm) {
  2878. cm.display.viewFrom = cm.display.viewTo = cm.doc.first;
  2879. cm.display.view = [];
  2880. cm.display.viewOffset = 0;
  2881. }
  2882. function viewCuttingPoint(cm, oldN, newN, dir) {
  2883. var index = findViewIndex(cm, oldN), diff, view = cm.display.view;
  2884. if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)
  2885. { return {index: index, lineN: newN} }
  2886. var n = cm.display.viewFrom;
  2887. for (var i = 0; i < index; i++)
  2888. { n += view[i].size; }
  2889. if (n != oldN) {
  2890. if (dir > 0) {
  2891. if (index == view.length - 1) { return null }
  2892. diff = (n + view[index].size) - oldN;
  2893. index++;
  2894. } else {
  2895. diff = n - oldN;
  2896. }
  2897. oldN += diff; newN += diff;
  2898. }
  2899. while (visualLineNo(cm.doc, newN) != newN) {
  2900. if (index == (dir < 0 ? 0 : view.length - 1)) { return null }
  2901. newN += dir * view[index - (dir < 0 ? 1 : 0)].size;
  2902. index += dir;
  2903. }
  2904. return {index: index, lineN: newN}
  2905. }
  2906. // Force the view to cover a given range, adding empty view element
  2907. // or clipping off existing ones as needed.
  2908. function adjustView(cm, from, to) {
  2909. var display = cm.display, view = display.view;
  2910. if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
  2911. display.view = buildViewArray(cm, from, to);
  2912. display.viewFrom = from;
  2913. } else {
  2914. if (display.viewFrom > from)
  2915. { display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view); }
  2916. else if (display.viewFrom < from)
  2917. { display.view = display.view.slice(findViewIndex(cm, from)); }
  2918. display.viewFrom = from;
  2919. if (display.viewTo < to)
  2920. { display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)); }
  2921. else if (display.viewTo > to)
  2922. { display.view = display.view.slice(0, findViewIndex(cm, to)); }
  2923. }
  2924. display.viewTo = to;
  2925. }
  2926. // Count the number of lines in the view whose DOM representation is
  2927. // out of date (or nonexistent).
  2928. function countDirtyView(cm) {
  2929. var view = cm.display.view, dirty = 0;
  2930. for (var i = 0; i < view.length; i++) {
  2931. var lineView = view[i];
  2932. if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }
  2933. }
  2934. return dirty
  2935. }
  2936. function updateSelection(cm) {
  2937. cm.display.input.showSelection(cm.display.input.prepareSelection());
  2938. }
  2939. function prepareSelection(cm, primary) {
  2940. if ( primary === void 0 ) primary = true;
  2941. var doc = cm.doc, result = {};
  2942. var curFragment = result.cursors = document.createDocumentFragment();
  2943. var selFragment = result.selection = document.createDocumentFragment();
  2944. for (var i = 0; i < doc.sel.ranges.length; i++) {
  2945. if (!primary && i == doc.sel.primIndex) { continue }
  2946. var range = doc.sel.ranges[i];
  2947. if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) { continue }
  2948. var collapsed = range.empty();
  2949. if (collapsed || cm.options.showCursorWhenSelecting)
  2950. { drawSelectionCursor(cm, range.head, curFragment); }
  2951. if (!collapsed)
  2952. { drawSelectionRange(cm, range, selFragment); }
  2953. }
  2954. return result
  2955. }
  2956. // Draws a cursor for the given range
  2957. function drawSelectionCursor(cm, head, output) {
  2958. var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine);
  2959. var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"));
  2960. cursor.style.left = pos.left + "px";
  2961. cursor.style.top = pos.top + "px";
  2962. cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px";
  2963. if (pos.other) {
  2964. // Secondary cursor, shown when on a 'jump' in bi-directional text
  2965. var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"));
  2966. otherCursor.style.display = "";
  2967. otherCursor.style.left = pos.other.left + "px";
  2968. otherCursor.style.top = pos.other.top + "px";
  2969. otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px";
  2970. }
  2971. }
  2972. function cmpCoords(a, b) { return a.top - b.top || a.left - b.left }
  2973. // Draws the given range as a highlighted selection
  2974. function drawSelectionRange(cm, range, output) {
  2975. var display = cm.display, doc = cm.doc;
  2976. var fragment = document.createDocumentFragment();
  2977. var padding = paddingH(cm.display), leftSide = padding.left;
  2978. var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;
  2979. var docLTR = doc.direction == "ltr";
  2980. function add(left, top, width, bottom) {
  2981. if (top < 0) { top = 0; }
  2982. top = Math.round(top);
  2983. bottom = Math.round(bottom);
  2984. fragment.appendChild(elt("div", null, "CodeMirror-selected", ("position: absolute; left: " + left + "px;\n top: " + top + "px; width: " + (width == null ? rightSide - left : width) + "px;\n height: " + (bottom - top) + "px")));
  2985. }
  2986. function drawForLine(line, fromArg, toArg) {
  2987. var lineObj = getLine(doc, line);
  2988. var lineLen = lineObj.text.length;
  2989. var start, end;
  2990. function coords(ch, bias) {
  2991. return charCoords(cm, Pos(line, ch), "div", lineObj, bias)
  2992. }
  2993. function wrapX(pos, dir, side) {
  2994. var extent = wrappedLineExtentChar(cm, lineObj, null, pos);
  2995. var prop = (dir == "ltr") == (side == "after") ? "left" : "right";
  2996. var ch = side == "after" ? extent.begin : extent.end - (/\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);
  2997. return coords(ch, prop)[prop]
  2998. }
  2999. var order = getOrder(lineObj, doc.direction);
  3000. iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {
  3001. var ltr = dir == "ltr";
  3002. var fromPos = coords(from, ltr ? "left" : "right");
  3003. var toPos = coords(to - 1, ltr ? "right" : "left");
  3004. var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;
  3005. var first = i == 0, last = !order || i == order.length - 1;
  3006. if (toPos.top - fromPos.top <= 3) { // Single line
  3007. var openLeft = (docLTR ? openStart : openEnd) && first;
  3008. var openRight = (docLTR ? openEnd : openStart) && last;
  3009. var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;
  3010. var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;
  3011. add(left, fromPos.top, right - left, fromPos.bottom);
  3012. } else { // Multiple lines
  3013. var topLeft, topRight, botLeft, botRight;
  3014. if (ltr) {
  3015. topLeft = docLTR && openStart && first ? leftSide : fromPos.left;
  3016. topRight = docLTR ? rightSide : wrapX(from, dir, "before");
  3017. botLeft = docLTR ? leftSide : wrapX(to, dir, "after");
  3018. botRight = docLTR && openEnd && last ? rightSide : toPos.right;
  3019. } else {
  3020. topLeft = !docLTR ? leftSide : wrapX(from, dir, "before");
  3021. topRight = !docLTR && openStart && first ? rightSide : fromPos.right;
  3022. botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;
  3023. botRight = !docLTR ? rightSide : wrapX(to, dir, "after");
  3024. }
  3025. add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);
  3026. if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }
  3027. add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);
  3028. }
  3029. if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }
  3030. if (cmpCoords(toPos, start) < 0) { start = toPos; }
  3031. if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }
  3032. if (cmpCoords(toPos, end) < 0) { end = toPos; }
  3033. });
  3034. return {start: start, end: end}
  3035. }
  3036. var sFrom = range.from(), sTo = range.to();
  3037. if (sFrom.line == sTo.line) {
  3038. drawForLine(sFrom.line, sFrom.ch, sTo.ch);
  3039. } else {
  3040. var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);
  3041. var singleVLine = visualLine(fromLine) == visualLine(toLine);
  3042. var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;
  3043. var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;
  3044. if (singleVLine) {
  3045. if (leftEnd.top < rightStart.top - 2) {
  3046. add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);
  3047. add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);
  3048. } else {
  3049. add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);
  3050. }
  3051. }
  3052. if (leftEnd.bottom < rightStart.top)
  3053. { add(leftSide, leftEnd.bottom, null, rightStart.top); }
  3054. }
  3055. output.appendChild(fragment);
  3056. }
  3057. // Cursor-blinking
  3058. function restartBlink(cm) {
  3059. if (!cm.state.focused) { return }
  3060. var display = cm.display;
  3061. clearInterval(display.blinker);
  3062. var on = true;
  3063. display.cursorDiv.style.visibility = "";
  3064. if (cm.options.cursorBlinkRate > 0)
  3065. { display.blinker = setInterval(function () {
  3066. if (!cm.hasFocus()) { onBlur(cm); }
  3067. display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden";
  3068. }, cm.options.cursorBlinkRate); }
  3069. else if (cm.options.cursorBlinkRate < 0)
  3070. { display.cursorDiv.style.visibility = "hidden"; }
  3071. }
  3072. function ensureFocus(cm) {
  3073. if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); }
  3074. }
  3075. function delayBlurEvent(cm) {
  3076. cm.state.delayingBlurEvent = true;
  3077. setTimeout(function () { if (cm.state.delayingBlurEvent) {
  3078. cm.state.delayingBlurEvent = false;
  3079. onBlur(cm);
  3080. } }, 100);
  3081. }
  3082. function onFocus(cm, e) {
  3083. if (cm.state.delayingBlurEvent) { cm.state.delayingBlurEvent = false; }
  3084. if (cm.options.readOnly == "nocursor") { return }
  3085. if (!cm.state.focused) {
  3086. signal(cm, "focus", cm, e);
  3087. cm.state.focused = true;
  3088. addClass(cm.display.wrapper, "CodeMirror-focused");
  3089. // This test prevents this from firing when a context
  3090. // menu is closed (since the input reset would kill the
  3091. // select-all detection hack)
  3092. if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
  3093. cm.display.input.reset();
  3094. if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20); } // Issue #1730
  3095. }
  3096. cm.display.input.receivedFocus();
  3097. }
  3098. restartBlink(cm);
  3099. }
  3100. function onBlur(cm, e) {
  3101. if (cm.state.delayingBlurEvent) { return }
  3102. if (cm.state.focused) {
  3103. signal(cm, "blur", cm, e);
  3104. cm.state.focused = false;
  3105. rmClass(cm.display.wrapper, "CodeMirror-focused");
  3106. }
  3107. clearInterval(cm.display.blinker);
  3108. setTimeout(function () { if (!cm.state.focused) { cm.display.shift = false; } }, 150);
  3109. }
  3110. // Read the actual heights of the rendered lines, and update their
  3111. // stored heights to match.
  3112. function updateHeightsInViewport(cm) {
  3113. var display = cm.display;
  3114. var prevBottom = display.lineDiv.offsetTop;
  3115. for (var i = 0; i < display.view.length; i++) {
  3116. var cur = display.view[i], wrapping = cm.options.lineWrapping;
  3117. var height = (void 0), width = 0;
  3118. if (cur.hidden) { continue }
  3119. if (ie && ie_version < 8) {
  3120. var bot = cur.node.offsetTop + cur.node.offsetHeight;
  3121. height = bot - prevBottom;
  3122. prevBottom = bot;
  3123. } else {
  3124. var box = cur.node.getBoundingClientRect();
  3125. height = box.bottom - box.top;
  3126. // Check that lines don't extend past the right of the current
  3127. // editor width
  3128. if (!wrapping && cur.text.firstChild)
  3129. { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }
  3130. }
  3131. var diff = cur.line.height - height;
  3132. if (diff > .005 || diff < -.005) {
  3133. updateLineHeight(cur.line, height);
  3134. updateWidgetHeight(cur.line);
  3135. if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)
  3136. { updateWidgetHeight(cur.rest[j]); } }
  3137. }
  3138. if (width > cm.display.sizerWidth) {
  3139. var chWidth = Math.ceil(width / charWidth(cm.display));
  3140. if (chWidth > cm.display.maxLineLength) {
  3141. cm.display.maxLineLength = chWidth;
  3142. cm.display.maxLine = cur.line;
  3143. cm.display.maxLineChanged = true;
  3144. }
  3145. }
  3146. }
  3147. }
  3148. // Read and store the height of line widgets associated with the
  3149. // given line.
  3150. function updateWidgetHeight(line) {
  3151. if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {
  3152. var w = line.widgets[i], parent = w.node.parentNode;
  3153. if (parent) { w.height = parent.offsetHeight; }
  3154. } }
  3155. }
  3156. // Compute the lines that are visible in a given viewport (defaults
  3157. // the the current scroll position). viewport may contain top,
  3158. // height, and ensure (see op.scrollToPos) properties.
  3159. function visibleLines(display, doc, viewport) {
  3160. var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;
  3161. top = Math.floor(top - paddingTop(display));
  3162. var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;
  3163. var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);
  3164. // Ensure is a {from: {line, ch}, to: {line, ch}} object, and
  3165. // forces those lines into the viewport (if possible).
  3166. if (viewport && viewport.ensure) {
  3167. var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;
  3168. if (ensureFrom < from) {
  3169. from = ensureFrom;
  3170. to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);
  3171. } else if (Math.min(ensureTo, doc.lastLine()) >= to) {
  3172. from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);
  3173. to = ensureTo;
  3174. }
  3175. }
  3176. return {from: from, to: Math.max(to, from + 1)}
  3177. }
  3178. // SCROLLING THINGS INTO VIEW
  3179. // If an editor sits on the top or bottom of the window, partially
  3180. // scrolled out of view, this ensures that the cursor is visible.
  3181. function maybeScrollWindow(cm, rect) {
  3182. if (signalDOMEvent(cm, "scrollCursorIntoView")) { return }
  3183. var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;
  3184. if (rect.top + box.top < 0) { doScroll = true; }
  3185. else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false; }
  3186. if (doScroll != null && !phantom) {
  3187. var scrollNode = elt("div", "\u200b", null, ("position: absolute;\n top: " + (rect.top - display.viewOffset - paddingTop(cm.display)) + "px;\n height: " + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + "px;\n left: " + (rect.left) + "px; width: " + (Math.max(2, rect.right - rect.left)) + "px;"));
  3188. cm.display.lineSpace.appendChild(scrollNode);
  3189. scrollNode.scrollIntoView(doScroll);
  3190. cm.display.lineSpace.removeChild(scrollNode);
  3191. }
  3192. }
  3193. // Scroll a given position into view (immediately), verifying that
  3194. // it actually became visible (as line heights are accurately
  3195. // measured, the position of something may 'drift' during drawing).
  3196. function scrollPosIntoView(cm, pos, end, margin) {
  3197. if (margin == null) { margin = 0; }
  3198. var rect;
  3199. if (!cm.options.lineWrapping && pos == end) {
  3200. // Set pos and end to the cursor positions around the character pos sticks to
  3201. // If pos.sticky == "before", that is around pos.ch - 1, otherwise around pos.ch
  3202. // If pos == Pos(_, 0, "before"), pos and end are unchanged
  3203. pos = pos.ch ? Pos(pos.line, pos.sticky == "before" ? pos.ch - 1 : pos.ch, "after") : pos;
  3204. end = pos.sticky == "before" ? Pos(pos.line, pos.ch + 1, "before") : pos;
  3205. }
  3206. for (var limit = 0; limit < 5; limit++) {
  3207. var changed = false;
  3208. var coords = cursorCoords(cm, pos);
  3209. var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);
  3210. rect = {left: Math.min(coords.left, endCoords.left),
  3211. top: Math.min(coords.top, endCoords.top) - margin,
  3212. right: Math.max(coords.left, endCoords.left),
  3213. bottom: Math.max(coords.bottom, endCoords.bottom) + margin};
  3214. var scrollPos = calculateScrollPos(cm, rect);
  3215. var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;
  3216. if (scrollPos.scrollTop != null) {
  3217. updateScrollTop(cm, scrollPos.scrollTop);
  3218. if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }
  3219. }
  3220. if (scrollPos.scrollLeft != null) {
  3221. setScrollLeft(cm, scrollPos.scrollLeft);
  3222. if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }
  3223. }
  3224. if (!changed) { break }
  3225. }
  3226. return rect
  3227. }
  3228. // Scroll a given set of coordinates into view (immediately).
  3229. function scrollIntoView(cm, rect) {
  3230. var scrollPos = calculateScrollPos(cm, rect);
  3231. if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }
  3232. if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }
  3233. }
  3234. // Calculate a new scroll position needed to scroll the given
  3235. // rectangle into view. Returns an object with scrollTop and
  3236. // scrollLeft properties. When these are undefined, the
  3237. // vertical/horizontal position does not need to be adjusted.
  3238. function calculateScrollPos(cm, rect) {
  3239. var display = cm.display, snapMargin = textHeight(cm.display);
  3240. if (rect.top < 0) { rect.top = 0; }
  3241. var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;
  3242. var screen = displayHeight(cm), result = {};
  3243. if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }
  3244. var docBottom = cm.doc.height + paddingVert(display);
  3245. var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;
  3246. if (rect.top < screentop) {
  3247. result.scrollTop = atTop ? 0 : rect.top;
  3248. } else if (rect.bottom > screentop + screen) {
  3249. var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);
  3250. if (newTop != screentop) { result.scrollTop = newTop; }
  3251. }
  3252. var gutterSpace = cm.options.fixedGutter ? 0 : display.gutters.offsetWidth;
  3253. var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft - gutterSpace;
  3254. var screenw = displayWidth(cm) - display.gutters.offsetWidth;
  3255. var tooWide = rect.right - rect.left > screenw;
  3256. if (tooWide) { rect.right = rect.left + screenw; }
  3257. if (rect.left < 10)
  3258. { result.scrollLeft = 0; }
  3259. else if (rect.left < screenleft)
  3260. { result.scrollLeft = Math.max(0, rect.left + gutterSpace - (tooWide ? 0 : 10)); }
  3261. else if (rect.right > screenw + screenleft - 3)
  3262. { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }
  3263. return result
  3264. }
  3265. // Store a relative adjustment to the scroll position in the current
  3266. // operation (to be applied when the operation finishes).
  3267. function addToScrollTop(cm, top) {
  3268. if (top == null) { return }
  3269. resolveScrollToPos(cm);
  3270. cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;
  3271. }
  3272. // Make sure that at the end of the operation the current cursor is
  3273. // shown.
  3274. function ensureCursorVisible(cm) {
  3275. resolveScrollToPos(cm);
  3276. var cur = cm.getCursor();
  3277. cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};
  3278. }
  3279. function scrollToCoords(cm, x, y) {
  3280. if (x != null || y != null) { resolveScrollToPos(cm); }
  3281. if (x != null) { cm.curOp.scrollLeft = x; }
  3282. if (y != null) { cm.curOp.scrollTop = y; }
  3283. }
  3284. function scrollToRange(cm, range) {
  3285. resolveScrollToPos(cm);
  3286. cm.curOp.scrollToPos = range;
  3287. }
  3288. // When an operation has its scrollToPos property set, and another
  3289. // scroll action is applied before the end of the operation, this
  3290. // 'simulates' scrolling that position into view in a cheap way, so
  3291. // that the effect of intermediate scroll commands is not ignored.
  3292. function resolveScrollToPos(cm) {
  3293. var range = cm.curOp.scrollToPos;
  3294. if (range) {
  3295. cm.curOp.scrollToPos = null;
  3296. var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);
  3297. scrollToCoordsRange(cm, from, to, range.margin);
  3298. }
  3299. }
  3300. function scrollToCoordsRange(cm, from, to, margin) {
  3301. var sPos = calculateScrollPos(cm, {
  3302. left: Math.min(from.left, to.left),
  3303. top: Math.min(from.top, to.top) - margin,
  3304. right: Math.max(from.right, to.right),
  3305. bottom: Math.max(from.bottom, to.bottom) + margin
  3306. });
  3307. scrollToCoords(cm, sPos.scrollLeft, sPos.scrollTop);
  3308. }
  3309. // Sync the scrollable area and scrollbars, ensure the viewport
  3310. // covers the visible area.
  3311. function updateScrollTop(cm, val) {
  3312. if (Math.abs(cm.doc.scrollTop - val) < 2) { return }
  3313. if (!gecko) { updateDisplaySimple(cm, {top: val}); }
  3314. setScrollTop(cm, val, true);
  3315. if (gecko) { updateDisplaySimple(cm); }
  3316. startWorker(cm, 100);
  3317. }
  3318. function setScrollTop(cm, val, forceScroll) {
  3319. val = Math.max(0, Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight, val));
  3320. if (cm.display.scroller.scrollTop == val && !forceScroll) { return }
  3321. cm.doc.scrollTop = val;
  3322. cm.display.scrollbars.setScrollTop(val);
  3323. if (cm.display.scroller.scrollTop != val) { cm.display.scroller.scrollTop = val; }
  3324. }
  3325. // Sync scroller and scrollbar, ensure the gutter elements are
  3326. // aligned.
  3327. function setScrollLeft(cm, val, isScroller, forceScroll) {
  3328. val = Math.max(0, Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth));
  3329. if ((isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) && !forceScroll) { return }
  3330. cm.doc.scrollLeft = val;
  3331. alignHorizontally(cm);
  3332. if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val; }
  3333. cm.display.scrollbars.setScrollLeft(val);
  3334. }
  3335. // SCROLLBARS
  3336. // Prepare DOM reads needed to update the scrollbars. Done in one
  3337. // shot to minimize update/measure roundtrips.
  3338. function measureForScrollbars(cm) {
  3339. var d = cm.display, gutterW = d.gutters.offsetWidth;
  3340. var docH = Math.round(cm.doc.height + paddingVert(cm.display));
  3341. return {
  3342. clientHeight: d.scroller.clientHeight,
  3343. viewHeight: d.wrapper.clientHeight,
  3344. scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,
  3345. viewWidth: d.wrapper.clientWidth,
  3346. barLeft: cm.options.fixedGutter ? gutterW : 0,
  3347. docHeight: docH,
  3348. scrollHeight: docH + scrollGap(cm) + d.barHeight,
  3349. nativeBarWidth: d.nativeBarWidth,
  3350. gutterWidth: gutterW
  3351. }
  3352. }
  3353. var NativeScrollbars = function(place, scroll, cm) {
  3354. this.cm = cm;
  3355. var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar");
  3356. var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar");
  3357. vert.tabIndex = horiz.tabIndex = -1;
  3358. place(vert); place(horiz);
  3359. on(vert, "scroll", function () {
  3360. if (vert.clientHeight) { scroll(vert.scrollTop, "vertical"); }
  3361. });
  3362. on(horiz, "scroll", function () {
  3363. if (horiz.clientWidth) { scroll(horiz.scrollLeft, "horizontal"); }
  3364. });
  3365. this.checkedZeroWidth = false;
  3366. // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
  3367. if (ie && ie_version < 8) { this.horiz.style.minHeight = this.vert.style.minWidth = "18px"; }
  3368. };
  3369. NativeScrollbars.prototype.update = function (measure) {
  3370. var needsH = measure.scrollWidth > measure.clientWidth + 1;
  3371. var needsV = measure.scrollHeight > measure.clientHeight + 1;
  3372. var sWidth = measure.nativeBarWidth;
  3373. if (needsV) {
  3374. this.vert.style.display = "block";
  3375. this.vert.style.bottom = needsH ? sWidth + "px" : "0";
  3376. var totalHeight = measure.viewHeight - (needsH ? sWidth : 0);
  3377. // A bug in IE8 can cause this value to be negative, so guard it.
  3378. this.vert.firstChild.style.height =
  3379. Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px";
  3380. } else {
  3381. this.vert.style.display = "";
  3382. this.vert.firstChild.style.height = "0";
  3383. }
  3384. if (needsH) {
  3385. this.horiz.style.display = "block";
  3386. this.horiz.style.right = needsV ? sWidth + "px" : "0";
  3387. this.horiz.style.left = measure.barLeft + "px";
  3388. var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0);
  3389. this.horiz.firstChild.style.width =
  3390. Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + "px";
  3391. } else {
  3392. this.horiz.style.display = "";
  3393. this.horiz.firstChild.style.width = "0";
  3394. }
  3395. if (!this.checkedZeroWidth && measure.clientHeight > 0) {
  3396. if (sWidth == 0) { this.zeroWidthHack(); }
  3397. this.checkedZeroWidth = true;
  3398. }
  3399. return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}
  3400. };
  3401. NativeScrollbars.prototype.setScrollLeft = function (pos) {
  3402. if (this.horiz.scrollLeft != pos) { this.horiz.scrollLeft = pos; }
  3403. if (this.disableHoriz) { this.enableZeroWidthBar(this.horiz, this.disableHoriz, "horiz"); }
  3404. };
  3405. NativeScrollbars.prototype.setScrollTop = function (pos) {
  3406. if (this.vert.scrollTop != pos) { this.vert.scrollTop = pos; }
  3407. if (this.disableVert) { this.enableZeroWidthBar(this.vert, this.disableVert, "vert"); }
  3408. };
  3409. NativeScrollbars.prototype.zeroWidthHack = function () {
  3410. var w = mac && !mac_geMountainLion ? "12px" : "18px";
  3411. this.horiz.style.height = this.vert.style.width = w;
  3412. this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none";
  3413. this.disableHoriz = new Delayed;
  3414. this.disableVert = new Delayed;
  3415. };
  3416. NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay, type) {
  3417. bar.style.pointerEvents = "auto";
  3418. function maybeDisable() {
  3419. // To find out whether the scrollbar is still visible, we
  3420. // check whether the element under the pixel in the bottom
  3421. // right corner of the scrollbar box is the scrollbar box
  3422. // itself (when the bar is still visible) or its filler child
  3423. // (when the bar is hidden). If it is still visible, we keep
  3424. // it enabled, if it's hidden, we disable pointer events.
  3425. var box = bar.getBoundingClientRect();
  3426. var elt = type == "vert" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2)
  3427. : document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1);
  3428. if (elt != bar) { bar.style.pointerEvents = "none"; }
  3429. else { delay.set(1000, maybeDisable); }
  3430. }
  3431. delay.set(1000, maybeDisable);
  3432. };
  3433. NativeScrollbars.prototype.clear = function () {
  3434. var parent = this.horiz.parentNode;
  3435. parent.removeChild(this.horiz);
  3436. parent.removeChild(this.vert);
  3437. };
  3438. var NullScrollbars = function () {};
  3439. NullScrollbars.prototype.update = function () { return {bottom: 0, right: 0} };
  3440. NullScrollbars.prototype.setScrollLeft = function () {};
  3441. NullScrollbars.prototype.setScrollTop = function () {};
  3442. NullScrollbars.prototype.clear = function () {};
  3443. function updateScrollbars(cm, measure) {
  3444. if (!measure) { measure = measureForScrollbars(cm); }
  3445. var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight;
  3446. updateScrollbarsInner(cm, measure);
  3447. for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {
  3448. if (startWidth != cm.display.barWidth && cm.options.lineWrapping)
  3449. { updateHeightsInViewport(cm); }
  3450. updateScrollbarsInner(cm, measureForScrollbars(cm));
  3451. startWidth = cm.display.barWidth; startHeight = cm.display.barHeight;
  3452. }
  3453. }
  3454. // Re-synchronize the fake scrollbars with the actual size of the
  3455. // content.
  3456. function updateScrollbarsInner(cm, measure) {
  3457. var d = cm.display;
  3458. var sizes = d.scrollbars.update(measure);
  3459. d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px";
  3460. d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px";
  3461. d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent";
  3462. if (sizes.right && sizes.bottom) {
  3463. d.scrollbarFiller.style.display = "block";
  3464. d.scrollbarFiller.style.height = sizes.bottom + "px";
  3465. d.scrollbarFiller.style.width = sizes.right + "px";
  3466. } else { d.scrollbarFiller.style.display = ""; }
  3467. if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {
  3468. d.gutterFiller.style.display = "block";
  3469. d.gutterFiller.style.height = sizes.bottom + "px";
  3470. d.gutterFiller.style.width = measure.gutterWidth + "px";
  3471. } else { d.gutterFiller.style.display = ""; }
  3472. }
  3473. var scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars};
  3474. function initScrollbars(cm) {
  3475. if (cm.display.scrollbars) {
  3476. cm.display.scrollbars.clear();
  3477. if (cm.display.scrollbars.addClass)
  3478. { rmClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
  3479. }
  3480. cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) {
  3481. cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller);
  3482. // Prevent clicks in the scrollbars from killing focus
  3483. on(node, "mousedown", function () {
  3484. if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0); }
  3485. });
  3486. node.setAttribute("cm-not-content", "true");
  3487. }, function (pos, axis) {
  3488. if (axis == "horizontal") { setScrollLeft(cm, pos); }
  3489. else { updateScrollTop(cm, pos); }
  3490. }, cm);
  3491. if (cm.display.scrollbars.addClass)
  3492. { addClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
  3493. }
  3494. // Operations are used to wrap a series of changes to the editor
  3495. // state in such a way that each change won't have to update the
  3496. // cursor and display (which would be awkward, slow, and
  3497. // error-prone). Instead, display updates are batched and then all
  3498. // combined and executed at once.
  3499. var nextOpId = 0;
  3500. // Start a new operation.
  3501. function startOperation(cm) {
  3502. cm.curOp = {
  3503. cm: cm,
  3504. viewChanged: false, // Flag that indicates that lines might need to be redrawn
  3505. startHeight: cm.doc.height, // Used to detect need to update scrollbar
  3506. forceUpdate: false, // Used to force a redraw
  3507. updateInput: 0, // Whether to reset the input textarea
  3508. typing: false, // Whether this reset should be careful to leave existing text (for compositing)
  3509. changeObjs: null, // Accumulated changes, for firing change events
  3510. cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on
  3511. cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already
  3512. selectionChanged: false, // Whether the selection needs to be redrawn
  3513. updateMaxLine: false, // Set when the widest line needs to be determined anew
  3514. scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet
  3515. scrollToPos: null, // Used to scroll to a specific position
  3516. focus: false,
  3517. id: ++nextOpId // Unique ID
  3518. };
  3519. pushOperation(cm.curOp);
  3520. }
  3521. // Finish an operation, updating the display and signalling delayed events
  3522. function endOperation(cm) {
  3523. var op = cm.curOp;
  3524. if (op) { finishOperation(op, function (group) {
  3525. for (var i = 0; i < group.ops.length; i++)
  3526. { group.ops[i].cm.curOp = null; }
  3527. endOperations(group);
  3528. }); }
  3529. }
  3530. // The DOM updates done when an operation finishes are batched so
  3531. // that the minimum number of relayouts are required.
  3532. function endOperations(group) {
  3533. var ops = group.ops;
  3534. for (var i = 0; i < ops.length; i++) // Read DOM
  3535. { endOperation_R1(ops[i]); }
  3536. for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe)
  3537. { endOperation_W1(ops[i$1]); }
  3538. for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM
  3539. { endOperation_R2(ops[i$2]); }
  3540. for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe)
  3541. { endOperation_W2(ops[i$3]); }
  3542. for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM
  3543. { endOperation_finish(ops[i$4]); }
  3544. }
  3545. function endOperation_R1(op) {
  3546. var cm = op.cm, display = cm.display;
  3547. maybeClipScrollbars(cm);
  3548. if (op.updateMaxLine) { findMaxLine(cm); }
  3549. op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||
  3550. op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||
  3551. op.scrollToPos.to.line >= display.viewTo) ||
  3552. display.maxLineChanged && cm.options.lineWrapping;
  3553. op.update = op.mustUpdate &&
  3554. new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);
  3555. }
  3556. function endOperation_W1(op) {
  3557. op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update);
  3558. }
  3559. function endOperation_R2(op) {
  3560. var cm = op.cm, display = cm.display;
  3561. if (op.updatedDisplay) { updateHeightsInViewport(cm); }
  3562. op.barMeasure = measureForScrollbars(cm);
  3563. // If the max line changed since it was last measured, measure it,
  3564. // and ensure the document's width matches it.
  3565. // updateDisplay_W2 will use these properties to do the actual resizing
  3566. if (display.maxLineChanged && !cm.options.lineWrapping) {
  3567. op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3;
  3568. cm.display.sizerWidth = op.adjustWidthTo;
  3569. op.barMeasure.scrollWidth =
  3570. Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth);
  3571. op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm));
  3572. }
  3573. if (op.updatedDisplay || op.selectionChanged)
  3574. { op.preparedSelection = display.input.prepareSelection(); }
  3575. }
  3576. function endOperation_W2(op) {
  3577. var cm = op.cm;
  3578. if (op.adjustWidthTo != null) {
  3579. cm.display.sizer.style.minWidth = op.adjustWidthTo + "px";
  3580. if (op.maxScrollLeft < cm.doc.scrollLeft)
  3581. { setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true); }
  3582. cm.display.maxLineChanged = false;
  3583. }
  3584. var takeFocus = op.focus && op.focus == activeElt();
  3585. if (op.preparedSelection)
  3586. { cm.display.input.showSelection(op.preparedSelection, takeFocus); }
  3587. if (op.updatedDisplay || op.startHeight != cm.doc.height)
  3588. { updateScrollbars(cm, op.barMeasure); }
  3589. if (op.updatedDisplay)
  3590. { setDocumentHeight(cm, op.barMeasure); }
  3591. if (op.selectionChanged) { restartBlink(cm); }
  3592. if (cm.state.focused && op.updateInput)
  3593. { cm.display.input.reset(op.typing); }
  3594. if (takeFocus) { ensureFocus(op.cm); }
  3595. }
  3596. function endOperation_finish(op) {
  3597. var cm = op.cm, display = cm.display, doc = cm.doc;
  3598. if (op.updatedDisplay) { postUpdateDisplay(cm, op.update); }
  3599. // Abort mouse wheel delta measurement, when scrolling explicitly
  3600. if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))
  3601. { display.wheelStartX = display.wheelStartY = null; }
  3602. // Propagate the scroll position to the actual DOM scroller
  3603. if (op.scrollTop != null) { setScrollTop(cm, op.scrollTop, op.forceScroll); }
  3604. if (op.scrollLeft != null) { setScrollLeft(cm, op.scrollLeft, true, true); }
  3605. // If we need to scroll a specific position into view, do so.
  3606. if (op.scrollToPos) {
  3607. var rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),
  3608. clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin);
  3609. maybeScrollWindow(cm, rect);
  3610. }
  3611. // Fire events for markers that are hidden/unidden by editing or
  3612. // undoing
  3613. var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;
  3614. if (hidden) { for (var i = 0; i < hidden.length; ++i)
  3615. { if (!hidden[i].lines.length) { signal(hidden[i], "hide"); } } }
  3616. if (unhidden) { for (var i$1 = 0; i$1 < unhidden.length; ++i$1)
  3617. { if (unhidden[i$1].lines.length) { signal(unhidden[i$1], "unhide"); } } }
  3618. if (display.wrapper.offsetHeight)
  3619. { doc.scrollTop = cm.display.scroller.scrollTop; }
  3620. // Fire change events, and delayed event handlers
  3621. if (op.changeObjs)
  3622. { signal(cm, "changes", cm, op.changeObjs); }
  3623. if (op.update)
  3624. { op.update.finish(); }
  3625. }
  3626. // Run the given function in an operation
  3627. function runInOp(cm, f) {
  3628. if (cm.curOp) { return f() }
  3629. startOperation(cm);
  3630. try { return f() }
  3631. finally { endOperation(cm); }
  3632. }
  3633. // Wraps a function in an operation. Returns the wrapped function.
  3634. function operation(cm, f) {
  3635. return function() {
  3636. if (cm.curOp) { return f.apply(cm, arguments) }
  3637. startOperation(cm);
  3638. try { return f.apply(cm, arguments) }
  3639. finally { endOperation(cm); }
  3640. }
  3641. }
  3642. // Used to add methods to editor and doc instances, wrapping them in
  3643. // operations.
  3644. function methodOp(f) {
  3645. return function() {
  3646. if (this.curOp) { return f.apply(this, arguments) }
  3647. startOperation(this);
  3648. try { return f.apply(this, arguments) }
  3649. finally { endOperation(this); }
  3650. }
  3651. }
  3652. function docMethodOp(f) {
  3653. return function() {
  3654. var cm = this.cm;
  3655. if (!cm || cm.curOp) { return f.apply(this, arguments) }
  3656. startOperation(cm);
  3657. try { return f.apply(this, arguments) }
  3658. finally { endOperation(cm); }
  3659. }
  3660. }
  3661. // HIGHLIGHT WORKER
  3662. function startWorker(cm, time) {
  3663. if (cm.doc.highlightFrontier < cm.display.viewTo)
  3664. { cm.state.highlight.set(time, bind(highlightWorker, cm)); }
  3665. }
  3666. function highlightWorker(cm) {
  3667. var doc = cm.doc;
  3668. if (doc.highlightFrontier >= cm.display.viewTo) { return }
  3669. var end = +new Date + cm.options.workTime;
  3670. var context = getContextBefore(cm, doc.highlightFrontier);
  3671. var changedLines = [];
  3672. doc.iter(context.line, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) {
  3673. if (context.line >= cm.display.viewFrom) { // Visible
  3674. var oldStyles = line.styles;
  3675. var resetState = line.text.length > cm.options.maxHighlightLength ? copyState(doc.mode, context.state) : null;
  3676. var highlighted = highlightLine(cm, line, context, true);
  3677. if (resetState) { context.state = resetState; }
  3678. line.styles = highlighted.styles;
  3679. var oldCls = line.styleClasses, newCls = highlighted.classes;
  3680. if (newCls) { line.styleClasses = newCls; }
  3681. else if (oldCls) { line.styleClasses = null; }
  3682. var ischange = !oldStyles || oldStyles.length != line.styles.length ||
  3683. oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);
  3684. for (var i = 0; !ischange && i < oldStyles.length; ++i) { ischange = oldStyles[i] != line.styles[i]; }
  3685. if (ischange) { changedLines.push(context.line); }
  3686. line.stateAfter = context.save();
  3687. context.nextLine();
  3688. } else {
  3689. if (line.text.length <= cm.options.maxHighlightLength)
  3690. { processLine(cm, line.text, context); }
  3691. line.stateAfter = context.line % 5 == 0 ? context.save() : null;
  3692. context.nextLine();
  3693. }
  3694. if (+new Date > end) {
  3695. startWorker(cm, cm.options.workDelay);
  3696. return true
  3697. }
  3698. });
  3699. doc.highlightFrontier = context.line;
  3700. doc.modeFrontier = Math.max(doc.modeFrontier, context.line);
  3701. if (changedLines.length) { runInOp(cm, function () {
  3702. for (var i = 0; i < changedLines.length; i++)
  3703. { regLineChange(cm, changedLines[i], "text"); }
  3704. }); }
  3705. }
  3706. // DISPLAY DRAWING
  3707. var DisplayUpdate = function(cm, viewport, force) {
  3708. var display = cm.display;
  3709. this.viewport = viewport;
  3710. // Store some values that we'll need later (but don't want to force a relayout for)
  3711. this.visible = visibleLines(display, cm.doc, viewport);
  3712. this.editorIsHidden = !display.wrapper.offsetWidth;
  3713. this.wrapperHeight = display.wrapper.clientHeight;
  3714. this.wrapperWidth = display.wrapper.clientWidth;
  3715. this.oldDisplayWidth = displayWidth(cm);
  3716. this.force = force;
  3717. this.dims = getDimensions(cm);
  3718. this.events = [];
  3719. };
  3720. DisplayUpdate.prototype.signal = function (emitter, type) {
  3721. if (hasHandler(emitter, type))
  3722. { this.events.push(arguments); }
  3723. };
  3724. DisplayUpdate.prototype.finish = function () {
  3725. for (var i = 0; i < this.events.length; i++)
  3726. { signal.apply(null, this.events[i]); }
  3727. };
  3728. function maybeClipScrollbars(cm) {
  3729. var display = cm.display;
  3730. if (!display.scrollbarsClipped && display.scroller.offsetWidth) {
  3731. display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth;
  3732. display.heightForcer.style.height = scrollGap(cm) + "px";
  3733. display.sizer.style.marginBottom = -display.nativeBarWidth + "px";
  3734. display.sizer.style.borderRightWidth = scrollGap(cm) + "px";
  3735. display.scrollbarsClipped = true;
  3736. }
  3737. }
  3738. function selectionSnapshot(cm) {
  3739. if (cm.hasFocus()) { return null }
  3740. var active = activeElt();
  3741. if (!active || !contains(cm.display.lineDiv, active)) { return null }
  3742. var result = {activeElt: active};
  3743. if (window.getSelection) {
  3744. var sel = window.getSelection();
  3745. if (sel.anchorNode && sel.extend && contains(cm.display.lineDiv, sel.anchorNode)) {
  3746. result.anchorNode = sel.anchorNode;
  3747. result.anchorOffset = sel.anchorOffset;
  3748. result.focusNode = sel.focusNode;
  3749. result.focusOffset = sel.focusOffset;
  3750. }
  3751. }
  3752. return result
  3753. }
  3754. function restoreSelection(snapshot) {
  3755. if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt()) { return }
  3756. snapshot.activeElt.focus();
  3757. if (!/^(INPUT|TEXTAREA)$/.test(snapshot.activeElt.nodeName) &&
  3758. snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) {
  3759. var sel = window.getSelection(), range = document.createRange();
  3760. range.setEnd(snapshot.anchorNode, snapshot.anchorOffset);
  3761. range.collapse(false);
  3762. sel.removeAllRanges();
  3763. sel.addRange(range);
  3764. sel.extend(snapshot.focusNode, snapshot.focusOffset);
  3765. }
  3766. }
  3767. // Does the actual updating of the line display. Bails out
  3768. // (returning false) when there is nothing to be done and forced is
  3769. // false.
  3770. function updateDisplayIfNeeded(cm, update) {
  3771. var display = cm.display, doc = cm.doc;
  3772. if (update.editorIsHidden) {
  3773. resetView(cm);
  3774. return false
  3775. }
  3776. // Bail out if the visible area is already rendered and nothing changed.
  3777. if (!update.force &&
  3778. update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&
  3779. (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&
  3780. display.renderedView == display.view && countDirtyView(cm) == 0)
  3781. { return false }
  3782. if (maybeUpdateLineNumberWidth(cm)) {
  3783. resetView(cm);
  3784. update.dims = getDimensions(cm);
  3785. }
  3786. // Compute a suitable new viewport (from & to)
  3787. var end = doc.first + doc.size;
  3788. var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);
  3789. var to = Math.min(end, update.visible.to + cm.options.viewportMargin);
  3790. if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }
  3791. if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }
  3792. if (sawCollapsedSpans) {
  3793. from = visualLineNo(cm.doc, from);
  3794. to = visualLineEndNo(cm.doc, to);
  3795. }
  3796. var different = from != display.viewFrom || to != display.viewTo ||
  3797. display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;
  3798. adjustView(cm, from, to);
  3799. display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));
  3800. // Position the mover div to align with the current scroll position
  3801. cm.display.mover.style.top = display.viewOffset + "px";
  3802. var toUpdate = countDirtyView(cm);
  3803. if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&
  3804. (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))
  3805. { return false }
  3806. // For big changes, we hide the enclosing element during the
  3807. // update, since that speeds up the operations on most browsers.
  3808. var selSnapshot = selectionSnapshot(cm);
  3809. if (toUpdate > 4) { display.lineDiv.style.display = "none"; }
  3810. patchDisplay(cm, display.updateLineNumbers, update.dims);
  3811. if (toUpdate > 4) { display.lineDiv.style.display = ""; }
  3812. display.renderedView = display.view;
  3813. // There might have been a widget with a focused element that got
  3814. // hidden or updated, if so re-focus it.
  3815. restoreSelection(selSnapshot);
  3816. // Prevent selection and cursors from interfering with the scroll
  3817. // width and height.
  3818. removeChildren(display.cursorDiv);
  3819. removeChildren(display.selectionDiv);
  3820. display.gutters.style.height = display.sizer.style.minHeight = 0;
  3821. if (different) {
  3822. display.lastWrapHeight = update.wrapperHeight;
  3823. display.lastWrapWidth = update.wrapperWidth;
  3824. startWorker(cm, 400);
  3825. }
  3826. display.updateLineNumbers = null;
  3827. return true
  3828. }
  3829. function postUpdateDisplay(cm, update) {
  3830. var viewport = update.viewport;
  3831. for (var first = true;; first = false) {
  3832. if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {
  3833. // Clip forced viewport to actual scrollable area.
  3834. if (viewport && viewport.top != null)
  3835. { viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)}; }
  3836. // Updated line heights might result in the drawn area not
  3837. // actually covering the viewport. Keep looping until it does.
  3838. update.visible = visibleLines(cm.display, cm.doc, viewport);
  3839. if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)
  3840. { break }
  3841. } else if (first) {
  3842. update.visible = visibleLines(cm.display, cm.doc, viewport);
  3843. }
  3844. if (!updateDisplayIfNeeded(cm, update)) { break }
  3845. updateHeightsInViewport(cm);
  3846. var barMeasure = measureForScrollbars(cm);
  3847. updateSelection(cm);
  3848. updateScrollbars(cm, barMeasure);
  3849. setDocumentHeight(cm, barMeasure);
  3850. update.force = false;
  3851. }
  3852. update.signal(cm, "update", cm);
  3853. if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {
  3854. update.signal(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo);
  3855. cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo;
  3856. }
  3857. }
  3858. function updateDisplaySimple(cm, viewport) {
  3859. var update = new DisplayUpdate(cm, viewport);
  3860. if (updateDisplayIfNeeded(cm, update)) {
  3861. updateHeightsInViewport(cm);
  3862. postUpdateDisplay(cm, update);
  3863. var barMeasure = measureForScrollbars(cm);
  3864. updateSelection(cm);
  3865. updateScrollbars(cm, barMeasure);
  3866. setDocumentHeight(cm, barMeasure);
  3867. update.finish();
  3868. }
  3869. }
  3870. // Sync the actual display DOM structure with display.view, removing
  3871. // nodes for lines that are no longer in view, and creating the ones
  3872. // that are not there yet, and updating the ones that are out of
  3873. // date.
  3874. function patchDisplay(cm, updateNumbersFrom, dims) {
  3875. var display = cm.display, lineNumbers = cm.options.lineNumbers;
  3876. var container = display.lineDiv, cur = container.firstChild;
  3877. function rm(node) {
  3878. var next = node.nextSibling;
  3879. // Works around a throw-scroll bug in OS X Webkit
  3880. if (webkit && mac && cm.display.currentWheelTarget == node)
  3881. { node.style.display = "none"; }
  3882. else
  3883. { node.parentNode.removeChild(node); }
  3884. return next
  3885. }
  3886. var view = display.view, lineN = display.viewFrom;
  3887. // Loop over the elements in the view, syncing cur (the DOM nodes
  3888. // in display.lineDiv) with the view as we go.
  3889. for (var i = 0; i < view.length; i++) {
  3890. var lineView = view[i];
  3891. if (lineView.hidden) ; else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet
  3892. var node = buildLineElement(cm, lineView, lineN, dims);
  3893. container.insertBefore(node, cur);
  3894. } else { // Already drawn
  3895. while (cur != lineView.node) { cur = rm(cur); }
  3896. var updateNumber = lineNumbers && updateNumbersFrom != null &&
  3897. updateNumbersFrom <= lineN && lineView.lineNumber;
  3898. if (lineView.changes) {
  3899. if (indexOf(lineView.changes, "gutter") > -1) { updateNumber = false; }
  3900. updateLineForChanges(cm, lineView, lineN, dims);
  3901. }
  3902. if (updateNumber) {
  3903. removeChildren(lineView.lineNumber);
  3904. lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));
  3905. }
  3906. cur = lineView.node.nextSibling;
  3907. }
  3908. lineN += lineView.size;
  3909. }
  3910. while (cur) { cur = rm(cur); }
  3911. }
  3912. function updateGutterSpace(display) {
  3913. var width = display.gutters.offsetWidth;
  3914. display.sizer.style.marginLeft = width + "px";
  3915. }
  3916. function setDocumentHeight(cm, measure) {
  3917. cm.display.sizer.style.minHeight = measure.docHeight + "px";
  3918. cm.display.heightForcer.style.top = measure.docHeight + "px";
  3919. cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px";
  3920. }
  3921. // Re-align line numbers and gutter marks to compensate for
  3922. // horizontal scrolling.
  3923. function alignHorizontally(cm) {
  3924. var display = cm.display, view = display.view;
  3925. if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }
  3926. var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;
  3927. var gutterW = display.gutters.offsetWidth, left = comp + "px";
  3928. for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {
  3929. if (cm.options.fixedGutter) {
  3930. if (view[i].gutter)
  3931. { view[i].gutter.style.left = left; }
  3932. if (view[i].gutterBackground)
  3933. { view[i].gutterBackground.style.left = left; }
  3934. }
  3935. var align = view[i].alignable;
  3936. if (align) { for (var j = 0; j < align.length; j++)
  3937. { align[j].style.left = left; } }
  3938. } }
  3939. if (cm.options.fixedGutter)
  3940. { display.gutters.style.left = (comp + gutterW) + "px"; }
  3941. }
  3942. // Used to ensure that the line number gutter is still the right
  3943. // size for the current document size. Returns true when an update
  3944. // is needed.
  3945. function maybeUpdateLineNumberWidth(cm) {
  3946. if (!cm.options.lineNumbers) { return false }
  3947. var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;
  3948. if (last.length != display.lineNumChars) {
  3949. var test = display.measure.appendChild(elt("div", [elt("div", last)],
  3950. "CodeMirror-linenumber CodeMirror-gutter-elt"));
  3951. var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;
  3952. display.lineGutter.style.width = "";
  3953. display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;
  3954. display.lineNumWidth = display.lineNumInnerWidth + padding;
  3955. display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;
  3956. display.lineGutter.style.width = display.lineNumWidth + "px";
  3957. updateGutterSpace(cm.display);
  3958. return true
  3959. }
  3960. return false
  3961. }
  3962. function getGutters(gutters, lineNumbers) {
  3963. var result = [], sawLineNumbers = false;
  3964. for (var i = 0; i < gutters.length; i++) {
  3965. var name = gutters[i], style = null;
  3966. if (typeof name != "string") { style = name.style; name = name.className; }
  3967. if (name == "CodeMirror-linenumbers") {
  3968. if (!lineNumbers) { continue }
  3969. else { sawLineNumbers = true; }
  3970. }
  3971. result.push({className: name, style: style});
  3972. }
  3973. if (lineNumbers && !sawLineNumbers) { result.push({className: "CodeMirror-linenumbers", style: null}); }
  3974. return result
  3975. }
  3976. // Rebuild the gutter elements, ensure the margin to the left of the
  3977. // code matches their width.
  3978. function renderGutters(display) {
  3979. var gutters = display.gutters, specs = display.gutterSpecs;
  3980. removeChildren(gutters);
  3981. display.lineGutter = null;
  3982. for (var i = 0; i < specs.length; ++i) {
  3983. var ref = specs[i];
  3984. var className = ref.className;
  3985. var style = ref.style;
  3986. var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + className));
  3987. if (style) { gElt.style.cssText = style; }
  3988. if (className == "CodeMirror-linenumbers") {
  3989. display.lineGutter = gElt;
  3990. gElt.style.width = (display.lineNumWidth || 1) + "px";
  3991. }
  3992. }
  3993. gutters.style.display = specs.length ? "" : "none";
  3994. updateGutterSpace(display);
  3995. }
  3996. function updateGutters(cm) {
  3997. renderGutters(cm.display);
  3998. regChange(cm);
  3999. alignHorizontally(cm);
  4000. }
  4001. // The display handles the DOM integration, both for input reading
  4002. // and content drawing. It holds references to DOM nodes and
  4003. // display-related state.
  4004. function Display(place, doc, input, options) {
  4005. var d = this;
  4006. this.input = input;
  4007. // Covers bottom-right square when both scrollbars are present.
  4008. d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler");
  4009. d.scrollbarFiller.setAttribute("cm-not-content", "true");
  4010. // Covers bottom of gutter when coverGutterNextToScrollbar is on
  4011. // and h scrollbar is present.
  4012. d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler");
  4013. d.gutterFiller.setAttribute("cm-not-content", "true");
  4014. // Will contain the actual code, positioned to cover the viewport.
  4015. d.lineDiv = eltP("div", null, "CodeMirror-code");
  4016. // Elements are added to these to represent selection and cursors.
  4017. d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1");
  4018. d.cursorDiv = elt("div", null, "CodeMirror-cursors");
  4019. // A visibility: hidden element used to find the size of things.
  4020. d.measure = elt("div", null, "CodeMirror-measure");
  4021. // When lines outside of the viewport are measured, they are drawn in this.
  4022. d.lineMeasure = elt("div", null, "CodeMirror-measure");
  4023. // Wraps everything that needs to exist inside the vertically-padded coordinate system
  4024. d.lineSpace = eltP("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],
  4025. null, "position: relative; outline: none");
  4026. var lines = eltP("div", [d.lineSpace], "CodeMirror-lines");
  4027. // Moved around its parent to cover visible view.
  4028. d.mover = elt("div", [lines], null, "position: relative");
  4029. // Set to the height of the document, allowing scrolling.
  4030. d.sizer = elt("div", [d.mover], "CodeMirror-sizer");
  4031. d.sizerWidth = null;
  4032. // Behavior of elts with overflow: auto and padding is
  4033. // inconsistent across browsers. This is used to ensure the
  4034. // scrollable area is big enough.
  4035. d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;");
  4036. // Will contain the gutters, if any.
  4037. d.gutters = elt("div", null, "CodeMirror-gutters");
  4038. d.lineGutter = null;
  4039. // Actual scrollable element.
  4040. d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll");
  4041. d.scroller.setAttribute("tabIndex", "-1");
  4042. // The element in which the editor lives.
  4043. d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror");
  4044. // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)
  4045. if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }
  4046. if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true; }
  4047. if (place) {
  4048. if (place.appendChild) { place.appendChild(d.wrapper); }
  4049. else { place(d.wrapper); }
  4050. }
  4051. // Current rendered range (may be bigger than the view window).
  4052. d.viewFrom = d.viewTo = doc.first;
  4053. d.reportedViewFrom = d.reportedViewTo = doc.first;
  4054. // Information about the rendered lines.
  4055. d.view = [];
  4056. d.renderedView = null;
  4057. // Holds info about a single rendered line when it was rendered
  4058. // for measurement, while not in view.
  4059. d.externalMeasured = null;
  4060. // Empty space (in pixels) above the view
  4061. d.viewOffset = 0;
  4062. d.lastWrapHeight = d.lastWrapWidth = 0;
  4063. d.updateLineNumbers = null;
  4064. d.nativeBarWidth = d.barHeight = d.barWidth = 0;
  4065. d.scrollbarsClipped = false;
  4066. // Used to only resize the line number gutter when necessary (when
  4067. // the amount of lines crosses a boundary that makes its width change)
  4068. d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;
  4069. // Set to true when a non-horizontal-scrolling line widget is
  4070. // added. As an optimization, line widget aligning is skipped when
  4071. // this is false.
  4072. d.alignWidgets = false;
  4073. d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
  4074. // Tracks the maximum line length so that the horizontal scrollbar
  4075. // can be kept static when scrolling.
  4076. d.maxLine = null;
  4077. d.maxLineLength = 0;
  4078. d.maxLineChanged = false;
  4079. // Used for measuring wheel scrolling granularity
  4080. d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;
  4081. // True when shift is held down.
  4082. d.shift = false;
  4083. // Used to track whether anything happened since the context menu
  4084. // was opened.
  4085. d.selForContextMenu = null;
  4086. d.activeTouch = null;
  4087. d.gutterSpecs = getGutters(options.gutters, options.lineNumbers);
  4088. renderGutters(d);
  4089. input.init(d);
  4090. }
  4091. // Since the delta values reported on mouse wheel events are
  4092. // unstandardized between browsers and even browser versions, and
  4093. // generally horribly unpredictable, this code starts by measuring
  4094. // the scroll effect that the first few mouse wheel events have,
  4095. // and, from that, detects the way it can convert deltas to pixel
  4096. // offsets afterwards.
  4097. //
  4098. // The reason we want to know the amount a wheel event will scroll
  4099. // is that it gives us a chance to update the display before the
  4100. // actual scrolling happens, reducing flickering.
  4101. var wheelSamples = 0, wheelPixelsPerUnit = null;
  4102. // Fill in a browser-detected starting value on browsers where we
  4103. // know one. These don't have to be accurate -- the result of them
  4104. // being wrong would just be a slight flicker on the first wheel
  4105. // scroll (if it is large enough).
  4106. if (ie) { wheelPixelsPerUnit = -.53; }
  4107. else if (gecko) { wheelPixelsPerUnit = 15; }
  4108. else if (chrome) { wheelPixelsPerUnit = -.7; }
  4109. else if (safari) { wheelPixelsPerUnit = -1/3; }
  4110. function wheelEventDelta(e) {
  4111. var dx = e.wheelDeltaX, dy = e.wheelDeltaY;
  4112. if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) { dx = e.detail; }
  4113. if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) { dy = e.detail; }
  4114. else if (dy == null) { dy = e.wheelDelta; }
  4115. return {x: dx, y: dy}
  4116. }
  4117. function wheelEventPixels(e) {
  4118. var delta = wheelEventDelta(e);
  4119. delta.x *= wheelPixelsPerUnit;
  4120. delta.y *= wheelPixelsPerUnit;
  4121. return delta
  4122. }
  4123. function onScrollWheel(cm, e) {
  4124. var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;
  4125. var display = cm.display, scroll = display.scroller;
  4126. // Quit if there's nothing to scroll here
  4127. var canScrollX = scroll.scrollWidth > scroll.clientWidth;
  4128. var canScrollY = scroll.scrollHeight > scroll.clientHeight;
  4129. if (!(dx && canScrollX || dy && canScrollY)) { return }
  4130. // Webkit browsers on OS X abort momentum scrolls when the target
  4131. // of the scroll event is removed from the scrollable element.
  4132. // This hack (see related code in patchDisplay) makes sure the
  4133. // element is kept around.
  4134. if (dy && mac && webkit) {
  4135. outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {
  4136. for (var i = 0; i < view.length; i++) {
  4137. if (view[i].node == cur) {
  4138. cm.display.currentWheelTarget = cur;
  4139. break outer
  4140. }
  4141. }
  4142. }
  4143. }
  4144. // On some browsers, horizontal scrolling will cause redraws to
  4145. // happen before the gutter has been realigned, causing it to
  4146. // wriggle around in a most unseemly way. When we have an
  4147. // estimated pixels/delta value, we just handle horizontal
  4148. // scrolling entirely here. It'll be slightly off from native, but
  4149. // better than glitching out.
  4150. if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {
  4151. if (dy && canScrollY)
  4152. { updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * wheelPixelsPerUnit)); }
  4153. setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * wheelPixelsPerUnit));
  4154. // Only prevent default scrolling if vertical scrolling is
  4155. // actually possible. Otherwise, it causes vertical scroll
  4156. // jitter on OSX trackpads when deltaX is small and deltaY
  4157. // is large (issue #3579)
  4158. if (!dy || (dy && canScrollY))
  4159. { e_preventDefault(e); }
  4160. display.wheelStartX = null; // Abort measurement, if in progress
  4161. return
  4162. }
  4163. // 'Project' the visible viewport to cover the area that is being
  4164. // scrolled into view (if we know enough to estimate it).
  4165. if (dy && wheelPixelsPerUnit != null) {
  4166. var pixels = dy * wheelPixelsPerUnit;
  4167. var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;
  4168. if (pixels < 0) { top = Math.max(0, top + pixels - 50); }
  4169. else { bot = Math.min(cm.doc.height, bot + pixels + 50); }
  4170. updateDisplaySimple(cm, {top: top, bottom: bot});
  4171. }
  4172. if (wheelSamples < 20) {
  4173. if (display.wheelStartX == null) {
  4174. display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;
  4175. display.wheelDX = dx; display.wheelDY = dy;
  4176. setTimeout(function () {
  4177. if (display.wheelStartX == null) { return }
  4178. var movedX = scroll.scrollLeft - display.wheelStartX;
  4179. var movedY = scroll.scrollTop - display.wheelStartY;
  4180. var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||
  4181. (movedX && display.wheelDX && movedX / display.wheelDX);
  4182. display.wheelStartX = display.wheelStartY = null;
  4183. if (!sample) { return }
  4184. wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);
  4185. ++wheelSamples;
  4186. }, 200);
  4187. } else {
  4188. display.wheelDX += dx; display.wheelDY += dy;
  4189. }
  4190. }
  4191. }
  4192. // Selection objects are immutable. A new one is created every time
  4193. // the selection changes. A selection is one or more non-overlapping
  4194. // (and non-touching) ranges, sorted, and an integer that indicates
  4195. // which one is the primary selection (the one that's scrolled into
  4196. // view, that getCursor returns, etc).
  4197. var Selection = function(ranges, primIndex) {
  4198. this.ranges = ranges;
  4199. this.primIndex = primIndex;
  4200. };
  4201. Selection.prototype.primary = function () { return this.ranges[this.primIndex] };
  4202. Selection.prototype.equals = function (other) {
  4203. if (other == this) { return true }
  4204. if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false }
  4205. for (var i = 0; i < this.ranges.length; i++) {
  4206. var here = this.ranges[i], there = other.ranges[i];
  4207. if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) { return false }
  4208. }
  4209. return true
  4210. };
  4211. Selection.prototype.deepCopy = function () {
  4212. var out = [];
  4213. for (var i = 0; i < this.ranges.length; i++)
  4214. { out[i] = new Range(copyPos(this.ranges[i].anchor), copyPos(this.ranges[i].head)); }
  4215. return new Selection(out, this.primIndex)
  4216. };
  4217. Selection.prototype.somethingSelected = function () {
  4218. for (var i = 0; i < this.ranges.length; i++)
  4219. { if (!this.ranges[i].empty()) { return true } }
  4220. return false
  4221. };
  4222. Selection.prototype.contains = function (pos, end) {
  4223. if (!end) { end = pos; }
  4224. for (var i = 0; i < this.ranges.length; i++) {
  4225. var range = this.ranges[i];
  4226. if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)
  4227. { return i }
  4228. }
  4229. return -1
  4230. };
  4231. var Range = function(anchor, head) {
  4232. this.anchor = anchor; this.head = head;
  4233. };
  4234. Range.prototype.from = function () { return minPos(this.anchor, this.head) };
  4235. Range.prototype.to = function () { return maxPos(this.anchor, this.head) };
  4236. Range.prototype.empty = function () { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch };
  4237. // Take an unsorted, potentially overlapping set of ranges, and
  4238. // build a selection out of it. 'Consumes' ranges array (modifying
  4239. // it).
  4240. function normalizeSelection(cm, ranges, primIndex) {
  4241. var mayTouch = cm && cm.options.selectionsMayTouch;
  4242. var prim = ranges[primIndex];
  4243. ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });
  4244. primIndex = indexOf(ranges, prim);
  4245. for (var i = 1; i < ranges.length; i++) {
  4246. var cur = ranges[i], prev = ranges[i - 1];
  4247. var diff = cmp(prev.to(), cur.from());
  4248. if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {
  4249. var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());
  4250. var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;
  4251. if (i <= primIndex) { --primIndex; }
  4252. ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));
  4253. }
  4254. }
  4255. return new Selection(ranges, primIndex)
  4256. }
  4257. function simpleSelection(anchor, head) {
  4258. return new Selection([new Range(anchor, head || anchor)], 0)
  4259. }
  4260. // Compute the position of the end of a change (its 'to' property
  4261. // refers to the pre-change end).
  4262. function changeEnd(change) {
  4263. if (!change.text) { return change.to }
  4264. return Pos(change.from.line + change.text.length - 1,
  4265. lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))
  4266. }
  4267. // Adjust a position to refer to the post-change position of the
  4268. // same text, or the end of the change if the change covers it.
  4269. function adjustForChange(pos, change) {
  4270. if (cmp(pos, change.from) < 0) { return pos }
  4271. if (cmp(pos, change.to) <= 0) { return changeEnd(change) }
  4272. var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;
  4273. if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }
  4274. return Pos(line, ch)
  4275. }
  4276. function computeSelAfterChange(doc, change) {
  4277. var out = [];
  4278. for (var i = 0; i < doc.sel.ranges.length; i++) {
  4279. var range = doc.sel.ranges[i];
  4280. out.push(new Range(adjustForChange(range.anchor, change),
  4281. adjustForChange(range.head, change)));
  4282. }
  4283. return normalizeSelection(doc.cm, out, doc.sel.primIndex)
  4284. }
  4285. function offsetPos(pos, old, nw) {
  4286. if (pos.line == old.line)
  4287. { return Pos(nw.line, pos.ch - old.ch + nw.ch) }
  4288. else
  4289. { return Pos(nw.line + (pos.line - old.line), pos.ch) }
  4290. }
  4291. // Used by replaceSelections to allow moving the selection to the
  4292. // start or around the replaced test. Hint may be "start" or "around".
  4293. function computeReplacedSel(doc, changes, hint) {
  4294. var out = [];
  4295. var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;
  4296. for (var i = 0; i < changes.length; i++) {
  4297. var change = changes[i];
  4298. var from = offsetPos(change.from, oldPrev, newPrev);
  4299. var to = offsetPos(changeEnd(change), oldPrev, newPrev);
  4300. oldPrev = change.to;
  4301. newPrev = to;
  4302. if (hint == "around") {
  4303. var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;
  4304. out[i] = new Range(inv ? to : from, inv ? from : to);
  4305. } else {
  4306. out[i] = new Range(from, from);
  4307. }
  4308. }
  4309. return new Selection(out, doc.sel.primIndex)
  4310. }
  4311. // Used to get the editor into a consistent state again when options change.
  4312. function loadMode(cm) {
  4313. cm.doc.mode = getMode(cm.options, cm.doc.modeOption);
  4314. resetModeState(cm);
  4315. }
  4316. function resetModeState(cm) {
  4317. cm.doc.iter(function (line) {
  4318. if (line.stateAfter) { line.stateAfter = null; }
  4319. if (line.styles) { line.styles = null; }
  4320. });
  4321. cm.doc.modeFrontier = cm.doc.highlightFrontier = cm.doc.first;
  4322. startWorker(cm, 100);
  4323. cm.state.modeGen++;
  4324. if (cm.curOp) { regChange(cm); }
  4325. }
  4326. // DOCUMENT DATA STRUCTURE
  4327. // By default, updates that start and end at the beginning of a line
  4328. // are treated specially, in order to make the association of line
  4329. // widgets and marker elements with the text behave more intuitive.
  4330. function isWholeLineUpdate(doc, change) {
  4331. return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" &&
  4332. (!doc.cm || doc.cm.options.wholeLineUpdateBefore)
  4333. }
  4334. // Perform a change on the document data structure.
  4335. function updateDoc(doc, change, markedSpans, estimateHeight) {
  4336. function spansFor(n) {return markedSpans ? markedSpans[n] : null}
  4337. function update(line, text, spans) {
  4338. updateLine(line, text, spans, estimateHeight);
  4339. signalLater(line, "change", line, change);
  4340. }
  4341. function linesFor(start, end) {
  4342. var result = [];
  4343. for (var i = start; i < end; ++i)
  4344. { result.push(new Line(text[i], spansFor(i), estimateHeight)); }
  4345. return result
  4346. }
  4347. var from = change.from, to = change.to, text = change.text;
  4348. var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);
  4349. var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;
  4350. // Adjust the line structure
  4351. if (change.full) {
  4352. doc.insert(0, linesFor(0, text.length));
  4353. doc.remove(text.length, doc.size - text.length);
  4354. } else if (isWholeLineUpdate(doc, change)) {
  4355. // This is a whole-line replace. Treated specially to make
  4356. // sure line objects move the way they are supposed to.
  4357. var added = linesFor(0, text.length - 1);
  4358. update(lastLine, lastLine.text, lastSpans);
  4359. if (nlines) { doc.remove(from.line, nlines); }
  4360. if (added.length) { doc.insert(from.line, added); }
  4361. } else if (firstLine == lastLine) {
  4362. if (text.length == 1) {
  4363. update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);
  4364. } else {
  4365. var added$1 = linesFor(1, text.length - 1);
  4366. added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));
  4367. update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
  4368. doc.insert(from.line + 1, added$1);
  4369. }
  4370. } else if (text.length == 1) {
  4371. update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));
  4372. doc.remove(from.line + 1, nlines);
  4373. } else {
  4374. update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
  4375. update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);
  4376. var added$2 = linesFor(1, text.length - 1);
  4377. if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }
  4378. doc.insert(from.line + 1, added$2);
  4379. }
  4380. signalLater(doc, "change", doc, change);
  4381. }
  4382. // Call f for all linked documents.
  4383. function linkedDocs(doc, f, sharedHistOnly) {
  4384. function propagate(doc, skip, sharedHist) {
  4385. if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {
  4386. var rel = doc.linked[i];
  4387. if (rel.doc == skip) { continue }
  4388. var shared = sharedHist && rel.sharedHist;
  4389. if (sharedHistOnly && !shared) { continue }
  4390. f(rel.doc, shared);
  4391. propagate(rel.doc, doc, shared);
  4392. } }
  4393. }
  4394. propagate(doc, null, true);
  4395. }
  4396. // Attach a document to an editor.
  4397. function attachDoc(cm, doc) {
  4398. if (doc.cm) { throw new Error("This document is already in use.") }
  4399. cm.doc = doc;
  4400. doc.cm = cm;
  4401. estimateLineHeights(cm);
  4402. loadMode(cm);
  4403. setDirectionClass(cm);
  4404. if (!cm.options.lineWrapping) { findMaxLine(cm); }
  4405. cm.options.mode = doc.modeOption;
  4406. regChange(cm);
  4407. }
  4408. function setDirectionClass(cm) {
  4409. (cm.doc.direction == "rtl" ? addClass : rmClass)(cm.display.lineDiv, "CodeMirror-rtl");
  4410. }
  4411. function directionChanged(cm) {
  4412. runInOp(cm, function () {
  4413. setDirectionClass(cm);
  4414. regChange(cm);
  4415. });
  4416. }
  4417. function History(startGen) {
  4418. // Arrays of change events and selections. Doing something adds an
  4419. // event to done and clears undo. Undoing moves events from done
  4420. // to undone, redoing moves them in the other direction.
  4421. this.done = []; this.undone = [];
  4422. this.undoDepth = Infinity;
  4423. // Used to track when changes can be merged into a single undo
  4424. // event
  4425. this.lastModTime = this.lastSelTime = 0;
  4426. this.lastOp = this.lastSelOp = null;
  4427. this.lastOrigin = this.lastSelOrigin = null;
  4428. // Used by the isClean() method
  4429. this.generation = this.maxGeneration = startGen || 1;
  4430. }
  4431. // Create a history change event from an updateDoc-style change
  4432. // object.
  4433. function historyChangeFromChange(doc, change) {
  4434. var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};
  4435. attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);
  4436. linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);
  4437. return histChange
  4438. }
  4439. // Pop all selection events off the end of a history array. Stop at
  4440. // a change event.
  4441. function clearSelectionEvents(array) {
  4442. while (array.length) {
  4443. var last = lst(array);
  4444. if (last.ranges) { array.pop(); }
  4445. else { break }
  4446. }
  4447. }
  4448. // Find the top change event in the history. Pop off selection
  4449. // events that are in the way.
  4450. function lastChangeEvent(hist, force) {
  4451. if (force) {
  4452. clearSelectionEvents(hist.done);
  4453. return lst(hist.done)
  4454. } else if (hist.done.length && !lst(hist.done).ranges) {
  4455. return lst(hist.done)
  4456. } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {
  4457. hist.done.pop();
  4458. return lst(hist.done)
  4459. }
  4460. }
  4461. // Register a change in the history. Merges changes that are within
  4462. // a single operation, or are close together with an origin that
  4463. // allows merging (starting with "+") into a single event.
  4464. function addChangeToHistory(doc, change, selAfter, opId) {
  4465. var hist = doc.history;
  4466. hist.undone.length = 0;
  4467. var time = +new Date, cur;
  4468. var last;
  4469. if ((hist.lastOp == opId ||
  4470. hist.lastOrigin == change.origin && change.origin &&
  4471. ((change.origin.charAt(0) == "+" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||
  4472. change.origin.charAt(0) == "*")) &&
  4473. (cur = lastChangeEvent(hist, hist.lastOp == opId))) {
  4474. // Merge this change into the last event
  4475. last = lst(cur.changes);
  4476. if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {
  4477. // Optimized case for simple insertion -- don't want to add
  4478. // new changesets for every character typed
  4479. last.to = changeEnd(change);
  4480. } else {
  4481. // Add new sub-event
  4482. cur.changes.push(historyChangeFromChange(doc, change));
  4483. }
  4484. } else {
  4485. // Can not be merged, start a new event.
  4486. var before = lst(hist.done);
  4487. if (!before || !before.ranges)
  4488. { pushSelectionToHistory(doc.sel, hist.done); }
  4489. cur = {changes: [historyChangeFromChange(doc, change)],
  4490. generation: hist.generation};
  4491. hist.done.push(cur);
  4492. while (hist.done.length > hist.undoDepth) {
  4493. hist.done.shift();
  4494. if (!hist.done[0].ranges) { hist.done.shift(); }
  4495. }
  4496. }
  4497. hist.done.push(selAfter);
  4498. hist.generation = ++hist.maxGeneration;
  4499. hist.lastModTime = hist.lastSelTime = time;
  4500. hist.lastOp = hist.lastSelOp = opId;
  4501. hist.lastOrigin = hist.lastSelOrigin = change.origin;
  4502. if (!last) { signal(doc, "historyAdded"); }
  4503. }
  4504. function selectionEventCanBeMerged(doc, origin, prev, sel) {
  4505. var ch = origin.charAt(0);
  4506. return ch == "*" ||
  4507. ch == "+" &&
  4508. prev.ranges.length == sel.ranges.length &&
  4509. prev.somethingSelected() == sel.somethingSelected() &&
  4510. new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500)
  4511. }
  4512. // Called whenever the selection changes, sets the new selection as
  4513. // the pending selection in the history, and pushes the old pending
  4514. // selection into the 'done' array when it was significantly
  4515. // different (in number of selected ranges, emptiness, or time).
  4516. function addSelectionToHistory(doc, sel, opId, options) {
  4517. var hist = doc.history, origin = options && options.origin;
  4518. // A new event is started when the previous origin does not match
  4519. // the current, or the origins don't allow matching. Origins
  4520. // starting with * are always merged, those starting with + are
  4521. // merged when similar and close together in time.
  4522. if (opId == hist.lastSelOp ||
  4523. (origin && hist.lastSelOrigin == origin &&
  4524. (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||
  4525. selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))
  4526. { hist.done[hist.done.length - 1] = sel; }
  4527. else
  4528. { pushSelectionToHistory(sel, hist.done); }
  4529. hist.lastSelTime = +new Date;
  4530. hist.lastSelOrigin = origin;
  4531. hist.lastSelOp = opId;
  4532. if (options && options.clearRedo !== false)
  4533. { clearSelectionEvents(hist.undone); }
  4534. }
  4535. function pushSelectionToHistory(sel, dest) {
  4536. var top = lst(dest);
  4537. if (!(top && top.ranges && top.equals(sel)))
  4538. { dest.push(sel); }
  4539. }
  4540. // Used to store marked span information in the history.
  4541. function attachLocalSpans(doc, change, from, to) {
  4542. var existing = change["spans_" + doc.id], n = 0;
  4543. doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {
  4544. if (line.markedSpans)
  4545. { (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans; }
  4546. ++n;
  4547. });
  4548. }
  4549. // When un/re-doing restores text containing marked spans, those
  4550. // that have been explicitly cleared should not be restored.
  4551. function removeClearedSpans(spans) {
  4552. if (!spans) { return null }
  4553. var out;
  4554. for (var i = 0; i < spans.length; ++i) {
  4555. if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i); } }
  4556. else if (out) { out.push(spans[i]); }
  4557. }
  4558. return !out ? spans : out.length ? out : null
  4559. }
  4560. // Retrieve and filter the old marked spans stored in a change event.
  4561. function getOldSpans(doc, change) {
  4562. var found = change["spans_" + doc.id];
  4563. if (!found) { return null }
  4564. var nw = [];
  4565. for (var i = 0; i < change.text.length; ++i)
  4566. { nw.push(removeClearedSpans(found[i])); }
  4567. return nw
  4568. }
  4569. // Used for un/re-doing changes from the history. Combines the
  4570. // result of computing the existing spans with the set of spans that
  4571. // existed in the history (so that deleting around a span and then
  4572. // undoing brings back the span).
  4573. function mergeOldSpans(doc, change) {
  4574. var old = getOldSpans(doc, change);
  4575. var stretched = stretchSpansOverChange(doc, change);
  4576. if (!old) { return stretched }
  4577. if (!stretched) { return old }
  4578. for (var i = 0; i < old.length; ++i) {
  4579. var oldCur = old[i], stretchCur = stretched[i];
  4580. if (oldCur && stretchCur) {
  4581. spans: for (var j = 0; j < stretchCur.length; ++j) {
  4582. var span = stretchCur[j];
  4583. for (var k = 0; k < oldCur.length; ++k)
  4584. { if (oldCur[k].marker == span.marker) { continue spans } }
  4585. oldCur.push(span);
  4586. }
  4587. } else if (stretchCur) {
  4588. old[i] = stretchCur;
  4589. }
  4590. }
  4591. return old
  4592. }
  4593. // Used both to provide a JSON-safe object in .getHistory, and, when
  4594. // detaching a document, to split the history in two
  4595. function copyHistoryArray(events, newGroup, instantiateSel) {
  4596. var copy = [];
  4597. for (var i = 0; i < events.length; ++i) {
  4598. var event = events[i];
  4599. if (event.ranges) {
  4600. copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);
  4601. continue
  4602. }
  4603. var changes = event.changes, newChanges = [];
  4604. copy.push({changes: newChanges});
  4605. for (var j = 0; j < changes.length; ++j) {
  4606. var change = changes[j], m = (void 0);
  4607. newChanges.push({from: change.from, to: change.to, text: change.text});
  4608. if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\d+)$/)) {
  4609. if (indexOf(newGroup, Number(m[1])) > -1) {
  4610. lst(newChanges)[prop] = change[prop];
  4611. delete change[prop];
  4612. }
  4613. } } }
  4614. }
  4615. }
  4616. return copy
  4617. }
  4618. // The 'scroll' parameter given to many of these indicated whether
  4619. // the new cursor position should be scrolled into view after
  4620. // modifying the selection.
  4621. // If shift is held or the extend flag is set, extends a range to
  4622. // include a given position (and optionally a second position).
  4623. // Otherwise, simply returns the range between the given positions.
  4624. // Used for cursor motion and such.
  4625. function extendRange(range, head, other, extend) {
  4626. if (extend) {
  4627. var anchor = range.anchor;
  4628. if (other) {
  4629. var posBefore = cmp(head, anchor) < 0;
  4630. if (posBefore != (cmp(other, anchor) < 0)) {
  4631. anchor = head;
  4632. head = other;
  4633. } else if (posBefore != (cmp(head, other) < 0)) {
  4634. head = other;
  4635. }
  4636. }
  4637. return new Range(anchor, head)
  4638. } else {
  4639. return new Range(other || head, head)
  4640. }
  4641. }
  4642. // Extend the primary selection range, discard the rest.
  4643. function extendSelection(doc, head, other, options, extend) {
  4644. if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }
  4645. setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);
  4646. }
  4647. // Extend all selections (pos is an array of selections with length
  4648. // equal the number of selections)
  4649. function extendSelections(doc, heads, options) {
  4650. var out = [];
  4651. var extend = doc.cm && (doc.cm.display.shift || doc.extend);
  4652. for (var i = 0; i < doc.sel.ranges.length; i++)
  4653. { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }
  4654. var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);
  4655. setSelection(doc, newSel, options);
  4656. }
  4657. // Updates a single range in the selection.
  4658. function replaceOneSelection(doc, i, range, options) {
  4659. var ranges = doc.sel.ranges.slice(0);
  4660. ranges[i] = range;
  4661. setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);
  4662. }
  4663. // Reset the selection to a single range.
  4664. function setSimpleSelection(doc, anchor, head, options) {
  4665. setSelection(doc, simpleSelection(anchor, head), options);
  4666. }
  4667. // Give beforeSelectionChange handlers a change to influence a
  4668. // selection update.
  4669. function filterSelectionChange(doc, sel, options) {
  4670. var obj = {
  4671. ranges: sel.ranges,
  4672. update: function(ranges) {
  4673. this.ranges = [];
  4674. for (var i = 0; i < ranges.length; i++)
  4675. { this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
  4676. clipPos(doc, ranges[i].head)); }
  4677. },
  4678. origin: options && options.origin
  4679. };
  4680. signal(doc, "beforeSelectionChange", doc, obj);
  4681. if (doc.cm) { signal(doc.cm, "beforeSelectionChange", doc.cm, obj); }
  4682. if (obj.ranges != sel.ranges) { return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1) }
  4683. else { return sel }
  4684. }
  4685. function setSelectionReplaceHistory(doc, sel, options) {
  4686. var done = doc.history.done, last = lst(done);
  4687. if (last && last.ranges) {
  4688. done[done.length - 1] = sel;
  4689. setSelectionNoUndo(doc, sel, options);
  4690. } else {
  4691. setSelection(doc, sel, options);
  4692. }
  4693. }
  4694. // Set a new selection.
  4695. function setSelection(doc, sel, options) {
  4696. setSelectionNoUndo(doc, sel, options);
  4697. addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);
  4698. }
  4699. function setSelectionNoUndo(doc, sel, options) {
  4700. if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange"))
  4701. { sel = filterSelectionChange(doc, sel, options); }
  4702. var bias = options && options.bias ||
  4703. (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);
  4704. setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true));
  4705. if (!(options && options.scroll === false) && doc.cm)
  4706. { ensureCursorVisible(doc.cm); }
  4707. }
  4708. function setSelectionInner(doc, sel) {
  4709. if (sel.equals(doc.sel)) { return }
  4710. doc.sel = sel;
  4711. if (doc.cm) {
  4712. doc.cm.curOp.updateInput = 1;
  4713. doc.cm.curOp.selectionChanged = true;
  4714. signalCursorActivity(doc.cm);
  4715. }
  4716. signalLater(doc, "cursorActivity", doc);
  4717. }
  4718. // Verify that the selection does not partially select any atomic
  4719. // marked ranges.
  4720. function reCheckSelection(doc) {
  4721. setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));
  4722. }
  4723. // Return a selection that does not partially select any atomic
  4724. // ranges.
  4725. function skipAtomicInSelection(doc, sel, bias, mayClear) {
  4726. var out;
  4727. for (var i = 0; i < sel.ranges.length; i++) {
  4728. var range = sel.ranges[i];
  4729. var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];
  4730. var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);
  4731. var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);
  4732. if (out || newAnchor != range.anchor || newHead != range.head) {
  4733. if (!out) { out = sel.ranges.slice(0, i); }
  4734. out[i] = new Range(newAnchor, newHead);
  4735. }
  4736. }
  4737. return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel
  4738. }
  4739. function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {
  4740. var line = getLine(doc, pos.line);
  4741. if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
  4742. var sp = line.markedSpans[i], m = sp.marker;
  4743. // Determine if we should prevent the cursor being placed to the left/right of an atomic marker
  4744. // Historically this was determined using the inclusiveLeft/Right option, but the new way to control it
  4745. // is with selectLeft/Right
  4746. var preventCursorLeft = ("selectLeft" in m) ? !m.selectLeft : m.inclusiveLeft;
  4747. var preventCursorRight = ("selectRight" in m) ? !m.selectRight : m.inclusiveRight;
  4748. if ((sp.from == null || (preventCursorLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&
  4749. (sp.to == null || (preventCursorRight ? sp.to >= pos.ch : sp.to > pos.ch))) {
  4750. if (mayClear) {
  4751. signal(m, "beforeCursorEnter");
  4752. if (m.explicitlyCleared) {
  4753. if (!line.markedSpans) { break }
  4754. else {--i; continue}
  4755. }
  4756. }
  4757. if (!m.atomic) { continue }
  4758. if (oldPos) {
  4759. var near = m.find(dir < 0 ? 1 : -1), diff = (void 0);
  4760. if (dir < 0 ? preventCursorRight : preventCursorLeft)
  4761. { near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null); }
  4762. if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
  4763. { return skipAtomicInner(doc, near, pos, dir, mayClear) }
  4764. }
  4765. var far = m.find(dir < 0 ? -1 : 1);
  4766. if (dir < 0 ? preventCursorLeft : preventCursorRight)
  4767. { far = movePos(doc, far, dir, far.line == pos.line ? line : null); }
  4768. return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null
  4769. }
  4770. } }
  4771. return pos
  4772. }
  4773. // Ensure a given position is not inside an atomic range.
  4774. function skipAtomic(doc, pos, oldPos, bias, mayClear) {
  4775. var dir = bias || 1;
  4776. var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||
  4777. (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||
  4778. skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||
  4779. (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true));
  4780. if (!found) {
  4781. doc.cantEdit = true;
  4782. return Pos(doc.first, 0)
  4783. }
  4784. return found
  4785. }
  4786. function movePos(doc, pos, dir, line) {
  4787. if (dir < 0 && pos.ch == 0) {
  4788. if (pos.line > doc.first) { return clipPos(doc, Pos(pos.line - 1)) }
  4789. else { return null }
  4790. } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {
  4791. if (pos.line < doc.first + doc.size - 1) { return Pos(pos.line + 1, 0) }
  4792. else { return null }
  4793. } else {
  4794. return new Pos(pos.line, pos.ch + dir)
  4795. }
  4796. }
  4797. function selectAll(cm) {
  4798. cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);
  4799. }
  4800. // UPDATING
  4801. // Allow "beforeChange" event handlers to influence a change
  4802. function filterChange(doc, change, update) {
  4803. var obj = {
  4804. canceled: false,
  4805. from: change.from,
  4806. to: change.to,
  4807. text: change.text,
  4808. origin: change.origin,
  4809. cancel: function () { return obj.canceled = true; }
  4810. };
  4811. if (update) { obj.update = function (from, to, text, origin) {
  4812. if (from) { obj.from = clipPos(doc, from); }
  4813. if (to) { obj.to = clipPos(doc, to); }
  4814. if (text) { obj.text = text; }
  4815. if (origin !== undefined) { obj.origin = origin; }
  4816. }; }
  4817. signal(doc, "beforeChange", doc, obj);
  4818. if (doc.cm) { signal(doc.cm, "beforeChange", doc.cm, obj); }
  4819. if (obj.canceled) {
  4820. if (doc.cm) { doc.cm.curOp.updateInput = 2; }
  4821. return null
  4822. }
  4823. return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}
  4824. }
  4825. // Apply a change to a document, and add it to the document's
  4826. // history, and propagating it to all linked documents.
  4827. function makeChange(doc, change, ignoreReadOnly) {
  4828. if (doc.cm) {
  4829. if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }
  4830. if (doc.cm.state.suppressEdits) { return }
  4831. }
  4832. if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) {
  4833. change = filterChange(doc, change, true);
  4834. if (!change) { return }
  4835. }
  4836. // Possibly split or suppress the update based on the presence
  4837. // of read-only spans in its range.
  4838. var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);
  4839. if (split) {
  4840. for (var i = split.length - 1; i >= 0; --i)
  4841. { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text, origin: change.origin}); }
  4842. } else {
  4843. makeChangeInner(doc, change);
  4844. }
  4845. }
  4846. function makeChangeInner(doc, change) {
  4847. if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) { return }
  4848. var selAfter = computeSelAfterChange(doc, change);
  4849. addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);
  4850. makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));
  4851. var rebased = [];
  4852. linkedDocs(doc, function (doc, sharedHist) {
  4853. if (!sharedHist && indexOf(rebased, doc.history) == -1) {
  4854. rebaseHist(doc.history, change);
  4855. rebased.push(doc.history);
  4856. }
  4857. makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));
  4858. });
  4859. }
  4860. // Revert a change stored in a document's history.
  4861. function makeChangeFromHistory(doc, type, allowSelectionOnly) {
  4862. var suppress = doc.cm && doc.cm.state.suppressEdits;
  4863. if (suppress && !allowSelectionOnly) { return }
  4864. var hist = doc.history, event, selAfter = doc.sel;
  4865. var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done;
  4866. // Verify that there is a useable event (so that ctrl-z won't
  4867. // needlessly clear selection events)
  4868. var i = 0;
  4869. for (; i < source.length; i++) {
  4870. event = source[i];
  4871. if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)
  4872. { break }
  4873. }
  4874. if (i == source.length) { return }
  4875. hist.lastOrigin = hist.lastSelOrigin = null;
  4876. for (;;) {
  4877. event = source.pop();
  4878. if (event.ranges) {
  4879. pushSelectionToHistory(event, dest);
  4880. if (allowSelectionOnly && !event.equals(doc.sel)) {
  4881. setSelection(doc, event, {clearRedo: false});
  4882. return
  4883. }
  4884. selAfter = event;
  4885. } else if (suppress) {
  4886. source.push(event);
  4887. return
  4888. } else { break }
  4889. }
  4890. // Build up a reverse change object to add to the opposite history
  4891. // stack (redo when undoing, and vice versa).
  4892. var antiChanges = [];
  4893. pushSelectionToHistory(selAfter, dest);
  4894. dest.push({changes: antiChanges, generation: hist.generation});
  4895. hist.generation = event.generation || ++hist.maxGeneration;
  4896. var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange");
  4897. var loop = function ( i ) {
  4898. var change = event.changes[i];
  4899. change.origin = type;
  4900. if (filter && !filterChange(doc, change, false)) {
  4901. source.length = 0;
  4902. return {}
  4903. }
  4904. antiChanges.push(historyChangeFromChange(doc, change));
  4905. var after = i ? computeSelAfterChange(doc, change) : lst(source);
  4906. makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));
  4907. if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); }
  4908. var rebased = [];
  4909. // Propagate to the linked documents
  4910. linkedDocs(doc, function (doc, sharedHist) {
  4911. if (!sharedHist && indexOf(rebased, doc.history) == -1) {
  4912. rebaseHist(doc.history, change);
  4913. rebased.push(doc.history);
  4914. }
  4915. makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));
  4916. });
  4917. };
  4918. for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {
  4919. var returned = loop( i$1 );
  4920. if ( returned ) return returned.v;
  4921. }
  4922. }
  4923. // Sub-views need their line numbers shifted when text is added
  4924. // above or below them in the parent document.
  4925. function shiftDoc(doc, distance) {
  4926. if (distance == 0) { return }
  4927. doc.first += distance;
  4928. doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range(
  4929. Pos(range.anchor.line + distance, range.anchor.ch),
  4930. Pos(range.head.line + distance, range.head.ch)
  4931. ); }), doc.sel.primIndex);
  4932. if (doc.cm) {
  4933. regChange(doc.cm, doc.first, doc.first - distance, distance);
  4934. for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)
  4935. { regLineChange(doc.cm, l, "gutter"); }
  4936. }
  4937. }
  4938. // More lower-level change function, handling only a single document
  4939. // (not linked ones).
  4940. function makeChangeSingleDoc(doc, change, selAfter, spans) {
  4941. if (doc.cm && !doc.cm.curOp)
  4942. { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }
  4943. if (change.to.line < doc.first) {
  4944. shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));
  4945. return
  4946. }
  4947. if (change.from.line > doc.lastLine()) { return }
  4948. // Clip the change to the size of this doc
  4949. if (change.from.line < doc.first) {
  4950. var shift = change.text.length - 1 - (doc.first - change.from.line);
  4951. shiftDoc(doc, shift);
  4952. change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),
  4953. text: [lst(change.text)], origin: change.origin};
  4954. }
  4955. var last = doc.lastLine();
  4956. if (change.to.line > last) {
  4957. change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),
  4958. text: [change.text[0]], origin: change.origin};
  4959. }
  4960. change.removed = getBetween(doc, change.from, change.to);
  4961. if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }
  4962. if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }
  4963. else { updateDoc(doc, change, spans); }
  4964. setSelectionNoUndo(doc, selAfter, sel_dontScroll);
  4965. if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))
  4966. { doc.cantEdit = false; }
  4967. }
  4968. // Handle the interaction of a change to a document with the editor
  4969. // that this document is part of.
  4970. function makeChangeSingleDocInEditor(cm, change, spans) {
  4971. var doc = cm.doc, display = cm.display, from = change.from, to = change.to;
  4972. var recomputeMaxLength = false, checkWidthStart = from.line;
  4973. if (!cm.options.lineWrapping) {
  4974. checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));
  4975. doc.iter(checkWidthStart, to.line + 1, function (line) {
  4976. if (line == display.maxLine) {
  4977. recomputeMaxLength = true;
  4978. return true
  4979. }
  4980. });
  4981. }
  4982. if (doc.sel.contains(change.from, change.to) > -1)
  4983. { signalCursorActivity(cm); }
  4984. updateDoc(doc, change, spans, estimateHeight(cm));
  4985. if (!cm.options.lineWrapping) {
  4986. doc.iter(checkWidthStart, from.line + change.text.length, function (line) {
  4987. var len = lineLength(line);
  4988. if (len > display.maxLineLength) {
  4989. display.maxLine = line;
  4990. display.maxLineLength = len;
  4991. display.maxLineChanged = true;
  4992. recomputeMaxLength = false;
  4993. }
  4994. });
  4995. if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }
  4996. }
  4997. retreatFrontier(doc, from.line);
  4998. startWorker(cm, 400);
  4999. var lendiff = change.text.length - (to.line - from.line) - 1;
  5000. // Remember that these lines changed, for updating the display
  5001. if (change.full)
  5002. { regChange(cm); }
  5003. else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))
  5004. { regLineChange(cm, from.line, "text"); }
  5005. else
  5006. { regChange(cm, from.line, to.line + 1, lendiff); }
  5007. var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change");
  5008. if (changeHandler || changesHandler) {
  5009. var obj = {
  5010. from: from, to: to,
  5011. text: change.text,
  5012. removed: change.removed,
  5013. origin: change.origin
  5014. };
  5015. if (changeHandler) { signalLater(cm, "change", cm, obj); }
  5016. if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }
  5017. }
  5018. cm.display.selForContextMenu = null;
  5019. }
  5020. function replaceRange(doc, code, from, to, origin) {
  5021. var assign;
  5022. if (!to) { to = from; }
  5023. if (cmp(to, from) < 0) { (assign = [to, from], from = assign[0], to = assign[1]); }
  5024. if (typeof code == "string") { code = doc.splitLines(code); }
  5025. makeChange(doc, {from: from, to: to, text: code, origin: origin});
  5026. }
  5027. // Rebasing/resetting history to deal with externally-sourced changes
  5028. function rebaseHistSelSingle(pos, from, to, diff) {
  5029. if (to < pos.line) {
  5030. pos.line += diff;
  5031. } else if (from < pos.line) {
  5032. pos.line = from;
  5033. pos.ch = 0;
  5034. }
  5035. }
  5036. // Tries to rebase an array of history events given a change in the
  5037. // document. If the change touches the same lines as the event, the
  5038. // event, and everything 'behind' it, is discarded. If the change is
  5039. // before the event, the event's positions are updated. Uses a
  5040. // copy-on-write scheme for the positions, to avoid having to
  5041. // reallocate them all on every rebase, but also avoid problems with
  5042. // shared position objects being unsafely updated.
  5043. function rebaseHistArray(array, from, to, diff) {
  5044. for (var i = 0; i < array.length; ++i) {
  5045. var sub = array[i], ok = true;
  5046. if (sub.ranges) {
  5047. if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }
  5048. for (var j = 0; j < sub.ranges.length; j++) {
  5049. rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);
  5050. rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);
  5051. }
  5052. continue
  5053. }
  5054. for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {
  5055. var cur = sub.changes[j$1];
  5056. if (to < cur.from.line) {
  5057. cur.from = Pos(cur.from.line + diff, cur.from.ch);
  5058. cur.to = Pos(cur.to.line + diff, cur.to.ch);
  5059. } else if (from <= cur.to.line) {
  5060. ok = false;
  5061. break
  5062. }
  5063. }
  5064. if (!ok) {
  5065. array.splice(0, i + 1);
  5066. i = 0;
  5067. }
  5068. }
  5069. }
  5070. function rebaseHist(hist, change) {
  5071. var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;
  5072. rebaseHistArray(hist.done, from, to, diff);
  5073. rebaseHistArray(hist.undone, from, to, diff);
  5074. }
  5075. // Utility for applying a change to a line by handle or number,
  5076. // returning the number and optionally registering the line as
  5077. // changed.
  5078. function changeLine(doc, handle, changeType, op) {
  5079. var no = handle, line = handle;
  5080. if (typeof handle == "number") { line = getLine(doc, clipLine(doc, handle)); }
  5081. else { no = lineNo(handle); }
  5082. if (no == null) { return null }
  5083. if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }
  5084. return line
  5085. }
  5086. // The document is represented as a BTree consisting of leaves, with
  5087. // chunk of lines in them, and branches, with up to ten leaves or
  5088. // other branch nodes below them. The top node is always a branch
  5089. // node, and is the document object itself (meaning it has
  5090. // additional methods and properties).
  5091. //
  5092. // All nodes have parent links. The tree is used both to go from
  5093. // line numbers to line objects, and to go from objects to numbers.
  5094. // It also indexes by height, and is used to convert between height
  5095. // and line object, and to find the total height of the document.
  5096. //
  5097. // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html
  5098. function LeafChunk(lines) {
  5099. this.lines = lines;
  5100. this.parent = null;
  5101. var height = 0;
  5102. for (var i = 0; i < lines.length; ++i) {
  5103. lines[i].parent = this;
  5104. height += lines[i].height;
  5105. }
  5106. this.height = height;
  5107. }
  5108. LeafChunk.prototype = {
  5109. chunkSize: function() { return this.lines.length },
  5110. // Remove the n lines at offset 'at'.
  5111. removeInner: function(at, n) {
  5112. for (var i = at, e = at + n; i < e; ++i) {
  5113. var line = this.lines[i];
  5114. this.height -= line.height;
  5115. cleanUpLine(line);
  5116. signalLater(line, "delete");
  5117. }
  5118. this.lines.splice(at, n);
  5119. },
  5120. // Helper used to collapse a small branch into a single leaf.
  5121. collapse: function(lines) {
  5122. lines.push.apply(lines, this.lines);
  5123. },
  5124. // Insert the given array of lines at offset 'at', count them as
  5125. // having the given height.
  5126. insertInner: function(at, lines, height) {
  5127. this.height += height;
  5128. this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));
  5129. for (var i = 0; i < lines.length; ++i) { lines[i].parent = this; }
  5130. },
  5131. // Used to iterate over a part of the tree.
  5132. iterN: function(at, n, op) {
  5133. for (var e = at + n; at < e; ++at)
  5134. { if (op(this.lines[at])) { return true } }
  5135. }
  5136. };
  5137. function BranchChunk(children) {
  5138. this.children = children;
  5139. var size = 0, height = 0;
  5140. for (var i = 0; i < children.length; ++i) {
  5141. var ch = children[i];
  5142. size += ch.chunkSize(); height += ch.height;
  5143. ch.parent = this;
  5144. }
  5145. this.size = size;
  5146. this.height = height;
  5147. this.parent = null;
  5148. }
  5149. BranchChunk.prototype = {
  5150. chunkSize: function() { return this.size },
  5151. removeInner: function(at, n) {
  5152. this.size -= n;
  5153. for (var i = 0; i < this.children.length; ++i) {
  5154. var child = this.children[i], sz = child.chunkSize();
  5155. if (at < sz) {
  5156. var rm = Math.min(n, sz - at), oldHeight = child.height;
  5157. child.removeInner(at, rm);
  5158. this.height -= oldHeight - child.height;
  5159. if (sz == rm) { this.children.splice(i--, 1); child.parent = null; }
  5160. if ((n -= rm) == 0) { break }
  5161. at = 0;
  5162. } else { at -= sz; }
  5163. }
  5164. // If the result is smaller than 25 lines, ensure that it is a
  5165. // single leaf node.
  5166. if (this.size - n < 25 &&
  5167. (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {
  5168. var lines = [];
  5169. this.collapse(lines);
  5170. this.children = [new LeafChunk(lines)];
  5171. this.children[0].parent = this;
  5172. }
  5173. },
  5174. collapse: function(lines) {
  5175. for (var i = 0; i < this.children.length; ++i) { this.children[i].collapse(lines); }
  5176. },
  5177. insertInner: function(at, lines, height) {
  5178. this.size += lines.length;
  5179. this.height += height;
  5180. for (var i = 0; i < this.children.length; ++i) {
  5181. var child = this.children[i], sz = child.chunkSize();
  5182. if (at <= sz) {
  5183. child.insertInner(at, lines, height);
  5184. if (child.lines && child.lines.length > 50) {
  5185. // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.
  5186. // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.
  5187. var remaining = child.lines.length % 25 + 25;
  5188. for (var pos = remaining; pos < child.lines.length;) {
  5189. var leaf = new LeafChunk(child.lines.slice(pos, pos += 25));
  5190. child.height -= leaf.height;
  5191. this.children.splice(++i, 0, leaf);
  5192. leaf.parent = this;
  5193. }
  5194. child.lines = child.lines.slice(0, remaining);
  5195. this.maybeSpill();
  5196. }
  5197. break
  5198. }
  5199. at -= sz;
  5200. }
  5201. },
  5202. // When a node has grown, check whether it should be split.
  5203. maybeSpill: function() {
  5204. if (this.children.length <= 10) { return }
  5205. var me = this;
  5206. do {
  5207. var spilled = me.children.splice(me.children.length - 5, 5);
  5208. var sibling = new BranchChunk(spilled);
  5209. if (!me.parent) { // Become the parent node
  5210. var copy = new BranchChunk(me.children);
  5211. copy.parent = me;
  5212. me.children = [copy, sibling];
  5213. me = copy;
  5214. } else {
  5215. me.size -= sibling.size;
  5216. me.height -= sibling.height;
  5217. var myIndex = indexOf(me.parent.children, me);
  5218. me.parent.children.splice(myIndex + 1, 0, sibling);
  5219. }
  5220. sibling.parent = me.parent;
  5221. } while (me.children.length > 10)
  5222. me.parent.maybeSpill();
  5223. },
  5224. iterN: function(at, n, op) {
  5225. for (var i = 0; i < this.children.length; ++i) {
  5226. var child = this.children[i], sz = child.chunkSize();
  5227. if (at < sz) {
  5228. var used = Math.min(n, sz - at);
  5229. if (child.iterN(at, used, op)) { return true }
  5230. if ((n -= used) == 0) { break }
  5231. at = 0;
  5232. } else { at -= sz; }
  5233. }
  5234. }
  5235. };
  5236. // Line widgets are block elements displayed above or below a line.
  5237. var LineWidget = function(doc, node, options) {
  5238. if (options) { for (var opt in options) { if (options.hasOwnProperty(opt))
  5239. { this[opt] = options[opt]; } } }
  5240. this.doc = doc;
  5241. this.node = node;
  5242. };
  5243. LineWidget.prototype.clear = function () {
  5244. var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line);
  5245. if (no == null || !ws) { return }
  5246. for (var i = 0; i < ws.length; ++i) { if (ws[i] == this) { ws.splice(i--, 1); } }
  5247. if (!ws.length) { line.widgets = null; }
  5248. var height = widgetHeight(this);
  5249. updateLineHeight(line, Math.max(0, line.height - height));
  5250. if (cm) {
  5251. runInOp(cm, function () {
  5252. adjustScrollWhenAboveVisible(cm, line, -height);
  5253. regLineChange(cm, no, "widget");
  5254. });
  5255. signalLater(cm, "lineWidgetCleared", cm, this, no);
  5256. }
  5257. };
  5258. LineWidget.prototype.changed = function () {
  5259. var this$1 = this;
  5260. var oldH = this.height, cm = this.doc.cm, line = this.line;
  5261. this.height = null;
  5262. var diff = widgetHeight(this) - oldH;
  5263. if (!diff) { return }
  5264. if (!lineIsHidden(this.doc, line)) { updateLineHeight(line, line.height + diff); }
  5265. if (cm) {
  5266. runInOp(cm, function () {
  5267. cm.curOp.forceUpdate = true;
  5268. adjustScrollWhenAboveVisible(cm, line, diff);
  5269. signalLater(cm, "lineWidgetChanged", cm, this$1, lineNo(line));
  5270. });
  5271. }
  5272. };
  5273. eventMixin(LineWidget);
  5274. function adjustScrollWhenAboveVisible(cm, line, diff) {
  5275. if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))
  5276. { addToScrollTop(cm, diff); }
  5277. }
  5278. function addLineWidget(doc, handle, node, options) {
  5279. var widget = new LineWidget(doc, node, options);
  5280. var cm = doc.cm;
  5281. if (cm && widget.noHScroll) { cm.display.alignWidgets = true; }
  5282. changeLine(doc, handle, "widget", function (line) {
  5283. var widgets = line.widgets || (line.widgets = []);
  5284. if (widget.insertAt == null) { widgets.push(widget); }
  5285. else { widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget); }
  5286. widget.line = line;
  5287. if (cm && !lineIsHidden(doc, line)) {
  5288. var aboveVisible = heightAtLine(line) < doc.scrollTop;
  5289. updateLineHeight(line, line.height + widgetHeight(widget));
  5290. if (aboveVisible) { addToScrollTop(cm, widget.height); }
  5291. cm.curOp.forceUpdate = true;
  5292. }
  5293. return true
  5294. });
  5295. if (cm) { signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle)); }
  5296. return widget
  5297. }
  5298. // TEXTMARKERS
  5299. // Created with markText and setBookmark methods. A TextMarker is a
  5300. // handle that can be used to clear or find a marked position in the
  5301. // document. Line objects hold arrays (markedSpans) containing
  5302. // {from, to, marker} object pointing to such marker objects, and
  5303. // indicating that such a marker is present on that line. Multiple
  5304. // lines may point to the same marker when it spans across lines.
  5305. // The spans will have null for their from/to properties when the
  5306. // marker continues beyond the start/end of the line. Markers have
  5307. // links back to the lines they currently touch.
  5308. // Collapsed markers have unique ids, in order to be able to order
  5309. // them, which is needed for uniquely determining an outer marker
  5310. // when they overlap (they may nest, but not partially overlap).
  5311. var nextMarkerId = 0;
  5312. var TextMarker = function(doc, type) {
  5313. this.lines = [];
  5314. this.type = type;
  5315. this.doc = doc;
  5316. this.id = ++nextMarkerId;
  5317. };
  5318. // Clear the marker.
  5319. TextMarker.prototype.clear = function () {
  5320. if (this.explicitlyCleared) { return }
  5321. var cm = this.doc.cm, withOp = cm && !cm.curOp;
  5322. if (withOp) { startOperation(cm); }
  5323. if (hasHandler(this, "clear")) {
  5324. var found = this.find();
  5325. if (found) { signalLater(this, "clear", found.from, found.to); }
  5326. }
  5327. var min = null, max = null;
  5328. for (var i = 0; i < this.lines.length; ++i) {
  5329. var line = this.lines[i];
  5330. var span = getMarkedSpanFor(line.markedSpans, this);
  5331. if (cm && !this.collapsed) { regLineChange(cm, lineNo(line), "text"); }
  5332. else if (cm) {
  5333. if (span.to != null) { max = lineNo(line); }
  5334. if (span.from != null) { min = lineNo(line); }
  5335. }
  5336. line.markedSpans = removeMarkedSpan(line.markedSpans, span);
  5337. if (span.from == null && this.collapsed && !lineIsHidden(this.doc, line) && cm)
  5338. { updateLineHeight(line, textHeight(cm.display)); }
  5339. }
  5340. if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {
  5341. var visual = visualLine(this.lines[i$1]), len = lineLength(visual);
  5342. if (len > cm.display.maxLineLength) {
  5343. cm.display.maxLine = visual;
  5344. cm.display.maxLineLength = len;
  5345. cm.display.maxLineChanged = true;
  5346. }
  5347. } }
  5348. if (min != null && cm && this.collapsed) { regChange(cm, min, max + 1); }
  5349. this.lines.length = 0;
  5350. this.explicitlyCleared = true;
  5351. if (this.atomic && this.doc.cantEdit) {
  5352. this.doc.cantEdit = false;
  5353. if (cm) { reCheckSelection(cm.doc); }
  5354. }
  5355. if (cm) { signalLater(cm, "markerCleared", cm, this, min, max); }
  5356. if (withOp) { endOperation(cm); }
  5357. if (this.parent) { this.parent.clear(); }
  5358. };
  5359. // Find the position of the marker in the document. Returns a {from,
  5360. // to} object by default. Side can be passed to get a specific side
  5361. // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the
  5362. // Pos objects returned contain a line object, rather than a line
  5363. // number (used to prevent looking up the same line twice).
  5364. TextMarker.prototype.find = function (side, lineObj) {
  5365. if (side == null && this.type == "bookmark") { side = 1; }
  5366. var from, to;
  5367. for (var i = 0; i < this.lines.length; ++i) {
  5368. var line = this.lines[i];
  5369. var span = getMarkedSpanFor(line.markedSpans, this);
  5370. if (span.from != null) {
  5371. from = Pos(lineObj ? line : lineNo(line), span.from);
  5372. if (side == -1) { return from }
  5373. }
  5374. if (span.to != null) {
  5375. to = Pos(lineObj ? line : lineNo(line), span.to);
  5376. if (side == 1) { return to }
  5377. }
  5378. }
  5379. return from && {from: from, to: to}
  5380. };
  5381. // Signals that the marker's widget changed, and surrounding layout
  5382. // should be recomputed.
  5383. TextMarker.prototype.changed = function () {
  5384. var this$1 = this;
  5385. var pos = this.find(-1, true), widget = this, cm = this.doc.cm;
  5386. if (!pos || !cm) { return }
  5387. runInOp(cm, function () {
  5388. var line = pos.line, lineN = lineNo(pos.line);
  5389. var view = findViewForLine(cm, lineN);
  5390. if (view) {
  5391. clearLineMeasurementCacheFor(view);
  5392. cm.curOp.selectionChanged = cm.curOp.forceUpdate = true;
  5393. }
  5394. cm.curOp.updateMaxLine = true;
  5395. if (!lineIsHidden(widget.doc, line) && widget.height != null) {
  5396. var oldHeight = widget.height;
  5397. widget.height = null;
  5398. var dHeight = widgetHeight(widget) - oldHeight;
  5399. if (dHeight)
  5400. { updateLineHeight(line, line.height + dHeight); }
  5401. }
  5402. signalLater(cm, "markerChanged", cm, this$1);
  5403. });
  5404. };
  5405. TextMarker.prototype.attachLine = function (line) {
  5406. if (!this.lines.length && this.doc.cm) {
  5407. var op = this.doc.cm.curOp;
  5408. if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)
  5409. { (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this); }
  5410. }
  5411. this.lines.push(line);
  5412. };
  5413. TextMarker.prototype.detachLine = function (line) {
  5414. this.lines.splice(indexOf(this.lines, line), 1);
  5415. if (!this.lines.length && this.doc.cm) {
  5416. var op = this.doc.cm.curOp
  5417. ;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);
  5418. }
  5419. };
  5420. eventMixin(TextMarker);
  5421. // Create a marker, wire it up to the right lines, and
  5422. function markText(doc, from, to, options, type) {
  5423. // Shared markers (across linked documents) are handled separately
  5424. // (markTextShared will call out to this again, once per
  5425. // document).
  5426. if (options && options.shared) { return markTextShared(doc, from, to, options, type) }
  5427. // Ensure we are in an operation.
  5428. if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) }
  5429. var marker = new TextMarker(doc, type), diff = cmp(from, to);
  5430. if (options) { copyObj(options, marker, false); }
  5431. // Don't connect empty markers unless clearWhenEmpty is false
  5432. if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)
  5433. { return marker }
  5434. if (marker.replacedWith) {
  5435. // Showing up as a widget implies collapsed (widget replaces text)
  5436. marker.collapsed = true;
  5437. marker.widgetNode = eltP("span", [marker.replacedWith], "CodeMirror-widget");
  5438. if (!options.handleMouseEvents) { marker.widgetNode.setAttribute("cm-ignore-events", "true"); }
  5439. if (options.insertLeft) { marker.widgetNode.insertLeft = true; }
  5440. }
  5441. if (marker.collapsed) {
  5442. if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||
  5443. from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))
  5444. { throw new Error("Inserting collapsed marker partially overlapping an existing one") }
  5445. seeCollapsedSpans();
  5446. }
  5447. if (marker.addToHistory)
  5448. { addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN); }
  5449. var curLine = from.line, cm = doc.cm, updateMaxLine;
  5450. doc.iter(curLine, to.line + 1, function (line) {
  5451. if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)
  5452. { updateMaxLine = true; }
  5453. if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0); }
  5454. addMarkedSpan(line, new MarkedSpan(marker,
  5455. curLine == from.line ? from.ch : null,
  5456. curLine == to.line ? to.ch : null));
  5457. ++curLine;
  5458. });
  5459. // lineIsHidden depends on the presence of the spans, so needs a second pass
  5460. if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) {
  5461. if (lineIsHidden(doc, line)) { updateLineHeight(line, 0); }
  5462. }); }
  5463. if (marker.clearOnEnter) { on(marker, "beforeCursorEnter", function () { return marker.clear(); }); }
  5464. if (marker.readOnly) {
  5465. seeReadOnlySpans();
  5466. if (doc.history.done.length || doc.history.undone.length)
  5467. { doc.clearHistory(); }
  5468. }
  5469. if (marker.collapsed) {
  5470. marker.id = ++nextMarkerId;
  5471. marker.atomic = true;
  5472. }
  5473. if (cm) {
  5474. // Sync editor state
  5475. if (updateMaxLine) { cm.curOp.updateMaxLine = true; }
  5476. if (marker.collapsed)
  5477. { regChange(cm, from.line, to.line + 1); }
  5478. else if (marker.className || marker.startStyle || marker.endStyle || marker.css ||
  5479. marker.attributes || marker.title)
  5480. { for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, "text"); } }
  5481. if (marker.atomic) { reCheckSelection(cm.doc); }
  5482. signalLater(cm, "markerAdded", cm, marker);
  5483. }
  5484. return marker
  5485. }
  5486. // SHARED TEXTMARKERS
  5487. // A shared marker spans multiple linked documents. It is
  5488. // implemented as a meta-marker-object controlling multiple normal
  5489. // markers.
  5490. var SharedTextMarker = function(markers, primary) {
  5491. this.markers = markers;
  5492. this.primary = primary;
  5493. for (var i = 0; i < markers.length; ++i)
  5494. { markers[i].parent = this; }
  5495. };
  5496. SharedTextMarker.prototype.clear = function () {
  5497. if (this.explicitlyCleared) { return }
  5498. this.explicitlyCleared = true;
  5499. for (var i = 0; i < this.markers.length; ++i)
  5500. { this.markers[i].clear(); }
  5501. signalLater(this, "clear");
  5502. };
  5503. SharedTextMarker.prototype.find = function (side, lineObj) {
  5504. return this.primary.find(side, lineObj)
  5505. };
  5506. eventMixin(SharedTextMarker);
  5507. function markTextShared(doc, from, to, options, type) {
  5508. options = copyObj(options);
  5509. options.shared = false;
  5510. var markers = [markText(doc, from, to, options, type)], primary = markers[0];
  5511. var widget = options.widgetNode;
  5512. linkedDocs(doc, function (doc) {
  5513. if (widget) { options.widgetNode = widget.cloneNode(true); }
  5514. markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type));
  5515. for (var i = 0; i < doc.linked.length; ++i)
  5516. { if (doc.linked[i].isParent) { return } }
  5517. primary = lst(markers);
  5518. });
  5519. return new SharedTextMarker(markers, primary)
  5520. }
  5521. function findSharedMarkers(doc) {
  5522. return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function (m) { return m.parent; })
  5523. }
  5524. function copySharedMarkers(doc, markers) {
  5525. for (var i = 0; i < markers.length; i++) {
  5526. var marker = markers[i], pos = marker.find();
  5527. var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to);
  5528. if (cmp(mFrom, mTo)) {
  5529. var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type);
  5530. marker.markers.push(subMark);
  5531. subMark.parent = marker;
  5532. }
  5533. }
  5534. }
  5535. function detachSharedMarkers(markers) {
  5536. var loop = function ( i ) {
  5537. var marker = markers[i], linked = [marker.primary.doc];
  5538. linkedDocs(marker.primary.doc, function (d) { return linked.push(d); });
  5539. for (var j = 0; j < marker.markers.length; j++) {
  5540. var subMarker = marker.markers[j];
  5541. if (indexOf(linked, subMarker.doc) == -1) {
  5542. subMarker.parent = null;
  5543. marker.markers.splice(j--, 1);
  5544. }
  5545. }
  5546. };
  5547. for (var i = 0; i < markers.length; i++) loop( i );
  5548. }
  5549. var nextDocId = 0;
  5550. var Doc = function(text, mode, firstLine, lineSep, direction) {
  5551. if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) }
  5552. if (firstLine == null) { firstLine = 0; }
  5553. BranchChunk.call(this, [new LeafChunk([new Line("", null)])]);
  5554. this.first = firstLine;
  5555. this.scrollTop = this.scrollLeft = 0;
  5556. this.cantEdit = false;
  5557. this.cleanGeneration = 1;
  5558. this.modeFrontier = this.highlightFrontier = firstLine;
  5559. var start = Pos(firstLine, 0);
  5560. this.sel = simpleSelection(start);
  5561. this.history = new History(null);
  5562. this.id = ++nextDocId;
  5563. this.modeOption = mode;
  5564. this.lineSep = lineSep;
  5565. this.direction = (direction == "rtl") ? "rtl" : "ltr";
  5566. this.extend = false;
  5567. if (typeof text == "string") { text = this.splitLines(text); }
  5568. updateDoc(this, {from: start, to: start, text: text});
  5569. setSelection(this, simpleSelection(start), sel_dontScroll);
  5570. };
  5571. Doc.prototype = createObj(BranchChunk.prototype, {
  5572. constructor: Doc,
  5573. // Iterate over the document. Supports two forms -- with only one
  5574. // argument, it calls that for each line in the document. With
  5575. // three, it iterates over the range given by the first two (with
  5576. // the second being non-inclusive).
  5577. iter: function(from, to, op) {
  5578. if (op) { this.iterN(from - this.first, to - from, op); }
  5579. else { this.iterN(this.first, this.first + this.size, from); }
  5580. },
  5581. // Non-public interface for adding and removing lines.
  5582. insert: function(at, lines) {
  5583. var height = 0;
  5584. for (var i = 0; i < lines.length; ++i) { height += lines[i].height; }
  5585. this.insertInner(at - this.first, lines, height);
  5586. },
  5587. remove: function(at, n) { this.removeInner(at - this.first, n); },
  5588. // From here, the methods are part of the public interface. Most
  5589. // are also available from CodeMirror (editor) instances.
  5590. getValue: function(lineSep) {
  5591. var lines = getLines(this, this.first, this.first + this.size);
  5592. if (lineSep === false) { return lines }
  5593. return lines.join(lineSep || this.lineSeparator())
  5594. },
  5595. setValue: docMethodOp(function(code) {
  5596. var top = Pos(this.first, 0), last = this.first + this.size - 1;
  5597. makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),
  5598. text: this.splitLines(code), origin: "setValue", full: true}, true);
  5599. if (this.cm) { scrollToCoords(this.cm, 0, 0); }
  5600. setSelection(this, simpleSelection(top), sel_dontScroll);
  5601. }),
  5602. replaceRange: function(code, from, to, origin) {
  5603. from = clipPos(this, from);
  5604. to = to ? clipPos(this, to) : from;
  5605. replaceRange(this, code, from, to, origin);
  5606. },
  5607. getRange: function(from, to, lineSep) {
  5608. var lines = getBetween(this, clipPos(this, from), clipPos(this, to));
  5609. if (lineSep === false) { return lines }
  5610. return lines.join(lineSep || this.lineSeparator())
  5611. },
  5612. getLine: function(line) {var l = this.getLineHandle(line); return l && l.text},
  5613. getLineHandle: function(line) {if (isLine(this, line)) { return getLine(this, line) }},
  5614. getLineNumber: function(line) {return lineNo(line)},
  5615. getLineHandleVisualStart: function(line) {
  5616. if (typeof line == "number") { line = getLine(this, line); }
  5617. return visualLine(line)
  5618. },
  5619. lineCount: function() {return this.size},
  5620. firstLine: function() {return this.first},
  5621. lastLine: function() {return this.first + this.size - 1},
  5622. clipPos: function(pos) {return clipPos(this, pos)},
  5623. getCursor: function(start) {
  5624. var range = this.sel.primary(), pos;
  5625. if (start == null || start == "head") { pos = range.head; }
  5626. else if (start == "anchor") { pos = range.anchor; }
  5627. else if (start == "end" || start == "to" || start === false) { pos = range.to(); }
  5628. else { pos = range.from(); }
  5629. return pos
  5630. },
  5631. listSelections: function() { return this.sel.ranges },
  5632. somethingSelected: function() {return this.sel.somethingSelected()},
  5633. setCursor: docMethodOp(function(line, ch, options) {
  5634. setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options);
  5635. }),
  5636. setSelection: docMethodOp(function(anchor, head, options) {
  5637. setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options);
  5638. }),
  5639. extendSelection: docMethodOp(function(head, other, options) {
  5640. extendSelection(this, clipPos(this, head), other && clipPos(this, other), options);
  5641. }),
  5642. extendSelections: docMethodOp(function(heads, options) {
  5643. extendSelections(this, clipPosArray(this, heads), options);
  5644. }),
  5645. extendSelectionsBy: docMethodOp(function(f, options) {
  5646. var heads = map(this.sel.ranges, f);
  5647. extendSelections(this, clipPosArray(this, heads), options);
  5648. }),
  5649. setSelections: docMethodOp(function(ranges, primary, options) {
  5650. if (!ranges.length) { return }
  5651. var out = [];
  5652. for (var i = 0; i < ranges.length; i++)
  5653. { out[i] = new Range(clipPos(this, ranges[i].anchor),
  5654. clipPos(this, ranges[i].head)); }
  5655. if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); }
  5656. setSelection(this, normalizeSelection(this.cm, out, primary), options);
  5657. }),
  5658. addSelection: docMethodOp(function(anchor, head, options) {
  5659. var ranges = this.sel.ranges.slice(0);
  5660. ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)));
  5661. setSelection(this, normalizeSelection(this.cm, ranges, ranges.length - 1), options);
  5662. }),
  5663. getSelection: function(lineSep) {
  5664. var ranges = this.sel.ranges, lines;
  5665. for (var i = 0; i < ranges.length; i++) {
  5666. var sel = getBetween(this, ranges[i].from(), ranges[i].to());
  5667. lines = lines ? lines.concat(sel) : sel;
  5668. }
  5669. if (lineSep === false) { return lines }
  5670. else { return lines.join(lineSep || this.lineSeparator()) }
  5671. },
  5672. getSelections: function(lineSep) {
  5673. var parts = [], ranges = this.sel.ranges;
  5674. for (var i = 0; i < ranges.length; i++) {
  5675. var sel = getBetween(this, ranges[i].from(), ranges[i].to());
  5676. if (lineSep !== false) { sel = sel.join(lineSep || this.lineSeparator()); }
  5677. parts[i] = sel;
  5678. }
  5679. return parts
  5680. },
  5681. replaceSelection: function(code, collapse, origin) {
  5682. var dup = [];
  5683. for (var i = 0; i < this.sel.ranges.length; i++)
  5684. { dup[i] = code; }
  5685. this.replaceSelections(dup, collapse, origin || "+input");
  5686. },
  5687. replaceSelections: docMethodOp(function(code, collapse, origin) {
  5688. var changes = [], sel = this.sel;
  5689. for (var i = 0; i < sel.ranges.length; i++) {
  5690. var range = sel.ranges[i];
  5691. changes[i] = {from: range.from(), to: range.to(), text: this.splitLines(code[i]), origin: origin};
  5692. }
  5693. var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse);
  5694. for (var i$1 = changes.length - 1; i$1 >= 0; i$1--)
  5695. { makeChange(this, changes[i$1]); }
  5696. if (newSel) { setSelectionReplaceHistory(this, newSel); }
  5697. else if (this.cm) { ensureCursorVisible(this.cm); }
  5698. }),
  5699. undo: docMethodOp(function() {makeChangeFromHistory(this, "undo");}),
  5700. redo: docMethodOp(function() {makeChangeFromHistory(this, "redo");}),
  5701. undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true);}),
  5702. redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true);}),
  5703. setExtending: function(val) {this.extend = val;},
  5704. getExtending: function() {return this.extend},
  5705. historySize: function() {
  5706. var hist = this.history, done = 0, undone = 0;
  5707. for (var i = 0; i < hist.done.length; i++) { if (!hist.done[i].ranges) { ++done; } }
  5708. for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone; } }
  5709. return {undo: done, redo: undone}
  5710. },
  5711. clearHistory: function() {
  5712. var this$1 = this;
  5713. this.history = new History(this.history.maxGeneration);
  5714. linkedDocs(this, function (doc) { return doc.history = this$1.history; }, true);
  5715. },
  5716. markClean: function() {
  5717. this.cleanGeneration = this.changeGeneration(true);
  5718. },
  5719. changeGeneration: function(forceSplit) {
  5720. if (forceSplit)
  5721. { this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null; }
  5722. return this.history.generation
  5723. },
  5724. isClean: function (gen) {
  5725. return this.history.generation == (gen || this.cleanGeneration)
  5726. },
  5727. getHistory: function() {
  5728. return {done: copyHistoryArray(this.history.done),
  5729. undone: copyHistoryArray(this.history.undone)}
  5730. },
  5731. setHistory: function(histData) {
  5732. var hist = this.history = new History(this.history.maxGeneration);
  5733. hist.done = copyHistoryArray(histData.done.slice(0), null, true);
  5734. hist.undone = copyHistoryArray(histData.undone.slice(0), null, true);
  5735. },
  5736. setGutterMarker: docMethodOp(function(line, gutterID, value) {
  5737. return changeLine(this, line, "gutter", function (line) {
  5738. var markers = line.gutterMarkers || (line.gutterMarkers = {});
  5739. markers[gutterID] = value;
  5740. if (!value && isEmpty(markers)) { line.gutterMarkers = null; }
  5741. return true
  5742. })
  5743. }),
  5744. clearGutter: docMethodOp(function(gutterID) {
  5745. var this$1 = this;
  5746. this.iter(function (line) {
  5747. if (line.gutterMarkers && line.gutterMarkers[gutterID]) {
  5748. changeLine(this$1, line, "gutter", function () {
  5749. line.gutterMarkers[gutterID] = null;
  5750. if (isEmpty(line.gutterMarkers)) { line.gutterMarkers = null; }
  5751. return true
  5752. });
  5753. }
  5754. });
  5755. }),
  5756. lineInfo: function(line) {
  5757. var n;
  5758. if (typeof line == "number") {
  5759. if (!isLine(this, line)) { return null }
  5760. n = line;
  5761. line = getLine(this, line);
  5762. if (!line) { return null }
  5763. } else {
  5764. n = lineNo(line);
  5765. if (n == null) { return null }
  5766. }
  5767. return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,
  5768. textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,
  5769. widgets: line.widgets}
  5770. },
  5771. addLineClass: docMethodOp(function(handle, where, cls) {
  5772. return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
  5773. var prop = where == "text" ? "textClass"
  5774. : where == "background" ? "bgClass"
  5775. : where == "gutter" ? "gutterClass" : "wrapClass";
  5776. if (!line[prop]) { line[prop] = cls; }
  5777. else if (classTest(cls).test(line[prop])) { return false }
  5778. else { line[prop] += " " + cls; }
  5779. return true
  5780. })
  5781. }),
  5782. removeLineClass: docMethodOp(function(handle, where, cls) {
  5783. return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
  5784. var prop = where == "text" ? "textClass"
  5785. : where == "background" ? "bgClass"
  5786. : where == "gutter" ? "gutterClass" : "wrapClass";
  5787. var cur = line[prop];
  5788. if (!cur) { return false }
  5789. else if (cls == null) { line[prop] = null; }
  5790. else {
  5791. var found = cur.match(classTest(cls));
  5792. if (!found) { return false }
  5793. var end = found.index + found[0].length;
  5794. line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null;
  5795. }
  5796. return true
  5797. })
  5798. }),
  5799. addLineWidget: docMethodOp(function(handle, node, options) {
  5800. return addLineWidget(this, handle, node, options)
  5801. }),
  5802. removeLineWidget: function(widget) { widget.clear(); },
  5803. markText: function(from, to, options) {
  5804. return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || "range")
  5805. },
  5806. setBookmark: function(pos, options) {
  5807. var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),
  5808. insertLeft: options && options.insertLeft,
  5809. clearWhenEmpty: false, shared: options && options.shared,
  5810. handleMouseEvents: options && options.handleMouseEvents};
  5811. pos = clipPos(this, pos);
  5812. return markText(this, pos, pos, realOpts, "bookmark")
  5813. },
  5814. findMarksAt: function(pos) {
  5815. pos = clipPos(this, pos);
  5816. var markers = [], spans = getLine(this, pos.line).markedSpans;
  5817. if (spans) { for (var i = 0; i < spans.length; ++i) {
  5818. var span = spans[i];
  5819. if ((span.from == null || span.from <= pos.ch) &&
  5820. (span.to == null || span.to >= pos.ch))
  5821. { markers.push(span.marker.parent || span.marker); }
  5822. } }
  5823. return markers
  5824. },
  5825. findMarks: function(from, to, filter) {
  5826. from = clipPos(this, from); to = clipPos(this, to);
  5827. var found = [], lineNo = from.line;
  5828. this.iter(from.line, to.line + 1, function (line) {
  5829. var spans = line.markedSpans;
  5830. if (spans) { for (var i = 0; i < spans.length; i++) {
  5831. var span = spans[i];
  5832. if (!(span.to != null && lineNo == from.line && from.ch >= span.to ||
  5833. span.from == null && lineNo != from.line ||
  5834. span.from != null && lineNo == to.line && span.from >= to.ch) &&
  5835. (!filter || filter(span.marker)))
  5836. { found.push(span.marker.parent || span.marker); }
  5837. } }
  5838. ++lineNo;
  5839. });
  5840. return found
  5841. },
  5842. getAllMarks: function() {
  5843. var markers = [];
  5844. this.iter(function (line) {
  5845. var sps = line.markedSpans;
  5846. if (sps) { for (var i = 0; i < sps.length; ++i)
  5847. { if (sps[i].from != null) { markers.push(sps[i].marker); } } }
  5848. });
  5849. return markers
  5850. },
  5851. posFromIndex: function(off) {
  5852. var ch, lineNo = this.first, sepSize = this.lineSeparator().length;
  5853. this.iter(function (line) {
  5854. var sz = line.text.length + sepSize;
  5855. if (sz > off) { ch = off; return true }
  5856. off -= sz;
  5857. ++lineNo;
  5858. });
  5859. return clipPos(this, Pos(lineNo, ch))
  5860. },
  5861. indexFromPos: function (coords) {
  5862. coords = clipPos(this, coords);
  5863. var index = coords.ch;
  5864. if (coords.line < this.first || coords.ch < 0) { return 0 }
  5865. var sepSize = this.lineSeparator().length;
  5866. this.iter(this.first, coords.line, function (line) { // iter aborts when callback returns a truthy value
  5867. index += line.text.length + sepSize;
  5868. });
  5869. return index
  5870. },
  5871. copy: function(copyHistory) {
  5872. var doc = new Doc(getLines(this, this.first, this.first + this.size),
  5873. this.modeOption, this.first, this.lineSep, this.direction);
  5874. doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft;
  5875. doc.sel = this.sel;
  5876. doc.extend = false;
  5877. if (copyHistory) {
  5878. doc.history.undoDepth = this.history.undoDepth;
  5879. doc.setHistory(this.getHistory());
  5880. }
  5881. return doc
  5882. },
  5883. linkedDoc: function(options) {
  5884. if (!options) { options = {}; }
  5885. var from = this.first, to = this.first + this.size;
  5886. if (options.from != null && options.from > from) { from = options.from; }
  5887. if (options.to != null && options.to < to) { to = options.to; }
  5888. var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep, this.direction);
  5889. if (options.sharedHist) { copy.history = this.history
  5890. ; }(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist});
  5891. copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}];
  5892. copySharedMarkers(copy, findSharedMarkers(this));
  5893. return copy
  5894. },
  5895. unlinkDoc: function(other) {
  5896. if (other instanceof CodeMirror) { other = other.doc; }
  5897. if (this.linked) { for (var i = 0; i < this.linked.length; ++i) {
  5898. var link = this.linked[i];
  5899. if (link.doc != other) { continue }
  5900. this.linked.splice(i, 1);
  5901. other.unlinkDoc(this);
  5902. detachSharedMarkers(findSharedMarkers(this));
  5903. break
  5904. } }
  5905. // If the histories were shared, split them again
  5906. if (other.history == this.history) {
  5907. var splitIds = [other.id];
  5908. linkedDocs(other, function (doc) { return splitIds.push(doc.id); }, true);
  5909. other.history = new History(null);
  5910. other.history.done = copyHistoryArray(this.history.done, splitIds);
  5911. other.history.undone = copyHistoryArray(this.history.undone, splitIds);
  5912. }
  5913. },
  5914. iterLinkedDocs: function(f) {linkedDocs(this, f);},
  5915. getMode: function() {return this.mode},
  5916. getEditor: function() {return this.cm},
  5917. splitLines: function(str) {
  5918. if (this.lineSep) { return str.split(this.lineSep) }
  5919. return splitLinesAuto(str)
  5920. },
  5921. lineSeparator: function() { return this.lineSep || "\n" },
  5922. setDirection: docMethodOp(function (dir) {
  5923. if (dir != "rtl") { dir = "ltr"; }
  5924. if (dir == this.direction) { return }
  5925. this.direction = dir;
  5926. this.iter(function (line) { return line.order = null; });
  5927. if (this.cm) { directionChanged(this.cm); }
  5928. })
  5929. });
  5930. // Public alias.
  5931. Doc.prototype.eachLine = Doc.prototype.iter;
  5932. // Kludge to work around strange IE behavior where it'll sometimes
  5933. // re-fire a series of drag-related events right after the drop (#1551)
  5934. var lastDrop = 0;
  5935. function onDrop(e) {
  5936. var cm = this;
  5937. clearDragCursor(cm);
  5938. if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))
  5939. { return }
  5940. e_preventDefault(e);
  5941. if (ie) { lastDrop = +new Date; }
  5942. var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;
  5943. if (!pos || cm.isReadOnly()) { return }
  5944. // Might be a file drop, in which case we simply extract the text
  5945. // and insert it.
  5946. if (files && files.length && window.FileReader && window.File) {
  5947. var n = files.length, text = Array(n), read = 0;
  5948. var markAsReadAndPasteIfAllFilesAreRead = function () {
  5949. if (++read == n) {
  5950. operation(cm, function () {
  5951. pos = clipPos(cm.doc, pos);
  5952. var change = {from: pos, to: pos,
  5953. text: cm.doc.splitLines(
  5954. text.filter(function (t) { return t != null; }).join(cm.doc.lineSeparator())),
  5955. origin: "paste"};
  5956. makeChange(cm.doc, change);
  5957. setSelectionReplaceHistory(cm.doc, simpleSelection(clipPos(cm.doc, pos), clipPos(cm.doc, changeEnd(change))));
  5958. })();
  5959. }
  5960. };
  5961. var readTextFromFile = function (file, i) {
  5962. if (cm.options.allowDropFileTypes &&
  5963. indexOf(cm.options.allowDropFileTypes, file.type) == -1) {
  5964. markAsReadAndPasteIfAllFilesAreRead();
  5965. return
  5966. }
  5967. var reader = new FileReader;
  5968. reader.onerror = function () { return markAsReadAndPasteIfAllFilesAreRead(); };
  5969. reader.onload = function () {
  5970. var content = reader.result;
  5971. if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) {
  5972. markAsReadAndPasteIfAllFilesAreRead();
  5973. return
  5974. }
  5975. text[i] = content;
  5976. markAsReadAndPasteIfAllFilesAreRead();
  5977. };
  5978. reader.readAsText(file);
  5979. };
  5980. for (var i = 0; i < files.length; i++) { readTextFromFile(files[i], i); }
  5981. } else { // Normal drop
  5982. // Don't do a replace if the drop happened inside of the selected text.
  5983. if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {
  5984. cm.state.draggingText(e);
  5985. // Ensure the editor is re-focused
  5986. setTimeout(function () { return cm.display.input.focus(); }, 20);
  5987. return
  5988. }
  5989. try {
  5990. var text$1 = e.dataTransfer.getData("Text");
  5991. if (text$1) {
  5992. var selected;
  5993. if (cm.state.draggingText && !cm.state.draggingText.copy)
  5994. { selected = cm.listSelections(); }
  5995. setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));
  5996. if (selected) { for (var i$1 = 0; i$1 < selected.length; ++i$1)
  5997. { replaceRange(cm.doc, "", selected[i$1].anchor, selected[i$1].head, "drag"); } }
  5998. cm.replaceSelection(text$1, "around", "paste");
  5999. cm.display.input.focus();
  6000. }
  6001. }
  6002. catch(e$1){}
  6003. }
  6004. }
  6005. function onDragStart(cm, e) {
  6006. if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return }
  6007. if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) { return }
  6008. e.dataTransfer.setData("Text", cm.getSelection());
  6009. e.dataTransfer.effectAllowed = "copyMove";
  6010. // Use dummy image instead of default browsers image.
  6011. // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
  6012. if (e.dataTransfer.setDragImage && !safari) {
  6013. var img = elt("img", null, null, "position: fixed; left: 0; top: 0;");
  6014. img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
  6015. if (presto) {
  6016. img.width = img.height = 1;
  6017. cm.display.wrapper.appendChild(img);
  6018. // Force a relayout, or Opera won't use our image for some obscure reason
  6019. img._top = img.offsetTop;
  6020. }
  6021. e.dataTransfer.setDragImage(img, 0, 0);
  6022. if (presto) { img.parentNode.removeChild(img); }
  6023. }
  6024. }
  6025. function onDragOver(cm, e) {
  6026. var pos = posFromMouse(cm, e);
  6027. if (!pos) { return }
  6028. var frag = document.createDocumentFragment();
  6029. drawSelectionCursor(cm, pos, frag);
  6030. if (!cm.display.dragCursor) {
  6031. cm.display.dragCursor = elt("div", null, "CodeMirror-cursors CodeMirror-dragcursors");
  6032. cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv);
  6033. }
  6034. removeChildrenAndAdd(cm.display.dragCursor, frag);
  6035. }
  6036. function clearDragCursor(cm) {
  6037. if (cm.display.dragCursor) {
  6038. cm.display.lineSpace.removeChild(cm.display.dragCursor);
  6039. cm.display.dragCursor = null;
  6040. }
  6041. }
  6042. // These must be handled carefully, because naively registering a
  6043. // handler for each editor will cause the editors to never be
  6044. // garbage collected.
  6045. function forEachCodeMirror(f) {
  6046. if (!document.getElementsByClassName) { return }
  6047. var byClass = document.getElementsByClassName("CodeMirror"), editors = [];
  6048. for (var i = 0; i < byClass.length; i++) {
  6049. var cm = byClass[i].CodeMirror;
  6050. if (cm) { editors.push(cm); }
  6051. }
  6052. if (editors.length) { editors[0].operation(function () {
  6053. for (var i = 0; i < editors.length; i++) { f(editors[i]); }
  6054. }); }
  6055. }
  6056. var globalsRegistered = false;
  6057. function ensureGlobalHandlers() {
  6058. if (globalsRegistered) { return }
  6059. registerGlobalHandlers();
  6060. globalsRegistered = true;
  6061. }
  6062. function registerGlobalHandlers() {
  6063. // When the window resizes, we need to refresh active editors.
  6064. var resizeTimer;
  6065. on(window, "resize", function () {
  6066. if (resizeTimer == null) { resizeTimer = setTimeout(function () {
  6067. resizeTimer = null;
  6068. forEachCodeMirror(onResize);
  6069. }, 100); }
  6070. });
  6071. // When the window loses focus, we want to show the editor as blurred
  6072. on(window, "blur", function () { return forEachCodeMirror(onBlur); });
  6073. }
  6074. // Called when the window resizes
  6075. function onResize(cm) {
  6076. var d = cm.display;
  6077. // Might be a text scaling operation, clear size caches.
  6078. d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
  6079. d.scrollbarsClipped = false;
  6080. cm.setSize();
  6081. }
  6082. var keyNames = {
  6083. 3: "Pause", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt",
  6084. 19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End",
  6085. 36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert",
  6086. 46: "Delete", 59: ";", 61: "=", 91: "Mod", 92: "Mod", 93: "Mod",
  6087. 106: "*", 107: "=", 109: "-", 110: ".", 111: "/", 145: "ScrollLock",
  6088. 173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\",
  6089. 221: "]", 222: "'", 224: "Mod", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete",
  6090. 63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert"
  6091. };
  6092. // Number keys
  6093. for (var i = 0; i < 10; i++) { keyNames[i + 48] = keyNames[i + 96] = String(i); }
  6094. // Alphabetic keys
  6095. for (var i$1 = 65; i$1 <= 90; i$1++) { keyNames[i$1] = String.fromCharCode(i$1); }
  6096. // Function keys
  6097. for (var i$2 = 1; i$2 <= 12; i$2++) { keyNames[i$2 + 111] = keyNames[i$2 + 63235] = "F" + i$2; }
  6098. var keyMap = {};
  6099. keyMap.basic = {
  6100. "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown",
  6101. "End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown",
  6102. "Delete": "delCharAfter", "Backspace": "delCharBefore", "Shift-Backspace": "delCharBefore",
  6103. "Tab": "defaultTab", "Shift-Tab": "indentAuto",
  6104. "Enter": "newlineAndIndent", "Insert": "toggleOverwrite",
  6105. "Esc": "singleSelection"
  6106. };
  6107. // Note that the save and find-related commands aren't defined by
  6108. // default. User code or addons can define them. Unknown commands
  6109. // are simply ignored.
  6110. keyMap.pcDefault = {
  6111. "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo",
  6112. "Ctrl-Home": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Up": "goLineUp", "Ctrl-Down": "goLineDown",
  6113. "Ctrl-Left": "goGroupLeft", "Ctrl-Right": "goGroupRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd",
  6114. "Ctrl-Backspace": "delGroupBefore", "Ctrl-Delete": "delGroupAfter", "Ctrl-S": "save", "Ctrl-F": "find",
  6115. "Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll",
  6116. "Ctrl-[": "indentLess", "Ctrl-]": "indentMore",
  6117. "Ctrl-U": "undoSelection", "Shift-Ctrl-U": "redoSelection", "Alt-U": "redoSelection",
  6118. "fallthrough": "basic"
  6119. };
  6120. // Very basic readline/emacs-style bindings, which are standard on Mac.
  6121. keyMap.emacsy = {
  6122. "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
  6123. "Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd",
  6124. "Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore",
  6125. "Alt-D": "delWordAfter", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars",
  6126. "Ctrl-O": "openLine"
  6127. };
  6128. keyMap.macDefault = {
  6129. "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo",
  6130. "Cmd-Home": "goDocStart", "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goGroupLeft",
  6131. "Alt-Right": "goGroupRight", "Cmd-Left": "goLineLeft", "Cmd-Right": "goLineRight", "Alt-Backspace": "delGroupBefore",
  6132. "Ctrl-Alt-Backspace": "delGroupAfter", "Alt-Delete": "delGroupAfter", "Cmd-S": "save", "Cmd-F": "find",
  6133. "Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll",
  6134. "Cmd-[": "indentLess", "Cmd-]": "indentMore", "Cmd-Backspace": "delWrappedLineLeft", "Cmd-Delete": "delWrappedLineRight",
  6135. "Cmd-U": "undoSelection", "Shift-Cmd-U": "redoSelection", "Ctrl-Up": "goDocStart", "Ctrl-Down": "goDocEnd",
  6136. "fallthrough": ["basic", "emacsy"]
  6137. };
  6138. keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault;
  6139. // KEYMAP DISPATCH
  6140. function normalizeKeyName(name) {
  6141. var parts = name.split(/-(?!$)/);
  6142. name = parts[parts.length - 1];
  6143. var alt, ctrl, shift, cmd;
  6144. for (var i = 0; i < parts.length - 1; i++) {
  6145. var mod = parts[i];
  6146. if (/^(cmd|meta|m)$/i.test(mod)) { cmd = true; }
  6147. else if (/^a(lt)?$/i.test(mod)) { alt = true; }
  6148. else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true; }
  6149. else if (/^s(hift)?$/i.test(mod)) { shift = true; }
  6150. else { throw new Error("Unrecognized modifier name: " + mod) }
  6151. }
  6152. if (alt) { name = "Alt-" + name; }
  6153. if (ctrl) { name = "Ctrl-" + name; }
  6154. if (cmd) { name = "Cmd-" + name; }
  6155. if (shift) { name = "Shift-" + name; }
  6156. return name
  6157. }
  6158. // This is a kludge to keep keymaps mostly working as raw objects
  6159. // (backwards compatibility) while at the same time support features
  6160. // like normalization and multi-stroke key bindings. It compiles a
  6161. // new normalized keymap, and then updates the old object to reflect
  6162. // this.
  6163. function normalizeKeyMap(keymap) {
  6164. var copy = {};
  6165. for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {
  6166. var value = keymap[keyname];
  6167. if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }
  6168. if (value == "...") { delete keymap[keyname]; continue }
  6169. var keys = map(keyname.split(" "), normalizeKeyName);
  6170. for (var i = 0; i < keys.length; i++) {
  6171. var val = (void 0), name = (void 0);
  6172. if (i == keys.length - 1) {
  6173. name = keys.join(" ");
  6174. val = value;
  6175. } else {
  6176. name = keys.slice(0, i + 1).join(" ");
  6177. val = "...";
  6178. }
  6179. var prev = copy[name];
  6180. if (!prev) { copy[name] = val; }
  6181. else if (prev != val) { throw new Error("Inconsistent bindings for " + name) }
  6182. }
  6183. delete keymap[keyname];
  6184. } }
  6185. for (var prop in copy) { keymap[prop] = copy[prop]; }
  6186. return keymap
  6187. }
  6188. function lookupKey(key, map, handle, context) {
  6189. map = getKeyMap(map);
  6190. var found = map.call ? map.call(key, context) : map[key];
  6191. if (found === false) { return "nothing" }
  6192. if (found === "...") { return "multi" }
  6193. if (found != null && handle(found)) { return "handled" }
  6194. if (map.fallthrough) {
  6195. if (Object.prototype.toString.call(map.fallthrough) != "[object Array]")
  6196. { return lookupKey(key, map.fallthrough, handle, context) }
  6197. for (var i = 0; i < map.fallthrough.length; i++) {
  6198. var result = lookupKey(key, map.fallthrough[i], handle, context);
  6199. if (result) { return result }
  6200. }
  6201. }
  6202. }
  6203. // Modifier key presses don't count as 'real' key presses for the
  6204. // purpose of keymap fallthrough.
  6205. function isModifierKey(value) {
  6206. var name = typeof value == "string" ? value : keyNames[value.keyCode];
  6207. return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod"
  6208. }
  6209. function addModifierNames(name, event, noShift) {
  6210. var base = name;
  6211. if (event.altKey && base != "Alt") { name = "Alt-" + name; }
  6212. if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != "Ctrl") { name = "Ctrl-" + name; }
  6213. if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != "Mod") { name = "Cmd-" + name; }
  6214. if (!noShift && event.shiftKey && base != "Shift") { name = "Shift-" + name; }
  6215. return name
  6216. }
  6217. // Look up the name of a key as indicated by an event object.
  6218. function keyName(event, noShift) {
  6219. if (presto && event.keyCode == 34 && event["char"]) { return false }
  6220. var name = keyNames[event.keyCode];
  6221. if (name == null || event.altGraphKey) { return false }
  6222. // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,
  6223. // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)
  6224. if (event.keyCode == 3 && event.code) { name = event.code; }
  6225. return addModifierNames(name, event, noShift)
  6226. }
  6227. function getKeyMap(val) {
  6228. return typeof val == "string" ? keyMap[val] : val
  6229. }
  6230. // Helper for deleting text near the selection(s), used to implement
  6231. // backspace, delete, and similar functionality.
  6232. function deleteNearSelection(cm, compute) {
  6233. var ranges = cm.doc.sel.ranges, kill = [];
  6234. // Build up a set of ranges to kill first, merging overlapping
  6235. // ranges.
  6236. for (var i = 0; i < ranges.length; i++) {
  6237. var toKill = compute(ranges[i]);
  6238. while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {
  6239. var replaced = kill.pop();
  6240. if (cmp(replaced.from, toKill.from) < 0) {
  6241. toKill.from = replaced.from;
  6242. break
  6243. }
  6244. }
  6245. kill.push(toKill);
  6246. }
  6247. // Next, remove those actual ranges.
  6248. runInOp(cm, function () {
  6249. for (var i = kill.length - 1; i >= 0; i--)
  6250. { replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete"); }
  6251. ensureCursorVisible(cm);
  6252. });
  6253. }
  6254. function moveCharLogically(line, ch, dir) {
  6255. var target = skipExtendingChars(line.text, ch + dir, dir);
  6256. return target < 0 || target > line.text.length ? null : target
  6257. }
  6258. function moveLogically(line, start, dir) {
  6259. var ch = moveCharLogically(line, start.ch, dir);
  6260. return ch == null ? null : new Pos(start.line, ch, dir < 0 ? "after" : "before")
  6261. }
  6262. function endOfLine(visually, cm, lineObj, lineNo, dir) {
  6263. if (visually) {
  6264. if (cm.doc.direction == "rtl") { dir = -dir; }
  6265. var order = getOrder(lineObj, cm.doc.direction);
  6266. if (order) {
  6267. var part = dir < 0 ? lst(order) : order[0];
  6268. var moveInStorageOrder = (dir < 0) == (part.level == 1);
  6269. var sticky = moveInStorageOrder ? "after" : "before";
  6270. var ch;
  6271. // With a wrapped rtl chunk (possibly spanning multiple bidi parts),
  6272. // it could be that the last bidi part is not on the last visual line,
  6273. // since visual lines contain content order-consecutive chunks.
  6274. // Thus, in rtl, we are looking for the first (content-order) character
  6275. // in the rtl chunk that is on the last line (that is, the same line
  6276. // as the last (content-order) character).
  6277. if (part.level > 0 || cm.doc.direction == "rtl") {
  6278. var prep = prepareMeasureForLine(cm, lineObj);
  6279. ch = dir < 0 ? lineObj.text.length - 1 : 0;
  6280. var targetTop = measureCharPrepared(cm, prep, ch).top;
  6281. ch = findFirst(function (ch) { return measureCharPrepared(cm, prep, ch).top == targetTop; }, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch);
  6282. if (sticky == "before") { ch = moveCharLogically(lineObj, ch, 1); }
  6283. } else { ch = dir < 0 ? part.to : part.from; }
  6284. return new Pos(lineNo, ch, sticky)
  6285. }
  6286. }
  6287. return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? "before" : "after")
  6288. }
  6289. function moveVisually(cm, line, start, dir) {
  6290. var bidi = getOrder(line, cm.doc.direction);
  6291. if (!bidi) { return moveLogically(line, start, dir) }
  6292. if (start.ch >= line.text.length) {
  6293. start.ch = line.text.length;
  6294. start.sticky = "before";
  6295. } else if (start.ch <= 0) {
  6296. start.ch = 0;
  6297. start.sticky = "after";
  6298. }
  6299. var partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos];
  6300. if (cm.doc.direction == "ltr" && part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) {
  6301. // Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines,
  6302. // nothing interesting happens.
  6303. return moveLogically(line, start, dir)
  6304. }
  6305. var mv = function (pos, dir) { return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir); };
  6306. var prep;
  6307. var getWrappedLineExtent = function (ch) {
  6308. if (!cm.options.lineWrapping) { return {begin: 0, end: line.text.length} }
  6309. prep = prep || prepareMeasureForLine(cm, line);
  6310. return wrappedLineExtentChar(cm, line, prep, ch)
  6311. };
  6312. var wrappedLineExtent = getWrappedLineExtent(start.sticky == "before" ? mv(start, -1) : start.ch);
  6313. if (cm.doc.direction == "rtl" || part.level == 1) {
  6314. var moveInStorageOrder = (part.level == 1) == (dir < 0);
  6315. var ch = mv(start, moveInStorageOrder ? 1 : -1);
  6316. if (ch != null && (!moveInStorageOrder ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) {
  6317. // Case 2: We move within an rtl part or in an rtl editor on the same visual line
  6318. var sticky = moveInStorageOrder ? "before" : "after";
  6319. return new Pos(start.line, ch, sticky)
  6320. }
  6321. }
  6322. // Case 3: Could not move within this bidi part in this visual line, so leave
  6323. // the current bidi part
  6324. var searchInVisualLine = function (partPos, dir, wrappedLineExtent) {
  6325. var getRes = function (ch, moveInStorageOrder) { return moveInStorageOrder
  6326. ? new Pos(start.line, mv(ch, 1), "before")
  6327. : new Pos(start.line, ch, "after"); };
  6328. for (; partPos >= 0 && partPos < bidi.length; partPos += dir) {
  6329. var part = bidi[partPos];
  6330. var moveInStorageOrder = (dir > 0) == (part.level != 1);
  6331. var ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1);
  6332. if (part.from <= ch && ch < part.to) { return getRes(ch, moveInStorageOrder) }
  6333. ch = moveInStorageOrder ? part.from : mv(part.to, -1);
  6334. if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) { return getRes(ch, moveInStorageOrder) }
  6335. }
  6336. };
  6337. // Case 3a: Look for other bidi parts on the same visual line
  6338. var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent);
  6339. if (res) { return res }
  6340. // Case 3b: Look for other bidi parts on the next visual line
  6341. var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1);
  6342. if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) {
  6343. res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh));
  6344. if (res) { return res }
  6345. }
  6346. // Case 4: Nowhere to move
  6347. return null
  6348. }
  6349. // Commands are parameter-less actions that can be performed on an
  6350. // editor, mostly used for keybindings.
  6351. var commands = {
  6352. selectAll: selectAll,
  6353. singleSelection: function (cm) { return cm.setSelection(cm.getCursor("anchor"), cm.getCursor("head"), sel_dontScroll); },
  6354. killLine: function (cm) { return deleteNearSelection(cm, function (range) {
  6355. if (range.empty()) {
  6356. var len = getLine(cm.doc, range.head.line).text.length;
  6357. if (range.head.ch == len && range.head.line < cm.lastLine())
  6358. { return {from: range.head, to: Pos(range.head.line + 1, 0)} }
  6359. else
  6360. { return {from: range.head, to: Pos(range.head.line, len)} }
  6361. } else {
  6362. return {from: range.from(), to: range.to()}
  6363. }
  6364. }); },
  6365. deleteLine: function (cm) { return deleteNearSelection(cm, function (range) { return ({
  6366. from: Pos(range.from().line, 0),
  6367. to: clipPos(cm.doc, Pos(range.to().line + 1, 0))
  6368. }); }); },
  6369. delLineLeft: function (cm) { return deleteNearSelection(cm, function (range) { return ({
  6370. from: Pos(range.from().line, 0), to: range.from()
  6371. }); }); },
  6372. delWrappedLineLeft: function (cm) { return deleteNearSelection(cm, function (range) {
  6373. var top = cm.charCoords(range.head, "div").top + 5;
  6374. var leftPos = cm.coordsChar({left: 0, top: top}, "div");
  6375. return {from: leftPos, to: range.from()}
  6376. }); },
  6377. delWrappedLineRight: function (cm) { return deleteNearSelection(cm, function (range) {
  6378. var top = cm.charCoords(range.head, "div").top + 5;
  6379. var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div");
  6380. return {from: range.from(), to: rightPos }
  6381. }); },
  6382. undo: function (cm) { return cm.undo(); },
  6383. redo: function (cm) { return cm.redo(); },
  6384. undoSelection: function (cm) { return cm.undoSelection(); },
  6385. redoSelection: function (cm) { return cm.redoSelection(); },
  6386. goDocStart: function (cm) { return cm.extendSelection(Pos(cm.firstLine(), 0)); },
  6387. goDocEnd: function (cm) { return cm.extendSelection(Pos(cm.lastLine())); },
  6388. goLineStart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStart(cm, range.head.line); },
  6389. {origin: "+move", bias: 1}
  6390. ); },
  6391. goLineStartSmart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStartSmart(cm, range.head); },
  6392. {origin: "+move", bias: 1}
  6393. ); },
  6394. goLineEnd: function (cm) { return cm.extendSelectionsBy(function (range) { return lineEnd(cm, range.head.line); },
  6395. {origin: "+move", bias: -1}
  6396. ); },
  6397. goLineRight: function (cm) { return cm.extendSelectionsBy(function (range) {
  6398. var top = cm.cursorCoords(range.head, "div").top + 5;
  6399. return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div")
  6400. }, sel_move); },
  6401. goLineLeft: function (cm) { return cm.extendSelectionsBy(function (range) {
  6402. var top = cm.cursorCoords(range.head, "div").top + 5;
  6403. return cm.coordsChar({left: 0, top: top}, "div")
  6404. }, sel_move); },
  6405. goLineLeftSmart: function (cm) { return cm.extendSelectionsBy(function (range) {
  6406. var top = cm.cursorCoords(range.head, "div").top + 5;
  6407. var pos = cm.coordsChar({left: 0, top: top}, "div");
  6408. if (pos.ch < cm.getLine(pos.line).search(/\S/)) { return lineStartSmart(cm, range.head) }
  6409. return pos
  6410. }, sel_move); },
  6411. goLineUp: function (cm) { return cm.moveV(-1, "line"); },
  6412. goLineDown: function (cm) { return cm.moveV(1, "line"); },
  6413. goPageUp: function (cm) { return cm.moveV(-1, "page"); },
  6414. goPageDown: function (cm) { return cm.moveV(1, "page"); },
  6415. goCharLeft: function (cm) { return cm.moveH(-1, "char"); },
  6416. goCharRight: function (cm) { return cm.moveH(1, "char"); },
  6417. goColumnLeft: function (cm) { return cm.moveH(-1, "column"); },
  6418. goColumnRight: function (cm) { return cm.moveH(1, "column"); },
  6419. goWordLeft: function (cm) { return cm.moveH(-1, "word"); },
  6420. goGroupRight: function (cm) { return cm.moveH(1, "group"); },
  6421. goGroupLeft: function (cm) { return cm.moveH(-1, "group"); },
  6422. goWordRight: function (cm) { return cm.moveH(1, "word"); },
  6423. delCharBefore: function (cm) { return cm.deleteH(-1, "codepoint"); },
  6424. delCharAfter: function (cm) { return cm.deleteH(1, "char"); },
  6425. delWordBefore: function (cm) { return cm.deleteH(-1, "word"); },
  6426. delWordAfter: function (cm) { return cm.deleteH(1, "word"); },
  6427. delGroupBefore: function (cm) { return cm.deleteH(-1, "group"); },
  6428. delGroupAfter: function (cm) { return cm.deleteH(1, "group"); },
  6429. indentAuto: function (cm) { return cm.indentSelection("smart"); },
  6430. indentMore: function (cm) { return cm.indentSelection("add"); },
  6431. indentLess: function (cm) { return cm.indentSelection("subtract"); },
  6432. insertTab: function (cm) { return cm.replaceSelection("\t"); },
  6433. insertSoftTab: function (cm) {
  6434. var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize;
  6435. for (var i = 0; i < ranges.length; i++) {
  6436. var pos = ranges[i].from();
  6437. var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize);
  6438. spaces.push(spaceStr(tabSize - col % tabSize));
  6439. }
  6440. cm.replaceSelections(spaces);
  6441. },
  6442. defaultTab: function (cm) {
  6443. if (cm.somethingSelected()) { cm.indentSelection("add"); }
  6444. else { cm.execCommand("insertTab"); }
  6445. },
  6446. // Swap the two chars left and right of each selection's head.
  6447. // Move cursor behind the two swapped characters afterwards.
  6448. //
  6449. // Doesn't consider line feeds a character.
  6450. // Doesn't scan more than one line above to find a character.
  6451. // Doesn't do anything on an empty line.
  6452. // Doesn't do anything with non-empty selections.
  6453. transposeChars: function (cm) { return runInOp(cm, function () {
  6454. var ranges = cm.listSelections(), newSel = [];
  6455. for (var i = 0; i < ranges.length; i++) {
  6456. if (!ranges[i].empty()) { continue }
  6457. var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text;
  6458. if (line) {
  6459. if (cur.ch == line.length) { cur = new Pos(cur.line, cur.ch - 1); }
  6460. if (cur.ch > 0) {
  6461. cur = new Pos(cur.line, cur.ch + 1);
  6462. cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2),
  6463. Pos(cur.line, cur.ch - 2), cur, "+transpose");
  6464. } else if (cur.line > cm.doc.first) {
  6465. var prev = getLine(cm.doc, cur.line - 1).text;
  6466. if (prev) {
  6467. cur = new Pos(cur.line, 1);
  6468. cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() +
  6469. prev.charAt(prev.length - 1),
  6470. Pos(cur.line - 1, prev.length - 1), cur, "+transpose");
  6471. }
  6472. }
  6473. }
  6474. newSel.push(new Range(cur, cur));
  6475. }
  6476. cm.setSelections(newSel);
  6477. }); },
  6478. newlineAndIndent: function (cm) { return runInOp(cm, function () {
  6479. var sels = cm.listSelections();
  6480. for (var i = sels.length - 1; i >= 0; i--)
  6481. { cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, "+input"); }
  6482. sels = cm.listSelections();
  6483. for (var i$1 = 0; i$1 < sels.length; i$1++)
  6484. { cm.indentLine(sels[i$1].from().line, null, true); }
  6485. ensureCursorVisible(cm);
  6486. }); },
  6487. openLine: function (cm) { return cm.replaceSelection("\n", "start"); },
  6488. toggleOverwrite: function (cm) { return cm.toggleOverwrite(); }
  6489. };
  6490. function lineStart(cm, lineN) {
  6491. var line = getLine(cm.doc, lineN);
  6492. var visual = visualLine(line);
  6493. if (visual != line) { lineN = lineNo(visual); }
  6494. return endOfLine(true, cm, visual, lineN, 1)
  6495. }
  6496. function lineEnd(cm, lineN) {
  6497. var line = getLine(cm.doc, lineN);
  6498. var visual = visualLineEnd(line);
  6499. if (visual != line) { lineN = lineNo(visual); }
  6500. return endOfLine(true, cm, line, lineN, -1)
  6501. }
  6502. function lineStartSmart(cm, pos) {
  6503. var start = lineStart(cm, pos.line);
  6504. var line = getLine(cm.doc, start.line);
  6505. var order = getOrder(line, cm.doc.direction);
  6506. if (!order || order[0].level == 0) {
  6507. var firstNonWS = Math.max(start.ch, line.text.search(/\S/));
  6508. var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch;
  6509. return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky)
  6510. }
  6511. return start
  6512. }
  6513. // Run a handler that was bound to a key.
  6514. function doHandleBinding(cm, bound, dropShift) {
  6515. if (typeof bound == "string") {
  6516. bound = commands[bound];
  6517. if (!bound) { return false }
  6518. }
  6519. // Ensure previous input has been read, so that the handler sees a
  6520. // consistent view of the document
  6521. cm.display.input.ensurePolled();
  6522. var prevShift = cm.display.shift, done = false;
  6523. try {
  6524. if (cm.isReadOnly()) { cm.state.suppressEdits = true; }
  6525. if (dropShift) { cm.display.shift = false; }
  6526. done = bound(cm) != Pass;
  6527. } finally {
  6528. cm.display.shift = prevShift;
  6529. cm.state.suppressEdits = false;
  6530. }
  6531. return done
  6532. }
  6533. function lookupKeyForEditor(cm, name, handle) {
  6534. for (var i = 0; i < cm.state.keyMaps.length; i++) {
  6535. var result = lookupKey(name, cm.state.keyMaps[i], handle, cm);
  6536. if (result) { return result }
  6537. }
  6538. return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm))
  6539. || lookupKey(name, cm.options.keyMap, handle, cm)
  6540. }
  6541. // Note that, despite the name, this function is also used to check
  6542. // for bound mouse clicks.
  6543. var stopSeq = new Delayed;
  6544. function dispatchKey(cm, name, e, handle) {
  6545. var seq = cm.state.keySeq;
  6546. if (seq) {
  6547. if (isModifierKey(name)) { return "handled" }
  6548. if (/\'$/.test(name))
  6549. { cm.state.keySeq = null; }
  6550. else
  6551. { stopSeq.set(50, function () {
  6552. if (cm.state.keySeq == seq) {
  6553. cm.state.keySeq = null;
  6554. cm.display.input.reset();
  6555. }
  6556. }); }
  6557. if (dispatchKeyInner(cm, seq + " " + name, e, handle)) { return true }
  6558. }
  6559. return dispatchKeyInner(cm, name, e, handle)
  6560. }
  6561. function dispatchKeyInner(cm, name, e, handle) {
  6562. var result = lookupKeyForEditor(cm, name, handle);
  6563. if (result == "multi")
  6564. { cm.state.keySeq = name; }
  6565. if (result == "handled")
  6566. { signalLater(cm, "keyHandled", cm, name, e); }
  6567. if (result == "handled" || result == "multi") {
  6568. e_preventDefault(e);
  6569. restartBlink(cm);
  6570. }
  6571. return !!result
  6572. }
  6573. // Handle a key from the keydown event.
  6574. function handleKeyBinding(cm, e) {
  6575. var name = keyName(e, true);
  6576. if (!name) { return false }
  6577. if (e.shiftKey && !cm.state.keySeq) {
  6578. // First try to resolve full name (including 'Shift-'). Failing
  6579. // that, see if there is a cursor-motion command (starting with
  6580. // 'go') bound to the keyname without 'Shift-'.
  6581. return dispatchKey(cm, "Shift-" + name, e, function (b) { return doHandleBinding(cm, b, true); })
  6582. || dispatchKey(cm, name, e, function (b) {
  6583. if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion)
  6584. { return doHandleBinding(cm, b) }
  6585. })
  6586. } else {
  6587. return dispatchKey(cm, name, e, function (b) { return doHandleBinding(cm, b); })
  6588. }
  6589. }
  6590. // Handle a key from the keypress event
  6591. function handleCharBinding(cm, e, ch) {
  6592. return dispatchKey(cm, "'" + ch + "'", e, function (b) { return doHandleBinding(cm, b, true); })
  6593. }
  6594. var lastStoppedKey = null;
  6595. function onKeyDown(e) {
  6596. var cm = this;
  6597. if (e.target && e.target != cm.display.input.getField()) { return }
  6598. cm.curOp.focus = activeElt();
  6599. if (signalDOMEvent(cm, e)) { return }
  6600. // IE does strange things with escape.
  6601. if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false; }
  6602. var code = e.keyCode;
  6603. cm.display.shift = code == 16 || e.shiftKey;
  6604. var handled = handleKeyBinding(cm, e);
  6605. if (presto) {
  6606. lastStoppedKey = handled ? code : null;
  6607. // Opera has no cut event... we try to at least catch the key combo
  6608. if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))
  6609. { cm.replaceSelection("", null, "cut"); }
  6610. }
  6611. if (gecko && !mac && !handled && code == 46 && e.shiftKey && !e.ctrlKey && document.execCommand)
  6612. { document.execCommand("cut"); }
  6613. // Turn mouse into crosshair when Alt is held on Mac.
  6614. if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className))
  6615. { showCrossHair(cm); }
  6616. }
  6617. function showCrossHair(cm) {
  6618. var lineDiv = cm.display.lineDiv;
  6619. addClass(lineDiv, "CodeMirror-crosshair");
  6620. function up(e) {
  6621. if (e.keyCode == 18 || !e.altKey) {
  6622. rmClass(lineDiv, "CodeMirror-crosshair");
  6623. off(document, "keyup", up);
  6624. off(document, "mouseover", up);
  6625. }
  6626. }
  6627. on(document, "keyup", up);
  6628. on(document, "mouseover", up);
  6629. }
  6630. function onKeyUp(e) {
  6631. if (e.keyCode == 16) { this.doc.sel.shift = false; }
  6632. signalDOMEvent(this, e);
  6633. }
  6634. function onKeyPress(e) {
  6635. var cm = this;
  6636. if (e.target && e.target != cm.display.input.getField()) { return }
  6637. if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) { return }
  6638. var keyCode = e.keyCode, charCode = e.charCode;
  6639. if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return}
  6640. if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) { return }
  6641. var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
  6642. // Some browsers fire keypress events for backspace
  6643. if (ch == "\x08") { return }
  6644. if (handleCharBinding(cm, e, ch)) { return }
  6645. cm.display.input.onKeyPress(e);
  6646. }
  6647. var DOUBLECLICK_DELAY = 400;
  6648. var PastClick = function(time, pos, button) {
  6649. this.time = time;
  6650. this.pos = pos;
  6651. this.button = button;
  6652. };
  6653. PastClick.prototype.compare = function (time, pos, button) {
  6654. return this.time + DOUBLECLICK_DELAY > time &&
  6655. cmp(pos, this.pos) == 0 && button == this.button
  6656. };
  6657. var lastClick, lastDoubleClick;
  6658. function clickRepeat(pos, button) {
  6659. var now = +new Date;
  6660. if (lastDoubleClick && lastDoubleClick.compare(now, pos, button)) {
  6661. lastClick = lastDoubleClick = null;
  6662. return "triple"
  6663. } else if (lastClick && lastClick.compare(now, pos, button)) {
  6664. lastDoubleClick = new PastClick(now, pos, button);
  6665. lastClick = null;
  6666. return "double"
  6667. } else {
  6668. lastClick = new PastClick(now, pos, button);
  6669. lastDoubleClick = null;
  6670. return "single"
  6671. }
  6672. }
  6673. // A mouse down can be a single click, double click, triple click,
  6674. // start of selection drag, start of text drag, new cursor
  6675. // (ctrl-click), rectangle drag (alt-drag), or xwin
  6676. // middle-click-paste. Or it might be a click on something we should
  6677. // not interfere with, such as a scrollbar or widget.
  6678. function onMouseDown(e) {
  6679. var cm = this, display = cm.display;
  6680. if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }
  6681. display.input.ensurePolled();
  6682. display.shift = e.shiftKey;
  6683. if (eventInWidget(display, e)) {
  6684. if (!webkit) {
  6685. // Briefly turn off draggability, to allow widgets to do
  6686. // normal dragging things.
  6687. display.scroller.draggable = false;
  6688. setTimeout(function () { return display.scroller.draggable = true; }, 100);
  6689. }
  6690. return
  6691. }
  6692. if (clickInGutter(cm, e)) { return }
  6693. var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : "single";
  6694. window.focus();
  6695. // #3261: make sure, that we're not starting a second selection
  6696. if (button == 1 && cm.state.selectingText)
  6697. { cm.state.selectingText(e); }
  6698. if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return }
  6699. if (button == 1) {
  6700. if (pos) { leftButtonDown(cm, pos, repeat, e); }
  6701. else if (e_target(e) == display.scroller) { e_preventDefault(e); }
  6702. } else if (button == 2) {
  6703. if (pos) { extendSelection(cm.doc, pos); }
  6704. setTimeout(function () { return display.input.focus(); }, 20);
  6705. } else if (button == 3) {
  6706. if (captureRightClick) { cm.display.input.onContextMenu(e); }
  6707. else { delayBlurEvent(cm); }
  6708. }
  6709. }
  6710. function handleMappedButton(cm, button, pos, repeat, event) {
  6711. var name = "Click";
  6712. if (repeat == "double") { name = "Double" + name; }
  6713. else if (repeat == "triple") { name = "Triple" + name; }
  6714. name = (button == 1 ? "Left" : button == 2 ? "Middle" : "Right") + name;
  6715. return dispatchKey(cm, addModifierNames(name, event), event, function (bound) {
  6716. if (typeof bound == "string") { bound = commands[bound]; }
  6717. if (!bound) { return false }
  6718. var done = false;
  6719. try {
  6720. if (cm.isReadOnly()) { cm.state.suppressEdits = true; }
  6721. done = bound(cm, pos) != Pass;
  6722. } finally {
  6723. cm.state.suppressEdits = false;
  6724. }
  6725. return done
  6726. })
  6727. }
  6728. function configureMouse(cm, repeat, event) {
  6729. var option = cm.getOption("configureMouse");
  6730. var value = option ? option(cm, repeat, event) : {};
  6731. if (value.unit == null) {
  6732. var rect = chromeOS ? event.shiftKey && event.metaKey : event.altKey;
  6733. value.unit = rect ? "rectangle" : repeat == "single" ? "char" : repeat == "double" ? "word" : "line";
  6734. }
  6735. if (value.extend == null || cm.doc.extend) { value.extend = cm.doc.extend || event.shiftKey; }
  6736. if (value.addNew == null) { value.addNew = mac ? event.metaKey : event.ctrlKey; }
  6737. if (value.moveOnDrag == null) { value.moveOnDrag = !(mac ? event.altKey : event.ctrlKey); }
  6738. return value
  6739. }
  6740. function leftButtonDown(cm, pos, repeat, event) {
  6741. if (ie) { setTimeout(bind(ensureFocus, cm), 0); }
  6742. else { cm.curOp.focus = activeElt(); }
  6743. var behavior = configureMouse(cm, repeat, event);
  6744. var sel = cm.doc.sel, contained;
  6745. if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&
  6746. repeat == "single" && (contained = sel.contains(pos)) > -1 &&
  6747. (cmp((contained = sel.ranges[contained]).from(), pos) < 0 || pos.xRel > 0) &&
  6748. (cmp(contained.to(), pos) > 0 || pos.xRel < 0))
  6749. { leftButtonStartDrag(cm, event, pos, behavior); }
  6750. else
  6751. { leftButtonSelect(cm, event, pos, behavior); }
  6752. }
  6753. // Start a text drag. When it ends, see if any dragging actually
  6754. // happen, and treat as a click if it didn't.
  6755. function leftButtonStartDrag(cm, event, pos, behavior) {
  6756. var display = cm.display, moved = false;
  6757. var dragEnd = operation(cm, function (e) {
  6758. if (webkit) { display.scroller.draggable = false; }
  6759. cm.state.draggingText = false;
  6760. off(display.wrapper.ownerDocument, "mouseup", dragEnd);
  6761. off(display.wrapper.ownerDocument, "mousemove", mouseMove);
  6762. off(display.scroller, "dragstart", dragStart);
  6763. off(display.scroller, "drop", dragEnd);
  6764. if (!moved) {
  6765. e_preventDefault(e);
  6766. if (!behavior.addNew)
  6767. { extendSelection(cm.doc, pos, null, null, behavior.extend); }
  6768. // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)
  6769. if ((webkit && !safari) || ie && ie_version == 9)
  6770. { setTimeout(function () {display.wrapper.ownerDocument.body.focus({preventScroll: true}); display.input.focus();}, 20); }
  6771. else
  6772. { display.input.focus(); }
  6773. }
  6774. });
  6775. var mouseMove = function(e2) {
  6776. moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10;
  6777. };
  6778. var dragStart = function () { return moved = true; };
  6779. // Let the drag handler handle this.
  6780. if (webkit) { display.scroller.draggable = true; }
  6781. cm.state.draggingText = dragEnd;
  6782. dragEnd.copy = !behavior.moveOnDrag;
  6783. // IE's approach to draggable
  6784. if (display.scroller.dragDrop) { display.scroller.dragDrop(); }
  6785. on(display.wrapper.ownerDocument, "mouseup", dragEnd);
  6786. on(display.wrapper.ownerDocument, "mousemove", mouseMove);
  6787. on(display.scroller, "dragstart", dragStart);
  6788. on(display.scroller, "drop", dragEnd);
  6789. delayBlurEvent(cm);
  6790. setTimeout(function () { return display.input.focus(); }, 20);
  6791. }
  6792. function rangeForUnit(cm, pos, unit) {
  6793. if (unit == "char") { return new Range(pos, pos) }
  6794. if (unit == "word") { return cm.findWordAt(pos) }
  6795. if (unit == "line") { return new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))) }
  6796. var result = unit(cm, pos);
  6797. return new Range(result.from, result.to)
  6798. }
  6799. // Normal selection, as opposed to text dragging.
  6800. function leftButtonSelect(cm, event, start, behavior) {
  6801. var display = cm.display, doc = cm.doc;
  6802. e_preventDefault(event);
  6803. var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;
  6804. if (behavior.addNew && !behavior.extend) {
  6805. ourIndex = doc.sel.contains(start);
  6806. if (ourIndex > -1)
  6807. { ourRange = ranges[ourIndex]; }
  6808. else
  6809. { ourRange = new Range(start, start); }
  6810. } else {
  6811. ourRange = doc.sel.primary();
  6812. ourIndex = doc.sel.primIndex;
  6813. }
  6814. if (behavior.unit == "rectangle") {
  6815. if (!behavior.addNew) { ourRange = new Range(start, start); }
  6816. start = posFromMouse(cm, event, true, true);
  6817. ourIndex = -1;
  6818. } else {
  6819. var range = rangeForUnit(cm, start, behavior.unit);
  6820. if (behavior.extend)
  6821. { ourRange = extendRange(ourRange, range.anchor, range.head, behavior.extend); }
  6822. else
  6823. { ourRange = range; }
  6824. }
  6825. if (!behavior.addNew) {
  6826. ourIndex = 0;
  6827. setSelection(doc, new Selection([ourRange], 0), sel_mouse);
  6828. startSel = doc.sel;
  6829. } else if (ourIndex == -1) {
  6830. ourIndex = ranges.length;
  6831. setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),
  6832. {scroll: false, origin: "*mouse"});
  6833. } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == "char" && !behavior.extend) {
  6834. setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),
  6835. {scroll: false, origin: "*mouse"});
  6836. startSel = doc.sel;
  6837. } else {
  6838. replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);
  6839. }
  6840. var lastPos = start;
  6841. function extendTo(pos) {
  6842. if (cmp(lastPos, pos) == 0) { return }
  6843. lastPos = pos;
  6844. if (behavior.unit == "rectangle") {
  6845. var ranges = [], tabSize = cm.options.tabSize;
  6846. var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);
  6847. var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);
  6848. var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);
  6849. for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));
  6850. line <= end; line++) {
  6851. var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);
  6852. if (left == right)
  6853. { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }
  6854. else if (text.length > leftPos)
  6855. { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }
  6856. }
  6857. if (!ranges.length) { ranges.push(new Range(start, start)); }
  6858. setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),
  6859. {origin: "*mouse", scroll: false});
  6860. cm.scrollIntoView(pos);
  6861. } else {
  6862. var oldRange = ourRange;
  6863. var range = rangeForUnit(cm, pos, behavior.unit);
  6864. var anchor = oldRange.anchor, head;
  6865. if (cmp(range.anchor, anchor) > 0) {
  6866. head = range.head;
  6867. anchor = minPos(oldRange.from(), range.anchor);
  6868. } else {
  6869. head = range.anchor;
  6870. anchor = maxPos(oldRange.to(), range.head);
  6871. }
  6872. var ranges$1 = startSel.ranges.slice(0);
  6873. ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));
  6874. setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);
  6875. }
  6876. }
  6877. var editorSize = display.wrapper.getBoundingClientRect();
  6878. // Used to ensure timeout re-tries don't fire when another extend
  6879. // happened in the meantime (clearTimeout isn't reliable -- at
  6880. // least on Chrome, the timeouts still happen even when cleared,
  6881. // if the clear happens after their scheduled firing time).
  6882. var counter = 0;
  6883. function extend(e) {
  6884. var curCount = ++counter;
  6885. var cur = posFromMouse(cm, e, true, behavior.unit == "rectangle");
  6886. if (!cur) { return }
  6887. if (cmp(cur, lastPos) != 0) {
  6888. cm.curOp.focus = activeElt();
  6889. extendTo(cur);
  6890. var visible = visibleLines(display, doc);
  6891. if (cur.line >= visible.to || cur.line < visible.from)
  6892. { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }
  6893. } else {
  6894. var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;
  6895. if (outside) { setTimeout(operation(cm, function () {
  6896. if (counter != curCount) { return }
  6897. display.scroller.scrollTop += outside;
  6898. extend(e);
  6899. }), 50); }
  6900. }
  6901. }
  6902. function done(e) {
  6903. cm.state.selectingText = false;
  6904. counter = Infinity;
  6905. // If e is null or undefined we interpret this as someone trying
  6906. // to explicitly cancel the selection rather than the user
  6907. // letting go of the mouse button.
  6908. if (e) {
  6909. e_preventDefault(e);
  6910. display.input.focus();
  6911. }
  6912. off(display.wrapper.ownerDocument, "mousemove", move);
  6913. off(display.wrapper.ownerDocument, "mouseup", up);
  6914. doc.history.lastSelOrigin = null;
  6915. }
  6916. var move = operation(cm, function (e) {
  6917. if (e.buttons === 0 || !e_button(e)) { done(e); }
  6918. else { extend(e); }
  6919. });
  6920. var up = operation(cm, done);
  6921. cm.state.selectingText = up;
  6922. on(display.wrapper.ownerDocument, "mousemove", move);
  6923. on(display.wrapper.ownerDocument, "mouseup", up);
  6924. }
  6925. // Used when mouse-selecting to adjust the anchor to the proper side
  6926. // of a bidi jump depending on the visual position of the head.
  6927. function bidiSimplify(cm, range) {
  6928. var anchor = range.anchor;
  6929. var head = range.head;
  6930. var anchorLine = getLine(cm.doc, anchor.line);
  6931. if (cmp(anchor, head) == 0 && anchor.sticky == head.sticky) { return range }
  6932. var order = getOrder(anchorLine);
  6933. if (!order) { return range }
  6934. var index = getBidiPartAt(order, anchor.ch, anchor.sticky), part = order[index];
  6935. if (part.from != anchor.ch && part.to != anchor.ch) { return range }
  6936. var boundary = index + ((part.from == anchor.ch) == (part.level != 1) ? 0 : 1);
  6937. if (boundary == 0 || boundary == order.length) { return range }
  6938. // Compute the relative visual position of the head compared to the
  6939. // anchor (<0 is to the left, >0 to the right)
  6940. var leftSide;
  6941. if (head.line != anchor.line) {
  6942. leftSide = (head.line - anchor.line) * (cm.doc.direction == "ltr" ? 1 : -1) > 0;
  6943. } else {
  6944. var headIndex = getBidiPartAt(order, head.ch, head.sticky);
  6945. var dir = headIndex - index || (head.ch - anchor.ch) * (part.level == 1 ? -1 : 1);
  6946. if (headIndex == boundary - 1 || headIndex == boundary)
  6947. { leftSide = dir < 0; }
  6948. else
  6949. { leftSide = dir > 0; }
  6950. }
  6951. var usePart = order[boundary + (leftSide ? -1 : 0)];
  6952. var from = leftSide == (usePart.level == 1);
  6953. var ch = from ? usePart.from : usePart.to, sticky = from ? "after" : "before";
  6954. return anchor.ch == ch && anchor.sticky == sticky ? range : new Range(new Pos(anchor.line, ch, sticky), head)
  6955. }
  6956. // Determines whether an event happened in the gutter, and fires the
  6957. // handlers for the corresponding event.
  6958. function gutterEvent(cm, e, type, prevent) {
  6959. var mX, mY;
  6960. if (e.touches) {
  6961. mX = e.touches[0].clientX;
  6962. mY = e.touches[0].clientY;
  6963. } else {
  6964. try { mX = e.clientX; mY = e.clientY; }
  6965. catch(e$1) { return false }
  6966. }
  6967. if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }
  6968. if (prevent) { e_preventDefault(e); }
  6969. var display = cm.display;
  6970. var lineBox = display.lineDiv.getBoundingClientRect();
  6971. if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }
  6972. mY -= lineBox.top - display.viewOffset;
  6973. for (var i = 0; i < cm.display.gutterSpecs.length; ++i) {
  6974. var g = display.gutters.childNodes[i];
  6975. if (g && g.getBoundingClientRect().right >= mX) {
  6976. var line = lineAtHeight(cm.doc, mY);
  6977. var gutter = cm.display.gutterSpecs[i];
  6978. signal(cm, type, cm, line, gutter.className, e);
  6979. return e_defaultPrevented(e)
  6980. }
  6981. }
  6982. }
  6983. function clickInGutter(cm, e) {
  6984. return gutterEvent(cm, e, "gutterClick", true)
  6985. }
  6986. // CONTEXT MENU HANDLING
  6987. // To make the context menu work, we need to briefly unhide the
  6988. // textarea (making it as unobtrusive as possible) to let the
  6989. // right-click take effect on it.
  6990. function onContextMenu(cm, e) {
  6991. if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return }
  6992. if (signalDOMEvent(cm, e, "contextmenu")) { return }
  6993. if (!captureRightClick) { cm.display.input.onContextMenu(e); }
  6994. }
  6995. function contextMenuInGutter(cm, e) {
  6996. if (!hasHandler(cm, "gutterContextMenu")) { return false }
  6997. return gutterEvent(cm, e, "gutterContextMenu", false)
  6998. }
  6999. function themeChanged(cm) {
  7000. cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") +
  7001. cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-");
  7002. clearCaches(cm);
  7003. }
  7004. var Init = {toString: function(){return "CodeMirror.Init"}};
  7005. var defaults = {};
  7006. var optionHandlers = {};
  7007. function defineOptions(CodeMirror) {
  7008. var optionHandlers = CodeMirror.optionHandlers;
  7009. function option(name, deflt, handle, notOnInit) {
  7010. CodeMirror.defaults[name] = deflt;
  7011. if (handle) { optionHandlers[name] =
  7012. notOnInit ? function (cm, val, old) {if (old != Init) { handle(cm, val, old); }} : handle; }
  7013. }
  7014. CodeMirror.defineOption = option;
  7015. // Passed to option handlers when there is no old value.
  7016. CodeMirror.Init = Init;
  7017. // These two are, on init, called from the constructor because they
  7018. // have to be initialized before the editor can start at all.
  7019. option("value", "", function (cm, val) { return cm.setValue(val); }, true);
  7020. option("mode", null, function (cm, val) {
  7021. cm.doc.modeOption = val;
  7022. loadMode(cm);
  7023. }, true);
  7024. option("indentUnit", 2, loadMode, true);
  7025. option("indentWithTabs", false);
  7026. option("smartIndent", true);
  7027. option("tabSize", 4, function (cm) {
  7028. resetModeState(cm);
  7029. clearCaches(cm);
  7030. regChange(cm);
  7031. }, true);
  7032. option("lineSeparator", null, function (cm, val) {
  7033. cm.doc.lineSep = val;
  7034. if (!val) { return }
  7035. var newBreaks = [], lineNo = cm.doc.first;
  7036. cm.doc.iter(function (line) {
  7037. for (var pos = 0;;) {
  7038. var found = line.text.indexOf(val, pos);
  7039. if (found == -1) { break }
  7040. pos = found + val.length;
  7041. newBreaks.push(Pos(lineNo, found));
  7042. }
  7043. lineNo++;
  7044. });
  7045. for (var i = newBreaks.length - 1; i >= 0; i--)
  7046. { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); }
  7047. });
  7048. option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g, function (cm, val, old) {
  7049. cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g");
  7050. if (old != Init) { cm.refresh(); }
  7051. });
  7052. option("specialCharPlaceholder", defaultSpecialCharPlaceholder, function (cm) { return cm.refresh(); }, true);
  7053. option("electricChars", true);
  7054. option("inputStyle", mobile ? "contenteditable" : "textarea", function () {
  7055. throw new Error("inputStyle can not (yet) be changed in a running editor") // FIXME
  7056. }, true);
  7057. option("spellcheck", false, function (cm, val) { return cm.getInputField().spellcheck = val; }, true);
  7058. option("autocorrect", false, function (cm, val) { return cm.getInputField().autocorrect = val; }, true);
  7059. option("autocapitalize", false, function (cm, val) { return cm.getInputField().autocapitalize = val; }, true);
  7060. option("rtlMoveVisually", !windows);
  7061. option("wholeLineUpdateBefore", true);
  7062. option("theme", "default", function (cm) {
  7063. themeChanged(cm);
  7064. updateGutters(cm);
  7065. }, true);
  7066. option("keyMap", "default", function (cm, val, old) {
  7067. var next = getKeyMap(val);
  7068. var prev = old != Init && getKeyMap(old);
  7069. if (prev && prev.detach) { prev.detach(cm, next); }
  7070. if (next.attach) { next.attach(cm, prev || null); }
  7071. });
  7072. option("extraKeys", null);
  7073. option("configureMouse", null);
  7074. option("lineWrapping", false, wrappingChanged, true);
  7075. option("gutters", [], function (cm, val) {
  7076. cm.display.gutterSpecs = getGutters(val, cm.options.lineNumbers);
  7077. updateGutters(cm);
  7078. }, true);
  7079. option("fixedGutter", true, function (cm, val) {
  7080. cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0";
  7081. cm.refresh();
  7082. }, true);
  7083. option("coverGutterNextToScrollbar", false, function (cm) { return updateScrollbars(cm); }, true);
  7084. option("scrollbarStyle", "native", function (cm) {
  7085. initScrollbars(cm);
  7086. updateScrollbars(cm);
  7087. cm.display.scrollbars.setScrollTop(cm.doc.scrollTop);
  7088. cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft);
  7089. }, true);
  7090. option("lineNumbers", false, function (cm, val) {
  7091. cm.display.gutterSpecs = getGutters(cm.options.gutters, val);
  7092. updateGutters(cm);
  7093. }, true);
  7094. option("firstLineNumber", 1, updateGutters, true);
  7095. option("lineNumberFormatter", function (integer) { return integer; }, updateGutters, true);
  7096. option("showCursorWhenSelecting", false, updateSelection, true);
  7097. option("resetSelectionOnContextMenu", true);
  7098. option("lineWiseCopyCut", true);
  7099. option("pasteLinesPerSelection", true);
  7100. option("selectionsMayTouch", false);
  7101. option("readOnly", false, function (cm, val) {
  7102. if (val == "nocursor") {
  7103. onBlur(cm);
  7104. cm.display.input.blur();
  7105. }
  7106. cm.display.input.readOnlyChanged(val);
  7107. });
  7108. option("screenReaderLabel", null, function (cm, val) {
  7109. val = (val === '') ? null : val;
  7110. cm.display.input.screenReaderLabelChanged(val);
  7111. });
  7112. option("disableInput", false, function (cm, val) {if (!val) { cm.display.input.reset(); }}, true);
  7113. option("dragDrop", true, dragDropChanged);
  7114. option("allowDropFileTypes", null);
  7115. option("cursorBlinkRate", 530);
  7116. option("cursorScrollMargin", 0);
  7117. option("cursorHeight", 1, updateSelection, true);
  7118. option("singleCursorHeightPerLine", true, updateSelection, true);
  7119. option("workTime", 100);
  7120. option("workDelay", 100);
  7121. option("flattenSpans", true, resetModeState, true);
  7122. option("addModeClass", false, resetModeState, true);
  7123. option("pollInterval", 100);
  7124. option("undoDepth", 200, function (cm, val) { return cm.doc.history.undoDepth = val; });
  7125. option("historyEventDelay", 1250);
  7126. option("viewportMargin", 10, function (cm) { return cm.refresh(); }, true);
  7127. option("maxHighlightLength", 10000, resetModeState, true);
  7128. option("moveInputWithCursor", true, function (cm, val) {
  7129. if (!val) { cm.display.input.resetPosition(); }
  7130. });
  7131. option("tabindex", null, function (cm, val) { return cm.display.input.getField().tabIndex = val || ""; });
  7132. option("autofocus", null);
  7133. option("direction", "ltr", function (cm, val) { return cm.doc.setDirection(val); }, true);
  7134. option("phrases", null);
  7135. }
  7136. function dragDropChanged(cm, value, old) {
  7137. var wasOn = old && old != Init;
  7138. if (!value != !wasOn) {
  7139. var funcs = cm.display.dragFunctions;
  7140. var toggle = value ? on : off;
  7141. toggle(cm.display.scroller, "dragstart", funcs.start);
  7142. toggle(cm.display.scroller, "dragenter", funcs.enter);
  7143. toggle(cm.display.scroller, "dragover", funcs.over);
  7144. toggle(cm.display.scroller, "dragleave", funcs.leave);
  7145. toggle(cm.display.scroller, "drop", funcs.drop);
  7146. }
  7147. }
  7148. function wrappingChanged(cm) {
  7149. if (cm.options.lineWrapping) {
  7150. addClass(cm.display.wrapper, "CodeMirror-wrap");
  7151. cm.display.sizer.style.minWidth = "";
  7152. cm.display.sizerWidth = null;
  7153. } else {
  7154. rmClass(cm.display.wrapper, "CodeMirror-wrap");
  7155. findMaxLine(cm);
  7156. }
  7157. estimateLineHeights(cm);
  7158. regChange(cm);
  7159. clearCaches(cm);
  7160. setTimeout(function () { return updateScrollbars(cm); }, 100);
  7161. }
  7162. // A CodeMirror instance represents an editor. This is the object
  7163. // that user code is usually dealing with.
  7164. function CodeMirror(place, options) {
  7165. var this$1 = this;
  7166. if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }
  7167. this.options = options = options ? copyObj(options) : {};
  7168. // Determine effective options based on given values and defaults.
  7169. copyObj(defaults, options, false);
  7170. var doc = options.value;
  7171. if (typeof doc == "string") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }
  7172. else if (options.mode) { doc.modeOption = options.mode; }
  7173. this.doc = doc;
  7174. var input = new CodeMirror.inputStyles[options.inputStyle](this);
  7175. var display = this.display = new Display(place, doc, input, options);
  7176. display.wrapper.CodeMirror = this;
  7177. themeChanged(this);
  7178. if (options.lineWrapping)
  7179. { this.display.wrapper.className += " CodeMirror-wrap"; }
  7180. initScrollbars(this);
  7181. this.state = {
  7182. keyMaps: [], // stores maps added by addKeyMap
  7183. overlays: [], // highlighting overlays, as added by addOverlay
  7184. modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info
  7185. overwrite: false,
  7186. delayingBlurEvent: false,
  7187. focused: false,
  7188. suppressEdits: false, // used to disable editing during key handlers when in readOnly mode
  7189. pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll
  7190. selectingText: false,
  7191. draggingText: false,
  7192. highlight: new Delayed(), // stores highlight worker timeout
  7193. keySeq: null, // Unfinished key sequence
  7194. specialChars: null
  7195. };
  7196. if (options.autofocus && !mobile) { display.input.focus(); }
  7197. // Override magic textarea content restore that IE sometimes does
  7198. // on our hidden textarea on reload
  7199. if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }
  7200. registerEventHandlers(this);
  7201. ensureGlobalHandlers();
  7202. startOperation(this);
  7203. this.curOp.forceUpdate = true;
  7204. attachDoc(this, doc);
  7205. if ((options.autofocus && !mobile) || this.hasFocus())
  7206. { setTimeout(function () {
  7207. if (this$1.hasFocus() && !this$1.state.focused) { onFocus(this$1); }
  7208. }, 20); }
  7209. else
  7210. { onBlur(this); }
  7211. for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))
  7212. { optionHandlers[opt](this, options[opt], Init); } }
  7213. maybeUpdateLineNumberWidth(this);
  7214. if (options.finishInit) { options.finishInit(this); }
  7215. for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); }
  7216. endOperation(this);
  7217. // Suppress optimizelegibility in Webkit, since it breaks text
  7218. // measuring on line wrapping boundaries.
  7219. if (webkit && options.lineWrapping &&
  7220. getComputedStyle(display.lineDiv).textRendering == "optimizelegibility")
  7221. { display.lineDiv.style.textRendering = "auto"; }
  7222. }
  7223. // The default configuration options.
  7224. CodeMirror.defaults = defaults;
  7225. // Functions to run when options are changed.
  7226. CodeMirror.optionHandlers = optionHandlers;
  7227. // Attach the necessary event handlers when initializing the editor
  7228. function registerEventHandlers(cm) {
  7229. var d = cm.display;
  7230. on(d.scroller, "mousedown", operation(cm, onMouseDown));
  7231. // Older IE's will not fire a second mousedown for a double click
  7232. if (ie && ie_version < 11)
  7233. { on(d.scroller, "dblclick", operation(cm, function (e) {
  7234. if (signalDOMEvent(cm, e)) { return }
  7235. var pos = posFromMouse(cm, e);
  7236. if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) { return }
  7237. e_preventDefault(e);
  7238. var word = cm.findWordAt(pos);
  7239. extendSelection(cm.doc, word.anchor, word.head);
  7240. })); }
  7241. else
  7242. { on(d.scroller, "dblclick", function (e) { return signalDOMEvent(cm, e) || e_preventDefault(e); }); }
  7243. // Some browsers fire contextmenu *after* opening the menu, at
  7244. // which point we can't mess with it anymore. Context menu is
  7245. // handled in onMouseDown for these browsers.
  7246. on(d.scroller, "contextmenu", function (e) { return onContextMenu(cm, e); });
  7247. on(d.input.getField(), "contextmenu", function (e) {
  7248. if (!d.scroller.contains(e.target)) { onContextMenu(cm, e); }
  7249. });
  7250. // Used to suppress mouse event handling when a touch happens
  7251. var touchFinished, prevTouch = {end: 0};
  7252. function finishTouch() {
  7253. if (d.activeTouch) {
  7254. touchFinished = setTimeout(function () { return d.activeTouch = null; }, 1000);
  7255. prevTouch = d.activeTouch;
  7256. prevTouch.end = +new Date;
  7257. }
  7258. }
  7259. function isMouseLikeTouchEvent(e) {
  7260. if (e.touches.length != 1) { return false }
  7261. var touch = e.touches[0];
  7262. return touch.radiusX <= 1 && touch.radiusY <= 1
  7263. }
  7264. function farAway(touch, other) {
  7265. if (other.left == null) { return true }
  7266. var dx = other.left - touch.left, dy = other.top - touch.top;
  7267. return dx * dx + dy * dy > 20 * 20
  7268. }
  7269. on(d.scroller, "touchstart", function (e) {
  7270. if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e) && !clickInGutter(cm, e)) {
  7271. d.input.ensurePolled();
  7272. clearTimeout(touchFinished);
  7273. var now = +new Date;
  7274. d.activeTouch = {start: now, moved: false,
  7275. prev: now - prevTouch.end <= 300 ? prevTouch : null};
  7276. if (e.touches.length == 1) {
  7277. d.activeTouch.left = e.touches[0].pageX;
  7278. d.activeTouch.top = e.touches[0].pageY;
  7279. }
  7280. }
  7281. });
  7282. on(d.scroller, "touchmove", function () {
  7283. if (d.activeTouch) { d.activeTouch.moved = true; }
  7284. });
  7285. on(d.scroller, "touchend", function (e) {
  7286. var touch = d.activeTouch;
  7287. if (touch && !eventInWidget(d, e) && touch.left != null &&
  7288. !touch.moved && new Date - touch.start < 300) {
  7289. var pos = cm.coordsChar(d.activeTouch, "page"), range;
  7290. if (!touch.prev || farAway(touch, touch.prev)) // Single tap
  7291. { range = new Range(pos, pos); }
  7292. else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap
  7293. { range = cm.findWordAt(pos); }
  7294. else // Triple tap
  7295. { range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))); }
  7296. cm.setSelection(range.anchor, range.head);
  7297. cm.focus();
  7298. e_preventDefault(e);
  7299. }
  7300. finishTouch();
  7301. });
  7302. on(d.scroller, "touchcancel", finishTouch);
  7303. // Sync scrolling between fake scrollbars and real scrollable
  7304. // area, ensure viewport is updated when scrolling.
  7305. on(d.scroller, "scroll", function () {
  7306. if (d.scroller.clientHeight) {
  7307. updateScrollTop(cm, d.scroller.scrollTop);
  7308. setScrollLeft(cm, d.scroller.scrollLeft, true);
  7309. signal(cm, "scroll", cm);
  7310. }
  7311. });
  7312. // Listen to wheel events in order to try and update the viewport on time.
  7313. on(d.scroller, "mousewheel", function (e) { return onScrollWheel(cm, e); });
  7314. on(d.scroller, "DOMMouseScroll", function (e) { return onScrollWheel(cm, e); });
  7315. // Prevent wrapper from ever scrolling
  7316. on(d.wrapper, "scroll", function () { return d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });
  7317. d.dragFunctions = {
  7318. enter: function (e) {if (!signalDOMEvent(cm, e)) { e_stop(e); }},
  7319. over: function (e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }},
  7320. start: function (e) { return onDragStart(cm, e); },
  7321. drop: operation(cm, onDrop),
  7322. leave: function (e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }}
  7323. };
  7324. var inp = d.input.getField();
  7325. on(inp, "keyup", function (e) { return onKeyUp.call(cm, e); });
  7326. on(inp, "keydown", operation(cm, onKeyDown));
  7327. on(inp, "keypress", operation(cm, onKeyPress));
  7328. on(inp, "focus", function (e) { return onFocus(cm, e); });
  7329. on(inp, "blur", function (e) { return onBlur(cm, e); });
  7330. }
  7331. var initHooks = [];
  7332. CodeMirror.defineInitHook = function (f) { return initHooks.push(f); };
  7333. // Indent the given line. The how parameter can be "smart",
  7334. // "add"/null, "subtract", or "prev". When aggressive is false
  7335. // (typically set to true for forced single-line indents), empty
  7336. // lines are not indented, and places where the mode returns Pass
  7337. // are left alone.
  7338. function indentLine(cm, n, how, aggressive) {
  7339. var doc = cm.doc, state;
  7340. if (how == null) { how = "add"; }
  7341. if (how == "smart") {
  7342. // Fall back to "prev" when the mode doesn't have an indentation
  7343. // method.
  7344. if (!doc.mode.indent) { how = "prev"; }
  7345. else { state = getContextBefore(cm, n).state; }
  7346. }
  7347. var tabSize = cm.options.tabSize;
  7348. var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);
  7349. if (line.stateAfter) { line.stateAfter = null; }
  7350. var curSpaceString = line.text.match(/^\s*/)[0], indentation;
  7351. if (!aggressive && !/\S/.test(line.text)) {
  7352. indentation = 0;
  7353. how = "not";
  7354. } else if (how == "smart") {
  7355. indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);
  7356. if (indentation == Pass || indentation > 150) {
  7357. if (!aggressive) { return }
  7358. how = "prev";
  7359. }
  7360. }
  7361. if (how == "prev") {
  7362. if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }
  7363. else { indentation = 0; }
  7364. } else if (how == "add") {
  7365. indentation = curSpace + cm.options.indentUnit;
  7366. } else if (how == "subtract") {
  7367. indentation = curSpace - cm.options.indentUnit;
  7368. } else if (typeof how == "number") {
  7369. indentation = curSpace + how;
  7370. }
  7371. indentation = Math.max(0, indentation);
  7372. var indentString = "", pos = 0;
  7373. if (cm.options.indentWithTabs)
  7374. { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";} }
  7375. if (pos < indentation) { indentString += spaceStr(indentation - pos); }
  7376. if (indentString != curSpaceString) {
  7377. replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input");
  7378. line.stateAfter = null;
  7379. return true
  7380. } else {
  7381. // Ensure that, if the cursor was in the whitespace at the start
  7382. // of the line, it is moved to the end of that space.
  7383. for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {
  7384. var range = doc.sel.ranges[i$1];
  7385. if (range.head.line == n && range.head.ch < curSpaceString.length) {
  7386. var pos$1 = Pos(n, curSpaceString.length);
  7387. replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));
  7388. break
  7389. }
  7390. }
  7391. }
  7392. }
  7393. // This will be set to a {lineWise: bool, text: [string]} object, so
  7394. // that, when pasting, we know what kind of selections the copied
  7395. // text was made out of.
  7396. var lastCopied = null;
  7397. function setLastCopied(newLastCopied) {
  7398. lastCopied = newLastCopied;
  7399. }
  7400. function applyTextInput(cm, inserted, deleted, sel, origin) {
  7401. var doc = cm.doc;
  7402. cm.display.shift = false;
  7403. if (!sel) { sel = doc.sel; }
  7404. var recent = +new Date - 200;
  7405. var paste = origin == "paste" || cm.state.pasteIncoming > recent;
  7406. var textLines = splitLinesAuto(inserted), multiPaste = null;
  7407. // When pasting N lines into N selections, insert one line per selection
  7408. if (paste && sel.ranges.length > 1) {
  7409. if (lastCopied && lastCopied.text.join("\n") == inserted) {
  7410. if (sel.ranges.length % lastCopied.text.length == 0) {
  7411. multiPaste = [];
  7412. for (var i = 0; i < lastCopied.text.length; i++)
  7413. { multiPaste.push(doc.splitLines(lastCopied.text[i])); }
  7414. }
  7415. } else if (textLines.length == sel.ranges.length && cm.options.pasteLinesPerSelection) {
  7416. multiPaste = map(textLines, function (l) { return [l]; });
  7417. }
  7418. }
  7419. var updateInput = cm.curOp.updateInput;
  7420. // Normal behavior is to insert the new text into every selection
  7421. for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) {
  7422. var range = sel.ranges[i$1];
  7423. var from = range.from(), to = range.to();
  7424. if (range.empty()) {
  7425. if (deleted && deleted > 0) // Handle deletion
  7426. { from = Pos(from.line, from.ch - deleted); }
  7427. else if (cm.state.overwrite && !paste) // Handle overwrite
  7428. { to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)); }
  7429. else if (paste && lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == textLines.join("\n"))
  7430. { from = to = Pos(from.line, 0); }
  7431. }
  7432. var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines,
  7433. origin: origin || (paste ? "paste" : cm.state.cutIncoming > recent ? "cut" : "+input")};
  7434. makeChange(cm.doc, changeEvent);
  7435. signalLater(cm, "inputRead", cm, changeEvent);
  7436. }
  7437. if (inserted && !paste)
  7438. { triggerElectric(cm, inserted); }
  7439. ensureCursorVisible(cm);
  7440. if (cm.curOp.updateInput < 2) { cm.curOp.updateInput = updateInput; }
  7441. cm.curOp.typing = true;
  7442. cm.state.pasteIncoming = cm.state.cutIncoming = -1;
  7443. }
  7444. function handlePaste(e, cm) {
  7445. var pasted = e.clipboardData && e.clipboardData.getData("Text");
  7446. if (pasted) {
  7447. e.preventDefault();
  7448. if (!cm.isReadOnly() && !cm.options.disableInput)
  7449. { runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, "paste"); }); }
  7450. return true
  7451. }
  7452. }
  7453. function triggerElectric(cm, inserted) {
  7454. // When an 'electric' character is inserted, immediately trigger a reindent
  7455. if (!cm.options.electricChars || !cm.options.smartIndent) { return }
  7456. var sel = cm.doc.sel;
  7457. for (var i = sel.ranges.length - 1; i >= 0; i--) {
  7458. var range = sel.ranges[i];
  7459. if (range.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range.head.line)) { continue }
  7460. var mode = cm.getModeAt(range.head);
  7461. var indented = false;
  7462. if (mode.electricChars) {
  7463. for (var j = 0; j < mode.electricChars.length; j++)
  7464. { if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {
  7465. indented = indentLine(cm, range.head.line, "smart");
  7466. break
  7467. } }
  7468. } else if (mode.electricInput) {
  7469. if (mode.electricInput.test(getLine(cm.doc, range.head.line).text.slice(0, range.head.ch)))
  7470. { indented = indentLine(cm, range.head.line, "smart"); }
  7471. }
  7472. if (indented) { signalLater(cm, "electricInput", cm, range.head.line); }
  7473. }
  7474. }
  7475. function copyableRanges(cm) {
  7476. var text = [], ranges = [];
  7477. for (var i = 0; i < cm.doc.sel.ranges.length; i++) {
  7478. var line = cm.doc.sel.ranges[i].head.line;
  7479. var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};
  7480. ranges.push(lineRange);
  7481. text.push(cm.getRange(lineRange.anchor, lineRange.head));
  7482. }
  7483. return {text: text, ranges: ranges}
  7484. }
  7485. function disableBrowserMagic(field, spellcheck, autocorrect, autocapitalize) {
  7486. field.setAttribute("autocorrect", autocorrect ? "" : "off");
  7487. field.setAttribute("autocapitalize", autocapitalize ? "" : "off");
  7488. field.setAttribute("spellcheck", !!spellcheck);
  7489. }
  7490. function hiddenTextarea() {
  7491. var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none");
  7492. var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;");
  7493. // The textarea is kept positioned near the cursor to prevent the
  7494. // fact that it'll be scrolled into view on input from scrolling
  7495. // our fake cursor out of view. On webkit, when wrap=off, paste is
  7496. // very slow. So make the area wide instead.
  7497. if (webkit) { te.style.width = "1000px"; }
  7498. else { te.setAttribute("wrap", "off"); }
  7499. // If border: 0; -- iOS fails to open keyboard (issue #1287)
  7500. if (ios) { te.style.border = "1px solid black"; }
  7501. disableBrowserMagic(te);
  7502. return div
  7503. }
  7504. // The publicly visible API. Note that methodOp(f) means
  7505. // 'wrap f in an operation, performed on its `this` parameter'.
  7506. // This is not the complete set of editor methods. Most of the
  7507. // methods defined on the Doc type are also injected into
  7508. // CodeMirror.prototype, for backwards compatibility and
  7509. // convenience.
  7510. function addEditorMethods(CodeMirror) {
  7511. var optionHandlers = CodeMirror.optionHandlers;
  7512. var helpers = CodeMirror.helpers = {};
  7513. CodeMirror.prototype = {
  7514. constructor: CodeMirror,
  7515. focus: function(){window.focus(); this.display.input.focus();},
  7516. setOption: function(option, value) {
  7517. var options = this.options, old = options[option];
  7518. if (options[option] == value && option != "mode") { return }
  7519. options[option] = value;
  7520. if (optionHandlers.hasOwnProperty(option))
  7521. { operation(this, optionHandlers[option])(this, value, old); }
  7522. signal(this, "optionChange", this, option);
  7523. },
  7524. getOption: function(option) {return this.options[option]},
  7525. getDoc: function() {return this.doc},
  7526. addKeyMap: function(map, bottom) {
  7527. this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map));
  7528. },
  7529. removeKeyMap: function(map) {
  7530. var maps = this.state.keyMaps;
  7531. for (var i = 0; i < maps.length; ++i)
  7532. { if (maps[i] == map || maps[i].name == map) {
  7533. maps.splice(i, 1);
  7534. return true
  7535. } }
  7536. },
  7537. addOverlay: methodOp(function(spec, options) {
  7538. var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);
  7539. if (mode.startState) { throw new Error("Overlays may not be stateful.") }
  7540. insertSorted(this.state.overlays,
  7541. {mode: mode, modeSpec: spec, opaque: options && options.opaque,
  7542. priority: (options && options.priority) || 0},
  7543. function (overlay) { return overlay.priority; });
  7544. this.state.modeGen++;
  7545. regChange(this);
  7546. }),
  7547. removeOverlay: methodOp(function(spec) {
  7548. var overlays = this.state.overlays;
  7549. for (var i = 0; i < overlays.length; ++i) {
  7550. var cur = overlays[i].modeSpec;
  7551. if (cur == spec || typeof spec == "string" && cur.name == spec) {
  7552. overlays.splice(i, 1);
  7553. this.state.modeGen++;
  7554. regChange(this);
  7555. return
  7556. }
  7557. }
  7558. }),
  7559. indentLine: methodOp(function(n, dir, aggressive) {
  7560. if (typeof dir != "string" && typeof dir != "number") {
  7561. if (dir == null) { dir = this.options.smartIndent ? "smart" : "prev"; }
  7562. else { dir = dir ? "add" : "subtract"; }
  7563. }
  7564. if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }
  7565. }),
  7566. indentSelection: methodOp(function(how) {
  7567. var ranges = this.doc.sel.ranges, end = -1;
  7568. for (var i = 0; i < ranges.length; i++) {
  7569. var range = ranges[i];
  7570. if (!range.empty()) {
  7571. var from = range.from(), to = range.to();
  7572. var start = Math.max(end, from.line);
  7573. end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;
  7574. for (var j = start; j < end; ++j)
  7575. { indentLine(this, j, how); }
  7576. var newRanges = this.doc.sel.ranges;
  7577. if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)
  7578. { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }
  7579. } else if (range.head.line > end) {
  7580. indentLine(this, range.head.line, how, true);
  7581. end = range.head.line;
  7582. if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); }
  7583. }
  7584. }
  7585. }),
  7586. // Fetch the parser token for a given character. Useful for hacks
  7587. // that want to inspect the mode state (say, for completion).
  7588. getTokenAt: function(pos, precise) {
  7589. return takeToken(this, pos, precise)
  7590. },
  7591. getLineTokens: function(line, precise) {
  7592. return takeToken(this, Pos(line), precise, true)
  7593. },
  7594. getTokenTypeAt: function(pos) {
  7595. pos = clipPos(this.doc, pos);
  7596. var styles = getLineStyles(this, getLine(this.doc, pos.line));
  7597. var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;
  7598. var type;
  7599. if (ch == 0) { type = styles[2]; }
  7600. else { for (;;) {
  7601. var mid = (before + after) >> 1;
  7602. if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }
  7603. else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }
  7604. else { type = styles[mid * 2 + 2]; break }
  7605. } }
  7606. var cut = type ? type.indexOf("overlay ") : -1;
  7607. return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)
  7608. },
  7609. getModeAt: function(pos) {
  7610. var mode = this.doc.mode;
  7611. if (!mode.innerMode) { return mode }
  7612. return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode
  7613. },
  7614. getHelper: function(pos, type) {
  7615. return this.getHelpers(pos, type)[0]
  7616. },
  7617. getHelpers: function(pos, type) {
  7618. var found = [];
  7619. if (!helpers.hasOwnProperty(type)) { return found }
  7620. var help = helpers[type], mode = this.getModeAt(pos);
  7621. if (typeof mode[type] == "string") {
  7622. if (help[mode[type]]) { found.push(help[mode[type]]); }
  7623. } else if (mode[type]) {
  7624. for (var i = 0; i < mode[type].length; i++) {
  7625. var val = help[mode[type][i]];
  7626. if (val) { found.push(val); }
  7627. }
  7628. } else if (mode.helperType && help[mode.helperType]) {
  7629. found.push(help[mode.helperType]);
  7630. } else if (help[mode.name]) {
  7631. found.push(help[mode.name]);
  7632. }
  7633. for (var i$1 = 0; i$1 < help._global.length; i$1++) {
  7634. var cur = help._global[i$1];
  7635. if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)
  7636. { found.push(cur.val); }
  7637. }
  7638. return found
  7639. },
  7640. getStateAfter: function(line, precise) {
  7641. var doc = this.doc;
  7642. line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);
  7643. return getContextBefore(this, line + 1, precise).state
  7644. },
  7645. cursorCoords: function(start, mode) {
  7646. var pos, range = this.doc.sel.primary();
  7647. if (start == null) { pos = range.head; }
  7648. else if (typeof start == "object") { pos = clipPos(this.doc, start); }
  7649. else { pos = start ? range.from() : range.to(); }
  7650. return cursorCoords(this, pos, mode || "page")
  7651. },
  7652. charCoords: function(pos, mode) {
  7653. return charCoords(this, clipPos(this.doc, pos), mode || "page")
  7654. },
  7655. coordsChar: function(coords, mode) {
  7656. coords = fromCoordSystem(this, coords, mode || "page");
  7657. return coordsChar(this, coords.left, coords.top)
  7658. },
  7659. lineAtHeight: function(height, mode) {
  7660. height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top;
  7661. return lineAtHeight(this.doc, height + this.display.viewOffset)
  7662. },
  7663. heightAtLine: function(line, mode, includeWidgets) {
  7664. var end = false, lineObj;
  7665. if (typeof line == "number") {
  7666. var last = this.doc.first + this.doc.size - 1;
  7667. if (line < this.doc.first) { line = this.doc.first; }
  7668. else if (line > last) { line = last; end = true; }
  7669. lineObj = getLine(this.doc, line);
  7670. } else {
  7671. lineObj = line;
  7672. }
  7673. return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page", includeWidgets || end).top +
  7674. (end ? this.doc.height - heightAtLine(lineObj) : 0)
  7675. },
  7676. defaultTextHeight: function() { return textHeight(this.display) },
  7677. defaultCharWidth: function() { return charWidth(this.display) },
  7678. getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},
  7679. addWidget: function(pos, node, scroll, vert, horiz) {
  7680. var display = this.display;
  7681. pos = cursorCoords(this, clipPos(this.doc, pos));
  7682. var top = pos.bottom, left = pos.left;
  7683. node.style.position = "absolute";
  7684. node.setAttribute("cm-ignore-events", "true");
  7685. this.display.input.setUneditable(node);
  7686. display.sizer.appendChild(node);
  7687. if (vert == "over") {
  7688. top = pos.top;
  7689. } else if (vert == "above" || vert == "near") {
  7690. var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),
  7691. hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);
  7692. // Default to positioning above (if specified and possible); otherwise default to positioning below
  7693. if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)
  7694. { top = pos.top - node.offsetHeight; }
  7695. else if (pos.bottom + node.offsetHeight <= vspace)
  7696. { top = pos.bottom; }
  7697. if (left + node.offsetWidth > hspace)
  7698. { left = hspace - node.offsetWidth; }
  7699. }
  7700. node.style.top = top + "px";
  7701. node.style.left = node.style.right = "";
  7702. if (horiz == "right") {
  7703. left = display.sizer.clientWidth - node.offsetWidth;
  7704. node.style.right = "0px";
  7705. } else {
  7706. if (horiz == "left") { left = 0; }
  7707. else if (horiz == "middle") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }
  7708. node.style.left = left + "px";
  7709. }
  7710. if (scroll)
  7711. { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }
  7712. },
  7713. triggerOnKeyDown: methodOp(onKeyDown),
  7714. triggerOnKeyPress: methodOp(onKeyPress),
  7715. triggerOnKeyUp: onKeyUp,
  7716. triggerOnMouseDown: methodOp(onMouseDown),
  7717. execCommand: function(cmd) {
  7718. if (commands.hasOwnProperty(cmd))
  7719. { return commands[cmd].call(null, this) }
  7720. },
  7721. triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),
  7722. findPosH: function(from, amount, unit, visually) {
  7723. var dir = 1;
  7724. if (amount < 0) { dir = -1; amount = -amount; }
  7725. var cur = clipPos(this.doc, from);
  7726. for (var i = 0; i < amount; ++i) {
  7727. cur = findPosH(this.doc, cur, dir, unit, visually);
  7728. if (cur.hitSide) { break }
  7729. }
  7730. return cur
  7731. },
  7732. moveH: methodOp(function(dir, unit) {
  7733. var this$1 = this;
  7734. this.extendSelectionsBy(function (range) {
  7735. if (this$1.display.shift || this$1.doc.extend || range.empty())
  7736. { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }
  7737. else
  7738. { return dir < 0 ? range.from() : range.to() }
  7739. }, sel_move);
  7740. }),
  7741. deleteH: methodOp(function(dir, unit) {
  7742. var sel = this.doc.sel, doc = this.doc;
  7743. if (sel.somethingSelected())
  7744. { doc.replaceSelection("", null, "+delete"); }
  7745. else
  7746. { deleteNearSelection(this, function (range) {
  7747. var other = findPosH(doc, range.head, dir, unit, false);
  7748. return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}
  7749. }); }
  7750. }),
  7751. findPosV: function(from, amount, unit, goalColumn) {
  7752. var dir = 1, x = goalColumn;
  7753. if (amount < 0) { dir = -1; amount = -amount; }
  7754. var cur = clipPos(this.doc, from);
  7755. for (var i = 0; i < amount; ++i) {
  7756. var coords = cursorCoords(this, cur, "div");
  7757. if (x == null) { x = coords.left; }
  7758. else { coords.left = x; }
  7759. cur = findPosV(this, coords, dir, unit);
  7760. if (cur.hitSide) { break }
  7761. }
  7762. return cur
  7763. },
  7764. moveV: methodOp(function(dir, unit) {
  7765. var this$1 = this;
  7766. var doc = this.doc, goals = [];
  7767. var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();
  7768. doc.extendSelectionsBy(function (range) {
  7769. if (collapse)
  7770. { return dir < 0 ? range.from() : range.to() }
  7771. var headPos = cursorCoords(this$1, range.head, "div");
  7772. if (range.goalColumn != null) { headPos.left = range.goalColumn; }
  7773. goals.push(headPos.left);
  7774. var pos = findPosV(this$1, headPos, dir, unit);
  7775. if (unit == "page" && range == doc.sel.primary())
  7776. { addToScrollTop(this$1, charCoords(this$1, pos, "div").top - headPos.top); }
  7777. return pos
  7778. }, sel_move);
  7779. if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)
  7780. { doc.sel.ranges[i].goalColumn = goals[i]; } }
  7781. }),
  7782. // Find the word at the given position (as returned by coordsChar).
  7783. findWordAt: function(pos) {
  7784. var doc = this.doc, line = getLine(doc, pos.line).text;
  7785. var start = pos.ch, end = pos.ch;
  7786. if (line) {
  7787. var helper = this.getHelper(pos, "wordChars");
  7788. if ((pos.sticky == "before" || end == line.length) && start) { --start; } else { ++end; }
  7789. var startChar = line.charAt(start);
  7790. var check = isWordChar(startChar, helper)
  7791. ? function (ch) { return isWordChar(ch, helper); }
  7792. : /\s/.test(startChar) ? function (ch) { return /\s/.test(ch); }
  7793. : function (ch) { return (!/\s/.test(ch) && !isWordChar(ch)); };
  7794. while (start > 0 && check(line.charAt(start - 1))) { --start; }
  7795. while (end < line.length && check(line.charAt(end))) { ++end; }
  7796. }
  7797. return new Range(Pos(pos.line, start), Pos(pos.line, end))
  7798. },
  7799. toggleOverwrite: function(value) {
  7800. if (value != null && value == this.state.overwrite) { return }
  7801. if (this.state.overwrite = !this.state.overwrite)
  7802. { addClass(this.display.cursorDiv, "CodeMirror-overwrite"); }
  7803. else
  7804. { rmClass(this.display.cursorDiv, "CodeMirror-overwrite"); }
  7805. signal(this, "overwriteToggle", this, this.state.overwrite);
  7806. },
  7807. hasFocus: function() { return this.display.input.getField() == activeElt() },
  7808. isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },
  7809. scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),
  7810. getScrollInfo: function() {
  7811. var scroller = this.display.scroller;
  7812. return {left: scroller.scrollLeft, top: scroller.scrollTop,
  7813. height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,
  7814. width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,
  7815. clientHeight: displayHeight(this), clientWidth: displayWidth(this)}
  7816. },
  7817. scrollIntoView: methodOp(function(range, margin) {
  7818. if (range == null) {
  7819. range = {from: this.doc.sel.primary().head, to: null};
  7820. if (margin == null) { margin = this.options.cursorScrollMargin; }
  7821. } else if (typeof range == "number") {
  7822. range = {from: Pos(range, 0), to: null};
  7823. } else if (range.from == null) {
  7824. range = {from: range, to: null};
  7825. }
  7826. if (!range.to) { range.to = range.from; }
  7827. range.margin = margin || 0;
  7828. if (range.from.line != null) {
  7829. scrollToRange(this, range);
  7830. } else {
  7831. scrollToCoordsRange(this, range.from, range.to, range.margin);
  7832. }
  7833. }),
  7834. setSize: methodOp(function(width, height) {
  7835. var this$1 = this;
  7836. var interpret = function (val) { return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val; };
  7837. if (width != null) { this.display.wrapper.style.width = interpret(width); }
  7838. if (height != null) { this.display.wrapper.style.height = interpret(height); }
  7839. if (this.options.lineWrapping) { clearLineMeasurementCache(this); }
  7840. var lineNo = this.display.viewFrom;
  7841. this.doc.iter(lineNo, this.display.viewTo, function (line) {
  7842. if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)
  7843. { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, "widget"); break } } }
  7844. ++lineNo;
  7845. });
  7846. this.curOp.forceUpdate = true;
  7847. signal(this, "refresh", this);
  7848. }),
  7849. operation: function(f){return runInOp(this, f)},
  7850. startOperation: function(){return startOperation(this)},
  7851. endOperation: function(){return endOperation(this)},
  7852. refresh: methodOp(function() {
  7853. var oldHeight = this.display.cachedTextHeight;
  7854. regChange(this);
  7855. this.curOp.forceUpdate = true;
  7856. clearCaches(this);
  7857. scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);
  7858. updateGutterSpace(this.display);
  7859. if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping)
  7860. { estimateLineHeights(this); }
  7861. signal(this, "refresh", this);
  7862. }),
  7863. swapDoc: methodOp(function(doc) {
  7864. var old = this.doc;
  7865. old.cm = null;
  7866. // Cancel the current text selection if any (#5821)
  7867. if (this.state.selectingText) { this.state.selectingText(); }
  7868. attachDoc(this, doc);
  7869. clearCaches(this);
  7870. this.display.input.reset();
  7871. scrollToCoords(this, doc.scrollLeft, doc.scrollTop);
  7872. this.curOp.forceScroll = true;
  7873. signalLater(this, "swapDoc", this, old);
  7874. return old
  7875. }),
  7876. phrase: function(phraseText) {
  7877. var phrases = this.options.phrases;
  7878. return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText
  7879. },
  7880. getInputField: function(){return this.display.input.getField()},
  7881. getWrapperElement: function(){return this.display.wrapper},
  7882. getScrollerElement: function(){return this.display.scroller},
  7883. getGutterElement: function(){return this.display.gutters}
  7884. };
  7885. eventMixin(CodeMirror);
  7886. CodeMirror.registerHelper = function(type, name, value) {
  7887. if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }
  7888. helpers[type][name] = value;
  7889. };
  7890. CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {
  7891. CodeMirror.registerHelper(type, name, value);
  7892. helpers[type]._global.push({pred: predicate, val: value});
  7893. };
  7894. }
  7895. // Used for horizontal relative motion. Dir is -1 or 1 (left or
  7896. // right), unit can be "codepoint", "char", "column" (like char, but
  7897. // doesn't cross line boundaries), "word" (across next word), or
  7898. // "group" (to the start of next group of word or
  7899. // non-word-non-whitespace chars). The visually param controls
  7900. // whether, in right-to-left text, direction 1 means to move towards
  7901. // the next index in the string, or towards the character to the right
  7902. // of the current position. The resulting position will have a
  7903. // hitSide=true property if it reached the end of the document.
  7904. function findPosH(doc, pos, dir, unit, visually) {
  7905. var oldPos = pos;
  7906. var origDir = dir;
  7907. var lineObj = getLine(doc, pos.line);
  7908. var lineDir = visually && doc.direction == "rtl" ? -dir : dir;
  7909. function findNextLine() {
  7910. var l = pos.line + lineDir;
  7911. if (l < doc.first || l >= doc.first + doc.size) { return false }
  7912. pos = new Pos(l, pos.ch, pos.sticky);
  7913. return lineObj = getLine(doc, l)
  7914. }
  7915. function moveOnce(boundToLine) {
  7916. var next;
  7917. if (unit == "codepoint") {
  7918. var ch = lineObj.text.charCodeAt(pos.ch + (unit > 0 ? 0 : -1));
  7919. if (isNaN(ch)) { next = null; }
  7920. else { next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (ch >= 0xD800 && ch < 0xDC00 ? 2 : 1))),
  7921. -dir); }
  7922. } else if (visually) {
  7923. next = moveVisually(doc.cm, lineObj, pos, dir);
  7924. } else {
  7925. next = moveLogically(lineObj, pos, dir);
  7926. }
  7927. if (next == null) {
  7928. if (!boundToLine && findNextLine())
  7929. { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); }
  7930. else
  7931. { return false }
  7932. } else {
  7933. pos = next;
  7934. }
  7935. return true
  7936. }
  7937. if (unit == "char" || unit == "codepoint") {
  7938. moveOnce();
  7939. } else if (unit == "column") {
  7940. moveOnce(true);
  7941. } else if (unit == "word" || unit == "group") {
  7942. var sawType = null, group = unit == "group";
  7943. var helper = doc.cm && doc.cm.getHelper(pos, "wordChars");
  7944. for (var first = true;; first = false) {
  7945. if (dir < 0 && !moveOnce(!first)) { break }
  7946. var cur = lineObj.text.charAt(pos.ch) || "\n";
  7947. var type = isWordChar(cur, helper) ? "w"
  7948. : group && cur == "\n" ? "n"
  7949. : !group || /\s/.test(cur) ? null
  7950. : "p";
  7951. if (group && !first && !type) { type = "s"; }
  7952. if (sawType && sawType != type) {
  7953. if (dir < 0) {dir = 1; moveOnce(); pos.sticky = "after";}
  7954. break
  7955. }
  7956. if (type) { sawType = type; }
  7957. if (dir > 0 && !moveOnce(!first)) { break }
  7958. }
  7959. }
  7960. var result = skipAtomic(doc, pos, oldPos, origDir, true);
  7961. if (equalCursorPos(oldPos, result)) { result.hitSide = true; }
  7962. return result
  7963. }
  7964. // For relative vertical movement. Dir may be -1 or 1. Unit can be
  7965. // "page" or "line". The resulting position will have a hitSide=true
  7966. // property if it reached the end of the document.
  7967. function findPosV(cm, pos, dir, unit) {
  7968. var doc = cm.doc, x = pos.left, y;
  7969. if (unit == "page") {
  7970. var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);
  7971. var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);
  7972. y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;
  7973. } else if (unit == "line") {
  7974. y = dir > 0 ? pos.bottom + 3 : pos.top - 3;
  7975. }
  7976. var target;
  7977. for (;;) {
  7978. target = coordsChar(cm, x, y);
  7979. if (!target.outside) { break }
  7980. if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }
  7981. y += dir * 5;
  7982. }
  7983. return target
  7984. }
  7985. // CONTENTEDITABLE INPUT STYLE
  7986. var ContentEditableInput = function(cm) {
  7987. this.cm = cm;
  7988. this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null;
  7989. this.polling = new Delayed();
  7990. this.composing = null;
  7991. this.gracePeriod = false;
  7992. this.readDOMTimeout = null;
  7993. };
  7994. ContentEditableInput.prototype.init = function (display) {
  7995. var this$1 = this;
  7996. var input = this, cm = input.cm;
  7997. var div = input.div = display.lineDiv;
  7998. disableBrowserMagic(div, cm.options.spellcheck, cm.options.autocorrect, cm.options.autocapitalize);
  7999. function belongsToInput(e) {
  8000. for (var t = e.target; t; t = t.parentNode) {
  8001. if (t == div) { return true }
  8002. if (/\bCodeMirror-(?:line)?widget\b/.test(t.className)) { break }
  8003. }
  8004. return false
  8005. }
  8006. on(div, "paste", function (e) {
  8007. if (!belongsToInput(e) || signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
  8008. // IE doesn't fire input events, so we schedule a read for the pasted content in this way
  8009. if (ie_version <= 11) { setTimeout(operation(cm, function () { return this$1.updateFromDOM(); }), 20); }
  8010. });
  8011. on(div, "compositionstart", function (e) {
  8012. this$1.composing = {data: e.data, done: false};
  8013. });
  8014. on(div, "compositionupdate", function (e) {
  8015. if (!this$1.composing) { this$1.composing = {data: e.data, done: false}; }
  8016. });
  8017. on(div, "compositionend", function (e) {
  8018. if (this$1.composing) {
  8019. if (e.data != this$1.composing.data) { this$1.readFromDOMSoon(); }
  8020. this$1.composing.done = true;
  8021. }
  8022. });
  8023. on(div, "touchstart", function () { return input.forceCompositionEnd(); });
  8024. on(div, "input", function () {
  8025. if (!this$1.composing) { this$1.readFromDOMSoon(); }
  8026. });
  8027. function onCopyCut(e) {
  8028. if (!belongsToInput(e) || signalDOMEvent(cm, e)) { return }
  8029. if (cm.somethingSelected()) {
  8030. setLastCopied({lineWise: false, text: cm.getSelections()});
  8031. if (e.type == "cut") { cm.replaceSelection("", null, "cut"); }
  8032. } else if (!cm.options.lineWiseCopyCut) {
  8033. return
  8034. } else {
  8035. var ranges = copyableRanges(cm);
  8036. setLastCopied({lineWise: true, text: ranges.text});
  8037. if (e.type == "cut") {
  8038. cm.operation(function () {
  8039. cm.setSelections(ranges.ranges, 0, sel_dontScroll);
  8040. cm.replaceSelection("", null, "cut");
  8041. });
  8042. }
  8043. }
  8044. if (e.clipboardData) {
  8045. e.clipboardData.clearData();
  8046. var content = lastCopied.text.join("\n");
  8047. // iOS exposes the clipboard API, but seems to discard content inserted into it
  8048. e.clipboardData.setData("Text", content);
  8049. if (e.clipboardData.getData("Text") == content) {
  8050. e.preventDefault();
  8051. return
  8052. }
  8053. }
  8054. // Old-fashioned briefly-focus-a-textarea hack
  8055. var kludge = hiddenTextarea(), te = kludge.firstChild;
  8056. cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);
  8057. te.value = lastCopied.text.join("\n");
  8058. var hadFocus = document.activeElement;
  8059. selectInput(te);
  8060. setTimeout(function () {
  8061. cm.display.lineSpace.removeChild(kludge);
  8062. hadFocus.focus();
  8063. if (hadFocus == div) { input.showPrimarySelection(); }
  8064. }, 50);
  8065. }
  8066. on(div, "copy", onCopyCut);
  8067. on(div, "cut", onCopyCut);
  8068. };
  8069. ContentEditableInput.prototype.screenReaderLabelChanged = function (label) {
  8070. // Label for screenreaders, accessibility
  8071. if(label) {
  8072. this.div.setAttribute('aria-label', label);
  8073. } else {
  8074. this.div.removeAttribute('aria-label');
  8075. }
  8076. };
  8077. ContentEditableInput.prototype.prepareSelection = function () {
  8078. var result = prepareSelection(this.cm, false);
  8079. result.focus = document.activeElement == this.div;
  8080. return result
  8081. };
  8082. ContentEditableInput.prototype.showSelection = function (info, takeFocus) {
  8083. if (!info || !this.cm.display.view.length) { return }
  8084. if (info.focus || takeFocus) { this.showPrimarySelection(); }
  8085. this.showMultipleSelections(info);
  8086. };
  8087. ContentEditableInput.prototype.getSelection = function () {
  8088. return this.cm.display.wrapper.ownerDocument.getSelection()
  8089. };
  8090. ContentEditableInput.prototype.showPrimarySelection = function () {
  8091. var sel = this.getSelection(), cm = this.cm, prim = cm.doc.sel.primary();
  8092. var from = prim.from(), to = prim.to();
  8093. if (cm.display.viewTo == cm.display.viewFrom || from.line >= cm.display.viewTo || to.line < cm.display.viewFrom) {
  8094. sel.removeAllRanges();
  8095. return
  8096. }
  8097. var curAnchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);
  8098. var curFocus = domToPos(cm, sel.focusNode, sel.focusOffset);
  8099. if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad &&
  8100. cmp(minPos(curAnchor, curFocus), from) == 0 &&
  8101. cmp(maxPos(curAnchor, curFocus), to) == 0)
  8102. { return }
  8103. var view = cm.display.view;
  8104. var start = (from.line >= cm.display.viewFrom && posToDOM(cm, from)) ||
  8105. {node: view[0].measure.map[2], offset: 0};
  8106. var end = to.line < cm.display.viewTo && posToDOM(cm, to);
  8107. if (!end) {
  8108. var measure = view[view.length - 1].measure;
  8109. var map = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map;
  8110. end = {node: map[map.length - 1], offset: map[map.length - 2] - map[map.length - 3]};
  8111. }
  8112. if (!start || !end) {
  8113. sel.removeAllRanges();
  8114. return
  8115. }
  8116. var old = sel.rangeCount && sel.getRangeAt(0), rng;
  8117. try { rng = range(start.node, start.offset, end.offset, end.node); }
  8118. catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible
  8119. if (rng) {
  8120. if (!gecko && cm.state.focused) {
  8121. sel.collapse(start.node, start.offset);
  8122. if (!rng.collapsed) {
  8123. sel.removeAllRanges();
  8124. sel.addRange(rng);
  8125. }
  8126. } else {
  8127. sel.removeAllRanges();
  8128. sel.addRange(rng);
  8129. }
  8130. if (old && sel.anchorNode == null) { sel.addRange(old); }
  8131. else if (gecko) { this.startGracePeriod(); }
  8132. }
  8133. this.rememberSelection();
  8134. };
  8135. ContentEditableInput.prototype.startGracePeriod = function () {
  8136. var this$1 = this;
  8137. clearTimeout(this.gracePeriod);
  8138. this.gracePeriod = setTimeout(function () {
  8139. this$1.gracePeriod = false;
  8140. if (this$1.selectionChanged())
  8141. { this$1.cm.operation(function () { return this$1.cm.curOp.selectionChanged = true; }); }
  8142. }, 20);
  8143. };
  8144. ContentEditableInput.prototype.showMultipleSelections = function (info) {
  8145. removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors);
  8146. removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection);
  8147. };
  8148. ContentEditableInput.prototype.rememberSelection = function () {
  8149. var sel = this.getSelection();
  8150. this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset;
  8151. this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset;
  8152. };
  8153. ContentEditableInput.prototype.selectionInEditor = function () {
  8154. var sel = this.getSelection();
  8155. if (!sel.rangeCount) { return false }
  8156. var node = sel.getRangeAt(0).commonAncestorContainer;
  8157. return contains(this.div, node)
  8158. };
  8159. ContentEditableInput.prototype.focus = function () {
  8160. if (this.cm.options.readOnly != "nocursor") {
  8161. if (!this.selectionInEditor() || document.activeElement != this.div)
  8162. { this.showSelection(this.prepareSelection(), true); }
  8163. this.div.focus();
  8164. }
  8165. };
  8166. ContentEditableInput.prototype.blur = function () { this.div.blur(); };
  8167. ContentEditableInput.prototype.getField = function () { return this.div };
  8168. ContentEditableInput.prototype.supportsTouch = function () { return true };
  8169. ContentEditableInput.prototype.receivedFocus = function () {
  8170. var input = this;
  8171. if (this.selectionInEditor())
  8172. { this.pollSelection(); }
  8173. else
  8174. { runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); }
  8175. function poll() {
  8176. if (input.cm.state.focused) {
  8177. input.pollSelection();
  8178. input.polling.set(input.cm.options.pollInterval, poll);
  8179. }
  8180. }
  8181. this.polling.set(this.cm.options.pollInterval, poll);
  8182. };
  8183. ContentEditableInput.prototype.selectionChanged = function () {
  8184. var sel = this.getSelection();
  8185. return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset ||
  8186. sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset
  8187. };
  8188. ContentEditableInput.prototype.pollSelection = function () {
  8189. if (this.readDOMTimeout != null || this.gracePeriod || !this.selectionChanged()) { return }
  8190. var sel = this.getSelection(), cm = this.cm;
  8191. // On Android Chrome (version 56, at least), backspacing into an
  8192. // uneditable block element will put the cursor in that element,
  8193. // and then, because it's not editable, hide the virtual keyboard.
  8194. // Because Android doesn't allow us to actually detect backspace
  8195. // presses in a sane way, this code checks for when that happens
  8196. // and simulates a backspace press in this case.
  8197. if (android && chrome && this.cm.display.gutterSpecs.length && isInGutter(sel.anchorNode)) {
  8198. this.cm.triggerOnKeyDown({type: "keydown", keyCode: 8, preventDefault: Math.abs});
  8199. this.blur();
  8200. this.focus();
  8201. return
  8202. }
  8203. if (this.composing) { return }
  8204. this.rememberSelection();
  8205. var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);
  8206. var head = domToPos(cm, sel.focusNode, sel.focusOffset);
  8207. if (anchor && head) { runInOp(cm, function () {
  8208. setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll);
  8209. if (anchor.bad || head.bad) { cm.curOp.selectionChanged = true; }
  8210. }); }
  8211. };
  8212. ContentEditableInput.prototype.pollContent = function () {
  8213. if (this.readDOMTimeout != null) {
  8214. clearTimeout(this.readDOMTimeout);
  8215. this.readDOMTimeout = null;
  8216. }
  8217. var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary();
  8218. var from = sel.from(), to = sel.to();
  8219. if (from.ch == 0 && from.line > cm.firstLine())
  8220. { from = Pos(from.line - 1, getLine(cm.doc, from.line - 1).length); }
  8221. if (to.ch == getLine(cm.doc, to.line).text.length && to.line < cm.lastLine())
  8222. { to = Pos(to.line + 1, 0); }
  8223. if (from.line < display.viewFrom || to.line > display.viewTo - 1) { return false }
  8224. var fromIndex, fromLine, fromNode;
  8225. if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {
  8226. fromLine = lineNo(display.view[0].line);
  8227. fromNode = display.view[0].node;
  8228. } else {
  8229. fromLine = lineNo(display.view[fromIndex].line);
  8230. fromNode = display.view[fromIndex - 1].node.nextSibling;
  8231. }
  8232. var toIndex = findViewIndex(cm, to.line);
  8233. var toLine, toNode;
  8234. if (toIndex == display.view.length - 1) {
  8235. toLine = display.viewTo - 1;
  8236. toNode = display.lineDiv.lastChild;
  8237. } else {
  8238. toLine = lineNo(display.view[toIndex + 1].line) - 1;
  8239. toNode = display.view[toIndex + 1].node.previousSibling;
  8240. }
  8241. if (!fromNode) { return false }
  8242. var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine));
  8243. var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length));
  8244. while (newText.length > 1 && oldText.length > 1) {
  8245. if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine--; }
  8246. else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++; }
  8247. else { break }
  8248. }
  8249. var cutFront = 0, cutEnd = 0;
  8250. var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length);
  8251. while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront))
  8252. { ++cutFront; }
  8253. var newBot = lst(newText), oldBot = lst(oldText);
  8254. var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0),
  8255. oldBot.length - (oldText.length == 1 ? cutFront : 0));
  8256. while (cutEnd < maxCutEnd &&
  8257. newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1))
  8258. { ++cutEnd; }
  8259. // Try to move start of change to start of selection if ambiguous
  8260. if (newText.length == 1 && oldText.length == 1 && fromLine == from.line) {
  8261. while (cutFront && cutFront > from.ch &&
  8262. newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) {
  8263. cutFront--;
  8264. cutEnd++;
  8265. }
  8266. }
  8267. newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd).replace(/^\u200b+/, "");
  8268. newText[0] = newText[0].slice(cutFront).replace(/\u200b+$/, "");
  8269. var chFrom = Pos(fromLine, cutFront);
  8270. var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0);
  8271. if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {
  8272. replaceRange(cm.doc, newText, chFrom, chTo, "+input");
  8273. return true
  8274. }
  8275. };
  8276. ContentEditableInput.prototype.ensurePolled = function () {
  8277. this.forceCompositionEnd();
  8278. };
  8279. ContentEditableInput.prototype.reset = function () {
  8280. this.forceCompositionEnd();
  8281. };
  8282. ContentEditableInput.prototype.forceCompositionEnd = function () {
  8283. if (!this.composing) { return }
  8284. clearTimeout(this.readDOMTimeout);
  8285. this.composing = null;
  8286. this.updateFromDOM();
  8287. this.div.blur();
  8288. this.div.focus();
  8289. };
  8290. ContentEditableInput.prototype.readFromDOMSoon = function () {
  8291. var this$1 = this;
  8292. if (this.readDOMTimeout != null) { return }
  8293. this.readDOMTimeout = setTimeout(function () {
  8294. this$1.readDOMTimeout = null;
  8295. if (this$1.composing) {
  8296. if (this$1.composing.done) { this$1.composing = null; }
  8297. else { return }
  8298. }
  8299. this$1.updateFromDOM();
  8300. }, 80);
  8301. };
  8302. ContentEditableInput.prototype.updateFromDOM = function () {
  8303. var this$1 = this;
  8304. if (this.cm.isReadOnly() || !this.pollContent())
  8305. { runInOp(this.cm, function () { return regChange(this$1.cm); }); }
  8306. };
  8307. ContentEditableInput.prototype.setUneditable = function (node) {
  8308. node.contentEditable = "false";
  8309. };
  8310. ContentEditableInput.prototype.onKeyPress = function (e) {
  8311. if (e.charCode == 0 || this.composing) { return }
  8312. e.preventDefault();
  8313. if (!this.cm.isReadOnly())
  8314. { operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0); }
  8315. };
  8316. ContentEditableInput.prototype.readOnlyChanged = function (val) {
  8317. this.div.contentEditable = String(val != "nocursor");
  8318. };
  8319. ContentEditableInput.prototype.onContextMenu = function () {};
  8320. ContentEditableInput.prototype.resetPosition = function () {};
  8321. ContentEditableInput.prototype.needsContentAttribute = true;
  8322. function posToDOM(cm, pos) {
  8323. var view = findViewForLine(cm, pos.line);
  8324. if (!view || view.hidden) { return null }
  8325. var line = getLine(cm.doc, pos.line);
  8326. var info = mapFromLineView(view, line, pos.line);
  8327. var order = getOrder(line, cm.doc.direction), side = "left";
  8328. if (order) {
  8329. var partPos = getBidiPartAt(order, pos.ch);
  8330. side = partPos % 2 ? "right" : "left";
  8331. }
  8332. var result = nodeAndOffsetInLineMap(info.map, pos.ch, side);
  8333. result.offset = result.collapse == "right" ? result.end : result.start;
  8334. return result
  8335. }
  8336. function isInGutter(node) {
  8337. for (var scan = node; scan; scan = scan.parentNode)
  8338. { if (/CodeMirror-gutter-wrapper/.test(scan.className)) { return true } }
  8339. return false
  8340. }
  8341. function badPos(pos, bad) { if (bad) { pos.bad = true; } return pos }
  8342. function domTextBetween(cm, from, to, fromLine, toLine) {
  8343. var text = "", closing = false, lineSep = cm.doc.lineSeparator(), extraLinebreak = false;
  8344. function recognizeMarker(id) { return function (marker) { return marker.id == id; } }
  8345. function close() {
  8346. if (closing) {
  8347. text += lineSep;
  8348. if (extraLinebreak) { text += lineSep; }
  8349. closing = extraLinebreak = false;
  8350. }
  8351. }
  8352. function addText(str) {
  8353. if (str) {
  8354. close();
  8355. text += str;
  8356. }
  8357. }
  8358. function walk(node) {
  8359. if (node.nodeType == 1) {
  8360. var cmText = node.getAttribute("cm-text");
  8361. if (cmText) {
  8362. addText(cmText);
  8363. return
  8364. }
  8365. var markerID = node.getAttribute("cm-marker"), range;
  8366. if (markerID) {
  8367. var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID));
  8368. if (found.length && (range = found[0].find(0)))
  8369. { addText(getBetween(cm.doc, range.from, range.to).join(lineSep)); }
  8370. return
  8371. }
  8372. if (node.getAttribute("contenteditable") == "false") { return }
  8373. var isBlock = /^(pre|div|p|li|table|br)$/i.test(node.nodeName);
  8374. if (!/^br$/i.test(node.nodeName) && node.textContent.length == 0) { return }
  8375. if (isBlock) { close(); }
  8376. for (var i = 0; i < node.childNodes.length; i++)
  8377. { walk(node.childNodes[i]); }
  8378. if (/^(pre|p)$/i.test(node.nodeName)) { extraLinebreak = true; }
  8379. if (isBlock) { closing = true; }
  8380. } else if (node.nodeType == 3) {
  8381. addText(node.nodeValue.replace(/\u200b/g, "").replace(/\u00a0/g, " "));
  8382. }
  8383. }
  8384. for (;;) {
  8385. walk(from);
  8386. if (from == to) { break }
  8387. from = from.nextSibling;
  8388. extraLinebreak = false;
  8389. }
  8390. return text
  8391. }
  8392. function domToPos(cm, node, offset) {
  8393. var lineNode;
  8394. if (node == cm.display.lineDiv) {
  8395. lineNode = cm.display.lineDiv.childNodes[offset];
  8396. if (!lineNode) { return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true) }
  8397. node = null; offset = 0;
  8398. } else {
  8399. for (lineNode = node;; lineNode = lineNode.parentNode) {
  8400. if (!lineNode || lineNode == cm.display.lineDiv) { return null }
  8401. if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) { break }
  8402. }
  8403. }
  8404. for (var i = 0; i < cm.display.view.length; i++) {
  8405. var lineView = cm.display.view[i];
  8406. if (lineView.node == lineNode)
  8407. { return locateNodeInLineView(lineView, node, offset) }
  8408. }
  8409. }
  8410. function locateNodeInLineView(lineView, node, offset) {
  8411. var wrapper = lineView.text.firstChild, bad = false;
  8412. if (!node || !contains(wrapper, node)) { return badPos(Pos(lineNo(lineView.line), 0), true) }
  8413. if (node == wrapper) {
  8414. bad = true;
  8415. node = wrapper.childNodes[offset];
  8416. offset = 0;
  8417. if (!node) {
  8418. var line = lineView.rest ? lst(lineView.rest) : lineView.line;
  8419. return badPos(Pos(lineNo(line), line.text.length), bad)
  8420. }
  8421. }
  8422. var textNode = node.nodeType == 3 ? node : null, topNode = node;
  8423. if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {
  8424. textNode = node.firstChild;
  8425. if (offset) { offset = textNode.nodeValue.length; }
  8426. }
  8427. while (topNode.parentNode != wrapper) { topNode = topNode.parentNode; }
  8428. var measure = lineView.measure, maps = measure.maps;
  8429. function find(textNode, topNode, offset) {
  8430. for (var i = -1; i < (maps ? maps.length : 0); i++) {
  8431. var map = i < 0 ? measure.map : maps[i];
  8432. for (var j = 0; j < map.length; j += 3) {
  8433. var curNode = map[j + 2];
  8434. if (curNode == textNode || curNode == topNode) {
  8435. var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]);
  8436. var ch = map[j] + offset;
  8437. if (offset < 0 || curNode != textNode) { ch = map[j + (offset ? 1 : 0)]; }
  8438. return Pos(line, ch)
  8439. }
  8440. }
  8441. }
  8442. }
  8443. var found = find(textNode, topNode, offset);
  8444. if (found) { return badPos(found, bad) }
  8445. // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems
  8446. for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) {
  8447. found = find(after, after.firstChild, 0);
  8448. if (found)
  8449. { return badPos(Pos(found.line, found.ch - dist), bad) }
  8450. else
  8451. { dist += after.textContent.length; }
  8452. }
  8453. for (var before = topNode.previousSibling, dist$1 = offset; before; before = before.previousSibling) {
  8454. found = find(before, before.firstChild, -1);
  8455. if (found)
  8456. { return badPos(Pos(found.line, found.ch + dist$1), bad) }
  8457. else
  8458. { dist$1 += before.textContent.length; }
  8459. }
  8460. }
  8461. // TEXTAREA INPUT STYLE
  8462. var TextareaInput = function(cm) {
  8463. this.cm = cm;
  8464. // See input.poll and input.reset
  8465. this.prevInput = "";
  8466. // Flag that indicates whether we expect input to appear real soon
  8467. // now (after some event like 'keypress' or 'input') and are
  8468. // polling intensively.
  8469. this.pollingFast = false;
  8470. // Self-resetting timeout for the poller
  8471. this.polling = new Delayed();
  8472. // Used to work around IE issue with selection being forgotten when focus moves away from textarea
  8473. this.hasSelection = false;
  8474. this.composing = null;
  8475. };
  8476. TextareaInput.prototype.init = function (display) {
  8477. var this$1 = this;
  8478. var input = this, cm = this.cm;
  8479. this.createField(display);
  8480. var te = this.textarea;
  8481. display.wrapper.insertBefore(this.wrapper, display.wrapper.firstChild);
  8482. // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)
  8483. if (ios) { te.style.width = "0px"; }
  8484. on(te, "input", function () {
  8485. if (ie && ie_version >= 9 && this$1.hasSelection) { this$1.hasSelection = null; }
  8486. input.poll();
  8487. });
  8488. on(te, "paste", function (e) {
  8489. if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
  8490. cm.state.pasteIncoming = +new Date;
  8491. input.fastPoll();
  8492. });
  8493. function prepareCopyCut(e) {
  8494. if (signalDOMEvent(cm, e)) { return }
  8495. if (cm.somethingSelected()) {
  8496. setLastCopied({lineWise: false, text: cm.getSelections()});
  8497. } else if (!cm.options.lineWiseCopyCut) {
  8498. return
  8499. } else {
  8500. var ranges = copyableRanges(cm);
  8501. setLastCopied({lineWise: true, text: ranges.text});
  8502. if (e.type == "cut") {
  8503. cm.setSelections(ranges.ranges, null, sel_dontScroll);
  8504. } else {
  8505. input.prevInput = "";
  8506. te.value = ranges.text.join("\n");
  8507. selectInput(te);
  8508. }
  8509. }
  8510. if (e.type == "cut") { cm.state.cutIncoming = +new Date; }
  8511. }
  8512. on(te, "cut", prepareCopyCut);
  8513. on(te, "copy", prepareCopyCut);
  8514. on(display.scroller, "paste", function (e) {
  8515. if (eventInWidget(display, e) || signalDOMEvent(cm, e)) { return }
  8516. if (!te.dispatchEvent) {
  8517. cm.state.pasteIncoming = +new Date;
  8518. input.focus();
  8519. return
  8520. }
  8521. // Pass the `paste` event to the textarea so it's handled by its event listener.
  8522. var event = new Event("paste");
  8523. event.clipboardData = e.clipboardData;
  8524. te.dispatchEvent(event);
  8525. });
  8526. // Prevent normal selection in the editor (we handle our own)
  8527. on(display.lineSpace, "selectstart", function (e) {
  8528. if (!eventInWidget(display, e)) { e_preventDefault(e); }
  8529. });
  8530. on(te, "compositionstart", function () {
  8531. var start = cm.getCursor("from");
  8532. if (input.composing) { input.composing.range.clear(); }
  8533. input.composing = {
  8534. start: start,
  8535. range: cm.markText(start, cm.getCursor("to"), {className: "CodeMirror-composing"})
  8536. };
  8537. });
  8538. on(te, "compositionend", function () {
  8539. if (input.composing) {
  8540. input.poll();
  8541. input.composing.range.clear();
  8542. input.composing = null;
  8543. }
  8544. });
  8545. };
  8546. TextareaInput.prototype.createField = function (_display) {
  8547. // Wraps and hides input textarea
  8548. this.wrapper = hiddenTextarea();
  8549. // The semihidden textarea that is focused when the editor is
  8550. // focused, and receives input.
  8551. this.textarea = this.wrapper.firstChild;
  8552. };
  8553. TextareaInput.prototype.screenReaderLabelChanged = function (label) {
  8554. // Label for screenreaders, accessibility
  8555. if(label) {
  8556. this.textarea.setAttribute('aria-label', label);
  8557. } else {
  8558. this.textarea.removeAttribute('aria-label');
  8559. }
  8560. };
  8561. TextareaInput.prototype.prepareSelection = function () {
  8562. // Redraw the selection and/or cursor
  8563. var cm = this.cm, display = cm.display, doc = cm.doc;
  8564. var result = prepareSelection(cm);
  8565. // Move the hidden textarea near the cursor to prevent scrolling artifacts
  8566. if (cm.options.moveInputWithCursor) {
  8567. var headPos = cursorCoords(cm, doc.sel.primary().head, "div");
  8568. var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();
  8569. result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
  8570. headPos.top + lineOff.top - wrapOff.top));
  8571. result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10,
  8572. headPos.left + lineOff.left - wrapOff.left));
  8573. }
  8574. return result
  8575. };
  8576. TextareaInput.prototype.showSelection = function (drawn) {
  8577. var cm = this.cm, display = cm.display;
  8578. removeChildrenAndAdd(display.cursorDiv, drawn.cursors);
  8579. removeChildrenAndAdd(display.selectionDiv, drawn.selection);
  8580. if (drawn.teTop != null) {
  8581. this.wrapper.style.top = drawn.teTop + "px";
  8582. this.wrapper.style.left = drawn.teLeft + "px";
  8583. }
  8584. };
  8585. // Reset the input to correspond to the selection (or to be empty,
  8586. // when not typing and nothing is selected)
  8587. TextareaInput.prototype.reset = function (typing) {
  8588. if (this.contextMenuPending || this.composing) { return }
  8589. var cm = this.cm;
  8590. if (cm.somethingSelected()) {
  8591. this.prevInput = "";
  8592. var content = cm.getSelection();
  8593. this.textarea.value = content;
  8594. if (cm.state.focused) { selectInput(this.textarea); }
  8595. if (ie && ie_version >= 9) { this.hasSelection = content; }
  8596. } else if (!typing) {
  8597. this.prevInput = this.textarea.value = "";
  8598. if (ie && ie_version >= 9) { this.hasSelection = null; }
  8599. }
  8600. };
  8601. TextareaInput.prototype.getField = function () { return this.textarea };
  8602. TextareaInput.prototype.supportsTouch = function () { return false };
  8603. TextareaInput.prototype.focus = function () {
  8604. if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt() != this.textarea)) {
  8605. try { this.textarea.focus(); }
  8606. catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM
  8607. }
  8608. };
  8609. TextareaInput.prototype.blur = function () { this.textarea.blur(); };
  8610. TextareaInput.prototype.resetPosition = function () {
  8611. this.wrapper.style.top = this.wrapper.style.left = 0;
  8612. };
  8613. TextareaInput.prototype.receivedFocus = function () { this.slowPoll(); };
  8614. // Poll for input changes, using the normal rate of polling. This
  8615. // runs as long as the editor is focused.
  8616. TextareaInput.prototype.slowPoll = function () {
  8617. var this$1 = this;
  8618. if (this.pollingFast) { return }
  8619. this.polling.set(this.cm.options.pollInterval, function () {
  8620. this$1.poll();
  8621. if (this$1.cm.state.focused) { this$1.slowPoll(); }
  8622. });
  8623. };
  8624. // When an event has just come in that is likely to add or change
  8625. // something in the input textarea, we poll faster, to ensure that
  8626. // the change appears on the screen quickly.
  8627. TextareaInput.prototype.fastPoll = function () {
  8628. var missed = false, input = this;
  8629. input.pollingFast = true;
  8630. function p() {
  8631. var changed = input.poll();
  8632. if (!changed && !missed) {missed = true; input.polling.set(60, p);}
  8633. else {input.pollingFast = false; input.slowPoll();}
  8634. }
  8635. input.polling.set(20, p);
  8636. };
  8637. // Read input from the textarea, and update the document to match.
  8638. // When something is selected, it is present in the textarea, and
  8639. // selected (unless it is huge, in which case a placeholder is
  8640. // used). When nothing is selected, the cursor sits after previously
  8641. // seen text (can be empty), which is stored in prevInput (we must
  8642. // not reset the textarea when typing, because that breaks IME).
  8643. TextareaInput.prototype.poll = function () {
  8644. var this$1 = this;
  8645. var cm = this.cm, input = this.textarea, prevInput = this.prevInput;
  8646. // Since this is called a *lot*, try to bail out as cheaply as
  8647. // possible when it is clear that nothing happened. hasSelection
  8648. // will be the case when there is a lot of text in the textarea,
  8649. // in which case reading its value would be expensive.
  8650. if (this.contextMenuPending || !cm.state.focused ||
  8651. (hasSelection(input) && !prevInput && !this.composing) ||
  8652. cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)
  8653. { return false }
  8654. var text = input.value;
  8655. // If nothing changed, bail.
  8656. if (text == prevInput && !cm.somethingSelected()) { return false }
  8657. // Work around nonsensical selection resetting in IE9/10, and
  8658. // inexplicable appearance of private area unicode characters on
  8659. // some key combos in Mac (#2689).
  8660. if (ie && ie_version >= 9 && this.hasSelection === text ||
  8661. mac && /[\uf700-\uf7ff]/.test(text)) {
  8662. cm.display.input.reset();
  8663. return false
  8664. }
  8665. if (cm.doc.sel == cm.display.selForContextMenu) {
  8666. var first = text.charCodeAt(0);
  8667. if (first == 0x200b && !prevInput) { prevInput = "\u200b"; }
  8668. if (first == 0x21da) { this.reset(); return this.cm.execCommand("undo") }
  8669. }
  8670. // Find the part of the input that is actually new
  8671. var same = 0, l = Math.min(prevInput.length, text.length);
  8672. while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) { ++same; }
  8673. runInOp(cm, function () {
  8674. applyTextInput(cm, text.slice(same), prevInput.length - same,
  8675. null, this$1.composing ? "*compose" : null);
  8676. // Don't leave long text in the textarea, since it makes further polling slow
  8677. if (text.length > 1000 || text.indexOf("\n") > -1) { input.value = this$1.prevInput = ""; }
  8678. else { this$1.prevInput = text; }
  8679. if (this$1.composing) {
  8680. this$1.composing.range.clear();
  8681. this$1.composing.range = cm.markText(this$1.composing.start, cm.getCursor("to"),
  8682. {className: "CodeMirror-composing"});
  8683. }
  8684. });
  8685. return true
  8686. };
  8687. TextareaInput.prototype.ensurePolled = function () {
  8688. if (this.pollingFast && this.poll()) { this.pollingFast = false; }
  8689. };
  8690. TextareaInput.prototype.onKeyPress = function () {
  8691. if (ie && ie_version >= 9) { this.hasSelection = null; }
  8692. this.fastPoll();
  8693. };
  8694. TextareaInput.prototype.onContextMenu = function (e) {
  8695. var input = this, cm = input.cm, display = cm.display, te = input.textarea;
  8696. if (input.contextMenuPending) { input.contextMenuPending(); }
  8697. var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;
  8698. if (!pos || presto) { return } // Opera is difficult.
  8699. // Reset the current text selection only if the click is done outside of the selection
  8700. // and 'resetSelectionOnContextMenu' option is true.
  8701. var reset = cm.options.resetSelectionOnContextMenu;
  8702. if (reset && cm.doc.sel.contains(pos) == -1)
  8703. { operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll); }
  8704. var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText;
  8705. var wrapperBox = input.wrapper.offsetParent.getBoundingClientRect();
  8706. input.wrapper.style.cssText = "position: static";
  8707. te.style.cssText = "position: absolute; width: 30px; height: 30px;\n top: " + (e.clientY - wrapperBox.top - 5) + "px; left: " + (e.clientX - wrapperBox.left - 5) + "px;\n z-index: 1000; background: " + (ie ? "rgba(255, 255, 255, .05)" : "transparent") + ";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
  8708. var oldScrollY;
  8709. if (webkit) { oldScrollY = window.scrollY; } // Work around Chrome issue (#2712)
  8710. display.input.focus();
  8711. if (webkit) { window.scrollTo(null, oldScrollY); }
  8712. display.input.reset();
  8713. // Adds "Select all" to context menu in FF
  8714. if (!cm.somethingSelected()) { te.value = input.prevInput = " "; }
  8715. input.contextMenuPending = rehide;
  8716. display.selForContextMenu = cm.doc.sel;
  8717. clearTimeout(display.detectingSelectAll);
  8718. // Select-all will be greyed out if there's nothing to select, so
  8719. // this adds a zero-width space so that we can later check whether
  8720. // it got selected.
  8721. function prepareSelectAllHack() {
  8722. if (te.selectionStart != null) {
  8723. var selected = cm.somethingSelected();
  8724. var extval = "\u200b" + (selected ? te.value : "");
  8725. te.value = "\u21da"; // Used to catch context-menu undo
  8726. te.value = extval;
  8727. input.prevInput = selected ? "" : "\u200b";
  8728. te.selectionStart = 1; te.selectionEnd = extval.length;
  8729. // Re-set this, in case some other handler touched the
  8730. // selection in the meantime.
  8731. display.selForContextMenu = cm.doc.sel;
  8732. }
  8733. }
  8734. function rehide() {
  8735. if (input.contextMenuPending != rehide) { return }
  8736. input.contextMenuPending = false;
  8737. input.wrapper.style.cssText = oldWrapperCSS;
  8738. te.style.cssText = oldCSS;
  8739. if (ie && ie_version < 9) { display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos); }
  8740. // Try to detect the user choosing select-all
  8741. if (te.selectionStart != null) {
  8742. if (!ie || (ie && ie_version < 9)) { prepareSelectAllHack(); }
  8743. var i = 0, poll = function () {
  8744. if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 &&
  8745. te.selectionEnd > 0 && input.prevInput == "\u200b") {
  8746. operation(cm, selectAll)(cm);
  8747. } else if (i++ < 10) {
  8748. display.detectingSelectAll = setTimeout(poll, 500);
  8749. } else {
  8750. display.selForContextMenu = null;
  8751. display.input.reset();
  8752. }
  8753. };
  8754. display.detectingSelectAll = setTimeout(poll, 200);
  8755. }
  8756. }
  8757. if (ie && ie_version >= 9) { prepareSelectAllHack(); }
  8758. if (captureRightClick) {
  8759. e_stop(e);
  8760. var mouseup = function () {
  8761. off(window, "mouseup", mouseup);
  8762. setTimeout(rehide, 20);
  8763. };
  8764. on(window, "mouseup", mouseup);
  8765. } else {
  8766. setTimeout(rehide, 50);
  8767. }
  8768. };
  8769. TextareaInput.prototype.readOnlyChanged = function (val) {
  8770. if (!val) { this.reset(); }
  8771. this.textarea.disabled = val == "nocursor";
  8772. this.textarea.readOnly = !!val;
  8773. };
  8774. TextareaInput.prototype.setUneditable = function () {};
  8775. TextareaInput.prototype.needsContentAttribute = false;
  8776. function fromTextArea(textarea, options) {
  8777. options = options ? copyObj(options) : {};
  8778. options.value = textarea.value;
  8779. if (!options.tabindex && textarea.tabIndex)
  8780. { options.tabindex = textarea.tabIndex; }
  8781. if (!options.placeholder && textarea.placeholder)
  8782. { options.placeholder = textarea.placeholder; }
  8783. // Set autofocus to true if this textarea is focused, or if it has
  8784. // autofocus and no other element is focused.
  8785. if (options.autofocus == null) {
  8786. var hasFocus = activeElt();
  8787. options.autofocus = hasFocus == textarea ||
  8788. textarea.getAttribute("autofocus") != null && hasFocus == document.body;
  8789. }
  8790. function save() {textarea.value = cm.getValue();}
  8791. var realSubmit;
  8792. if (textarea.form) {
  8793. on(textarea.form, "submit", save);
  8794. // Deplorable hack to make the submit method do the right thing.
  8795. if (!options.leaveSubmitMethodAlone) {
  8796. var form = textarea.form;
  8797. realSubmit = form.submit;
  8798. try {
  8799. var wrappedSubmit = form.submit = function () {
  8800. save();
  8801. form.submit = realSubmit;
  8802. form.submit();
  8803. form.submit = wrappedSubmit;
  8804. };
  8805. } catch(e) {}
  8806. }
  8807. }
  8808. options.finishInit = function (cm) {
  8809. cm.save = save;
  8810. cm.getTextArea = function () { return textarea; };
  8811. cm.toTextArea = function () {
  8812. cm.toTextArea = isNaN; // Prevent this from being ran twice
  8813. save();
  8814. textarea.parentNode.removeChild(cm.getWrapperElement());
  8815. textarea.style.display = "";
  8816. if (textarea.form) {
  8817. off(textarea.form, "submit", save);
  8818. if (!options.leaveSubmitMethodAlone && typeof textarea.form.submit == "function")
  8819. { textarea.form.submit = realSubmit; }
  8820. }
  8821. };
  8822. };
  8823. textarea.style.display = "none";
  8824. var cm = CodeMirror(function (node) { return textarea.parentNode.insertBefore(node, textarea.nextSibling); },
  8825. options);
  8826. return cm
  8827. }
  8828. function addLegacyProps(CodeMirror) {
  8829. CodeMirror.off = off;
  8830. CodeMirror.on = on;
  8831. CodeMirror.wheelEventPixels = wheelEventPixels;
  8832. CodeMirror.Doc = Doc;
  8833. CodeMirror.splitLines = splitLinesAuto;
  8834. CodeMirror.countColumn = countColumn;
  8835. CodeMirror.findColumn = findColumn;
  8836. CodeMirror.isWordChar = isWordCharBasic;
  8837. CodeMirror.Pass = Pass;
  8838. CodeMirror.signal = signal;
  8839. CodeMirror.Line = Line;
  8840. CodeMirror.changeEnd = changeEnd;
  8841. CodeMirror.scrollbarModel = scrollbarModel;
  8842. CodeMirror.Pos = Pos;
  8843. CodeMirror.cmpPos = cmp;
  8844. CodeMirror.modes = modes;
  8845. CodeMirror.mimeModes = mimeModes;
  8846. CodeMirror.resolveMode = resolveMode;
  8847. CodeMirror.getMode = getMode;
  8848. CodeMirror.modeExtensions = modeExtensions;
  8849. CodeMirror.extendMode = extendMode;
  8850. CodeMirror.copyState = copyState;
  8851. CodeMirror.startState = startState;
  8852. CodeMirror.innerMode = innerMode;
  8853. CodeMirror.commands = commands;
  8854. CodeMirror.keyMap = keyMap;
  8855. CodeMirror.keyName = keyName;
  8856. CodeMirror.isModifierKey = isModifierKey;
  8857. CodeMirror.lookupKey = lookupKey;
  8858. CodeMirror.normalizeKeyMap = normalizeKeyMap;
  8859. CodeMirror.StringStream = StringStream;
  8860. CodeMirror.SharedTextMarker = SharedTextMarker;
  8861. CodeMirror.TextMarker = TextMarker;
  8862. CodeMirror.LineWidget = LineWidget;
  8863. CodeMirror.e_preventDefault = e_preventDefault;
  8864. CodeMirror.e_stopPropagation = e_stopPropagation;
  8865. CodeMirror.e_stop = e_stop;
  8866. CodeMirror.addClass = addClass;
  8867. CodeMirror.contains = contains;
  8868. CodeMirror.rmClass = rmClass;
  8869. CodeMirror.keyNames = keyNames;
  8870. }
  8871. // EDITOR CONSTRUCTOR
  8872. defineOptions(CodeMirror);
  8873. addEditorMethods(CodeMirror);
  8874. // Set up methods on CodeMirror's prototype to redirect to the editor's document.
  8875. var dontDelegate = "iter insert remove copy getEditor constructor".split(" ");
  8876. for (var prop in Doc.prototype) { if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)
  8877. { CodeMirror.prototype[prop] = (function(method) {
  8878. return function() {return method.apply(this.doc, arguments)}
  8879. })(Doc.prototype[prop]); } }
  8880. eventMixin(Doc);
  8881. CodeMirror.inputStyles = {"textarea": TextareaInput, "contenteditable": ContentEditableInput};
  8882. // Extra arguments are stored as the mode's dependencies, which is
  8883. // used by (legacy) mechanisms like loadmode.js to automatically
  8884. // load a mode. (Preferred mechanism is the require/define calls.)
  8885. CodeMirror.defineMode = function(name/*, mode, …*/) {
  8886. if (!CodeMirror.defaults.mode && name != "null") { CodeMirror.defaults.mode = name; }
  8887. defineMode.apply(this, arguments);
  8888. };
  8889. CodeMirror.defineMIME = defineMIME;
  8890. // Minimal default mode.
  8891. CodeMirror.defineMode("null", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); });
  8892. CodeMirror.defineMIME("text/plain", "null");
  8893. // EXTENSIONS
  8894. CodeMirror.defineExtension = function (name, func) {
  8895. CodeMirror.prototype[name] = func;
  8896. };
  8897. CodeMirror.defineDocExtension = function (name, func) {
  8898. Doc.prototype[name] = func;
  8899. };
  8900. CodeMirror.fromTextArea = fromTextArea;
  8901. addLegacyProps(CodeMirror);
  8902. CodeMirror.version = "5.58.2";
  8903. return CodeMirror;
  8904. })));
  8905. ;(function (global, factory) {
  8906. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  8907. typeof define === 'function' && define.amd ? define('moment',factory) :
  8908. global.moment = factory()
  8909. }(this, (function () { 'use strict';
  8910. var hookCallback;
  8911. function hooks() {
  8912. return hookCallback.apply(null, arguments);
  8913. }
  8914. // This is done to register the method called with moment()
  8915. // without creating circular dependencies.
  8916. function setHookCallback(callback) {
  8917. hookCallback = callback;
  8918. }
  8919. function isArray(input) {
  8920. return (
  8921. input instanceof Array ||
  8922. Object.prototype.toString.call(input) === '[object Array]'
  8923. );
  8924. }
  8925. function isObject(input) {
  8926. // IE8 will treat undefined and null as object if it wasn't for
  8927. // input != null
  8928. return (
  8929. input != null &&
  8930. Object.prototype.toString.call(input) === '[object Object]'
  8931. );
  8932. }
  8933. function hasOwnProp(a, b) {
  8934. return Object.prototype.hasOwnProperty.call(a, b);
  8935. }
  8936. function isObjectEmpty(obj) {
  8937. if (Object.getOwnPropertyNames) {
  8938. return Object.getOwnPropertyNames(obj).length === 0;
  8939. } else {
  8940. var k;
  8941. for (k in obj) {
  8942. if (hasOwnProp(obj, k)) {
  8943. return false;
  8944. }
  8945. }
  8946. return true;
  8947. }
  8948. }
  8949. function isUndefined(input) {
  8950. return input === void 0;
  8951. }
  8952. function isNumber(input) {
  8953. return (
  8954. typeof input === 'number' ||
  8955. Object.prototype.toString.call(input) === '[object Number]'
  8956. );
  8957. }
  8958. function isDate(input) {
  8959. return (
  8960. input instanceof Date ||
  8961. Object.prototype.toString.call(input) === '[object Date]'
  8962. );
  8963. }
  8964. function map(arr, fn) {
  8965. var res = [],
  8966. i,
  8967. arrLen = arr.length;
  8968. for (i = 0; i < arrLen; ++i) {
  8969. res.push(fn(arr[i], i));
  8970. }
  8971. return res;
  8972. }
  8973. function extend(a, b) {
  8974. for (var i in b) {
  8975. if (hasOwnProp(b, i)) {
  8976. a[i] = b[i];
  8977. }
  8978. }
  8979. if (hasOwnProp(b, 'toString')) {
  8980. a.toString = b.toString;
  8981. }
  8982. if (hasOwnProp(b, 'valueOf')) {
  8983. a.valueOf = b.valueOf;
  8984. }
  8985. return a;
  8986. }
  8987. function createUTC(input, format, locale, strict) {
  8988. return createLocalOrUTC(input, format, locale, strict, true).utc();
  8989. }
  8990. function defaultParsingFlags() {
  8991. // We need to deep clone this object.
  8992. return {
  8993. empty: false,
  8994. unusedTokens: [],
  8995. unusedInput: [],
  8996. overflow: -2,
  8997. charsLeftOver: 0,
  8998. nullInput: false,
  8999. invalidEra: null,
  9000. invalidMonth: null,
  9001. invalidFormat: false,
  9002. userInvalidated: false,
  9003. iso: false,
  9004. parsedDateParts: [],
  9005. era: null,
  9006. meridiem: null,
  9007. rfc2822: false,
  9008. weekdayMismatch: false,
  9009. };
  9010. }
  9011. function getParsingFlags(m) {
  9012. if (m._pf == null) {
  9013. m._pf = defaultParsingFlags();
  9014. }
  9015. return m._pf;
  9016. }
  9017. var some;
  9018. if (Array.prototype.some) {
  9019. some = Array.prototype.some;
  9020. } else {
  9021. some = function (fun) {
  9022. var t = Object(this),
  9023. len = t.length >>> 0,
  9024. i;
  9025. for (i = 0; i < len; i++) {
  9026. if (i in t && fun.call(this, t[i], i, t)) {
  9027. return true;
  9028. }
  9029. }
  9030. return false;
  9031. };
  9032. }
  9033. function isValid(m) {
  9034. if (m._isValid == null) {
  9035. var flags = getParsingFlags(m),
  9036. parsedParts = some.call(flags.parsedDateParts, function (i) {
  9037. return i != null;
  9038. }),
  9039. isNowValid =
  9040. !isNaN(m._d.getTime()) &&
  9041. flags.overflow < 0 &&
  9042. !flags.empty &&
  9043. !flags.invalidEra &&
  9044. !flags.invalidMonth &&
  9045. !flags.invalidWeekday &&
  9046. !flags.weekdayMismatch &&
  9047. !flags.nullInput &&
  9048. !flags.invalidFormat &&
  9049. !flags.userInvalidated &&
  9050. (!flags.meridiem || (flags.meridiem && parsedParts));
  9051. if (m._strict) {
  9052. isNowValid =
  9053. isNowValid &&
  9054. flags.charsLeftOver === 0 &&
  9055. flags.unusedTokens.length === 0 &&
  9056. flags.bigHour === undefined;
  9057. }
  9058. if (Object.isFrozen == null || !Object.isFrozen(m)) {
  9059. m._isValid = isNowValid;
  9060. } else {
  9061. return isNowValid;
  9062. }
  9063. }
  9064. return m._isValid;
  9065. }
  9066. function createInvalid(flags) {
  9067. var m = createUTC(NaN);
  9068. if (flags != null) {
  9069. extend(getParsingFlags(m), flags);
  9070. } else {
  9071. getParsingFlags(m).userInvalidated = true;
  9072. }
  9073. return m;
  9074. }
  9075. // Plugins that add properties should also add the key here (null value),
  9076. // so we can properly clone ourselves.
  9077. var momentProperties = (hooks.momentProperties = []),
  9078. updateInProgress = false;
  9079. function copyConfig(to, from) {
  9080. var i,
  9081. prop,
  9082. val,
  9083. momentPropertiesLen = momentProperties.length;
  9084. if (!isUndefined(from._isAMomentObject)) {
  9085. to._isAMomentObject = from._isAMomentObject;
  9086. }
  9087. if (!isUndefined(from._i)) {
  9088. to._i = from._i;
  9089. }
  9090. if (!isUndefined(from._f)) {
  9091. to._f = from._f;
  9092. }
  9093. if (!isUndefined(from._l)) {
  9094. to._l = from._l;
  9095. }
  9096. if (!isUndefined(from._strict)) {
  9097. to._strict = from._strict;
  9098. }
  9099. if (!isUndefined(from._tzm)) {
  9100. to._tzm = from._tzm;
  9101. }
  9102. if (!isUndefined(from._isUTC)) {
  9103. to._isUTC = from._isUTC;
  9104. }
  9105. if (!isUndefined(from._offset)) {
  9106. to._offset = from._offset;
  9107. }
  9108. if (!isUndefined(from._pf)) {
  9109. to._pf = getParsingFlags(from);
  9110. }
  9111. if (!isUndefined(from._locale)) {
  9112. to._locale = from._locale;
  9113. }
  9114. if (momentPropertiesLen > 0) {
  9115. for (i = 0; i < momentPropertiesLen; i++) {
  9116. prop = momentProperties[i];
  9117. val = from[prop];
  9118. if (!isUndefined(val)) {
  9119. to[prop] = val;
  9120. }
  9121. }
  9122. }
  9123. return to;
  9124. }
  9125. // Moment prototype object
  9126. function Moment(config) {
  9127. copyConfig(this, config);
  9128. this._d = new Date(config._d != null ? config._d.getTime() : NaN);
  9129. if (!this.isValid()) {
  9130. this._d = new Date(NaN);
  9131. }
  9132. // Prevent infinite loop in case updateOffset creates new moment
  9133. // objects.
  9134. if (updateInProgress === false) {
  9135. updateInProgress = true;
  9136. hooks.updateOffset(this);
  9137. updateInProgress = false;
  9138. }
  9139. }
  9140. function isMoment(obj) {
  9141. return (
  9142. obj instanceof Moment || (obj != null && obj._isAMomentObject != null)
  9143. );
  9144. }
  9145. function warn(msg) {
  9146. if (
  9147. hooks.suppressDeprecationWarnings === false &&
  9148. typeof console !== 'undefined' &&
  9149. console.warn
  9150. ) {
  9151. console.warn('Deprecation warning: ' + msg);
  9152. }
  9153. }
  9154. function deprecate(msg, fn) {
  9155. var firstTime = true;
  9156. return extend(function () {
  9157. if (hooks.deprecationHandler != null) {
  9158. hooks.deprecationHandler(null, msg);
  9159. }
  9160. if (firstTime) {
  9161. var args = [],
  9162. arg,
  9163. i,
  9164. key,
  9165. argLen = arguments.length;
  9166. for (i = 0; i < argLen; i++) {
  9167. arg = '';
  9168. if (typeof arguments[i] === 'object') {
  9169. arg += '\n[' + i + '] ';
  9170. for (key in arguments[0]) {
  9171. if (hasOwnProp(arguments[0], key)) {
  9172. arg += key + ': ' + arguments[0][key] + ', ';
  9173. }
  9174. }
  9175. arg = arg.slice(0, -2); // Remove trailing comma and space
  9176. } else {
  9177. arg = arguments[i];
  9178. }
  9179. args.push(arg);
  9180. }
  9181. warn(
  9182. msg +
  9183. '\nArguments: ' +
  9184. Array.prototype.slice.call(args).join('') +
  9185. '\n' +
  9186. new Error().stack
  9187. );
  9188. firstTime = false;
  9189. }
  9190. return fn.apply(this, arguments);
  9191. }, fn);
  9192. }
  9193. var deprecations = {};
  9194. function deprecateSimple(name, msg) {
  9195. if (hooks.deprecationHandler != null) {
  9196. hooks.deprecationHandler(name, msg);
  9197. }
  9198. if (!deprecations[name]) {
  9199. warn(msg);
  9200. deprecations[name] = true;
  9201. }
  9202. }
  9203. hooks.suppressDeprecationWarnings = false;
  9204. hooks.deprecationHandler = null;
  9205. function isFunction(input) {
  9206. return (
  9207. (typeof Function !== 'undefined' && input instanceof Function) ||
  9208. Object.prototype.toString.call(input) === '[object Function]'
  9209. );
  9210. }
  9211. function set(config) {
  9212. var prop, i;
  9213. for (i in config) {
  9214. if (hasOwnProp(config, i)) {
  9215. prop = config[i];
  9216. if (isFunction(prop)) {
  9217. this[i] = prop;
  9218. } else {
  9219. this['_' + i] = prop;
  9220. }
  9221. }
  9222. }
  9223. this._config = config;
  9224. // Lenient ordinal parsing accepts just a number in addition to
  9225. // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.
  9226. // TODO: Remove "ordinalParse" fallback in next major release.
  9227. this._dayOfMonthOrdinalParseLenient = new RegExp(
  9228. (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +
  9229. '|' +
  9230. /\d{1,2}/.source
  9231. );
  9232. }
  9233. function mergeConfigs(parentConfig, childConfig) {
  9234. var res = extend({}, parentConfig),
  9235. prop;
  9236. for (prop in childConfig) {
  9237. if (hasOwnProp(childConfig, prop)) {
  9238. if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
  9239. res[prop] = {};
  9240. extend(res[prop], parentConfig[prop]);
  9241. extend(res[prop], childConfig[prop]);
  9242. } else if (childConfig[prop] != null) {
  9243. res[prop] = childConfig[prop];
  9244. } else {
  9245. delete res[prop];
  9246. }
  9247. }
  9248. }
  9249. for (prop in parentConfig) {
  9250. if (
  9251. hasOwnProp(parentConfig, prop) &&
  9252. !hasOwnProp(childConfig, prop) &&
  9253. isObject(parentConfig[prop])
  9254. ) {
  9255. // make sure changes to properties don't modify parent config
  9256. res[prop] = extend({}, res[prop]);
  9257. }
  9258. }
  9259. return res;
  9260. }
  9261. function Locale(config) {
  9262. if (config != null) {
  9263. this.set(config);
  9264. }
  9265. }
  9266. var keys;
  9267. if (Object.keys) {
  9268. keys = Object.keys;
  9269. } else {
  9270. keys = function (obj) {
  9271. var i,
  9272. res = [];
  9273. for (i in obj) {
  9274. if (hasOwnProp(obj, i)) {
  9275. res.push(i);
  9276. }
  9277. }
  9278. return res;
  9279. };
  9280. }
  9281. var defaultCalendar = {
  9282. sameDay: '[Today at] LT',
  9283. nextDay: '[Tomorrow at] LT',
  9284. nextWeek: 'dddd [at] LT',
  9285. lastDay: '[Yesterday at] LT',
  9286. lastWeek: '[Last] dddd [at] LT',
  9287. sameElse: 'L',
  9288. };
  9289. function calendar(key, mom, now) {
  9290. var output = this._calendar[key] || this._calendar['sameElse'];
  9291. return isFunction(output) ? output.call(mom, now) : output;
  9292. }
  9293. function zeroFill(number, targetLength, forceSign) {
  9294. var absNumber = '' + Math.abs(number),
  9295. zerosToFill = targetLength - absNumber.length,
  9296. sign = number >= 0;
  9297. return (
  9298. (sign ? (forceSign ? '+' : '') : '-') +
  9299. Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) +
  9300. absNumber
  9301. );
  9302. }
  9303. var formattingTokens =
  9304. /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,
  9305. localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,
  9306. formatFunctions = {},
  9307. formatTokenFunctions = {};
  9308. // token: 'M'
  9309. // padded: ['MM', 2]
  9310. // ordinal: 'Mo'
  9311. // callback: function () { this.month() + 1 }
  9312. function addFormatToken(token, padded, ordinal, callback) {
  9313. var func = callback;
  9314. if (typeof callback === 'string') {
  9315. func = function () {
  9316. return this[callback]();
  9317. };
  9318. }
  9319. if (token) {
  9320. formatTokenFunctions[token] = func;
  9321. }
  9322. if (padded) {
  9323. formatTokenFunctions[padded[0]] = function () {
  9324. return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
  9325. };
  9326. }
  9327. if (ordinal) {
  9328. formatTokenFunctions[ordinal] = function () {
  9329. return this.localeData().ordinal(
  9330. func.apply(this, arguments),
  9331. token
  9332. );
  9333. };
  9334. }
  9335. }
  9336. function removeFormattingTokens(input) {
  9337. if (input.match(/\[[\s\S]/)) {
  9338. return input.replace(/^\[|\]$/g, '');
  9339. }
  9340. return input.replace(/\\/g, '');
  9341. }
  9342. function makeFormatFunction(format) {
  9343. var array = format.match(formattingTokens),
  9344. i,
  9345. length;
  9346. for (i = 0, length = array.length; i < length; i++) {
  9347. if (formatTokenFunctions[array[i]]) {
  9348. array[i] = formatTokenFunctions[array[i]];
  9349. } else {
  9350. array[i] = removeFormattingTokens(array[i]);
  9351. }
  9352. }
  9353. return function (mom) {
  9354. var output = '',
  9355. i;
  9356. for (i = 0; i < length; i++) {
  9357. output += isFunction(array[i])
  9358. ? array[i].call(mom, format)
  9359. : array[i];
  9360. }
  9361. return output;
  9362. };
  9363. }
  9364. // format date using native date object
  9365. function formatMoment(m, format) {
  9366. if (!m.isValid()) {
  9367. return m.localeData().invalidDate();
  9368. }
  9369. format = expandFormat(format, m.localeData());
  9370. formatFunctions[format] =
  9371. formatFunctions[format] || makeFormatFunction(format);
  9372. return formatFunctions[format](m);
  9373. }
  9374. function expandFormat(format, locale) {
  9375. var i = 5;
  9376. function replaceLongDateFormatTokens(input) {
  9377. return locale.longDateFormat(input) || input;
  9378. }
  9379. localFormattingTokens.lastIndex = 0;
  9380. while (i >= 0 && localFormattingTokens.test(format)) {
  9381. format = format.replace(
  9382. localFormattingTokens,
  9383. replaceLongDateFormatTokens
  9384. );
  9385. localFormattingTokens.lastIndex = 0;
  9386. i -= 1;
  9387. }
  9388. return format;
  9389. }
  9390. var defaultLongDateFormat = {
  9391. LTS: 'h:mm:ss A',
  9392. LT: 'h:mm A',
  9393. L: 'MM/DD/YYYY',
  9394. LL: 'MMMM D, YYYY',
  9395. LLL: 'MMMM D, YYYY h:mm A',
  9396. LLLL: 'dddd, MMMM D, YYYY h:mm A',
  9397. };
  9398. function longDateFormat(key) {
  9399. var format = this._longDateFormat[key],
  9400. formatUpper = this._longDateFormat[key.toUpperCase()];
  9401. if (format || !formatUpper) {
  9402. return format;
  9403. }
  9404. this._longDateFormat[key] = formatUpper
  9405. .match(formattingTokens)
  9406. .map(function (tok) {
  9407. if (
  9408. tok === 'MMMM' ||
  9409. tok === 'MM' ||
  9410. tok === 'DD' ||
  9411. tok === 'dddd'
  9412. ) {
  9413. return tok.slice(1);
  9414. }
  9415. return tok;
  9416. })
  9417. .join('');
  9418. return this._longDateFormat[key];
  9419. }
  9420. var defaultInvalidDate = 'Invalid date';
  9421. function invalidDate() {
  9422. return this._invalidDate;
  9423. }
  9424. var defaultOrdinal = '%d',
  9425. defaultDayOfMonthOrdinalParse = /\d{1,2}/;
  9426. function ordinal(number) {
  9427. return this._ordinal.replace('%d', number);
  9428. }
  9429. var defaultRelativeTime = {
  9430. future: 'in %s',
  9431. past: '%s ago',
  9432. s: 'a few seconds',
  9433. ss: '%d seconds',
  9434. m: 'a minute',
  9435. mm: '%d minutes',
  9436. h: 'an hour',
  9437. hh: '%d hours',
  9438. d: 'a day',
  9439. dd: '%d days',
  9440. w: 'a week',
  9441. ww: '%d weeks',
  9442. M: 'a month',
  9443. MM: '%d months',
  9444. y: 'a year',
  9445. yy: '%d years',
  9446. };
  9447. function relativeTime(number, withoutSuffix, string, isFuture) {
  9448. var output = this._relativeTime[string];
  9449. return isFunction(output)
  9450. ? output(number, withoutSuffix, string, isFuture)
  9451. : output.replace(/%d/i, number);
  9452. }
  9453. function pastFuture(diff, output) {
  9454. var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
  9455. return isFunction(format) ? format(output) : format.replace(/%s/i, output);
  9456. }
  9457. var aliases = {};
  9458. function addUnitAlias(unit, shorthand) {
  9459. var lowerCase = unit.toLowerCase();
  9460. aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
  9461. }
  9462. function normalizeUnits(units) {
  9463. return typeof units === 'string'
  9464. ? aliases[units] || aliases[units.toLowerCase()]
  9465. : undefined;
  9466. }
  9467. function normalizeObjectUnits(inputObject) {
  9468. var normalizedInput = {},
  9469. normalizedProp,
  9470. prop;
  9471. for (prop in inputObject) {
  9472. if (hasOwnProp(inputObject, prop)) {
  9473. normalizedProp = normalizeUnits(prop);
  9474. if (normalizedProp) {
  9475. normalizedInput[normalizedProp] = inputObject[prop];
  9476. }
  9477. }
  9478. }
  9479. return normalizedInput;
  9480. }
  9481. var priorities = {};
  9482. function addUnitPriority(unit, priority) {
  9483. priorities[unit] = priority;
  9484. }
  9485. function getPrioritizedUnits(unitsObj) {
  9486. var units = [],
  9487. u;
  9488. for (u in unitsObj) {
  9489. if (hasOwnProp(unitsObj, u)) {
  9490. units.push({ unit: u, priority: priorities[u] });
  9491. }
  9492. }
  9493. units.sort(function (a, b) {
  9494. return a.priority - b.priority;
  9495. });
  9496. return units;
  9497. }
  9498. function isLeapYear(year) {
  9499. return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
  9500. }
  9501. function absFloor(number) {
  9502. if (number < 0) {
  9503. // -0 -> 0
  9504. return Math.ceil(number) || 0;
  9505. } else {
  9506. return Math.floor(number);
  9507. }
  9508. }
  9509. function toInt(argumentForCoercion) {
  9510. var coercedNumber = +argumentForCoercion,
  9511. value = 0;
  9512. if (coercedNumber !== 0 && isFinite(coercedNumber)) {
  9513. value = absFloor(coercedNumber);
  9514. }
  9515. return value;
  9516. }
  9517. function makeGetSet(unit, keepTime) {
  9518. return function (value) {
  9519. if (value != null) {
  9520. set$1(this, unit, value);
  9521. hooks.updateOffset(this, keepTime);
  9522. return this;
  9523. } else {
  9524. return get(this, unit);
  9525. }
  9526. };
  9527. }
  9528. function get(mom, unit) {
  9529. return mom.isValid()
  9530. ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]()
  9531. : NaN;
  9532. }
  9533. function set$1(mom, unit, value) {
  9534. if (mom.isValid() && !isNaN(value)) {
  9535. if (
  9536. unit === 'FullYear' &&
  9537. isLeapYear(mom.year()) &&
  9538. mom.month() === 1 &&
  9539. mom.date() === 29
  9540. ) {
  9541. value = toInt(value);
  9542. mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](
  9543. value,
  9544. mom.month(),
  9545. daysInMonth(value, mom.month())
  9546. );
  9547. } else {
  9548. mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
  9549. }
  9550. }
  9551. }
  9552. // MOMENTS
  9553. function stringGet(units) {
  9554. units = normalizeUnits(units);
  9555. if (isFunction(this[units])) {
  9556. return this[units]();
  9557. }
  9558. return this;
  9559. }
  9560. function stringSet(units, value) {
  9561. if (typeof units === 'object') {
  9562. units = normalizeObjectUnits(units);
  9563. var prioritized = getPrioritizedUnits(units),
  9564. i,
  9565. prioritizedLen = prioritized.length;
  9566. for (i = 0; i < prioritizedLen; i++) {
  9567. this[prioritized[i].unit](units[prioritized[i].unit]);
  9568. }
  9569. } else {
  9570. units = normalizeUnits(units);
  9571. if (isFunction(this[units])) {
  9572. return this[units](value);
  9573. }
  9574. }
  9575. return this;
  9576. }
  9577. var match1 = /\d/, // 0 - 9
  9578. match2 = /\d\d/, // 00 - 99
  9579. match3 = /\d{3}/, // 000 - 999
  9580. match4 = /\d{4}/, // 0000 - 9999
  9581. match6 = /[+-]?\d{6}/, // -999999 - 999999
  9582. match1to2 = /\d\d?/, // 0 - 99
  9583. match3to4 = /\d\d\d\d?/, // 999 - 9999
  9584. match5to6 = /\d\d\d\d\d\d?/, // 99999 - 999999
  9585. match1to3 = /\d{1,3}/, // 0 - 999
  9586. match1to4 = /\d{1,4}/, // 0 - 9999
  9587. match1to6 = /[+-]?\d{1,6}/, // -999999 - 999999
  9588. matchUnsigned = /\d+/, // 0 - inf
  9589. matchSigned = /[+-]?\d+/, // -inf - inf
  9590. matchOffset = /Z|[+-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z
  9591. matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z
  9592. matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123
  9593. // any word (or two) characters or numbers including two/three word month in arabic.
  9594. // includes scottish gaelic two word and hyphenated months
  9595. matchWord =
  9596. /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,
  9597. regexes;
  9598. regexes = {};
  9599. function addRegexToken(token, regex, strictRegex) {
  9600. regexes[token] = isFunction(regex)
  9601. ? regex
  9602. : function (isStrict, localeData) {
  9603. return isStrict && strictRegex ? strictRegex : regex;
  9604. };
  9605. }
  9606. function getParseRegexForToken(token, config) {
  9607. if (!hasOwnProp(regexes, token)) {
  9608. return new RegExp(unescapeFormat(token));
  9609. }
  9610. return regexes[token](config._strict, config._locale);
  9611. }
  9612. // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
  9613. function unescapeFormat(s) {
  9614. return regexEscape(
  9615. s
  9616. .replace('\\', '')
  9617. .replace(
  9618. /\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,
  9619. function (matched, p1, p2, p3, p4) {
  9620. return p1 || p2 || p3 || p4;
  9621. }
  9622. )
  9623. );
  9624. }
  9625. function regexEscape(s) {
  9626. return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  9627. }
  9628. var tokens = {};
  9629. function addParseToken(token, callback) {
  9630. var i,
  9631. func = callback,
  9632. tokenLen;
  9633. if (typeof token === 'string') {
  9634. token = [token];
  9635. }
  9636. if (isNumber(callback)) {
  9637. func = function (input, array) {
  9638. array[callback] = toInt(input);
  9639. };
  9640. }
  9641. tokenLen = token.length;
  9642. for (i = 0; i < tokenLen; i++) {
  9643. tokens[token[i]] = func;
  9644. }
  9645. }
  9646. function addWeekParseToken(token, callback) {
  9647. addParseToken(token, function (input, array, config, token) {
  9648. config._w = config._w || {};
  9649. callback(input, config._w, config, token);
  9650. });
  9651. }
  9652. function addTimeToArrayFromToken(token, input, config) {
  9653. if (input != null && hasOwnProp(tokens, token)) {
  9654. tokens[token](input, config._a, config, token);
  9655. }
  9656. }
  9657. var YEAR = 0,
  9658. MONTH = 1,
  9659. DATE = 2,
  9660. HOUR = 3,
  9661. MINUTE = 4,
  9662. SECOND = 5,
  9663. MILLISECOND = 6,
  9664. WEEK = 7,
  9665. WEEKDAY = 8;
  9666. function mod(n, x) {
  9667. return ((n % x) + x) % x;
  9668. }
  9669. var indexOf;
  9670. if (Array.prototype.indexOf) {
  9671. indexOf = Array.prototype.indexOf;
  9672. } else {
  9673. indexOf = function (o) {
  9674. // I know
  9675. var i;
  9676. for (i = 0; i < this.length; ++i) {
  9677. if (this[i] === o) {
  9678. return i;
  9679. }
  9680. }
  9681. return -1;
  9682. };
  9683. }
  9684. function daysInMonth(year, month) {
  9685. if (isNaN(year) || isNaN(month)) {
  9686. return NaN;
  9687. }
  9688. var modMonth = mod(month, 12);
  9689. year += (month - modMonth) / 12;
  9690. return modMonth === 1
  9691. ? isLeapYear(year)
  9692. ? 29
  9693. : 28
  9694. : 31 - ((modMonth % 7) % 2);
  9695. }
  9696. // FORMATTING
  9697. addFormatToken('M', ['MM', 2], 'Mo', function () {
  9698. return this.month() + 1;
  9699. });
  9700. addFormatToken('MMM', 0, 0, function (format) {
  9701. return this.localeData().monthsShort(this, format);
  9702. });
  9703. addFormatToken('MMMM', 0, 0, function (format) {
  9704. return this.localeData().months(this, format);
  9705. });
  9706. // ALIASES
  9707. addUnitAlias('month', 'M');
  9708. // PRIORITY
  9709. addUnitPriority('month', 8);
  9710. // PARSING
  9711. addRegexToken('M', match1to2);
  9712. addRegexToken('MM', match1to2, match2);
  9713. addRegexToken('MMM', function (isStrict, locale) {
  9714. return locale.monthsShortRegex(isStrict);
  9715. });
  9716. addRegexToken('MMMM', function (isStrict, locale) {
  9717. return locale.monthsRegex(isStrict);
  9718. });
  9719. addParseToken(['M', 'MM'], function (input, array) {
  9720. array[MONTH] = toInt(input) - 1;
  9721. });
  9722. addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
  9723. var month = config._locale.monthsParse(input, token, config._strict);
  9724. // if we didn't find a month name, mark the date as invalid.
  9725. if (month != null) {
  9726. array[MONTH] = month;
  9727. } else {
  9728. getParsingFlags(config).invalidMonth = input;
  9729. }
  9730. });
  9731. // LOCALES
  9732. var defaultLocaleMonths =
  9733. 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
  9734. '_'
  9735. ),
  9736. defaultLocaleMonthsShort =
  9737. 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
  9738. MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,
  9739. defaultMonthsShortRegex = matchWord,
  9740. defaultMonthsRegex = matchWord;
  9741. function localeMonths(m, format) {
  9742. if (!m) {
  9743. return isArray(this._months)
  9744. ? this._months
  9745. : this._months['standalone'];
  9746. }
  9747. return isArray(this._months)
  9748. ? this._months[m.month()]
  9749. : this._months[
  9750. (this._months.isFormat || MONTHS_IN_FORMAT).test(format)
  9751. ? 'format'
  9752. : 'standalone'
  9753. ][m.month()];
  9754. }
  9755. function localeMonthsShort(m, format) {
  9756. if (!m) {
  9757. return isArray(this._monthsShort)
  9758. ? this._monthsShort
  9759. : this._monthsShort['standalone'];
  9760. }
  9761. return isArray(this._monthsShort)
  9762. ? this._monthsShort[m.month()]
  9763. : this._monthsShort[
  9764. MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'
  9765. ][m.month()];
  9766. }
  9767. function handleStrictParse(monthName, format, strict) {
  9768. var i,
  9769. ii,
  9770. mom,
  9771. llc = monthName.toLocaleLowerCase();
  9772. if (!this._monthsParse) {
  9773. // this is not used
  9774. this._monthsParse = [];
  9775. this._longMonthsParse = [];
  9776. this._shortMonthsParse = [];
  9777. for (i = 0; i < 12; ++i) {
  9778. mom = createUTC([2000, i]);
  9779. this._shortMonthsParse[i] = this.monthsShort(
  9780. mom,
  9781. ''
  9782. ).toLocaleLowerCase();
  9783. this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
  9784. }
  9785. }
  9786. if (strict) {
  9787. if (format === 'MMM') {
  9788. ii = indexOf.call(this._shortMonthsParse, llc);
  9789. return ii !== -1 ? ii : null;
  9790. } else {
  9791. ii = indexOf.call(this._longMonthsParse, llc);
  9792. return ii !== -1 ? ii : null;
  9793. }
  9794. } else {
  9795. if (format === 'MMM') {
  9796. ii = indexOf.call(this._shortMonthsParse, llc);
  9797. if (ii !== -1) {
  9798. return ii;
  9799. }
  9800. ii = indexOf.call(this._longMonthsParse, llc);
  9801. return ii !== -1 ? ii : null;
  9802. } else {
  9803. ii = indexOf.call(this._longMonthsParse, llc);
  9804. if (ii !== -1) {
  9805. return ii;
  9806. }
  9807. ii = indexOf.call(this._shortMonthsParse, llc);
  9808. return ii !== -1 ? ii : null;
  9809. }
  9810. }
  9811. }
  9812. function localeMonthsParse(monthName, format, strict) {
  9813. var i, mom, regex;
  9814. if (this._monthsParseExact) {
  9815. return handleStrictParse.call(this, monthName, format, strict);
  9816. }
  9817. if (!this._monthsParse) {
  9818. this._monthsParse = [];
  9819. this._longMonthsParse = [];
  9820. this._shortMonthsParse = [];
  9821. }
  9822. // TODO: add sorting
  9823. // Sorting makes sure if one month (or abbr) is a prefix of another
  9824. // see sorting in computeMonthsParse
  9825. for (i = 0; i < 12; i++) {
  9826. // make the regex if we don't have it already
  9827. mom = createUTC([2000, i]);
  9828. if (strict && !this._longMonthsParse[i]) {
  9829. this._longMonthsParse[i] = new RegExp(
  9830. '^' + this.months(mom, '').replace('.', '') + '$',
  9831. 'i'
  9832. );
  9833. this._shortMonthsParse[i] = new RegExp(
  9834. '^' + this.monthsShort(mom, '').replace('.', '') + '$',
  9835. 'i'
  9836. );
  9837. }
  9838. if (!strict && !this._monthsParse[i]) {
  9839. regex =
  9840. '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
  9841. this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
  9842. }
  9843. // test the regex
  9844. if (
  9845. strict &&
  9846. format === 'MMMM' &&
  9847. this._longMonthsParse[i].test(monthName)
  9848. ) {
  9849. return i;
  9850. } else if (
  9851. strict &&
  9852. format === 'MMM' &&
  9853. this._shortMonthsParse[i].test(monthName)
  9854. ) {
  9855. return i;
  9856. } else if (!strict && this._monthsParse[i].test(monthName)) {
  9857. return i;
  9858. }
  9859. }
  9860. }
  9861. // MOMENTS
  9862. function setMonth(mom, value) {
  9863. var dayOfMonth;
  9864. if (!mom.isValid()) {
  9865. // No op
  9866. return mom;
  9867. }
  9868. if (typeof value === 'string') {
  9869. if (/^\d+$/.test(value)) {
  9870. value = toInt(value);
  9871. } else {
  9872. value = mom.localeData().monthsParse(value);
  9873. // TODO: Another silent failure?
  9874. if (!isNumber(value)) {
  9875. return mom;
  9876. }
  9877. }
  9878. }
  9879. dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
  9880. mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
  9881. return mom;
  9882. }
  9883. function getSetMonth(value) {
  9884. if (value != null) {
  9885. setMonth(this, value);
  9886. hooks.updateOffset(this, true);
  9887. return this;
  9888. } else {
  9889. return get(this, 'Month');
  9890. }
  9891. }
  9892. function getDaysInMonth() {
  9893. return daysInMonth(this.year(), this.month());
  9894. }
  9895. function monthsShortRegex(isStrict) {
  9896. if (this._monthsParseExact) {
  9897. if (!hasOwnProp(this, '_monthsRegex')) {
  9898. computeMonthsParse.call(this);
  9899. }
  9900. if (isStrict) {
  9901. return this._monthsShortStrictRegex;
  9902. } else {
  9903. return this._monthsShortRegex;
  9904. }
  9905. } else {
  9906. if (!hasOwnProp(this, '_monthsShortRegex')) {
  9907. this._monthsShortRegex = defaultMonthsShortRegex;
  9908. }
  9909. return this._monthsShortStrictRegex && isStrict
  9910. ? this._monthsShortStrictRegex
  9911. : this._monthsShortRegex;
  9912. }
  9913. }
  9914. function monthsRegex(isStrict) {
  9915. if (this._monthsParseExact) {
  9916. if (!hasOwnProp(this, '_monthsRegex')) {
  9917. computeMonthsParse.call(this);
  9918. }
  9919. if (isStrict) {
  9920. return this._monthsStrictRegex;
  9921. } else {
  9922. return this._monthsRegex;
  9923. }
  9924. } else {
  9925. if (!hasOwnProp(this, '_monthsRegex')) {
  9926. this._monthsRegex = defaultMonthsRegex;
  9927. }
  9928. return this._monthsStrictRegex && isStrict
  9929. ? this._monthsStrictRegex
  9930. : this._monthsRegex;
  9931. }
  9932. }
  9933. function computeMonthsParse() {
  9934. function cmpLenRev(a, b) {
  9935. return b.length - a.length;
  9936. }
  9937. var shortPieces = [],
  9938. longPieces = [],
  9939. mixedPieces = [],
  9940. i,
  9941. mom;
  9942. for (i = 0; i < 12; i++) {
  9943. // make the regex if we don't have it already
  9944. mom = createUTC([2000, i]);
  9945. shortPieces.push(this.monthsShort(mom, ''));
  9946. longPieces.push(this.months(mom, ''));
  9947. mixedPieces.push(this.months(mom, ''));
  9948. mixedPieces.push(this.monthsShort(mom, ''));
  9949. }
  9950. // Sorting makes sure if one month (or abbr) is a prefix of another it
  9951. // will match the longer piece.
  9952. shortPieces.sort(cmpLenRev);
  9953. longPieces.sort(cmpLenRev);
  9954. mixedPieces.sort(cmpLenRev);
  9955. for (i = 0; i < 12; i++) {
  9956. shortPieces[i] = regexEscape(shortPieces[i]);
  9957. longPieces[i] = regexEscape(longPieces[i]);
  9958. }
  9959. for (i = 0; i < 24; i++) {
  9960. mixedPieces[i] = regexEscape(mixedPieces[i]);
  9961. }
  9962. this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  9963. this._monthsShortRegex = this._monthsRegex;
  9964. this._monthsStrictRegex = new RegExp(
  9965. '^(' + longPieces.join('|') + ')',
  9966. 'i'
  9967. );
  9968. this._monthsShortStrictRegex = new RegExp(
  9969. '^(' + shortPieces.join('|') + ')',
  9970. 'i'
  9971. );
  9972. }
  9973. // FORMATTING
  9974. addFormatToken('Y', 0, 0, function () {
  9975. var y = this.year();
  9976. return y <= 9999 ? zeroFill(y, 4) : '+' + y;
  9977. });
  9978. addFormatToken(0, ['YY', 2], 0, function () {
  9979. return this.year() % 100;
  9980. });
  9981. addFormatToken(0, ['YYYY', 4], 0, 'year');
  9982. addFormatToken(0, ['YYYYY', 5], 0, 'year');
  9983. addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
  9984. // ALIASES
  9985. addUnitAlias('year', 'y');
  9986. // PRIORITIES
  9987. addUnitPriority('year', 1);
  9988. // PARSING
  9989. addRegexToken('Y', matchSigned);
  9990. addRegexToken('YY', match1to2, match2);
  9991. addRegexToken('YYYY', match1to4, match4);
  9992. addRegexToken('YYYYY', match1to6, match6);
  9993. addRegexToken('YYYYYY', match1to6, match6);
  9994. addParseToken(['YYYYY', 'YYYYYY'], YEAR);
  9995. addParseToken('YYYY', function (input, array) {
  9996. array[YEAR] =
  9997. input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
  9998. });
  9999. addParseToken('YY', function (input, array) {
  10000. array[YEAR] = hooks.parseTwoDigitYear(input);
  10001. });
  10002. addParseToken('Y', function (input, array) {
  10003. array[YEAR] = parseInt(input, 10);
  10004. });
  10005. // HELPERS
  10006. function daysInYear(year) {
  10007. return isLeapYear(year) ? 366 : 365;
  10008. }
  10009. // HOOKS
  10010. hooks.parseTwoDigitYear = function (input) {
  10011. return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
  10012. };
  10013. // MOMENTS
  10014. var getSetYear = makeGetSet('FullYear', true);
  10015. function getIsLeapYear() {
  10016. return isLeapYear(this.year());
  10017. }
  10018. function createDate(y, m, d, h, M, s, ms) {
  10019. // can't just apply() to create a date:
  10020. // https://stackoverflow.com/q/181348
  10021. var date;
  10022. // the date constructor remaps years 0-99 to 1900-1999
  10023. if (y < 100 && y >= 0) {
  10024. // preserve leap years using a full 400 year cycle, then reset
  10025. date = new Date(y + 400, m, d, h, M, s, ms);
  10026. if (isFinite(date.getFullYear())) {
  10027. date.setFullYear(y);
  10028. }
  10029. } else {
  10030. date = new Date(y, m, d, h, M, s, ms);
  10031. }
  10032. return date;
  10033. }
  10034. function createUTCDate(y) {
  10035. var date, args;
  10036. // the Date.UTC function remaps years 0-99 to 1900-1999
  10037. if (y < 100 && y >= 0) {
  10038. args = Array.prototype.slice.call(arguments);
  10039. // preserve leap years using a full 400 year cycle, then reset
  10040. args[0] = y + 400;
  10041. date = new Date(Date.UTC.apply(null, args));
  10042. if (isFinite(date.getUTCFullYear())) {
  10043. date.setUTCFullYear(y);
  10044. }
  10045. } else {
  10046. date = new Date(Date.UTC.apply(null, arguments));
  10047. }
  10048. return date;
  10049. }
  10050. // start-of-first-week - start-of-year
  10051. function firstWeekOffset(year, dow, doy) {
  10052. var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
  10053. fwd = 7 + dow - doy,
  10054. // first-week day local weekday -- which local weekday is fwd
  10055. fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
  10056. return -fwdlw + fwd - 1;
  10057. }
  10058. // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
  10059. function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
  10060. var localWeekday = (7 + weekday - dow) % 7,
  10061. weekOffset = firstWeekOffset(year, dow, doy),
  10062. dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
  10063. resYear,
  10064. resDayOfYear;
  10065. if (dayOfYear <= 0) {
  10066. resYear = year - 1;
  10067. resDayOfYear = daysInYear(resYear) + dayOfYear;
  10068. } else if (dayOfYear > daysInYear(year)) {
  10069. resYear = year + 1;
  10070. resDayOfYear = dayOfYear - daysInYear(year);
  10071. } else {
  10072. resYear = year;
  10073. resDayOfYear = dayOfYear;
  10074. }
  10075. return {
  10076. year: resYear,
  10077. dayOfYear: resDayOfYear,
  10078. };
  10079. }
  10080. function weekOfYear(mom, dow, doy) {
  10081. var weekOffset = firstWeekOffset(mom.year(), dow, doy),
  10082. week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
  10083. resWeek,
  10084. resYear;
  10085. if (week < 1) {
  10086. resYear = mom.year() - 1;
  10087. resWeek = week + weeksInYear(resYear, dow, doy);
  10088. } else if (week > weeksInYear(mom.year(), dow, doy)) {
  10089. resWeek = week - weeksInYear(mom.year(), dow, doy);
  10090. resYear = mom.year() + 1;
  10091. } else {
  10092. resYear = mom.year();
  10093. resWeek = week;
  10094. }
  10095. return {
  10096. week: resWeek,
  10097. year: resYear,
  10098. };
  10099. }
  10100. function weeksInYear(year, dow, doy) {
  10101. var weekOffset = firstWeekOffset(year, dow, doy),
  10102. weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
  10103. return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
  10104. }
  10105. // FORMATTING
  10106. addFormatToken('w', ['ww', 2], 'wo', 'week');
  10107. addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
  10108. // ALIASES
  10109. addUnitAlias('week', 'w');
  10110. addUnitAlias('isoWeek', 'W');
  10111. // PRIORITIES
  10112. addUnitPriority('week', 5);
  10113. addUnitPriority('isoWeek', 5);
  10114. // PARSING
  10115. addRegexToken('w', match1to2);
  10116. addRegexToken('ww', match1to2, match2);
  10117. addRegexToken('W', match1to2);
  10118. addRegexToken('WW', match1to2, match2);
  10119. addWeekParseToken(
  10120. ['w', 'ww', 'W', 'WW'],
  10121. function (input, week, config, token) {
  10122. week[token.substr(0, 1)] = toInt(input);
  10123. }
  10124. );
  10125. // HELPERS
  10126. // LOCALES
  10127. function localeWeek(mom) {
  10128. return weekOfYear(mom, this._week.dow, this._week.doy).week;
  10129. }
  10130. var defaultLocaleWeek = {
  10131. dow: 0, // Sunday is the first day of the week.
  10132. doy: 6, // The week that contains Jan 6th is the first week of the year.
  10133. };
  10134. function localeFirstDayOfWeek() {
  10135. return this._week.dow;
  10136. }
  10137. function localeFirstDayOfYear() {
  10138. return this._week.doy;
  10139. }
  10140. // MOMENTS
  10141. function getSetWeek(input) {
  10142. var week = this.localeData().week(this);
  10143. return input == null ? week : this.add((input - week) * 7, 'd');
  10144. }
  10145. function getSetISOWeek(input) {
  10146. var week = weekOfYear(this, 1, 4).week;
  10147. return input == null ? week : this.add((input - week) * 7, 'd');
  10148. }
  10149. // FORMATTING
  10150. addFormatToken('d', 0, 'do', 'day');
  10151. addFormatToken('dd', 0, 0, function (format) {
  10152. return this.localeData().weekdaysMin(this, format);
  10153. });
  10154. addFormatToken('ddd', 0, 0, function (format) {
  10155. return this.localeData().weekdaysShort(this, format);
  10156. });
  10157. addFormatToken('dddd', 0, 0, function (format) {
  10158. return this.localeData().weekdays(this, format);
  10159. });
  10160. addFormatToken('e', 0, 0, 'weekday');
  10161. addFormatToken('E', 0, 0, 'isoWeekday');
  10162. // ALIASES
  10163. addUnitAlias('day', 'd');
  10164. addUnitAlias('weekday', 'e');
  10165. addUnitAlias('isoWeekday', 'E');
  10166. // PRIORITY
  10167. addUnitPriority('day', 11);
  10168. addUnitPriority('weekday', 11);
  10169. addUnitPriority('isoWeekday', 11);
  10170. // PARSING
  10171. addRegexToken('d', match1to2);
  10172. addRegexToken('e', match1to2);
  10173. addRegexToken('E', match1to2);
  10174. addRegexToken('dd', function (isStrict, locale) {
  10175. return locale.weekdaysMinRegex(isStrict);
  10176. });
  10177. addRegexToken('ddd', function (isStrict, locale) {
  10178. return locale.weekdaysShortRegex(isStrict);
  10179. });
  10180. addRegexToken('dddd', function (isStrict, locale) {
  10181. return locale.weekdaysRegex(isStrict);
  10182. });
  10183. addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
  10184. var weekday = config._locale.weekdaysParse(input, token, config._strict);
  10185. // if we didn't get a weekday name, mark the date as invalid
  10186. if (weekday != null) {
  10187. week.d = weekday;
  10188. } else {
  10189. getParsingFlags(config).invalidWeekday = input;
  10190. }
  10191. });
  10192. addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
  10193. week[token] = toInt(input);
  10194. });
  10195. // HELPERS
  10196. function parseWeekday(input, locale) {
  10197. if (typeof input !== 'string') {
  10198. return input;
  10199. }
  10200. if (!isNaN(input)) {
  10201. return parseInt(input, 10);
  10202. }
  10203. input = locale.weekdaysParse(input);
  10204. if (typeof input === 'number') {
  10205. return input;
  10206. }
  10207. return null;
  10208. }
  10209. function parseIsoWeekday(input, locale) {
  10210. if (typeof input === 'string') {
  10211. return locale.weekdaysParse(input) % 7 || 7;
  10212. }
  10213. return isNaN(input) ? null : input;
  10214. }
  10215. // LOCALES
  10216. function shiftWeekdays(ws, n) {
  10217. return ws.slice(n, 7).concat(ws.slice(0, n));
  10218. }
  10219. var defaultLocaleWeekdays =
  10220. 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
  10221. defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
  10222. defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
  10223. defaultWeekdaysRegex = matchWord,
  10224. defaultWeekdaysShortRegex = matchWord,
  10225. defaultWeekdaysMinRegex = matchWord;
  10226. function localeWeekdays(m, format) {
  10227. var weekdays = isArray(this._weekdays)
  10228. ? this._weekdays
  10229. : this._weekdays[
  10230. m && m !== true && this._weekdays.isFormat.test(format)
  10231. ? 'format'
  10232. : 'standalone'
  10233. ];
  10234. return m === true
  10235. ? shiftWeekdays(weekdays, this._week.dow)
  10236. : m
  10237. ? weekdays[m.day()]
  10238. : weekdays;
  10239. }
  10240. function localeWeekdaysShort(m) {
  10241. return m === true
  10242. ? shiftWeekdays(this._weekdaysShort, this._week.dow)
  10243. : m
  10244. ? this._weekdaysShort[m.day()]
  10245. : this._weekdaysShort;
  10246. }
  10247. function localeWeekdaysMin(m) {
  10248. return m === true
  10249. ? shiftWeekdays(this._weekdaysMin, this._week.dow)
  10250. : m
  10251. ? this._weekdaysMin[m.day()]
  10252. : this._weekdaysMin;
  10253. }
  10254. function handleStrictParse$1(weekdayName, format, strict) {
  10255. var i,
  10256. ii,
  10257. mom,
  10258. llc = weekdayName.toLocaleLowerCase();
  10259. if (!this._weekdaysParse) {
  10260. this._weekdaysParse = [];
  10261. this._shortWeekdaysParse = [];
  10262. this._minWeekdaysParse = [];
  10263. for (i = 0; i < 7; ++i) {
  10264. mom = createUTC([2000, 1]).day(i);
  10265. this._minWeekdaysParse[i] = this.weekdaysMin(
  10266. mom,
  10267. ''
  10268. ).toLocaleLowerCase();
  10269. this._shortWeekdaysParse[i] = this.weekdaysShort(
  10270. mom,
  10271. ''
  10272. ).toLocaleLowerCase();
  10273. this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
  10274. }
  10275. }
  10276. if (strict) {
  10277. if (format === 'dddd') {
  10278. ii = indexOf.call(this._weekdaysParse, llc);
  10279. return ii !== -1 ? ii : null;
  10280. } else if (format === 'ddd') {
  10281. ii = indexOf.call(this._shortWeekdaysParse, llc);
  10282. return ii !== -1 ? ii : null;
  10283. } else {
  10284. ii = indexOf.call(this._minWeekdaysParse, llc);
  10285. return ii !== -1 ? ii : null;
  10286. }
  10287. } else {
  10288. if (format === 'dddd') {
  10289. ii = indexOf.call(this._weekdaysParse, llc);
  10290. if (ii !== -1) {
  10291. return ii;
  10292. }
  10293. ii = indexOf.call(this._shortWeekdaysParse, llc);
  10294. if (ii !== -1) {
  10295. return ii;
  10296. }
  10297. ii = indexOf.call(this._minWeekdaysParse, llc);
  10298. return ii !== -1 ? ii : null;
  10299. } else if (format === 'ddd') {
  10300. ii = indexOf.call(this._shortWeekdaysParse, llc);
  10301. if (ii !== -1) {
  10302. return ii;
  10303. }
  10304. ii = indexOf.call(this._weekdaysParse, llc);
  10305. if (ii !== -1) {
  10306. return ii;
  10307. }
  10308. ii = indexOf.call(this._minWeekdaysParse, llc);
  10309. return ii !== -1 ? ii : null;
  10310. } else {
  10311. ii = indexOf.call(this._minWeekdaysParse, llc);
  10312. if (ii !== -1) {
  10313. return ii;
  10314. }
  10315. ii = indexOf.call(this._weekdaysParse, llc);
  10316. if (ii !== -1) {
  10317. return ii;
  10318. }
  10319. ii = indexOf.call(this._shortWeekdaysParse, llc);
  10320. return ii !== -1 ? ii : null;
  10321. }
  10322. }
  10323. }
  10324. function localeWeekdaysParse(weekdayName, format, strict) {
  10325. var i, mom, regex;
  10326. if (this._weekdaysParseExact) {
  10327. return handleStrictParse$1.call(this, weekdayName, format, strict);
  10328. }
  10329. if (!this._weekdaysParse) {
  10330. this._weekdaysParse = [];
  10331. this._minWeekdaysParse = [];
  10332. this._shortWeekdaysParse = [];
  10333. this._fullWeekdaysParse = [];
  10334. }
  10335. for (i = 0; i < 7; i++) {
  10336. // make the regex if we don't have it already
  10337. mom = createUTC([2000, 1]).day(i);
  10338. if (strict && !this._fullWeekdaysParse[i]) {
  10339. this._fullWeekdaysParse[i] = new RegExp(
  10340. '^' + this.weekdays(mom, '').replace('.', '\\.?') + '$',
  10341. 'i'
  10342. );
  10343. this._shortWeekdaysParse[i] = new RegExp(
  10344. '^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$',
  10345. 'i'
  10346. );
  10347. this._minWeekdaysParse[i] = new RegExp(
  10348. '^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$',
  10349. 'i'
  10350. );
  10351. }
  10352. if (!this._weekdaysParse[i]) {
  10353. regex =
  10354. '^' +
  10355. this.weekdays(mom, '') +
  10356. '|^' +
  10357. this.weekdaysShort(mom, '') +
  10358. '|^' +
  10359. this.weekdaysMin(mom, '');
  10360. this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
  10361. }
  10362. // test the regex
  10363. if (
  10364. strict &&
  10365. format === 'dddd' &&
  10366. this._fullWeekdaysParse[i].test(weekdayName)
  10367. ) {
  10368. return i;
  10369. } else if (
  10370. strict &&
  10371. format === 'ddd' &&
  10372. this._shortWeekdaysParse[i].test(weekdayName)
  10373. ) {
  10374. return i;
  10375. } else if (
  10376. strict &&
  10377. format === 'dd' &&
  10378. this._minWeekdaysParse[i].test(weekdayName)
  10379. ) {
  10380. return i;
  10381. } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
  10382. return i;
  10383. }
  10384. }
  10385. }
  10386. // MOMENTS
  10387. function getSetDayOfWeek(input) {
  10388. if (!this.isValid()) {
  10389. return input != null ? this : NaN;
  10390. }
  10391. var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
  10392. if (input != null) {
  10393. input = parseWeekday(input, this.localeData());
  10394. return this.add(input - day, 'd');
  10395. } else {
  10396. return day;
  10397. }
  10398. }
  10399. function getSetLocaleDayOfWeek(input) {
  10400. if (!this.isValid()) {
  10401. return input != null ? this : NaN;
  10402. }
  10403. var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
  10404. return input == null ? weekday : this.add(input - weekday, 'd');
  10405. }
  10406. function getSetISODayOfWeek(input) {
  10407. if (!this.isValid()) {
  10408. return input != null ? this : NaN;
  10409. }
  10410. // behaves the same as moment#day except
  10411. // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
  10412. // as a setter, sunday should belong to the previous week.
  10413. if (input != null) {
  10414. var weekday = parseIsoWeekday(input, this.localeData());
  10415. return this.day(this.day() % 7 ? weekday : weekday - 7);
  10416. } else {
  10417. return this.day() || 7;
  10418. }
  10419. }
  10420. function weekdaysRegex(isStrict) {
  10421. if (this._weekdaysParseExact) {
  10422. if (!hasOwnProp(this, '_weekdaysRegex')) {
  10423. computeWeekdaysParse.call(this);
  10424. }
  10425. if (isStrict) {
  10426. return this._weekdaysStrictRegex;
  10427. } else {
  10428. return this._weekdaysRegex;
  10429. }
  10430. } else {
  10431. if (!hasOwnProp(this, '_weekdaysRegex')) {
  10432. this._weekdaysRegex = defaultWeekdaysRegex;
  10433. }
  10434. return this._weekdaysStrictRegex && isStrict
  10435. ? this._weekdaysStrictRegex
  10436. : this._weekdaysRegex;
  10437. }
  10438. }
  10439. function weekdaysShortRegex(isStrict) {
  10440. if (this._weekdaysParseExact) {
  10441. if (!hasOwnProp(this, '_weekdaysRegex')) {
  10442. computeWeekdaysParse.call(this);
  10443. }
  10444. if (isStrict) {
  10445. return this._weekdaysShortStrictRegex;
  10446. } else {
  10447. return this._weekdaysShortRegex;
  10448. }
  10449. } else {
  10450. if (!hasOwnProp(this, '_weekdaysShortRegex')) {
  10451. this._weekdaysShortRegex = defaultWeekdaysShortRegex;
  10452. }
  10453. return this._weekdaysShortStrictRegex && isStrict
  10454. ? this._weekdaysShortStrictRegex
  10455. : this._weekdaysShortRegex;
  10456. }
  10457. }
  10458. function weekdaysMinRegex(isStrict) {
  10459. if (this._weekdaysParseExact) {
  10460. if (!hasOwnProp(this, '_weekdaysRegex')) {
  10461. computeWeekdaysParse.call(this);
  10462. }
  10463. if (isStrict) {
  10464. return this._weekdaysMinStrictRegex;
  10465. } else {
  10466. return this._weekdaysMinRegex;
  10467. }
  10468. } else {
  10469. if (!hasOwnProp(this, '_weekdaysMinRegex')) {
  10470. this._weekdaysMinRegex = defaultWeekdaysMinRegex;
  10471. }
  10472. return this._weekdaysMinStrictRegex && isStrict
  10473. ? this._weekdaysMinStrictRegex
  10474. : this._weekdaysMinRegex;
  10475. }
  10476. }
  10477. function computeWeekdaysParse() {
  10478. function cmpLenRev(a, b) {
  10479. return b.length - a.length;
  10480. }
  10481. var minPieces = [],
  10482. shortPieces = [],
  10483. longPieces = [],
  10484. mixedPieces = [],
  10485. i,
  10486. mom,
  10487. minp,
  10488. shortp,
  10489. longp;
  10490. for (i = 0; i < 7; i++) {
  10491. // make the regex if we don't have it already
  10492. mom = createUTC([2000, 1]).day(i);
  10493. minp = regexEscape(this.weekdaysMin(mom, ''));
  10494. shortp = regexEscape(this.weekdaysShort(mom, ''));
  10495. longp = regexEscape(this.weekdays(mom, ''));
  10496. minPieces.push(minp);
  10497. shortPieces.push(shortp);
  10498. longPieces.push(longp);
  10499. mixedPieces.push(minp);
  10500. mixedPieces.push(shortp);
  10501. mixedPieces.push(longp);
  10502. }
  10503. // Sorting makes sure if one weekday (or abbr) is a prefix of another it
  10504. // will match the longer piece.
  10505. minPieces.sort(cmpLenRev);
  10506. shortPieces.sort(cmpLenRev);
  10507. longPieces.sort(cmpLenRev);
  10508. mixedPieces.sort(cmpLenRev);
  10509. this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  10510. this._weekdaysShortRegex = this._weekdaysRegex;
  10511. this._weekdaysMinRegex = this._weekdaysRegex;
  10512. this._weekdaysStrictRegex = new RegExp(
  10513. '^(' + longPieces.join('|') + ')',
  10514. 'i'
  10515. );
  10516. this._weekdaysShortStrictRegex = new RegExp(
  10517. '^(' + shortPieces.join('|') + ')',
  10518. 'i'
  10519. );
  10520. this._weekdaysMinStrictRegex = new RegExp(
  10521. '^(' + minPieces.join('|') + ')',
  10522. 'i'
  10523. );
  10524. }
  10525. // FORMATTING
  10526. function hFormat() {
  10527. return this.hours() % 12 || 12;
  10528. }
  10529. function kFormat() {
  10530. return this.hours() || 24;
  10531. }
  10532. addFormatToken('H', ['HH', 2], 0, 'hour');
  10533. addFormatToken('h', ['hh', 2], 0, hFormat);
  10534. addFormatToken('k', ['kk', 2], 0, kFormat);
  10535. addFormatToken('hmm', 0, 0, function () {
  10536. return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
  10537. });
  10538. addFormatToken('hmmss', 0, 0, function () {
  10539. return (
  10540. '' +
  10541. hFormat.apply(this) +
  10542. zeroFill(this.minutes(), 2) +
  10543. zeroFill(this.seconds(), 2)
  10544. );
  10545. });
  10546. addFormatToken('Hmm', 0, 0, function () {
  10547. return '' + this.hours() + zeroFill(this.minutes(), 2);
  10548. });
  10549. addFormatToken('Hmmss', 0, 0, function () {
  10550. return (
  10551. '' +
  10552. this.hours() +
  10553. zeroFill(this.minutes(), 2) +
  10554. zeroFill(this.seconds(), 2)
  10555. );
  10556. });
  10557. function meridiem(token, lowercase) {
  10558. addFormatToken(token, 0, 0, function () {
  10559. return this.localeData().meridiem(
  10560. this.hours(),
  10561. this.minutes(),
  10562. lowercase
  10563. );
  10564. });
  10565. }
  10566. meridiem('a', true);
  10567. meridiem('A', false);
  10568. // ALIASES
  10569. addUnitAlias('hour', 'h');
  10570. // PRIORITY
  10571. addUnitPriority('hour', 13);
  10572. // PARSING
  10573. function matchMeridiem(isStrict, locale) {
  10574. return locale._meridiemParse;
  10575. }
  10576. addRegexToken('a', matchMeridiem);
  10577. addRegexToken('A', matchMeridiem);
  10578. addRegexToken('H', match1to2);
  10579. addRegexToken('h', match1to2);
  10580. addRegexToken('k', match1to2);
  10581. addRegexToken('HH', match1to2, match2);
  10582. addRegexToken('hh', match1to2, match2);
  10583. addRegexToken('kk', match1to2, match2);
  10584. addRegexToken('hmm', match3to4);
  10585. addRegexToken('hmmss', match5to6);
  10586. addRegexToken('Hmm', match3to4);
  10587. addRegexToken('Hmmss', match5to6);
  10588. addParseToken(['H', 'HH'], HOUR);
  10589. addParseToken(['k', 'kk'], function (input, array, config) {
  10590. var kInput = toInt(input);
  10591. array[HOUR] = kInput === 24 ? 0 : kInput;
  10592. });
  10593. addParseToken(['a', 'A'], function (input, array, config) {
  10594. config._isPm = config._locale.isPM(input);
  10595. config._meridiem = input;
  10596. });
  10597. addParseToken(['h', 'hh'], function (input, array, config) {
  10598. array[HOUR] = toInt(input);
  10599. getParsingFlags(config).bigHour = true;
  10600. });
  10601. addParseToken('hmm', function (input, array, config) {
  10602. var pos = input.length - 2;
  10603. array[HOUR] = toInt(input.substr(0, pos));
  10604. array[MINUTE] = toInt(input.substr(pos));
  10605. getParsingFlags(config).bigHour = true;
  10606. });
  10607. addParseToken('hmmss', function (input, array, config) {
  10608. var pos1 = input.length - 4,
  10609. pos2 = input.length - 2;
  10610. array[HOUR] = toInt(input.substr(0, pos1));
  10611. array[MINUTE] = toInt(input.substr(pos1, 2));
  10612. array[SECOND] = toInt(input.substr(pos2));
  10613. getParsingFlags(config).bigHour = true;
  10614. });
  10615. addParseToken('Hmm', function (input, array, config) {
  10616. var pos = input.length - 2;
  10617. array[HOUR] = toInt(input.substr(0, pos));
  10618. array[MINUTE] = toInt(input.substr(pos));
  10619. });
  10620. addParseToken('Hmmss', function (input, array, config) {
  10621. var pos1 = input.length - 4,
  10622. pos2 = input.length - 2;
  10623. array[HOUR] = toInt(input.substr(0, pos1));
  10624. array[MINUTE] = toInt(input.substr(pos1, 2));
  10625. array[SECOND] = toInt(input.substr(pos2));
  10626. });
  10627. // LOCALES
  10628. function localeIsPM(input) {
  10629. // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
  10630. // Using charAt should be more compatible.
  10631. return (input + '').toLowerCase().charAt(0) === 'p';
  10632. }
  10633. var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i,
  10634. // Setting the hour should keep the time, because the user explicitly
  10635. // specified which hour they want. So trying to maintain the same hour (in
  10636. // a new timezone) makes sense. Adding/subtracting hours does not follow
  10637. // this rule.
  10638. getSetHour = makeGetSet('Hours', true);
  10639. function localeMeridiem(hours, minutes, isLower) {
  10640. if (hours > 11) {
  10641. return isLower ? 'pm' : 'PM';
  10642. } else {
  10643. return isLower ? 'am' : 'AM';
  10644. }
  10645. }
  10646. var baseConfig = {
  10647. calendar: defaultCalendar,
  10648. longDateFormat: defaultLongDateFormat,
  10649. invalidDate: defaultInvalidDate,
  10650. ordinal: defaultOrdinal,
  10651. dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
  10652. relativeTime: defaultRelativeTime,
  10653. months: defaultLocaleMonths,
  10654. monthsShort: defaultLocaleMonthsShort,
  10655. week: defaultLocaleWeek,
  10656. weekdays: defaultLocaleWeekdays,
  10657. weekdaysMin: defaultLocaleWeekdaysMin,
  10658. weekdaysShort: defaultLocaleWeekdaysShort,
  10659. meridiemParse: defaultLocaleMeridiemParse,
  10660. };
  10661. // internal storage for locale config files
  10662. var locales = {},
  10663. localeFamilies = {},
  10664. globalLocale;
  10665. function commonPrefix(arr1, arr2) {
  10666. var i,
  10667. minl = Math.min(arr1.length, arr2.length);
  10668. for (i = 0; i < minl; i += 1) {
  10669. if (arr1[i] !== arr2[i]) {
  10670. return i;
  10671. }
  10672. }
  10673. return minl;
  10674. }
  10675. function normalizeLocale(key) {
  10676. return key ? key.toLowerCase().replace('_', '-') : key;
  10677. }
  10678. // pick the locale from the array
  10679. // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
  10680. // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
  10681. function chooseLocale(names) {
  10682. var i = 0,
  10683. j,
  10684. next,
  10685. locale,
  10686. split;
  10687. while (i < names.length) {
  10688. split = normalizeLocale(names[i]).split('-');
  10689. j = split.length;
  10690. next = normalizeLocale(names[i + 1]);
  10691. next = next ? next.split('-') : null;
  10692. while (j > 0) {
  10693. locale = loadLocale(split.slice(0, j).join('-'));
  10694. if (locale) {
  10695. return locale;
  10696. }
  10697. if (
  10698. next &&
  10699. next.length >= j &&
  10700. commonPrefix(split, next) >= j - 1
  10701. ) {
  10702. //the next array item is better than a shallower substring of this one
  10703. break;
  10704. }
  10705. j--;
  10706. }
  10707. i++;
  10708. }
  10709. return globalLocale;
  10710. }
  10711. function isLocaleNameSane(name) {
  10712. // Prevent names that look like filesystem paths, i.e contain '/' or '\'
  10713. return name.match('^[^/\\\\]*$') != null;
  10714. }
  10715. function loadLocale(name) {
  10716. var oldLocale = null,
  10717. aliasedRequire;
  10718. // TODO: Find a better way to register and load all the locales in Node
  10719. if (
  10720. locales[name] === undefined &&
  10721. typeof module !== 'undefined' &&
  10722. module &&
  10723. module.exports &&
  10724. isLocaleNameSane(name)
  10725. ) {
  10726. try {
  10727. oldLocale = globalLocale._abbr;
  10728. aliasedRequire = require;
  10729. aliasedRequire('./locale/' + name);
  10730. getSetGlobalLocale(oldLocale);
  10731. } catch (e) {
  10732. // mark as not found to avoid repeating expensive file require call causing high CPU
  10733. // when trying to find en-US, en_US, en-us for every format call
  10734. locales[name] = null; // null means not found
  10735. }
  10736. }
  10737. return locales[name];
  10738. }
  10739. // This function will load locale and then set the global locale. If
  10740. // no arguments are passed in, it will simply return the current global
  10741. // locale key.
  10742. function getSetGlobalLocale(key, values) {
  10743. var data;
  10744. if (key) {
  10745. if (isUndefined(values)) {
  10746. data = getLocale(key);
  10747. } else {
  10748. data = defineLocale(key, values);
  10749. }
  10750. if (data) {
  10751. // moment.duration._locale = moment._locale = data;
  10752. globalLocale = data;
  10753. } else {
  10754. if (typeof console !== 'undefined' && console.warn) {
  10755. //warn user if arguments are passed but the locale could not be set
  10756. console.warn(
  10757. 'Locale ' + key + ' not found. Did you forget to load it?'
  10758. );
  10759. }
  10760. }
  10761. }
  10762. return globalLocale._abbr;
  10763. }
  10764. function defineLocale(name, config) {
  10765. if (config !== null) {
  10766. var locale,
  10767. parentConfig = baseConfig;
  10768. config.abbr = name;
  10769. if (locales[name] != null) {
  10770. deprecateSimple(
  10771. 'defineLocaleOverride',
  10772. 'use moment.updateLocale(localeName, config) to change ' +
  10773. 'an existing locale. moment.defineLocale(localeName, ' +
  10774. 'config) should only be used for creating a new locale ' +
  10775. 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'
  10776. );
  10777. parentConfig = locales[name]._config;
  10778. } else if (config.parentLocale != null) {
  10779. if (locales[config.parentLocale] != null) {
  10780. parentConfig = locales[config.parentLocale]._config;
  10781. } else {
  10782. locale = loadLocale(config.parentLocale);
  10783. if (locale != null) {
  10784. parentConfig = locale._config;
  10785. } else {
  10786. if (!localeFamilies[config.parentLocale]) {
  10787. localeFamilies[config.parentLocale] = [];
  10788. }
  10789. localeFamilies[config.parentLocale].push({
  10790. name: name,
  10791. config: config,
  10792. });
  10793. return null;
  10794. }
  10795. }
  10796. }
  10797. locales[name] = new Locale(mergeConfigs(parentConfig, config));
  10798. if (localeFamilies[name]) {
  10799. localeFamilies[name].forEach(function (x) {
  10800. defineLocale(x.name, x.config);
  10801. });
  10802. }
  10803. // backwards compat for now: also set the locale
  10804. // make sure we set the locale AFTER all child locales have been
  10805. // created, so we won't end up with the child locale set.
  10806. getSetGlobalLocale(name);
  10807. return locales[name];
  10808. } else {
  10809. // useful for testing
  10810. delete locales[name];
  10811. return null;
  10812. }
  10813. }
  10814. function updateLocale(name, config) {
  10815. if (config != null) {
  10816. var locale,
  10817. tmpLocale,
  10818. parentConfig = baseConfig;
  10819. if (locales[name] != null && locales[name].parentLocale != null) {
  10820. // Update existing child locale in-place to avoid memory-leaks
  10821. locales[name].set(mergeConfigs(locales[name]._config, config));
  10822. } else {
  10823. // MERGE
  10824. tmpLocale = loadLocale(name);
  10825. if (tmpLocale != null) {
  10826. parentConfig = tmpLocale._config;
  10827. }
  10828. config = mergeConfigs(parentConfig, config);
  10829. if (tmpLocale == null) {
  10830. // updateLocale is called for creating a new locale
  10831. // Set abbr so it will have a name (getters return
  10832. // undefined otherwise).
  10833. config.abbr = name;
  10834. }
  10835. locale = new Locale(config);
  10836. locale.parentLocale = locales[name];
  10837. locales[name] = locale;
  10838. }
  10839. // backwards compat for now: also set the locale
  10840. getSetGlobalLocale(name);
  10841. } else {
  10842. // pass null for config to unupdate, useful for tests
  10843. if (locales[name] != null) {
  10844. if (locales[name].parentLocale != null) {
  10845. locales[name] = locales[name].parentLocale;
  10846. if (name === getSetGlobalLocale()) {
  10847. getSetGlobalLocale(name);
  10848. }
  10849. } else if (locales[name] != null) {
  10850. delete locales[name];
  10851. }
  10852. }
  10853. }
  10854. return locales[name];
  10855. }
  10856. // returns locale data
  10857. function getLocale(key) {
  10858. var locale;
  10859. if (key && key._locale && key._locale._abbr) {
  10860. key = key._locale._abbr;
  10861. }
  10862. if (!key) {
  10863. return globalLocale;
  10864. }
  10865. if (!isArray(key)) {
  10866. //short-circuit everything else
  10867. locale = loadLocale(key);
  10868. if (locale) {
  10869. return locale;
  10870. }
  10871. key = [key];
  10872. }
  10873. return chooseLocale(key);
  10874. }
  10875. function listLocales() {
  10876. return keys(locales);
  10877. }
  10878. function checkOverflow(m) {
  10879. var overflow,
  10880. a = m._a;
  10881. if (a && getParsingFlags(m).overflow === -2) {
  10882. overflow =
  10883. a[MONTH] < 0 || a[MONTH] > 11
  10884. ? MONTH
  10885. : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH])
  10886. ? DATE
  10887. : a[HOUR] < 0 ||
  10888. a[HOUR] > 24 ||
  10889. (a[HOUR] === 24 &&
  10890. (a[MINUTE] !== 0 ||
  10891. a[SECOND] !== 0 ||
  10892. a[MILLISECOND] !== 0))
  10893. ? HOUR
  10894. : a[MINUTE] < 0 || a[MINUTE] > 59
  10895. ? MINUTE
  10896. : a[SECOND] < 0 || a[SECOND] > 59
  10897. ? SECOND
  10898. : a[MILLISECOND] < 0 || a[MILLISECOND] > 999
  10899. ? MILLISECOND
  10900. : -1;
  10901. if (
  10902. getParsingFlags(m)._overflowDayOfYear &&
  10903. (overflow < YEAR || overflow > DATE)
  10904. ) {
  10905. overflow = DATE;
  10906. }
  10907. if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
  10908. overflow = WEEK;
  10909. }
  10910. if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
  10911. overflow = WEEKDAY;
  10912. }
  10913. getParsingFlags(m).overflow = overflow;
  10914. }
  10915. return m;
  10916. }
  10917. // iso 8601 regex
  10918. // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
  10919. var extendedIsoRegex =
  10920. /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
  10921. basicIsoRegex =
  10922. /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
  10923. tzRegex = /Z|[+-]\d\d(?::?\d\d)?/,
  10924. isoDates = [
  10925. ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
  10926. ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
  10927. ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
  10928. ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
  10929. ['YYYY-DDD', /\d{4}-\d{3}/],
  10930. ['YYYY-MM', /\d{4}-\d\d/, false],
  10931. ['YYYYYYMMDD', /[+-]\d{10}/],
  10932. ['YYYYMMDD', /\d{8}/],
  10933. ['GGGG[W]WWE', /\d{4}W\d{3}/],
  10934. ['GGGG[W]WW', /\d{4}W\d{2}/, false],
  10935. ['YYYYDDD', /\d{7}/],
  10936. ['YYYYMM', /\d{6}/, false],
  10937. ['YYYY', /\d{4}/, false],
  10938. ],
  10939. // iso time formats and regexes
  10940. isoTimes = [
  10941. ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
  10942. ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
  10943. ['HH:mm:ss', /\d\d:\d\d:\d\d/],
  10944. ['HH:mm', /\d\d:\d\d/],
  10945. ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
  10946. ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
  10947. ['HHmmss', /\d\d\d\d\d\d/],
  10948. ['HHmm', /\d\d\d\d/],
  10949. ['HH', /\d\d/],
  10950. ],
  10951. aspNetJsonRegex = /^\/?Date\((-?\d+)/i,
  10952. // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
  10953. rfc2822 =
  10954. /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,
  10955. obsOffsets = {
  10956. UT: 0,
  10957. GMT: 0,
  10958. EDT: -4 * 60,
  10959. EST: -5 * 60,
  10960. CDT: -5 * 60,
  10961. CST: -6 * 60,
  10962. MDT: -6 * 60,
  10963. MST: -7 * 60,
  10964. PDT: -7 * 60,
  10965. PST: -8 * 60,
  10966. };
  10967. // date from iso format
  10968. function configFromISO(config) {
  10969. var i,
  10970. l,
  10971. string = config._i,
  10972. match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
  10973. allowTime,
  10974. dateFormat,
  10975. timeFormat,
  10976. tzFormat,
  10977. isoDatesLen = isoDates.length,
  10978. isoTimesLen = isoTimes.length;
  10979. if (match) {
  10980. getParsingFlags(config).iso = true;
  10981. for (i = 0, l = isoDatesLen; i < l; i++) {
  10982. if (isoDates[i][1].exec(match[1])) {
  10983. dateFormat = isoDates[i][0];
  10984. allowTime = isoDates[i][2] !== false;
  10985. break;
  10986. }
  10987. }
  10988. if (dateFormat == null) {
  10989. config._isValid = false;
  10990. return;
  10991. }
  10992. if (match[3]) {
  10993. for (i = 0, l = isoTimesLen; i < l; i++) {
  10994. if (isoTimes[i][1].exec(match[3])) {
  10995. // match[2] should be 'T' or space
  10996. timeFormat = (match[2] || ' ') + isoTimes[i][0];
  10997. break;
  10998. }
  10999. }
  11000. if (timeFormat == null) {
  11001. config._isValid = false;
  11002. return;
  11003. }
  11004. }
  11005. if (!allowTime && timeFormat != null) {
  11006. config._isValid = false;
  11007. return;
  11008. }
  11009. if (match[4]) {
  11010. if (tzRegex.exec(match[4])) {
  11011. tzFormat = 'Z';
  11012. } else {
  11013. config._isValid = false;
  11014. return;
  11015. }
  11016. }
  11017. config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
  11018. configFromStringAndFormat(config);
  11019. } else {
  11020. config._isValid = false;
  11021. }
  11022. }
  11023. function extractFromRFC2822Strings(
  11024. yearStr,
  11025. monthStr,
  11026. dayStr,
  11027. hourStr,
  11028. minuteStr,
  11029. secondStr
  11030. ) {
  11031. var result = [
  11032. untruncateYear(yearStr),
  11033. defaultLocaleMonthsShort.indexOf(monthStr),
  11034. parseInt(dayStr, 10),
  11035. parseInt(hourStr, 10),
  11036. parseInt(minuteStr, 10),
  11037. ];
  11038. if (secondStr) {
  11039. result.push(parseInt(secondStr, 10));
  11040. }
  11041. return result;
  11042. }
  11043. function untruncateYear(yearStr) {
  11044. var year = parseInt(yearStr, 10);
  11045. if (year <= 49) {
  11046. return 2000 + year;
  11047. } else if (year <= 999) {
  11048. return 1900 + year;
  11049. }
  11050. return year;
  11051. }
  11052. function preprocessRFC2822(s) {
  11053. // Remove comments and folding whitespace and replace multiple-spaces with a single space
  11054. return s
  11055. .replace(/\([^()]*\)|[\n\t]/g, ' ')
  11056. .replace(/(\s\s+)/g, ' ')
  11057. .replace(/^\s\s*/, '')
  11058. .replace(/\s\s*$/, '');
  11059. }
  11060. function checkWeekday(weekdayStr, parsedInput, config) {
  11061. if (weekdayStr) {
  11062. // TODO: Replace the vanilla JS Date object with an independent day-of-week check.
  11063. var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),
  11064. weekdayActual = new Date(
  11065. parsedInput[0],
  11066. parsedInput[1],
  11067. parsedInput[2]
  11068. ).getDay();
  11069. if (weekdayProvided !== weekdayActual) {
  11070. getParsingFlags(config).weekdayMismatch = true;
  11071. config._isValid = false;
  11072. return false;
  11073. }
  11074. }
  11075. return true;
  11076. }
  11077. function calculateOffset(obsOffset, militaryOffset, numOffset) {
  11078. if (obsOffset) {
  11079. return obsOffsets[obsOffset];
  11080. } else if (militaryOffset) {
  11081. // the only allowed military tz is Z
  11082. return 0;
  11083. } else {
  11084. var hm = parseInt(numOffset, 10),
  11085. m = hm % 100,
  11086. h = (hm - m) / 100;
  11087. return h * 60 + m;
  11088. }
  11089. }
  11090. // date and time from ref 2822 format
  11091. function configFromRFC2822(config) {
  11092. var match = rfc2822.exec(preprocessRFC2822(config._i)),
  11093. parsedArray;
  11094. if (match) {
  11095. parsedArray = extractFromRFC2822Strings(
  11096. match[4],
  11097. match[3],
  11098. match[2],
  11099. match[5],
  11100. match[6],
  11101. match[7]
  11102. );
  11103. if (!checkWeekday(match[1], parsedArray, config)) {
  11104. return;
  11105. }
  11106. config._a = parsedArray;
  11107. config._tzm = calculateOffset(match[8], match[9], match[10]);
  11108. config._d = createUTCDate.apply(null, config._a);
  11109. config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
  11110. getParsingFlags(config).rfc2822 = true;
  11111. } else {
  11112. config._isValid = false;
  11113. }
  11114. }
  11115. // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict
  11116. function configFromString(config) {
  11117. var matched = aspNetJsonRegex.exec(config._i);
  11118. if (matched !== null) {
  11119. config._d = new Date(+matched[1]);
  11120. return;
  11121. }
  11122. configFromISO(config);
  11123. if (config._isValid === false) {
  11124. delete config._isValid;
  11125. } else {
  11126. return;
  11127. }
  11128. configFromRFC2822(config);
  11129. if (config._isValid === false) {
  11130. delete config._isValid;
  11131. } else {
  11132. return;
  11133. }
  11134. if (config._strict) {
  11135. config._isValid = false;
  11136. } else {
  11137. // Final attempt, use Input Fallback
  11138. hooks.createFromInputFallback(config);
  11139. }
  11140. }
  11141. hooks.createFromInputFallback = deprecate(
  11142. 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +
  11143. 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +
  11144. 'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.',
  11145. function (config) {
  11146. config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
  11147. }
  11148. );
  11149. // Pick the first defined of two or three arguments.
  11150. function defaults(a, b, c) {
  11151. if (a != null) {
  11152. return a;
  11153. }
  11154. if (b != null) {
  11155. return b;
  11156. }
  11157. return c;
  11158. }
  11159. function currentDateArray(config) {
  11160. // hooks is actually the exported moment object
  11161. var nowValue = new Date(hooks.now());
  11162. if (config._useUTC) {
  11163. return [
  11164. nowValue.getUTCFullYear(),
  11165. nowValue.getUTCMonth(),
  11166. nowValue.getUTCDate(),
  11167. ];
  11168. }
  11169. return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
  11170. }
  11171. // convert an array to a date.
  11172. // the array should mirror the parameters below
  11173. // note: all values past the year are optional and will default to the lowest possible value.
  11174. // [year, month, day , hour, minute, second, millisecond]
  11175. function configFromArray(config) {
  11176. var i,
  11177. date,
  11178. input = [],
  11179. currentDate,
  11180. expectedWeekday,
  11181. yearToUse;
  11182. if (config._d) {
  11183. return;
  11184. }
  11185. currentDate = currentDateArray(config);
  11186. //compute day of the year from weeks and weekdays
  11187. if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
  11188. dayOfYearFromWeekInfo(config);
  11189. }
  11190. //if the day of the year is set, figure out what it is
  11191. if (config._dayOfYear != null) {
  11192. yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
  11193. if (
  11194. config._dayOfYear > daysInYear(yearToUse) ||
  11195. config._dayOfYear === 0
  11196. ) {
  11197. getParsingFlags(config)._overflowDayOfYear = true;
  11198. }
  11199. date = createUTCDate(yearToUse, 0, config._dayOfYear);
  11200. config._a[MONTH] = date.getUTCMonth();
  11201. config._a[DATE] = date.getUTCDate();
  11202. }
  11203. // Default to current date.
  11204. // * if no year, month, day of month are given, default to today
  11205. // * if day of month is given, default month and year
  11206. // * if month is given, default only year
  11207. // * if year is given, don't default anything
  11208. for (i = 0; i < 3 && config._a[i] == null; ++i) {
  11209. config._a[i] = input[i] = currentDate[i];
  11210. }
  11211. // Zero out whatever was not defaulted, including time
  11212. for (; i < 7; i++) {
  11213. config._a[i] = input[i] =
  11214. config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i];
  11215. }
  11216. // Check for 24:00:00.000
  11217. if (
  11218. config._a[HOUR] === 24 &&
  11219. config._a[MINUTE] === 0 &&
  11220. config._a[SECOND] === 0 &&
  11221. config._a[MILLISECOND] === 0
  11222. ) {
  11223. config._nextDay = true;
  11224. config._a[HOUR] = 0;
  11225. }
  11226. config._d = (config._useUTC ? createUTCDate : createDate).apply(
  11227. null,
  11228. input
  11229. );
  11230. expectedWeekday = config._useUTC
  11231. ? config._d.getUTCDay()
  11232. : config._d.getDay();
  11233. // Apply timezone offset from input. The actual utcOffset can be changed
  11234. // with parseZone.
  11235. if (config._tzm != null) {
  11236. config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
  11237. }
  11238. if (config._nextDay) {
  11239. config._a[HOUR] = 24;
  11240. }
  11241. // check for mismatching day of week
  11242. if (
  11243. config._w &&
  11244. typeof config._w.d !== 'undefined' &&
  11245. config._w.d !== expectedWeekday
  11246. ) {
  11247. getParsingFlags(config).weekdayMismatch = true;
  11248. }
  11249. }
  11250. function dayOfYearFromWeekInfo(config) {
  11251. var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek;
  11252. w = config._w;
  11253. if (w.GG != null || w.W != null || w.E != null) {
  11254. dow = 1;
  11255. doy = 4;
  11256. // TODO: We need to take the current isoWeekYear, but that depends on
  11257. // how we interpret now (local, utc, fixed offset). So create
  11258. // a now version of current config (take local/utc/offset flags, and
  11259. // create now).
  11260. weekYear = defaults(
  11261. w.GG,
  11262. config._a[YEAR],
  11263. weekOfYear(createLocal(), 1, 4).year
  11264. );
  11265. week = defaults(w.W, 1);
  11266. weekday = defaults(w.E, 1);
  11267. if (weekday < 1 || weekday > 7) {
  11268. weekdayOverflow = true;
  11269. }
  11270. } else {
  11271. dow = config._locale._week.dow;
  11272. doy = config._locale._week.doy;
  11273. curWeek = weekOfYear(createLocal(), dow, doy);
  11274. weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
  11275. // Default to current week.
  11276. week = defaults(w.w, curWeek.week);
  11277. if (w.d != null) {
  11278. // weekday -- low day numbers are considered next week
  11279. weekday = w.d;
  11280. if (weekday < 0 || weekday > 6) {
  11281. weekdayOverflow = true;
  11282. }
  11283. } else if (w.e != null) {
  11284. // local weekday -- counting starts from beginning of week
  11285. weekday = w.e + dow;
  11286. if (w.e < 0 || w.e > 6) {
  11287. weekdayOverflow = true;
  11288. }
  11289. } else {
  11290. // default to beginning of week
  11291. weekday = dow;
  11292. }
  11293. }
  11294. if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
  11295. getParsingFlags(config)._overflowWeeks = true;
  11296. } else if (weekdayOverflow != null) {
  11297. getParsingFlags(config)._overflowWeekday = true;
  11298. } else {
  11299. temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
  11300. config._a[YEAR] = temp.year;
  11301. config._dayOfYear = temp.dayOfYear;
  11302. }
  11303. }
  11304. // constant that refers to the ISO standard
  11305. hooks.ISO_8601 = function () {};
  11306. // constant that refers to the RFC 2822 form
  11307. hooks.RFC_2822 = function () {};
  11308. // date from string and format string
  11309. function configFromStringAndFormat(config) {
  11310. // TODO: Move this to another part of the creation flow to prevent circular deps
  11311. if (config._f === hooks.ISO_8601) {
  11312. configFromISO(config);
  11313. return;
  11314. }
  11315. if (config._f === hooks.RFC_2822) {
  11316. configFromRFC2822(config);
  11317. return;
  11318. }
  11319. config._a = [];
  11320. getParsingFlags(config).empty = true;
  11321. // This array is used to make a Date, either with `new Date` or `Date.UTC`
  11322. var string = '' + config._i,
  11323. i,
  11324. parsedInput,
  11325. tokens,
  11326. token,
  11327. skipped,
  11328. stringLength = string.length,
  11329. totalParsedInputLength = 0,
  11330. era,
  11331. tokenLen;
  11332. tokens =
  11333. expandFormat(config._f, config._locale).match(formattingTokens) || [];
  11334. tokenLen = tokens.length;
  11335. for (i = 0; i < tokenLen; i++) {
  11336. token = tokens[i];
  11337. parsedInput = (string.match(getParseRegexForToken(token, config)) ||
  11338. [])[0];
  11339. if (parsedInput) {
  11340. skipped = string.substr(0, string.indexOf(parsedInput));
  11341. if (skipped.length > 0) {
  11342. getParsingFlags(config).unusedInput.push(skipped);
  11343. }
  11344. string = string.slice(
  11345. string.indexOf(parsedInput) + parsedInput.length
  11346. );
  11347. totalParsedInputLength += parsedInput.length;
  11348. }
  11349. // don't parse if it's not a known token
  11350. if (formatTokenFunctions[token]) {
  11351. if (parsedInput) {
  11352. getParsingFlags(config).empty = false;
  11353. } else {
  11354. getParsingFlags(config).unusedTokens.push(token);
  11355. }
  11356. addTimeToArrayFromToken(token, parsedInput, config);
  11357. } else if (config._strict && !parsedInput) {
  11358. getParsingFlags(config).unusedTokens.push(token);
  11359. }
  11360. }
  11361. // add remaining unparsed input length to the string
  11362. getParsingFlags(config).charsLeftOver =
  11363. stringLength - totalParsedInputLength;
  11364. if (string.length > 0) {
  11365. getParsingFlags(config).unusedInput.push(string);
  11366. }
  11367. // clear _12h flag if hour is <= 12
  11368. if (
  11369. config._a[HOUR] <= 12 &&
  11370. getParsingFlags(config).bigHour === true &&
  11371. config._a[HOUR] > 0
  11372. ) {
  11373. getParsingFlags(config).bigHour = undefined;
  11374. }
  11375. getParsingFlags(config).parsedDateParts = config._a.slice(0);
  11376. getParsingFlags(config).meridiem = config._meridiem;
  11377. // handle meridiem
  11378. config._a[HOUR] = meridiemFixWrap(
  11379. config._locale,
  11380. config._a[HOUR],
  11381. config._meridiem
  11382. );
  11383. // handle era
  11384. era = getParsingFlags(config).era;
  11385. if (era !== null) {
  11386. config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]);
  11387. }
  11388. configFromArray(config);
  11389. checkOverflow(config);
  11390. }
  11391. function meridiemFixWrap(locale, hour, meridiem) {
  11392. var isPm;
  11393. if (meridiem == null) {
  11394. // nothing to do
  11395. return hour;
  11396. }
  11397. if (locale.meridiemHour != null) {
  11398. return locale.meridiemHour(hour, meridiem);
  11399. } else if (locale.isPM != null) {
  11400. // Fallback
  11401. isPm = locale.isPM(meridiem);
  11402. if (isPm && hour < 12) {
  11403. hour += 12;
  11404. }
  11405. if (!isPm && hour === 12) {
  11406. hour = 0;
  11407. }
  11408. return hour;
  11409. } else {
  11410. // this is not supposed to happen
  11411. return hour;
  11412. }
  11413. }
  11414. // date from string and array of format strings
  11415. function configFromStringAndArray(config) {
  11416. var tempConfig,
  11417. bestMoment,
  11418. scoreToBeat,
  11419. i,
  11420. currentScore,
  11421. validFormatFound,
  11422. bestFormatIsValid = false,
  11423. configfLen = config._f.length;
  11424. if (configfLen === 0) {
  11425. getParsingFlags(config).invalidFormat = true;
  11426. config._d = new Date(NaN);
  11427. return;
  11428. }
  11429. for (i = 0; i < configfLen; i++) {
  11430. currentScore = 0;
  11431. validFormatFound = false;
  11432. tempConfig = copyConfig({}, config);
  11433. if (config._useUTC != null) {
  11434. tempConfig._useUTC = config._useUTC;
  11435. }
  11436. tempConfig._f = config._f[i];
  11437. configFromStringAndFormat(tempConfig);
  11438. if (isValid(tempConfig)) {
  11439. validFormatFound = true;
  11440. }
  11441. // if there is any input that was not parsed add a penalty for that format
  11442. currentScore += getParsingFlags(tempConfig).charsLeftOver;
  11443. //or tokens
  11444. currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
  11445. getParsingFlags(tempConfig).score = currentScore;
  11446. if (!bestFormatIsValid) {
  11447. if (
  11448. scoreToBeat == null ||
  11449. currentScore < scoreToBeat ||
  11450. validFormatFound
  11451. ) {
  11452. scoreToBeat = currentScore;
  11453. bestMoment = tempConfig;
  11454. if (validFormatFound) {
  11455. bestFormatIsValid = true;
  11456. }
  11457. }
  11458. } else {
  11459. if (currentScore < scoreToBeat) {
  11460. scoreToBeat = currentScore;
  11461. bestMoment = tempConfig;
  11462. }
  11463. }
  11464. }
  11465. extend(config, bestMoment || tempConfig);
  11466. }
  11467. function configFromObject(config) {
  11468. if (config._d) {
  11469. return;
  11470. }
  11471. var i = normalizeObjectUnits(config._i),
  11472. dayOrDate = i.day === undefined ? i.date : i.day;
  11473. config._a = map(
  11474. [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond],
  11475. function (obj) {
  11476. return obj && parseInt(obj, 10);
  11477. }
  11478. );
  11479. configFromArray(config);
  11480. }
  11481. function createFromConfig(config) {
  11482. var res = new Moment(checkOverflow(prepareConfig(config)));
  11483. if (res._nextDay) {
  11484. // Adding is smart enough around DST
  11485. res.add(1, 'd');
  11486. res._nextDay = undefined;
  11487. }
  11488. return res;
  11489. }
  11490. function prepareConfig(config) {
  11491. var input = config._i,
  11492. format = config._f;
  11493. config._locale = config._locale || getLocale(config._l);
  11494. if (input === null || (format === undefined && input === '')) {
  11495. return createInvalid({ nullInput: true });
  11496. }
  11497. if (typeof input === 'string') {
  11498. config._i = input = config._locale.preparse(input);
  11499. }
  11500. if (isMoment(input)) {
  11501. return new Moment(checkOverflow(input));
  11502. } else if (isDate(input)) {
  11503. config._d = input;
  11504. } else if (isArray(format)) {
  11505. configFromStringAndArray(config);
  11506. } else if (format) {
  11507. configFromStringAndFormat(config);
  11508. } else {
  11509. configFromInput(config);
  11510. }
  11511. if (!isValid(config)) {
  11512. config._d = null;
  11513. }
  11514. return config;
  11515. }
  11516. function configFromInput(config) {
  11517. var input = config._i;
  11518. if (isUndefined(input)) {
  11519. config._d = new Date(hooks.now());
  11520. } else if (isDate(input)) {
  11521. config._d = new Date(input.valueOf());
  11522. } else if (typeof input === 'string') {
  11523. configFromString(config);
  11524. } else if (isArray(input)) {
  11525. config._a = map(input.slice(0), function (obj) {
  11526. return parseInt(obj, 10);
  11527. });
  11528. configFromArray(config);
  11529. } else if (isObject(input)) {
  11530. configFromObject(config);
  11531. } else if (isNumber(input)) {
  11532. // from milliseconds
  11533. config._d = new Date(input);
  11534. } else {
  11535. hooks.createFromInputFallback(config);
  11536. }
  11537. }
  11538. function createLocalOrUTC(input, format, locale, strict, isUTC) {
  11539. var c = {};
  11540. if (format === true || format === false) {
  11541. strict = format;
  11542. format = undefined;
  11543. }
  11544. if (locale === true || locale === false) {
  11545. strict = locale;
  11546. locale = undefined;
  11547. }
  11548. if (
  11549. (isObject(input) && isObjectEmpty(input)) ||
  11550. (isArray(input) && input.length === 0)
  11551. ) {
  11552. input = undefined;
  11553. }
  11554. // object construction must be done this way.
  11555. // https://github.com/moment/moment/issues/1423
  11556. c._isAMomentObject = true;
  11557. c._useUTC = c._isUTC = isUTC;
  11558. c._l = locale;
  11559. c._i = input;
  11560. c._f = format;
  11561. c._strict = strict;
  11562. return createFromConfig(c);
  11563. }
  11564. function createLocal(input, format, locale, strict) {
  11565. return createLocalOrUTC(input, format, locale, strict, false);
  11566. }
  11567. var prototypeMin = deprecate(
  11568. 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
  11569. function () {
  11570. var other = createLocal.apply(null, arguments);
  11571. if (this.isValid() && other.isValid()) {
  11572. return other < this ? this : other;
  11573. } else {
  11574. return createInvalid();
  11575. }
  11576. }
  11577. ),
  11578. prototypeMax = deprecate(
  11579. 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
  11580. function () {
  11581. var other = createLocal.apply(null, arguments);
  11582. if (this.isValid() && other.isValid()) {
  11583. return other > this ? this : other;
  11584. } else {
  11585. return createInvalid();
  11586. }
  11587. }
  11588. );
  11589. // Pick a moment m from moments so that m[fn](other) is true for all
  11590. // other. This relies on the function fn to be transitive.
  11591. //
  11592. // moments should either be an array of moment objects or an array, whose
  11593. // first element is an array of moment objects.
  11594. function pickBy(fn, moments) {
  11595. var res, i;
  11596. if (moments.length === 1 && isArray(moments[0])) {
  11597. moments = moments[0];
  11598. }
  11599. if (!moments.length) {
  11600. return createLocal();
  11601. }
  11602. res = moments[0];
  11603. for (i = 1; i < moments.length; ++i) {
  11604. if (!moments[i].isValid() || moments[i][fn](res)) {
  11605. res = moments[i];
  11606. }
  11607. }
  11608. return res;
  11609. }
  11610. // TODO: Use [].sort instead?
  11611. function min() {
  11612. var args = [].slice.call(arguments, 0);
  11613. return pickBy('isBefore', args);
  11614. }
  11615. function max() {
  11616. var args = [].slice.call(arguments, 0);
  11617. return pickBy('isAfter', args);
  11618. }
  11619. var now = function () {
  11620. return Date.now ? Date.now() : +new Date();
  11621. };
  11622. var ordering = [
  11623. 'year',
  11624. 'quarter',
  11625. 'month',
  11626. 'week',
  11627. 'day',
  11628. 'hour',
  11629. 'minute',
  11630. 'second',
  11631. 'millisecond',
  11632. ];
  11633. function isDurationValid(m) {
  11634. var key,
  11635. unitHasDecimal = false,
  11636. i,
  11637. orderLen = ordering.length;
  11638. for (key in m) {
  11639. if (
  11640. hasOwnProp(m, key) &&
  11641. !(
  11642. indexOf.call(ordering, key) !== -1 &&
  11643. (m[key] == null || !isNaN(m[key]))
  11644. )
  11645. ) {
  11646. return false;
  11647. }
  11648. }
  11649. for (i = 0; i < orderLen; ++i) {
  11650. if (m[ordering[i]]) {
  11651. if (unitHasDecimal) {
  11652. return false; // only allow non-integers for smallest unit
  11653. }
  11654. if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
  11655. unitHasDecimal = true;
  11656. }
  11657. }
  11658. }
  11659. return true;
  11660. }
  11661. function isValid$1() {
  11662. return this._isValid;
  11663. }
  11664. function createInvalid$1() {
  11665. return createDuration(NaN);
  11666. }
  11667. function Duration(duration) {
  11668. var normalizedInput = normalizeObjectUnits(duration),
  11669. years = normalizedInput.year || 0,
  11670. quarters = normalizedInput.quarter || 0,
  11671. months = normalizedInput.month || 0,
  11672. weeks = normalizedInput.week || normalizedInput.isoWeek || 0,
  11673. days = normalizedInput.day || 0,
  11674. hours = normalizedInput.hour || 0,
  11675. minutes = normalizedInput.minute || 0,
  11676. seconds = normalizedInput.second || 0,
  11677. milliseconds = normalizedInput.millisecond || 0;
  11678. this._isValid = isDurationValid(normalizedInput);
  11679. // representation for dateAddRemove
  11680. this._milliseconds =
  11681. +milliseconds +
  11682. seconds * 1e3 + // 1000
  11683. minutes * 6e4 + // 1000 * 60
  11684. hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
  11685. // Because of dateAddRemove treats 24 hours as different from a
  11686. // day when working around DST, we need to store them separately
  11687. this._days = +days + weeks * 7;
  11688. // It is impossible to translate months into days without knowing
  11689. // which months you are are talking about, so we have to store
  11690. // it separately.
  11691. this._months = +months + quarters * 3 + years * 12;
  11692. this._data = {};
  11693. this._locale = getLocale();
  11694. this._bubble();
  11695. }
  11696. function isDuration(obj) {
  11697. return obj instanceof Duration;
  11698. }
  11699. function absRound(number) {
  11700. if (number < 0) {
  11701. return Math.round(-1 * number) * -1;
  11702. } else {
  11703. return Math.round(number);
  11704. }
  11705. }
  11706. // compare two arrays, return the number of differences
  11707. function compareArrays(array1, array2, dontConvert) {
  11708. var len = Math.min(array1.length, array2.length),
  11709. lengthDiff = Math.abs(array1.length - array2.length),
  11710. diffs = 0,
  11711. i;
  11712. for (i = 0; i < len; i++) {
  11713. if (
  11714. (dontConvert && array1[i] !== array2[i]) ||
  11715. (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))
  11716. ) {
  11717. diffs++;
  11718. }
  11719. }
  11720. return diffs + lengthDiff;
  11721. }
  11722. // FORMATTING
  11723. function offset(token, separator) {
  11724. addFormatToken(token, 0, 0, function () {
  11725. var offset = this.utcOffset(),
  11726. sign = '+';
  11727. if (offset < 0) {
  11728. offset = -offset;
  11729. sign = '-';
  11730. }
  11731. return (
  11732. sign +
  11733. zeroFill(~~(offset / 60), 2) +
  11734. separator +
  11735. zeroFill(~~offset % 60, 2)
  11736. );
  11737. });
  11738. }
  11739. offset('Z', ':');
  11740. offset('ZZ', '');
  11741. // PARSING
  11742. addRegexToken('Z', matchShortOffset);
  11743. addRegexToken('ZZ', matchShortOffset);
  11744. addParseToken(['Z', 'ZZ'], function (input, array, config) {
  11745. config._useUTC = true;
  11746. config._tzm = offsetFromString(matchShortOffset, input);
  11747. });
  11748. // HELPERS
  11749. // timezone chunker
  11750. // '+10:00' > ['10', '00']
  11751. // '-1530' > ['-15', '30']
  11752. var chunkOffset = /([\+\-]|\d\d)/gi;
  11753. function offsetFromString(matcher, string) {
  11754. var matches = (string || '').match(matcher),
  11755. chunk,
  11756. parts,
  11757. minutes;
  11758. if (matches === null) {
  11759. return null;
  11760. }
  11761. chunk = matches[matches.length - 1] || [];
  11762. parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
  11763. minutes = +(parts[1] * 60) + toInt(parts[2]);
  11764. return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes;
  11765. }
  11766. // Return a moment from input, that is local/utc/zone equivalent to model.
  11767. function cloneWithOffset(input, model) {
  11768. var res, diff;
  11769. if (model._isUTC) {
  11770. res = model.clone();
  11771. diff =
  11772. (isMoment(input) || isDate(input)
  11773. ? input.valueOf()
  11774. : createLocal(input).valueOf()) - res.valueOf();
  11775. // Use low-level api, because this fn is low-level api.
  11776. res._d.setTime(res._d.valueOf() + diff);
  11777. hooks.updateOffset(res, false);
  11778. return res;
  11779. } else {
  11780. return createLocal(input).local();
  11781. }
  11782. }
  11783. function getDateOffset(m) {
  11784. // On Firefox.24 Date#getTimezoneOffset returns a floating point.
  11785. // https://github.com/moment/moment/pull/1871
  11786. return -Math.round(m._d.getTimezoneOffset());
  11787. }
  11788. // HOOKS
  11789. // This function will be called whenever a moment is mutated.
  11790. // It is intended to keep the offset in sync with the timezone.
  11791. hooks.updateOffset = function () {};
  11792. // MOMENTS
  11793. // keepLocalTime = true means only change the timezone, without
  11794. // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
  11795. // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
  11796. // +0200, so we adjust the time as needed, to be valid.
  11797. //
  11798. // Keeping the time actually adds/subtracts (one hour)
  11799. // from the actual represented time. That is why we call updateOffset
  11800. // a second time. In case it wants us to change the offset again
  11801. // _changeInProgress == true case, then we have to adjust, because
  11802. // there is no such time in the given timezone.
  11803. function getSetOffset(input, keepLocalTime, keepMinutes) {
  11804. var offset = this._offset || 0,
  11805. localAdjust;
  11806. if (!this.isValid()) {
  11807. return input != null ? this : NaN;
  11808. }
  11809. if (input != null) {
  11810. if (typeof input === 'string') {
  11811. input = offsetFromString(matchShortOffset, input);
  11812. if (input === null) {
  11813. return this;
  11814. }
  11815. } else if (Math.abs(input) < 16 && !keepMinutes) {
  11816. input = input * 60;
  11817. }
  11818. if (!this._isUTC && keepLocalTime) {
  11819. localAdjust = getDateOffset(this);
  11820. }
  11821. this._offset = input;
  11822. this._isUTC = true;
  11823. if (localAdjust != null) {
  11824. this.add(localAdjust, 'm');
  11825. }
  11826. if (offset !== input) {
  11827. if (!keepLocalTime || this._changeInProgress) {
  11828. addSubtract(
  11829. this,
  11830. createDuration(input - offset, 'm'),
  11831. 1,
  11832. false
  11833. );
  11834. } else if (!this._changeInProgress) {
  11835. this._changeInProgress = true;
  11836. hooks.updateOffset(this, true);
  11837. this._changeInProgress = null;
  11838. }
  11839. }
  11840. return this;
  11841. } else {
  11842. return this._isUTC ? offset : getDateOffset(this);
  11843. }
  11844. }
  11845. function getSetZone(input, keepLocalTime) {
  11846. if (input != null) {
  11847. if (typeof input !== 'string') {
  11848. input = -input;
  11849. }
  11850. this.utcOffset(input, keepLocalTime);
  11851. return this;
  11852. } else {
  11853. return -this.utcOffset();
  11854. }
  11855. }
  11856. function setOffsetToUTC(keepLocalTime) {
  11857. return this.utcOffset(0, keepLocalTime);
  11858. }
  11859. function setOffsetToLocal(keepLocalTime) {
  11860. if (this._isUTC) {
  11861. this.utcOffset(0, keepLocalTime);
  11862. this._isUTC = false;
  11863. if (keepLocalTime) {
  11864. this.subtract(getDateOffset(this), 'm');
  11865. }
  11866. }
  11867. return this;
  11868. }
  11869. function setOffsetToParsedOffset() {
  11870. if (this._tzm != null) {
  11871. this.utcOffset(this._tzm, false, true);
  11872. } else if (typeof this._i === 'string') {
  11873. var tZone = offsetFromString(matchOffset, this._i);
  11874. if (tZone != null) {
  11875. this.utcOffset(tZone);
  11876. } else {
  11877. this.utcOffset(0, true);
  11878. }
  11879. }
  11880. return this;
  11881. }
  11882. function hasAlignedHourOffset(input) {
  11883. if (!this.isValid()) {
  11884. return false;
  11885. }
  11886. input = input ? createLocal(input).utcOffset() : 0;
  11887. return (this.utcOffset() - input) % 60 === 0;
  11888. }
  11889. function isDaylightSavingTime() {
  11890. return (
  11891. this.utcOffset() > this.clone().month(0).utcOffset() ||
  11892. this.utcOffset() > this.clone().month(5).utcOffset()
  11893. );
  11894. }
  11895. function isDaylightSavingTimeShifted() {
  11896. if (!isUndefined(this._isDSTShifted)) {
  11897. return this._isDSTShifted;
  11898. }
  11899. var c = {},
  11900. other;
  11901. copyConfig(c, this);
  11902. c = prepareConfig(c);
  11903. if (c._a) {
  11904. other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
  11905. this._isDSTShifted =
  11906. this.isValid() && compareArrays(c._a, other.toArray()) > 0;
  11907. } else {
  11908. this._isDSTShifted = false;
  11909. }
  11910. return this._isDSTShifted;
  11911. }
  11912. function isLocal() {
  11913. return this.isValid() ? !this._isUTC : false;
  11914. }
  11915. function isUtcOffset() {
  11916. return this.isValid() ? this._isUTC : false;
  11917. }
  11918. function isUtc() {
  11919. return this.isValid() ? this._isUTC && this._offset === 0 : false;
  11920. }
  11921. // ASP.NET json date format regex
  11922. var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,
  11923. // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
  11924. // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
  11925. // and further modified to allow for strings containing both week and day
  11926. isoRegex =
  11927. /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
  11928. function createDuration(input, key) {
  11929. var duration = input,
  11930. // matching against regexp is expensive, do it on demand
  11931. match = null,
  11932. sign,
  11933. ret,
  11934. diffRes;
  11935. if (isDuration(input)) {
  11936. duration = {
  11937. ms: input._milliseconds,
  11938. d: input._days,
  11939. M: input._months,
  11940. };
  11941. } else if (isNumber(input) || !isNaN(+input)) {
  11942. duration = {};
  11943. if (key) {
  11944. duration[key] = +input;
  11945. } else {
  11946. duration.milliseconds = +input;
  11947. }
  11948. } else if ((match = aspNetRegex.exec(input))) {
  11949. sign = match[1] === '-' ? -1 : 1;
  11950. duration = {
  11951. y: 0,
  11952. d: toInt(match[DATE]) * sign,
  11953. h: toInt(match[HOUR]) * sign,
  11954. m: toInt(match[MINUTE]) * sign,
  11955. s: toInt(match[SECOND]) * sign,
  11956. ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign, // the millisecond decimal point is included in the match
  11957. };
  11958. } else if ((match = isoRegex.exec(input))) {
  11959. sign = match[1] === '-' ? -1 : 1;
  11960. duration = {
  11961. y: parseIso(match[2], sign),
  11962. M: parseIso(match[3], sign),
  11963. w: parseIso(match[4], sign),
  11964. d: parseIso(match[5], sign),
  11965. h: parseIso(match[6], sign),
  11966. m: parseIso(match[7], sign),
  11967. s: parseIso(match[8], sign),
  11968. };
  11969. } else if (duration == null) {
  11970. // checks for null or undefined
  11971. duration = {};
  11972. } else if (
  11973. typeof duration === 'object' &&
  11974. ('from' in duration || 'to' in duration)
  11975. ) {
  11976. diffRes = momentsDifference(
  11977. createLocal(duration.from),
  11978. createLocal(duration.to)
  11979. );
  11980. duration = {};
  11981. duration.ms = diffRes.milliseconds;
  11982. duration.M = diffRes.months;
  11983. }
  11984. ret = new Duration(duration);
  11985. if (isDuration(input) && hasOwnProp(input, '_locale')) {
  11986. ret._locale = input._locale;
  11987. }
  11988. if (isDuration(input) && hasOwnProp(input, '_isValid')) {
  11989. ret._isValid = input._isValid;
  11990. }
  11991. return ret;
  11992. }
  11993. createDuration.fn = Duration.prototype;
  11994. createDuration.invalid = createInvalid$1;
  11995. function parseIso(inp, sign) {
  11996. // We'd normally use ~~inp for this, but unfortunately it also
  11997. // converts floats to ints.
  11998. // inp may be undefined, so careful calling replace on it.
  11999. var res = inp && parseFloat(inp.replace(',', '.'));
  12000. // apply sign while we're at it
  12001. return (isNaN(res) ? 0 : res) * sign;
  12002. }
  12003. function positiveMomentsDifference(base, other) {
  12004. var res = {};
  12005. res.months =
  12006. other.month() - base.month() + (other.year() - base.year()) * 12;
  12007. if (base.clone().add(res.months, 'M').isAfter(other)) {
  12008. --res.months;
  12009. }
  12010. res.milliseconds = +other - +base.clone().add(res.months, 'M');
  12011. return res;
  12012. }
  12013. function momentsDifference(base, other) {
  12014. var res;
  12015. if (!(base.isValid() && other.isValid())) {
  12016. return { milliseconds: 0, months: 0 };
  12017. }
  12018. other = cloneWithOffset(other, base);
  12019. if (base.isBefore(other)) {
  12020. res = positiveMomentsDifference(base, other);
  12021. } else {
  12022. res = positiveMomentsDifference(other, base);
  12023. res.milliseconds = -res.milliseconds;
  12024. res.months = -res.months;
  12025. }
  12026. return res;
  12027. }
  12028. // TODO: remove 'name' arg after deprecation is removed
  12029. function createAdder(direction, name) {
  12030. return function (val, period) {
  12031. var dur, tmp;
  12032. //invert the arguments, but complain about it
  12033. if (period !== null && !isNaN(+period)) {
  12034. deprecateSimple(
  12035. name,
  12036. 'moment().' +
  12037. name +
  12038. '(period, number) is deprecated. Please use moment().' +
  12039. name +
  12040. '(number, period). ' +
  12041. 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'
  12042. );
  12043. tmp = val;
  12044. val = period;
  12045. period = tmp;
  12046. }
  12047. dur = createDuration(val, period);
  12048. addSubtract(this, dur, direction);
  12049. return this;
  12050. };
  12051. }
  12052. function addSubtract(mom, duration, isAdding, updateOffset) {
  12053. var milliseconds = duration._milliseconds,
  12054. days = absRound(duration._days),
  12055. months = absRound(duration._months);
  12056. if (!mom.isValid()) {
  12057. // No op
  12058. return;
  12059. }
  12060. updateOffset = updateOffset == null ? true : updateOffset;
  12061. if (months) {
  12062. setMonth(mom, get(mom, 'Month') + months * isAdding);
  12063. }
  12064. if (days) {
  12065. set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
  12066. }
  12067. if (milliseconds) {
  12068. mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
  12069. }
  12070. if (updateOffset) {
  12071. hooks.updateOffset(mom, days || months);
  12072. }
  12073. }
  12074. var add = createAdder(1, 'add'),
  12075. subtract = createAdder(-1, 'subtract');
  12076. function isString(input) {
  12077. return typeof input === 'string' || input instanceof String;
  12078. }
  12079. // type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined
  12080. function isMomentInput(input) {
  12081. return (
  12082. isMoment(input) ||
  12083. isDate(input) ||
  12084. isString(input) ||
  12085. isNumber(input) ||
  12086. isNumberOrStringArray(input) ||
  12087. isMomentInputObject(input) ||
  12088. input === null ||
  12089. input === undefined
  12090. );
  12091. }
  12092. function isMomentInputObject(input) {
  12093. var objectTest = isObject(input) && !isObjectEmpty(input),
  12094. propertyTest = false,
  12095. properties = [
  12096. 'years',
  12097. 'year',
  12098. 'y',
  12099. 'months',
  12100. 'month',
  12101. 'M',
  12102. 'days',
  12103. 'day',
  12104. 'd',
  12105. 'dates',
  12106. 'date',
  12107. 'D',
  12108. 'hours',
  12109. 'hour',
  12110. 'h',
  12111. 'minutes',
  12112. 'minute',
  12113. 'm',
  12114. 'seconds',
  12115. 'second',
  12116. 's',
  12117. 'milliseconds',
  12118. 'millisecond',
  12119. 'ms',
  12120. ],
  12121. i,
  12122. property,
  12123. propertyLen = properties.length;
  12124. for (i = 0; i < propertyLen; i += 1) {
  12125. property = properties[i];
  12126. propertyTest = propertyTest || hasOwnProp(input, property);
  12127. }
  12128. return objectTest && propertyTest;
  12129. }
  12130. function isNumberOrStringArray(input) {
  12131. var arrayTest = isArray(input),
  12132. dataTypeTest = false;
  12133. if (arrayTest) {
  12134. dataTypeTest =
  12135. input.filter(function (item) {
  12136. return !isNumber(item) && isString(input);
  12137. }).length === 0;
  12138. }
  12139. return arrayTest && dataTypeTest;
  12140. }
  12141. function isCalendarSpec(input) {
  12142. var objectTest = isObject(input) && !isObjectEmpty(input),
  12143. propertyTest = false,
  12144. properties = [
  12145. 'sameDay',
  12146. 'nextDay',
  12147. 'lastDay',
  12148. 'nextWeek',
  12149. 'lastWeek',
  12150. 'sameElse',
  12151. ],
  12152. i,
  12153. property;
  12154. for (i = 0; i < properties.length; i += 1) {
  12155. property = properties[i];
  12156. propertyTest = propertyTest || hasOwnProp(input, property);
  12157. }
  12158. return objectTest && propertyTest;
  12159. }
  12160. function getCalendarFormat(myMoment, now) {
  12161. var diff = myMoment.diff(now, 'days', true);
  12162. return diff < -6
  12163. ? 'sameElse'
  12164. : diff < -1
  12165. ? 'lastWeek'
  12166. : diff < 0
  12167. ? 'lastDay'
  12168. : diff < 1
  12169. ? 'sameDay'
  12170. : diff < 2
  12171. ? 'nextDay'
  12172. : diff < 7
  12173. ? 'nextWeek'
  12174. : 'sameElse';
  12175. }
  12176. function calendar$1(time, formats) {
  12177. // Support for single parameter, formats only overload to the calendar function
  12178. if (arguments.length === 1) {
  12179. if (!arguments[0]) {
  12180. time = undefined;
  12181. formats = undefined;
  12182. } else if (isMomentInput(arguments[0])) {
  12183. time = arguments[0];
  12184. formats = undefined;
  12185. } else if (isCalendarSpec(arguments[0])) {
  12186. formats = arguments[0];
  12187. time = undefined;
  12188. }
  12189. }
  12190. // We want to compare the start of today, vs this.
  12191. // Getting start-of-today depends on whether we're local/utc/offset or not.
  12192. var now = time || createLocal(),
  12193. sod = cloneWithOffset(now, this).startOf('day'),
  12194. format = hooks.calendarFormat(this, sod) || 'sameElse',
  12195. output =
  12196. formats &&
  12197. (isFunction(formats[format])
  12198. ? formats[format].call(this, now)
  12199. : formats[format]);
  12200. return this.format(
  12201. output || this.localeData().calendar(format, this, createLocal(now))
  12202. );
  12203. }
  12204. function clone() {
  12205. return new Moment(this);
  12206. }
  12207. function isAfter(input, units) {
  12208. var localInput = isMoment(input) ? input : createLocal(input);
  12209. if (!(this.isValid() && localInput.isValid())) {
  12210. return false;
  12211. }
  12212. units = normalizeUnits(units) || 'millisecond';
  12213. if (units === 'millisecond') {
  12214. return this.valueOf() > localInput.valueOf();
  12215. } else {
  12216. return localInput.valueOf() < this.clone().startOf(units).valueOf();
  12217. }
  12218. }
  12219. function isBefore(input, units) {
  12220. var localInput = isMoment(input) ? input : createLocal(input);
  12221. if (!(this.isValid() && localInput.isValid())) {
  12222. return false;
  12223. }
  12224. units = normalizeUnits(units) || 'millisecond';
  12225. if (units === 'millisecond') {
  12226. return this.valueOf() < localInput.valueOf();
  12227. } else {
  12228. return this.clone().endOf(units).valueOf() < localInput.valueOf();
  12229. }
  12230. }
  12231. function isBetween(from, to, units, inclusivity) {
  12232. var localFrom = isMoment(from) ? from : createLocal(from),
  12233. localTo = isMoment(to) ? to : createLocal(to);
  12234. if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
  12235. return false;
  12236. }
  12237. inclusivity = inclusivity || '()';
  12238. return (
  12239. (inclusivity[0] === '('
  12240. ? this.isAfter(localFrom, units)
  12241. : !this.isBefore(localFrom, units)) &&
  12242. (inclusivity[1] === ')'
  12243. ? this.isBefore(localTo, units)
  12244. : !this.isAfter(localTo, units))
  12245. );
  12246. }
  12247. function isSame(input, units) {
  12248. var localInput = isMoment(input) ? input : createLocal(input),
  12249. inputMs;
  12250. if (!(this.isValid() && localInput.isValid())) {
  12251. return false;
  12252. }
  12253. units = normalizeUnits(units) || 'millisecond';
  12254. if (units === 'millisecond') {
  12255. return this.valueOf() === localInput.valueOf();
  12256. } else {
  12257. inputMs = localInput.valueOf();
  12258. return (
  12259. this.clone().startOf(units).valueOf() <= inputMs &&
  12260. inputMs <= this.clone().endOf(units).valueOf()
  12261. );
  12262. }
  12263. }
  12264. function isSameOrAfter(input, units) {
  12265. return this.isSame(input, units) || this.isAfter(input, units);
  12266. }
  12267. function isSameOrBefore(input, units) {
  12268. return this.isSame(input, units) || this.isBefore(input, units);
  12269. }
  12270. function diff(input, units, asFloat) {
  12271. var that, zoneDelta, output;
  12272. if (!this.isValid()) {
  12273. return NaN;
  12274. }
  12275. that = cloneWithOffset(input, this);
  12276. if (!that.isValid()) {
  12277. return NaN;
  12278. }
  12279. zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
  12280. units = normalizeUnits(units);
  12281. switch (units) {
  12282. case 'year':
  12283. output = monthDiff(this, that) / 12;
  12284. break;
  12285. case 'month':
  12286. output = monthDiff(this, that);
  12287. break;
  12288. case 'quarter':
  12289. output = monthDiff(this, that) / 3;
  12290. break;
  12291. case 'second':
  12292. output = (this - that) / 1e3;
  12293. break; // 1000
  12294. case 'minute':
  12295. output = (this - that) / 6e4;
  12296. break; // 1000 * 60
  12297. case 'hour':
  12298. output = (this - that) / 36e5;
  12299. break; // 1000 * 60 * 60
  12300. case 'day':
  12301. output = (this - that - zoneDelta) / 864e5;
  12302. break; // 1000 * 60 * 60 * 24, negate dst
  12303. case 'week':
  12304. output = (this - that - zoneDelta) / 6048e5;
  12305. break; // 1000 * 60 * 60 * 24 * 7, negate dst
  12306. default:
  12307. output = this - that;
  12308. }
  12309. return asFloat ? output : absFloor(output);
  12310. }
  12311. function monthDiff(a, b) {
  12312. if (a.date() < b.date()) {
  12313. // end-of-month calculations work correct when the start month has more
  12314. // days than the end month.
  12315. return -monthDiff(b, a);
  12316. }
  12317. // difference in months
  12318. var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()),
  12319. // b is in (anchor - 1 month, anchor + 1 month)
  12320. anchor = a.clone().add(wholeMonthDiff, 'months'),
  12321. anchor2,
  12322. adjust;
  12323. if (b - anchor < 0) {
  12324. anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
  12325. // linear across the month
  12326. adjust = (b - anchor) / (anchor - anchor2);
  12327. } else {
  12328. anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
  12329. // linear across the month
  12330. adjust = (b - anchor) / (anchor2 - anchor);
  12331. }
  12332. //check for negative zero, return zero if negative zero
  12333. return -(wholeMonthDiff + adjust) || 0;
  12334. }
  12335. hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
  12336. hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
  12337. function toString() {
  12338. return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
  12339. }
  12340. function toISOString(keepOffset) {
  12341. if (!this.isValid()) {
  12342. return null;
  12343. }
  12344. var utc = keepOffset !== true,
  12345. m = utc ? this.clone().utc() : this;
  12346. if (m.year() < 0 || m.year() > 9999) {
  12347. return formatMoment(
  12348. m,
  12349. utc
  12350. ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'
  12351. : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ'
  12352. );
  12353. }
  12354. if (isFunction(Date.prototype.toISOString)) {
  12355. // native implementation is ~50x faster, use it when we can
  12356. if (utc) {
  12357. return this.toDate().toISOString();
  12358. } else {
  12359. return new Date(this.valueOf() + this.utcOffset() * 60 * 1000)
  12360. .toISOString()
  12361. .replace('Z', formatMoment(m, 'Z'));
  12362. }
  12363. }
  12364. return formatMoment(
  12365. m,
  12366. utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ'
  12367. );
  12368. }
  12369. /**
  12370. * Return a human readable representation of a moment that can
  12371. * also be evaluated to get a new moment which is the same
  12372. *
  12373. * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
  12374. */
  12375. function inspect() {
  12376. if (!this.isValid()) {
  12377. return 'moment.invalid(/* ' + this._i + ' */)';
  12378. }
  12379. var func = 'moment',
  12380. zone = '',
  12381. prefix,
  12382. year,
  12383. datetime,
  12384. suffix;
  12385. if (!this.isLocal()) {
  12386. func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
  12387. zone = 'Z';
  12388. }
  12389. prefix = '[' + func + '("]';
  12390. year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY';
  12391. datetime = '-MM-DD[T]HH:mm:ss.SSS';
  12392. suffix = zone + '[")]';
  12393. return this.format(prefix + year + datetime + suffix);
  12394. }
  12395. function format(inputString) {
  12396. if (!inputString) {
  12397. inputString = this.isUtc()
  12398. ? hooks.defaultFormatUtc
  12399. : hooks.defaultFormat;
  12400. }
  12401. var output = formatMoment(this, inputString);
  12402. return this.localeData().postformat(output);
  12403. }
  12404. function from(time, withoutSuffix) {
  12405. if (
  12406. this.isValid() &&
  12407. ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
  12408. ) {
  12409. return createDuration({ to: this, from: time })
  12410. .locale(this.locale())
  12411. .humanize(!withoutSuffix);
  12412. } else {
  12413. return this.localeData().invalidDate();
  12414. }
  12415. }
  12416. function fromNow(withoutSuffix) {
  12417. return this.from(createLocal(), withoutSuffix);
  12418. }
  12419. function to(time, withoutSuffix) {
  12420. if (
  12421. this.isValid() &&
  12422. ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
  12423. ) {
  12424. return createDuration({ from: this, to: time })
  12425. .locale(this.locale())
  12426. .humanize(!withoutSuffix);
  12427. } else {
  12428. return this.localeData().invalidDate();
  12429. }
  12430. }
  12431. function toNow(withoutSuffix) {
  12432. return this.to(createLocal(), withoutSuffix);
  12433. }
  12434. // If passed a locale key, it will set the locale for this
  12435. // instance. Otherwise, it will return the locale configuration
  12436. // variables for this instance.
  12437. function locale(key) {
  12438. var newLocaleData;
  12439. if (key === undefined) {
  12440. return this._locale._abbr;
  12441. } else {
  12442. newLocaleData = getLocale(key);
  12443. if (newLocaleData != null) {
  12444. this._locale = newLocaleData;
  12445. }
  12446. return this;
  12447. }
  12448. }
  12449. var lang = deprecate(
  12450. 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
  12451. function (key) {
  12452. if (key === undefined) {
  12453. return this.localeData();
  12454. } else {
  12455. return this.locale(key);
  12456. }
  12457. }
  12458. );
  12459. function localeData() {
  12460. return this._locale;
  12461. }
  12462. var MS_PER_SECOND = 1000,
  12463. MS_PER_MINUTE = 60 * MS_PER_SECOND,
  12464. MS_PER_HOUR = 60 * MS_PER_MINUTE,
  12465. MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
  12466. // actual modulo - handles negative numbers (for dates before 1970):
  12467. function mod$1(dividend, divisor) {
  12468. return ((dividend % divisor) + divisor) % divisor;
  12469. }
  12470. function localStartOfDate(y, m, d) {
  12471. // the date constructor remaps years 0-99 to 1900-1999
  12472. if (y < 100 && y >= 0) {
  12473. // preserve leap years using a full 400 year cycle, then reset
  12474. return new Date(y + 400, m, d) - MS_PER_400_YEARS;
  12475. } else {
  12476. return new Date(y, m, d).valueOf();
  12477. }
  12478. }
  12479. function utcStartOfDate(y, m, d) {
  12480. // Date.UTC remaps years 0-99 to 1900-1999
  12481. if (y < 100 && y >= 0) {
  12482. // preserve leap years using a full 400 year cycle, then reset
  12483. return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
  12484. } else {
  12485. return Date.UTC(y, m, d);
  12486. }
  12487. }
  12488. function startOf(units) {
  12489. var time, startOfDate;
  12490. units = normalizeUnits(units);
  12491. if (units === undefined || units === 'millisecond' || !this.isValid()) {
  12492. return this;
  12493. }
  12494. startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
  12495. switch (units) {
  12496. case 'year':
  12497. time = startOfDate(this.year(), 0, 1);
  12498. break;
  12499. case 'quarter':
  12500. time = startOfDate(
  12501. this.year(),
  12502. this.month() - (this.month() % 3),
  12503. 1
  12504. );
  12505. break;
  12506. case 'month':
  12507. time = startOfDate(this.year(), this.month(), 1);
  12508. break;
  12509. case 'week':
  12510. time = startOfDate(
  12511. this.year(),
  12512. this.month(),
  12513. this.date() - this.weekday()
  12514. );
  12515. break;
  12516. case 'isoWeek':
  12517. time = startOfDate(
  12518. this.year(),
  12519. this.month(),
  12520. this.date() - (this.isoWeekday() - 1)
  12521. );
  12522. break;
  12523. case 'day':
  12524. case 'date':
  12525. time = startOfDate(this.year(), this.month(), this.date());
  12526. break;
  12527. case 'hour':
  12528. time = this._d.valueOf();
  12529. time -= mod$1(
  12530. time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
  12531. MS_PER_HOUR
  12532. );
  12533. break;
  12534. case 'minute':
  12535. time = this._d.valueOf();
  12536. time -= mod$1(time, MS_PER_MINUTE);
  12537. break;
  12538. case 'second':
  12539. time = this._d.valueOf();
  12540. time -= mod$1(time, MS_PER_SECOND);
  12541. break;
  12542. }
  12543. this._d.setTime(time);
  12544. hooks.updateOffset(this, true);
  12545. return this;
  12546. }
  12547. function endOf(units) {
  12548. var time, startOfDate;
  12549. units = normalizeUnits(units);
  12550. if (units === undefined || units === 'millisecond' || !this.isValid()) {
  12551. return this;
  12552. }
  12553. startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
  12554. switch (units) {
  12555. case 'year':
  12556. time = startOfDate(this.year() + 1, 0, 1) - 1;
  12557. break;
  12558. case 'quarter':
  12559. time =
  12560. startOfDate(
  12561. this.year(),
  12562. this.month() - (this.month() % 3) + 3,
  12563. 1
  12564. ) - 1;
  12565. break;
  12566. case 'month':
  12567. time = startOfDate(this.year(), this.month() + 1, 1) - 1;
  12568. break;
  12569. case 'week':
  12570. time =
  12571. startOfDate(
  12572. this.year(),
  12573. this.month(),
  12574. this.date() - this.weekday() + 7
  12575. ) - 1;
  12576. break;
  12577. case 'isoWeek':
  12578. time =
  12579. startOfDate(
  12580. this.year(),
  12581. this.month(),
  12582. this.date() - (this.isoWeekday() - 1) + 7
  12583. ) - 1;
  12584. break;
  12585. case 'day':
  12586. case 'date':
  12587. time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
  12588. break;
  12589. case 'hour':
  12590. time = this._d.valueOf();
  12591. time +=
  12592. MS_PER_HOUR -
  12593. mod$1(
  12594. time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
  12595. MS_PER_HOUR
  12596. ) -
  12597. 1;
  12598. break;
  12599. case 'minute':
  12600. time = this._d.valueOf();
  12601. time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
  12602. break;
  12603. case 'second':
  12604. time = this._d.valueOf();
  12605. time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
  12606. break;
  12607. }
  12608. this._d.setTime(time);
  12609. hooks.updateOffset(this, true);
  12610. return this;
  12611. }
  12612. function valueOf() {
  12613. return this._d.valueOf() - (this._offset || 0) * 60000;
  12614. }
  12615. function unix() {
  12616. return Math.floor(this.valueOf() / 1000);
  12617. }
  12618. function toDate() {
  12619. return new Date(this.valueOf());
  12620. }
  12621. function toArray() {
  12622. var m = this;
  12623. return [
  12624. m.year(),
  12625. m.month(),
  12626. m.date(),
  12627. m.hour(),
  12628. m.minute(),
  12629. m.second(),
  12630. m.millisecond(),
  12631. ];
  12632. }
  12633. function toObject() {
  12634. var m = this;
  12635. return {
  12636. years: m.year(),
  12637. months: m.month(),
  12638. date: m.date(),
  12639. hours: m.hours(),
  12640. minutes: m.minutes(),
  12641. seconds: m.seconds(),
  12642. milliseconds: m.milliseconds(),
  12643. };
  12644. }
  12645. function toJSON() {
  12646. // new Date(NaN).toJSON() === null
  12647. return this.isValid() ? this.toISOString() : null;
  12648. }
  12649. function isValid$2() {
  12650. return isValid(this);
  12651. }
  12652. function parsingFlags() {
  12653. return extend({}, getParsingFlags(this));
  12654. }
  12655. function invalidAt() {
  12656. return getParsingFlags(this).overflow;
  12657. }
  12658. function creationData() {
  12659. return {
  12660. input: this._i,
  12661. format: this._f,
  12662. locale: this._locale,
  12663. isUTC: this._isUTC,
  12664. strict: this._strict,
  12665. };
  12666. }
  12667. addFormatToken('N', 0, 0, 'eraAbbr');
  12668. addFormatToken('NN', 0, 0, 'eraAbbr');
  12669. addFormatToken('NNN', 0, 0, 'eraAbbr');
  12670. addFormatToken('NNNN', 0, 0, 'eraName');
  12671. addFormatToken('NNNNN', 0, 0, 'eraNarrow');
  12672. addFormatToken('y', ['y', 1], 'yo', 'eraYear');
  12673. addFormatToken('y', ['yy', 2], 0, 'eraYear');
  12674. addFormatToken('y', ['yyy', 3], 0, 'eraYear');
  12675. addFormatToken('y', ['yyyy', 4], 0, 'eraYear');
  12676. addRegexToken('N', matchEraAbbr);
  12677. addRegexToken('NN', matchEraAbbr);
  12678. addRegexToken('NNN', matchEraAbbr);
  12679. addRegexToken('NNNN', matchEraName);
  12680. addRegexToken('NNNNN', matchEraNarrow);
  12681. addParseToken(
  12682. ['N', 'NN', 'NNN', 'NNNN', 'NNNNN'],
  12683. function (input, array, config, token) {
  12684. var era = config._locale.erasParse(input, token, config._strict);
  12685. if (era) {
  12686. getParsingFlags(config).era = era;
  12687. } else {
  12688. getParsingFlags(config).invalidEra = input;
  12689. }
  12690. }
  12691. );
  12692. addRegexToken('y', matchUnsigned);
  12693. addRegexToken('yy', matchUnsigned);
  12694. addRegexToken('yyy', matchUnsigned);
  12695. addRegexToken('yyyy', matchUnsigned);
  12696. addRegexToken('yo', matchEraYearOrdinal);
  12697. addParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR);
  12698. addParseToken(['yo'], function (input, array, config, token) {
  12699. var match;
  12700. if (config._locale._eraYearOrdinalRegex) {
  12701. match = input.match(config._locale._eraYearOrdinalRegex);
  12702. }
  12703. if (config._locale.eraYearOrdinalParse) {
  12704. array[YEAR] = config._locale.eraYearOrdinalParse(input, match);
  12705. } else {
  12706. array[YEAR] = parseInt(input, 10);
  12707. }
  12708. });
  12709. function localeEras(m, format) {
  12710. var i,
  12711. l,
  12712. date,
  12713. eras = this._eras || getLocale('en')._eras;
  12714. for (i = 0, l = eras.length; i < l; ++i) {
  12715. switch (typeof eras[i].since) {
  12716. case 'string':
  12717. // truncate time
  12718. date = hooks(eras[i].since).startOf('day');
  12719. eras[i].since = date.valueOf();
  12720. break;
  12721. }
  12722. switch (typeof eras[i].until) {
  12723. case 'undefined':
  12724. eras[i].until = +Infinity;
  12725. break;
  12726. case 'string':
  12727. // truncate time
  12728. date = hooks(eras[i].until).startOf('day').valueOf();
  12729. eras[i].until = date.valueOf();
  12730. break;
  12731. }
  12732. }
  12733. return eras;
  12734. }
  12735. function localeErasParse(eraName, format, strict) {
  12736. var i,
  12737. l,
  12738. eras = this.eras(),
  12739. name,
  12740. abbr,
  12741. narrow;
  12742. eraName = eraName.toUpperCase();
  12743. for (i = 0, l = eras.length; i < l; ++i) {
  12744. name = eras[i].name.toUpperCase();
  12745. abbr = eras[i].abbr.toUpperCase();
  12746. narrow = eras[i].narrow.toUpperCase();
  12747. if (strict) {
  12748. switch (format) {
  12749. case 'N':
  12750. case 'NN':
  12751. case 'NNN':
  12752. if (abbr === eraName) {
  12753. return eras[i];
  12754. }
  12755. break;
  12756. case 'NNNN':
  12757. if (name === eraName) {
  12758. return eras[i];
  12759. }
  12760. break;
  12761. case 'NNNNN':
  12762. if (narrow === eraName) {
  12763. return eras[i];
  12764. }
  12765. break;
  12766. }
  12767. } else if ([name, abbr, narrow].indexOf(eraName) >= 0) {
  12768. return eras[i];
  12769. }
  12770. }
  12771. }
  12772. function localeErasConvertYear(era, year) {
  12773. var dir = era.since <= era.until ? +1 : -1;
  12774. if (year === undefined) {
  12775. return hooks(era.since).year();
  12776. } else {
  12777. return hooks(era.since).year() + (year - era.offset) * dir;
  12778. }
  12779. }
  12780. function getEraName() {
  12781. var i,
  12782. l,
  12783. val,
  12784. eras = this.localeData().eras();
  12785. for (i = 0, l = eras.length; i < l; ++i) {
  12786. // truncate time
  12787. val = this.clone().startOf('day').valueOf();
  12788. if (eras[i].since <= val && val <= eras[i].until) {
  12789. return eras[i].name;
  12790. }
  12791. if (eras[i].until <= val && val <= eras[i].since) {
  12792. return eras[i].name;
  12793. }
  12794. }
  12795. return '';
  12796. }
  12797. function getEraNarrow() {
  12798. var i,
  12799. l,
  12800. val,
  12801. eras = this.localeData().eras();
  12802. for (i = 0, l = eras.length; i < l; ++i) {
  12803. // truncate time
  12804. val = this.clone().startOf('day').valueOf();
  12805. if (eras[i].since <= val && val <= eras[i].until) {
  12806. return eras[i].narrow;
  12807. }
  12808. if (eras[i].until <= val && val <= eras[i].since) {
  12809. return eras[i].narrow;
  12810. }
  12811. }
  12812. return '';
  12813. }
  12814. function getEraAbbr() {
  12815. var i,
  12816. l,
  12817. val,
  12818. eras = this.localeData().eras();
  12819. for (i = 0, l = eras.length; i < l; ++i) {
  12820. // truncate time
  12821. val = this.clone().startOf('day').valueOf();
  12822. if (eras[i].since <= val && val <= eras[i].until) {
  12823. return eras[i].abbr;
  12824. }
  12825. if (eras[i].until <= val && val <= eras[i].since) {
  12826. return eras[i].abbr;
  12827. }
  12828. }
  12829. return '';
  12830. }
  12831. function getEraYear() {
  12832. var i,
  12833. l,
  12834. dir,
  12835. val,
  12836. eras = this.localeData().eras();
  12837. for (i = 0, l = eras.length; i < l; ++i) {
  12838. dir = eras[i].since <= eras[i].until ? +1 : -1;
  12839. // truncate time
  12840. val = this.clone().startOf('day').valueOf();
  12841. if (
  12842. (eras[i].since <= val && val <= eras[i].until) ||
  12843. (eras[i].until <= val && val <= eras[i].since)
  12844. ) {
  12845. return (
  12846. (this.year() - hooks(eras[i].since).year()) * dir +
  12847. eras[i].offset
  12848. );
  12849. }
  12850. }
  12851. return this.year();
  12852. }
  12853. function erasNameRegex(isStrict) {
  12854. if (!hasOwnProp(this, '_erasNameRegex')) {
  12855. computeErasParse.call(this);
  12856. }
  12857. return isStrict ? this._erasNameRegex : this._erasRegex;
  12858. }
  12859. function erasAbbrRegex(isStrict) {
  12860. if (!hasOwnProp(this, '_erasAbbrRegex')) {
  12861. computeErasParse.call(this);
  12862. }
  12863. return isStrict ? this._erasAbbrRegex : this._erasRegex;
  12864. }
  12865. function erasNarrowRegex(isStrict) {
  12866. if (!hasOwnProp(this, '_erasNarrowRegex')) {
  12867. computeErasParse.call(this);
  12868. }
  12869. return isStrict ? this._erasNarrowRegex : this._erasRegex;
  12870. }
  12871. function matchEraAbbr(isStrict, locale) {
  12872. return locale.erasAbbrRegex(isStrict);
  12873. }
  12874. function matchEraName(isStrict, locale) {
  12875. return locale.erasNameRegex(isStrict);
  12876. }
  12877. function matchEraNarrow(isStrict, locale) {
  12878. return locale.erasNarrowRegex(isStrict);
  12879. }
  12880. function matchEraYearOrdinal(isStrict, locale) {
  12881. return locale._eraYearOrdinalRegex || matchUnsigned;
  12882. }
  12883. function computeErasParse() {
  12884. var abbrPieces = [],
  12885. namePieces = [],
  12886. narrowPieces = [],
  12887. mixedPieces = [],
  12888. i,
  12889. l,
  12890. eras = this.eras();
  12891. for (i = 0, l = eras.length; i < l; ++i) {
  12892. namePieces.push(regexEscape(eras[i].name));
  12893. abbrPieces.push(regexEscape(eras[i].abbr));
  12894. narrowPieces.push(regexEscape(eras[i].narrow));
  12895. mixedPieces.push(regexEscape(eras[i].name));
  12896. mixedPieces.push(regexEscape(eras[i].abbr));
  12897. mixedPieces.push(regexEscape(eras[i].narrow));
  12898. }
  12899. this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  12900. this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i');
  12901. this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i');
  12902. this._erasNarrowRegex = new RegExp(
  12903. '^(' + narrowPieces.join('|') + ')',
  12904. 'i'
  12905. );
  12906. }
  12907. // FORMATTING
  12908. addFormatToken(0, ['gg', 2], 0, function () {
  12909. return this.weekYear() % 100;
  12910. });
  12911. addFormatToken(0, ['GG', 2], 0, function () {
  12912. return this.isoWeekYear() % 100;
  12913. });
  12914. function addWeekYearFormatToken(token, getter) {
  12915. addFormatToken(0, [token, token.length], 0, getter);
  12916. }
  12917. addWeekYearFormatToken('gggg', 'weekYear');
  12918. addWeekYearFormatToken('ggggg', 'weekYear');
  12919. addWeekYearFormatToken('GGGG', 'isoWeekYear');
  12920. addWeekYearFormatToken('GGGGG', 'isoWeekYear');
  12921. // ALIASES
  12922. addUnitAlias('weekYear', 'gg');
  12923. addUnitAlias('isoWeekYear', 'GG');
  12924. // PRIORITY
  12925. addUnitPriority('weekYear', 1);
  12926. addUnitPriority('isoWeekYear', 1);
  12927. // PARSING
  12928. addRegexToken('G', matchSigned);
  12929. addRegexToken('g', matchSigned);
  12930. addRegexToken('GG', match1to2, match2);
  12931. addRegexToken('gg', match1to2, match2);
  12932. addRegexToken('GGGG', match1to4, match4);
  12933. addRegexToken('gggg', match1to4, match4);
  12934. addRegexToken('GGGGG', match1to6, match6);
  12935. addRegexToken('ggggg', match1to6, match6);
  12936. addWeekParseToken(
  12937. ['gggg', 'ggggg', 'GGGG', 'GGGGG'],
  12938. function (input, week, config, token) {
  12939. week[token.substr(0, 2)] = toInt(input);
  12940. }
  12941. );
  12942. addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
  12943. week[token] = hooks.parseTwoDigitYear(input);
  12944. });
  12945. // MOMENTS
  12946. function getSetWeekYear(input) {
  12947. return getSetWeekYearHelper.call(
  12948. this,
  12949. input,
  12950. this.week(),
  12951. this.weekday(),
  12952. this.localeData()._week.dow,
  12953. this.localeData()._week.doy
  12954. );
  12955. }
  12956. function getSetISOWeekYear(input) {
  12957. return getSetWeekYearHelper.call(
  12958. this,
  12959. input,
  12960. this.isoWeek(),
  12961. this.isoWeekday(),
  12962. 1,
  12963. 4
  12964. );
  12965. }
  12966. function getISOWeeksInYear() {
  12967. return weeksInYear(this.year(), 1, 4);
  12968. }
  12969. function getISOWeeksInISOWeekYear() {
  12970. return weeksInYear(this.isoWeekYear(), 1, 4);
  12971. }
  12972. function getWeeksInYear() {
  12973. var weekInfo = this.localeData()._week;
  12974. return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
  12975. }
  12976. function getWeeksInWeekYear() {
  12977. var weekInfo = this.localeData()._week;
  12978. return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy);
  12979. }
  12980. function getSetWeekYearHelper(input, week, weekday, dow, doy) {
  12981. var weeksTarget;
  12982. if (input == null) {
  12983. return weekOfYear(this, dow, doy).year;
  12984. } else {
  12985. weeksTarget = weeksInYear(input, dow, doy);
  12986. if (week > weeksTarget) {
  12987. week = weeksTarget;
  12988. }
  12989. return setWeekAll.call(this, input, week, weekday, dow, doy);
  12990. }
  12991. }
  12992. function setWeekAll(weekYear, week, weekday, dow, doy) {
  12993. var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
  12994. date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
  12995. this.year(date.getUTCFullYear());
  12996. this.month(date.getUTCMonth());
  12997. this.date(date.getUTCDate());
  12998. return this;
  12999. }
  13000. // FORMATTING
  13001. addFormatToken('Q', 0, 'Qo', 'quarter');
  13002. // ALIASES
  13003. addUnitAlias('quarter', 'Q');
  13004. // PRIORITY
  13005. addUnitPriority('quarter', 7);
  13006. // PARSING
  13007. addRegexToken('Q', match1);
  13008. addParseToken('Q', function (input, array) {
  13009. array[MONTH] = (toInt(input) - 1) * 3;
  13010. });
  13011. // MOMENTS
  13012. function getSetQuarter(input) {
  13013. return input == null
  13014. ? Math.ceil((this.month() + 1) / 3)
  13015. : this.month((input - 1) * 3 + (this.month() % 3));
  13016. }
  13017. // FORMATTING
  13018. addFormatToken('D', ['DD', 2], 'Do', 'date');
  13019. // ALIASES
  13020. addUnitAlias('date', 'D');
  13021. // PRIORITY
  13022. addUnitPriority('date', 9);
  13023. // PARSING
  13024. addRegexToken('D', match1to2);
  13025. addRegexToken('DD', match1to2, match2);
  13026. addRegexToken('Do', function (isStrict, locale) {
  13027. // TODO: Remove "ordinalParse" fallback in next major release.
  13028. return isStrict
  13029. ? locale._dayOfMonthOrdinalParse || locale._ordinalParse
  13030. : locale._dayOfMonthOrdinalParseLenient;
  13031. });
  13032. addParseToken(['D', 'DD'], DATE);
  13033. addParseToken('Do', function (input, array) {
  13034. array[DATE] = toInt(input.match(match1to2)[0]);
  13035. });
  13036. // MOMENTS
  13037. var getSetDayOfMonth = makeGetSet('Date', true);
  13038. // FORMATTING
  13039. addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
  13040. // ALIASES
  13041. addUnitAlias('dayOfYear', 'DDD');
  13042. // PRIORITY
  13043. addUnitPriority('dayOfYear', 4);
  13044. // PARSING
  13045. addRegexToken('DDD', match1to3);
  13046. addRegexToken('DDDD', match3);
  13047. addParseToken(['DDD', 'DDDD'], function (input, array, config) {
  13048. config._dayOfYear = toInt(input);
  13049. });
  13050. // HELPERS
  13051. // MOMENTS
  13052. function getSetDayOfYear(input) {
  13053. var dayOfYear =
  13054. Math.round(
  13055. (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5
  13056. ) + 1;
  13057. return input == null ? dayOfYear : this.add(input - dayOfYear, 'd');
  13058. }
  13059. // FORMATTING
  13060. addFormatToken('m', ['mm', 2], 0, 'minute');
  13061. // ALIASES
  13062. addUnitAlias('minute', 'm');
  13063. // PRIORITY
  13064. addUnitPriority('minute', 14);
  13065. // PARSING
  13066. addRegexToken('m', match1to2);
  13067. addRegexToken('mm', match1to2, match2);
  13068. addParseToken(['m', 'mm'], MINUTE);
  13069. // MOMENTS
  13070. var getSetMinute = makeGetSet('Minutes', false);
  13071. // FORMATTING
  13072. addFormatToken('s', ['ss', 2], 0, 'second');
  13073. // ALIASES
  13074. addUnitAlias('second', 's');
  13075. // PRIORITY
  13076. addUnitPriority('second', 15);
  13077. // PARSING
  13078. addRegexToken('s', match1to2);
  13079. addRegexToken('ss', match1to2, match2);
  13080. addParseToken(['s', 'ss'], SECOND);
  13081. // MOMENTS
  13082. var getSetSecond = makeGetSet('Seconds', false);
  13083. // FORMATTING
  13084. addFormatToken('S', 0, 0, function () {
  13085. return ~~(this.millisecond() / 100);
  13086. });
  13087. addFormatToken(0, ['SS', 2], 0, function () {
  13088. return ~~(this.millisecond() / 10);
  13089. });
  13090. addFormatToken(0, ['SSS', 3], 0, 'millisecond');
  13091. addFormatToken(0, ['SSSS', 4], 0, function () {
  13092. return this.millisecond() * 10;
  13093. });
  13094. addFormatToken(0, ['SSSSS', 5], 0, function () {
  13095. return this.millisecond() * 100;
  13096. });
  13097. addFormatToken(0, ['SSSSSS', 6], 0, function () {
  13098. return this.millisecond() * 1000;
  13099. });
  13100. addFormatToken(0, ['SSSSSSS', 7], 0, function () {
  13101. return this.millisecond() * 10000;
  13102. });
  13103. addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
  13104. return this.millisecond() * 100000;
  13105. });
  13106. addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
  13107. return this.millisecond() * 1000000;
  13108. });
  13109. // ALIASES
  13110. addUnitAlias('millisecond', 'ms');
  13111. // PRIORITY
  13112. addUnitPriority('millisecond', 16);
  13113. // PARSING
  13114. addRegexToken('S', match1to3, match1);
  13115. addRegexToken('SS', match1to3, match2);
  13116. addRegexToken('SSS', match1to3, match3);
  13117. var token, getSetMillisecond;
  13118. for (token = 'SSSS'; token.length <= 9; token += 'S') {
  13119. addRegexToken(token, matchUnsigned);
  13120. }
  13121. function parseMs(input, array) {
  13122. array[MILLISECOND] = toInt(('0.' + input) * 1000);
  13123. }
  13124. for (token = 'S'; token.length <= 9; token += 'S') {
  13125. addParseToken(token, parseMs);
  13126. }
  13127. getSetMillisecond = makeGetSet('Milliseconds', false);
  13128. // FORMATTING
  13129. addFormatToken('z', 0, 0, 'zoneAbbr');
  13130. addFormatToken('zz', 0, 0, 'zoneName');
  13131. // MOMENTS
  13132. function getZoneAbbr() {
  13133. return this._isUTC ? 'UTC' : '';
  13134. }
  13135. function getZoneName() {
  13136. return this._isUTC ? 'Coordinated Universal Time' : '';
  13137. }
  13138. var proto = Moment.prototype;
  13139. proto.add = add;
  13140. proto.calendar = calendar$1;
  13141. proto.clone = clone;
  13142. proto.diff = diff;
  13143. proto.endOf = endOf;
  13144. proto.format = format;
  13145. proto.from = from;
  13146. proto.fromNow = fromNow;
  13147. proto.to = to;
  13148. proto.toNow = toNow;
  13149. proto.get = stringGet;
  13150. proto.invalidAt = invalidAt;
  13151. proto.isAfter = isAfter;
  13152. proto.isBefore = isBefore;
  13153. proto.isBetween = isBetween;
  13154. proto.isSame = isSame;
  13155. proto.isSameOrAfter = isSameOrAfter;
  13156. proto.isSameOrBefore = isSameOrBefore;
  13157. proto.isValid = isValid$2;
  13158. proto.lang = lang;
  13159. proto.locale = locale;
  13160. proto.localeData = localeData;
  13161. proto.max = prototypeMax;
  13162. proto.min = prototypeMin;
  13163. proto.parsingFlags = parsingFlags;
  13164. proto.set = stringSet;
  13165. proto.startOf = startOf;
  13166. proto.subtract = subtract;
  13167. proto.toArray = toArray;
  13168. proto.toObject = toObject;
  13169. proto.toDate = toDate;
  13170. proto.toISOString = toISOString;
  13171. proto.inspect = inspect;
  13172. if (typeof Symbol !== 'undefined' && Symbol.for != null) {
  13173. proto[Symbol.for('nodejs.util.inspect.custom')] = function () {
  13174. return 'Moment<' + this.format() + '>';
  13175. };
  13176. }
  13177. proto.toJSON = toJSON;
  13178. proto.toString = toString;
  13179. proto.unix = unix;
  13180. proto.valueOf = valueOf;
  13181. proto.creationData = creationData;
  13182. proto.eraName = getEraName;
  13183. proto.eraNarrow = getEraNarrow;
  13184. proto.eraAbbr = getEraAbbr;
  13185. proto.eraYear = getEraYear;
  13186. proto.year = getSetYear;
  13187. proto.isLeapYear = getIsLeapYear;
  13188. proto.weekYear = getSetWeekYear;
  13189. proto.isoWeekYear = getSetISOWeekYear;
  13190. proto.quarter = proto.quarters = getSetQuarter;
  13191. proto.month = getSetMonth;
  13192. proto.daysInMonth = getDaysInMonth;
  13193. proto.week = proto.weeks = getSetWeek;
  13194. proto.isoWeek = proto.isoWeeks = getSetISOWeek;
  13195. proto.weeksInYear = getWeeksInYear;
  13196. proto.weeksInWeekYear = getWeeksInWeekYear;
  13197. proto.isoWeeksInYear = getISOWeeksInYear;
  13198. proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear;
  13199. proto.date = getSetDayOfMonth;
  13200. proto.day = proto.days = getSetDayOfWeek;
  13201. proto.weekday = getSetLocaleDayOfWeek;
  13202. proto.isoWeekday = getSetISODayOfWeek;
  13203. proto.dayOfYear = getSetDayOfYear;
  13204. proto.hour = proto.hours = getSetHour;
  13205. proto.minute = proto.minutes = getSetMinute;
  13206. proto.second = proto.seconds = getSetSecond;
  13207. proto.millisecond = proto.milliseconds = getSetMillisecond;
  13208. proto.utcOffset = getSetOffset;
  13209. proto.utc = setOffsetToUTC;
  13210. proto.local = setOffsetToLocal;
  13211. proto.parseZone = setOffsetToParsedOffset;
  13212. proto.hasAlignedHourOffset = hasAlignedHourOffset;
  13213. proto.isDST = isDaylightSavingTime;
  13214. proto.isLocal = isLocal;
  13215. proto.isUtcOffset = isUtcOffset;
  13216. proto.isUtc = isUtc;
  13217. proto.isUTC = isUtc;
  13218. proto.zoneAbbr = getZoneAbbr;
  13219. proto.zoneName = getZoneName;
  13220. proto.dates = deprecate(
  13221. 'dates accessor is deprecated. Use date instead.',
  13222. getSetDayOfMonth
  13223. );
  13224. proto.months = deprecate(
  13225. 'months accessor is deprecated. Use month instead',
  13226. getSetMonth
  13227. );
  13228. proto.years = deprecate(
  13229. 'years accessor is deprecated. Use year instead',
  13230. getSetYear
  13231. );
  13232. proto.zone = deprecate(
  13233. 'moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/',
  13234. getSetZone
  13235. );
  13236. proto.isDSTShifted = deprecate(
  13237. 'isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information',
  13238. isDaylightSavingTimeShifted
  13239. );
  13240. function createUnix(input) {
  13241. return createLocal(input * 1000);
  13242. }
  13243. function createInZone() {
  13244. return createLocal.apply(null, arguments).parseZone();
  13245. }
  13246. function preParsePostFormat(string) {
  13247. return string;
  13248. }
  13249. var proto$1 = Locale.prototype;
  13250. proto$1.calendar = calendar;
  13251. proto$1.longDateFormat = longDateFormat;
  13252. proto$1.invalidDate = invalidDate;
  13253. proto$1.ordinal = ordinal;
  13254. proto$1.preparse = preParsePostFormat;
  13255. proto$1.postformat = preParsePostFormat;
  13256. proto$1.relativeTime = relativeTime;
  13257. proto$1.pastFuture = pastFuture;
  13258. proto$1.set = set;
  13259. proto$1.eras = localeEras;
  13260. proto$1.erasParse = localeErasParse;
  13261. proto$1.erasConvertYear = localeErasConvertYear;
  13262. proto$1.erasAbbrRegex = erasAbbrRegex;
  13263. proto$1.erasNameRegex = erasNameRegex;
  13264. proto$1.erasNarrowRegex = erasNarrowRegex;
  13265. proto$1.months = localeMonths;
  13266. proto$1.monthsShort = localeMonthsShort;
  13267. proto$1.monthsParse = localeMonthsParse;
  13268. proto$1.monthsRegex = monthsRegex;
  13269. proto$1.monthsShortRegex = monthsShortRegex;
  13270. proto$1.week = localeWeek;
  13271. proto$1.firstDayOfYear = localeFirstDayOfYear;
  13272. proto$1.firstDayOfWeek = localeFirstDayOfWeek;
  13273. proto$1.weekdays = localeWeekdays;
  13274. proto$1.weekdaysMin = localeWeekdaysMin;
  13275. proto$1.weekdaysShort = localeWeekdaysShort;
  13276. proto$1.weekdaysParse = localeWeekdaysParse;
  13277. proto$1.weekdaysRegex = weekdaysRegex;
  13278. proto$1.weekdaysShortRegex = weekdaysShortRegex;
  13279. proto$1.weekdaysMinRegex = weekdaysMinRegex;
  13280. proto$1.isPM = localeIsPM;
  13281. proto$1.meridiem = localeMeridiem;
  13282. function get$1(format, index, field, setter) {
  13283. var locale = getLocale(),
  13284. utc = createUTC().set(setter, index);
  13285. return locale[field](utc, format);
  13286. }
  13287. function listMonthsImpl(format, index, field) {
  13288. if (isNumber(format)) {
  13289. index = format;
  13290. format = undefined;
  13291. }
  13292. format = format || '';
  13293. if (index != null) {
  13294. return get$1(format, index, field, 'month');
  13295. }
  13296. var i,
  13297. out = [];
  13298. for (i = 0; i < 12; i++) {
  13299. out[i] = get$1(format, i, field, 'month');
  13300. }
  13301. return out;
  13302. }
  13303. // ()
  13304. // (5)
  13305. // (fmt, 5)
  13306. // (fmt)
  13307. // (true)
  13308. // (true, 5)
  13309. // (true, fmt, 5)
  13310. // (true, fmt)
  13311. function listWeekdaysImpl(localeSorted, format, index, field) {
  13312. if (typeof localeSorted === 'boolean') {
  13313. if (isNumber(format)) {
  13314. index = format;
  13315. format = undefined;
  13316. }
  13317. format = format || '';
  13318. } else {
  13319. format = localeSorted;
  13320. index = format;
  13321. localeSorted = false;
  13322. if (isNumber(format)) {
  13323. index = format;
  13324. format = undefined;
  13325. }
  13326. format = format || '';
  13327. }
  13328. var locale = getLocale(),
  13329. shift = localeSorted ? locale._week.dow : 0,
  13330. i,
  13331. out = [];
  13332. if (index != null) {
  13333. return get$1(format, (index + shift) % 7, field, 'day');
  13334. }
  13335. for (i = 0; i < 7; i++) {
  13336. out[i] = get$1(format, (i + shift) % 7, field, 'day');
  13337. }
  13338. return out;
  13339. }
  13340. function listMonths(format, index) {
  13341. return listMonthsImpl(format, index, 'months');
  13342. }
  13343. function listMonthsShort(format, index) {
  13344. return listMonthsImpl(format, index, 'monthsShort');
  13345. }
  13346. function listWeekdays(localeSorted, format, index) {
  13347. return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
  13348. }
  13349. function listWeekdaysShort(localeSorted, format, index) {
  13350. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
  13351. }
  13352. function listWeekdaysMin(localeSorted, format, index) {
  13353. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
  13354. }
  13355. getSetGlobalLocale('en', {
  13356. eras: [
  13357. {
  13358. since: '0001-01-01',
  13359. until: +Infinity,
  13360. offset: 1,
  13361. name: 'Anno Domini',
  13362. narrow: 'AD',
  13363. abbr: 'AD',
  13364. },
  13365. {
  13366. since: '0000-12-31',
  13367. until: -Infinity,
  13368. offset: 1,
  13369. name: 'Before Christ',
  13370. narrow: 'BC',
  13371. abbr: 'BC',
  13372. },
  13373. ],
  13374. dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
  13375. ordinal: function (number) {
  13376. var b = number % 10,
  13377. output =
  13378. toInt((number % 100) / 10) === 1
  13379. ? 'th'
  13380. : b === 1
  13381. ? 'st'
  13382. : b === 2
  13383. ? 'nd'
  13384. : b === 3
  13385. ? 'rd'
  13386. : 'th';
  13387. return number + output;
  13388. },
  13389. });
  13390. // Side effect imports
  13391. hooks.lang = deprecate(
  13392. 'moment.lang is deprecated. Use moment.locale instead.',
  13393. getSetGlobalLocale
  13394. );
  13395. hooks.langData = deprecate(
  13396. 'moment.langData is deprecated. Use moment.localeData instead.',
  13397. getLocale
  13398. );
  13399. var mathAbs = Math.abs;
  13400. function abs() {
  13401. var data = this._data;
  13402. this._milliseconds = mathAbs(this._milliseconds);
  13403. this._days = mathAbs(this._days);
  13404. this._months = mathAbs(this._months);
  13405. data.milliseconds = mathAbs(data.milliseconds);
  13406. data.seconds = mathAbs(data.seconds);
  13407. data.minutes = mathAbs(data.minutes);
  13408. data.hours = mathAbs(data.hours);
  13409. data.months = mathAbs(data.months);
  13410. data.years = mathAbs(data.years);
  13411. return this;
  13412. }
  13413. function addSubtract$1(duration, input, value, direction) {
  13414. var other = createDuration(input, value);
  13415. duration._milliseconds += direction * other._milliseconds;
  13416. duration._days += direction * other._days;
  13417. duration._months += direction * other._months;
  13418. return duration._bubble();
  13419. }
  13420. // supports only 2.0-style add(1, 's') or add(duration)
  13421. function add$1(input, value) {
  13422. return addSubtract$1(this, input, value, 1);
  13423. }
  13424. // supports only 2.0-style subtract(1, 's') or subtract(duration)
  13425. function subtract$1(input, value) {
  13426. return addSubtract$1(this, input, value, -1);
  13427. }
  13428. function absCeil(number) {
  13429. if (number < 0) {
  13430. return Math.floor(number);
  13431. } else {
  13432. return Math.ceil(number);
  13433. }
  13434. }
  13435. function bubble() {
  13436. var milliseconds = this._milliseconds,
  13437. days = this._days,
  13438. months = this._months,
  13439. data = this._data,
  13440. seconds,
  13441. minutes,
  13442. hours,
  13443. years,
  13444. monthsFromDays;
  13445. // if we have a mix of positive and negative values, bubble down first
  13446. // check: https://github.com/moment/moment/issues/2166
  13447. if (
  13448. !(
  13449. (milliseconds >= 0 && days >= 0 && months >= 0) ||
  13450. (milliseconds <= 0 && days <= 0 && months <= 0)
  13451. )
  13452. ) {
  13453. milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
  13454. days = 0;
  13455. months = 0;
  13456. }
  13457. // The following code bubbles up values, see the tests for
  13458. // examples of what that means.
  13459. data.milliseconds = milliseconds % 1000;
  13460. seconds = absFloor(milliseconds / 1000);
  13461. data.seconds = seconds % 60;
  13462. minutes = absFloor(seconds / 60);
  13463. data.minutes = minutes % 60;
  13464. hours = absFloor(minutes / 60);
  13465. data.hours = hours % 24;
  13466. days += absFloor(hours / 24);
  13467. // convert days to months
  13468. monthsFromDays = absFloor(daysToMonths(days));
  13469. months += monthsFromDays;
  13470. days -= absCeil(monthsToDays(monthsFromDays));
  13471. // 12 months -> 1 year
  13472. years = absFloor(months / 12);
  13473. months %= 12;
  13474. data.days = days;
  13475. data.months = months;
  13476. data.years = years;
  13477. return this;
  13478. }
  13479. function daysToMonths(days) {
  13480. // 400 years have 146097 days (taking into account leap year rules)
  13481. // 400 years have 12 months === 4800
  13482. return (days * 4800) / 146097;
  13483. }
  13484. function monthsToDays(months) {
  13485. // the reverse of daysToMonths
  13486. return (months * 146097) / 4800;
  13487. }
  13488. function as(units) {
  13489. if (!this.isValid()) {
  13490. return NaN;
  13491. }
  13492. var days,
  13493. months,
  13494. milliseconds = this._milliseconds;
  13495. units = normalizeUnits(units);
  13496. if (units === 'month' || units === 'quarter' || units === 'year') {
  13497. days = this._days + milliseconds / 864e5;
  13498. months = this._months + daysToMonths(days);
  13499. switch (units) {
  13500. case 'month':
  13501. return months;
  13502. case 'quarter':
  13503. return months / 3;
  13504. case 'year':
  13505. return months / 12;
  13506. }
  13507. } else {
  13508. // handle milliseconds separately because of floating point math errors (issue #1867)
  13509. days = this._days + Math.round(monthsToDays(this._months));
  13510. switch (units) {
  13511. case 'week':
  13512. return days / 7 + milliseconds / 6048e5;
  13513. case 'day':
  13514. return days + milliseconds / 864e5;
  13515. case 'hour':
  13516. return days * 24 + milliseconds / 36e5;
  13517. case 'minute':
  13518. return days * 1440 + milliseconds / 6e4;
  13519. case 'second':
  13520. return days * 86400 + milliseconds / 1000;
  13521. // Math.floor prevents floating point math errors here
  13522. case 'millisecond':
  13523. return Math.floor(days * 864e5) + milliseconds;
  13524. default:
  13525. throw new Error('Unknown unit ' + units);
  13526. }
  13527. }
  13528. }
  13529. // TODO: Use this.as('ms')?
  13530. function valueOf$1() {
  13531. if (!this.isValid()) {
  13532. return NaN;
  13533. }
  13534. return (
  13535. this._milliseconds +
  13536. this._days * 864e5 +
  13537. (this._months % 12) * 2592e6 +
  13538. toInt(this._months / 12) * 31536e6
  13539. );
  13540. }
  13541. function makeAs(alias) {
  13542. return function () {
  13543. return this.as(alias);
  13544. };
  13545. }
  13546. var asMilliseconds = makeAs('ms'),
  13547. asSeconds = makeAs('s'),
  13548. asMinutes = makeAs('m'),
  13549. asHours = makeAs('h'),
  13550. asDays = makeAs('d'),
  13551. asWeeks = makeAs('w'),
  13552. asMonths = makeAs('M'),
  13553. asQuarters = makeAs('Q'),
  13554. asYears = makeAs('y');
  13555. function clone$1() {
  13556. return createDuration(this);
  13557. }
  13558. function get$2(units) {
  13559. units = normalizeUnits(units);
  13560. return this.isValid() ? this[units + 's']() : NaN;
  13561. }
  13562. function makeGetter(name) {
  13563. return function () {
  13564. return this.isValid() ? this._data[name] : NaN;
  13565. };
  13566. }
  13567. var milliseconds = makeGetter('milliseconds'),
  13568. seconds = makeGetter('seconds'),
  13569. minutes = makeGetter('minutes'),
  13570. hours = makeGetter('hours'),
  13571. days = makeGetter('days'),
  13572. months = makeGetter('months'),
  13573. years = makeGetter('years');
  13574. function weeks() {
  13575. return absFloor(this.days() / 7);
  13576. }
  13577. var round = Math.round,
  13578. thresholds = {
  13579. ss: 44, // a few seconds to seconds
  13580. s: 45, // seconds to minute
  13581. m: 45, // minutes to hour
  13582. h: 22, // hours to day
  13583. d: 26, // days to month/week
  13584. w: null, // weeks to month
  13585. M: 11, // months to year
  13586. };
  13587. // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
  13588. function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
  13589. return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
  13590. }
  13591. function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) {
  13592. var duration = createDuration(posNegDuration).abs(),
  13593. seconds = round(duration.as('s')),
  13594. minutes = round(duration.as('m')),
  13595. hours = round(duration.as('h')),
  13596. days = round(duration.as('d')),
  13597. months = round(duration.as('M')),
  13598. weeks = round(duration.as('w')),
  13599. years = round(duration.as('y')),
  13600. a =
  13601. (seconds <= thresholds.ss && ['s', seconds]) ||
  13602. (seconds < thresholds.s && ['ss', seconds]) ||
  13603. (minutes <= 1 && ['m']) ||
  13604. (minutes < thresholds.m && ['mm', minutes]) ||
  13605. (hours <= 1 && ['h']) ||
  13606. (hours < thresholds.h && ['hh', hours]) ||
  13607. (days <= 1 && ['d']) ||
  13608. (days < thresholds.d && ['dd', days]);
  13609. if (thresholds.w != null) {
  13610. a =
  13611. a ||
  13612. (weeks <= 1 && ['w']) ||
  13613. (weeks < thresholds.w && ['ww', weeks]);
  13614. }
  13615. a = a ||
  13616. (months <= 1 && ['M']) ||
  13617. (months < thresholds.M && ['MM', months]) ||
  13618. (years <= 1 && ['y']) || ['yy', years];
  13619. a[2] = withoutSuffix;
  13620. a[3] = +posNegDuration > 0;
  13621. a[4] = locale;
  13622. return substituteTimeAgo.apply(null, a);
  13623. }
  13624. // This function allows you to set the rounding function for relative time strings
  13625. function getSetRelativeTimeRounding(roundingFunction) {
  13626. if (roundingFunction === undefined) {
  13627. return round;
  13628. }
  13629. if (typeof roundingFunction === 'function') {
  13630. round = roundingFunction;
  13631. return true;
  13632. }
  13633. return false;
  13634. }
  13635. // This function allows you to set a threshold for relative time strings
  13636. function getSetRelativeTimeThreshold(threshold, limit) {
  13637. if (thresholds[threshold] === undefined) {
  13638. return false;
  13639. }
  13640. if (limit === undefined) {
  13641. return thresholds[threshold];
  13642. }
  13643. thresholds[threshold] = limit;
  13644. if (threshold === 's') {
  13645. thresholds.ss = limit - 1;
  13646. }
  13647. return true;
  13648. }
  13649. function humanize(argWithSuffix, argThresholds) {
  13650. if (!this.isValid()) {
  13651. return this.localeData().invalidDate();
  13652. }
  13653. var withSuffix = false,
  13654. th = thresholds,
  13655. locale,
  13656. output;
  13657. if (typeof argWithSuffix === 'object') {
  13658. argThresholds = argWithSuffix;
  13659. argWithSuffix = false;
  13660. }
  13661. if (typeof argWithSuffix === 'boolean') {
  13662. withSuffix = argWithSuffix;
  13663. }
  13664. if (typeof argThresholds === 'object') {
  13665. th = Object.assign({}, thresholds, argThresholds);
  13666. if (argThresholds.s != null && argThresholds.ss == null) {
  13667. th.ss = argThresholds.s - 1;
  13668. }
  13669. }
  13670. locale = this.localeData();
  13671. output = relativeTime$1(this, !withSuffix, th, locale);
  13672. if (withSuffix) {
  13673. output = locale.pastFuture(+this, output);
  13674. }
  13675. return locale.postformat(output);
  13676. }
  13677. var abs$1 = Math.abs;
  13678. function sign(x) {
  13679. return (x > 0) - (x < 0) || +x;
  13680. }
  13681. function toISOString$1() {
  13682. // for ISO strings we do not use the normal bubbling rules:
  13683. // * milliseconds bubble up until they become hours
  13684. // * days do not bubble at all
  13685. // * months bubble up until they become years
  13686. // This is because there is no context-free conversion between hours and days
  13687. // (think of clock changes)
  13688. // and also not between days and months (28-31 days per month)
  13689. if (!this.isValid()) {
  13690. return this.localeData().invalidDate();
  13691. }
  13692. var seconds = abs$1(this._milliseconds) / 1000,
  13693. days = abs$1(this._days),
  13694. months = abs$1(this._months),
  13695. minutes,
  13696. hours,
  13697. years,
  13698. s,
  13699. total = this.asSeconds(),
  13700. totalSign,
  13701. ymSign,
  13702. daysSign,
  13703. hmsSign;
  13704. if (!total) {
  13705. // this is the same as C#'s (Noda) and python (isodate)...
  13706. // but not other JS (goog.date)
  13707. return 'P0D';
  13708. }
  13709. // 3600 seconds -> 60 minutes -> 1 hour
  13710. minutes = absFloor(seconds / 60);
  13711. hours = absFloor(minutes / 60);
  13712. seconds %= 60;
  13713. minutes %= 60;
  13714. // 12 months -> 1 year
  13715. years = absFloor(months / 12);
  13716. months %= 12;
  13717. // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
  13718. s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
  13719. totalSign = total < 0 ? '-' : '';
  13720. ymSign = sign(this._months) !== sign(total) ? '-' : '';
  13721. daysSign = sign(this._days) !== sign(total) ? '-' : '';
  13722. hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
  13723. return (
  13724. totalSign +
  13725. 'P' +
  13726. (years ? ymSign + years + 'Y' : '') +
  13727. (months ? ymSign + months + 'M' : '') +
  13728. (days ? daysSign + days + 'D' : '') +
  13729. (hours || minutes || seconds ? 'T' : '') +
  13730. (hours ? hmsSign + hours + 'H' : '') +
  13731. (minutes ? hmsSign + minutes + 'M' : '') +
  13732. (seconds ? hmsSign + s + 'S' : '')
  13733. );
  13734. }
  13735. var proto$2 = Duration.prototype;
  13736. proto$2.isValid = isValid$1;
  13737. proto$2.abs = abs;
  13738. proto$2.add = add$1;
  13739. proto$2.subtract = subtract$1;
  13740. proto$2.as = as;
  13741. proto$2.asMilliseconds = asMilliseconds;
  13742. proto$2.asSeconds = asSeconds;
  13743. proto$2.asMinutes = asMinutes;
  13744. proto$2.asHours = asHours;
  13745. proto$2.asDays = asDays;
  13746. proto$2.asWeeks = asWeeks;
  13747. proto$2.asMonths = asMonths;
  13748. proto$2.asQuarters = asQuarters;
  13749. proto$2.asYears = asYears;
  13750. proto$2.valueOf = valueOf$1;
  13751. proto$2._bubble = bubble;
  13752. proto$2.clone = clone$1;
  13753. proto$2.get = get$2;
  13754. proto$2.milliseconds = milliseconds;
  13755. proto$2.seconds = seconds;
  13756. proto$2.minutes = minutes;
  13757. proto$2.hours = hours;
  13758. proto$2.days = days;
  13759. proto$2.weeks = weeks;
  13760. proto$2.months = months;
  13761. proto$2.years = years;
  13762. proto$2.humanize = humanize;
  13763. proto$2.toISOString = toISOString$1;
  13764. proto$2.toString = toISOString$1;
  13765. proto$2.toJSON = toISOString$1;
  13766. proto$2.locale = locale;
  13767. proto$2.localeData = localeData;
  13768. proto$2.toIsoString = deprecate(
  13769. 'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)',
  13770. toISOString$1
  13771. );
  13772. proto$2.lang = lang;
  13773. // FORMATTING
  13774. addFormatToken('X', 0, 0, 'unix');
  13775. addFormatToken('x', 0, 0, 'valueOf');
  13776. // PARSING
  13777. addRegexToken('x', matchSigned);
  13778. addRegexToken('X', matchTimestamp);
  13779. addParseToken('X', function (input, array, config) {
  13780. config._d = new Date(parseFloat(input) * 1000);
  13781. });
  13782. addParseToken('x', function (input, array, config) {
  13783. config._d = new Date(toInt(input));
  13784. });
  13785. //! moment.js
  13786. hooks.version = '2.29.4';
  13787. setHookCallback(createLocal);
  13788. hooks.fn = proto;
  13789. hooks.min = min;
  13790. hooks.max = max;
  13791. hooks.now = now;
  13792. hooks.utc = createUTC;
  13793. hooks.unix = createUnix;
  13794. hooks.months = listMonths;
  13795. hooks.isDate = isDate;
  13796. hooks.locale = getSetGlobalLocale;
  13797. hooks.invalid = createInvalid;
  13798. hooks.duration = createDuration;
  13799. hooks.isMoment = isMoment;
  13800. hooks.weekdays = listWeekdays;
  13801. hooks.parseZone = createInZone;
  13802. hooks.localeData = getLocale;
  13803. hooks.isDuration = isDuration;
  13804. hooks.monthsShort = listMonthsShort;
  13805. hooks.weekdaysMin = listWeekdaysMin;
  13806. hooks.defineLocale = defineLocale;
  13807. hooks.updateLocale = updateLocale;
  13808. hooks.locales = listLocales;
  13809. hooks.weekdaysShort = listWeekdaysShort;
  13810. hooks.normalizeUnits = normalizeUnits;
  13811. hooks.relativeTimeRounding = getSetRelativeTimeRounding;
  13812. hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
  13813. hooks.calendarFormat = getCalendarFormat;
  13814. hooks.prototype = proto;
  13815. // currently HTML5 input type only supports 24-hour formats
  13816. hooks.HTML5_FMT = {
  13817. DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // <input type="datetime-local" />
  13818. DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // <input type="datetime-local" step="1" />
  13819. DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // <input type="datetime-local" step="0.001" />
  13820. DATE: 'YYYY-MM-DD', // <input type="date" />
  13821. TIME: 'HH:mm', // <input type="time" />
  13822. TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" />
  13823. TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" />
  13824. WEEK: 'GGGG-[W]WW', // <input type="week" />
  13825. MONTH: 'YYYY-MM', // <input type="month" />
  13826. };
  13827. //! moment.js locale configuration
  13828. hooks.defineLocale('af', {
  13829. months: 'Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember'.split(
  13830. '_'
  13831. ),
  13832. monthsShort: 'Jan_Feb_Mrt_Apr_Mei_Jun_Jul_Aug_Sep_Okt_Nov_Des'.split('_'),
  13833. weekdays: 'Sondag_Maandag_Dinsdag_Woensdag_Donderdag_Vrydag_Saterdag'.split(
  13834. '_'
  13835. ),
  13836. weekdaysShort: 'Son_Maa_Din_Woe_Don_Vry_Sat'.split('_'),
  13837. weekdaysMin: 'So_Ma_Di_Wo_Do_Vr_Sa'.split('_'),
  13838. meridiemParse: /vm|nm/i,
  13839. isPM: function (input) {
  13840. return /^nm$/i.test(input);
  13841. },
  13842. meridiem: function (hours, minutes, isLower) {
  13843. if (hours < 12) {
  13844. return isLower ? 'vm' : 'VM';
  13845. } else {
  13846. return isLower ? 'nm' : 'NM';
  13847. }
  13848. },
  13849. longDateFormat: {
  13850. LT: 'HH:mm',
  13851. LTS: 'HH:mm:ss',
  13852. L: 'DD/MM/YYYY',
  13853. LL: 'D MMMM YYYY',
  13854. LLL: 'D MMMM YYYY HH:mm',
  13855. LLLL: 'dddd, D MMMM YYYY HH:mm',
  13856. },
  13857. calendar: {
  13858. sameDay: '[Vandag om] LT',
  13859. nextDay: '[Môre om] LT',
  13860. nextWeek: 'dddd [om] LT',
  13861. lastDay: '[Gister om] LT',
  13862. lastWeek: '[Laas] dddd [om] LT',
  13863. sameElse: 'L',
  13864. },
  13865. relativeTime: {
  13866. future: 'oor %s',
  13867. past: '%s gelede',
  13868. s: "'n paar sekondes",
  13869. ss: '%d sekondes',
  13870. m: "'n minuut",
  13871. mm: '%d minute',
  13872. h: "'n uur",
  13873. hh: '%d ure',
  13874. d: "'n dag",
  13875. dd: '%d dae',
  13876. M: "'n maand",
  13877. MM: '%d maande',
  13878. y: "'n jaar",
  13879. yy: '%d jaar',
  13880. },
  13881. dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/,
  13882. ordinal: function (number) {
  13883. return (
  13884. number +
  13885. (number === 1 || number === 8 || number >= 20 ? 'ste' : 'de')
  13886. ); // Thanks to Joris Röling : https://github.com/jjupiter
  13887. },
  13888. week: {
  13889. dow: 1, // Maandag is die eerste dag van die week.
  13890. doy: 4, // Die week wat die 4de Januarie bevat is die eerste week van die jaar.
  13891. },
  13892. });
  13893. //! moment.js locale configuration
  13894. var pluralForm = function (n) {
  13895. return n === 0
  13896. ? 0
  13897. : n === 1
  13898. ? 1
  13899. : n === 2
  13900. ? 2
  13901. : n % 100 >= 3 && n % 100 <= 10
  13902. ? 3
  13903. : n % 100 >= 11
  13904. ? 4
  13905. : 5;
  13906. },
  13907. plurals = {
  13908. s: [
  13909. 'أقل من ثانية',
  13910. 'ثانية واحدة',
  13911. ['ثانيتان', 'ثانيتين'],
  13912. '%d ثوان',
  13913. '%d ثانية',
  13914. '%d ثانية',
  13915. ],
  13916. m: [
  13917. 'أقل من دقيقة',
  13918. 'دقيقة واحدة',
  13919. ['دقيقتان', 'دقيقتين'],
  13920. '%d دقائق',
  13921. '%d دقيقة',
  13922. '%d دقيقة',
  13923. ],
  13924. h: [
  13925. 'أقل من ساعة',
  13926. 'ساعة واحدة',
  13927. ['ساعتان', 'ساعتين'],
  13928. '%d ساعات',
  13929. '%d ساعة',
  13930. '%d ساعة',
  13931. ],
  13932. d: [
  13933. 'أقل من يوم',
  13934. 'يوم واحد',
  13935. ['يومان', 'يومين'],
  13936. '%d أيام',
  13937. '%d يومًا',
  13938. '%d يوم',
  13939. ],
  13940. M: [
  13941. 'أقل من شهر',
  13942. 'شهر واحد',
  13943. ['شهران', 'شهرين'],
  13944. '%d أشهر',
  13945. '%d شهرا',
  13946. '%d شهر',
  13947. ],
  13948. y: [
  13949. 'أقل من عام',
  13950. 'عام واحد',
  13951. ['عامان', 'عامين'],
  13952. '%d أعوام',
  13953. '%d عامًا',
  13954. '%d عام',
  13955. ],
  13956. },
  13957. pluralize = function (u) {
  13958. return function (number, withoutSuffix, string, isFuture) {
  13959. var f = pluralForm(number),
  13960. str = plurals[u][pluralForm(number)];
  13961. if (f === 2) {
  13962. str = str[withoutSuffix ? 0 : 1];
  13963. }
  13964. return str.replace(/%d/i, number);
  13965. };
  13966. },
  13967. months$1 = [
  13968. 'جانفي',
  13969. 'فيفري',
  13970. 'مارس',
  13971. 'أفريل',
  13972. 'ماي',
  13973. 'جوان',
  13974. 'جويلية',
  13975. 'أوت',
  13976. 'سبتمبر',
  13977. 'أكتوبر',
  13978. 'نوفمبر',
  13979. 'ديسمبر',
  13980. ];
  13981. hooks.defineLocale('ar-dz', {
  13982. months: months$1,
  13983. monthsShort: months$1,
  13984. weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
  13985. weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'),
  13986. weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'),
  13987. weekdaysParseExact: true,
  13988. longDateFormat: {
  13989. LT: 'HH:mm',
  13990. LTS: 'HH:mm:ss',
  13991. L: 'D/\u200FM/\u200FYYYY',
  13992. LL: 'D MMMM YYYY',
  13993. LLL: 'D MMMM YYYY HH:mm',
  13994. LLLL: 'dddd D MMMM YYYY HH:mm',
  13995. },
  13996. meridiemParse: /ص|م/,
  13997. isPM: function (input) {
  13998. return 'م' === input;
  13999. },
  14000. meridiem: function (hour, minute, isLower) {
  14001. if (hour < 12) {
  14002. return 'ص';
  14003. } else {
  14004. return 'م';
  14005. }
  14006. },
  14007. calendar: {
  14008. sameDay: '[اليوم عند الساعة] LT',
  14009. nextDay: '[غدًا عند الساعة] LT',
  14010. nextWeek: 'dddd [عند الساعة] LT',
  14011. lastDay: '[أمس عند الساعة] LT',
  14012. lastWeek: 'dddd [عند الساعة] LT',
  14013. sameElse: 'L',
  14014. },
  14015. relativeTime: {
  14016. future: 'بعد %s',
  14017. past: 'منذ %s',
  14018. s: pluralize('s'),
  14019. ss: pluralize('s'),
  14020. m: pluralize('m'),
  14021. mm: pluralize('m'),
  14022. h: pluralize('h'),
  14023. hh: pluralize('h'),
  14024. d: pluralize('d'),
  14025. dd: pluralize('d'),
  14026. M: pluralize('M'),
  14027. MM: pluralize('M'),
  14028. y: pluralize('y'),
  14029. yy: pluralize('y'),
  14030. },
  14031. postformat: function (string) {
  14032. return string.replace(/,/g, '،');
  14033. },
  14034. week: {
  14035. dow: 0, // Sunday is the first day of the week.
  14036. doy: 4, // The week that contains Jan 4th is the first week of the year.
  14037. },
  14038. });
  14039. //! moment.js locale configuration
  14040. hooks.defineLocale('ar-kw', {
  14041. months: 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split(
  14042. '_'
  14043. ),
  14044. monthsShort:
  14045. 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split(
  14046. '_'
  14047. ),
  14048. weekdays: 'الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
  14049. weekdaysShort: 'احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'),
  14050. weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'),
  14051. weekdaysParseExact: true,
  14052. longDateFormat: {
  14053. LT: 'HH:mm',
  14054. LTS: 'HH:mm:ss',
  14055. L: 'DD/MM/YYYY',
  14056. LL: 'D MMMM YYYY',
  14057. LLL: 'D MMMM YYYY HH:mm',
  14058. LLLL: 'dddd D MMMM YYYY HH:mm',
  14059. },
  14060. calendar: {
  14061. sameDay: '[اليوم على الساعة] LT',
  14062. nextDay: '[غدا على الساعة] LT',
  14063. nextWeek: 'dddd [على الساعة] LT',
  14064. lastDay: '[أمس على الساعة] LT',
  14065. lastWeek: 'dddd [على الساعة] LT',
  14066. sameElse: 'L',
  14067. },
  14068. relativeTime: {
  14069. future: 'في %s',
  14070. past: 'منذ %s',
  14071. s: 'ثوان',
  14072. ss: '%d ثانية',
  14073. m: 'دقيقة',
  14074. mm: '%d دقائق',
  14075. h: 'ساعة',
  14076. hh: '%d ساعات',
  14077. d: 'يوم',
  14078. dd: '%d أيام',
  14079. M: 'شهر',
  14080. MM: '%d أشهر',
  14081. y: 'سنة',
  14082. yy: '%d سنوات',
  14083. },
  14084. week: {
  14085. dow: 0, // Sunday is the first day of the week.
  14086. doy: 12, // The week that contains Jan 12th is the first week of the year.
  14087. },
  14088. });
  14089. //! moment.js locale configuration
  14090. var symbolMap = {
  14091. 1: '1',
  14092. 2: '2',
  14093. 3: '3',
  14094. 4: '4',
  14095. 5: '5',
  14096. 6: '6',
  14097. 7: '7',
  14098. 8: '8',
  14099. 9: '9',
  14100. 0: '0',
  14101. },
  14102. pluralForm$1 = function (n) {
  14103. return n === 0
  14104. ? 0
  14105. : n === 1
  14106. ? 1
  14107. : n === 2
  14108. ? 2
  14109. : n % 100 >= 3 && n % 100 <= 10
  14110. ? 3
  14111. : n % 100 >= 11
  14112. ? 4
  14113. : 5;
  14114. },
  14115. plurals$1 = {
  14116. s: [
  14117. 'أقل من ثانية',
  14118. 'ثانية واحدة',
  14119. ['ثانيتان', 'ثانيتين'],
  14120. '%d ثوان',
  14121. '%d ثانية',
  14122. '%d ثانية',
  14123. ],
  14124. m: [
  14125. 'أقل من دقيقة',
  14126. 'دقيقة واحدة',
  14127. ['دقيقتان', 'دقيقتين'],
  14128. '%d دقائق',
  14129. '%d دقيقة',
  14130. '%d دقيقة',
  14131. ],
  14132. h: [
  14133. 'أقل من ساعة',
  14134. 'ساعة واحدة',
  14135. ['ساعتان', 'ساعتين'],
  14136. '%d ساعات',
  14137. '%d ساعة',
  14138. '%d ساعة',
  14139. ],
  14140. d: [
  14141. 'أقل من يوم',
  14142. 'يوم واحد',
  14143. ['يومان', 'يومين'],
  14144. '%d أيام',
  14145. '%d يومًا',
  14146. '%d يوم',
  14147. ],
  14148. M: [
  14149. 'أقل من شهر',
  14150. 'شهر واحد',
  14151. ['شهران', 'شهرين'],
  14152. '%d أشهر',
  14153. '%d شهرا',
  14154. '%d شهر',
  14155. ],
  14156. y: [
  14157. 'أقل من عام',
  14158. 'عام واحد',
  14159. ['عامان', 'عامين'],
  14160. '%d أعوام',
  14161. '%d عامًا',
  14162. '%d عام',
  14163. ],
  14164. },
  14165. pluralize$1 = function (u) {
  14166. return function (number, withoutSuffix, string, isFuture) {
  14167. var f = pluralForm$1(number),
  14168. str = plurals$1[u][pluralForm$1(number)];
  14169. if (f === 2) {
  14170. str = str[withoutSuffix ? 0 : 1];
  14171. }
  14172. return str.replace(/%d/i, number);
  14173. };
  14174. },
  14175. months$2 = [
  14176. 'يناير',
  14177. 'فبراير',
  14178. 'مارس',
  14179. 'أبريل',
  14180. 'مايو',
  14181. 'يونيو',
  14182. 'يوليو',
  14183. 'أغسطس',
  14184. 'سبتمبر',
  14185. 'أكتوبر',
  14186. 'نوفمبر',
  14187. 'ديسمبر',
  14188. ];
  14189. hooks.defineLocale('ar-ly', {
  14190. months: months$2,
  14191. monthsShort: months$2,
  14192. weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
  14193. weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'),
  14194. weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'),
  14195. weekdaysParseExact: true,
  14196. longDateFormat: {
  14197. LT: 'HH:mm',
  14198. LTS: 'HH:mm:ss',
  14199. L: 'D/\u200FM/\u200FYYYY',
  14200. LL: 'D MMMM YYYY',
  14201. LLL: 'D MMMM YYYY HH:mm',
  14202. LLLL: 'dddd D MMMM YYYY HH:mm',
  14203. },
  14204. meridiemParse: /ص|م/,
  14205. isPM: function (input) {
  14206. return 'م' === input;
  14207. },
  14208. meridiem: function (hour, minute, isLower) {
  14209. if (hour < 12) {
  14210. return 'ص';
  14211. } else {
  14212. return 'م';
  14213. }
  14214. },
  14215. calendar: {
  14216. sameDay: '[اليوم عند الساعة] LT',
  14217. nextDay: '[غدًا عند الساعة] LT',
  14218. nextWeek: 'dddd [عند الساعة] LT',
  14219. lastDay: '[أمس عند الساعة] LT',
  14220. lastWeek: 'dddd [عند الساعة] LT',
  14221. sameElse: 'L',
  14222. },
  14223. relativeTime: {
  14224. future: 'بعد %s',
  14225. past: 'منذ %s',
  14226. s: pluralize$1('s'),
  14227. ss: pluralize$1('s'),
  14228. m: pluralize$1('m'),
  14229. mm: pluralize$1('m'),
  14230. h: pluralize$1('h'),
  14231. hh: pluralize$1('h'),
  14232. d: pluralize$1('d'),
  14233. dd: pluralize$1('d'),
  14234. M: pluralize$1('M'),
  14235. MM: pluralize$1('M'),
  14236. y: pluralize$1('y'),
  14237. yy: pluralize$1('y'),
  14238. },
  14239. preparse: function (string) {
  14240. return string.replace(/،/g, ',');
  14241. },
  14242. postformat: function (string) {
  14243. return string
  14244. .replace(/\d/g, function (match) {
  14245. return symbolMap[match];
  14246. })
  14247. .replace(/,/g, '،');
  14248. },
  14249. week: {
  14250. dow: 6, // Saturday is the first day of the week.
  14251. doy: 12, // The week that contains Jan 12th is the first week of the year.
  14252. },
  14253. });
  14254. //! moment.js locale configuration
  14255. hooks.defineLocale('ar-ma', {
  14256. months: 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split(
  14257. '_'
  14258. ),
  14259. monthsShort:
  14260. 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split(
  14261. '_'
  14262. ),
  14263. weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
  14264. weekdaysShort: 'احد_اثنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'),
  14265. weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'),
  14266. weekdaysParseExact: true,
  14267. longDateFormat: {
  14268. LT: 'HH:mm',
  14269. LTS: 'HH:mm:ss',
  14270. L: 'DD/MM/YYYY',
  14271. LL: 'D MMMM YYYY',
  14272. LLL: 'D MMMM YYYY HH:mm',
  14273. LLLL: 'dddd D MMMM YYYY HH:mm',
  14274. },
  14275. calendar: {
  14276. sameDay: '[اليوم على الساعة] LT',
  14277. nextDay: '[غدا على الساعة] LT',
  14278. nextWeek: 'dddd [على الساعة] LT',
  14279. lastDay: '[أمس على الساعة] LT',
  14280. lastWeek: 'dddd [على الساعة] LT',
  14281. sameElse: 'L',
  14282. },
  14283. relativeTime: {
  14284. future: 'في %s',
  14285. past: 'منذ %s',
  14286. s: 'ثوان',
  14287. ss: '%d ثانية',
  14288. m: 'دقيقة',
  14289. mm: '%d دقائق',
  14290. h: 'ساعة',
  14291. hh: '%d ساعات',
  14292. d: 'يوم',
  14293. dd: '%d أيام',
  14294. M: 'شهر',
  14295. MM: '%d أشهر',
  14296. y: 'سنة',
  14297. yy: '%d سنوات',
  14298. },
  14299. week: {
  14300. dow: 1, // Monday is the first day of the week.
  14301. doy: 4, // The week that contains Jan 4th is the first week of the year.
  14302. },
  14303. });
  14304. //! moment.js locale configuration
  14305. var symbolMap$1 = {
  14306. 1: '١',
  14307. 2: '٢',
  14308. 3: '٣',
  14309. 4: '٤',
  14310. 5: '٥',
  14311. 6: '٦',
  14312. 7: '٧',
  14313. 8: '٨',
  14314. 9: '٩',
  14315. 0: '٠',
  14316. },
  14317. numberMap = {
  14318. '١': '1',
  14319. '٢': '2',
  14320. '٣': '3',
  14321. '٤': '4',
  14322. '٥': '5',
  14323. '٦': '6',
  14324. '٧': '7',
  14325. '٨': '8',
  14326. '٩': '9',
  14327. '٠': '0',
  14328. };
  14329. hooks.defineLocale('ar-sa', {
  14330. months: 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split(
  14331. '_'
  14332. ),
  14333. monthsShort:
  14334. 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split(
  14335. '_'
  14336. ),
  14337. weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
  14338. weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'),
  14339. weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'),
  14340. weekdaysParseExact: true,
  14341. longDateFormat: {
  14342. LT: 'HH:mm',
  14343. LTS: 'HH:mm:ss',
  14344. L: 'DD/MM/YYYY',
  14345. LL: 'D MMMM YYYY',
  14346. LLL: 'D MMMM YYYY HH:mm',
  14347. LLLL: 'dddd D MMMM YYYY HH:mm',
  14348. },
  14349. meridiemParse: /ص|م/,
  14350. isPM: function (input) {
  14351. return 'م' === input;
  14352. },
  14353. meridiem: function (hour, minute, isLower) {
  14354. if (hour < 12) {
  14355. return 'ص';
  14356. } else {
  14357. return 'م';
  14358. }
  14359. },
  14360. calendar: {
  14361. sameDay: '[اليوم على الساعة] LT',
  14362. nextDay: '[غدا على الساعة] LT',
  14363. nextWeek: 'dddd [على الساعة] LT',
  14364. lastDay: '[أمس على الساعة] LT',
  14365. lastWeek: 'dddd [على الساعة] LT',
  14366. sameElse: 'L',
  14367. },
  14368. relativeTime: {
  14369. future: 'في %s',
  14370. past: 'منذ %s',
  14371. s: 'ثوان',
  14372. ss: '%d ثانية',
  14373. m: 'دقيقة',
  14374. mm: '%d دقائق',
  14375. h: 'ساعة',
  14376. hh: '%d ساعات',
  14377. d: 'يوم',
  14378. dd: '%d أيام',
  14379. M: 'شهر',
  14380. MM: '%d أشهر',
  14381. y: 'سنة',
  14382. yy: '%d سنوات',
  14383. },
  14384. preparse: function (string) {
  14385. return string
  14386. .replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) {
  14387. return numberMap[match];
  14388. })
  14389. .replace(/،/g, ',');
  14390. },
  14391. postformat: function (string) {
  14392. return string
  14393. .replace(/\d/g, function (match) {
  14394. return symbolMap$1[match];
  14395. })
  14396. .replace(/,/g, '،');
  14397. },
  14398. week: {
  14399. dow: 0, // Sunday is the first day of the week.
  14400. doy: 6, // The week that contains Jan 6th is the first week of the year.
  14401. },
  14402. });
  14403. //! moment.js locale configuration
  14404. hooks.defineLocale('ar-tn', {
  14405. months: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split(
  14406. '_'
  14407. ),
  14408. monthsShort:
  14409. 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split(
  14410. '_'
  14411. ),
  14412. weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
  14413. weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'),
  14414. weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'),
  14415. weekdaysParseExact: true,
  14416. longDateFormat: {
  14417. LT: 'HH:mm',
  14418. LTS: 'HH:mm:ss',
  14419. L: 'DD/MM/YYYY',
  14420. LL: 'D MMMM YYYY',
  14421. LLL: 'D MMMM YYYY HH:mm',
  14422. LLLL: 'dddd D MMMM YYYY HH:mm',
  14423. },
  14424. calendar: {
  14425. sameDay: '[اليوم على الساعة] LT',
  14426. nextDay: '[غدا على الساعة] LT',
  14427. nextWeek: 'dddd [على الساعة] LT',
  14428. lastDay: '[أمس على الساعة] LT',
  14429. lastWeek: 'dddd [على الساعة] LT',
  14430. sameElse: 'L',
  14431. },
  14432. relativeTime: {
  14433. future: 'في %s',
  14434. past: 'منذ %s',
  14435. s: 'ثوان',
  14436. ss: '%d ثانية',
  14437. m: 'دقيقة',
  14438. mm: '%d دقائق',
  14439. h: 'ساعة',
  14440. hh: '%d ساعات',
  14441. d: 'يوم',
  14442. dd: '%d أيام',
  14443. M: 'شهر',
  14444. MM: '%d أشهر',
  14445. y: 'سنة',
  14446. yy: '%d سنوات',
  14447. },
  14448. week: {
  14449. dow: 1, // Monday is the first day of the week.
  14450. doy: 4, // The week that contains Jan 4th is the first week of the year.
  14451. },
  14452. });
  14453. //! moment.js locale configuration
  14454. var symbolMap$2 = {
  14455. 1: '١',
  14456. 2: '٢',
  14457. 3: '٣',
  14458. 4: '٤',
  14459. 5: '٥',
  14460. 6: '٦',
  14461. 7: '٧',
  14462. 8: '٨',
  14463. 9: '٩',
  14464. 0: '٠',
  14465. },
  14466. numberMap$1 = {
  14467. '١': '1',
  14468. '٢': '2',
  14469. '٣': '3',
  14470. '٤': '4',
  14471. '٥': '5',
  14472. '٦': '6',
  14473. '٧': '7',
  14474. '٨': '8',
  14475. '٩': '9',
  14476. '٠': '0',
  14477. },
  14478. pluralForm$2 = function (n) {
  14479. return n === 0
  14480. ? 0
  14481. : n === 1
  14482. ? 1
  14483. : n === 2
  14484. ? 2
  14485. : n % 100 >= 3 && n % 100 <= 10
  14486. ? 3
  14487. : n % 100 >= 11
  14488. ? 4
  14489. : 5;
  14490. },
  14491. plurals$2 = {
  14492. s: [
  14493. 'أقل من ثانية',
  14494. 'ثانية واحدة',
  14495. ['ثانيتان', 'ثانيتين'],
  14496. '%d ثوان',
  14497. '%d ثانية',
  14498. '%d ثانية',
  14499. ],
  14500. m: [
  14501. 'أقل من دقيقة',
  14502. 'دقيقة واحدة',
  14503. ['دقيقتان', 'دقيقتين'],
  14504. '%d دقائق',
  14505. '%d دقيقة',
  14506. '%d دقيقة',
  14507. ],
  14508. h: [
  14509. 'أقل من ساعة',
  14510. 'ساعة واحدة',
  14511. ['ساعتان', 'ساعتين'],
  14512. '%d ساعات',
  14513. '%d ساعة',
  14514. '%d ساعة',
  14515. ],
  14516. d: [
  14517. 'أقل من يوم',
  14518. 'يوم واحد',
  14519. ['يومان', 'يومين'],
  14520. '%d أيام',
  14521. '%d يومًا',
  14522. '%d يوم',
  14523. ],
  14524. M: [
  14525. 'أقل من شهر',
  14526. 'شهر واحد',
  14527. ['شهران', 'شهرين'],
  14528. '%d أشهر',
  14529. '%d شهرا',
  14530. '%d شهر',
  14531. ],
  14532. y: [
  14533. 'أقل من عام',
  14534. 'عام واحد',
  14535. ['عامان', 'عامين'],
  14536. '%d أعوام',
  14537. '%d عامًا',
  14538. '%d عام',
  14539. ],
  14540. },
  14541. pluralize$2 = function (u) {
  14542. return function (number, withoutSuffix, string, isFuture) {
  14543. var f = pluralForm$2(number),
  14544. str = plurals$2[u][pluralForm$2(number)];
  14545. if (f === 2) {
  14546. str = str[withoutSuffix ? 0 : 1];
  14547. }
  14548. return str.replace(/%d/i, number);
  14549. };
  14550. },
  14551. months$3 = [
  14552. 'يناير',
  14553. 'فبراير',
  14554. 'مارس',
  14555. 'أبريل',
  14556. 'مايو',
  14557. 'يونيو',
  14558. 'يوليو',
  14559. 'أغسطس',
  14560. 'سبتمبر',
  14561. 'أكتوبر',
  14562. 'نوفمبر',
  14563. 'ديسمبر',
  14564. ];
  14565. hooks.defineLocale('ar', {
  14566. months: months$3,
  14567. monthsShort: months$3,
  14568. weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
  14569. weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'),
  14570. weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'),
  14571. weekdaysParseExact: true,
  14572. longDateFormat: {
  14573. LT: 'HH:mm',
  14574. LTS: 'HH:mm:ss',
  14575. L: 'D/\u200FM/\u200FYYYY',
  14576. LL: 'D MMMM YYYY',
  14577. LLL: 'D MMMM YYYY HH:mm',
  14578. LLLL: 'dddd D MMMM YYYY HH:mm',
  14579. },
  14580. meridiemParse: /ص|م/,
  14581. isPM: function (input) {
  14582. return 'م' === input;
  14583. },
  14584. meridiem: function (hour, minute, isLower) {
  14585. if (hour < 12) {
  14586. return 'ص';
  14587. } else {
  14588. return 'م';
  14589. }
  14590. },
  14591. calendar: {
  14592. sameDay: '[اليوم عند الساعة] LT',
  14593. nextDay: '[غدًا عند الساعة] LT',
  14594. nextWeek: 'dddd [عند الساعة] LT',
  14595. lastDay: '[أمس عند الساعة] LT',
  14596. lastWeek: 'dddd [عند الساعة] LT',
  14597. sameElse: 'L',
  14598. },
  14599. relativeTime: {
  14600. future: 'بعد %s',
  14601. past: 'منذ %s',
  14602. s: pluralize$2('s'),
  14603. ss: pluralize$2('s'),
  14604. m: pluralize$2('m'),
  14605. mm: pluralize$2('m'),
  14606. h: pluralize$2('h'),
  14607. hh: pluralize$2('h'),
  14608. d: pluralize$2('d'),
  14609. dd: pluralize$2('d'),
  14610. M: pluralize$2('M'),
  14611. MM: pluralize$2('M'),
  14612. y: pluralize$2('y'),
  14613. yy: pluralize$2('y'),
  14614. },
  14615. preparse: function (string) {
  14616. return string
  14617. .replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) {
  14618. return numberMap$1[match];
  14619. })
  14620. .replace(/،/g, ',');
  14621. },
  14622. postformat: function (string) {
  14623. return string
  14624. .replace(/\d/g, function (match) {
  14625. return symbolMap$2[match];
  14626. })
  14627. .replace(/,/g, '،');
  14628. },
  14629. week: {
  14630. dow: 6, // Saturday is the first day of the week.
  14631. doy: 12, // The week that contains Jan 12th is the first week of the year.
  14632. },
  14633. });
  14634. //! moment.js locale configuration
  14635. var suffixes = {
  14636. 1: '-inci',
  14637. 5: '-inci',
  14638. 8: '-inci',
  14639. 70: '-inci',
  14640. 80: '-inci',
  14641. 2: '-nci',
  14642. 7: '-nci',
  14643. 20: '-nci',
  14644. 50: '-nci',
  14645. 3: '-üncü',
  14646. 4: '-üncü',
  14647. 100: '-üncü',
  14648. 6: '-ncı',
  14649. 9: '-uncu',
  14650. 10: '-uncu',
  14651. 30: '-uncu',
  14652. 60: '-ıncı',
  14653. 90: '-ıncı',
  14654. };
  14655. hooks.defineLocale('az', {
  14656. months: 'yanvar_fevral_mart_aprel_may_iyun_iyul_avqust_sentyabr_oktyabr_noyabr_dekabr'.split(
  14657. '_'
  14658. ),
  14659. monthsShort: 'yan_fev_mar_apr_may_iyn_iyl_avq_sen_okt_noy_dek'.split('_'),
  14660. weekdays:
  14661. 'Bazar_Bazar ertəsi_Çərşənbə axşamı_Çərşənbə_Cümə axşamı_Cümə_Şənbə'.split(
  14662. '_'
  14663. ),
  14664. weekdaysShort: 'Baz_BzE_ÇAx_Çər_CAx_Cüm_Şən'.split('_'),
  14665. weekdaysMin: 'Bz_BE_ÇA_Çə_CA_Cü_Şə'.split('_'),
  14666. weekdaysParseExact: true,
  14667. longDateFormat: {
  14668. LT: 'HH:mm',
  14669. LTS: 'HH:mm:ss',
  14670. L: 'DD.MM.YYYY',
  14671. LL: 'D MMMM YYYY',
  14672. LLL: 'D MMMM YYYY HH:mm',
  14673. LLLL: 'dddd, D MMMM YYYY HH:mm',
  14674. },
  14675. calendar: {
  14676. sameDay: '[bugün saat] LT',
  14677. nextDay: '[sabah saat] LT',
  14678. nextWeek: '[gələn həftə] dddd [saat] LT',
  14679. lastDay: '[dünən] LT',
  14680. lastWeek: '[keçən həftə] dddd [saat] LT',
  14681. sameElse: 'L',
  14682. },
  14683. relativeTime: {
  14684. future: '%s sonra',
  14685. past: '%s əvvəl',
  14686. s: 'bir neçə saniyə',
  14687. ss: '%d saniyə',
  14688. m: 'bir dəqiqə',
  14689. mm: '%d dəqiqə',
  14690. h: 'bir saat',
  14691. hh: '%d saat',
  14692. d: 'bir gün',
  14693. dd: '%d gün',
  14694. M: 'bir ay',
  14695. MM: '%d ay',
  14696. y: 'bir il',
  14697. yy: '%d il',
  14698. },
  14699. meridiemParse: /gecə|səhər|gündüz|axşam/,
  14700. isPM: function (input) {
  14701. return /^(gündüz|axşam)$/.test(input);
  14702. },
  14703. meridiem: function (hour, minute, isLower) {
  14704. if (hour < 4) {
  14705. return 'gecə';
  14706. } else if (hour < 12) {
  14707. return 'səhər';
  14708. } else if (hour < 17) {
  14709. return 'gündüz';
  14710. } else {
  14711. return 'axşam';
  14712. }
  14713. },
  14714. dayOfMonthOrdinalParse: /\d{1,2}-(ıncı|inci|nci|üncü|ncı|uncu)/,
  14715. ordinal: function (number) {
  14716. if (number === 0) {
  14717. // special case for zero
  14718. return number + '-ıncı';
  14719. }
  14720. var a = number % 10,
  14721. b = (number % 100) - a,
  14722. c = number >= 100 ? 100 : null;
  14723. return number + (suffixes[a] || suffixes[b] || suffixes[c]);
  14724. },
  14725. week: {
  14726. dow: 1, // Monday is the first day of the week.
  14727. doy: 7, // The week that contains Jan 7th is the first week of the year.
  14728. },
  14729. });
  14730. //! moment.js locale configuration
  14731. function plural(word, num) {
  14732. var forms = word.split('_');
  14733. return num % 10 === 1 && num % 100 !== 11
  14734. ? forms[0]
  14735. : num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20)
  14736. ? forms[1]
  14737. : forms[2];
  14738. }
  14739. function relativeTimeWithPlural(number, withoutSuffix, key) {
  14740. var format = {
  14741. ss: withoutSuffix ? 'секунда_секунды_секунд' : 'секунду_секунды_секунд',
  14742. mm: withoutSuffix ? 'хвіліна_хвіліны_хвілін' : 'хвіліну_хвіліны_хвілін',
  14743. hh: withoutSuffix ? 'гадзіна_гадзіны_гадзін' : 'гадзіну_гадзіны_гадзін',
  14744. dd: 'дзень_дні_дзён',
  14745. MM: 'месяц_месяцы_месяцаў',
  14746. yy: 'год_гады_гадоў',
  14747. };
  14748. if (key === 'm') {
  14749. return withoutSuffix ? 'хвіліна' : 'хвіліну';
  14750. } else if (key === 'h') {
  14751. return withoutSuffix ? 'гадзіна' : 'гадзіну';
  14752. } else {
  14753. return number + ' ' + plural(format[key], +number);
  14754. }
  14755. }
  14756. hooks.defineLocale('be', {
  14757. months: {
  14758. format: 'студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня'.split(
  14759. '_'
  14760. ),
  14761. standalone:
  14762. 'студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань'.split(
  14763. '_'
  14764. ),
  14765. },
  14766. monthsShort:
  14767. 'студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж'.split('_'),
  14768. weekdays: {
  14769. format: 'нядзелю_панядзелак_аўторак_сераду_чацвер_пятніцу_суботу'.split(
  14770. '_'
  14771. ),
  14772. standalone:
  14773. 'нядзеля_панядзелак_аўторак_серада_чацвер_пятніца_субота'.split(
  14774. '_'
  14775. ),
  14776. isFormat: /\[ ?[Ууў] ?(?:мінулую|наступную)? ?\] ?dddd/,
  14777. },
  14778. weekdaysShort: 'нд_пн_ат_ср_чц_пт_сб'.split('_'),
  14779. weekdaysMin: 'нд_пн_ат_ср_чц_пт_сб'.split('_'),
  14780. longDateFormat: {
  14781. LT: 'HH:mm',
  14782. LTS: 'HH:mm:ss',
  14783. L: 'DD.MM.YYYY',
  14784. LL: 'D MMMM YYYY г.',
  14785. LLL: 'D MMMM YYYY г., HH:mm',
  14786. LLLL: 'dddd, D MMMM YYYY г., HH:mm',
  14787. },
  14788. calendar: {
  14789. sameDay: '[Сёння ў] LT',
  14790. nextDay: '[Заўтра ў] LT',
  14791. lastDay: '[Учора ў] LT',
  14792. nextWeek: function () {
  14793. return '[У] dddd [ў] LT';
  14794. },
  14795. lastWeek: function () {
  14796. switch (this.day()) {
  14797. case 0:
  14798. case 3:
  14799. case 5:
  14800. case 6:
  14801. return '[У мінулую] dddd [ў] LT';
  14802. case 1:
  14803. case 2:
  14804. case 4:
  14805. return '[У мінулы] dddd [ў] LT';
  14806. }
  14807. },
  14808. sameElse: 'L',
  14809. },
  14810. relativeTime: {
  14811. future: 'праз %s',
  14812. past: '%s таму',
  14813. s: 'некалькі секунд',
  14814. m: relativeTimeWithPlural,
  14815. mm: relativeTimeWithPlural,
  14816. h: relativeTimeWithPlural,
  14817. hh: relativeTimeWithPlural,
  14818. d: 'дзень',
  14819. dd: relativeTimeWithPlural,
  14820. M: 'месяц',
  14821. MM: relativeTimeWithPlural,
  14822. y: 'год',
  14823. yy: relativeTimeWithPlural,
  14824. },
  14825. meridiemParse: /ночы|раніцы|дня|вечара/,
  14826. isPM: function (input) {
  14827. return /^(дня|вечара)$/.test(input);
  14828. },
  14829. meridiem: function (hour, minute, isLower) {
  14830. if (hour < 4) {
  14831. return 'ночы';
  14832. } else if (hour < 12) {
  14833. return 'раніцы';
  14834. } else if (hour < 17) {
  14835. return 'дня';
  14836. } else {
  14837. return 'вечара';
  14838. }
  14839. },
  14840. dayOfMonthOrdinalParse: /\d{1,2}-(і|ы|га)/,
  14841. ordinal: function (number, period) {
  14842. switch (period) {
  14843. case 'M':
  14844. case 'd':
  14845. case 'DDD':
  14846. case 'w':
  14847. case 'W':
  14848. return (number % 10 === 2 || number % 10 === 3) &&
  14849. number % 100 !== 12 &&
  14850. number % 100 !== 13
  14851. ? number + '-і'
  14852. : number + '-ы';
  14853. case 'D':
  14854. return number + '-га';
  14855. default:
  14856. return number;
  14857. }
  14858. },
  14859. week: {
  14860. dow: 1, // Monday is the first day of the week.
  14861. doy: 7, // The week that contains Jan 7th is the first week of the year.
  14862. },
  14863. });
  14864. //! moment.js locale configuration
  14865. hooks.defineLocale('bg', {
  14866. months: 'януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември'.split(
  14867. '_'
  14868. ),
  14869. monthsShort: 'яну_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек'.split('_'),
  14870. weekdays: 'неделя_понеделник_вторник_сряда_четвъртък_петък_събота'.split(
  14871. '_'
  14872. ),
  14873. weekdaysShort: 'нед_пон_вто_сря_чет_пет_съб'.split('_'),
  14874. weekdaysMin: 'нд_пн_вт_ср_чт_пт_сб'.split('_'),
  14875. longDateFormat: {
  14876. LT: 'H:mm',
  14877. LTS: 'H:mm:ss',
  14878. L: 'D.MM.YYYY',
  14879. LL: 'D MMMM YYYY',
  14880. LLL: 'D MMMM YYYY H:mm',
  14881. LLLL: 'dddd, D MMMM YYYY H:mm',
  14882. },
  14883. calendar: {
  14884. sameDay: '[Днес в] LT',
  14885. nextDay: '[Утре в] LT',
  14886. nextWeek: 'dddd [в] LT',
  14887. lastDay: '[Вчера в] LT',
  14888. lastWeek: function () {
  14889. switch (this.day()) {
  14890. case 0:
  14891. case 3:
  14892. case 6:
  14893. return '[Миналата] dddd [в] LT';
  14894. case 1:
  14895. case 2:
  14896. case 4:
  14897. case 5:
  14898. return '[Миналия] dddd [в] LT';
  14899. }
  14900. },
  14901. sameElse: 'L',
  14902. },
  14903. relativeTime: {
  14904. future: 'след %s',
  14905. past: 'преди %s',
  14906. s: 'няколко секунди',
  14907. ss: '%d секунди',
  14908. m: 'минута',
  14909. mm: '%d минути',
  14910. h: 'час',
  14911. hh: '%d часа',
  14912. d: 'ден',
  14913. dd: '%d дена',
  14914. w: 'седмица',
  14915. ww: '%d седмици',
  14916. M: 'месец',
  14917. MM: '%d месеца',
  14918. y: 'година',
  14919. yy: '%d години',
  14920. },
  14921. dayOfMonthOrdinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/,
  14922. ordinal: function (number) {
  14923. var lastDigit = number % 10,
  14924. last2Digits = number % 100;
  14925. if (number === 0) {
  14926. return number + '-ев';
  14927. } else if (last2Digits === 0) {
  14928. return number + '-ен';
  14929. } else if (last2Digits > 10 && last2Digits < 20) {
  14930. return number + '-ти';
  14931. } else if (lastDigit === 1) {
  14932. return number + '-ви';
  14933. } else if (lastDigit === 2) {
  14934. return number + '-ри';
  14935. } else if (lastDigit === 7 || lastDigit === 8) {
  14936. return number + '-ми';
  14937. } else {
  14938. return number + '-ти';
  14939. }
  14940. },
  14941. week: {
  14942. dow: 1, // Monday is the first day of the week.
  14943. doy: 7, // The week that contains Jan 7th is the first week of the year.
  14944. },
  14945. });
  14946. //! moment.js locale configuration
  14947. hooks.defineLocale('bm', {
  14948. months: 'Zanwuyekalo_Fewuruyekalo_Marisikalo_Awirilikalo_Mɛkalo_Zuwɛnkalo_Zuluyekalo_Utikalo_Sɛtanburukalo_ɔkutɔburukalo_Nowanburukalo_Desanburukalo'.split(
  14949. '_'
  14950. ),
  14951. monthsShort: 'Zan_Few_Mar_Awi_Mɛ_Zuw_Zul_Uti_Sɛt_ɔku_Now_Des'.split('_'),
  14952. weekdays: 'Kari_Ntɛnɛn_Tarata_Araba_Alamisa_Juma_Sibiri'.split('_'),
  14953. weekdaysShort: 'Kar_Ntɛ_Tar_Ara_Ala_Jum_Sib'.split('_'),
  14954. weekdaysMin: 'Ka_Nt_Ta_Ar_Al_Ju_Si'.split('_'),
  14955. longDateFormat: {
  14956. LT: 'HH:mm',
  14957. LTS: 'HH:mm:ss',
  14958. L: 'DD/MM/YYYY',
  14959. LL: 'MMMM [tile] D [san] YYYY',
  14960. LLL: 'MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm',
  14961. LLLL: 'dddd MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm',
  14962. },
  14963. calendar: {
  14964. sameDay: '[Bi lɛrɛ] LT',
  14965. nextDay: '[Sini lɛrɛ] LT',
  14966. nextWeek: 'dddd [don lɛrɛ] LT',
  14967. lastDay: '[Kunu lɛrɛ] LT',
  14968. lastWeek: 'dddd [tɛmɛnen lɛrɛ] LT',
  14969. sameElse: 'L',
  14970. },
  14971. relativeTime: {
  14972. future: '%s kɔnɔ',
  14973. past: 'a bɛ %s bɔ',
  14974. s: 'sanga dama dama',
  14975. ss: 'sekondi %d',
  14976. m: 'miniti kelen',
  14977. mm: 'miniti %d',
  14978. h: 'lɛrɛ kelen',
  14979. hh: 'lɛrɛ %d',
  14980. d: 'tile kelen',
  14981. dd: 'tile %d',
  14982. M: 'kalo kelen',
  14983. MM: 'kalo %d',
  14984. y: 'san kelen',
  14985. yy: 'san %d',
  14986. },
  14987. week: {
  14988. dow: 1, // Monday is the first day of the week.
  14989. doy: 4, // The week that contains Jan 4th is the first week of the year.
  14990. },
  14991. });
  14992. //! moment.js locale configuration
  14993. var symbolMap$3 = {
  14994. 1: '১',
  14995. 2: '২',
  14996. 3: '৩',
  14997. 4: '৪',
  14998. 5: '৫',
  14999. 6: '৬',
  15000. 7: '৭',
  15001. 8: '৮',
  15002. 9: '৯',
  15003. 0: '০',
  15004. },
  15005. numberMap$2 = {
  15006. '১': '1',
  15007. '২': '2',
  15008. '৩': '3',
  15009. '৪': '4',
  15010. '৫': '5',
  15011. '৬': '6',
  15012. '৭': '7',
  15013. '৮': '8',
  15014. '৯': '9',
  15015. '০': '0',
  15016. };
  15017. hooks.defineLocale('bn-bd', {
  15018. months: 'জানুয়ারি_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর'.split(
  15019. '_'
  15020. ),
  15021. monthsShort:
  15022. 'জানু_ফেব্রু_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্ট_অক্টো_নভে_ডিসে'.split(
  15023. '_'
  15024. ),
  15025. weekdays: 'রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পতিবার_শুক্রবার_শনিবার'.split(
  15026. '_'
  15027. ),
  15028. weekdaysShort: 'রবি_সোম_মঙ্গল_বুধ_বৃহস্পতি_শুক্র_শনি'.split('_'),
  15029. weekdaysMin: 'রবি_সোম_মঙ্গল_বুধ_বৃহ_শুক্র_শনি'.split('_'),
  15030. longDateFormat: {
  15031. LT: 'A h:mm সময়',
  15032. LTS: 'A h:mm:ss সময়',
  15033. L: 'DD/MM/YYYY',
  15034. LL: 'D MMMM YYYY',
  15035. LLL: 'D MMMM YYYY, A h:mm সময়',
  15036. LLLL: 'dddd, D MMMM YYYY, A h:mm সময়',
  15037. },
  15038. calendar: {
  15039. sameDay: '[আজ] LT',
  15040. nextDay: '[আগামীকাল] LT',
  15041. nextWeek: 'dddd, LT',
  15042. lastDay: '[গতকাল] LT',
  15043. lastWeek: '[গত] dddd, LT',
  15044. sameElse: 'L',
  15045. },
  15046. relativeTime: {
  15047. future: '%s পরে',
  15048. past: '%s আগে',
  15049. s: 'কয়েক সেকেন্ড',
  15050. ss: '%d সেকেন্ড',
  15051. m: 'এক মিনিট',
  15052. mm: '%d মিনিট',
  15053. h: 'এক ঘন্টা',
  15054. hh: '%d ঘন্টা',
  15055. d: 'এক দিন',
  15056. dd: '%d দিন',
  15057. M: 'এক মাস',
  15058. MM: '%d মাস',
  15059. y: 'এক বছর',
  15060. yy: '%d বছর',
  15061. },
  15062. preparse: function (string) {
  15063. return string.replace(/[১২৩৪৫৬৭৮৯০]/g, function (match) {
  15064. return numberMap$2[match];
  15065. });
  15066. },
  15067. postformat: function (string) {
  15068. return string.replace(/\d/g, function (match) {
  15069. return symbolMap$3[match];
  15070. });
  15071. },
  15072. meridiemParse: /রাত|ভোর|সকাল|দুপুর|বিকাল|সন্ধ্যা|রাত/,
  15073. meridiemHour: function (hour, meridiem) {
  15074. if (hour === 12) {
  15075. hour = 0;
  15076. }
  15077. if (meridiem === 'রাত') {
  15078. return hour < 4 ? hour : hour + 12;
  15079. } else if (meridiem === 'ভোর') {
  15080. return hour;
  15081. } else if (meridiem === 'সকাল') {
  15082. return hour;
  15083. } else if (meridiem === 'দুপুর') {
  15084. return hour >= 3 ? hour : hour + 12;
  15085. } else if (meridiem === 'বিকাল') {
  15086. return hour + 12;
  15087. } else if (meridiem === 'সন্ধ্যা') {
  15088. return hour + 12;
  15089. }
  15090. },
  15091. meridiem: function (hour, minute, isLower) {
  15092. if (hour < 4) {
  15093. return 'রাত';
  15094. } else if (hour < 6) {
  15095. return 'ভোর';
  15096. } else if (hour < 12) {
  15097. return 'সকাল';
  15098. } else if (hour < 15) {
  15099. return 'দুপুর';
  15100. } else if (hour < 18) {
  15101. return 'বিকাল';
  15102. } else if (hour < 20) {
  15103. return 'সন্ধ্যা';
  15104. } else {
  15105. return 'রাত';
  15106. }
  15107. },
  15108. week: {
  15109. dow: 0, // Sunday is the first day of the week.
  15110. doy: 6, // The week that contains Jan 6th is the first week of the year.
  15111. },
  15112. });
  15113. //! moment.js locale configuration
  15114. var symbolMap$4 = {
  15115. 1: '১',
  15116. 2: '২',
  15117. 3: '৩',
  15118. 4: '৪',
  15119. 5: '৫',
  15120. 6: '৬',
  15121. 7: '৭',
  15122. 8: '৮',
  15123. 9: '৯',
  15124. 0: '০',
  15125. },
  15126. numberMap$3 = {
  15127. '১': '1',
  15128. '২': '2',
  15129. '৩': '3',
  15130. '৪': '4',
  15131. '৫': '5',
  15132. '৬': '6',
  15133. '৭': '7',
  15134. '৮': '8',
  15135. '৯': '9',
  15136. '০': '0',
  15137. };
  15138. hooks.defineLocale('bn', {
  15139. months: 'জানুয়ারি_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর'.split(
  15140. '_'
  15141. ),
  15142. monthsShort:
  15143. 'জানু_ফেব্রু_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্ট_অক্টো_নভে_ডিসে'.split(
  15144. '_'
  15145. ),
  15146. weekdays: 'রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পতিবার_শুক্রবার_শনিবার'.split(
  15147. '_'
  15148. ),
  15149. weekdaysShort: 'রবি_সোম_মঙ্গল_বুধ_বৃহস্পতি_শুক্র_শনি'.split('_'),
  15150. weekdaysMin: 'রবি_সোম_মঙ্গল_বুধ_বৃহ_শুক্র_শনি'.split('_'),
  15151. longDateFormat: {
  15152. LT: 'A h:mm সময়',
  15153. LTS: 'A h:mm:ss সময়',
  15154. L: 'DD/MM/YYYY',
  15155. LL: 'D MMMM YYYY',
  15156. LLL: 'D MMMM YYYY, A h:mm সময়',
  15157. LLLL: 'dddd, D MMMM YYYY, A h:mm সময়',
  15158. },
  15159. calendar: {
  15160. sameDay: '[আজ] LT',
  15161. nextDay: '[আগামীকাল] LT',
  15162. nextWeek: 'dddd, LT',
  15163. lastDay: '[গতকাল] LT',
  15164. lastWeek: '[গত] dddd, LT',
  15165. sameElse: 'L',
  15166. },
  15167. relativeTime: {
  15168. future: '%s পরে',
  15169. past: '%s আগে',
  15170. s: 'কয়েক সেকেন্ড',
  15171. ss: '%d সেকেন্ড',
  15172. m: 'এক মিনিট',
  15173. mm: '%d মিনিট',
  15174. h: 'এক ঘন্টা',
  15175. hh: '%d ঘন্টা',
  15176. d: 'এক দিন',
  15177. dd: '%d দিন',
  15178. M: 'এক মাস',
  15179. MM: '%d মাস',
  15180. y: 'এক বছর',
  15181. yy: '%d বছর',
  15182. },
  15183. preparse: function (string) {
  15184. return string.replace(/[১২৩৪৫৬৭৮৯০]/g, function (match) {
  15185. return numberMap$3[match];
  15186. });
  15187. },
  15188. postformat: function (string) {
  15189. return string.replace(/\d/g, function (match) {
  15190. return symbolMap$4[match];
  15191. });
  15192. },
  15193. meridiemParse: /রাত|সকাল|দুপুর|বিকাল|রাত/,
  15194. meridiemHour: function (hour, meridiem) {
  15195. if (hour === 12) {
  15196. hour = 0;
  15197. }
  15198. if (
  15199. (meridiem === 'রাত' && hour >= 4) ||
  15200. (meridiem === 'দুপুর' && hour < 5) ||
  15201. meridiem === 'বিকাল'
  15202. ) {
  15203. return hour + 12;
  15204. } else {
  15205. return hour;
  15206. }
  15207. },
  15208. meridiem: function (hour, minute, isLower) {
  15209. if (hour < 4) {
  15210. return 'রাত';
  15211. } else if (hour < 10) {
  15212. return 'সকাল';
  15213. } else if (hour < 17) {
  15214. return 'দুপুর';
  15215. } else if (hour < 20) {
  15216. return 'বিকাল';
  15217. } else {
  15218. return 'রাত';
  15219. }
  15220. },
  15221. week: {
  15222. dow: 0, // Sunday is the first day of the week.
  15223. doy: 6, // The week that contains Jan 6th is the first week of the year.
  15224. },
  15225. });
  15226. //! moment.js locale configuration
  15227. var symbolMap$5 = {
  15228. 1: '༡',
  15229. 2: '༢',
  15230. 3: '༣',
  15231. 4: '༤',
  15232. 5: '༥',
  15233. 6: '༦',
  15234. 7: '༧',
  15235. 8: '༨',
  15236. 9: '༩',
  15237. 0: '༠',
  15238. },
  15239. numberMap$4 = {
  15240. '༡': '1',
  15241. '༢': '2',
  15242. '༣': '3',
  15243. '༤': '4',
  15244. '༥': '5',
  15245. '༦': '6',
  15246. '༧': '7',
  15247. '༨': '8',
  15248. '༩': '9',
  15249. '༠': '0',
  15250. };
  15251. hooks.defineLocale('bo', {
  15252. months: 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split(
  15253. '_'
  15254. ),
  15255. monthsShort:
  15256. 'ཟླ་1_ཟླ་2_ཟླ་3_ཟླ་4_ཟླ་5_ཟླ་6_ཟླ་7_ཟླ་8_ཟླ་9_ཟླ་10_ཟླ་11_ཟླ་12'.split(
  15257. '_'
  15258. ),
  15259. monthsShortRegex: /^(ཟླ་\d{1,2})/,
  15260. monthsParseExact: true,
  15261. weekdays:
  15262. 'གཟའ་ཉི་མ་_གཟའ་ཟླ་བ་_གཟའ་མིག་དམར་_གཟའ་ལྷག་པ་_གཟའ་ཕུར་བུ_གཟའ་པ་སངས་_གཟའ་སྤེན་པ་'.split(
  15263. '_'
  15264. ),
  15265. weekdaysShort: 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.split(
  15266. '_'
  15267. ),
  15268. weekdaysMin: 'ཉི_ཟླ_མིག_ལྷག_ཕུར_སངས_སྤེན'.split('_'),
  15269. longDateFormat: {
  15270. LT: 'A h:mm',
  15271. LTS: 'A h:mm:ss',
  15272. L: 'DD/MM/YYYY',
  15273. LL: 'D MMMM YYYY',
  15274. LLL: 'D MMMM YYYY, A h:mm',
  15275. LLLL: 'dddd, D MMMM YYYY, A h:mm',
  15276. },
  15277. calendar: {
  15278. sameDay: '[དི་རིང] LT',
  15279. nextDay: '[སང་ཉིན] LT',
  15280. nextWeek: '[བདུན་ཕྲག་རྗེས་མ], LT',
  15281. lastDay: '[ཁ་སང] LT',
  15282. lastWeek: '[བདུན་ཕྲག་མཐའ་མ] dddd, LT',
  15283. sameElse: 'L',
  15284. },
  15285. relativeTime: {
  15286. future: '%s ལ་',
  15287. past: '%s སྔན་ལ',
  15288. s: 'ལམ་སང',
  15289. ss: '%d སྐར་ཆ།',
  15290. m: 'སྐར་མ་གཅིག',
  15291. mm: '%d སྐར་མ',
  15292. h: 'ཆུ་ཚོད་གཅིག',
  15293. hh: '%d ཆུ་ཚོད',
  15294. d: 'ཉིན་གཅིག',
  15295. dd: '%d ཉིན་',
  15296. M: 'ཟླ་བ་གཅིག',
  15297. MM: '%d ཟླ་བ',
  15298. y: 'ལོ་གཅིག',
  15299. yy: '%d ལོ',
  15300. },
  15301. preparse: function (string) {
  15302. return string.replace(/[༡༢༣༤༥༦༧༨༩༠]/g, function (match) {
  15303. return numberMap$4[match];
  15304. });
  15305. },
  15306. postformat: function (string) {
  15307. return string.replace(/\d/g, function (match) {
  15308. return symbolMap$5[match];
  15309. });
  15310. },
  15311. meridiemParse: /མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/,
  15312. meridiemHour: function (hour, meridiem) {
  15313. if (hour === 12) {
  15314. hour = 0;
  15315. }
  15316. if (
  15317. (meridiem === 'མཚན་མོ' && hour >= 4) ||
  15318. (meridiem === 'ཉིན་གུང' && hour < 5) ||
  15319. meridiem === 'དགོང་དག'
  15320. ) {
  15321. return hour + 12;
  15322. } else {
  15323. return hour;
  15324. }
  15325. },
  15326. meridiem: function (hour, minute, isLower) {
  15327. if (hour < 4) {
  15328. return 'མཚན་མོ';
  15329. } else if (hour < 10) {
  15330. return 'ཞོགས་ཀས';
  15331. } else if (hour < 17) {
  15332. return 'ཉིན་གུང';
  15333. } else if (hour < 20) {
  15334. return 'དགོང་དག';
  15335. } else {
  15336. return 'མཚན་མོ';
  15337. }
  15338. },
  15339. week: {
  15340. dow: 0, // Sunday is the first day of the week.
  15341. doy: 6, // The week that contains Jan 6th is the first week of the year.
  15342. },
  15343. });
  15344. //! moment.js locale configuration
  15345. function relativeTimeWithMutation(number, withoutSuffix, key) {
  15346. var format = {
  15347. mm: 'munutenn',
  15348. MM: 'miz',
  15349. dd: 'devezh',
  15350. };
  15351. return number + ' ' + mutation(format[key], number);
  15352. }
  15353. function specialMutationForYears(number) {
  15354. switch (lastNumber(number)) {
  15355. case 1:
  15356. case 3:
  15357. case 4:
  15358. case 5:
  15359. case 9:
  15360. return number + ' bloaz';
  15361. default:
  15362. return number + ' vloaz';
  15363. }
  15364. }
  15365. function lastNumber(number) {
  15366. if (number > 9) {
  15367. return lastNumber(number % 10);
  15368. }
  15369. return number;
  15370. }
  15371. function mutation(text, number) {
  15372. if (number === 2) {
  15373. return softMutation(text);
  15374. }
  15375. return text;
  15376. }
  15377. function softMutation(text) {
  15378. var mutationTable = {
  15379. m: 'v',
  15380. b: 'v',
  15381. d: 'z',
  15382. };
  15383. if (mutationTable[text.charAt(0)] === undefined) {
  15384. return text;
  15385. }
  15386. return mutationTable[text.charAt(0)] + text.substring(1);
  15387. }
  15388. var monthsParse = [
  15389. /^gen/i,
  15390. /^c[ʼ\']hwe/i,
  15391. /^meu/i,
  15392. /^ebr/i,
  15393. /^mae/i,
  15394. /^(mez|eve)/i,
  15395. /^gou/i,
  15396. /^eos/i,
  15397. /^gwe/i,
  15398. /^her/i,
  15399. /^du/i,
  15400. /^ker/i,
  15401. ],
  15402. monthsRegex$1 =
  15403. /^(genver|c[ʼ\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu|gen|c[ʼ\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i,
  15404. monthsStrictRegex =
  15405. /^(genver|c[ʼ\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu)/i,
  15406. monthsShortStrictRegex =
  15407. /^(gen|c[ʼ\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i,
  15408. fullWeekdaysParse = [
  15409. /^sul/i,
  15410. /^lun/i,
  15411. /^meurzh/i,
  15412. /^merc[ʼ\']her/i,
  15413. /^yaou/i,
  15414. /^gwener/i,
  15415. /^sadorn/i,
  15416. ],
  15417. shortWeekdaysParse = [
  15418. /^Sul/i,
  15419. /^Lun/i,
  15420. /^Meu/i,
  15421. /^Mer/i,
  15422. /^Yao/i,
  15423. /^Gwe/i,
  15424. /^Sad/i,
  15425. ],
  15426. minWeekdaysParse = [
  15427. /^Su/i,
  15428. /^Lu/i,
  15429. /^Me([^r]|$)/i,
  15430. /^Mer/i,
  15431. /^Ya/i,
  15432. /^Gw/i,
  15433. /^Sa/i,
  15434. ];
  15435. hooks.defineLocale('br', {
  15436. months: 'Genver_Cʼhwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu'.split(
  15437. '_'
  15438. ),
  15439. monthsShort: 'Gen_Cʼhwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker'.split('_'),
  15440. weekdays: 'Sul_Lun_Meurzh_Mercʼher_Yaou_Gwener_Sadorn'.split('_'),
  15441. weekdaysShort: 'Sul_Lun_Meu_Mer_Yao_Gwe_Sad'.split('_'),
  15442. weekdaysMin: 'Su_Lu_Me_Mer_Ya_Gw_Sa'.split('_'),
  15443. weekdaysParse: minWeekdaysParse,
  15444. fullWeekdaysParse: fullWeekdaysParse,
  15445. shortWeekdaysParse: shortWeekdaysParse,
  15446. minWeekdaysParse: minWeekdaysParse,
  15447. monthsRegex: monthsRegex$1,
  15448. monthsShortRegex: monthsRegex$1,
  15449. monthsStrictRegex: monthsStrictRegex,
  15450. monthsShortStrictRegex: monthsShortStrictRegex,
  15451. monthsParse: monthsParse,
  15452. longMonthsParse: monthsParse,
  15453. shortMonthsParse: monthsParse,
  15454. longDateFormat: {
  15455. LT: 'HH:mm',
  15456. LTS: 'HH:mm:ss',
  15457. L: 'DD/MM/YYYY',
  15458. LL: 'D [a viz] MMMM YYYY',
  15459. LLL: 'D [a viz] MMMM YYYY HH:mm',
  15460. LLLL: 'dddd, D [a viz] MMMM YYYY HH:mm',
  15461. },
  15462. calendar: {
  15463. sameDay: '[Hiziv da] LT',
  15464. nextDay: '[Warcʼhoazh da] LT',
  15465. nextWeek: 'dddd [da] LT',
  15466. lastDay: '[Decʼh da] LT',
  15467. lastWeek: 'dddd [paset da] LT',
  15468. sameElse: 'L',
  15469. },
  15470. relativeTime: {
  15471. future: 'a-benn %s',
  15472. past: '%s ʼzo',
  15473. s: 'un nebeud segondennoù',
  15474. ss: '%d eilenn',
  15475. m: 'ur vunutenn',
  15476. mm: relativeTimeWithMutation,
  15477. h: 'un eur',
  15478. hh: '%d eur',
  15479. d: 'un devezh',
  15480. dd: relativeTimeWithMutation,
  15481. M: 'ur miz',
  15482. MM: relativeTimeWithMutation,
  15483. y: 'ur bloaz',
  15484. yy: specialMutationForYears,
  15485. },
  15486. dayOfMonthOrdinalParse: /\d{1,2}(añ|vet)/,
  15487. ordinal: function (number) {
  15488. var output = number === 1 ? 'añ' : 'vet';
  15489. return number + output;
  15490. },
  15491. week: {
  15492. dow: 1, // Monday is the first day of the week.
  15493. doy: 4, // The week that contains Jan 4th is the first week of the year.
  15494. },
  15495. meridiemParse: /a.m.|g.m./, // goude merenn | a-raok merenn
  15496. isPM: function (token) {
  15497. return token === 'g.m.';
  15498. },
  15499. meridiem: function (hour, minute, isLower) {
  15500. return hour < 12 ? 'a.m.' : 'g.m.';
  15501. },
  15502. });
  15503. //! moment.js locale configuration
  15504. function translate(number, withoutSuffix, key) {
  15505. var result = number + ' ';
  15506. switch (key) {
  15507. case 'ss':
  15508. if (number === 1) {
  15509. result += 'sekunda';
  15510. } else if (number === 2 || number === 3 || number === 4) {
  15511. result += 'sekunde';
  15512. } else {
  15513. result += 'sekundi';
  15514. }
  15515. return result;
  15516. case 'm':
  15517. return withoutSuffix ? 'jedna minuta' : 'jedne minute';
  15518. case 'mm':
  15519. if (number === 1) {
  15520. result += 'minuta';
  15521. } else if (number === 2 || number === 3 || number === 4) {
  15522. result += 'minute';
  15523. } else {
  15524. result += 'minuta';
  15525. }
  15526. return result;
  15527. case 'h':
  15528. return withoutSuffix ? 'jedan sat' : 'jednog sata';
  15529. case 'hh':
  15530. if (number === 1) {
  15531. result += 'sat';
  15532. } else if (number === 2 || number === 3 || number === 4) {
  15533. result += 'sata';
  15534. } else {
  15535. result += 'sati';
  15536. }
  15537. return result;
  15538. case 'dd':
  15539. if (number === 1) {
  15540. result += 'dan';
  15541. } else {
  15542. result += 'dana';
  15543. }
  15544. return result;
  15545. case 'MM':
  15546. if (number === 1) {
  15547. result += 'mjesec';
  15548. } else if (number === 2 || number === 3 || number === 4) {
  15549. result += 'mjeseca';
  15550. } else {
  15551. result += 'mjeseci';
  15552. }
  15553. return result;
  15554. case 'yy':
  15555. if (number === 1) {
  15556. result += 'godina';
  15557. } else if (number === 2 || number === 3 || number === 4) {
  15558. result += 'godine';
  15559. } else {
  15560. result += 'godina';
  15561. }
  15562. return result;
  15563. }
  15564. }
  15565. hooks.defineLocale('bs', {
  15566. months: 'januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar'.split(
  15567. '_'
  15568. ),
  15569. monthsShort:
  15570. 'jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.'.split(
  15571. '_'
  15572. ),
  15573. monthsParseExact: true,
  15574. weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split(
  15575. '_'
  15576. ),
  15577. weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'),
  15578. weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'),
  15579. weekdaysParseExact: true,
  15580. longDateFormat: {
  15581. LT: 'H:mm',
  15582. LTS: 'H:mm:ss',
  15583. L: 'DD.MM.YYYY',
  15584. LL: 'D. MMMM YYYY',
  15585. LLL: 'D. MMMM YYYY H:mm',
  15586. LLLL: 'dddd, D. MMMM YYYY H:mm',
  15587. },
  15588. calendar: {
  15589. sameDay: '[danas u] LT',
  15590. nextDay: '[sutra u] LT',
  15591. nextWeek: function () {
  15592. switch (this.day()) {
  15593. case 0:
  15594. return '[u] [nedjelju] [u] LT';
  15595. case 3:
  15596. return '[u] [srijedu] [u] LT';
  15597. case 6:
  15598. return '[u] [subotu] [u] LT';
  15599. case 1:
  15600. case 2:
  15601. case 4:
  15602. case 5:
  15603. return '[u] dddd [u] LT';
  15604. }
  15605. },
  15606. lastDay: '[jučer u] LT',
  15607. lastWeek: function () {
  15608. switch (this.day()) {
  15609. case 0:
  15610. case 3:
  15611. return '[prošlu] dddd [u] LT';
  15612. case 6:
  15613. return '[prošle] [subote] [u] LT';
  15614. case 1:
  15615. case 2:
  15616. case 4:
  15617. case 5:
  15618. return '[prošli] dddd [u] LT';
  15619. }
  15620. },
  15621. sameElse: 'L',
  15622. },
  15623. relativeTime: {
  15624. future: 'za %s',
  15625. past: 'prije %s',
  15626. s: 'par sekundi',
  15627. ss: translate,
  15628. m: translate,
  15629. mm: translate,
  15630. h: translate,
  15631. hh: translate,
  15632. d: 'dan',
  15633. dd: translate,
  15634. M: 'mjesec',
  15635. MM: translate,
  15636. y: 'godinu',
  15637. yy: translate,
  15638. },
  15639. dayOfMonthOrdinalParse: /\d{1,2}\./,
  15640. ordinal: '%d.',
  15641. week: {
  15642. dow: 1, // Monday is the first day of the week.
  15643. doy: 7, // The week that contains Jan 7th is the first week of the year.
  15644. },
  15645. });
  15646. //! moment.js locale configuration
  15647. hooks.defineLocale('ca', {
  15648. months: {
  15649. standalone:
  15650. 'gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre'.split(
  15651. '_'
  15652. ),
  15653. format: "de gener_de febrer_de març_d'abril_de maig_de juny_de juliol_d'agost_de setembre_d'octubre_de novembre_de desembre".split(
  15654. '_'
  15655. ),
  15656. isFormat: /D[oD]?(\s)+MMMM/,
  15657. },
  15658. monthsShort:
  15659. 'gen._febr._març_abr._maig_juny_jul._ag._set._oct._nov._des.'.split(
  15660. '_'
  15661. ),
  15662. monthsParseExact: true,
  15663. weekdays:
  15664. 'diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte'.split(
  15665. '_'
  15666. ),
  15667. weekdaysShort: 'dg._dl._dt._dc._dj._dv._ds.'.split('_'),
  15668. weekdaysMin: 'dg_dl_dt_dc_dj_dv_ds'.split('_'),
  15669. weekdaysParseExact: true,
  15670. longDateFormat: {
  15671. LT: 'H:mm',
  15672. LTS: 'H:mm:ss',
  15673. L: 'DD/MM/YYYY',
  15674. LL: 'D MMMM [de] YYYY',
  15675. ll: 'D MMM YYYY',
  15676. LLL: 'D MMMM [de] YYYY [a les] H:mm',
  15677. lll: 'D MMM YYYY, H:mm',
  15678. LLLL: 'dddd D MMMM [de] YYYY [a les] H:mm',
  15679. llll: 'ddd D MMM YYYY, H:mm',
  15680. },
  15681. calendar: {
  15682. sameDay: function () {
  15683. return '[avui a ' + (this.hours() !== 1 ? 'les' : 'la') + '] LT';
  15684. },
  15685. nextDay: function () {
  15686. return '[demà a ' + (this.hours() !== 1 ? 'les' : 'la') + '] LT';
  15687. },
  15688. nextWeek: function () {
  15689. return 'dddd [a ' + (this.hours() !== 1 ? 'les' : 'la') + '] LT';
  15690. },
  15691. lastDay: function () {
  15692. return '[ahir a ' + (this.hours() !== 1 ? 'les' : 'la') + '] LT';
  15693. },
  15694. lastWeek: function () {
  15695. return (
  15696. '[el] dddd [passat a ' +
  15697. (this.hours() !== 1 ? 'les' : 'la') +
  15698. '] LT'
  15699. );
  15700. },
  15701. sameElse: 'L',
  15702. },
  15703. relativeTime: {
  15704. future: "d'aquí %s",
  15705. past: 'fa %s',
  15706. s: 'uns segons',
  15707. ss: '%d segons',
  15708. m: 'un minut',
  15709. mm: '%d minuts',
  15710. h: 'una hora',
  15711. hh: '%d hores',
  15712. d: 'un dia',
  15713. dd: '%d dies',
  15714. M: 'un mes',
  15715. MM: '%d mesos',
  15716. y: 'un any',
  15717. yy: '%d anys',
  15718. },
  15719. dayOfMonthOrdinalParse: /\d{1,2}(r|n|t|è|a)/,
  15720. ordinal: function (number, period) {
  15721. var output =
  15722. number === 1
  15723. ? 'r'
  15724. : number === 2
  15725. ? 'n'
  15726. : number === 3
  15727. ? 'r'
  15728. : number === 4
  15729. ? 't'
  15730. : 'è';
  15731. if (period === 'w' || period === 'W') {
  15732. output = 'a';
  15733. }
  15734. return number + output;
  15735. },
  15736. week: {
  15737. dow: 1, // Monday is the first day of the week.
  15738. doy: 4, // The week that contains Jan 4th is the first week of the year.
  15739. },
  15740. });
  15741. //! moment.js locale configuration
  15742. var months$4 = {
  15743. format: 'leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec'.split(
  15744. '_'
  15745. ),
  15746. standalone:
  15747. 'ledna_února_března_dubna_května_června_července_srpna_září_října_listopadu_prosince'.split(
  15748. '_'
  15749. ),
  15750. },
  15751. monthsShort = 'led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro'.split('_'),
  15752. monthsParse$1 = [
  15753. /^led/i,
  15754. /^úno/i,
  15755. /^bře/i,
  15756. /^dub/i,
  15757. /^kvě/i,
  15758. /^(čvn|červen$|června)/i,
  15759. /^(čvc|červenec|července)/i,
  15760. /^srp/i,
  15761. /^zář/i,
  15762. /^říj/i,
  15763. /^lis/i,
  15764. /^pro/i,
  15765. ],
  15766. // NOTE: 'červen' is substring of 'červenec'; therefore 'červenec' must precede 'červen' in the regex to be fully matched.
  15767. // Otherwise parser matches '1. červenec' as '1. červen' + 'ec'.
  15768. monthsRegex$2 =
  15769. /^(leden|únor|březen|duben|květen|červenec|července|červen|června|srpen|září|říjen|listopad|prosinec|led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i;
  15770. function plural$1(n) {
  15771. return n > 1 && n < 5 && ~~(n / 10) !== 1;
  15772. }
  15773. function translate$1(number, withoutSuffix, key, isFuture) {
  15774. var result = number + ' ';
  15775. switch (key) {
  15776. case 's': // a few seconds / in a few seconds / a few seconds ago
  15777. return withoutSuffix || isFuture ? 'pár sekund' : 'pár sekundami';
  15778. case 'ss': // 9 seconds / in 9 seconds / 9 seconds ago
  15779. if (withoutSuffix || isFuture) {
  15780. return result + (plural$1(number) ? 'sekundy' : 'sekund');
  15781. } else {
  15782. return result + 'sekundami';
  15783. }
  15784. case 'm': // a minute / in a minute / a minute ago
  15785. return withoutSuffix ? 'minuta' : isFuture ? 'minutu' : 'minutou';
  15786. case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago
  15787. if (withoutSuffix || isFuture) {
  15788. return result + (plural$1(number) ? 'minuty' : 'minut');
  15789. } else {
  15790. return result + 'minutami';
  15791. }
  15792. case 'h': // an hour / in an hour / an hour ago
  15793. return withoutSuffix ? 'hodina' : isFuture ? 'hodinu' : 'hodinou';
  15794. case 'hh': // 9 hours / in 9 hours / 9 hours ago
  15795. if (withoutSuffix || isFuture) {
  15796. return result + (plural$1(number) ? 'hodiny' : 'hodin');
  15797. } else {
  15798. return result + 'hodinami';
  15799. }
  15800. case 'd': // a day / in a day / a day ago
  15801. return withoutSuffix || isFuture ? 'den' : 'dnem';
  15802. case 'dd': // 9 days / in 9 days / 9 days ago
  15803. if (withoutSuffix || isFuture) {
  15804. return result + (plural$1(number) ? 'dny' : 'dní');
  15805. } else {
  15806. return result + 'dny';
  15807. }
  15808. case 'M': // a month / in a month / a month ago
  15809. return withoutSuffix || isFuture ? 'měsíc' : 'měsícem';
  15810. case 'MM': // 9 months / in 9 months / 9 months ago
  15811. if (withoutSuffix || isFuture) {
  15812. return result + (plural$1(number) ? 'měsíce' : 'měsíců');
  15813. } else {
  15814. return result + 'měsíci';
  15815. }
  15816. case 'y': // a year / in a year / a year ago
  15817. return withoutSuffix || isFuture ? 'rok' : 'rokem';
  15818. case 'yy': // 9 years / in 9 years / 9 years ago
  15819. if (withoutSuffix || isFuture) {
  15820. return result + (plural$1(number) ? 'roky' : 'let');
  15821. } else {
  15822. return result + 'lety';
  15823. }
  15824. }
  15825. }
  15826. hooks.defineLocale('cs', {
  15827. months: months$4,
  15828. monthsShort: monthsShort,
  15829. monthsRegex: monthsRegex$2,
  15830. monthsShortRegex: monthsRegex$2,
  15831. // NOTE: 'červen' is substring of 'červenec'; therefore 'červenec' must precede 'červen' in the regex to be fully matched.
  15832. // Otherwise parser matches '1. červenec' as '1. červen' + 'ec'.
  15833. monthsStrictRegex:
  15834. /^(leden|ledna|února|únor|březen|března|duben|dubna|květen|května|červenec|července|červen|června|srpen|srpna|září|říjen|října|listopadu|listopad|prosinec|prosince)/i,
  15835. monthsShortStrictRegex:
  15836. /^(led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i,
  15837. monthsParse: monthsParse$1,
  15838. longMonthsParse: monthsParse$1,
  15839. shortMonthsParse: monthsParse$1,
  15840. weekdays: 'neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota'.split('_'),
  15841. weekdaysShort: 'ne_po_út_st_čt_pá_so'.split('_'),
  15842. weekdaysMin: 'ne_po_út_st_čt_pá_so'.split('_'),
  15843. longDateFormat: {
  15844. LT: 'H:mm',
  15845. LTS: 'H:mm:ss',
  15846. L: 'DD.MM.YYYY',
  15847. LL: 'D. MMMM YYYY',
  15848. LLL: 'D. MMMM YYYY H:mm',
  15849. LLLL: 'dddd D. MMMM YYYY H:mm',
  15850. l: 'D. M. YYYY',
  15851. },
  15852. calendar: {
  15853. sameDay: '[dnes v] LT',
  15854. nextDay: '[zítra v] LT',
  15855. nextWeek: function () {
  15856. switch (this.day()) {
  15857. case 0:
  15858. return '[v neděli v] LT';
  15859. case 1:
  15860. case 2:
  15861. return '[v] dddd [v] LT';
  15862. case 3:
  15863. return '[ve středu v] LT';
  15864. case 4:
  15865. return '[ve čtvrtek v] LT';
  15866. case 5:
  15867. return '[v pátek v] LT';
  15868. case 6:
  15869. return '[v sobotu v] LT';
  15870. }
  15871. },
  15872. lastDay: '[včera v] LT',
  15873. lastWeek: function () {
  15874. switch (this.day()) {
  15875. case 0:
  15876. return '[minulou neděli v] LT';
  15877. case 1:
  15878. case 2:
  15879. return '[minulé] dddd [v] LT';
  15880. case 3:
  15881. return '[minulou středu v] LT';
  15882. case 4:
  15883. case 5:
  15884. return '[minulý] dddd [v] LT';
  15885. case 6:
  15886. return '[minulou sobotu v] LT';
  15887. }
  15888. },
  15889. sameElse: 'L',
  15890. },
  15891. relativeTime: {
  15892. future: 'za %s',
  15893. past: 'před %s',
  15894. s: translate$1,
  15895. ss: translate$1,
  15896. m: translate$1,
  15897. mm: translate$1,
  15898. h: translate$1,
  15899. hh: translate$1,
  15900. d: translate$1,
  15901. dd: translate$1,
  15902. M: translate$1,
  15903. MM: translate$1,
  15904. y: translate$1,
  15905. yy: translate$1,
  15906. },
  15907. dayOfMonthOrdinalParse: /\d{1,2}\./,
  15908. ordinal: '%d.',
  15909. week: {
  15910. dow: 1, // Monday is the first day of the week.
  15911. doy: 4, // The week that contains Jan 4th is the first week of the year.
  15912. },
  15913. });
  15914. //! moment.js locale configuration
  15915. hooks.defineLocale('cv', {
  15916. months: 'кӑрлач_нарӑс_пуш_ака_май_ҫӗртме_утӑ_ҫурла_авӑн_юпа_чӳк_раштав'.split(
  15917. '_'
  15918. ),
  15919. monthsShort: 'кӑр_нар_пуш_ака_май_ҫӗр_утӑ_ҫур_авн_юпа_чӳк_раш'.split('_'),
  15920. weekdays:
  15921. 'вырсарникун_тунтикун_ытларикун_юнкун_кӗҫнерникун_эрнекун_шӑматкун'.split(
  15922. '_'
  15923. ),
  15924. weekdaysShort: 'выр_тун_ытл_юн_кӗҫ_эрн_шӑм'.split('_'),
  15925. weekdaysMin: 'вр_тн_ыт_юн_кҫ_эр_шм'.split('_'),
  15926. longDateFormat: {
  15927. LT: 'HH:mm',
  15928. LTS: 'HH:mm:ss',
  15929. L: 'DD-MM-YYYY',
  15930. LL: 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ]',
  15931. LLL: 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm',
  15932. LLLL: 'dddd, YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm',
  15933. },
  15934. calendar: {
  15935. sameDay: '[Паян] LT [сехетре]',
  15936. nextDay: '[Ыран] LT [сехетре]',
  15937. lastDay: '[Ӗнер] LT [сехетре]',
  15938. nextWeek: '[Ҫитес] dddd LT [сехетре]',
  15939. lastWeek: '[Иртнӗ] dddd LT [сехетре]',
  15940. sameElse: 'L',
  15941. },
  15942. relativeTime: {
  15943. future: function (output) {
  15944. var affix = /сехет$/i.exec(output)
  15945. ? 'рен'
  15946. : /ҫул$/i.exec(output)
  15947. ? 'тан'
  15948. : 'ран';
  15949. return output + affix;
  15950. },
  15951. past: '%s каялла',
  15952. s: 'пӗр-ик ҫеккунт',
  15953. ss: '%d ҫеккунт',
  15954. m: 'пӗр минут',
  15955. mm: '%d минут',
  15956. h: 'пӗр сехет',
  15957. hh: '%d сехет',
  15958. d: 'пӗр кун',
  15959. dd: '%d кун',
  15960. M: 'пӗр уйӑх',
  15961. MM: '%d уйӑх',
  15962. y: 'пӗр ҫул',
  15963. yy: '%d ҫул',
  15964. },
  15965. dayOfMonthOrdinalParse: /\d{1,2}-мӗш/,
  15966. ordinal: '%d-мӗш',
  15967. week: {
  15968. dow: 1, // Monday is the first day of the week.
  15969. doy: 7, // The week that contains Jan 7th is the first week of the year.
  15970. },
  15971. });
  15972. //! moment.js locale configuration
  15973. hooks.defineLocale('cy', {
  15974. months: 'Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr'.split(
  15975. '_'
  15976. ),
  15977. monthsShort: 'Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag'.split(
  15978. '_'
  15979. ),
  15980. weekdays:
  15981. 'Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn'.split(
  15982. '_'
  15983. ),
  15984. weekdaysShort: 'Sul_Llun_Maw_Mer_Iau_Gwe_Sad'.split('_'),
  15985. weekdaysMin: 'Su_Ll_Ma_Me_Ia_Gw_Sa'.split('_'),
  15986. weekdaysParseExact: true,
  15987. // time formats are the same as en-gb
  15988. longDateFormat: {
  15989. LT: 'HH:mm',
  15990. LTS: 'HH:mm:ss',
  15991. L: 'DD/MM/YYYY',
  15992. LL: 'D MMMM YYYY',
  15993. LLL: 'D MMMM YYYY HH:mm',
  15994. LLLL: 'dddd, D MMMM YYYY HH:mm',
  15995. },
  15996. calendar: {
  15997. sameDay: '[Heddiw am] LT',
  15998. nextDay: '[Yfory am] LT',
  15999. nextWeek: 'dddd [am] LT',
  16000. lastDay: '[Ddoe am] LT',
  16001. lastWeek: 'dddd [diwethaf am] LT',
  16002. sameElse: 'L',
  16003. },
  16004. relativeTime: {
  16005. future: 'mewn %s',
  16006. past: '%s yn ôl',
  16007. s: 'ychydig eiliadau',
  16008. ss: '%d eiliad',
  16009. m: 'munud',
  16010. mm: '%d munud',
  16011. h: 'awr',
  16012. hh: '%d awr',
  16013. d: 'diwrnod',
  16014. dd: '%d diwrnod',
  16015. M: 'mis',
  16016. MM: '%d mis',
  16017. y: 'blwyddyn',
  16018. yy: '%d flynedd',
  16019. },
  16020. dayOfMonthOrdinalParse: /\d{1,2}(fed|ain|af|il|ydd|ed|eg)/,
  16021. // traditional ordinal numbers above 31 are not commonly used in colloquial Welsh
  16022. ordinal: function (number) {
  16023. var b = number,
  16024. output = '',
  16025. lookup = [
  16026. '',
  16027. 'af',
  16028. 'il',
  16029. 'ydd',
  16030. 'ydd',
  16031. 'ed',
  16032. 'ed',
  16033. 'ed',
  16034. 'fed',
  16035. 'fed',
  16036. 'fed', // 1af to 10fed
  16037. 'eg',
  16038. 'fed',
  16039. 'eg',
  16040. 'eg',
  16041. 'fed',
  16042. 'eg',
  16043. 'eg',
  16044. 'fed',
  16045. 'eg',
  16046. 'fed', // 11eg to 20fed
  16047. ];
  16048. if (b > 20) {
  16049. if (b === 40 || b === 50 || b === 60 || b === 80 || b === 100) {
  16050. output = 'fed'; // not 30ain, 70ain or 90ain
  16051. } else {
  16052. output = 'ain';
  16053. }
  16054. } else if (b > 0) {
  16055. output = lookup[b];
  16056. }
  16057. return number + output;
  16058. },
  16059. week: {
  16060. dow: 1, // Monday is the first day of the week.
  16061. doy: 4, // The week that contains Jan 4th is the first week of the year.
  16062. },
  16063. });
  16064. //! moment.js locale configuration
  16065. hooks.defineLocale('da', {
  16066. months: 'januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december'.split(
  16067. '_'
  16068. ),
  16069. monthsShort: 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'),
  16070. weekdays: 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'),
  16071. weekdaysShort: 'søn_man_tir_ons_tor_fre_lør'.split('_'),
  16072. weekdaysMin: 'sø_ma_ti_on_to_fr_lø'.split('_'),
  16073. longDateFormat: {
  16074. LT: 'HH:mm',
  16075. LTS: 'HH:mm:ss',
  16076. L: 'DD.MM.YYYY',
  16077. LL: 'D. MMMM YYYY',
  16078. LLL: 'D. MMMM YYYY HH:mm',
  16079. LLLL: 'dddd [d.] D. MMMM YYYY [kl.] HH:mm',
  16080. },
  16081. calendar: {
  16082. sameDay: '[i dag kl.] LT',
  16083. nextDay: '[i morgen kl.] LT',
  16084. nextWeek: 'på dddd [kl.] LT',
  16085. lastDay: '[i går kl.] LT',
  16086. lastWeek: '[i] dddd[s kl.] LT',
  16087. sameElse: 'L',
  16088. },
  16089. relativeTime: {
  16090. future: 'om %s',
  16091. past: '%s siden',
  16092. s: 'få sekunder',
  16093. ss: '%d sekunder',
  16094. m: 'et minut',
  16095. mm: '%d minutter',
  16096. h: 'en time',
  16097. hh: '%d timer',
  16098. d: 'en dag',
  16099. dd: '%d dage',
  16100. M: 'en måned',
  16101. MM: '%d måneder',
  16102. y: 'et år',
  16103. yy: '%d år',
  16104. },
  16105. dayOfMonthOrdinalParse: /\d{1,2}\./,
  16106. ordinal: '%d.',
  16107. week: {
  16108. dow: 1, // Monday is the first day of the week.
  16109. doy: 4, // The week that contains Jan 4th is the first week of the year.
  16110. },
  16111. });
  16112. //! moment.js locale configuration
  16113. function processRelativeTime(number, withoutSuffix, key, isFuture) {
  16114. var format = {
  16115. m: ['eine Minute', 'einer Minute'],
  16116. h: ['eine Stunde', 'einer Stunde'],
  16117. d: ['ein Tag', 'einem Tag'],
  16118. dd: [number + ' Tage', number + ' Tagen'],
  16119. w: ['eine Woche', 'einer Woche'],
  16120. M: ['ein Monat', 'einem Monat'],
  16121. MM: [number + ' Monate', number + ' Monaten'],
  16122. y: ['ein Jahr', 'einem Jahr'],
  16123. yy: [number + ' Jahre', number + ' Jahren'],
  16124. };
  16125. return withoutSuffix ? format[key][0] : format[key][1];
  16126. }
  16127. hooks.defineLocale('de-at', {
  16128. months: 'Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split(
  16129. '_'
  16130. ),
  16131. monthsShort:
  16132. 'Jän._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split('_'),
  16133. monthsParseExact: true,
  16134. weekdays:
  16135. 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split(
  16136. '_'
  16137. ),
  16138. weekdaysShort: 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'),
  16139. weekdaysMin: 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'),
  16140. weekdaysParseExact: true,
  16141. longDateFormat: {
  16142. LT: 'HH:mm',
  16143. LTS: 'HH:mm:ss',
  16144. L: 'DD.MM.YYYY',
  16145. LL: 'D. MMMM YYYY',
  16146. LLL: 'D. MMMM YYYY HH:mm',
  16147. LLLL: 'dddd, D. MMMM YYYY HH:mm',
  16148. },
  16149. calendar: {
  16150. sameDay: '[heute um] LT [Uhr]',
  16151. sameElse: 'L',
  16152. nextDay: '[morgen um] LT [Uhr]',
  16153. nextWeek: 'dddd [um] LT [Uhr]',
  16154. lastDay: '[gestern um] LT [Uhr]',
  16155. lastWeek: '[letzten] dddd [um] LT [Uhr]',
  16156. },
  16157. relativeTime: {
  16158. future: 'in %s',
  16159. past: 'vor %s',
  16160. s: 'ein paar Sekunden',
  16161. ss: '%d Sekunden',
  16162. m: processRelativeTime,
  16163. mm: '%d Minuten',
  16164. h: processRelativeTime,
  16165. hh: '%d Stunden',
  16166. d: processRelativeTime,
  16167. dd: processRelativeTime,
  16168. w: processRelativeTime,
  16169. ww: '%d Wochen',
  16170. M: processRelativeTime,
  16171. MM: processRelativeTime,
  16172. y: processRelativeTime,
  16173. yy: processRelativeTime,
  16174. },
  16175. dayOfMonthOrdinalParse: /\d{1,2}\./,
  16176. ordinal: '%d.',
  16177. week: {
  16178. dow: 1, // Monday is the first day of the week.
  16179. doy: 4, // The week that contains Jan 4th is the first week of the year.
  16180. },
  16181. });
  16182. //! moment.js locale configuration
  16183. function processRelativeTime$1(number, withoutSuffix, key, isFuture) {
  16184. var format = {
  16185. m: ['eine Minute', 'einer Minute'],
  16186. h: ['eine Stunde', 'einer Stunde'],
  16187. d: ['ein Tag', 'einem Tag'],
  16188. dd: [number + ' Tage', number + ' Tagen'],
  16189. w: ['eine Woche', 'einer Woche'],
  16190. M: ['ein Monat', 'einem Monat'],
  16191. MM: [number + ' Monate', number + ' Monaten'],
  16192. y: ['ein Jahr', 'einem Jahr'],
  16193. yy: [number + ' Jahre', number + ' Jahren'],
  16194. };
  16195. return withoutSuffix ? format[key][0] : format[key][1];
  16196. }
  16197. hooks.defineLocale('de-ch', {
  16198. months: 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split(
  16199. '_'
  16200. ),
  16201. monthsShort:
  16202. 'Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split('_'),
  16203. monthsParseExact: true,
  16204. weekdays:
  16205. 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split(
  16206. '_'
  16207. ),
  16208. weekdaysShort: 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'),
  16209. weekdaysMin: 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'),
  16210. weekdaysParseExact: true,
  16211. longDateFormat: {
  16212. LT: 'HH:mm',
  16213. LTS: 'HH:mm:ss',
  16214. L: 'DD.MM.YYYY',
  16215. LL: 'D. MMMM YYYY',
  16216. LLL: 'D. MMMM YYYY HH:mm',
  16217. LLLL: 'dddd, D. MMMM YYYY HH:mm',
  16218. },
  16219. calendar: {
  16220. sameDay: '[heute um] LT [Uhr]',
  16221. sameElse: 'L',
  16222. nextDay: '[morgen um] LT [Uhr]',
  16223. nextWeek: 'dddd [um] LT [Uhr]',
  16224. lastDay: '[gestern um] LT [Uhr]',
  16225. lastWeek: '[letzten] dddd [um] LT [Uhr]',
  16226. },
  16227. relativeTime: {
  16228. future: 'in %s',
  16229. past: 'vor %s',
  16230. s: 'ein paar Sekunden',
  16231. ss: '%d Sekunden',
  16232. m: processRelativeTime$1,
  16233. mm: '%d Minuten',
  16234. h: processRelativeTime$1,
  16235. hh: '%d Stunden',
  16236. d: processRelativeTime$1,
  16237. dd: processRelativeTime$1,
  16238. w: processRelativeTime$1,
  16239. ww: '%d Wochen',
  16240. M: processRelativeTime$1,
  16241. MM: processRelativeTime$1,
  16242. y: processRelativeTime$1,
  16243. yy: processRelativeTime$1,
  16244. },
  16245. dayOfMonthOrdinalParse: /\d{1,2}\./,
  16246. ordinal: '%d.',
  16247. week: {
  16248. dow: 1, // Monday is the first day of the week.
  16249. doy: 4, // The week that contains Jan 4th is the first week of the year.
  16250. },
  16251. });
  16252. //! moment.js locale configuration
  16253. function processRelativeTime$2(number, withoutSuffix, key, isFuture) {
  16254. var format = {
  16255. m: ['eine Minute', 'einer Minute'],
  16256. h: ['eine Stunde', 'einer Stunde'],
  16257. d: ['ein Tag', 'einem Tag'],
  16258. dd: [number + ' Tage', number + ' Tagen'],
  16259. w: ['eine Woche', 'einer Woche'],
  16260. M: ['ein Monat', 'einem Monat'],
  16261. MM: [number + ' Monate', number + ' Monaten'],
  16262. y: ['ein Jahr', 'einem Jahr'],
  16263. yy: [number + ' Jahre', number + ' Jahren'],
  16264. };
  16265. return withoutSuffix ? format[key][0] : format[key][1];
  16266. }
  16267. hooks.defineLocale('de', {
  16268. months: 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split(
  16269. '_'
  16270. ),
  16271. monthsShort:
  16272. 'Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split('_'),
  16273. monthsParseExact: true,
  16274. weekdays:
  16275. 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split(
  16276. '_'
  16277. ),
  16278. weekdaysShort: 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'),
  16279. weekdaysMin: 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'),
  16280. weekdaysParseExact: true,
  16281. longDateFormat: {
  16282. LT: 'HH:mm',
  16283. LTS: 'HH:mm:ss',
  16284. L: 'DD.MM.YYYY',
  16285. LL: 'D. MMMM YYYY',
  16286. LLL: 'D. MMMM YYYY HH:mm',
  16287. LLLL: 'dddd, D. MMMM YYYY HH:mm',
  16288. },
  16289. calendar: {
  16290. sameDay: '[heute um] LT [Uhr]',
  16291. sameElse: 'L',
  16292. nextDay: '[morgen um] LT [Uhr]',
  16293. nextWeek: 'dddd [um] LT [Uhr]',
  16294. lastDay: '[gestern um] LT [Uhr]',
  16295. lastWeek: '[letzten] dddd [um] LT [Uhr]',
  16296. },
  16297. relativeTime: {
  16298. future: 'in %s',
  16299. past: 'vor %s',
  16300. s: 'ein paar Sekunden',
  16301. ss: '%d Sekunden',
  16302. m: processRelativeTime$2,
  16303. mm: '%d Minuten',
  16304. h: processRelativeTime$2,
  16305. hh: '%d Stunden',
  16306. d: processRelativeTime$2,
  16307. dd: processRelativeTime$2,
  16308. w: processRelativeTime$2,
  16309. ww: '%d Wochen',
  16310. M: processRelativeTime$2,
  16311. MM: processRelativeTime$2,
  16312. y: processRelativeTime$2,
  16313. yy: processRelativeTime$2,
  16314. },
  16315. dayOfMonthOrdinalParse: /\d{1,2}\./,
  16316. ordinal: '%d.',
  16317. week: {
  16318. dow: 1, // Monday is the first day of the week.
  16319. doy: 4, // The week that contains Jan 4th is the first week of the year.
  16320. },
  16321. });
  16322. //! moment.js locale configuration
  16323. var months$5 = [
  16324. 'ޖެނުއަރީ',
  16325. 'ފެބްރުއަރީ',
  16326. 'މާރިޗު',
  16327. 'އޭޕްރީލު',
  16328. 'މޭ',
  16329. 'ޖޫން',
  16330. 'ޖުލައި',
  16331. 'އޯގަސްޓު',
  16332. 'ސެޕްޓެމްބަރު',
  16333. 'އޮކްޓޯބަރު',
  16334. 'ނޮވެމްބަރު',
  16335. 'ޑިސެމްބަރު',
  16336. ],
  16337. weekdays = [
  16338. 'އާދިއްތަ',
  16339. 'ހޯމަ',
  16340. 'އަންގާރަ',
  16341. 'ބުދަ',
  16342. 'ބުރާސްފަތި',
  16343. 'ހުކުރު',
  16344. 'ހޮނިހިރު',
  16345. ];
  16346. hooks.defineLocale('dv', {
  16347. months: months$5,
  16348. monthsShort: months$5,
  16349. weekdays: weekdays,
  16350. weekdaysShort: weekdays,
  16351. weekdaysMin: 'އާދި_ހޯމަ_އަން_ބުދަ_ބުރާ_ހުކު_ހޮނި'.split('_'),
  16352. longDateFormat: {
  16353. LT: 'HH:mm',
  16354. LTS: 'HH:mm:ss',
  16355. L: 'D/M/YYYY',
  16356. LL: 'D MMMM YYYY',
  16357. LLL: 'D MMMM YYYY HH:mm',
  16358. LLLL: 'dddd D MMMM YYYY HH:mm',
  16359. },
  16360. meridiemParse: /މކ|މފ/,
  16361. isPM: function (input) {
  16362. return 'މފ' === input;
  16363. },
  16364. meridiem: function (hour, minute, isLower) {
  16365. if (hour < 12) {
  16366. return 'މކ';
  16367. } else {
  16368. return 'މފ';
  16369. }
  16370. },
  16371. calendar: {
  16372. sameDay: '[މިއަދު] LT',
  16373. nextDay: '[މާދަމާ] LT',
  16374. nextWeek: 'dddd LT',
  16375. lastDay: '[އިއްޔެ] LT',
  16376. lastWeek: '[ފާއިތުވި] dddd LT',
  16377. sameElse: 'L',
  16378. },
  16379. relativeTime: {
  16380. future: 'ތެރޭގައި %s',
  16381. past: 'ކުރިން %s',
  16382. s: 'ސިކުންތުކޮޅެއް',
  16383. ss: 'd% ސިކުންތު',
  16384. m: 'މިނިޓެއް',
  16385. mm: 'މިނިޓު %d',
  16386. h: 'ގަޑިއިރެއް',
  16387. hh: 'ގަޑިއިރު %d',
  16388. d: 'ދުވަހެއް',
  16389. dd: 'ދުވަސް %d',
  16390. M: 'މަހެއް',
  16391. MM: 'މަސް %d',
  16392. y: 'އަހަރެއް',
  16393. yy: 'އަހަރު %d',
  16394. },
  16395. preparse: function (string) {
  16396. return string.replace(/،/g, ',');
  16397. },
  16398. postformat: function (string) {
  16399. return string.replace(/,/g, '،');
  16400. },
  16401. week: {
  16402. dow: 7, // Sunday is the first day of the week.
  16403. doy: 12, // The week that contains Jan 12th is the first week of the year.
  16404. },
  16405. });
  16406. //! moment.js locale configuration
  16407. function isFunction$1(input) {
  16408. return (
  16409. (typeof Function !== 'undefined' && input instanceof Function) ||
  16410. Object.prototype.toString.call(input) === '[object Function]'
  16411. );
  16412. }
  16413. hooks.defineLocale('el', {
  16414. monthsNominativeEl:
  16415. 'Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος'.split(
  16416. '_'
  16417. ),
  16418. monthsGenitiveEl:
  16419. 'Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου'.split(
  16420. '_'
  16421. ),
  16422. months: function (momentToFormat, format) {
  16423. if (!momentToFormat) {
  16424. return this._monthsNominativeEl;
  16425. } else if (
  16426. typeof format === 'string' &&
  16427. /D/.test(format.substring(0, format.indexOf('MMMM')))
  16428. ) {
  16429. // if there is a day number before 'MMMM'
  16430. return this._monthsGenitiveEl[momentToFormat.month()];
  16431. } else {
  16432. return this._monthsNominativeEl[momentToFormat.month()];
  16433. }
  16434. },
  16435. monthsShort: 'Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ'.split('_'),
  16436. weekdays: 'Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο'.split(
  16437. '_'
  16438. ),
  16439. weekdaysShort: 'Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ'.split('_'),
  16440. weekdaysMin: 'Κυ_Δε_Τρ_Τε_Πε_Πα_Σα'.split('_'),
  16441. meridiem: function (hours, minutes, isLower) {
  16442. if (hours > 11) {
  16443. return isLower ? 'μμ' : 'ΜΜ';
  16444. } else {
  16445. return isLower ? 'πμ' : 'ΠΜ';
  16446. }
  16447. },
  16448. isPM: function (input) {
  16449. return (input + '').toLowerCase()[0] === 'μ';
  16450. },
  16451. meridiemParse: /[ΠΜ]\.?Μ?\.?/i,
  16452. longDateFormat: {
  16453. LT: 'h:mm A',
  16454. LTS: 'h:mm:ss A',
  16455. L: 'DD/MM/YYYY',
  16456. LL: 'D MMMM YYYY',
  16457. LLL: 'D MMMM YYYY h:mm A',
  16458. LLLL: 'dddd, D MMMM YYYY h:mm A',
  16459. },
  16460. calendarEl: {
  16461. sameDay: '[Σήμερα {}] LT',
  16462. nextDay: '[Αύριο {}] LT',
  16463. nextWeek: 'dddd [{}] LT',
  16464. lastDay: '[Χθες {}] LT',
  16465. lastWeek: function () {
  16466. switch (this.day()) {
  16467. case 6:
  16468. return '[το προηγούμενο] dddd [{}] LT';
  16469. default:
  16470. return '[την προηγούμενη] dddd [{}] LT';
  16471. }
  16472. },
  16473. sameElse: 'L',
  16474. },
  16475. calendar: function (key, mom) {
  16476. var output = this._calendarEl[key],
  16477. hours = mom && mom.hours();
  16478. if (isFunction$1(output)) {
  16479. output = output.apply(mom);
  16480. }
  16481. return output.replace('{}', hours % 12 === 1 ? 'στη' : 'στις');
  16482. },
  16483. relativeTime: {
  16484. future: 'σε %s',
  16485. past: '%s πριν',
  16486. s: 'λίγα δευτερόλεπτα',
  16487. ss: '%d δευτερόλεπτα',
  16488. m: 'ένα λεπτό',
  16489. mm: '%d λεπτά',
  16490. h: 'μία ώρα',
  16491. hh: '%d ώρες',
  16492. d: 'μία μέρα',
  16493. dd: '%d μέρες',
  16494. M: 'ένας μήνας',
  16495. MM: '%d μήνες',
  16496. y: 'ένας χρόνος',
  16497. yy: '%d χρόνια',
  16498. },
  16499. dayOfMonthOrdinalParse: /\d{1,2}η/,
  16500. ordinal: '%dη',
  16501. week: {
  16502. dow: 1, // Monday is the first day of the week.
  16503. doy: 4, // The week that contains Jan 4st is the first week of the year.
  16504. },
  16505. });
  16506. //! moment.js locale configuration
  16507. hooks.defineLocale('en-au', {
  16508. months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
  16509. '_'
  16510. ),
  16511. monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
  16512. weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(
  16513. '_'
  16514. ),
  16515. weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
  16516. weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
  16517. longDateFormat: {
  16518. LT: 'h:mm A',
  16519. LTS: 'h:mm:ss A',
  16520. L: 'DD/MM/YYYY',
  16521. LL: 'D MMMM YYYY',
  16522. LLL: 'D MMMM YYYY h:mm A',
  16523. LLLL: 'dddd, D MMMM YYYY h:mm A',
  16524. },
  16525. calendar: {
  16526. sameDay: '[Today at] LT',
  16527. nextDay: '[Tomorrow at] LT',
  16528. nextWeek: 'dddd [at] LT',
  16529. lastDay: '[Yesterday at] LT',
  16530. lastWeek: '[Last] dddd [at] LT',
  16531. sameElse: 'L',
  16532. },
  16533. relativeTime: {
  16534. future: 'in %s',
  16535. past: '%s ago',
  16536. s: 'a few seconds',
  16537. ss: '%d seconds',
  16538. m: 'a minute',
  16539. mm: '%d minutes',
  16540. h: 'an hour',
  16541. hh: '%d hours',
  16542. d: 'a day',
  16543. dd: '%d days',
  16544. M: 'a month',
  16545. MM: '%d months',
  16546. y: 'a year',
  16547. yy: '%d years',
  16548. },
  16549. dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
  16550. ordinal: function (number) {
  16551. var b = number % 10,
  16552. output =
  16553. ~~((number % 100) / 10) === 1
  16554. ? 'th'
  16555. : b === 1
  16556. ? 'st'
  16557. : b === 2
  16558. ? 'nd'
  16559. : b === 3
  16560. ? 'rd'
  16561. : 'th';
  16562. return number + output;
  16563. },
  16564. week: {
  16565. dow: 0, // Sunday is the first day of the week.
  16566. doy: 4, // The week that contains Jan 4th is the first week of the year.
  16567. },
  16568. });
  16569. //! moment.js locale configuration
  16570. hooks.defineLocale('en-ca', {
  16571. months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
  16572. '_'
  16573. ),
  16574. monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
  16575. weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(
  16576. '_'
  16577. ),
  16578. weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
  16579. weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
  16580. longDateFormat: {
  16581. LT: 'h:mm A',
  16582. LTS: 'h:mm:ss A',
  16583. L: 'YYYY-MM-DD',
  16584. LL: 'MMMM D, YYYY',
  16585. LLL: 'MMMM D, YYYY h:mm A',
  16586. LLLL: 'dddd, MMMM D, YYYY h:mm A',
  16587. },
  16588. calendar: {
  16589. sameDay: '[Today at] LT',
  16590. nextDay: '[Tomorrow at] LT',
  16591. nextWeek: 'dddd [at] LT',
  16592. lastDay: '[Yesterday at] LT',
  16593. lastWeek: '[Last] dddd [at] LT',
  16594. sameElse: 'L',
  16595. },
  16596. relativeTime: {
  16597. future: 'in %s',
  16598. past: '%s ago',
  16599. s: 'a few seconds',
  16600. ss: '%d seconds',
  16601. m: 'a minute',
  16602. mm: '%d minutes',
  16603. h: 'an hour',
  16604. hh: '%d hours',
  16605. d: 'a day',
  16606. dd: '%d days',
  16607. M: 'a month',
  16608. MM: '%d months',
  16609. y: 'a year',
  16610. yy: '%d years',
  16611. },
  16612. dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
  16613. ordinal: function (number) {
  16614. var b = number % 10,
  16615. output =
  16616. ~~((number % 100) / 10) === 1
  16617. ? 'th'
  16618. : b === 1
  16619. ? 'st'
  16620. : b === 2
  16621. ? 'nd'
  16622. : b === 3
  16623. ? 'rd'
  16624. : 'th';
  16625. return number + output;
  16626. },
  16627. });
  16628. //! moment.js locale configuration
  16629. hooks.defineLocale('en-gb', {
  16630. months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
  16631. '_'
  16632. ),
  16633. monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
  16634. weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(
  16635. '_'
  16636. ),
  16637. weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
  16638. weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
  16639. longDateFormat: {
  16640. LT: 'HH:mm',
  16641. LTS: 'HH:mm:ss',
  16642. L: 'DD/MM/YYYY',
  16643. LL: 'D MMMM YYYY',
  16644. LLL: 'D MMMM YYYY HH:mm',
  16645. LLLL: 'dddd, D MMMM YYYY HH:mm',
  16646. },
  16647. calendar: {
  16648. sameDay: '[Today at] LT',
  16649. nextDay: '[Tomorrow at] LT',
  16650. nextWeek: 'dddd [at] LT',
  16651. lastDay: '[Yesterday at] LT',
  16652. lastWeek: '[Last] dddd [at] LT',
  16653. sameElse: 'L',
  16654. },
  16655. relativeTime: {
  16656. future: 'in %s',
  16657. past: '%s ago',
  16658. s: 'a few seconds',
  16659. ss: '%d seconds',
  16660. m: 'a minute',
  16661. mm: '%d minutes',
  16662. h: 'an hour',
  16663. hh: '%d hours',
  16664. d: 'a day',
  16665. dd: '%d days',
  16666. M: 'a month',
  16667. MM: '%d months',
  16668. y: 'a year',
  16669. yy: '%d years',
  16670. },
  16671. dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
  16672. ordinal: function (number) {
  16673. var b = number % 10,
  16674. output =
  16675. ~~((number % 100) / 10) === 1
  16676. ? 'th'
  16677. : b === 1
  16678. ? 'st'
  16679. : b === 2
  16680. ? 'nd'
  16681. : b === 3
  16682. ? 'rd'
  16683. : 'th';
  16684. return number + output;
  16685. },
  16686. week: {
  16687. dow: 1, // Monday is the first day of the week.
  16688. doy: 4, // The week that contains Jan 4th is the first week of the year.
  16689. },
  16690. });
  16691. //! moment.js locale configuration
  16692. hooks.defineLocale('en-ie', {
  16693. months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
  16694. '_'
  16695. ),
  16696. monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
  16697. weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(
  16698. '_'
  16699. ),
  16700. weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
  16701. weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
  16702. longDateFormat: {
  16703. LT: 'HH:mm',
  16704. LTS: 'HH:mm:ss',
  16705. L: 'DD/MM/YYYY',
  16706. LL: 'D MMMM YYYY',
  16707. LLL: 'D MMMM YYYY HH:mm',
  16708. LLLL: 'dddd D MMMM YYYY HH:mm',
  16709. },
  16710. calendar: {
  16711. sameDay: '[Today at] LT',
  16712. nextDay: '[Tomorrow at] LT',
  16713. nextWeek: 'dddd [at] LT',
  16714. lastDay: '[Yesterday at] LT',
  16715. lastWeek: '[Last] dddd [at] LT',
  16716. sameElse: 'L',
  16717. },
  16718. relativeTime: {
  16719. future: 'in %s',
  16720. past: '%s ago',
  16721. s: 'a few seconds',
  16722. ss: '%d seconds',
  16723. m: 'a minute',
  16724. mm: '%d minutes',
  16725. h: 'an hour',
  16726. hh: '%d hours',
  16727. d: 'a day',
  16728. dd: '%d days',
  16729. M: 'a month',
  16730. MM: '%d months',
  16731. y: 'a year',
  16732. yy: '%d years',
  16733. },
  16734. dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
  16735. ordinal: function (number) {
  16736. var b = number % 10,
  16737. output =
  16738. ~~((number % 100) / 10) === 1
  16739. ? 'th'
  16740. : b === 1
  16741. ? 'st'
  16742. : b === 2
  16743. ? 'nd'
  16744. : b === 3
  16745. ? 'rd'
  16746. : 'th';
  16747. return number + output;
  16748. },
  16749. week: {
  16750. dow: 1, // Monday is the first day of the week.
  16751. doy: 4, // The week that contains Jan 4th is the first week of the year.
  16752. },
  16753. });
  16754. //! moment.js locale configuration
  16755. hooks.defineLocale('en-il', {
  16756. months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
  16757. '_'
  16758. ),
  16759. monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
  16760. weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(
  16761. '_'
  16762. ),
  16763. weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
  16764. weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
  16765. longDateFormat: {
  16766. LT: 'HH:mm',
  16767. LTS: 'HH:mm:ss',
  16768. L: 'DD/MM/YYYY',
  16769. LL: 'D MMMM YYYY',
  16770. LLL: 'D MMMM YYYY HH:mm',
  16771. LLLL: 'dddd, D MMMM YYYY HH:mm',
  16772. },
  16773. calendar: {
  16774. sameDay: '[Today at] LT',
  16775. nextDay: '[Tomorrow at] LT',
  16776. nextWeek: 'dddd [at] LT',
  16777. lastDay: '[Yesterday at] LT',
  16778. lastWeek: '[Last] dddd [at] LT',
  16779. sameElse: 'L',
  16780. },
  16781. relativeTime: {
  16782. future: 'in %s',
  16783. past: '%s ago',
  16784. s: 'a few seconds',
  16785. ss: '%d seconds',
  16786. m: 'a minute',
  16787. mm: '%d minutes',
  16788. h: 'an hour',
  16789. hh: '%d hours',
  16790. d: 'a day',
  16791. dd: '%d days',
  16792. M: 'a month',
  16793. MM: '%d months',
  16794. y: 'a year',
  16795. yy: '%d years',
  16796. },
  16797. dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
  16798. ordinal: function (number) {
  16799. var b = number % 10,
  16800. output =
  16801. ~~((number % 100) / 10) === 1
  16802. ? 'th'
  16803. : b === 1
  16804. ? 'st'
  16805. : b === 2
  16806. ? 'nd'
  16807. : b === 3
  16808. ? 'rd'
  16809. : 'th';
  16810. return number + output;
  16811. },
  16812. });
  16813. //! moment.js locale configuration
  16814. hooks.defineLocale('en-in', {
  16815. months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
  16816. '_'
  16817. ),
  16818. monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
  16819. weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(
  16820. '_'
  16821. ),
  16822. weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
  16823. weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
  16824. longDateFormat: {
  16825. LT: 'h:mm A',
  16826. LTS: 'h:mm:ss A',
  16827. L: 'DD/MM/YYYY',
  16828. LL: 'D MMMM YYYY',
  16829. LLL: 'D MMMM YYYY h:mm A',
  16830. LLLL: 'dddd, D MMMM YYYY h:mm A',
  16831. },
  16832. calendar: {
  16833. sameDay: '[Today at] LT',
  16834. nextDay: '[Tomorrow at] LT',
  16835. nextWeek: 'dddd [at] LT',
  16836. lastDay: '[Yesterday at] LT',
  16837. lastWeek: '[Last] dddd [at] LT',
  16838. sameElse: 'L',
  16839. },
  16840. relativeTime: {
  16841. future: 'in %s',
  16842. past: '%s ago',
  16843. s: 'a few seconds',
  16844. ss: '%d seconds',
  16845. m: 'a minute',
  16846. mm: '%d minutes',
  16847. h: 'an hour',
  16848. hh: '%d hours',
  16849. d: 'a day',
  16850. dd: '%d days',
  16851. M: 'a month',
  16852. MM: '%d months',
  16853. y: 'a year',
  16854. yy: '%d years',
  16855. },
  16856. dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
  16857. ordinal: function (number) {
  16858. var b = number % 10,
  16859. output =
  16860. ~~((number % 100) / 10) === 1
  16861. ? 'th'
  16862. : b === 1
  16863. ? 'st'
  16864. : b === 2
  16865. ? 'nd'
  16866. : b === 3
  16867. ? 'rd'
  16868. : 'th';
  16869. return number + output;
  16870. },
  16871. week: {
  16872. dow: 0, // Sunday is the first day of the week.
  16873. doy: 6, // The week that contains Jan 1st is the first week of the year.
  16874. },
  16875. });
  16876. //! moment.js locale configuration
  16877. hooks.defineLocale('en-nz', {
  16878. months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
  16879. '_'
  16880. ),
  16881. monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
  16882. weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(
  16883. '_'
  16884. ),
  16885. weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
  16886. weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
  16887. longDateFormat: {
  16888. LT: 'h:mm A',
  16889. LTS: 'h:mm:ss A',
  16890. L: 'DD/MM/YYYY',
  16891. LL: 'D MMMM YYYY',
  16892. LLL: 'D MMMM YYYY h:mm A',
  16893. LLLL: 'dddd, D MMMM YYYY h:mm A',
  16894. },
  16895. calendar: {
  16896. sameDay: '[Today at] LT',
  16897. nextDay: '[Tomorrow at] LT',
  16898. nextWeek: 'dddd [at] LT',
  16899. lastDay: '[Yesterday at] LT',
  16900. lastWeek: '[Last] dddd [at] LT',
  16901. sameElse: 'L',
  16902. },
  16903. relativeTime: {
  16904. future: 'in %s',
  16905. past: '%s ago',
  16906. s: 'a few seconds',
  16907. ss: '%d seconds',
  16908. m: 'a minute',
  16909. mm: '%d minutes',
  16910. h: 'an hour',
  16911. hh: '%d hours',
  16912. d: 'a day',
  16913. dd: '%d days',
  16914. M: 'a month',
  16915. MM: '%d months',
  16916. y: 'a year',
  16917. yy: '%d years',
  16918. },
  16919. dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
  16920. ordinal: function (number) {
  16921. var b = number % 10,
  16922. output =
  16923. ~~((number % 100) / 10) === 1
  16924. ? 'th'
  16925. : b === 1
  16926. ? 'st'
  16927. : b === 2
  16928. ? 'nd'
  16929. : b === 3
  16930. ? 'rd'
  16931. : 'th';
  16932. return number + output;
  16933. },
  16934. week: {
  16935. dow: 1, // Monday is the first day of the week.
  16936. doy: 4, // The week that contains Jan 4th is the first week of the year.
  16937. },
  16938. });
  16939. //! moment.js locale configuration
  16940. hooks.defineLocale('en-sg', {
  16941. months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
  16942. '_'
  16943. ),
  16944. monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
  16945. weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(
  16946. '_'
  16947. ),
  16948. weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
  16949. weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
  16950. longDateFormat: {
  16951. LT: 'HH:mm',
  16952. LTS: 'HH:mm:ss',
  16953. L: 'DD/MM/YYYY',
  16954. LL: 'D MMMM YYYY',
  16955. LLL: 'D MMMM YYYY HH:mm',
  16956. LLLL: 'dddd, D MMMM YYYY HH:mm',
  16957. },
  16958. calendar: {
  16959. sameDay: '[Today at] LT',
  16960. nextDay: '[Tomorrow at] LT',
  16961. nextWeek: 'dddd [at] LT',
  16962. lastDay: '[Yesterday at] LT',
  16963. lastWeek: '[Last] dddd [at] LT',
  16964. sameElse: 'L',
  16965. },
  16966. relativeTime: {
  16967. future: 'in %s',
  16968. past: '%s ago',
  16969. s: 'a few seconds',
  16970. ss: '%d seconds',
  16971. m: 'a minute',
  16972. mm: '%d minutes',
  16973. h: 'an hour',
  16974. hh: '%d hours',
  16975. d: 'a day',
  16976. dd: '%d days',
  16977. M: 'a month',
  16978. MM: '%d months',
  16979. y: 'a year',
  16980. yy: '%d years',
  16981. },
  16982. dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
  16983. ordinal: function (number) {
  16984. var b = number % 10,
  16985. output =
  16986. ~~((number % 100) / 10) === 1
  16987. ? 'th'
  16988. : b === 1
  16989. ? 'st'
  16990. : b === 2
  16991. ? 'nd'
  16992. : b === 3
  16993. ? 'rd'
  16994. : 'th';
  16995. return number + output;
  16996. },
  16997. week: {
  16998. dow: 1, // Monday is the first day of the week.
  16999. doy: 4, // The week that contains Jan 4th is the first week of the year.
  17000. },
  17001. });
  17002. //! moment.js locale configuration
  17003. hooks.defineLocale('eo', {
  17004. months: 'januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro'.split(
  17005. '_'
  17006. ),
  17007. monthsShort: 'jan_feb_mart_apr_maj_jun_jul_aŭg_sept_okt_nov_dec'.split('_'),
  17008. weekdays: 'dimanĉo_lundo_mardo_merkredo_ĵaŭdo_vendredo_sabato'.split('_'),
  17009. weekdaysShort: 'dim_lun_mard_merk_ĵaŭ_ven_sab'.split('_'),
  17010. weekdaysMin: 'di_lu_ma_me_ĵa_ve_sa'.split('_'),
  17011. longDateFormat: {
  17012. LT: 'HH:mm',
  17013. LTS: 'HH:mm:ss',
  17014. L: 'YYYY-MM-DD',
  17015. LL: '[la] D[-an de] MMMM, YYYY',
  17016. LLL: '[la] D[-an de] MMMM, YYYY HH:mm',
  17017. LLLL: 'dddd[n], [la] D[-an de] MMMM, YYYY HH:mm',
  17018. llll: 'ddd, [la] D[-an de] MMM, YYYY HH:mm',
  17019. },
  17020. meridiemParse: /[ap]\.t\.m/i,
  17021. isPM: function (input) {
  17022. return input.charAt(0).toLowerCase() === 'p';
  17023. },
  17024. meridiem: function (hours, minutes, isLower) {
  17025. if (hours > 11) {
  17026. return isLower ? 'p.t.m.' : 'P.T.M.';
  17027. } else {
  17028. return isLower ? 'a.t.m.' : 'A.T.M.';
  17029. }
  17030. },
  17031. calendar: {
  17032. sameDay: '[Hodiaŭ je] LT',
  17033. nextDay: '[Morgaŭ je] LT',
  17034. nextWeek: 'dddd[n je] LT',
  17035. lastDay: '[Hieraŭ je] LT',
  17036. lastWeek: '[pasintan] dddd[n je] LT',
  17037. sameElse: 'L',
  17038. },
  17039. relativeTime: {
  17040. future: 'post %s',
  17041. past: 'antaŭ %s',
  17042. s: 'kelkaj sekundoj',
  17043. ss: '%d sekundoj',
  17044. m: 'unu minuto',
  17045. mm: '%d minutoj',
  17046. h: 'unu horo',
  17047. hh: '%d horoj',
  17048. d: 'unu tago', //ne 'diurno', ĉar estas uzita por proksimumo
  17049. dd: '%d tagoj',
  17050. M: 'unu monato',
  17051. MM: '%d monatoj',
  17052. y: 'unu jaro',
  17053. yy: '%d jaroj',
  17054. },
  17055. dayOfMonthOrdinalParse: /\d{1,2}a/,
  17056. ordinal: '%da',
  17057. week: {
  17058. dow: 1, // Monday is the first day of the week.
  17059. doy: 7, // The week that contains Jan 7th is the first week of the year.
  17060. },
  17061. });
  17062. //! moment.js locale configuration
  17063. var monthsShortDot =
  17064. 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split(
  17065. '_'
  17066. ),
  17067. monthsShort$1 = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'),
  17068. monthsParse$2 = [
  17069. /^ene/i,
  17070. /^feb/i,
  17071. /^mar/i,
  17072. /^abr/i,
  17073. /^may/i,
  17074. /^jun/i,
  17075. /^jul/i,
  17076. /^ago/i,
  17077. /^sep/i,
  17078. /^oct/i,
  17079. /^nov/i,
  17080. /^dic/i,
  17081. ],
  17082. monthsRegex$3 =
  17083. /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;
  17084. hooks.defineLocale('es-do', {
  17085. months: 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split(
  17086. '_'
  17087. ),
  17088. monthsShort: function (m, format) {
  17089. if (!m) {
  17090. return monthsShortDot;
  17091. } else if (/-MMM-/.test(format)) {
  17092. return monthsShort$1[m.month()];
  17093. } else {
  17094. return monthsShortDot[m.month()];
  17095. }
  17096. },
  17097. monthsRegex: monthsRegex$3,
  17098. monthsShortRegex: monthsRegex$3,
  17099. monthsStrictRegex:
  17100. /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,
  17101. monthsShortStrictRegex:
  17102. /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,
  17103. monthsParse: monthsParse$2,
  17104. longMonthsParse: monthsParse$2,
  17105. shortMonthsParse: monthsParse$2,
  17106. weekdays: 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'),
  17107. weekdaysShort: 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'),
  17108. weekdaysMin: 'do_lu_ma_mi_ju_vi_sá'.split('_'),
  17109. weekdaysParseExact: true,
  17110. longDateFormat: {
  17111. LT: 'h:mm A',
  17112. LTS: 'h:mm:ss A',
  17113. L: 'DD/MM/YYYY',
  17114. LL: 'D [de] MMMM [de] YYYY',
  17115. LLL: 'D [de] MMMM [de] YYYY h:mm A',
  17116. LLLL: 'dddd, D [de] MMMM [de] YYYY h:mm A',
  17117. },
  17118. calendar: {
  17119. sameDay: function () {
  17120. return '[hoy a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
  17121. },
  17122. nextDay: function () {
  17123. return '[mañana a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
  17124. },
  17125. nextWeek: function () {
  17126. return 'dddd [a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
  17127. },
  17128. lastDay: function () {
  17129. return '[ayer a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
  17130. },
  17131. lastWeek: function () {
  17132. return (
  17133. '[el] dddd [pasado a la' +
  17134. (this.hours() !== 1 ? 's' : '') +
  17135. '] LT'
  17136. );
  17137. },
  17138. sameElse: 'L',
  17139. },
  17140. relativeTime: {
  17141. future: 'en %s',
  17142. past: 'hace %s',
  17143. s: 'unos segundos',
  17144. ss: '%d segundos',
  17145. m: 'un minuto',
  17146. mm: '%d minutos',
  17147. h: 'una hora',
  17148. hh: '%d horas',
  17149. d: 'un día',
  17150. dd: '%d días',
  17151. w: 'una semana',
  17152. ww: '%d semanas',
  17153. M: 'un mes',
  17154. MM: '%d meses',
  17155. y: 'un año',
  17156. yy: '%d años',
  17157. },
  17158. dayOfMonthOrdinalParse: /\d{1,2}º/,
  17159. ordinal: '%dº',
  17160. week: {
  17161. dow: 1, // Monday is the first day of the week.
  17162. doy: 4, // The week that contains Jan 4th is the first week of the year.
  17163. },
  17164. });
  17165. //! moment.js locale configuration
  17166. var monthsShortDot$1 =
  17167. 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split(
  17168. '_'
  17169. ),
  17170. monthsShort$2 = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'),
  17171. monthsParse$3 = [
  17172. /^ene/i,
  17173. /^feb/i,
  17174. /^mar/i,
  17175. /^abr/i,
  17176. /^may/i,
  17177. /^jun/i,
  17178. /^jul/i,
  17179. /^ago/i,
  17180. /^sep/i,
  17181. /^oct/i,
  17182. /^nov/i,
  17183. /^dic/i,
  17184. ],
  17185. monthsRegex$4 =
  17186. /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;
  17187. hooks.defineLocale('es-mx', {
  17188. months: 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split(
  17189. '_'
  17190. ),
  17191. monthsShort: function (m, format) {
  17192. if (!m) {
  17193. return monthsShortDot$1;
  17194. } else if (/-MMM-/.test(format)) {
  17195. return monthsShort$2[m.month()];
  17196. } else {
  17197. return monthsShortDot$1[m.month()];
  17198. }
  17199. },
  17200. monthsRegex: monthsRegex$4,
  17201. monthsShortRegex: monthsRegex$4,
  17202. monthsStrictRegex:
  17203. /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,
  17204. monthsShortStrictRegex:
  17205. /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,
  17206. monthsParse: monthsParse$3,
  17207. longMonthsParse: monthsParse$3,
  17208. shortMonthsParse: monthsParse$3,
  17209. weekdays: 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'),
  17210. weekdaysShort: 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'),
  17211. weekdaysMin: 'do_lu_ma_mi_ju_vi_sá'.split('_'),
  17212. weekdaysParseExact: true,
  17213. longDateFormat: {
  17214. LT: 'H:mm',
  17215. LTS: 'H:mm:ss',
  17216. L: 'DD/MM/YYYY',
  17217. LL: 'D [de] MMMM [de] YYYY',
  17218. LLL: 'D [de] MMMM [de] YYYY H:mm',
  17219. LLLL: 'dddd, D [de] MMMM [de] YYYY H:mm',
  17220. },
  17221. calendar: {
  17222. sameDay: function () {
  17223. return '[hoy a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
  17224. },
  17225. nextDay: function () {
  17226. return '[mañana a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
  17227. },
  17228. nextWeek: function () {
  17229. return 'dddd [a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
  17230. },
  17231. lastDay: function () {
  17232. return '[ayer a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
  17233. },
  17234. lastWeek: function () {
  17235. return (
  17236. '[el] dddd [pasado a la' +
  17237. (this.hours() !== 1 ? 's' : '') +
  17238. '] LT'
  17239. );
  17240. },
  17241. sameElse: 'L',
  17242. },
  17243. relativeTime: {
  17244. future: 'en %s',
  17245. past: 'hace %s',
  17246. s: 'unos segundos',
  17247. ss: '%d segundos',
  17248. m: 'un minuto',
  17249. mm: '%d minutos',
  17250. h: 'una hora',
  17251. hh: '%d horas',
  17252. d: 'un día',
  17253. dd: '%d días',
  17254. w: 'una semana',
  17255. ww: '%d semanas',
  17256. M: 'un mes',
  17257. MM: '%d meses',
  17258. y: 'un año',
  17259. yy: '%d años',
  17260. },
  17261. dayOfMonthOrdinalParse: /\d{1,2}º/,
  17262. ordinal: '%dº',
  17263. week: {
  17264. dow: 0, // Sunday is the first day of the week.
  17265. doy: 4, // The week that contains Jan 4th is the first week of the year.
  17266. },
  17267. invalidDate: 'Fecha inválida',
  17268. });
  17269. //! moment.js locale configuration
  17270. var monthsShortDot$2 =
  17271. 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split(
  17272. '_'
  17273. ),
  17274. monthsShort$3 = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'),
  17275. monthsParse$4 = [
  17276. /^ene/i,
  17277. /^feb/i,
  17278. /^mar/i,
  17279. /^abr/i,
  17280. /^may/i,
  17281. /^jun/i,
  17282. /^jul/i,
  17283. /^ago/i,
  17284. /^sep/i,
  17285. /^oct/i,
  17286. /^nov/i,
  17287. /^dic/i,
  17288. ],
  17289. monthsRegex$5 =
  17290. /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;
  17291. hooks.defineLocale('es-us', {
  17292. months: 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split(
  17293. '_'
  17294. ),
  17295. monthsShort: function (m, format) {
  17296. if (!m) {
  17297. return monthsShortDot$2;
  17298. } else if (/-MMM-/.test(format)) {
  17299. return monthsShort$3[m.month()];
  17300. } else {
  17301. return monthsShortDot$2[m.month()];
  17302. }
  17303. },
  17304. monthsRegex: monthsRegex$5,
  17305. monthsShortRegex: monthsRegex$5,
  17306. monthsStrictRegex:
  17307. /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,
  17308. monthsShortStrictRegex:
  17309. /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,
  17310. monthsParse: monthsParse$4,
  17311. longMonthsParse: monthsParse$4,
  17312. shortMonthsParse: monthsParse$4,
  17313. weekdays: 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'),
  17314. weekdaysShort: 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'),
  17315. weekdaysMin: 'do_lu_ma_mi_ju_vi_sá'.split('_'),
  17316. weekdaysParseExact: true,
  17317. longDateFormat: {
  17318. LT: 'h:mm A',
  17319. LTS: 'h:mm:ss A',
  17320. L: 'MM/DD/YYYY',
  17321. LL: 'D [de] MMMM [de] YYYY',
  17322. LLL: 'D [de] MMMM [de] YYYY h:mm A',
  17323. LLLL: 'dddd, D [de] MMMM [de] YYYY h:mm A',
  17324. },
  17325. calendar: {
  17326. sameDay: function () {
  17327. return '[hoy a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
  17328. },
  17329. nextDay: function () {
  17330. return '[mañana a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
  17331. },
  17332. nextWeek: function () {
  17333. return 'dddd [a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
  17334. },
  17335. lastDay: function () {
  17336. return '[ayer a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
  17337. },
  17338. lastWeek: function () {
  17339. return (
  17340. '[el] dddd [pasado a la' +
  17341. (this.hours() !== 1 ? 's' : '') +
  17342. '] LT'
  17343. );
  17344. },
  17345. sameElse: 'L',
  17346. },
  17347. relativeTime: {
  17348. future: 'en %s',
  17349. past: 'hace %s',
  17350. s: 'unos segundos',
  17351. ss: '%d segundos',
  17352. m: 'un minuto',
  17353. mm: '%d minutos',
  17354. h: 'una hora',
  17355. hh: '%d horas',
  17356. d: 'un día',
  17357. dd: '%d días',
  17358. w: 'una semana',
  17359. ww: '%d semanas',
  17360. M: 'un mes',
  17361. MM: '%d meses',
  17362. y: 'un año',
  17363. yy: '%d años',
  17364. },
  17365. dayOfMonthOrdinalParse: /\d{1,2}º/,
  17366. ordinal: '%dº',
  17367. week: {
  17368. dow: 0, // Sunday is the first day of the week.
  17369. doy: 6, // The week that contains Jan 6th is the first week of the year.
  17370. },
  17371. });
  17372. //! moment.js locale configuration
  17373. var monthsShortDot$3 =
  17374. 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split(
  17375. '_'
  17376. ),
  17377. monthsShort$4 = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'),
  17378. monthsParse$5 = [
  17379. /^ene/i,
  17380. /^feb/i,
  17381. /^mar/i,
  17382. /^abr/i,
  17383. /^may/i,
  17384. /^jun/i,
  17385. /^jul/i,
  17386. /^ago/i,
  17387. /^sep/i,
  17388. /^oct/i,
  17389. /^nov/i,
  17390. /^dic/i,
  17391. ],
  17392. monthsRegex$6 =
  17393. /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;
  17394. hooks.defineLocale('es', {
  17395. months: 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split(
  17396. '_'
  17397. ),
  17398. monthsShort: function (m, format) {
  17399. if (!m) {
  17400. return monthsShortDot$3;
  17401. } else if (/-MMM-/.test(format)) {
  17402. return monthsShort$4[m.month()];
  17403. } else {
  17404. return monthsShortDot$3[m.month()];
  17405. }
  17406. },
  17407. monthsRegex: monthsRegex$6,
  17408. monthsShortRegex: monthsRegex$6,
  17409. monthsStrictRegex:
  17410. /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,
  17411. monthsShortStrictRegex:
  17412. /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,
  17413. monthsParse: monthsParse$5,
  17414. longMonthsParse: monthsParse$5,
  17415. shortMonthsParse: monthsParse$5,
  17416. weekdays: 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'),
  17417. weekdaysShort: 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'),
  17418. weekdaysMin: 'do_lu_ma_mi_ju_vi_sá'.split('_'),
  17419. weekdaysParseExact: true,
  17420. longDateFormat: {
  17421. LT: 'H:mm',
  17422. LTS: 'H:mm:ss',
  17423. L: 'DD/MM/YYYY',
  17424. LL: 'D [de] MMMM [de] YYYY',
  17425. LLL: 'D [de] MMMM [de] YYYY H:mm',
  17426. LLLL: 'dddd, D [de] MMMM [de] YYYY H:mm',
  17427. },
  17428. calendar: {
  17429. sameDay: function () {
  17430. return '[hoy a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
  17431. },
  17432. nextDay: function () {
  17433. return '[mañana a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
  17434. },
  17435. nextWeek: function () {
  17436. return 'dddd [a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
  17437. },
  17438. lastDay: function () {
  17439. return '[ayer a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
  17440. },
  17441. lastWeek: function () {
  17442. return (
  17443. '[el] dddd [pasado a la' +
  17444. (this.hours() !== 1 ? 's' : '') +
  17445. '] LT'
  17446. );
  17447. },
  17448. sameElse: 'L',
  17449. },
  17450. relativeTime: {
  17451. future: 'en %s',
  17452. past: 'hace %s',
  17453. s: 'unos segundos',
  17454. ss: '%d segundos',
  17455. m: 'un minuto',
  17456. mm: '%d minutos',
  17457. h: 'una hora',
  17458. hh: '%d horas',
  17459. d: 'un día',
  17460. dd: '%d días',
  17461. w: 'una semana',
  17462. ww: '%d semanas',
  17463. M: 'un mes',
  17464. MM: '%d meses',
  17465. y: 'un año',
  17466. yy: '%d años',
  17467. },
  17468. dayOfMonthOrdinalParse: /\d{1,2}º/,
  17469. ordinal: '%dº',
  17470. week: {
  17471. dow: 1, // Monday is the first day of the week.
  17472. doy: 4, // The week that contains Jan 4th is the first week of the year.
  17473. },
  17474. invalidDate: 'Fecha inválida',
  17475. });
  17476. //! moment.js locale configuration
  17477. function processRelativeTime$3(number, withoutSuffix, key, isFuture) {
  17478. var format = {
  17479. s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],
  17480. ss: [number + 'sekundi', number + 'sekundit'],
  17481. m: ['ühe minuti', 'üks minut'],
  17482. mm: [number + ' minuti', number + ' minutit'],
  17483. h: ['ühe tunni', 'tund aega', 'üks tund'],
  17484. hh: [number + ' tunni', number + ' tundi'],
  17485. d: ['ühe päeva', 'üks päev'],
  17486. M: ['kuu aja', 'kuu aega', 'üks kuu'],
  17487. MM: [number + ' kuu', number + ' kuud'],
  17488. y: ['ühe aasta', 'aasta', 'üks aasta'],
  17489. yy: [number + ' aasta', number + ' aastat'],
  17490. };
  17491. if (withoutSuffix) {
  17492. return format[key][2] ? format[key][2] : format[key][1];
  17493. }
  17494. return isFuture ? format[key][0] : format[key][1];
  17495. }
  17496. hooks.defineLocale('et', {
  17497. months: 'jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember'.split(
  17498. '_'
  17499. ),
  17500. monthsShort:
  17501. 'jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets'.split('_'),
  17502. weekdays:
  17503. 'pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev'.split(
  17504. '_'
  17505. ),
  17506. weekdaysShort: 'P_E_T_K_N_R_L'.split('_'),
  17507. weekdaysMin: 'P_E_T_K_N_R_L'.split('_'),
  17508. longDateFormat: {
  17509. LT: 'H:mm',
  17510. LTS: 'H:mm:ss',
  17511. L: 'DD.MM.YYYY',
  17512. LL: 'D. MMMM YYYY',
  17513. LLL: 'D. MMMM YYYY H:mm',
  17514. LLLL: 'dddd, D. MMMM YYYY H:mm',
  17515. },
  17516. calendar: {
  17517. sameDay: '[Täna,] LT',
  17518. nextDay: '[Homme,] LT',
  17519. nextWeek: '[Järgmine] dddd LT',
  17520. lastDay: '[Eile,] LT',
  17521. lastWeek: '[Eelmine] dddd LT',
  17522. sameElse: 'L',
  17523. },
  17524. relativeTime: {
  17525. future: '%s pärast',
  17526. past: '%s tagasi',
  17527. s: processRelativeTime$3,
  17528. ss: processRelativeTime$3,
  17529. m: processRelativeTime$3,
  17530. mm: processRelativeTime$3,
  17531. h: processRelativeTime$3,
  17532. hh: processRelativeTime$3,
  17533. d: processRelativeTime$3,
  17534. dd: '%d päeva',
  17535. M: processRelativeTime$3,
  17536. MM: processRelativeTime$3,
  17537. y: processRelativeTime$3,
  17538. yy: processRelativeTime$3,
  17539. },
  17540. dayOfMonthOrdinalParse: /\d{1,2}\./,
  17541. ordinal: '%d.',
  17542. week: {
  17543. dow: 1, // Monday is the first day of the week.
  17544. doy: 4, // The week that contains Jan 4th is the first week of the year.
  17545. },
  17546. });
  17547. //! moment.js locale configuration
  17548. hooks.defineLocale('eu', {
  17549. months: 'urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua'.split(
  17550. '_'
  17551. ),
  17552. monthsShort:
  17553. 'urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.'.split(
  17554. '_'
  17555. ),
  17556. monthsParseExact: true,
  17557. weekdays:
  17558. 'igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata'.split(
  17559. '_'
  17560. ),
  17561. weekdaysShort: 'ig._al._ar._az._og._ol._lr.'.split('_'),
  17562. weekdaysMin: 'ig_al_ar_az_og_ol_lr'.split('_'),
  17563. weekdaysParseExact: true,
  17564. longDateFormat: {
  17565. LT: 'HH:mm',
  17566. LTS: 'HH:mm:ss',
  17567. L: 'YYYY-MM-DD',
  17568. LL: 'YYYY[ko] MMMM[ren] D[a]',
  17569. LLL: 'YYYY[ko] MMMM[ren] D[a] HH:mm',
  17570. LLLL: 'dddd, YYYY[ko] MMMM[ren] D[a] HH:mm',
  17571. l: 'YYYY-M-D',
  17572. ll: 'YYYY[ko] MMM D[a]',
  17573. lll: 'YYYY[ko] MMM D[a] HH:mm',
  17574. llll: 'ddd, YYYY[ko] MMM D[a] HH:mm',
  17575. },
  17576. calendar: {
  17577. sameDay: '[gaur] LT[etan]',
  17578. nextDay: '[bihar] LT[etan]',
  17579. nextWeek: 'dddd LT[etan]',
  17580. lastDay: '[atzo] LT[etan]',
  17581. lastWeek: '[aurreko] dddd LT[etan]',
  17582. sameElse: 'L',
  17583. },
  17584. relativeTime: {
  17585. future: '%s barru',
  17586. past: 'duela %s',
  17587. s: 'segundo batzuk',
  17588. ss: '%d segundo',
  17589. m: 'minutu bat',
  17590. mm: '%d minutu',
  17591. h: 'ordu bat',
  17592. hh: '%d ordu',
  17593. d: 'egun bat',
  17594. dd: '%d egun',
  17595. M: 'hilabete bat',
  17596. MM: '%d hilabete',
  17597. y: 'urte bat',
  17598. yy: '%d urte',
  17599. },
  17600. dayOfMonthOrdinalParse: /\d{1,2}\./,
  17601. ordinal: '%d.',
  17602. week: {
  17603. dow: 1, // Monday is the first day of the week.
  17604. doy: 7, // The week that contains Jan 7th is the first week of the year.
  17605. },
  17606. });
  17607. //! moment.js locale configuration
  17608. var symbolMap$6 = {
  17609. 1: '۱',
  17610. 2: '۲',
  17611. 3: '۳',
  17612. 4: '۴',
  17613. 5: '۵',
  17614. 6: '۶',
  17615. 7: '۷',
  17616. 8: '۸',
  17617. 9: '۹',
  17618. 0: '۰',
  17619. },
  17620. numberMap$5 = {
  17621. '۱': '1',
  17622. '۲': '2',
  17623. '۳': '3',
  17624. '۴': '4',
  17625. '۵': '5',
  17626. '۶': '6',
  17627. '۷': '7',
  17628. '۸': '8',
  17629. '۹': '9',
  17630. '۰': '0',
  17631. };
  17632. hooks.defineLocale('fa', {
  17633. months: 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split(
  17634. '_'
  17635. ),
  17636. monthsShort:
  17637. 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split(
  17638. '_'
  17639. ),
  17640. weekdays:
  17641. 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split(
  17642. '_'
  17643. ),
  17644. weekdaysShort:
  17645. 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split(
  17646. '_'
  17647. ),
  17648. weekdaysMin: 'ی_د_س_چ_پ_ج_ش'.split('_'),
  17649. weekdaysParseExact: true,
  17650. longDateFormat: {
  17651. LT: 'HH:mm',
  17652. LTS: 'HH:mm:ss',
  17653. L: 'DD/MM/YYYY',
  17654. LL: 'D MMMM YYYY',
  17655. LLL: 'D MMMM YYYY HH:mm',
  17656. LLLL: 'dddd, D MMMM YYYY HH:mm',
  17657. },
  17658. meridiemParse: /قبل از ظهر|بعد از ظهر/,
  17659. isPM: function (input) {
  17660. return /بعد از ظهر/.test(input);
  17661. },
  17662. meridiem: function (hour, minute, isLower) {
  17663. if (hour < 12) {
  17664. return 'قبل از ظهر';
  17665. } else {
  17666. return 'بعد از ظهر';
  17667. }
  17668. },
  17669. calendar: {
  17670. sameDay: '[امروز ساعت] LT',
  17671. nextDay: '[فردا ساعت] LT',
  17672. nextWeek: 'dddd [ساعت] LT',
  17673. lastDay: '[دیروز ساعت] LT',
  17674. lastWeek: 'dddd [پیش] [ساعت] LT',
  17675. sameElse: 'L',
  17676. },
  17677. relativeTime: {
  17678. future: 'در %s',
  17679. past: '%s پیش',
  17680. s: 'چند ثانیه',
  17681. ss: '%d ثانیه',
  17682. m: 'یک دقیقه',
  17683. mm: '%d دقیقه',
  17684. h: 'یک ساعت',
  17685. hh: '%d ساعت',
  17686. d: 'یک روز',
  17687. dd: '%d روز',
  17688. M: 'یک ماه',
  17689. MM: '%d ماه',
  17690. y: 'یک سال',
  17691. yy: '%d سال',
  17692. },
  17693. preparse: function (string) {
  17694. return string
  17695. .replace(/[۰-۹]/g, function (match) {
  17696. return numberMap$5[match];
  17697. })
  17698. .replace(/،/g, ',');
  17699. },
  17700. postformat: function (string) {
  17701. return string
  17702. .replace(/\d/g, function (match) {
  17703. return symbolMap$6[match];
  17704. })
  17705. .replace(/,/g, '،');
  17706. },
  17707. dayOfMonthOrdinalParse: /\d{1,2}م/,
  17708. ordinal: '%dم',
  17709. week: {
  17710. dow: 6, // Saturday is the first day of the week.
  17711. doy: 12, // The week that contains Jan 12th is the first week of the year.
  17712. },
  17713. });
  17714. //! moment.js locale configuration
  17715. var numbersPast =
  17716. 'nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän'.split(
  17717. ' '
  17718. ),
  17719. numbersFuture = [
  17720. 'nolla',
  17721. 'yhden',
  17722. 'kahden',
  17723. 'kolmen',
  17724. 'neljän',
  17725. 'viiden',
  17726. 'kuuden',
  17727. numbersPast[7],
  17728. numbersPast[8],
  17729. numbersPast[9],
  17730. ];
  17731. function translate$2(number, withoutSuffix, key, isFuture) {
  17732. var result = '';
  17733. switch (key) {
  17734. case 's':
  17735. return isFuture ? 'muutaman sekunnin' : 'muutama sekunti';
  17736. case 'ss':
  17737. result = isFuture ? 'sekunnin' : 'sekuntia';
  17738. break;
  17739. case 'm':
  17740. return isFuture ? 'minuutin' : 'minuutti';
  17741. case 'mm':
  17742. result = isFuture ? 'minuutin' : 'minuuttia';
  17743. break;
  17744. case 'h':
  17745. return isFuture ? 'tunnin' : 'tunti';
  17746. case 'hh':
  17747. result = isFuture ? 'tunnin' : 'tuntia';
  17748. break;
  17749. case 'd':
  17750. return isFuture ? 'päivän' : 'päivä';
  17751. case 'dd':
  17752. result = isFuture ? 'päivän' : 'päivää';
  17753. break;
  17754. case 'M':
  17755. return isFuture ? 'kuukauden' : 'kuukausi';
  17756. case 'MM':
  17757. result = isFuture ? 'kuukauden' : 'kuukautta';
  17758. break;
  17759. case 'y':
  17760. return isFuture ? 'vuoden' : 'vuosi';
  17761. case 'yy':
  17762. result = isFuture ? 'vuoden' : 'vuotta';
  17763. break;
  17764. }
  17765. result = verbalNumber(number, isFuture) + ' ' + result;
  17766. return result;
  17767. }
  17768. function verbalNumber(number, isFuture) {
  17769. return number < 10
  17770. ? isFuture
  17771. ? numbersFuture[number]
  17772. : numbersPast[number]
  17773. : number;
  17774. }
  17775. hooks.defineLocale('fi', {
  17776. months: 'tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu'.split(
  17777. '_'
  17778. ),
  17779. monthsShort:
  17780. 'tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu'.split(
  17781. '_'
  17782. ),
  17783. weekdays:
  17784. 'sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai'.split(
  17785. '_'
  17786. ),
  17787. weekdaysShort: 'su_ma_ti_ke_to_pe_la'.split('_'),
  17788. weekdaysMin: 'su_ma_ti_ke_to_pe_la'.split('_'),
  17789. longDateFormat: {
  17790. LT: 'HH.mm',
  17791. LTS: 'HH.mm.ss',
  17792. L: 'DD.MM.YYYY',
  17793. LL: 'Do MMMM[ta] YYYY',
  17794. LLL: 'Do MMMM[ta] YYYY, [klo] HH.mm',
  17795. LLLL: 'dddd, Do MMMM[ta] YYYY, [klo] HH.mm',
  17796. l: 'D.M.YYYY',
  17797. ll: 'Do MMM YYYY',
  17798. lll: 'Do MMM YYYY, [klo] HH.mm',
  17799. llll: 'ddd, Do MMM YYYY, [klo] HH.mm',
  17800. },
  17801. calendar: {
  17802. sameDay: '[tänään] [klo] LT',
  17803. nextDay: '[huomenna] [klo] LT',
  17804. nextWeek: 'dddd [klo] LT',
  17805. lastDay: '[eilen] [klo] LT',
  17806. lastWeek: '[viime] dddd[na] [klo] LT',
  17807. sameElse: 'L',
  17808. },
  17809. relativeTime: {
  17810. future: '%s päästä',
  17811. past: '%s sitten',
  17812. s: translate$2,
  17813. ss: translate$2,
  17814. m: translate$2,
  17815. mm: translate$2,
  17816. h: translate$2,
  17817. hh: translate$2,
  17818. d: translate$2,
  17819. dd: translate$2,
  17820. M: translate$2,
  17821. MM: translate$2,
  17822. y: translate$2,
  17823. yy: translate$2,
  17824. },
  17825. dayOfMonthOrdinalParse: /\d{1,2}\./,
  17826. ordinal: '%d.',
  17827. week: {
  17828. dow: 1, // Monday is the first day of the week.
  17829. doy: 4, // The week that contains Jan 4th is the first week of the year.
  17830. },
  17831. });
  17832. //! moment.js locale configuration
  17833. hooks.defineLocale('fil', {
  17834. months: 'Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre'.split(
  17835. '_'
  17836. ),
  17837. monthsShort: 'Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis'.split('_'),
  17838. weekdays: 'Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado'.split(
  17839. '_'
  17840. ),
  17841. weekdaysShort: 'Lin_Lun_Mar_Miy_Huw_Biy_Sab'.split('_'),
  17842. weekdaysMin: 'Li_Lu_Ma_Mi_Hu_Bi_Sab'.split('_'),
  17843. longDateFormat: {
  17844. LT: 'HH:mm',
  17845. LTS: 'HH:mm:ss',
  17846. L: 'MM/D/YYYY',
  17847. LL: 'MMMM D, YYYY',
  17848. LLL: 'MMMM D, YYYY HH:mm',
  17849. LLLL: 'dddd, MMMM DD, YYYY HH:mm',
  17850. },
  17851. calendar: {
  17852. sameDay: 'LT [ngayong araw]',
  17853. nextDay: '[Bukas ng] LT',
  17854. nextWeek: 'LT [sa susunod na] dddd',
  17855. lastDay: 'LT [kahapon]',
  17856. lastWeek: 'LT [noong nakaraang] dddd',
  17857. sameElse: 'L',
  17858. },
  17859. relativeTime: {
  17860. future: 'sa loob ng %s',
  17861. past: '%s ang nakalipas',
  17862. s: 'ilang segundo',
  17863. ss: '%d segundo',
  17864. m: 'isang minuto',
  17865. mm: '%d minuto',
  17866. h: 'isang oras',
  17867. hh: '%d oras',
  17868. d: 'isang araw',
  17869. dd: '%d araw',
  17870. M: 'isang buwan',
  17871. MM: '%d buwan',
  17872. y: 'isang taon',
  17873. yy: '%d taon',
  17874. },
  17875. dayOfMonthOrdinalParse: /\d{1,2}/,
  17876. ordinal: function (number) {
  17877. return number;
  17878. },
  17879. week: {
  17880. dow: 1, // Monday is the first day of the week.
  17881. doy: 4, // The week that contains Jan 4th is the first week of the year.
  17882. },
  17883. });
  17884. //! moment.js locale configuration
  17885. hooks.defineLocale('fo', {
  17886. months: 'januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember'.split(
  17887. '_'
  17888. ),
  17889. monthsShort: 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'),
  17890. weekdays:
  17891. 'sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur'.split(
  17892. '_'
  17893. ),
  17894. weekdaysShort: 'sun_mán_týs_mik_hós_frí_ley'.split('_'),
  17895. weekdaysMin: 'su_má_tý_mi_hó_fr_le'.split('_'),
  17896. longDateFormat: {
  17897. LT: 'HH:mm',
  17898. LTS: 'HH:mm:ss',
  17899. L: 'DD/MM/YYYY',
  17900. LL: 'D MMMM YYYY',
  17901. LLL: 'D MMMM YYYY HH:mm',
  17902. LLLL: 'dddd D. MMMM, YYYY HH:mm',
  17903. },
  17904. calendar: {
  17905. sameDay: '[Í dag kl.] LT',
  17906. nextDay: '[Í morgin kl.] LT',
  17907. nextWeek: 'dddd [kl.] LT',
  17908. lastDay: '[Í gjár kl.] LT',
  17909. lastWeek: '[síðstu] dddd [kl] LT',
  17910. sameElse: 'L',
  17911. },
  17912. relativeTime: {
  17913. future: 'um %s',
  17914. past: '%s síðani',
  17915. s: 'fá sekund',
  17916. ss: '%d sekundir',
  17917. m: 'ein minuttur',
  17918. mm: '%d minuttir',
  17919. h: 'ein tími',
  17920. hh: '%d tímar',
  17921. d: 'ein dagur',
  17922. dd: '%d dagar',
  17923. M: 'ein mánaður',
  17924. MM: '%d mánaðir',
  17925. y: 'eitt ár',
  17926. yy: '%d ár',
  17927. },
  17928. dayOfMonthOrdinalParse: /\d{1,2}\./,
  17929. ordinal: '%d.',
  17930. week: {
  17931. dow: 1, // Monday is the first day of the week.
  17932. doy: 4, // The week that contains Jan 4th is the first week of the year.
  17933. },
  17934. });
  17935. //! moment.js locale configuration
  17936. hooks.defineLocale('fr-ca', {
  17937. months: 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split(
  17938. '_'
  17939. ),
  17940. monthsShort:
  17941. 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split(
  17942. '_'
  17943. ),
  17944. monthsParseExact: true,
  17945. weekdays: 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'),
  17946. weekdaysShort: 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'),
  17947. weekdaysMin: 'di_lu_ma_me_je_ve_sa'.split('_'),
  17948. weekdaysParseExact: true,
  17949. longDateFormat: {
  17950. LT: 'HH:mm',
  17951. LTS: 'HH:mm:ss',
  17952. L: 'YYYY-MM-DD',
  17953. LL: 'D MMMM YYYY',
  17954. LLL: 'D MMMM YYYY HH:mm',
  17955. LLLL: 'dddd D MMMM YYYY HH:mm',
  17956. },
  17957. calendar: {
  17958. sameDay: '[Aujourd’hui à] LT',
  17959. nextDay: '[Demain à] LT',
  17960. nextWeek: 'dddd [à] LT',
  17961. lastDay: '[Hier à] LT',
  17962. lastWeek: 'dddd [dernier à] LT',
  17963. sameElse: 'L',
  17964. },
  17965. relativeTime: {
  17966. future: 'dans %s',
  17967. past: 'il y a %s',
  17968. s: 'quelques secondes',
  17969. ss: '%d secondes',
  17970. m: 'une minute',
  17971. mm: '%d minutes',
  17972. h: 'une heure',
  17973. hh: '%d heures',
  17974. d: 'un jour',
  17975. dd: '%d jours',
  17976. M: 'un mois',
  17977. MM: '%d mois',
  17978. y: 'un an',
  17979. yy: '%d ans',
  17980. },
  17981. dayOfMonthOrdinalParse: /\d{1,2}(er|e)/,
  17982. ordinal: function (number, period) {
  17983. switch (period) {
  17984. // Words with masculine grammatical gender: mois, trimestre, jour
  17985. default:
  17986. case 'M':
  17987. case 'Q':
  17988. case 'D':
  17989. case 'DDD':
  17990. case 'd':
  17991. return number + (number === 1 ? 'er' : 'e');
  17992. // Words with feminine grammatical gender: semaine
  17993. case 'w':
  17994. case 'W':
  17995. return number + (number === 1 ? 're' : 'e');
  17996. }
  17997. },
  17998. });
  17999. //! moment.js locale configuration
  18000. hooks.defineLocale('fr-ch', {
  18001. months: 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split(
  18002. '_'
  18003. ),
  18004. monthsShort:
  18005. 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split(
  18006. '_'
  18007. ),
  18008. monthsParseExact: true,
  18009. weekdays: 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'),
  18010. weekdaysShort: 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'),
  18011. weekdaysMin: 'di_lu_ma_me_je_ve_sa'.split('_'),
  18012. weekdaysParseExact: true,
  18013. longDateFormat: {
  18014. LT: 'HH:mm',
  18015. LTS: 'HH:mm:ss',
  18016. L: 'DD.MM.YYYY',
  18017. LL: 'D MMMM YYYY',
  18018. LLL: 'D MMMM YYYY HH:mm',
  18019. LLLL: 'dddd D MMMM YYYY HH:mm',
  18020. },
  18021. calendar: {
  18022. sameDay: '[Aujourd’hui à] LT',
  18023. nextDay: '[Demain à] LT',
  18024. nextWeek: 'dddd [à] LT',
  18025. lastDay: '[Hier à] LT',
  18026. lastWeek: 'dddd [dernier à] LT',
  18027. sameElse: 'L',
  18028. },
  18029. relativeTime: {
  18030. future: 'dans %s',
  18031. past: 'il y a %s',
  18032. s: 'quelques secondes',
  18033. ss: '%d secondes',
  18034. m: 'une minute',
  18035. mm: '%d minutes',
  18036. h: 'une heure',
  18037. hh: '%d heures',
  18038. d: 'un jour',
  18039. dd: '%d jours',
  18040. M: 'un mois',
  18041. MM: '%d mois',
  18042. y: 'un an',
  18043. yy: '%d ans',
  18044. },
  18045. dayOfMonthOrdinalParse: /\d{1,2}(er|e)/,
  18046. ordinal: function (number, period) {
  18047. switch (period) {
  18048. // Words with masculine grammatical gender: mois, trimestre, jour
  18049. default:
  18050. case 'M':
  18051. case 'Q':
  18052. case 'D':
  18053. case 'DDD':
  18054. case 'd':
  18055. return number + (number === 1 ? 'er' : 'e');
  18056. // Words with feminine grammatical gender: semaine
  18057. case 'w':
  18058. case 'W':
  18059. return number + (number === 1 ? 're' : 'e');
  18060. }
  18061. },
  18062. week: {
  18063. dow: 1, // Monday is the first day of the week.
  18064. doy: 4, // The week that contains Jan 4th is the first week of the year.
  18065. },
  18066. });
  18067. //! moment.js locale configuration
  18068. var monthsStrictRegex$1 =
  18069. /^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i,
  18070. monthsShortStrictRegex$1 =
  18071. /(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?)/i,
  18072. monthsRegex$7 =
  18073. /(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?|janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i,
  18074. monthsParse$6 = [
  18075. /^janv/i,
  18076. /^févr/i,
  18077. /^mars/i,
  18078. /^avr/i,
  18079. /^mai/i,
  18080. /^juin/i,
  18081. /^juil/i,
  18082. /^août/i,
  18083. /^sept/i,
  18084. /^oct/i,
  18085. /^nov/i,
  18086. /^déc/i,
  18087. ];
  18088. hooks.defineLocale('fr', {
  18089. months: 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split(
  18090. '_'
  18091. ),
  18092. monthsShort:
  18093. 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split(
  18094. '_'
  18095. ),
  18096. monthsRegex: monthsRegex$7,
  18097. monthsShortRegex: monthsRegex$7,
  18098. monthsStrictRegex: monthsStrictRegex$1,
  18099. monthsShortStrictRegex: monthsShortStrictRegex$1,
  18100. monthsParse: monthsParse$6,
  18101. longMonthsParse: monthsParse$6,
  18102. shortMonthsParse: monthsParse$6,
  18103. weekdays: 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'),
  18104. weekdaysShort: 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'),
  18105. weekdaysMin: 'di_lu_ma_me_je_ve_sa'.split('_'),
  18106. weekdaysParseExact: true,
  18107. longDateFormat: {
  18108. LT: 'HH:mm',
  18109. LTS: 'HH:mm:ss',
  18110. L: 'DD/MM/YYYY',
  18111. LL: 'D MMMM YYYY',
  18112. LLL: 'D MMMM YYYY HH:mm',
  18113. LLLL: 'dddd D MMMM YYYY HH:mm',
  18114. },
  18115. calendar: {
  18116. sameDay: '[Aujourd’hui à] LT',
  18117. nextDay: '[Demain à] LT',
  18118. nextWeek: 'dddd [à] LT',
  18119. lastDay: '[Hier à] LT',
  18120. lastWeek: 'dddd [dernier à] LT',
  18121. sameElse: 'L',
  18122. },
  18123. relativeTime: {
  18124. future: 'dans %s',
  18125. past: 'il y a %s',
  18126. s: 'quelques secondes',
  18127. ss: '%d secondes',
  18128. m: 'une minute',
  18129. mm: '%d minutes',
  18130. h: 'une heure',
  18131. hh: '%d heures',
  18132. d: 'un jour',
  18133. dd: '%d jours',
  18134. w: 'une semaine',
  18135. ww: '%d semaines',
  18136. M: 'un mois',
  18137. MM: '%d mois',
  18138. y: 'un an',
  18139. yy: '%d ans',
  18140. },
  18141. dayOfMonthOrdinalParse: /\d{1,2}(er|)/,
  18142. ordinal: function (number, period) {
  18143. switch (period) {
  18144. // TODO: Return 'e' when day of month > 1. Move this case inside
  18145. // block for masculine words below.
  18146. // See https://github.com/moment/moment/issues/3375
  18147. case 'D':
  18148. return number + (number === 1 ? 'er' : '');
  18149. // Words with masculine grammatical gender: mois, trimestre, jour
  18150. default:
  18151. case 'M':
  18152. case 'Q':
  18153. case 'DDD':
  18154. case 'd':
  18155. return number + (number === 1 ? 'er' : 'e');
  18156. // Words with feminine grammatical gender: semaine
  18157. case 'w':
  18158. case 'W':
  18159. return number + (number === 1 ? 're' : 'e');
  18160. }
  18161. },
  18162. week: {
  18163. dow: 1, // Monday is the first day of the week.
  18164. doy: 4, // The week that contains Jan 4th is the first week of the year.
  18165. },
  18166. });
  18167. //! moment.js locale configuration
  18168. var monthsShortWithDots =
  18169. 'jan._feb._mrt._apr._mai_jun._jul._aug._sep._okt._nov._des.'.split('_'),
  18170. monthsShortWithoutDots =
  18171. 'jan_feb_mrt_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_');
  18172. hooks.defineLocale('fy', {
  18173. months: 'jannewaris_febrewaris_maart_april_maaie_juny_july_augustus_septimber_oktober_novimber_desimber'.split(
  18174. '_'
  18175. ),
  18176. monthsShort: function (m, format) {
  18177. if (!m) {
  18178. return monthsShortWithDots;
  18179. } else if (/-MMM-/.test(format)) {
  18180. return monthsShortWithoutDots[m.month()];
  18181. } else {
  18182. return monthsShortWithDots[m.month()];
  18183. }
  18184. },
  18185. monthsParseExact: true,
  18186. weekdays: 'snein_moandei_tiisdei_woansdei_tongersdei_freed_sneon'.split(
  18187. '_'
  18188. ),
  18189. weekdaysShort: 'si._mo._ti._wo._to._fr._so.'.split('_'),
  18190. weekdaysMin: 'Si_Mo_Ti_Wo_To_Fr_So'.split('_'),
  18191. weekdaysParseExact: true,
  18192. longDateFormat: {
  18193. LT: 'HH:mm',
  18194. LTS: 'HH:mm:ss',
  18195. L: 'DD-MM-YYYY',
  18196. LL: 'D MMMM YYYY',
  18197. LLL: 'D MMMM YYYY HH:mm',
  18198. LLLL: 'dddd D MMMM YYYY HH:mm',
  18199. },
  18200. calendar: {
  18201. sameDay: '[hjoed om] LT',
  18202. nextDay: '[moarn om] LT',
  18203. nextWeek: 'dddd [om] LT',
  18204. lastDay: '[juster om] LT',
  18205. lastWeek: '[ôfrûne] dddd [om] LT',
  18206. sameElse: 'L',
  18207. },
  18208. relativeTime: {
  18209. future: 'oer %s',
  18210. past: '%s lyn',
  18211. s: 'in pear sekonden',
  18212. ss: '%d sekonden',
  18213. m: 'ien minút',
  18214. mm: '%d minuten',
  18215. h: 'ien oere',
  18216. hh: '%d oeren',
  18217. d: 'ien dei',
  18218. dd: '%d dagen',
  18219. M: 'ien moanne',
  18220. MM: '%d moannen',
  18221. y: 'ien jier',
  18222. yy: '%d jierren',
  18223. },
  18224. dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/,
  18225. ordinal: function (number) {
  18226. return (
  18227. number +
  18228. (number === 1 || number === 8 || number >= 20 ? 'ste' : 'de')
  18229. );
  18230. },
  18231. week: {
  18232. dow: 1, // Monday is the first day of the week.
  18233. doy: 4, // The week that contains Jan 4th is the first week of the year.
  18234. },
  18235. });
  18236. //! moment.js locale configuration
  18237. var months$6 = [
  18238. 'Eanáir',
  18239. 'Feabhra',
  18240. 'Márta',
  18241. 'Aibreán',
  18242. 'Bealtaine',
  18243. 'Meitheamh',
  18244. 'Iúil',
  18245. 'Lúnasa',
  18246. 'Meán Fómhair',
  18247. 'Deireadh Fómhair',
  18248. 'Samhain',
  18249. 'Nollaig',
  18250. ],
  18251. monthsShort$5 = [
  18252. 'Ean',
  18253. 'Feabh',
  18254. 'Márt',
  18255. 'Aib',
  18256. 'Beal',
  18257. 'Meith',
  18258. 'Iúil',
  18259. 'Lún',
  18260. 'M.F.',
  18261. 'D.F.',
  18262. 'Samh',
  18263. 'Noll',
  18264. ],
  18265. weekdays$1 = [
  18266. 'Dé Domhnaigh',
  18267. 'Dé Luain',
  18268. 'Dé Máirt',
  18269. 'Dé Céadaoin',
  18270. 'Déardaoin',
  18271. 'Dé hAoine',
  18272. 'Dé Sathairn',
  18273. ],
  18274. weekdaysShort = ['Domh', 'Luan', 'Máirt', 'Céad', 'Déar', 'Aoine', 'Sath'],
  18275. weekdaysMin = ['Do', 'Lu', 'Má', 'Cé', 'Dé', 'A', 'Sa'];
  18276. hooks.defineLocale('ga', {
  18277. months: months$6,
  18278. monthsShort: monthsShort$5,
  18279. monthsParseExact: true,
  18280. weekdays: weekdays$1,
  18281. weekdaysShort: weekdaysShort,
  18282. weekdaysMin: weekdaysMin,
  18283. longDateFormat: {
  18284. LT: 'HH:mm',
  18285. LTS: 'HH:mm:ss',
  18286. L: 'DD/MM/YYYY',
  18287. LL: 'D MMMM YYYY',
  18288. LLL: 'D MMMM YYYY HH:mm',
  18289. LLLL: 'dddd, D MMMM YYYY HH:mm',
  18290. },
  18291. calendar: {
  18292. sameDay: '[Inniu ag] LT',
  18293. nextDay: '[Amárach ag] LT',
  18294. nextWeek: 'dddd [ag] LT',
  18295. lastDay: '[Inné ag] LT',
  18296. lastWeek: 'dddd [seo caite] [ag] LT',
  18297. sameElse: 'L',
  18298. },
  18299. relativeTime: {
  18300. future: 'i %s',
  18301. past: '%s ó shin',
  18302. s: 'cúpla soicind',
  18303. ss: '%d soicind',
  18304. m: 'nóiméad',
  18305. mm: '%d nóiméad',
  18306. h: 'uair an chloig',
  18307. hh: '%d uair an chloig',
  18308. d: 'lá',
  18309. dd: '%d lá',
  18310. M: 'mí',
  18311. MM: '%d míonna',
  18312. y: 'bliain',
  18313. yy: '%d bliain',
  18314. },
  18315. dayOfMonthOrdinalParse: /\d{1,2}(d|na|mh)/,
  18316. ordinal: function (number) {
  18317. var output = number === 1 ? 'd' : number % 10 === 2 ? 'na' : 'mh';
  18318. return number + output;
  18319. },
  18320. week: {
  18321. dow: 1, // Monday is the first day of the week.
  18322. doy: 4, // The week that contains Jan 4th is the first week of the year.
  18323. },
  18324. });
  18325. //! moment.js locale configuration
  18326. var months$7 = [
  18327. 'Am Faoilleach',
  18328. 'An Gearran',
  18329. 'Am Màrt',
  18330. 'An Giblean',
  18331. 'An Cèitean',
  18332. 'An t-Ògmhios',
  18333. 'An t-Iuchar',
  18334. 'An Lùnastal',
  18335. 'An t-Sultain',
  18336. 'An Dàmhair',
  18337. 'An t-Samhain',
  18338. 'An Dùbhlachd',
  18339. ],
  18340. monthsShort$6 = [
  18341. 'Faoi',
  18342. 'Gear',
  18343. 'Màrt',
  18344. 'Gibl',
  18345. 'Cèit',
  18346. 'Ògmh',
  18347. 'Iuch',
  18348. 'Lùn',
  18349. 'Sult',
  18350. 'Dàmh',
  18351. 'Samh',
  18352. 'Dùbh',
  18353. ],
  18354. weekdays$2 = [
  18355. 'Didòmhnaich',
  18356. 'Diluain',
  18357. 'Dimàirt',
  18358. 'Diciadain',
  18359. 'Diardaoin',
  18360. 'Dihaoine',
  18361. 'Disathairne',
  18362. ],
  18363. weekdaysShort$1 = ['Did', 'Dil', 'Dim', 'Dic', 'Dia', 'Dih', 'Dis'],
  18364. weekdaysMin$1 = ['Dò', 'Lu', 'Mà', 'Ci', 'Ar', 'Ha', 'Sa'];
  18365. hooks.defineLocale('gd', {
  18366. months: months$7,
  18367. monthsShort: monthsShort$6,
  18368. monthsParseExact: true,
  18369. weekdays: weekdays$2,
  18370. weekdaysShort: weekdaysShort$1,
  18371. weekdaysMin: weekdaysMin$1,
  18372. longDateFormat: {
  18373. LT: 'HH:mm',
  18374. LTS: 'HH:mm:ss',
  18375. L: 'DD/MM/YYYY',
  18376. LL: 'D MMMM YYYY',
  18377. LLL: 'D MMMM YYYY HH:mm',
  18378. LLLL: 'dddd, D MMMM YYYY HH:mm',
  18379. },
  18380. calendar: {
  18381. sameDay: '[An-diugh aig] LT',
  18382. nextDay: '[A-màireach aig] LT',
  18383. nextWeek: 'dddd [aig] LT',
  18384. lastDay: '[An-dè aig] LT',
  18385. lastWeek: 'dddd [seo chaidh] [aig] LT',
  18386. sameElse: 'L',
  18387. },
  18388. relativeTime: {
  18389. future: 'ann an %s',
  18390. past: 'bho chionn %s',
  18391. s: 'beagan diogan',
  18392. ss: '%d diogan',
  18393. m: 'mionaid',
  18394. mm: '%d mionaidean',
  18395. h: 'uair',
  18396. hh: '%d uairean',
  18397. d: 'latha',
  18398. dd: '%d latha',
  18399. M: 'mìos',
  18400. MM: '%d mìosan',
  18401. y: 'bliadhna',
  18402. yy: '%d bliadhna',
  18403. },
  18404. dayOfMonthOrdinalParse: /\d{1,2}(d|na|mh)/,
  18405. ordinal: function (number) {
  18406. var output = number === 1 ? 'd' : number % 10 === 2 ? 'na' : 'mh';
  18407. return number + output;
  18408. },
  18409. week: {
  18410. dow: 1, // Monday is the first day of the week.
  18411. doy: 4, // The week that contains Jan 4th is the first week of the year.
  18412. },
  18413. });
  18414. //! moment.js locale configuration
  18415. hooks.defineLocale('gl', {
  18416. months: 'xaneiro_febreiro_marzo_abril_maio_xuño_xullo_agosto_setembro_outubro_novembro_decembro'.split(
  18417. '_'
  18418. ),
  18419. monthsShort:
  18420. 'xan._feb._mar._abr._mai._xuñ._xul._ago._set._out._nov._dec.'.split(
  18421. '_'
  18422. ),
  18423. monthsParseExact: true,
  18424. weekdays: 'domingo_luns_martes_mércores_xoves_venres_sábado'.split('_'),
  18425. weekdaysShort: 'dom._lun._mar._mér._xov._ven._sáb.'.split('_'),
  18426. weekdaysMin: 'do_lu_ma_mé_xo_ve_sá'.split('_'),
  18427. weekdaysParseExact: true,
  18428. longDateFormat: {
  18429. LT: 'H:mm',
  18430. LTS: 'H:mm:ss',
  18431. L: 'DD/MM/YYYY',
  18432. LL: 'D [de] MMMM [de] YYYY',
  18433. LLL: 'D [de] MMMM [de] YYYY H:mm',
  18434. LLLL: 'dddd, D [de] MMMM [de] YYYY H:mm',
  18435. },
  18436. calendar: {
  18437. sameDay: function () {
  18438. return '[hoxe ' + (this.hours() !== 1 ? 'ás' : 'á') + '] LT';
  18439. },
  18440. nextDay: function () {
  18441. return '[mañá ' + (this.hours() !== 1 ? 'ás' : 'á') + '] LT';
  18442. },
  18443. nextWeek: function () {
  18444. return 'dddd [' + (this.hours() !== 1 ? 'ás' : 'a') + '] LT';
  18445. },
  18446. lastDay: function () {
  18447. return '[onte ' + (this.hours() !== 1 ? 'á' : 'a') + '] LT';
  18448. },
  18449. lastWeek: function () {
  18450. return (
  18451. '[o] dddd [pasado ' + (this.hours() !== 1 ? 'ás' : 'a') + '] LT'
  18452. );
  18453. },
  18454. sameElse: 'L',
  18455. },
  18456. relativeTime: {
  18457. future: function (str) {
  18458. if (str.indexOf('un') === 0) {
  18459. return 'n' + str;
  18460. }
  18461. return 'en ' + str;
  18462. },
  18463. past: 'hai %s',
  18464. s: 'uns segundos',
  18465. ss: '%d segundos',
  18466. m: 'un minuto',
  18467. mm: '%d minutos',
  18468. h: 'unha hora',
  18469. hh: '%d horas',
  18470. d: 'un día',
  18471. dd: '%d días',
  18472. M: 'un mes',
  18473. MM: '%d meses',
  18474. y: 'un ano',
  18475. yy: '%d anos',
  18476. },
  18477. dayOfMonthOrdinalParse: /\d{1,2}º/,
  18478. ordinal: '%dº',
  18479. week: {
  18480. dow: 1, // Monday is the first day of the week.
  18481. doy: 4, // The week that contains Jan 4th is the first week of the year.
  18482. },
  18483. });
  18484. //! moment.js locale configuration
  18485. function processRelativeTime$4(number, withoutSuffix, key, isFuture) {
  18486. var format = {
  18487. s: ['थोडया सॅकंडांनी', 'थोडे सॅकंड'],
  18488. ss: [number + ' सॅकंडांनी', number + ' सॅकंड'],
  18489. m: ['एका मिणटान', 'एक मिनूट'],
  18490. mm: [number + ' मिणटांनी', number + ' मिणटां'],
  18491. h: ['एका वरान', 'एक वर'],
  18492. hh: [number + ' वरांनी', number + ' वरां'],
  18493. d: ['एका दिसान', 'एक दीस'],
  18494. dd: [number + ' दिसांनी', number + ' दीस'],
  18495. M: ['एका म्हयन्यान', 'एक म्हयनो'],
  18496. MM: [number + ' म्हयन्यानी', number + ' म्हयने'],
  18497. y: ['एका वर्सान', 'एक वर्स'],
  18498. yy: [number + ' वर्सांनी', number + ' वर्सां'],
  18499. };
  18500. return isFuture ? format[key][0] : format[key][1];
  18501. }
  18502. hooks.defineLocale('gom-deva', {
  18503. months: {
  18504. standalone:
  18505. 'जानेवारी_फेब्रुवारी_मार्च_एप्रील_मे_जून_जुलय_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर'.split(
  18506. '_'
  18507. ),
  18508. format: 'जानेवारीच्या_फेब्रुवारीच्या_मार्चाच्या_एप्रीलाच्या_मेयाच्या_जूनाच्या_जुलयाच्या_ऑगस्टाच्या_सप्टेंबराच्या_ऑक्टोबराच्या_नोव्हेंबराच्या_डिसेंबराच्या'.split(
  18509. '_'
  18510. ),
  18511. isFormat: /MMMM(\s)+D[oD]?/,
  18512. },
  18513. monthsShort:
  18514. 'जाने._फेब्रु._मार्च_एप्री._मे_जून_जुल._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.'.split(
  18515. '_'
  18516. ),
  18517. monthsParseExact: true,
  18518. weekdays: 'आयतार_सोमार_मंगळार_बुधवार_बिरेस्तार_सुक्रार_शेनवार'.split('_'),
  18519. weekdaysShort: 'आयत._सोम._मंगळ._बुध._ब्रेस्त._सुक्र._शेन.'.split('_'),
  18520. weekdaysMin: 'आ_सो_मं_बु_ब्रे_सु_शे'.split('_'),
  18521. weekdaysParseExact: true,
  18522. longDateFormat: {
  18523. LT: 'A h:mm [वाजतां]',
  18524. LTS: 'A h:mm:ss [वाजतां]',
  18525. L: 'DD-MM-YYYY',
  18526. LL: 'D MMMM YYYY',
  18527. LLL: 'D MMMM YYYY A h:mm [वाजतां]',
  18528. LLLL: 'dddd, MMMM Do, YYYY, A h:mm [वाजतां]',
  18529. llll: 'ddd, D MMM YYYY, A h:mm [वाजतां]',
  18530. },
  18531. calendar: {
  18532. sameDay: '[आयज] LT',
  18533. nextDay: '[फाल्यां] LT',
  18534. nextWeek: '[फुडलो] dddd[,] LT',
  18535. lastDay: '[काल] LT',
  18536. lastWeek: '[फाटलो] dddd[,] LT',
  18537. sameElse: 'L',
  18538. },
  18539. relativeTime: {
  18540. future: '%s',
  18541. past: '%s आदीं',
  18542. s: processRelativeTime$4,
  18543. ss: processRelativeTime$4,
  18544. m: processRelativeTime$4,
  18545. mm: processRelativeTime$4,
  18546. h: processRelativeTime$4,
  18547. hh: processRelativeTime$4,
  18548. d: processRelativeTime$4,
  18549. dd: processRelativeTime$4,
  18550. M: processRelativeTime$4,
  18551. MM: processRelativeTime$4,
  18552. y: processRelativeTime$4,
  18553. yy: processRelativeTime$4,
  18554. },
  18555. dayOfMonthOrdinalParse: /\d{1,2}(वेर)/,
  18556. ordinal: function (number, period) {
  18557. switch (period) {
  18558. // the ordinal 'वेर' only applies to day of the month
  18559. case 'D':
  18560. return number + 'वेर';
  18561. default:
  18562. case 'M':
  18563. case 'Q':
  18564. case 'DDD':
  18565. case 'd':
  18566. case 'w':
  18567. case 'W':
  18568. return number;
  18569. }
  18570. },
  18571. week: {
  18572. dow: 0, // Sunday is the first day of the week
  18573. doy: 3, // The week that contains Jan 4th is the first week of the year (7 + 0 - 4)
  18574. },
  18575. meridiemParse: /राती|सकाळीं|दनपारां|सांजे/,
  18576. meridiemHour: function (hour, meridiem) {
  18577. if (hour === 12) {
  18578. hour = 0;
  18579. }
  18580. if (meridiem === 'राती') {
  18581. return hour < 4 ? hour : hour + 12;
  18582. } else if (meridiem === 'सकाळीं') {
  18583. return hour;
  18584. } else if (meridiem === 'दनपारां') {
  18585. return hour > 12 ? hour : hour + 12;
  18586. } else if (meridiem === 'सांजे') {
  18587. return hour + 12;
  18588. }
  18589. },
  18590. meridiem: function (hour, minute, isLower) {
  18591. if (hour < 4) {
  18592. return 'राती';
  18593. } else if (hour < 12) {
  18594. return 'सकाळीं';
  18595. } else if (hour < 16) {
  18596. return 'दनपारां';
  18597. } else if (hour < 20) {
  18598. return 'सांजे';
  18599. } else {
  18600. return 'राती';
  18601. }
  18602. },
  18603. });
  18604. //! moment.js locale configuration
  18605. function processRelativeTime$5(number, withoutSuffix, key, isFuture) {
  18606. var format = {
  18607. s: ['thoddea sekondamni', 'thodde sekond'],
  18608. ss: [number + ' sekondamni', number + ' sekond'],
  18609. m: ['eka mintan', 'ek minut'],
  18610. mm: [number + ' mintamni', number + ' mintam'],
  18611. h: ['eka voran', 'ek vor'],
  18612. hh: [number + ' voramni', number + ' voram'],
  18613. d: ['eka disan', 'ek dis'],
  18614. dd: [number + ' disamni', number + ' dis'],
  18615. M: ['eka mhoinean', 'ek mhoino'],
  18616. MM: [number + ' mhoineamni', number + ' mhoine'],
  18617. y: ['eka vorsan', 'ek voros'],
  18618. yy: [number + ' vorsamni', number + ' vorsam'],
  18619. };
  18620. return isFuture ? format[key][0] : format[key][1];
  18621. }
  18622. hooks.defineLocale('gom-latn', {
  18623. months: {
  18624. standalone:
  18625. 'Janer_Febrer_Mars_Abril_Mai_Jun_Julai_Agost_Setembr_Otubr_Novembr_Dezembr'.split(
  18626. '_'
  18627. ),
  18628. format: 'Janerachea_Febrerachea_Marsachea_Abrilachea_Maiachea_Junachea_Julaiachea_Agostachea_Setembrachea_Otubrachea_Novembrachea_Dezembrachea'.split(
  18629. '_'
  18630. ),
  18631. isFormat: /MMMM(\s)+D[oD]?/,
  18632. },
  18633. monthsShort:
  18634. 'Jan._Feb._Mars_Abr._Mai_Jun_Jul._Ago._Set._Otu._Nov._Dez.'.split('_'),
  18635. monthsParseExact: true,
  18636. weekdays: "Aitar_Somar_Mongllar_Budhvar_Birestar_Sukrar_Son'var".split('_'),
  18637. weekdaysShort: 'Ait._Som._Mon._Bud._Bre._Suk._Son.'.split('_'),
  18638. weekdaysMin: 'Ai_Sm_Mo_Bu_Br_Su_Sn'.split('_'),
  18639. weekdaysParseExact: true,
  18640. longDateFormat: {
  18641. LT: 'A h:mm [vazta]',
  18642. LTS: 'A h:mm:ss [vazta]',
  18643. L: 'DD-MM-YYYY',
  18644. LL: 'D MMMM YYYY',
  18645. LLL: 'D MMMM YYYY A h:mm [vazta]',
  18646. LLLL: 'dddd, MMMM Do, YYYY, A h:mm [vazta]',
  18647. llll: 'ddd, D MMM YYYY, A h:mm [vazta]',
  18648. },
  18649. calendar: {
  18650. sameDay: '[Aiz] LT',
  18651. nextDay: '[Faleam] LT',
  18652. nextWeek: '[Fuddlo] dddd[,] LT',
  18653. lastDay: '[Kal] LT',
  18654. lastWeek: '[Fattlo] dddd[,] LT',
  18655. sameElse: 'L',
  18656. },
  18657. relativeTime: {
  18658. future: '%s',
  18659. past: '%s adim',
  18660. s: processRelativeTime$5,
  18661. ss: processRelativeTime$5,
  18662. m: processRelativeTime$5,
  18663. mm: processRelativeTime$5,
  18664. h: processRelativeTime$5,
  18665. hh: processRelativeTime$5,
  18666. d: processRelativeTime$5,
  18667. dd: processRelativeTime$5,
  18668. M: processRelativeTime$5,
  18669. MM: processRelativeTime$5,
  18670. y: processRelativeTime$5,
  18671. yy: processRelativeTime$5,
  18672. },
  18673. dayOfMonthOrdinalParse: /\d{1,2}(er)/,
  18674. ordinal: function (number, period) {
  18675. switch (period) {
  18676. // the ordinal 'er' only applies to day of the month
  18677. case 'D':
  18678. return number + 'er';
  18679. default:
  18680. case 'M':
  18681. case 'Q':
  18682. case 'DDD':
  18683. case 'd':
  18684. case 'w':
  18685. case 'W':
  18686. return number;
  18687. }
  18688. },
  18689. week: {
  18690. dow: 0, // Sunday is the first day of the week
  18691. doy: 3, // The week that contains Jan 4th is the first week of the year (7 + 0 - 4)
  18692. },
  18693. meridiemParse: /rati|sokallim|donparam|sanje/,
  18694. meridiemHour: function (hour, meridiem) {
  18695. if (hour === 12) {
  18696. hour = 0;
  18697. }
  18698. if (meridiem === 'rati') {
  18699. return hour < 4 ? hour : hour + 12;
  18700. } else if (meridiem === 'sokallim') {
  18701. return hour;
  18702. } else if (meridiem === 'donparam') {
  18703. return hour > 12 ? hour : hour + 12;
  18704. } else if (meridiem === 'sanje') {
  18705. return hour + 12;
  18706. }
  18707. },
  18708. meridiem: function (hour, minute, isLower) {
  18709. if (hour < 4) {
  18710. return 'rati';
  18711. } else if (hour < 12) {
  18712. return 'sokallim';
  18713. } else if (hour < 16) {
  18714. return 'donparam';
  18715. } else if (hour < 20) {
  18716. return 'sanje';
  18717. } else {
  18718. return 'rati';
  18719. }
  18720. },
  18721. });
  18722. //! moment.js locale configuration
  18723. var symbolMap$7 = {
  18724. 1: '૧',
  18725. 2: '૨',
  18726. 3: '૩',
  18727. 4: '૪',
  18728. 5: '૫',
  18729. 6: '૬',
  18730. 7: '૭',
  18731. 8: '૮',
  18732. 9: '૯',
  18733. 0: '૦',
  18734. },
  18735. numberMap$6 = {
  18736. '૧': '1',
  18737. '૨': '2',
  18738. '૩': '3',
  18739. '૪': '4',
  18740. '૫': '5',
  18741. '૬': '6',
  18742. '૭': '7',
  18743. '૮': '8',
  18744. '૯': '9',
  18745. '૦': '0',
  18746. };
  18747. hooks.defineLocale('gu', {
  18748. months: 'જાન્યુઆરી_ફેબ્રુઆરી_માર્ચ_એપ્રિલ_મે_જૂન_જુલાઈ_ઑગસ્ટ_સપ્ટેમ્બર_ઑક્ટ્બર_નવેમ્બર_ડિસેમ્બર'.split(
  18749. '_'
  18750. ),
  18751. monthsShort:
  18752. 'જાન્યુ._ફેબ્રુ._માર્ચ_એપ્રિ._મે_જૂન_જુલા._ઑગ._સપ્ટે._ઑક્ટ્._નવે._ડિસે.'.split(
  18753. '_'
  18754. ),
  18755. monthsParseExact: true,
  18756. weekdays: 'રવિવાર_સોમવાર_મંગળવાર_બુધ્વાર_ગુરુવાર_શુક્રવાર_શનિવાર'.split(
  18757. '_'
  18758. ),
  18759. weekdaysShort: 'રવિ_સોમ_મંગળ_બુધ્_ગુરુ_શુક્ર_શનિ'.split('_'),
  18760. weekdaysMin: 'ર_સો_મં_બુ_ગુ_શુ_શ'.split('_'),
  18761. longDateFormat: {
  18762. LT: 'A h:mm વાગ્યે',
  18763. LTS: 'A h:mm:ss વાગ્યે',
  18764. L: 'DD/MM/YYYY',
  18765. LL: 'D MMMM YYYY',
  18766. LLL: 'D MMMM YYYY, A h:mm વાગ્યે',
  18767. LLLL: 'dddd, D MMMM YYYY, A h:mm વાગ્યે',
  18768. },
  18769. calendar: {
  18770. sameDay: '[આજ] LT',
  18771. nextDay: '[કાલે] LT',
  18772. nextWeek: 'dddd, LT',
  18773. lastDay: '[ગઇકાલે] LT',
  18774. lastWeek: '[પાછલા] dddd, LT',
  18775. sameElse: 'L',
  18776. },
  18777. relativeTime: {
  18778. future: '%s મા',
  18779. past: '%s પહેલા',
  18780. s: 'અમુક પળો',
  18781. ss: '%d સેકંડ',
  18782. m: 'એક મિનિટ',
  18783. mm: '%d મિનિટ',
  18784. h: 'એક કલાક',
  18785. hh: '%d કલાક',
  18786. d: 'એક દિવસ',
  18787. dd: '%d દિવસ',
  18788. M: 'એક મહિનો',
  18789. MM: '%d મહિનો',
  18790. y: 'એક વર્ષ',
  18791. yy: '%d વર્ષ',
  18792. },
  18793. preparse: function (string) {
  18794. return string.replace(/[૧૨૩૪૫૬૭૮૯૦]/g, function (match) {
  18795. return numberMap$6[match];
  18796. });
  18797. },
  18798. postformat: function (string) {
  18799. return string.replace(/\d/g, function (match) {
  18800. return symbolMap$7[match];
  18801. });
  18802. },
  18803. // Gujarati notation for meridiems are quite fuzzy in practice. While there exists
  18804. // a rigid notion of a 'Pahar' it is not used as rigidly in modern Gujarati.
  18805. meridiemParse: /રાત|બપોર|સવાર|સાંજ/,
  18806. meridiemHour: function (hour, meridiem) {
  18807. if (hour === 12) {
  18808. hour = 0;
  18809. }
  18810. if (meridiem === 'રાત') {
  18811. return hour < 4 ? hour : hour + 12;
  18812. } else if (meridiem === 'સવાર') {
  18813. return hour;
  18814. } else if (meridiem === 'બપોર') {
  18815. return hour >= 10 ? hour : hour + 12;
  18816. } else if (meridiem === 'સાંજ') {
  18817. return hour + 12;
  18818. }
  18819. },
  18820. meridiem: function (hour, minute, isLower) {
  18821. if (hour < 4) {
  18822. return 'રાત';
  18823. } else if (hour < 10) {
  18824. return 'સવાર';
  18825. } else if (hour < 17) {
  18826. return 'બપોર';
  18827. } else if (hour < 20) {
  18828. return 'સાંજ';
  18829. } else {
  18830. return 'રાત';
  18831. }
  18832. },
  18833. week: {
  18834. dow: 0, // Sunday is the first day of the week.
  18835. doy: 6, // The week that contains Jan 6th is the first week of the year.
  18836. },
  18837. });
  18838. //! moment.js locale configuration
  18839. hooks.defineLocale('he', {
  18840. months: 'ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר'.split(
  18841. '_'
  18842. ),
  18843. monthsShort:
  18844. 'ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳'.split('_'),
  18845. weekdays: 'ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת'.split('_'),
  18846. weekdaysShort: 'א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳'.split('_'),
  18847. weekdaysMin: 'א_ב_ג_ד_ה_ו_ש'.split('_'),
  18848. longDateFormat: {
  18849. LT: 'HH:mm',
  18850. LTS: 'HH:mm:ss',
  18851. L: 'DD/MM/YYYY',
  18852. LL: 'D [ב]MMMM YYYY',
  18853. LLL: 'D [ב]MMMM YYYY HH:mm',
  18854. LLLL: 'dddd, D [ב]MMMM YYYY HH:mm',
  18855. l: 'D/M/YYYY',
  18856. ll: 'D MMM YYYY',
  18857. lll: 'D MMM YYYY HH:mm',
  18858. llll: 'ddd, D MMM YYYY HH:mm',
  18859. },
  18860. calendar: {
  18861. sameDay: '[היום ב־]LT',
  18862. nextDay: '[מחר ב־]LT',
  18863. nextWeek: 'dddd [בשעה] LT',
  18864. lastDay: '[אתמול ב־]LT',
  18865. lastWeek: '[ביום] dddd [האחרון בשעה] LT',
  18866. sameElse: 'L',
  18867. },
  18868. relativeTime: {
  18869. future: 'בעוד %s',
  18870. past: 'לפני %s',
  18871. s: 'מספר שניות',
  18872. ss: '%d שניות',
  18873. m: 'דקה',
  18874. mm: '%d דקות',
  18875. h: 'שעה',
  18876. hh: function (number) {
  18877. if (number === 2) {
  18878. return 'שעתיים';
  18879. }
  18880. return number + ' שעות';
  18881. },
  18882. d: 'יום',
  18883. dd: function (number) {
  18884. if (number === 2) {
  18885. return 'יומיים';
  18886. }
  18887. return number + ' ימים';
  18888. },
  18889. M: 'חודש',
  18890. MM: function (number) {
  18891. if (number === 2) {
  18892. return 'חודשיים';
  18893. }
  18894. return number + ' חודשים';
  18895. },
  18896. y: 'שנה',
  18897. yy: function (number) {
  18898. if (number === 2) {
  18899. return 'שנתיים';
  18900. } else if (number % 10 === 0 && number !== 10) {
  18901. return number + ' שנה';
  18902. }
  18903. return number + ' שנים';
  18904. },
  18905. },
  18906. meridiemParse:
  18907. /אחה"צ|לפנה"צ|אחרי הצהריים|לפני הצהריים|לפנות בוקר|בבוקר|בערב/i,
  18908. isPM: function (input) {
  18909. return /^(אחה"צ|אחרי הצהריים|בערב)$/.test(input);
  18910. },
  18911. meridiem: function (hour, minute, isLower) {
  18912. if (hour < 5) {
  18913. return 'לפנות בוקר';
  18914. } else if (hour < 10) {
  18915. return 'בבוקר';
  18916. } else if (hour < 12) {
  18917. return isLower ? 'לפנה"צ' : 'לפני הצהריים';
  18918. } else if (hour < 18) {
  18919. return isLower ? 'אחה"צ' : 'אחרי הצהריים';
  18920. } else {
  18921. return 'בערב';
  18922. }
  18923. },
  18924. });
  18925. //! moment.js locale configuration
  18926. var symbolMap$8 = {
  18927. 1: '१',
  18928. 2: '२',
  18929. 3: '३',
  18930. 4: '४',
  18931. 5: '५',
  18932. 6: '६',
  18933. 7: '७',
  18934. 8: '८',
  18935. 9: '९',
  18936. 0: '०',
  18937. },
  18938. numberMap$7 = {
  18939. '१': '1',
  18940. '२': '2',
  18941. '३': '3',
  18942. '४': '4',
  18943. '५': '5',
  18944. '६': '6',
  18945. '७': '7',
  18946. '८': '8',
  18947. '९': '9',
  18948. '०': '0',
  18949. },
  18950. monthsParse$7 = [
  18951. /^जन/i,
  18952. /^फ़र|फर/i,
  18953. /^मार्च/i,
  18954. /^अप्रै/i,
  18955. /^मई/i,
  18956. /^जून/i,
  18957. /^जुल/i,
  18958. /^अग/i,
  18959. /^सितं|सित/i,
  18960. /^अक्टू/i,
  18961. /^नव|नवं/i,
  18962. /^दिसं|दिस/i,
  18963. ],
  18964. shortMonthsParse = [
  18965. /^जन/i,
  18966. /^फ़र/i,
  18967. /^मार्च/i,
  18968. /^अप्रै/i,
  18969. /^मई/i,
  18970. /^जून/i,
  18971. /^जुल/i,
  18972. /^अग/i,
  18973. /^सित/i,
  18974. /^अक्टू/i,
  18975. /^नव/i,
  18976. /^दिस/i,
  18977. ];
  18978. hooks.defineLocale('hi', {
  18979. months: {
  18980. format: 'जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर'.split(
  18981. '_'
  18982. ),
  18983. standalone:
  18984. 'जनवरी_फरवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितंबर_अक्टूबर_नवंबर_दिसंबर'.split(
  18985. '_'
  18986. ),
  18987. },
  18988. monthsShort:
  18989. 'जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.'.split('_'),
  18990. weekdays: 'रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'),
  18991. weekdaysShort: 'रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि'.split('_'),
  18992. weekdaysMin: 'र_सो_मं_बु_गु_शु_श'.split('_'),
  18993. longDateFormat: {
  18994. LT: 'A h:mm बजे',
  18995. LTS: 'A h:mm:ss बजे',
  18996. L: 'DD/MM/YYYY',
  18997. LL: 'D MMMM YYYY',
  18998. LLL: 'D MMMM YYYY, A h:mm बजे',
  18999. LLLL: 'dddd, D MMMM YYYY, A h:mm बजे',
  19000. },
  19001. monthsParse: monthsParse$7,
  19002. longMonthsParse: monthsParse$7,
  19003. shortMonthsParse: shortMonthsParse,
  19004. monthsRegex:
  19005. /^(जनवरी|जन\.?|फ़रवरी|फरवरी|फ़र\.?|मार्च?|अप्रैल|अप्रै\.?|मई?|जून?|जुलाई|जुल\.?|अगस्त|अग\.?|सितम्बर|सितंबर|सित\.?|अक्टूबर|अक्टू\.?|नवम्बर|नवंबर|नव\.?|दिसम्बर|दिसंबर|दिस\.?)/i,
  19006. monthsShortRegex:
  19007. /^(जनवरी|जन\.?|फ़रवरी|फरवरी|फ़र\.?|मार्च?|अप्रैल|अप्रै\.?|मई?|जून?|जुलाई|जुल\.?|अगस्त|अग\.?|सितम्बर|सितंबर|सित\.?|अक्टूबर|अक्टू\.?|नवम्बर|नवंबर|नव\.?|दिसम्बर|दिसंबर|दिस\.?)/i,
  19008. monthsStrictRegex:
  19009. /^(जनवरी?|फ़रवरी|फरवरी?|मार्च?|अप्रैल?|मई?|जून?|जुलाई?|अगस्त?|सितम्बर|सितंबर|सित?\.?|अक्टूबर|अक्टू\.?|नवम्बर|नवंबर?|दिसम्बर|दिसंबर?)/i,
  19010. monthsShortStrictRegex:
  19011. /^(जन\.?|फ़र\.?|मार्च?|अप्रै\.?|मई?|जून?|जुल\.?|अग\.?|सित\.?|अक्टू\.?|नव\.?|दिस\.?)/i,
  19012. calendar: {
  19013. sameDay: '[आज] LT',
  19014. nextDay: '[कल] LT',
  19015. nextWeek: 'dddd, LT',
  19016. lastDay: '[कल] LT',
  19017. lastWeek: '[पिछले] dddd, LT',
  19018. sameElse: 'L',
  19019. },
  19020. relativeTime: {
  19021. future: '%s में',
  19022. past: '%s पहले',
  19023. s: 'कुछ ही क्षण',
  19024. ss: '%d सेकंड',
  19025. m: 'एक मिनट',
  19026. mm: '%d मिनट',
  19027. h: 'एक घंटा',
  19028. hh: '%d घंटे',
  19029. d: 'एक दिन',
  19030. dd: '%d दिन',
  19031. M: 'एक महीने',
  19032. MM: '%d महीने',
  19033. y: 'एक वर्ष',
  19034. yy: '%d वर्ष',
  19035. },
  19036. preparse: function (string) {
  19037. return string.replace(/[१२३४५६७८९०]/g, function (match) {
  19038. return numberMap$7[match];
  19039. });
  19040. },
  19041. postformat: function (string) {
  19042. return string.replace(/\d/g, function (match) {
  19043. return symbolMap$8[match];
  19044. });
  19045. },
  19046. // Hindi notation for meridiems are quite fuzzy in practice. While there exists
  19047. // a rigid notion of a 'Pahar' it is not used as rigidly in modern Hindi.
  19048. meridiemParse: /रात|सुबह|दोपहर|शाम/,
  19049. meridiemHour: function (hour, meridiem) {
  19050. if (hour === 12) {
  19051. hour = 0;
  19052. }
  19053. if (meridiem === 'रात') {
  19054. return hour < 4 ? hour : hour + 12;
  19055. } else if (meridiem === 'सुबह') {
  19056. return hour;
  19057. } else if (meridiem === 'दोपहर') {
  19058. return hour >= 10 ? hour : hour + 12;
  19059. } else if (meridiem === 'शाम') {
  19060. return hour + 12;
  19061. }
  19062. },
  19063. meridiem: function (hour, minute, isLower) {
  19064. if (hour < 4) {
  19065. return 'रात';
  19066. } else if (hour < 10) {
  19067. return 'सुबह';
  19068. } else if (hour < 17) {
  19069. return 'दोपहर';
  19070. } else if (hour < 20) {
  19071. return 'शाम';
  19072. } else {
  19073. return 'रात';
  19074. }
  19075. },
  19076. week: {
  19077. dow: 0, // Sunday is the first day of the week.
  19078. doy: 6, // The week that contains Jan 6th is the first week of the year.
  19079. },
  19080. });
  19081. //! moment.js locale configuration
  19082. function translate$3(number, withoutSuffix, key) {
  19083. var result = number + ' ';
  19084. switch (key) {
  19085. case 'ss':
  19086. if (number === 1) {
  19087. result += 'sekunda';
  19088. } else if (number === 2 || number === 3 || number === 4) {
  19089. result += 'sekunde';
  19090. } else {
  19091. result += 'sekundi';
  19092. }
  19093. return result;
  19094. case 'm':
  19095. return withoutSuffix ? 'jedna minuta' : 'jedne minute';
  19096. case 'mm':
  19097. if (number === 1) {
  19098. result += 'minuta';
  19099. } else if (number === 2 || number === 3 || number === 4) {
  19100. result += 'minute';
  19101. } else {
  19102. result += 'minuta';
  19103. }
  19104. return result;
  19105. case 'h':
  19106. return withoutSuffix ? 'jedan sat' : 'jednog sata';
  19107. case 'hh':
  19108. if (number === 1) {
  19109. result += 'sat';
  19110. } else if (number === 2 || number === 3 || number === 4) {
  19111. result += 'sata';
  19112. } else {
  19113. result += 'sati';
  19114. }
  19115. return result;
  19116. case 'dd':
  19117. if (number === 1) {
  19118. result += 'dan';
  19119. } else {
  19120. result += 'dana';
  19121. }
  19122. return result;
  19123. case 'MM':
  19124. if (number === 1) {
  19125. result += 'mjesec';
  19126. } else if (number === 2 || number === 3 || number === 4) {
  19127. result += 'mjeseca';
  19128. } else {
  19129. result += 'mjeseci';
  19130. }
  19131. return result;
  19132. case 'yy':
  19133. if (number === 1) {
  19134. result += 'godina';
  19135. } else if (number === 2 || number === 3 || number === 4) {
  19136. result += 'godine';
  19137. } else {
  19138. result += 'godina';
  19139. }
  19140. return result;
  19141. }
  19142. }
  19143. hooks.defineLocale('hr', {
  19144. months: {
  19145. format: 'siječnja_veljače_ožujka_travnja_svibnja_lipnja_srpnja_kolovoza_rujna_listopada_studenoga_prosinca'.split(
  19146. '_'
  19147. ),
  19148. standalone:
  19149. 'siječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac'.split(
  19150. '_'
  19151. ),
  19152. },
  19153. monthsShort:
  19154. 'sij._velj._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.'.split(
  19155. '_'
  19156. ),
  19157. monthsParseExact: true,
  19158. weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split(
  19159. '_'
  19160. ),
  19161. weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'),
  19162. weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'),
  19163. weekdaysParseExact: true,
  19164. longDateFormat: {
  19165. LT: 'H:mm',
  19166. LTS: 'H:mm:ss',
  19167. L: 'DD.MM.YYYY',
  19168. LL: 'Do MMMM YYYY',
  19169. LLL: 'Do MMMM YYYY H:mm',
  19170. LLLL: 'dddd, Do MMMM YYYY H:mm',
  19171. },
  19172. calendar: {
  19173. sameDay: '[danas u] LT',
  19174. nextDay: '[sutra u] LT',
  19175. nextWeek: function () {
  19176. switch (this.day()) {
  19177. case 0:
  19178. return '[u] [nedjelju] [u] LT';
  19179. case 3:
  19180. return '[u] [srijedu] [u] LT';
  19181. case 6:
  19182. return '[u] [subotu] [u] LT';
  19183. case 1:
  19184. case 2:
  19185. case 4:
  19186. case 5:
  19187. return '[u] dddd [u] LT';
  19188. }
  19189. },
  19190. lastDay: '[jučer u] LT',
  19191. lastWeek: function () {
  19192. switch (this.day()) {
  19193. case 0:
  19194. return '[prošlu] [nedjelju] [u] LT';
  19195. case 3:
  19196. return '[prošlu] [srijedu] [u] LT';
  19197. case 6:
  19198. return '[prošle] [subote] [u] LT';
  19199. case 1:
  19200. case 2:
  19201. case 4:
  19202. case 5:
  19203. return '[prošli] dddd [u] LT';
  19204. }
  19205. },
  19206. sameElse: 'L',
  19207. },
  19208. relativeTime: {
  19209. future: 'za %s',
  19210. past: 'prije %s',
  19211. s: 'par sekundi',
  19212. ss: translate$3,
  19213. m: translate$3,
  19214. mm: translate$3,
  19215. h: translate$3,
  19216. hh: translate$3,
  19217. d: 'dan',
  19218. dd: translate$3,
  19219. M: 'mjesec',
  19220. MM: translate$3,
  19221. y: 'godinu',
  19222. yy: translate$3,
  19223. },
  19224. dayOfMonthOrdinalParse: /\d{1,2}\./,
  19225. ordinal: '%d.',
  19226. week: {
  19227. dow: 1, // Monday is the first day of the week.
  19228. doy: 7, // The week that contains Jan 7th is the first week of the year.
  19229. },
  19230. });
  19231. //! moment.js locale configuration
  19232. var weekEndings =
  19233. 'vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton'.split(' ');
  19234. function translate$4(number, withoutSuffix, key, isFuture) {
  19235. var num = number;
  19236. switch (key) {
  19237. case 's':
  19238. return isFuture || withoutSuffix
  19239. ? 'néhány másodperc'
  19240. : 'néhány másodperce';
  19241. case 'ss':
  19242. return num + (isFuture || withoutSuffix)
  19243. ? ' másodperc'
  19244. : ' másodperce';
  19245. case 'm':
  19246. return 'egy' + (isFuture || withoutSuffix ? ' perc' : ' perce');
  19247. case 'mm':
  19248. return num + (isFuture || withoutSuffix ? ' perc' : ' perce');
  19249. case 'h':
  19250. return 'egy' + (isFuture || withoutSuffix ? ' óra' : ' órája');
  19251. case 'hh':
  19252. return num + (isFuture || withoutSuffix ? ' óra' : ' órája');
  19253. case 'd':
  19254. return 'egy' + (isFuture || withoutSuffix ? ' nap' : ' napja');
  19255. case 'dd':
  19256. return num + (isFuture || withoutSuffix ? ' nap' : ' napja');
  19257. case 'M':
  19258. return 'egy' + (isFuture || withoutSuffix ? ' hónap' : ' hónapja');
  19259. case 'MM':
  19260. return num + (isFuture || withoutSuffix ? ' hónap' : ' hónapja');
  19261. case 'y':
  19262. return 'egy' + (isFuture || withoutSuffix ? ' év' : ' éve');
  19263. case 'yy':
  19264. return num + (isFuture || withoutSuffix ? ' év' : ' éve');
  19265. }
  19266. return '';
  19267. }
  19268. function week(isFuture) {
  19269. return (
  19270. (isFuture ? '' : '[múlt] ') +
  19271. '[' +
  19272. weekEndings[this.day()] +
  19273. '] LT[-kor]'
  19274. );
  19275. }
  19276. hooks.defineLocale('hu', {
  19277. months: 'január_február_március_április_május_június_július_augusztus_szeptember_október_november_december'.split(
  19278. '_'
  19279. ),
  19280. monthsShort:
  19281. 'jan._feb._márc._ápr._máj._jún._júl._aug._szept._okt._nov._dec.'.split(
  19282. '_'
  19283. ),
  19284. monthsParseExact: true,
  19285. weekdays: 'vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat'.split('_'),
  19286. weekdaysShort: 'vas_hét_kedd_sze_csüt_pén_szo'.split('_'),
  19287. weekdaysMin: 'v_h_k_sze_cs_p_szo'.split('_'),
  19288. longDateFormat: {
  19289. LT: 'H:mm',
  19290. LTS: 'H:mm:ss',
  19291. L: 'YYYY.MM.DD.',
  19292. LL: 'YYYY. MMMM D.',
  19293. LLL: 'YYYY. MMMM D. H:mm',
  19294. LLLL: 'YYYY. MMMM D., dddd H:mm',
  19295. },
  19296. meridiemParse: /de|du/i,
  19297. isPM: function (input) {
  19298. return input.charAt(1).toLowerCase() === 'u';
  19299. },
  19300. meridiem: function (hours, minutes, isLower) {
  19301. if (hours < 12) {
  19302. return isLower === true ? 'de' : 'DE';
  19303. } else {
  19304. return isLower === true ? 'du' : 'DU';
  19305. }
  19306. },
  19307. calendar: {
  19308. sameDay: '[ma] LT[-kor]',
  19309. nextDay: '[holnap] LT[-kor]',
  19310. nextWeek: function () {
  19311. return week.call(this, true);
  19312. },
  19313. lastDay: '[tegnap] LT[-kor]',
  19314. lastWeek: function () {
  19315. return week.call(this, false);
  19316. },
  19317. sameElse: 'L',
  19318. },
  19319. relativeTime: {
  19320. future: '%s múlva',
  19321. past: '%s',
  19322. s: translate$4,
  19323. ss: translate$4,
  19324. m: translate$4,
  19325. mm: translate$4,
  19326. h: translate$4,
  19327. hh: translate$4,
  19328. d: translate$4,
  19329. dd: translate$4,
  19330. M: translate$4,
  19331. MM: translate$4,
  19332. y: translate$4,
  19333. yy: translate$4,
  19334. },
  19335. dayOfMonthOrdinalParse: /\d{1,2}\./,
  19336. ordinal: '%d.',
  19337. week: {
  19338. dow: 1, // Monday is the first day of the week.
  19339. doy: 4, // The week that contains Jan 4th is the first week of the year.
  19340. },
  19341. });
  19342. //! moment.js locale configuration
  19343. hooks.defineLocale('hy-am', {
  19344. months: {
  19345. format: 'հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի'.split(
  19346. '_'
  19347. ),
  19348. standalone:
  19349. 'հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր'.split(
  19350. '_'
  19351. ),
  19352. },
  19353. monthsShort: 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_'),
  19354. weekdays:
  19355. 'կիրակի_երկուշաբթի_երեքշաբթի_չորեքշաբթի_հինգշաբթի_ուրբաթ_շաբաթ'.split(
  19356. '_'
  19357. ),
  19358. weekdaysShort: 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'),
  19359. weekdaysMin: 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'),
  19360. longDateFormat: {
  19361. LT: 'HH:mm',
  19362. LTS: 'HH:mm:ss',
  19363. L: 'DD.MM.YYYY',
  19364. LL: 'D MMMM YYYY թ.',
  19365. LLL: 'D MMMM YYYY թ., HH:mm',
  19366. LLLL: 'dddd, D MMMM YYYY թ., HH:mm',
  19367. },
  19368. calendar: {
  19369. sameDay: '[այսօր] LT',
  19370. nextDay: '[վաղը] LT',
  19371. lastDay: '[երեկ] LT',
  19372. nextWeek: function () {
  19373. return 'dddd [օրը ժամը] LT';
  19374. },
  19375. lastWeek: function () {
  19376. return '[անցած] dddd [օրը ժամը] LT';
  19377. },
  19378. sameElse: 'L',
  19379. },
  19380. relativeTime: {
  19381. future: '%s հետո',
  19382. past: '%s առաջ',
  19383. s: 'մի քանի վայրկյան',
  19384. ss: '%d վայրկյան',
  19385. m: 'րոպե',
  19386. mm: '%d րոպե',
  19387. h: 'ժամ',
  19388. hh: '%d ժամ',
  19389. d: 'օր',
  19390. dd: '%d օր',
  19391. M: 'ամիս',
  19392. MM: '%d ամիս',
  19393. y: 'տարի',
  19394. yy: '%d տարի',
  19395. },
  19396. meridiemParse: /գիշերվա|առավոտվա|ցերեկվա|երեկոյան/,
  19397. isPM: function (input) {
  19398. return /^(ցերեկվա|երեկոյան)$/.test(input);
  19399. },
  19400. meridiem: function (hour) {
  19401. if (hour < 4) {
  19402. return 'գիշերվա';
  19403. } else if (hour < 12) {
  19404. return 'առավոտվա';
  19405. } else if (hour < 17) {
  19406. return 'ցերեկվա';
  19407. } else {
  19408. return 'երեկոյան';
  19409. }
  19410. },
  19411. dayOfMonthOrdinalParse: /\d{1,2}|\d{1,2}-(ին|րդ)/,
  19412. ordinal: function (number, period) {
  19413. switch (period) {
  19414. case 'DDD':
  19415. case 'w':
  19416. case 'W':
  19417. case 'DDDo':
  19418. if (number === 1) {
  19419. return number + '-ին';
  19420. }
  19421. return number + '-րդ';
  19422. default:
  19423. return number;
  19424. }
  19425. },
  19426. week: {
  19427. dow: 1, // Monday is the first day of the week.
  19428. doy: 7, // The week that contains Jan 7th is the first week of the year.
  19429. },
  19430. });
  19431. //! moment.js locale configuration
  19432. hooks.defineLocale('id', {
  19433. months: 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember'.split(
  19434. '_'
  19435. ),
  19436. monthsShort: 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Agt_Sep_Okt_Nov_Des'.split('_'),
  19437. weekdays: 'Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu'.split('_'),
  19438. weekdaysShort: 'Min_Sen_Sel_Rab_Kam_Jum_Sab'.split('_'),
  19439. weekdaysMin: 'Mg_Sn_Sl_Rb_Km_Jm_Sb'.split('_'),
  19440. longDateFormat: {
  19441. LT: 'HH.mm',
  19442. LTS: 'HH.mm.ss',
  19443. L: 'DD/MM/YYYY',
  19444. LL: 'D MMMM YYYY',
  19445. LLL: 'D MMMM YYYY [pukul] HH.mm',
  19446. LLLL: 'dddd, D MMMM YYYY [pukul] HH.mm',
  19447. },
  19448. meridiemParse: /pagi|siang|sore|malam/,
  19449. meridiemHour: function (hour, meridiem) {
  19450. if (hour === 12) {
  19451. hour = 0;
  19452. }
  19453. if (meridiem === 'pagi') {
  19454. return hour;
  19455. } else if (meridiem === 'siang') {
  19456. return hour >= 11 ? hour : hour + 12;
  19457. } else if (meridiem === 'sore' || meridiem === 'malam') {
  19458. return hour + 12;
  19459. }
  19460. },
  19461. meridiem: function (hours, minutes, isLower) {
  19462. if (hours < 11) {
  19463. return 'pagi';
  19464. } else if (hours < 15) {
  19465. return 'siang';
  19466. } else if (hours < 19) {
  19467. return 'sore';
  19468. } else {
  19469. return 'malam';
  19470. }
  19471. },
  19472. calendar: {
  19473. sameDay: '[Hari ini pukul] LT',
  19474. nextDay: '[Besok pukul] LT',
  19475. nextWeek: 'dddd [pukul] LT',
  19476. lastDay: '[Kemarin pukul] LT',
  19477. lastWeek: 'dddd [lalu pukul] LT',
  19478. sameElse: 'L',
  19479. },
  19480. relativeTime: {
  19481. future: 'dalam %s',
  19482. past: '%s yang lalu',
  19483. s: 'beberapa detik',
  19484. ss: '%d detik',
  19485. m: 'semenit',
  19486. mm: '%d menit',
  19487. h: 'sejam',
  19488. hh: '%d jam',
  19489. d: 'sehari',
  19490. dd: '%d hari',
  19491. M: 'sebulan',
  19492. MM: '%d bulan',
  19493. y: 'setahun',
  19494. yy: '%d tahun',
  19495. },
  19496. week: {
  19497. dow: 0, // Sunday is the first day of the week.
  19498. doy: 6, // The week that contains Jan 6th is the first week of the year.
  19499. },
  19500. });
  19501. //! moment.js locale configuration
  19502. function plural$2(n) {
  19503. if (n % 100 === 11) {
  19504. return true;
  19505. } else if (n % 10 === 1) {
  19506. return false;
  19507. }
  19508. return true;
  19509. }
  19510. function translate$5(number, withoutSuffix, key, isFuture) {
  19511. var result = number + ' ';
  19512. switch (key) {
  19513. case 's':
  19514. return withoutSuffix || isFuture
  19515. ? 'nokkrar sekúndur'
  19516. : 'nokkrum sekúndum';
  19517. case 'ss':
  19518. if (plural$2(number)) {
  19519. return (
  19520. result +
  19521. (withoutSuffix || isFuture ? 'sekúndur' : 'sekúndum')
  19522. );
  19523. }
  19524. return result + 'sekúnda';
  19525. case 'm':
  19526. return withoutSuffix ? 'mínúta' : 'mínútu';
  19527. case 'mm':
  19528. if (plural$2(number)) {
  19529. return (
  19530. result + (withoutSuffix || isFuture ? 'mínútur' : 'mínútum')
  19531. );
  19532. } else if (withoutSuffix) {
  19533. return result + 'mínúta';
  19534. }
  19535. return result + 'mínútu';
  19536. case 'hh':
  19537. if (plural$2(number)) {
  19538. return (
  19539. result +
  19540. (withoutSuffix || isFuture
  19541. ? 'klukkustundir'
  19542. : 'klukkustundum')
  19543. );
  19544. }
  19545. return result + 'klukkustund';
  19546. case 'd':
  19547. if (withoutSuffix) {
  19548. return 'dagur';
  19549. }
  19550. return isFuture ? 'dag' : 'degi';
  19551. case 'dd':
  19552. if (plural$2(number)) {
  19553. if (withoutSuffix) {
  19554. return result + 'dagar';
  19555. }
  19556. return result + (isFuture ? 'daga' : 'dögum');
  19557. } else if (withoutSuffix) {
  19558. return result + 'dagur';
  19559. }
  19560. return result + (isFuture ? 'dag' : 'degi');
  19561. case 'M':
  19562. if (withoutSuffix) {
  19563. return 'mánuður';
  19564. }
  19565. return isFuture ? 'mánuð' : 'mánuði';
  19566. case 'MM':
  19567. if (plural$2(number)) {
  19568. if (withoutSuffix) {
  19569. return result + 'mánuðir';
  19570. }
  19571. return result + (isFuture ? 'mánuði' : 'mánuðum');
  19572. } else if (withoutSuffix) {
  19573. return result + 'mánuður';
  19574. }
  19575. return result + (isFuture ? 'mánuð' : 'mánuði');
  19576. case 'y':
  19577. return withoutSuffix || isFuture ? 'ár' : 'ári';
  19578. case 'yy':
  19579. if (plural$2(number)) {
  19580. return result + (withoutSuffix || isFuture ? 'ár' : 'árum');
  19581. }
  19582. return result + (withoutSuffix || isFuture ? 'ár' : 'ári');
  19583. }
  19584. }
  19585. hooks.defineLocale('is', {
  19586. months: 'janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember'.split(
  19587. '_'
  19588. ),
  19589. monthsShort: 'jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des'.split('_'),
  19590. weekdays:
  19591. 'sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur'.split(
  19592. '_'
  19593. ),
  19594. weekdaysShort: 'sun_mán_þri_mið_fim_fös_lau'.split('_'),
  19595. weekdaysMin: 'Su_Má_Þr_Mi_Fi_Fö_La'.split('_'),
  19596. longDateFormat: {
  19597. LT: 'H:mm',
  19598. LTS: 'H:mm:ss',
  19599. L: 'DD.MM.YYYY',
  19600. LL: 'D. MMMM YYYY',
  19601. LLL: 'D. MMMM YYYY [kl.] H:mm',
  19602. LLLL: 'dddd, D. MMMM YYYY [kl.] H:mm',
  19603. },
  19604. calendar: {
  19605. sameDay: '[í dag kl.] LT',
  19606. nextDay: '[á morgun kl.] LT',
  19607. nextWeek: 'dddd [kl.] LT',
  19608. lastDay: '[í gær kl.] LT',
  19609. lastWeek: '[síðasta] dddd [kl.] LT',
  19610. sameElse: 'L',
  19611. },
  19612. relativeTime: {
  19613. future: 'eftir %s',
  19614. past: 'fyrir %s síðan',
  19615. s: translate$5,
  19616. ss: translate$5,
  19617. m: translate$5,
  19618. mm: translate$5,
  19619. h: 'klukkustund',
  19620. hh: translate$5,
  19621. d: translate$5,
  19622. dd: translate$5,
  19623. M: translate$5,
  19624. MM: translate$5,
  19625. y: translate$5,
  19626. yy: translate$5,
  19627. },
  19628. dayOfMonthOrdinalParse: /\d{1,2}\./,
  19629. ordinal: '%d.',
  19630. week: {
  19631. dow: 1, // Monday is the first day of the week.
  19632. doy: 4, // The week that contains Jan 4th is the first week of the year.
  19633. },
  19634. });
  19635. //! moment.js locale configuration
  19636. hooks.defineLocale('it-ch', {
  19637. months: 'gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre'.split(
  19638. '_'
  19639. ),
  19640. monthsShort: 'gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic'.split('_'),
  19641. weekdays: 'domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato'.split(
  19642. '_'
  19643. ),
  19644. weekdaysShort: 'dom_lun_mar_mer_gio_ven_sab'.split('_'),
  19645. weekdaysMin: 'do_lu_ma_me_gi_ve_sa'.split('_'),
  19646. longDateFormat: {
  19647. LT: 'HH:mm',
  19648. LTS: 'HH:mm:ss',
  19649. L: 'DD.MM.YYYY',
  19650. LL: 'D MMMM YYYY',
  19651. LLL: 'D MMMM YYYY HH:mm',
  19652. LLLL: 'dddd D MMMM YYYY HH:mm',
  19653. },
  19654. calendar: {
  19655. sameDay: '[Oggi alle] LT',
  19656. nextDay: '[Domani alle] LT',
  19657. nextWeek: 'dddd [alle] LT',
  19658. lastDay: '[Ieri alle] LT',
  19659. lastWeek: function () {
  19660. switch (this.day()) {
  19661. case 0:
  19662. return '[la scorsa] dddd [alle] LT';
  19663. default:
  19664. return '[lo scorso] dddd [alle] LT';
  19665. }
  19666. },
  19667. sameElse: 'L',
  19668. },
  19669. relativeTime: {
  19670. future: function (s) {
  19671. return (/^[0-9].+$/.test(s) ? 'tra' : 'in') + ' ' + s;
  19672. },
  19673. past: '%s fa',
  19674. s: 'alcuni secondi',
  19675. ss: '%d secondi',
  19676. m: 'un minuto',
  19677. mm: '%d minuti',
  19678. h: "un'ora",
  19679. hh: '%d ore',
  19680. d: 'un giorno',
  19681. dd: '%d giorni',
  19682. M: 'un mese',
  19683. MM: '%d mesi',
  19684. y: 'un anno',
  19685. yy: '%d anni',
  19686. },
  19687. dayOfMonthOrdinalParse: /\d{1,2}º/,
  19688. ordinal: '%dº',
  19689. week: {
  19690. dow: 1, // Monday is the first day of the week.
  19691. doy: 4, // The week that contains Jan 4th is the first week of the year.
  19692. },
  19693. });
  19694. //! moment.js locale configuration
  19695. hooks.defineLocale('it', {
  19696. months: 'gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre'.split(
  19697. '_'
  19698. ),
  19699. monthsShort: 'gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic'.split('_'),
  19700. weekdays: 'domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato'.split(
  19701. '_'
  19702. ),
  19703. weekdaysShort: 'dom_lun_mar_mer_gio_ven_sab'.split('_'),
  19704. weekdaysMin: 'do_lu_ma_me_gi_ve_sa'.split('_'),
  19705. longDateFormat: {
  19706. LT: 'HH:mm',
  19707. LTS: 'HH:mm:ss',
  19708. L: 'DD/MM/YYYY',
  19709. LL: 'D MMMM YYYY',
  19710. LLL: 'D MMMM YYYY HH:mm',
  19711. LLLL: 'dddd D MMMM YYYY HH:mm',
  19712. },
  19713. calendar: {
  19714. sameDay: function () {
  19715. return (
  19716. '[Oggi a' +
  19717. (this.hours() > 1 ? 'lle ' : this.hours() === 0 ? ' ' : "ll'") +
  19718. ']LT'
  19719. );
  19720. },
  19721. nextDay: function () {
  19722. return (
  19723. '[Domani a' +
  19724. (this.hours() > 1 ? 'lle ' : this.hours() === 0 ? ' ' : "ll'") +
  19725. ']LT'
  19726. );
  19727. },
  19728. nextWeek: function () {
  19729. return (
  19730. 'dddd [a' +
  19731. (this.hours() > 1 ? 'lle ' : this.hours() === 0 ? ' ' : "ll'") +
  19732. ']LT'
  19733. );
  19734. },
  19735. lastDay: function () {
  19736. return (
  19737. '[Ieri a' +
  19738. (this.hours() > 1 ? 'lle ' : this.hours() === 0 ? ' ' : "ll'") +
  19739. ']LT'
  19740. );
  19741. },
  19742. lastWeek: function () {
  19743. switch (this.day()) {
  19744. case 0:
  19745. return (
  19746. '[La scorsa] dddd [a' +
  19747. (this.hours() > 1
  19748. ? 'lle '
  19749. : this.hours() === 0
  19750. ? ' '
  19751. : "ll'") +
  19752. ']LT'
  19753. );
  19754. default:
  19755. return (
  19756. '[Lo scorso] dddd [a' +
  19757. (this.hours() > 1
  19758. ? 'lle '
  19759. : this.hours() === 0
  19760. ? ' '
  19761. : "ll'") +
  19762. ']LT'
  19763. );
  19764. }
  19765. },
  19766. sameElse: 'L',
  19767. },
  19768. relativeTime: {
  19769. future: 'tra %s',
  19770. past: '%s fa',
  19771. s: 'alcuni secondi',
  19772. ss: '%d secondi',
  19773. m: 'un minuto',
  19774. mm: '%d minuti',
  19775. h: "un'ora",
  19776. hh: '%d ore',
  19777. d: 'un giorno',
  19778. dd: '%d giorni',
  19779. w: 'una settimana',
  19780. ww: '%d settimane',
  19781. M: 'un mese',
  19782. MM: '%d mesi',
  19783. y: 'un anno',
  19784. yy: '%d anni',
  19785. },
  19786. dayOfMonthOrdinalParse: /\d{1,2}º/,
  19787. ordinal: '%dº',
  19788. week: {
  19789. dow: 1, // Monday is the first day of the week.
  19790. doy: 4, // The week that contains Jan 4th is the first week of the year.
  19791. },
  19792. });
  19793. //! moment.js locale configuration
  19794. hooks.defineLocale('ja', {
  19795. eras: [
  19796. {
  19797. since: '2019-05-01',
  19798. offset: 1,
  19799. name: '令和',
  19800. narrow: '㋿',
  19801. abbr: 'R',
  19802. },
  19803. {
  19804. since: '1989-01-08',
  19805. until: '2019-04-30',
  19806. offset: 1,
  19807. name: '平成',
  19808. narrow: '㍻',
  19809. abbr: 'H',
  19810. },
  19811. {
  19812. since: '1926-12-25',
  19813. until: '1989-01-07',
  19814. offset: 1,
  19815. name: '昭和',
  19816. narrow: '㍼',
  19817. abbr: 'S',
  19818. },
  19819. {
  19820. since: '1912-07-30',
  19821. until: '1926-12-24',
  19822. offset: 1,
  19823. name: '大正',
  19824. narrow: '㍽',
  19825. abbr: 'T',
  19826. },
  19827. {
  19828. since: '1873-01-01',
  19829. until: '1912-07-29',
  19830. offset: 6,
  19831. name: '明治',
  19832. narrow: '㍾',
  19833. abbr: 'M',
  19834. },
  19835. {
  19836. since: '0001-01-01',
  19837. until: '1873-12-31',
  19838. offset: 1,
  19839. name: '西暦',
  19840. narrow: 'AD',
  19841. abbr: 'AD',
  19842. },
  19843. {
  19844. since: '0000-12-31',
  19845. until: -Infinity,
  19846. offset: 1,
  19847. name: '紀元前',
  19848. narrow: 'BC',
  19849. abbr: 'BC',
  19850. },
  19851. ],
  19852. eraYearOrdinalRegex: /(元|\d+)年/,
  19853. eraYearOrdinalParse: function (input, match) {
  19854. return match[1] === '元' ? 1 : parseInt(match[1] || input, 10);
  19855. },
  19856. months: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
  19857. monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split(
  19858. '_'
  19859. ),
  19860. weekdays: '日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日'.split('_'),
  19861. weekdaysShort: '日_月_火_水_木_金_土'.split('_'),
  19862. weekdaysMin: '日_月_火_水_木_金_土'.split('_'),
  19863. longDateFormat: {
  19864. LT: 'HH:mm',
  19865. LTS: 'HH:mm:ss',
  19866. L: 'YYYY/MM/DD',
  19867. LL: 'YYYY年M月D日',
  19868. LLL: 'YYYY年M月D日 HH:mm',
  19869. LLLL: 'YYYY年M月D日 dddd HH:mm',
  19870. l: 'YYYY/MM/DD',
  19871. ll: 'YYYY年M月D日',
  19872. lll: 'YYYY年M月D日 HH:mm',
  19873. llll: 'YYYY年M月D日(ddd) HH:mm',
  19874. },
  19875. meridiemParse: /午前|午後/i,
  19876. isPM: function (input) {
  19877. return input === '午後';
  19878. },
  19879. meridiem: function (hour, minute, isLower) {
  19880. if (hour < 12) {
  19881. return '午前';
  19882. } else {
  19883. return '午後';
  19884. }
  19885. },
  19886. calendar: {
  19887. sameDay: '[今日] LT',
  19888. nextDay: '[明日] LT',
  19889. nextWeek: function (now) {
  19890. if (now.week() !== this.week()) {
  19891. return '[来週]dddd LT';
  19892. } else {
  19893. return 'dddd LT';
  19894. }
  19895. },
  19896. lastDay: '[昨日] LT',
  19897. lastWeek: function (now) {
  19898. if (this.week() !== now.week()) {
  19899. return '[先週]dddd LT';
  19900. } else {
  19901. return 'dddd LT';
  19902. }
  19903. },
  19904. sameElse: 'L',
  19905. },
  19906. dayOfMonthOrdinalParse: /\d{1,2}日/,
  19907. ordinal: function (number, period) {
  19908. switch (period) {
  19909. case 'y':
  19910. return number === 1 ? '元年' : number + '年';
  19911. case 'd':
  19912. case 'D':
  19913. case 'DDD':
  19914. return number + '日';
  19915. default:
  19916. return number;
  19917. }
  19918. },
  19919. relativeTime: {
  19920. future: '%s後',
  19921. past: '%s前',
  19922. s: '数秒',
  19923. ss: '%d秒',
  19924. m: '1分',
  19925. mm: '%d分',
  19926. h: '1時間',
  19927. hh: '%d時間',
  19928. d: '1日',
  19929. dd: '%d日',
  19930. M: '1ヶ月',
  19931. MM: '%dヶ月',
  19932. y: '1年',
  19933. yy: '%d年',
  19934. },
  19935. });
  19936. //! moment.js locale configuration
  19937. hooks.defineLocale('jv', {
  19938. months: 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_Nopember_Desember'.split(
  19939. '_'
  19940. ),
  19941. monthsShort: 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nop_Des'.split('_'),
  19942. weekdays: 'Minggu_Senen_Seloso_Rebu_Kemis_Jemuwah_Septu'.split('_'),
  19943. weekdaysShort: 'Min_Sen_Sel_Reb_Kem_Jem_Sep'.split('_'),
  19944. weekdaysMin: 'Mg_Sn_Sl_Rb_Km_Jm_Sp'.split('_'),
  19945. longDateFormat: {
  19946. LT: 'HH.mm',
  19947. LTS: 'HH.mm.ss',
  19948. L: 'DD/MM/YYYY',
  19949. LL: 'D MMMM YYYY',
  19950. LLL: 'D MMMM YYYY [pukul] HH.mm',
  19951. LLLL: 'dddd, D MMMM YYYY [pukul] HH.mm',
  19952. },
  19953. meridiemParse: /enjing|siyang|sonten|ndalu/,
  19954. meridiemHour: function (hour, meridiem) {
  19955. if (hour === 12) {
  19956. hour = 0;
  19957. }
  19958. if (meridiem === 'enjing') {
  19959. return hour;
  19960. } else if (meridiem === 'siyang') {
  19961. return hour >= 11 ? hour : hour + 12;
  19962. } else if (meridiem === 'sonten' || meridiem === 'ndalu') {
  19963. return hour + 12;
  19964. }
  19965. },
  19966. meridiem: function (hours, minutes, isLower) {
  19967. if (hours < 11) {
  19968. return 'enjing';
  19969. } else if (hours < 15) {
  19970. return 'siyang';
  19971. } else if (hours < 19) {
  19972. return 'sonten';
  19973. } else {
  19974. return 'ndalu';
  19975. }
  19976. },
  19977. calendar: {
  19978. sameDay: '[Dinten puniko pukul] LT',
  19979. nextDay: '[Mbenjang pukul] LT',
  19980. nextWeek: 'dddd [pukul] LT',
  19981. lastDay: '[Kala wingi pukul] LT',
  19982. lastWeek: 'dddd [kepengker pukul] LT',
  19983. sameElse: 'L',
  19984. },
  19985. relativeTime: {
  19986. future: 'wonten ing %s',
  19987. past: '%s ingkang kepengker',
  19988. s: 'sawetawis detik',
  19989. ss: '%d detik',
  19990. m: 'setunggal menit',
  19991. mm: '%d menit',
  19992. h: 'setunggal jam',
  19993. hh: '%d jam',
  19994. d: 'sedinten',
  19995. dd: '%d dinten',
  19996. M: 'sewulan',
  19997. MM: '%d wulan',
  19998. y: 'setaun',
  19999. yy: '%d taun',
  20000. },
  20001. week: {
  20002. dow: 1, // Monday is the first day of the week.
  20003. doy: 7, // The week that contains Jan 7th is the first week of the year.
  20004. },
  20005. });
  20006. //! moment.js locale configuration
  20007. hooks.defineLocale('ka', {
  20008. months: 'იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი'.split(
  20009. '_'
  20010. ),
  20011. monthsShort: 'იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ'.split('_'),
  20012. weekdays: {
  20013. standalone:
  20014. 'კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი'.split(
  20015. '_'
  20016. ),
  20017. format: 'კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს'.split(
  20018. '_'
  20019. ),
  20020. isFormat: /(წინა|შემდეგ)/,
  20021. },
  20022. weekdaysShort: 'კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ'.split('_'),
  20023. weekdaysMin: 'კვ_ორ_სა_ოთ_ხუ_პა_შა'.split('_'),
  20024. longDateFormat: {
  20025. LT: 'HH:mm',
  20026. LTS: 'HH:mm:ss',
  20027. L: 'DD/MM/YYYY',
  20028. LL: 'D MMMM YYYY',
  20029. LLL: 'D MMMM YYYY HH:mm',
  20030. LLLL: 'dddd, D MMMM YYYY HH:mm',
  20031. },
  20032. calendar: {
  20033. sameDay: '[დღეს] LT[-ზე]',
  20034. nextDay: '[ხვალ] LT[-ზე]',
  20035. lastDay: '[გუშინ] LT[-ზე]',
  20036. nextWeek: '[შემდეგ] dddd LT[-ზე]',
  20037. lastWeek: '[წინა] dddd LT-ზე',
  20038. sameElse: 'L',
  20039. },
  20040. relativeTime: {
  20041. future: function (s) {
  20042. return s.replace(
  20043. /(წამ|წუთ|საათ|წელ|დღ|თვ)(ი|ე)/,
  20044. function ($0, $1, $2) {
  20045. return $2 === 'ი' ? $1 + 'ში' : $1 + $2 + 'ში';
  20046. }
  20047. );
  20048. },
  20049. past: function (s) {
  20050. if (/(წამი|წუთი|საათი|დღე|თვე)/.test(s)) {
  20051. return s.replace(/(ი|ე)$/, 'ის წინ');
  20052. }
  20053. if (/წელი/.test(s)) {
  20054. return s.replace(/წელი$/, 'წლის წინ');
  20055. }
  20056. return s;
  20057. },
  20058. s: 'რამდენიმე წამი',
  20059. ss: '%d წამი',
  20060. m: 'წუთი',
  20061. mm: '%d წუთი',
  20062. h: 'საათი',
  20063. hh: '%d საათი',
  20064. d: 'დღე',
  20065. dd: '%d დღე',
  20066. M: 'თვე',
  20067. MM: '%d თვე',
  20068. y: 'წელი',
  20069. yy: '%d წელი',
  20070. },
  20071. dayOfMonthOrdinalParse: /0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/,
  20072. ordinal: function (number) {
  20073. if (number === 0) {
  20074. return number;
  20075. }
  20076. if (number === 1) {
  20077. return number + '-ლი';
  20078. }
  20079. if (
  20080. number < 20 ||
  20081. (number <= 100 && number % 20 === 0) ||
  20082. number % 100 === 0
  20083. ) {
  20084. return 'მე-' + number;
  20085. }
  20086. return number + '-ე';
  20087. },
  20088. week: {
  20089. dow: 1,
  20090. doy: 7,
  20091. },
  20092. });
  20093. //! moment.js locale configuration
  20094. var suffixes$1 = {
  20095. 0: '-ші',
  20096. 1: '-ші',
  20097. 2: '-ші',
  20098. 3: '-ші',
  20099. 4: '-ші',
  20100. 5: '-ші',
  20101. 6: '-шы',
  20102. 7: '-ші',
  20103. 8: '-ші',
  20104. 9: '-шы',
  20105. 10: '-шы',
  20106. 20: '-шы',
  20107. 30: '-шы',
  20108. 40: '-шы',
  20109. 50: '-ші',
  20110. 60: '-шы',
  20111. 70: '-ші',
  20112. 80: '-ші',
  20113. 90: '-шы',
  20114. 100: '-ші',
  20115. };
  20116. hooks.defineLocale('kk', {
  20117. months: 'қаңтар_ақпан_наурыз_сәуір_мамыр_маусым_шілде_тамыз_қыркүйек_қазан_қараша_желтоқсан'.split(
  20118. '_'
  20119. ),
  20120. monthsShort: 'қаң_ақп_нау_сәу_мам_мау_шіл_там_қыр_қаз_қар_жел'.split('_'),
  20121. weekdays: 'жексенбі_дүйсенбі_сейсенбі_сәрсенбі_бейсенбі_жұма_сенбі'.split(
  20122. '_'
  20123. ),
  20124. weekdaysShort: 'жек_дүй_сей_сәр_бей_жұм_сен'.split('_'),
  20125. weekdaysMin: 'жк_дй_сй_ср_бй_жм_сн'.split('_'),
  20126. longDateFormat: {
  20127. LT: 'HH:mm',
  20128. LTS: 'HH:mm:ss',
  20129. L: 'DD.MM.YYYY',
  20130. LL: 'D MMMM YYYY',
  20131. LLL: 'D MMMM YYYY HH:mm',
  20132. LLLL: 'dddd, D MMMM YYYY HH:mm',
  20133. },
  20134. calendar: {
  20135. sameDay: '[Бүгін сағат] LT',
  20136. nextDay: '[Ертең сағат] LT',
  20137. nextWeek: 'dddd [сағат] LT',
  20138. lastDay: '[Кеше сағат] LT',
  20139. lastWeek: '[Өткен аптаның] dddd [сағат] LT',
  20140. sameElse: 'L',
  20141. },
  20142. relativeTime: {
  20143. future: '%s ішінде',
  20144. past: '%s бұрын',
  20145. s: 'бірнеше секунд',
  20146. ss: '%d секунд',
  20147. m: 'бір минут',
  20148. mm: '%d минут',
  20149. h: 'бір сағат',
  20150. hh: '%d сағат',
  20151. d: 'бір күн',
  20152. dd: '%d күн',
  20153. M: 'бір ай',
  20154. MM: '%d ай',
  20155. y: 'бір жыл',
  20156. yy: '%d жыл',
  20157. },
  20158. dayOfMonthOrdinalParse: /\d{1,2}-(ші|шы)/,
  20159. ordinal: function (number) {
  20160. var a = number % 10,
  20161. b = number >= 100 ? 100 : null;
  20162. return number + (suffixes$1[number] || suffixes$1[a] || suffixes$1[b]);
  20163. },
  20164. week: {
  20165. dow: 1, // Monday is the first day of the week.
  20166. doy: 7, // The week that contains Jan 7th is the first week of the year.
  20167. },
  20168. });
  20169. //! moment.js locale configuration
  20170. var symbolMap$9 = {
  20171. 1: '១',
  20172. 2: '២',
  20173. 3: '៣',
  20174. 4: '៤',
  20175. 5: '៥',
  20176. 6: '៦',
  20177. 7: '៧',
  20178. 8: '៨',
  20179. 9: '៩',
  20180. 0: '០',
  20181. },
  20182. numberMap$8 = {
  20183. '១': '1',
  20184. '២': '2',
  20185. '៣': '3',
  20186. '៤': '4',
  20187. '៥': '5',
  20188. '៦': '6',
  20189. '៧': '7',
  20190. '៨': '8',
  20191. '៩': '9',
  20192. '០': '0',
  20193. };
  20194. hooks.defineLocale('km', {
  20195. months: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split(
  20196. '_'
  20197. ),
  20198. monthsShort:
  20199. 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split(
  20200. '_'
  20201. ),
  20202. weekdays: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'),
  20203. weekdaysShort: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'),
  20204. weekdaysMin: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'),
  20205. weekdaysParseExact: true,
  20206. longDateFormat: {
  20207. LT: 'HH:mm',
  20208. LTS: 'HH:mm:ss',
  20209. L: 'DD/MM/YYYY',
  20210. LL: 'D MMMM YYYY',
  20211. LLL: 'D MMMM YYYY HH:mm',
  20212. LLLL: 'dddd, D MMMM YYYY HH:mm',
  20213. },
  20214. meridiemParse: /ព្រឹក|ល្ងាច/,
  20215. isPM: function (input) {
  20216. return input === 'ល្ងាច';
  20217. },
  20218. meridiem: function (hour, minute, isLower) {
  20219. if (hour < 12) {
  20220. return 'ព្រឹក';
  20221. } else {
  20222. return 'ល្ងាច';
  20223. }
  20224. },
  20225. calendar: {
  20226. sameDay: '[ថ្ងៃនេះ ម៉ោង] LT',
  20227. nextDay: '[ស្អែក ម៉ោង] LT',
  20228. nextWeek: 'dddd [ម៉ោង] LT',
  20229. lastDay: '[ម្សិលមិញ ម៉ោង] LT',
  20230. lastWeek: 'dddd [សប្តាហ៍មុន] [ម៉ោង] LT',
  20231. sameElse: 'L',
  20232. },
  20233. relativeTime: {
  20234. future: '%sទៀត',
  20235. past: '%sមុន',
  20236. s: 'ប៉ុន្មានវិនាទី',
  20237. ss: '%d វិនាទី',
  20238. m: 'មួយនាទី',
  20239. mm: '%d នាទី',
  20240. h: 'មួយម៉ោង',
  20241. hh: '%d ម៉ោង',
  20242. d: 'មួយថ្ងៃ',
  20243. dd: '%d ថ្ងៃ',
  20244. M: 'មួយខែ',
  20245. MM: '%d ខែ',
  20246. y: 'មួយឆ្នាំ',
  20247. yy: '%d ឆ្នាំ',
  20248. },
  20249. dayOfMonthOrdinalParse: /ទី\d{1,2}/,
  20250. ordinal: 'ទី%d',
  20251. preparse: function (string) {
  20252. return string.replace(/[១២៣៤៥៦៧៨៩០]/g, function (match) {
  20253. return numberMap$8[match];
  20254. });
  20255. },
  20256. postformat: function (string) {
  20257. return string.replace(/\d/g, function (match) {
  20258. return symbolMap$9[match];
  20259. });
  20260. },
  20261. week: {
  20262. dow: 1, // Monday is the first day of the week.
  20263. doy: 4, // The week that contains Jan 4th is the first week of the year.
  20264. },
  20265. });
  20266. //! moment.js locale configuration
  20267. var symbolMap$a = {
  20268. 1: '೧',
  20269. 2: '೨',
  20270. 3: '೩',
  20271. 4: '೪',
  20272. 5: '೫',
  20273. 6: '೬',
  20274. 7: '೭',
  20275. 8: '೮',
  20276. 9: '೯',
  20277. 0: '೦',
  20278. },
  20279. numberMap$9 = {
  20280. '೧': '1',
  20281. '೨': '2',
  20282. '೩': '3',
  20283. '೪': '4',
  20284. '೫': '5',
  20285. '೬': '6',
  20286. '೭': '7',
  20287. '೮': '8',
  20288. '೯': '9',
  20289. '೦': '0',
  20290. };
  20291. hooks.defineLocale('kn', {
  20292. months: 'ಜನವರಿ_ಫೆಬ್ರವರಿ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂಬರ್_ಅಕ್ಟೋಬರ್_ನವೆಂಬರ್_ಡಿಸೆಂಬರ್'.split(
  20293. '_'
  20294. ),
  20295. monthsShort:
  20296. 'ಜನ_ಫೆಬ್ರ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂ_ಅಕ್ಟೋ_ನವೆಂ_ಡಿಸೆಂ'.split(
  20297. '_'
  20298. ),
  20299. monthsParseExact: true,
  20300. weekdays: 'ಭಾನುವಾರ_ಸೋಮವಾರ_ಮಂಗಳವಾರ_ಬುಧವಾರ_ಗುರುವಾರ_ಶುಕ್ರವಾರ_ಶನಿವಾರ'.split(
  20301. '_'
  20302. ),
  20303. weekdaysShort: 'ಭಾನು_ಸೋಮ_ಮಂಗಳ_ಬುಧ_ಗುರು_ಶುಕ್ರ_ಶನಿ'.split('_'),
  20304. weekdaysMin: 'ಭಾ_ಸೋ_ಮಂ_ಬು_ಗು_ಶು_ಶ'.split('_'),
  20305. longDateFormat: {
  20306. LT: 'A h:mm',
  20307. LTS: 'A h:mm:ss',
  20308. L: 'DD/MM/YYYY',
  20309. LL: 'D MMMM YYYY',
  20310. LLL: 'D MMMM YYYY, A h:mm',
  20311. LLLL: 'dddd, D MMMM YYYY, A h:mm',
  20312. },
  20313. calendar: {
  20314. sameDay: '[ಇಂದು] LT',
  20315. nextDay: '[ನಾಳೆ] LT',
  20316. nextWeek: 'dddd, LT',
  20317. lastDay: '[ನಿನ್ನೆ] LT',
  20318. lastWeek: '[ಕೊನೆಯ] dddd, LT',
  20319. sameElse: 'L',
  20320. },
  20321. relativeTime: {
  20322. future: '%s ನಂತರ',
  20323. past: '%s ಹಿಂದೆ',
  20324. s: 'ಕೆಲವು ಕ್ಷಣಗಳು',
  20325. ss: '%d ಸೆಕೆಂಡುಗಳು',
  20326. m: 'ಒಂದು ನಿಮಿಷ',
  20327. mm: '%d ನಿಮಿಷ',
  20328. h: 'ಒಂದು ಗಂಟೆ',
  20329. hh: '%d ಗಂಟೆ',
  20330. d: 'ಒಂದು ದಿನ',
  20331. dd: '%d ದಿನ',
  20332. M: 'ಒಂದು ತಿಂಗಳು',
  20333. MM: '%d ತಿಂಗಳು',
  20334. y: 'ಒಂದು ವರ್ಷ',
  20335. yy: '%d ವರ್ಷ',
  20336. },
  20337. preparse: function (string) {
  20338. return string.replace(/[೧೨೩೪೫೬೭೮೯೦]/g, function (match) {
  20339. return numberMap$9[match];
  20340. });
  20341. },
  20342. postformat: function (string) {
  20343. return string.replace(/\d/g, function (match) {
  20344. return symbolMap$a[match];
  20345. });
  20346. },
  20347. meridiemParse: /ರಾತ್ರಿ|ಬೆಳಿಗ್ಗೆ|ಮಧ್ಯಾಹ್ನ|ಸಂಜೆ/,
  20348. meridiemHour: function (hour, meridiem) {
  20349. if (hour === 12) {
  20350. hour = 0;
  20351. }
  20352. if (meridiem === 'ರಾತ್ರಿ') {
  20353. return hour < 4 ? hour : hour + 12;
  20354. } else if (meridiem === 'ಬೆಳಿಗ್ಗೆ') {
  20355. return hour;
  20356. } else if (meridiem === 'ಮಧ್ಯಾಹ್ನ') {
  20357. return hour >= 10 ? hour : hour + 12;
  20358. } else if (meridiem === 'ಸಂಜೆ') {
  20359. return hour + 12;
  20360. }
  20361. },
  20362. meridiem: function (hour, minute, isLower) {
  20363. if (hour < 4) {
  20364. return 'ರಾತ್ರಿ';
  20365. } else if (hour < 10) {
  20366. return 'ಬೆಳಿಗ್ಗೆ';
  20367. } else if (hour < 17) {
  20368. return 'ಮಧ್ಯಾಹ್ನ';
  20369. } else if (hour < 20) {
  20370. return 'ಸಂಜೆ';
  20371. } else {
  20372. return 'ರಾತ್ರಿ';
  20373. }
  20374. },
  20375. dayOfMonthOrdinalParse: /\d{1,2}(ನೇ)/,
  20376. ordinal: function (number) {
  20377. return number + 'ನೇ';
  20378. },
  20379. week: {
  20380. dow: 0, // Sunday is the first day of the week.
  20381. doy: 6, // The week that contains Jan 6th is the first week of the year.
  20382. },
  20383. });
  20384. //! moment.js locale configuration
  20385. hooks.defineLocale('ko', {
  20386. months: '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'),
  20387. monthsShort: '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split(
  20388. '_'
  20389. ),
  20390. weekdays: '일요일_월요일_화요일_수요일_목요일_금요일_토요일'.split('_'),
  20391. weekdaysShort: '일_월_화_수_목_금_토'.split('_'),
  20392. weekdaysMin: '일_월_화_수_목_금_토'.split('_'),
  20393. longDateFormat: {
  20394. LT: 'A h:mm',
  20395. LTS: 'A h:mm:ss',
  20396. L: 'YYYY.MM.DD.',
  20397. LL: 'YYYY년 MMMM D일',
  20398. LLL: 'YYYY년 MMMM D일 A h:mm',
  20399. LLLL: 'YYYY년 MMMM D일 dddd A h:mm',
  20400. l: 'YYYY.MM.DD.',
  20401. ll: 'YYYY년 MMMM D일',
  20402. lll: 'YYYY년 MMMM D일 A h:mm',
  20403. llll: 'YYYY년 MMMM D일 dddd A h:mm',
  20404. },
  20405. calendar: {
  20406. sameDay: '오늘 LT',
  20407. nextDay: '내일 LT',
  20408. nextWeek: 'dddd LT',
  20409. lastDay: '어제 LT',
  20410. lastWeek: '지난주 dddd LT',
  20411. sameElse: 'L',
  20412. },
  20413. relativeTime: {
  20414. future: '%s 후',
  20415. past: '%s 전',
  20416. s: '몇 초',
  20417. ss: '%d초',
  20418. m: '1분',
  20419. mm: '%d분',
  20420. h: '한 시간',
  20421. hh: '%d시간',
  20422. d: '하루',
  20423. dd: '%d일',
  20424. M: '한 달',
  20425. MM: '%d달',
  20426. y: '일 년',
  20427. yy: '%d년',
  20428. },
  20429. dayOfMonthOrdinalParse: /\d{1,2}(일|월|주)/,
  20430. ordinal: function (number, period) {
  20431. switch (period) {
  20432. case 'd':
  20433. case 'D':
  20434. case 'DDD':
  20435. return number + '일';
  20436. case 'M':
  20437. return number + '월';
  20438. case 'w':
  20439. case 'W':
  20440. return number + '주';
  20441. default:
  20442. return number;
  20443. }
  20444. },
  20445. meridiemParse: /오전|오후/,
  20446. isPM: function (token) {
  20447. return token === '오후';
  20448. },
  20449. meridiem: function (hour, minute, isUpper) {
  20450. return hour < 12 ? '오전' : '오후';
  20451. },
  20452. });
  20453. //! moment.js locale configuration
  20454. var symbolMap$b = {
  20455. 1: '١',
  20456. 2: '٢',
  20457. 3: '٣',
  20458. 4: '٤',
  20459. 5: '٥',
  20460. 6: '٦',
  20461. 7: '٧',
  20462. 8: '٨',
  20463. 9: '٩',
  20464. 0: '٠',
  20465. },
  20466. numberMap$a = {
  20467. '١': '1',
  20468. '٢': '2',
  20469. '٣': '3',
  20470. '٤': '4',
  20471. '٥': '5',
  20472. '٦': '6',
  20473. '٧': '7',
  20474. '٨': '8',
  20475. '٩': '9',
  20476. '٠': '0',
  20477. },
  20478. months$8 = [
  20479. 'کانونی دووەم',
  20480. 'شوبات',
  20481. 'ئازار',
  20482. 'نیسان',
  20483. 'ئایار',
  20484. 'حوزەیران',
  20485. 'تەمموز',
  20486. 'ئاب',
  20487. 'ئەیلوول',
  20488. 'تشرینی یەكەم',
  20489. 'تشرینی دووەم',
  20490. 'كانونی یەکەم',
  20491. ];
  20492. hooks.defineLocale('ku', {
  20493. months: months$8,
  20494. monthsShort: months$8,
  20495. weekdays:
  20496. 'یه‌كشه‌ممه‌_دووشه‌ممه‌_سێشه‌ممه‌_چوارشه‌ممه‌_پێنجشه‌ممه‌_هه‌ینی_شه‌ممه‌'.split(
  20497. '_'
  20498. ),
  20499. weekdaysShort:
  20500. 'یه‌كشه‌م_دووشه‌م_سێشه‌م_چوارشه‌م_پێنجشه‌م_هه‌ینی_شه‌ممه‌'.split('_'),
  20501. weekdaysMin: 'ی_د_س_چ_پ_ه_ش'.split('_'),
  20502. weekdaysParseExact: true,
  20503. longDateFormat: {
  20504. LT: 'HH:mm',
  20505. LTS: 'HH:mm:ss',
  20506. L: 'DD/MM/YYYY',
  20507. LL: 'D MMMM YYYY',
  20508. LLL: 'D MMMM YYYY HH:mm',
  20509. LLLL: 'dddd, D MMMM YYYY HH:mm',
  20510. },
  20511. meridiemParse: /ئێواره‌|به‌یانی/,
  20512. isPM: function (input) {
  20513. return /ئێواره‌/.test(input);
  20514. },
  20515. meridiem: function (hour, minute, isLower) {
  20516. if (hour < 12) {
  20517. return 'به‌یانی';
  20518. } else {
  20519. return 'ئێواره‌';
  20520. }
  20521. },
  20522. calendar: {
  20523. sameDay: '[ئه‌مرۆ كاتژمێر] LT',
  20524. nextDay: '[به‌یانی كاتژمێر] LT',
  20525. nextWeek: 'dddd [كاتژمێر] LT',
  20526. lastDay: '[دوێنێ كاتژمێر] LT',
  20527. lastWeek: 'dddd [كاتژمێر] LT',
  20528. sameElse: 'L',
  20529. },
  20530. relativeTime: {
  20531. future: 'له‌ %s',
  20532. past: '%s',
  20533. s: 'چه‌ند چركه‌یه‌ك',
  20534. ss: 'چركه‌ %d',
  20535. m: 'یه‌ك خوله‌ك',
  20536. mm: '%d خوله‌ك',
  20537. h: 'یه‌ك كاتژمێر',
  20538. hh: '%d كاتژمێر',
  20539. d: 'یه‌ك ڕۆژ',
  20540. dd: '%d ڕۆژ',
  20541. M: 'یه‌ك مانگ',
  20542. MM: '%d مانگ',
  20543. y: 'یه‌ك ساڵ',
  20544. yy: '%d ساڵ',
  20545. },
  20546. preparse: function (string) {
  20547. return string
  20548. .replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) {
  20549. return numberMap$a[match];
  20550. })
  20551. .replace(/،/g, ',');
  20552. },
  20553. postformat: function (string) {
  20554. return string
  20555. .replace(/\d/g, function (match) {
  20556. return symbolMap$b[match];
  20557. })
  20558. .replace(/,/g, '،');
  20559. },
  20560. week: {
  20561. dow: 6, // Saturday is the first day of the week.
  20562. doy: 12, // The week that contains Jan 12th is the first week of the year.
  20563. },
  20564. });
  20565. //! moment.js locale configuration
  20566. var suffixes$2 = {
  20567. 0: '-чү',
  20568. 1: '-чи',
  20569. 2: '-чи',
  20570. 3: '-чү',
  20571. 4: '-чү',
  20572. 5: '-чи',
  20573. 6: '-чы',
  20574. 7: '-чи',
  20575. 8: '-чи',
  20576. 9: '-чу',
  20577. 10: '-чу',
  20578. 20: '-чы',
  20579. 30: '-чу',
  20580. 40: '-чы',
  20581. 50: '-чү',
  20582. 60: '-чы',
  20583. 70: '-чи',
  20584. 80: '-чи',
  20585. 90: '-чу',
  20586. 100: '-чү',
  20587. };
  20588. hooks.defineLocale('ky', {
  20589. months: 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split(
  20590. '_'
  20591. ),
  20592. monthsShort: 'янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек'.split(
  20593. '_'
  20594. ),
  20595. weekdays: 'Жекшемби_Дүйшөмбү_Шейшемби_Шаршемби_Бейшемби_Жума_Ишемби'.split(
  20596. '_'
  20597. ),
  20598. weekdaysShort: 'Жек_Дүй_Шей_Шар_Бей_Жум_Ише'.split('_'),
  20599. weekdaysMin: 'Жк_Дй_Шй_Шр_Бй_Жм_Иш'.split('_'),
  20600. longDateFormat: {
  20601. LT: 'HH:mm',
  20602. LTS: 'HH:mm:ss',
  20603. L: 'DD.MM.YYYY',
  20604. LL: 'D MMMM YYYY',
  20605. LLL: 'D MMMM YYYY HH:mm',
  20606. LLLL: 'dddd, D MMMM YYYY HH:mm',
  20607. },
  20608. calendar: {
  20609. sameDay: '[Бүгүн саат] LT',
  20610. nextDay: '[Эртең саат] LT',
  20611. nextWeek: 'dddd [саат] LT',
  20612. lastDay: '[Кечээ саат] LT',
  20613. lastWeek: '[Өткөн аптанын] dddd [күнү] [саат] LT',
  20614. sameElse: 'L',
  20615. },
  20616. relativeTime: {
  20617. future: '%s ичинде',
  20618. past: '%s мурун',
  20619. s: 'бирнече секунд',
  20620. ss: '%d секунд',
  20621. m: 'бир мүнөт',
  20622. mm: '%d мүнөт',
  20623. h: 'бир саат',
  20624. hh: '%d саат',
  20625. d: 'бир күн',
  20626. dd: '%d күн',
  20627. M: 'бир ай',
  20628. MM: '%d ай',
  20629. y: 'бир жыл',
  20630. yy: '%d жыл',
  20631. },
  20632. dayOfMonthOrdinalParse: /\d{1,2}-(чи|чы|чү|чу)/,
  20633. ordinal: function (number) {
  20634. var a = number % 10,
  20635. b = number >= 100 ? 100 : null;
  20636. return number + (suffixes$2[number] || suffixes$2[a] || suffixes$2[b]);
  20637. },
  20638. week: {
  20639. dow: 1, // Monday is the first day of the week.
  20640. doy: 7, // The week that contains Jan 7th is the first week of the year.
  20641. },
  20642. });
  20643. //! moment.js locale configuration
  20644. function processRelativeTime$6(number, withoutSuffix, key, isFuture) {
  20645. var format = {
  20646. m: ['eng Minutt', 'enger Minutt'],
  20647. h: ['eng Stonn', 'enger Stonn'],
  20648. d: ['een Dag', 'engem Dag'],
  20649. M: ['ee Mount', 'engem Mount'],
  20650. y: ['ee Joer', 'engem Joer'],
  20651. };
  20652. return withoutSuffix ? format[key][0] : format[key][1];
  20653. }
  20654. function processFutureTime(string) {
  20655. var number = string.substr(0, string.indexOf(' '));
  20656. if (eifelerRegelAppliesToNumber(number)) {
  20657. return 'a ' + string;
  20658. }
  20659. return 'an ' + string;
  20660. }
  20661. function processPastTime(string) {
  20662. var number = string.substr(0, string.indexOf(' '));
  20663. if (eifelerRegelAppliesToNumber(number)) {
  20664. return 'viru ' + string;
  20665. }
  20666. return 'virun ' + string;
  20667. }
  20668. /**
  20669. * Returns true if the word before the given number loses the '-n' ending.
  20670. * e.g. 'an 10 Deeg' but 'a 5 Deeg'
  20671. *
  20672. * @param number {integer}
  20673. * @returns {boolean}
  20674. */
  20675. function eifelerRegelAppliesToNumber(number) {
  20676. number = parseInt(number, 10);
  20677. if (isNaN(number)) {
  20678. return false;
  20679. }
  20680. if (number < 0) {
  20681. // Negative Number --> always true
  20682. return true;
  20683. } else if (number < 10) {
  20684. // Only 1 digit
  20685. if (4 <= number && number <= 7) {
  20686. return true;
  20687. }
  20688. return false;
  20689. } else if (number < 100) {
  20690. // 2 digits
  20691. var lastDigit = number % 10,
  20692. firstDigit = number / 10;
  20693. if (lastDigit === 0) {
  20694. return eifelerRegelAppliesToNumber(firstDigit);
  20695. }
  20696. return eifelerRegelAppliesToNumber(lastDigit);
  20697. } else if (number < 10000) {
  20698. // 3 or 4 digits --> recursively check first digit
  20699. while (number >= 10) {
  20700. number = number / 10;
  20701. }
  20702. return eifelerRegelAppliesToNumber(number);
  20703. } else {
  20704. // Anything larger than 4 digits: recursively check first n-3 digits
  20705. number = number / 1000;
  20706. return eifelerRegelAppliesToNumber(number);
  20707. }
  20708. }
  20709. hooks.defineLocale('lb', {
  20710. months: 'Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember'.split(
  20711. '_'
  20712. ),
  20713. monthsShort:
  20714. 'Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split(
  20715. '_'
  20716. ),
  20717. monthsParseExact: true,
  20718. weekdays:
  20719. 'Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg'.split(
  20720. '_'
  20721. ),
  20722. weekdaysShort: 'So._Mé._Dë._Më._Do._Fr._Sa.'.split('_'),
  20723. weekdaysMin: 'So_Mé_Dë_Më_Do_Fr_Sa'.split('_'),
  20724. weekdaysParseExact: true,
  20725. longDateFormat: {
  20726. LT: 'H:mm [Auer]',
  20727. LTS: 'H:mm:ss [Auer]',
  20728. L: 'DD.MM.YYYY',
  20729. LL: 'D. MMMM YYYY',
  20730. LLL: 'D. MMMM YYYY H:mm [Auer]',
  20731. LLLL: 'dddd, D. MMMM YYYY H:mm [Auer]',
  20732. },
  20733. calendar: {
  20734. sameDay: '[Haut um] LT',
  20735. sameElse: 'L',
  20736. nextDay: '[Muer um] LT',
  20737. nextWeek: 'dddd [um] LT',
  20738. lastDay: '[Gëschter um] LT',
  20739. lastWeek: function () {
  20740. // Different date string for 'Dënschdeg' (Tuesday) and 'Donneschdeg' (Thursday) due to phonological rule
  20741. switch (this.day()) {
  20742. case 2:
  20743. case 4:
  20744. return '[Leschten] dddd [um] LT';
  20745. default:
  20746. return '[Leschte] dddd [um] LT';
  20747. }
  20748. },
  20749. },
  20750. relativeTime: {
  20751. future: processFutureTime,
  20752. past: processPastTime,
  20753. s: 'e puer Sekonnen',
  20754. ss: '%d Sekonnen',
  20755. m: processRelativeTime$6,
  20756. mm: '%d Minutten',
  20757. h: processRelativeTime$6,
  20758. hh: '%d Stonnen',
  20759. d: processRelativeTime$6,
  20760. dd: '%d Deeg',
  20761. M: processRelativeTime$6,
  20762. MM: '%d Méint',
  20763. y: processRelativeTime$6,
  20764. yy: '%d Joer',
  20765. },
  20766. dayOfMonthOrdinalParse: /\d{1,2}\./,
  20767. ordinal: '%d.',
  20768. week: {
  20769. dow: 1, // Monday is the first day of the week.
  20770. doy: 4, // The week that contains Jan 4th is the first week of the year.
  20771. },
  20772. });
  20773. //! moment.js locale configuration
  20774. hooks.defineLocale('lo', {
  20775. months: 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split(
  20776. '_'
  20777. ),
  20778. monthsShort:
  20779. 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split(
  20780. '_'
  20781. ),
  20782. weekdays: 'ອາທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'),
  20783. weekdaysShort: 'ທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'),
  20784. weekdaysMin: 'ທ_ຈ_ອຄ_ພ_ພຫ_ສກ_ສ'.split('_'),
  20785. weekdaysParseExact: true,
  20786. longDateFormat: {
  20787. LT: 'HH:mm',
  20788. LTS: 'HH:mm:ss',
  20789. L: 'DD/MM/YYYY',
  20790. LL: 'D MMMM YYYY',
  20791. LLL: 'D MMMM YYYY HH:mm',
  20792. LLLL: 'ວັນdddd D MMMM YYYY HH:mm',
  20793. },
  20794. meridiemParse: /ຕອນເຊົ້າ|ຕອນແລງ/,
  20795. isPM: function (input) {
  20796. return input === 'ຕອນແລງ';
  20797. },
  20798. meridiem: function (hour, minute, isLower) {
  20799. if (hour < 12) {
  20800. return 'ຕອນເຊົ້າ';
  20801. } else {
  20802. return 'ຕອນແລງ';
  20803. }
  20804. },
  20805. calendar: {
  20806. sameDay: '[ມື້ນີ້ເວລາ] LT',
  20807. nextDay: '[ມື້ອື່ນເວລາ] LT',
  20808. nextWeek: '[ວັນ]dddd[ໜ້າເວລາ] LT',
  20809. lastDay: '[ມື້ວານນີ້ເວລາ] LT',
  20810. lastWeek: '[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT',
  20811. sameElse: 'L',
  20812. },
  20813. relativeTime: {
  20814. future: 'ອີກ %s',
  20815. past: '%sຜ່ານມາ',
  20816. s: 'ບໍ່ເທົ່າໃດວິນາທີ',
  20817. ss: '%d ວິນາທີ',
  20818. m: '1 ນາທີ',
  20819. mm: '%d ນາທີ',
  20820. h: '1 ຊົ່ວໂມງ',
  20821. hh: '%d ຊົ່ວໂມງ',
  20822. d: '1 ມື້',
  20823. dd: '%d ມື້',
  20824. M: '1 ເດືອນ',
  20825. MM: '%d ເດືອນ',
  20826. y: '1 ປີ',
  20827. yy: '%d ປີ',
  20828. },
  20829. dayOfMonthOrdinalParse: /(ທີ່)\d{1,2}/,
  20830. ordinal: function (number) {
  20831. return 'ທີ່' + number;
  20832. },
  20833. });
  20834. //! moment.js locale configuration
  20835. var units = {
  20836. ss: 'sekundė_sekundžių_sekundes',
  20837. m: 'minutė_minutės_minutę',
  20838. mm: 'minutės_minučių_minutes',
  20839. h: 'valanda_valandos_valandą',
  20840. hh: 'valandos_valandų_valandas',
  20841. d: 'diena_dienos_dieną',
  20842. dd: 'dienos_dienų_dienas',
  20843. M: 'mėnuo_mėnesio_mėnesį',
  20844. MM: 'mėnesiai_mėnesių_mėnesius',
  20845. y: 'metai_metų_metus',
  20846. yy: 'metai_metų_metus',
  20847. };
  20848. function translateSeconds(number, withoutSuffix, key, isFuture) {
  20849. if (withoutSuffix) {
  20850. return 'kelios sekundės';
  20851. } else {
  20852. return isFuture ? 'kelių sekundžių' : 'kelias sekundes';
  20853. }
  20854. }
  20855. function translateSingular(number, withoutSuffix, key, isFuture) {
  20856. return withoutSuffix
  20857. ? forms(key)[0]
  20858. : isFuture
  20859. ? forms(key)[1]
  20860. : forms(key)[2];
  20861. }
  20862. function special(number) {
  20863. return number % 10 === 0 || (number > 10 && number < 20);
  20864. }
  20865. function forms(key) {
  20866. return units[key].split('_');
  20867. }
  20868. function translate$6(number, withoutSuffix, key, isFuture) {
  20869. var result = number + ' ';
  20870. if (number === 1) {
  20871. return (
  20872. result + translateSingular(number, withoutSuffix, key[0], isFuture)
  20873. );
  20874. } else if (withoutSuffix) {
  20875. return result + (special(number) ? forms(key)[1] : forms(key)[0]);
  20876. } else {
  20877. if (isFuture) {
  20878. return result + forms(key)[1];
  20879. } else {
  20880. return result + (special(number) ? forms(key)[1] : forms(key)[2]);
  20881. }
  20882. }
  20883. }
  20884. hooks.defineLocale('lt', {
  20885. months: {
  20886. format: 'sausio_vasario_kovo_balandžio_gegužės_birželio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio'.split(
  20887. '_'
  20888. ),
  20889. standalone:
  20890. 'sausis_vasaris_kovas_balandis_gegužė_birželis_liepa_rugpjūtis_rugsėjis_spalis_lapkritis_gruodis'.split(
  20891. '_'
  20892. ),
  20893. isFormat: /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?|MMMM?(\[[^\[\]]*\]|\s)+D[oD]?/,
  20894. },
  20895. monthsShort: 'sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd'.split('_'),
  20896. weekdays: {
  20897. format: 'sekmadienį_pirmadienį_antradienį_trečiadienį_ketvirtadienį_penktadienį_šeštadienį'.split(
  20898. '_'
  20899. ),
  20900. standalone:
  20901. 'sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis'.split(
  20902. '_'
  20903. ),
  20904. isFormat: /dddd HH:mm/,
  20905. },
  20906. weekdaysShort: 'Sek_Pir_Ant_Tre_Ket_Pen_Šeš'.split('_'),
  20907. weekdaysMin: 'S_P_A_T_K_Pn_Š'.split('_'),
  20908. weekdaysParseExact: true,
  20909. longDateFormat: {
  20910. LT: 'HH:mm',
  20911. LTS: 'HH:mm:ss',
  20912. L: 'YYYY-MM-DD',
  20913. LL: 'YYYY [m.] MMMM D [d.]',
  20914. LLL: 'YYYY [m.] MMMM D [d.], HH:mm [val.]',
  20915. LLLL: 'YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]',
  20916. l: 'YYYY-MM-DD',
  20917. ll: 'YYYY [m.] MMMM D [d.]',
  20918. lll: 'YYYY [m.] MMMM D [d.], HH:mm [val.]',
  20919. llll: 'YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]',
  20920. },
  20921. calendar: {
  20922. sameDay: '[Šiandien] LT',
  20923. nextDay: '[Rytoj] LT',
  20924. nextWeek: 'dddd LT',
  20925. lastDay: '[Vakar] LT',
  20926. lastWeek: '[Praėjusį] dddd LT',
  20927. sameElse: 'L',
  20928. },
  20929. relativeTime: {
  20930. future: 'po %s',
  20931. past: 'prieš %s',
  20932. s: translateSeconds,
  20933. ss: translate$6,
  20934. m: translateSingular,
  20935. mm: translate$6,
  20936. h: translateSingular,
  20937. hh: translate$6,
  20938. d: translateSingular,
  20939. dd: translate$6,
  20940. M: translateSingular,
  20941. MM: translate$6,
  20942. y: translateSingular,
  20943. yy: translate$6,
  20944. },
  20945. dayOfMonthOrdinalParse: /\d{1,2}-oji/,
  20946. ordinal: function (number) {
  20947. return number + '-oji';
  20948. },
  20949. week: {
  20950. dow: 1, // Monday is the first day of the week.
  20951. doy: 4, // The week that contains Jan 4th is the first week of the year.
  20952. },
  20953. });
  20954. //! moment.js locale configuration
  20955. var units$1 = {
  20956. ss: 'sekundes_sekundēm_sekunde_sekundes'.split('_'),
  20957. m: 'minūtes_minūtēm_minūte_minūtes'.split('_'),
  20958. mm: 'minūtes_minūtēm_minūte_minūtes'.split('_'),
  20959. h: 'stundas_stundām_stunda_stundas'.split('_'),
  20960. hh: 'stundas_stundām_stunda_stundas'.split('_'),
  20961. d: 'dienas_dienām_diena_dienas'.split('_'),
  20962. dd: 'dienas_dienām_diena_dienas'.split('_'),
  20963. M: 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'),
  20964. MM: 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'),
  20965. y: 'gada_gadiem_gads_gadi'.split('_'),
  20966. yy: 'gada_gadiem_gads_gadi'.split('_'),
  20967. };
  20968. /**
  20969. * @param withoutSuffix boolean true = a length of time; false = before/after a period of time.
  20970. */
  20971. function format$1(forms, number, withoutSuffix) {
  20972. if (withoutSuffix) {
  20973. // E.g. "21 minūte", "3 minūtes".
  20974. return number % 10 === 1 && number % 100 !== 11 ? forms[2] : forms[3];
  20975. } else {
  20976. // E.g. "21 minūtes" as in "pēc 21 minūtes".
  20977. // E.g. "3 minūtēm" as in "pēc 3 minūtēm".
  20978. return number % 10 === 1 && number % 100 !== 11 ? forms[0] : forms[1];
  20979. }
  20980. }
  20981. function relativeTimeWithPlural$1(number, withoutSuffix, key) {
  20982. return number + ' ' + format$1(units$1[key], number, withoutSuffix);
  20983. }
  20984. function relativeTimeWithSingular(number, withoutSuffix, key) {
  20985. return format$1(units$1[key], number, withoutSuffix);
  20986. }
  20987. function relativeSeconds(number, withoutSuffix) {
  20988. return withoutSuffix ? 'dažas sekundes' : 'dažām sekundēm';
  20989. }
  20990. hooks.defineLocale('lv', {
  20991. months: 'janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris'.split(
  20992. '_'
  20993. ),
  20994. monthsShort: 'jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec'.split('_'),
  20995. weekdays:
  20996. 'svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena'.split(
  20997. '_'
  20998. ),
  20999. weekdaysShort: 'Sv_P_O_T_C_Pk_S'.split('_'),
  21000. weekdaysMin: 'Sv_P_O_T_C_Pk_S'.split('_'),
  21001. weekdaysParseExact: true,
  21002. longDateFormat: {
  21003. LT: 'HH:mm',
  21004. LTS: 'HH:mm:ss',
  21005. L: 'DD.MM.YYYY.',
  21006. LL: 'YYYY. [gada] D. MMMM',
  21007. LLL: 'YYYY. [gada] D. MMMM, HH:mm',
  21008. LLLL: 'YYYY. [gada] D. MMMM, dddd, HH:mm',
  21009. },
  21010. calendar: {
  21011. sameDay: '[Šodien pulksten] LT',
  21012. nextDay: '[Rīt pulksten] LT',
  21013. nextWeek: 'dddd [pulksten] LT',
  21014. lastDay: '[Vakar pulksten] LT',
  21015. lastWeek: '[Pagājušā] dddd [pulksten] LT',
  21016. sameElse: 'L',
  21017. },
  21018. relativeTime: {
  21019. future: 'pēc %s',
  21020. past: 'pirms %s',
  21021. s: relativeSeconds,
  21022. ss: relativeTimeWithPlural$1,
  21023. m: relativeTimeWithSingular,
  21024. mm: relativeTimeWithPlural$1,
  21025. h: relativeTimeWithSingular,
  21026. hh: relativeTimeWithPlural$1,
  21027. d: relativeTimeWithSingular,
  21028. dd: relativeTimeWithPlural$1,
  21029. M: relativeTimeWithSingular,
  21030. MM: relativeTimeWithPlural$1,
  21031. y: relativeTimeWithSingular,
  21032. yy: relativeTimeWithPlural$1,
  21033. },
  21034. dayOfMonthOrdinalParse: /\d{1,2}\./,
  21035. ordinal: '%d.',
  21036. week: {
  21037. dow: 1, // Monday is the first day of the week.
  21038. doy: 4, // The week that contains Jan 4th is the first week of the year.
  21039. },
  21040. });
  21041. //! moment.js locale configuration
  21042. var translator = {
  21043. words: {
  21044. //Different grammatical cases
  21045. ss: ['sekund', 'sekunda', 'sekundi'],
  21046. m: ['jedan minut', 'jednog minuta'],
  21047. mm: ['minut', 'minuta', 'minuta'],
  21048. h: ['jedan sat', 'jednog sata'],
  21049. hh: ['sat', 'sata', 'sati'],
  21050. dd: ['dan', 'dana', 'dana'],
  21051. MM: ['mjesec', 'mjeseca', 'mjeseci'],
  21052. yy: ['godina', 'godine', 'godina'],
  21053. },
  21054. correctGrammaticalCase: function (number, wordKey) {
  21055. return number === 1
  21056. ? wordKey[0]
  21057. : number >= 2 && number <= 4
  21058. ? wordKey[1]
  21059. : wordKey[2];
  21060. },
  21061. translate: function (number, withoutSuffix, key) {
  21062. var wordKey = translator.words[key];
  21063. if (key.length === 1) {
  21064. return withoutSuffix ? wordKey[0] : wordKey[1];
  21065. } else {
  21066. return (
  21067. number +
  21068. ' ' +
  21069. translator.correctGrammaticalCase(number, wordKey)
  21070. );
  21071. }
  21072. },
  21073. };
  21074. hooks.defineLocale('me', {
  21075. months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split(
  21076. '_'
  21077. ),
  21078. monthsShort:
  21079. 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'),
  21080. monthsParseExact: true,
  21081. weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split(
  21082. '_'
  21083. ),
  21084. weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'),
  21085. weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'),
  21086. weekdaysParseExact: true,
  21087. longDateFormat: {
  21088. LT: 'H:mm',
  21089. LTS: 'H:mm:ss',
  21090. L: 'DD.MM.YYYY',
  21091. LL: 'D. MMMM YYYY',
  21092. LLL: 'D. MMMM YYYY H:mm',
  21093. LLLL: 'dddd, D. MMMM YYYY H:mm',
  21094. },
  21095. calendar: {
  21096. sameDay: '[danas u] LT',
  21097. nextDay: '[sjutra u] LT',
  21098. nextWeek: function () {
  21099. switch (this.day()) {
  21100. case 0:
  21101. return '[u] [nedjelju] [u] LT';
  21102. case 3:
  21103. return '[u] [srijedu] [u] LT';
  21104. case 6:
  21105. return '[u] [subotu] [u] LT';
  21106. case 1:
  21107. case 2:
  21108. case 4:
  21109. case 5:
  21110. return '[u] dddd [u] LT';
  21111. }
  21112. },
  21113. lastDay: '[juče u] LT',
  21114. lastWeek: function () {
  21115. var lastWeekDays = [
  21116. '[prošle] [nedjelje] [u] LT',
  21117. '[prošlog] [ponedjeljka] [u] LT',
  21118. '[prošlog] [utorka] [u] LT',
  21119. '[prošle] [srijede] [u] LT',
  21120. '[prošlog] [četvrtka] [u] LT',
  21121. '[prošlog] [petka] [u] LT',
  21122. '[prošle] [subote] [u] LT',
  21123. ];
  21124. return lastWeekDays[this.day()];
  21125. },
  21126. sameElse: 'L',
  21127. },
  21128. relativeTime: {
  21129. future: 'za %s',
  21130. past: 'prije %s',
  21131. s: 'nekoliko sekundi',
  21132. ss: translator.translate,
  21133. m: translator.translate,
  21134. mm: translator.translate,
  21135. h: translator.translate,
  21136. hh: translator.translate,
  21137. d: 'dan',
  21138. dd: translator.translate,
  21139. M: 'mjesec',
  21140. MM: translator.translate,
  21141. y: 'godinu',
  21142. yy: translator.translate,
  21143. },
  21144. dayOfMonthOrdinalParse: /\d{1,2}\./,
  21145. ordinal: '%d.',
  21146. week: {
  21147. dow: 1, // Monday is the first day of the week.
  21148. doy: 7, // The week that contains Jan 7th is the first week of the year.
  21149. },
  21150. });
  21151. //! moment.js locale configuration
  21152. hooks.defineLocale('mi', {
  21153. months: 'Kohi-tāte_Hui-tanguru_Poutū-te-rangi_Paenga-whāwhā_Haratua_Pipiri_Hōngoingoi_Here-turi-kōkā_Mahuru_Whiringa-ā-nuku_Whiringa-ā-rangi_Hakihea'.split(
  21154. '_'
  21155. ),
  21156. monthsShort:
  21157. 'Kohi_Hui_Pou_Pae_Hara_Pipi_Hōngoi_Here_Mahu_Whi-nu_Whi-ra_Haki'.split(
  21158. '_'
  21159. ),
  21160. monthsRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,
  21161. monthsStrictRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,
  21162. monthsShortRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,
  21163. monthsShortStrictRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,2}/i,
  21164. weekdays: 'Rātapu_Mane_Tūrei_Wenerei_Tāite_Paraire_Hātarei'.split('_'),
  21165. weekdaysShort: 'Ta_Ma_Tū_We_Tāi_Pa_Hā'.split('_'),
  21166. weekdaysMin: 'Ta_Ma_Tū_We_Tāi_Pa_Hā'.split('_'),
  21167. longDateFormat: {
  21168. LT: 'HH:mm',
  21169. LTS: 'HH:mm:ss',
  21170. L: 'DD/MM/YYYY',
  21171. LL: 'D MMMM YYYY',
  21172. LLL: 'D MMMM YYYY [i] HH:mm',
  21173. LLLL: 'dddd, D MMMM YYYY [i] HH:mm',
  21174. },
  21175. calendar: {
  21176. sameDay: '[i teie mahana, i] LT',
  21177. nextDay: '[apopo i] LT',
  21178. nextWeek: 'dddd [i] LT',
  21179. lastDay: '[inanahi i] LT',
  21180. lastWeek: 'dddd [whakamutunga i] LT',
  21181. sameElse: 'L',
  21182. },
  21183. relativeTime: {
  21184. future: 'i roto i %s',
  21185. past: '%s i mua',
  21186. s: 'te hēkona ruarua',
  21187. ss: '%d hēkona',
  21188. m: 'he meneti',
  21189. mm: '%d meneti',
  21190. h: 'te haora',
  21191. hh: '%d haora',
  21192. d: 'he ra',
  21193. dd: '%d ra',
  21194. M: 'he marama',
  21195. MM: '%d marama',
  21196. y: 'he tau',
  21197. yy: '%d tau',
  21198. },
  21199. dayOfMonthOrdinalParse: /\d{1,2}º/,
  21200. ordinal: '%dº',
  21201. week: {
  21202. dow: 1, // Monday is the first day of the week.
  21203. doy: 4, // The week that contains Jan 4th is the first week of the year.
  21204. },
  21205. });
  21206. //! moment.js locale configuration
  21207. hooks.defineLocale('mk', {
  21208. months: 'јануари_февруари_март_април_мај_јуни_јули_август_септември_октомври_ноември_декември'.split(
  21209. '_'
  21210. ),
  21211. monthsShort: 'јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек'.split('_'),
  21212. weekdays: 'недела_понеделник_вторник_среда_четврток_петок_сабота'.split(
  21213. '_'
  21214. ),
  21215. weekdaysShort: 'нед_пон_вто_сре_чет_пет_саб'.split('_'),
  21216. weekdaysMin: 'нe_пo_вт_ср_че_пе_сa'.split('_'),
  21217. longDateFormat: {
  21218. LT: 'H:mm',
  21219. LTS: 'H:mm:ss',
  21220. L: 'D.MM.YYYY',
  21221. LL: 'D MMMM YYYY',
  21222. LLL: 'D MMMM YYYY H:mm',
  21223. LLLL: 'dddd, D MMMM YYYY H:mm',
  21224. },
  21225. calendar: {
  21226. sameDay: '[Денес во] LT',
  21227. nextDay: '[Утре во] LT',
  21228. nextWeek: '[Во] dddd [во] LT',
  21229. lastDay: '[Вчера во] LT',
  21230. lastWeek: function () {
  21231. switch (this.day()) {
  21232. case 0:
  21233. case 3:
  21234. case 6:
  21235. return '[Изминатата] dddd [во] LT';
  21236. case 1:
  21237. case 2:
  21238. case 4:
  21239. case 5:
  21240. return '[Изминатиот] dddd [во] LT';
  21241. }
  21242. },
  21243. sameElse: 'L',
  21244. },
  21245. relativeTime: {
  21246. future: 'за %s',
  21247. past: 'пред %s',
  21248. s: 'неколку секунди',
  21249. ss: '%d секунди',
  21250. m: 'една минута',
  21251. mm: '%d минути',
  21252. h: 'еден час',
  21253. hh: '%d часа',
  21254. d: 'еден ден',
  21255. dd: '%d дена',
  21256. M: 'еден месец',
  21257. MM: '%d месеци',
  21258. y: 'една година',
  21259. yy: '%d години',
  21260. },
  21261. dayOfMonthOrdinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/,
  21262. ordinal: function (number) {
  21263. var lastDigit = number % 10,
  21264. last2Digits = number % 100;
  21265. if (number === 0) {
  21266. return number + '-ев';
  21267. } else if (last2Digits === 0) {
  21268. return number + '-ен';
  21269. } else if (last2Digits > 10 && last2Digits < 20) {
  21270. return number + '-ти';
  21271. } else if (lastDigit === 1) {
  21272. return number + '-ви';
  21273. } else if (lastDigit === 2) {
  21274. return number + '-ри';
  21275. } else if (lastDigit === 7 || lastDigit === 8) {
  21276. return number + '-ми';
  21277. } else {
  21278. return number + '-ти';
  21279. }
  21280. },
  21281. week: {
  21282. dow: 1, // Monday is the first day of the week.
  21283. doy: 7, // The week that contains Jan 7th is the first week of the year.
  21284. },
  21285. });
  21286. //! moment.js locale configuration
  21287. hooks.defineLocale('ml', {
  21288. months: 'ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ'.split(
  21289. '_'
  21290. ),
  21291. monthsShort:
  21292. 'ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.'.split(
  21293. '_'
  21294. ),
  21295. monthsParseExact: true,
  21296. weekdays:
  21297. 'ഞായറാഴ്ച_തിങ്കളാഴ്ച_ചൊവ്വാഴ്ച_ബുധനാഴ്ച_വ്യാഴാഴ്ച_വെള്ളിയാഴ്ച_ശനിയാഴ്ച'.split(
  21298. '_'
  21299. ),
  21300. weekdaysShort: 'ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി'.split('_'),
  21301. weekdaysMin: 'ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ'.split('_'),
  21302. longDateFormat: {
  21303. LT: 'A h:mm -നു',
  21304. LTS: 'A h:mm:ss -നു',
  21305. L: 'DD/MM/YYYY',
  21306. LL: 'D MMMM YYYY',
  21307. LLL: 'D MMMM YYYY, A h:mm -നു',
  21308. LLLL: 'dddd, D MMMM YYYY, A h:mm -നു',
  21309. },
  21310. calendar: {
  21311. sameDay: '[ഇന്ന്] LT',
  21312. nextDay: '[നാളെ] LT',
  21313. nextWeek: 'dddd, LT',
  21314. lastDay: '[ഇന്നലെ] LT',
  21315. lastWeek: '[കഴിഞ്ഞ] dddd, LT',
  21316. sameElse: 'L',
  21317. },
  21318. relativeTime: {
  21319. future: '%s കഴിഞ്ഞ്',
  21320. past: '%s മുൻപ്',
  21321. s: 'അൽപ നിമിഷങ്ങൾ',
  21322. ss: '%d സെക്കൻഡ്',
  21323. m: 'ഒരു മിനിറ്റ്',
  21324. mm: '%d മിനിറ്റ്',
  21325. h: 'ഒരു മണിക്കൂർ',
  21326. hh: '%d മണിക്കൂർ',
  21327. d: 'ഒരു ദിവസം',
  21328. dd: '%d ദിവസം',
  21329. M: 'ഒരു മാസം',
  21330. MM: '%d മാസം',
  21331. y: 'ഒരു വർഷം',
  21332. yy: '%d വർഷം',
  21333. },
  21334. meridiemParse: /രാത്രി|രാവിലെ|ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി/i,
  21335. meridiemHour: function (hour, meridiem) {
  21336. if (hour === 12) {
  21337. hour = 0;
  21338. }
  21339. if (
  21340. (meridiem === 'രാത്രി' && hour >= 4) ||
  21341. meridiem === 'ഉച്ച കഴിഞ്ഞ്' ||
  21342. meridiem === 'വൈകുന്നേരം'
  21343. ) {
  21344. return hour + 12;
  21345. } else {
  21346. return hour;
  21347. }
  21348. },
  21349. meridiem: function (hour, minute, isLower) {
  21350. if (hour < 4) {
  21351. return 'രാത്രി';
  21352. } else if (hour < 12) {
  21353. return 'രാവിലെ';
  21354. } else if (hour < 17) {
  21355. return 'ഉച്ച കഴിഞ്ഞ്';
  21356. } else if (hour < 20) {
  21357. return 'വൈകുന്നേരം';
  21358. } else {
  21359. return 'രാത്രി';
  21360. }
  21361. },
  21362. });
  21363. //! moment.js locale configuration
  21364. function translate$7(number, withoutSuffix, key, isFuture) {
  21365. switch (key) {
  21366. case 's':
  21367. return withoutSuffix ? 'хэдхэн секунд' : 'хэдхэн секундын';
  21368. case 'ss':
  21369. return number + (withoutSuffix ? ' секунд' : ' секундын');
  21370. case 'm':
  21371. case 'mm':
  21372. return number + (withoutSuffix ? ' минут' : ' минутын');
  21373. case 'h':
  21374. case 'hh':
  21375. return number + (withoutSuffix ? ' цаг' : ' цагийн');
  21376. case 'd':
  21377. case 'dd':
  21378. return number + (withoutSuffix ? ' өдөр' : ' өдрийн');
  21379. case 'M':
  21380. case 'MM':
  21381. return number + (withoutSuffix ? ' сар' : ' сарын');
  21382. case 'y':
  21383. case 'yy':
  21384. return number + (withoutSuffix ? ' жил' : ' жилийн');
  21385. default:
  21386. return number;
  21387. }
  21388. }
  21389. hooks.defineLocale('mn', {
  21390. months: 'Нэгдүгээр сар_Хоёрдугаар сар_Гуравдугаар сар_Дөрөвдүгээр сар_Тавдугаар сар_Зургадугаар сар_Долдугаар сар_Наймдугаар сар_Есдүгээр сар_Аравдугаар сар_Арван нэгдүгээр сар_Арван хоёрдугаар сар'.split(
  21391. '_'
  21392. ),
  21393. monthsShort:
  21394. '1 сар_2 сар_3 сар_4 сар_5 сар_6 сар_7 сар_8 сар_9 сар_10 сар_11 сар_12 сар'.split(
  21395. '_'
  21396. ),
  21397. monthsParseExact: true,
  21398. weekdays: 'Ням_Даваа_Мягмар_Лхагва_Пүрэв_Баасан_Бямба'.split('_'),
  21399. weekdaysShort: 'Ням_Дав_Мяг_Лха_Пүр_Баа_Бям'.split('_'),
  21400. weekdaysMin: 'Ня_Да_Мя_Лх_Пү_Ба_Бя'.split('_'),
  21401. weekdaysParseExact: true,
  21402. longDateFormat: {
  21403. LT: 'HH:mm',
  21404. LTS: 'HH:mm:ss',
  21405. L: 'YYYY-MM-DD',
  21406. LL: 'YYYY оны MMMMын D',
  21407. LLL: 'YYYY оны MMMMын D HH:mm',
  21408. LLLL: 'dddd, YYYY оны MMMMын D HH:mm',
  21409. },
  21410. meridiemParse: /ҮӨ|ҮХ/i,
  21411. isPM: function (input) {
  21412. return input === 'ҮХ';
  21413. },
  21414. meridiem: function (hour, minute, isLower) {
  21415. if (hour < 12) {
  21416. return 'ҮӨ';
  21417. } else {
  21418. return 'ҮХ';
  21419. }
  21420. },
  21421. calendar: {
  21422. sameDay: '[Өнөөдөр] LT',
  21423. nextDay: '[Маргааш] LT',
  21424. nextWeek: '[Ирэх] dddd LT',
  21425. lastDay: '[Өчигдөр] LT',
  21426. lastWeek: '[Өнгөрсөн] dddd LT',
  21427. sameElse: 'L',
  21428. },
  21429. relativeTime: {
  21430. future: '%s дараа',
  21431. past: '%s өмнө',
  21432. s: translate$7,
  21433. ss: translate$7,
  21434. m: translate$7,
  21435. mm: translate$7,
  21436. h: translate$7,
  21437. hh: translate$7,
  21438. d: translate$7,
  21439. dd: translate$7,
  21440. M: translate$7,
  21441. MM: translate$7,
  21442. y: translate$7,
  21443. yy: translate$7,
  21444. },
  21445. dayOfMonthOrdinalParse: /\d{1,2} өдөр/,
  21446. ordinal: function (number, period) {
  21447. switch (period) {
  21448. case 'd':
  21449. case 'D':
  21450. case 'DDD':
  21451. return number + ' өдөр';
  21452. default:
  21453. return number;
  21454. }
  21455. },
  21456. });
  21457. //! moment.js locale configuration
  21458. var symbolMap$c = {
  21459. 1: '१',
  21460. 2: '२',
  21461. 3: '३',
  21462. 4: '४',
  21463. 5: '५',
  21464. 6: '६',
  21465. 7: '७',
  21466. 8: '८',
  21467. 9: '९',
  21468. 0: '०',
  21469. },
  21470. numberMap$b = {
  21471. '१': '1',
  21472. '२': '2',
  21473. '३': '3',
  21474. '४': '4',
  21475. '५': '5',
  21476. '६': '6',
  21477. '७': '7',
  21478. '८': '8',
  21479. '९': '9',
  21480. '०': '0',
  21481. };
  21482. function relativeTimeMr(number, withoutSuffix, string, isFuture) {
  21483. var output = '';
  21484. if (withoutSuffix) {
  21485. switch (string) {
  21486. case 's':
  21487. output = 'काही सेकंद';
  21488. break;
  21489. case 'ss':
  21490. output = '%d सेकंद';
  21491. break;
  21492. case 'm':
  21493. output = 'एक मिनिट';
  21494. break;
  21495. case 'mm':
  21496. output = '%d मिनिटे';
  21497. break;
  21498. case 'h':
  21499. output = 'एक तास';
  21500. break;
  21501. case 'hh':
  21502. output = '%d तास';
  21503. break;
  21504. case 'd':
  21505. output = 'एक दिवस';
  21506. break;
  21507. case 'dd':
  21508. output = '%d दिवस';
  21509. break;
  21510. case 'M':
  21511. output = 'एक महिना';
  21512. break;
  21513. case 'MM':
  21514. output = '%d महिने';
  21515. break;
  21516. case 'y':
  21517. output = 'एक वर्ष';
  21518. break;
  21519. case 'yy':
  21520. output = '%d वर्षे';
  21521. break;
  21522. }
  21523. } else {
  21524. switch (string) {
  21525. case 's':
  21526. output = 'काही सेकंदां';
  21527. break;
  21528. case 'ss':
  21529. output = '%d सेकंदां';
  21530. break;
  21531. case 'm':
  21532. output = 'एका मिनिटा';
  21533. break;
  21534. case 'mm':
  21535. output = '%d मिनिटां';
  21536. break;
  21537. case 'h':
  21538. output = 'एका तासा';
  21539. break;
  21540. case 'hh':
  21541. output = '%d तासां';
  21542. break;
  21543. case 'd':
  21544. output = 'एका दिवसा';
  21545. break;
  21546. case 'dd':
  21547. output = '%d दिवसां';
  21548. break;
  21549. case 'M':
  21550. output = 'एका महिन्या';
  21551. break;
  21552. case 'MM':
  21553. output = '%d महिन्यां';
  21554. break;
  21555. case 'y':
  21556. output = 'एका वर्षा';
  21557. break;
  21558. case 'yy':
  21559. output = '%d वर्षां';
  21560. break;
  21561. }
  21562. }
  21563. return output.replace(/%d/i, number);
  21564. }
  21565. hooks.defineLocale('mr', {
  21566. months: 'जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर'.split(
  21567. '_'
  21568. ),
  21569. monthsShort:
  21570. 'जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.'.split(
  21571. '_'
  21572. ),
  21573. monthsParseExact: true,
  21574. weekdays: 'रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'),
  21575. weekdaysShort: 'रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि'.split('_'),
  21576. weekdaysMin: 'र_सो_मं_बु_गु_शु_श'.split('_'),
  21577. longDateFormat: {
  21578. LT: 'A h:mm वाजता',
  21579. LTS: 'A h:mm:ss वाजता',
  21580. L: 'DD/MM/YYYY',
  21581. LL: 'D MMMM YYYY',
  21582. LLL: 'D MMMM YYYY, A h:mm वाजता',
  21583. LLLL: 'dddd, D MMMM YYYY, A h:mm वाजता',
  21584. },
  21585. calendar: {
  21586. sameDay: '[आज] LT',
  21587. nextDay: '[उद्या] LT',
  21588. nextWeek: 'dddd, LT',
  21589. lastDay: '[काल] LT',
  21590. lastWeek: '[मागील] dddd, LT',
  21591. sameElse: 'L',
  21592. },
  21593. relativeTime: {
  21594. future: '%sमध्ये',
  21595. past: '%sपूर्वी',
  21596. s: relativeTimeMr,
  21597. ss: relativeTimeMr,
  21598. m: relativeTimeMr,
  21599. mm: relativeTimeMr,
  21600. h: relativeTimeMr,
  21601. hh: relativeTimeMr,
  21602. d: relativeTimeMr,
  21603. dd: relativeTimeMr,
  21604. M: relativeTimeMr,
  21605. MM: relativeTimeMr,
  21606. y: relativeTimeMr,
  21607. yy: relativeTimeMr,
  21608. },
  21609. preparse: function (string) {
  21610. return string.replace(/[१२३४५६७८९०]/g, function (match) {
  21611. return numberMap$b[match];
  21612. });
  21613. },
  21614. postformat: function (string) {
  21615. return string.replace(/\d/g, function (match) {
  21616. return symbolMap$c[match];
  21617. });
  21618. },
  21619. meridiemParse: /पहाटे|सकाळी|दुपारी|सायंकाळी|रात्री/,
  21620. meridiemHour: function (hour, meridiem) {
  21621. if (hour === 12) {
  21622. hour = 0;
  21623. }
  21624. if (meridiem === 'पहाटे' || meridiem === 'सकाळी') {
  21625. return hour;
  21626. } else if (
  21627. meridiem === 'दुपारी' ||
  21628. meridiem === 'सायंकाळी' ||
  21629. meridiem === 'रात्री'
  21630. ) {
  21631. return hour >= 12 ? hour : hour + 12;
  21632. }
  21633. },
  21634. meridiem: function (hour, minute, isLower) {
  21635. if (hour >= 0 && hour < 6) {
  21636. return 'पहाटे';
  21637. } else if (hour < 12) {
  21638. return 'सकाळी';
  21639. } else if (hour < 17) {
  21640. return 'दुपारी';
  21641. } else if (hour < 20) {
  21642. return 'सायंकाळी';
  21643. } else {
  21644. return 'रात्री';
  21645. }
  21646. },
  21647. week: {
  21648. dow: 0, // Sunday is the first day of the week.
  21649. doy: 6, // The week that contains Jan 6th is the first week of the year.
  21650. },
  21651. });
  21652. //! moment.js locale configuration
  21653. hooks.defineLocale('ms-my', {
  21654. months: 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split(
  21655. '_'
  21656. ),
  21657. monthsShort: 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'),
  21658. weekdays: 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'),
  21659. weekdaysShort: 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'),
  21660. weekdaysMin: 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'),
  21661. longDateFormat: {
  21662. LT: 'HH.mm',
  21663. LTS: 'HH.mm.ss',
  21664. L: 'DD/MM/YYYY',
  21665. LL: 'D MMMM YYYY',
  21666. LLL: 'D MMMM YYYY [pukul] HH.mm',
  21667. LLLL: 'dddd, D MMMM YYYY [pukul] HH.mm',
  21668. },
  21669. meridiemParse: /pagi|tengahari|petang|malam/,
  21670. meridiemHour: function (hour, meridiem) {
  21671. if (hour === 12) {
  21672. hour = 0;
  21673. }
  21674. if (meridiem === 'pagi') {
  21675. return hour;
  21676. } else if (meridiem === 'tengahari') {
  21677. return hour >= 11 ? hour : hour + 12;
  21678. } else if (meridiem === 'petang' || meridiem === 'malam') {
  21679. return hour + 12;
  21680. }
  21681. },
  21682. meridiem: function (hours, minutes, isLower) {
  21683. if (hours < 11) {
  21684. return 'pagi';
  21685. } else if (hours < 15) {
  21686. return 'tengahari';
  21687. } else if (hours < 19) {
  21688. return 'petang';
  21689. } else {
  21690. return 'malam';
  21691. }
  21692. },
  21693. calendar: {
  21694. sameDay: '[Hari ini pukul] LT',
  21695. nextDay: '[Esok pukul] LT',
  21696. nextWeek: 'dddd [pukul] LT',
  21697. lastDay: '[Kelmarin pukul] LT',
  21698. lastWeek: 'dddd [lepas pukul] LT',
  21699. sameElse: 'L',
  21700. },
  21701. relativeTime: {
  21702. future: 'dalam %s',
  21703. past: '%s yang lepas',
  21704. s: 'beberapa saat',
  21705. ss: '%d saat',
  21706. m: 'seminit',
  21707. mm: '%d minit',
  21708. h: 'sejam',
  21709. hh: '%d jam',
  21710. d: 'sehari',
  21711. dd: '%d hari',
  21712. M: 'sebulan',
  21713. MM: '%d bulan',
  21714. y: 'setahun',
  21715. yy: '%d tahun',
  21716. },
  21717. week: {
  21718. dow: 1, // Monday is the first day of the week.
  21719. doy: 7, // The week that contains Jan 7th is the first week of the year.
  21720. },
  21721. });
  21722. //! moment.js locale configuration
  21723. hooks.defineLocale('ms', {
  21724. months: 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split(
  21725. '_'
  21726. ),
  21727. monthsShort: 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'),
  21728. weekdays: 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'),
  21729. weekdaysShort: 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'),
  21730. weekdaysMin: 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'),
  21731. longDateFormat: {
  21732. LT: 'HH.mm',
  21733. LTS: 'HH.mm.ss',
  21734. L: 'DD/MM/YYYY',
  21735. LL: 'D MMMM YYYY',
  21736. LLL: 'D MMMM YYYY [pukul] HH.mm',
  21737. LLLL: 'dddd, D MMMM YYYY [pukul] HH.mm',
  21738. },
  21739. meridiemParse: /pagi|tengahari|petang|malam/,
  21740. meridiemHour: function (hour, meridiem) {
  21741. if (hour === 12) {
  21742. hour = 0;
  21743. }
  21744. if (meridiem === 'pagi') {
  21745. return hour;
  21746. } else if (meridiem === 'tengahari') {
  21747. return hour >= 11 ? hour : hour + 12;
  21748. } else if (meridiem === 'petang' || meridiem === 'malam') {
  21749. return hour + 12;
  21750. }
  21751. },
  21752. meridiem: function (hours, minutes, isLower) {
  21753. if (hours < 11) {
  21754. return 'pagi';
  21755. } else if (hours < 15) {
  21756. return 'tengahari';
  21757. } else if (hours < 19) {
  21758. return 'petang';
  21759. } else {
  21760. return 'malam';
  21761. }
  21762. },
  21763. calendar: {
  21764. sameDay: '[Hari ini pukul] LT',
  21765. nextDay: '[Esok pukul] LT',
  21766. nextWeek: 'dddd [pukul] LT',
  21767. lastDay: '[Kelmarin pukul] LT',
  21768. lastWeek: 'dddd [lepas pukul] LT',
  21769. sameElse: 'L',
  21770. },
  21771. relativeTime: {
  21772. future: 'dalam %s',
  21773. past: '%s yang lepas',
  21774. s: 'beberapa saat',
  21775. ss: '%d saat',
  21776. m: 'seminit',
  21777. mm: '%d minit',
  21778. h: 'sejam',
  21779. hh: '%d jam',
  21780. d: 'sehari',
  21781. dd: '%d hari',
  21782. M: 'sebulan',
  21783. MM: '%d bulan',
  21784. y: 'setahun',
  21785. yy: '%d tahun',
  21786. },
  21787. week: {
  21788. dow: 1, // Monday is the first day of the week.
  21789. doy: 7, // The week that contains Jan 7th is the first week of the year.
  21790. },
  21791. });
  21792. //! moment.js locale configuration
  21793. hooks.defineLocale('mt', {
  21794. months: 'Jannar_Frar_Marzu_April_Mejju_Ġunju_Lulju_Awwissu_Settembru_Ottubru_Novembru_Diċembru'.split(
  21795. '_'
  21796. ),
  21797. monthsShort: 'Jan_Fra_Mar_Apr_Mej_Ġun_Lul_Aww_Set_Ott_Nov_Diċ'.split('_'),
  21798. weekdays:
  21799. 'Il-Ħadd_It-Tnejn_It-Tlieta_L-Erbgħa_Il-Ħamis_Il-Ġimgħa_Is-Sibt'.split(
  21800. '_'
  21801. ),
  21802. weekdaysShort: 'Ħad_Tne_Tli_Erb_Ħam_Ġim_Sib'.split('_'),
  21803. weekdaysMin: 'Ħa_Tn_Tl_Er_Ħa_Ġi_Si'.split('_'),
  21804. longDateFormat: {
  21805. LT: 'HH:mm',
  21806. LTS: 'HH:mm:ss',
  21807. L: 'DD/MM/YYYY',
  21808. LL: 'D MMMM YYYY',
  21809. LLL: 'D MMMM YYYY HH:mm',
  21810. LLLL: 'dddd, D MMMM YYYY HH:mm',
  21811. },
  21812. calendar: {
  21813. sameDay: '[Illum fil-]LT',
  21814. nextDay: '[Għada fil-]LT',
  21815. nextWeek: 'dddd [fil-]LT',
  21816. lastDay: '[Il-bieraħ fil-]LT',
  21817. lastWeek: 'dddd [li għadda] [fil-]LT',
  21818. sameElse: 'L',
  21819. },
  21820. relativeTime: {
  21821. future: 'f’ %s',
  21822. past: '%s ilu',
  21823. s: 'ftit sekondi',
  21824. ss: '%d sekondi',
  21825. m: 'minuta',
  21826. mm: '%d minuti',
  21827. h: 'siegħa',
  21828. hh: '%d siegħat',
  21829. d: 'ġurnata',
  21830. dd: '%d ġranet',
  21831. M: 'xahar',
  21832. MM: '%d xhur',
  21833. y: 'sena',
  21834. yy: '%d sni',
  21835. },
  21836. dayOfMonthOrdinalParse: /\d{1,2}º/,
  21837. ordinal: '%dº',
  21838. week: {
  21839. dow: 1, // Monday is the first day of the week.
  21840. doy: 4, // The week that contains Jan 4th is the first week of the year.
  21841. },
  21842. });
  21843. //! moment.js locale configuration
  21844. var symbolMap$d = {
  21845. 1: '၁',
  21846. 2: '၂',
  21847. 3: '၃',
  21848. 4: '၄',
  21849. 5: '၅',
  21850. 6: '၆',
  21851. 7: '၇',
  21852. 8: '၈',
  21853. 9: '၉',
  21854. 0: '၀',
  21855. },
  21856. numberMap$c = {
  21857. '၁': '1',
  21858. '၂': '2',
  21859. '၃': '3',
  21860. '၄': '4',
  21861. '၅': '5',
  21862. '၆': '6',
  21863. '၇': '7',
  21864. '၈': '8',
  21865. '၉': '9',
  21866. '၀': '0',
  21867. };
  21868. hooks.defineLocale('my', {
  21869. months: 'ဇန်နဝါရီ_ဖေဖော်ဝါရီ_မတ်_ဧပြီ_မေ_ဇွန်_ဇူလိုင်_သြဂုတ်_စက်တင်ဘာ_အောက်တိုဘာ_နိုဝင်ဘာ_ဒီဇင်ဘာ'.split(
  21870. '_'
  21871. ),
  21872. monthsShort: 'ဇန်_ဖေ_မတ်_ပြီ_မေ_ဇွန်_လိုင်_သြ_စက်_အောက်_နို_ဒီ'.split('_'),
  21873. weekdays: 'တနင်္ဂနွေ_တနင်္လာ_အင်္ဂါ_ဗုဒ္ဓဟူး_ကြာသပတေး_သောကြာ_စနေ'.split(
  21874. '_'
  21875. ),
  21876. weekdaysShort: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'),
  21877. weekdaysMin: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'),
  21878. longDateFormat: {
  21879. LT: 'HH:mm',
  21880. LTS: 'HH:mm:ss',
  21881. L: 'DD/MM/YYYY',
  21882. LL: 'D MMMM YYYY',
  21883. LLL: 'D MMMM YYYY HH:mm',
  21884. LLLL: 'dddd D MMMM YYYY HH:mm',
  21885. },
  21886. calendar: {
  21887. sameDay: '[ယနေ.] LT [မှာ]',
  21888. nextDay: '[မနက်ဖြန်] LT [မှာ]',
  21889. nextWeek: 'dddd LT [မှာ]',
  21890. lastDay: '[မနေ.က] LT [မှာ]',
  21891. lastWeek: '[ပြီးခဲ့သော] dddd LT [မှာ]',
  21892. sameElse: 'L',
  21893. },
  21894. relativeTime: {
  21895. future: 'လာမည့် %s မှာ',
  21896. past: 'လွန်ခဲ့သော %s က',
  21897. s: 'စက္ကန်.အနည်းငယ်',
  21898. ss: '%d စက္ကန့်',
  21899. m: 'တစ်မိနစ်',
  21900. mm: '%d မိနစ်',
  21901. h: 'တစ်နာရီ',
  21902. hh: '%d နာရီ',
  21903. d: 'တစ်ရက်',
  21904. dd: '%d ရက်',
  21905. M: 'တစ်လ',
  21906. MM: '%d လ',
  21907. y: 'တစ်နှစ်',
  21908. yy: '%d နှစ်',
  21909. },
  21910. preparse: function (string) {
  21911. return string.replace(/[၁၂၃၄၅၆၇၈၉၀]/g, function (match) {
  21912. return numberMap$c[match];
  21913. });
  21914. },
  21915. postformat: function (string) {
  21916. return string.replace(/\d/g, function (match) {
  21917. return symbolMap$d[match];
  21918. });
  21919. },
  21920. week: {
  21921. dow: 1, // Monday is the first day of the week.
  21922. doy: 4, // The week that contains Jan 4th is the first week of the year.
  21923. },
  21924. });
  21925. //! moment.js locale configuration
  21926. hooks.defineLocale('nb', {
  21927. months: 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split(
  21928. '_'
  21929. ),
  21930. monthsShort:
  21931. 'jan._feb._mars_apr._mai_juni_juli_aug._sep._okt._nov._des.'.split('_'),
  21932. monthsParseExact: true,
  21933. weekdays: 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'),
  21934. weekdaysShort: 'sø._ma._ti._on._to._fr._lø.'.split('_'),
  21935. weekdaysMin: 'sø_ma_ti_on_to_fr_lø'.split('_'),
  21936. weekdaysParseExact: true,
  21937. longDateFormat: {
  21938. LT: 'HH:mm',
  21939. LTS: 'HH:mm:ss',
  21940. L: 'DD.MM.YYYY',
  21941. LL: 'D. MMMM YYYY',
  21942. LLL: 'D. MMMM YYYY [kl.] HH:mm',
  21943. LLLL: 'dddd D. MMMM YYYY [kl.] HH:mm',
  21944. },
  21945. calendar: {
  21946. sameDay: '[i dag kl.] LT',
  21947. nextDay: '[i morgen kl.] LT',
  21948. nextWeek: 'dddd [kl.] LT',
  21949. lastDay: '[i går kl.] LT',
  21950. lastWeek: '[forrige] dddd [kl.] LT',
  21951. sameElse: 'L',
  21952. },
  21953. relativeTime: {
  21954. future: 'om %s',
  21955. past: '%s siden',
  21956. s: 'noen sekunder',
  21957. ss: '%d sekunder',
  21958. m: 'ett minutt',
  21959. mm: '%d minutter',
  21960. h: 'en time',
  21961. hh: '%d timer',
  21962. d: 'en dag',
  21963. dd: '%d dager',
  21964. w: 'en uke',
  21965. ww: '%d uker',
  21966. M: 'en måned',
  21967. MM: '%d måneder',
  21968. y: 'ett år',
  21969. yy: '%d år',
  21970. },
  21971. dayOfMonthOrdinalParse: /\d{1,2}\./,
  21972. ordinal: '%d.',
  21973. week: {
  21974. dow: 1, // Monday is the first day of the week.
  21975. doy: 4, // The week that contains Jan 4th is the first week of the year.
  21976. },
  21977. });
  21978. //! moment.js locale configuration
  21979. var symbolMap$e = {
  21980. 1: '१',
  21981. 2: '२',
  21982. 3: '३',
  21983. 4: '४',
  21984. 5: '५',
  21985. 6: '६',
  21986. 7: '७',
  21987. 8: '८',
  21988. 9: '९',
  21989. 0: '०',
  21990. },
  21991. numberMap$d = {
  21992. '१': '1',
  21993. '२': '2',
  21994. '३': '3',
  21995. '४': '4',
  21996. '५': '5',
  21997. '६': '6',
  21998. '७': '7',
  21999. '८': '8',
  22000. '९': '9',
  22001. '०': '0',
  22002. };
  22003. hooks.defineLocale('ne', {
  22004. months: 'जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर'.split(
  22005. '_'
  22006. ),
  22007. monthsShort:
  22008. 'जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.'.split(
  22009. '_'
  22010. ),
  22011. monthsParseExact: true,
  22012. weekdays: 'आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार'.split(
  22013. '_'
  22014. ),
  22015. weekdaysShort: 'आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.'.split('_'),
  22016. weekdaysMin: 'आ._सो._मं._बु._बि._शु._श.'.split('_'),
  22017. weekdaysParseExact: true,
  22018. longDateFormat: {
  22019. LT: 'Aको h:mm बजे',
  22020. LTS: 'Aको h:mm:ss बजे',
  22021. L: 'DD/MM/YYYY',
  22022. LL: 'D MMMM YYYY',
  22023. LLL: 'D MMMM YYYY, Aको h:mm बजे',
  22024. LLLL: 'dddd, D MMMM YYYY, Aको h:mm बजे',
  22025. },
  22026. preparse: function (string) {
  22027. return string.replace(/[१२३४५६७८९०]/g, function (match) {
  22028. return numberMap$d[match];
  22029. });
  22030. },
  22031. postformat: function (string) {
  22032. return string.replace(/\d/g, function (match) {
  22033. return symbolMap$e[match];
  22034. });
  22035. },
  22036. meridiemParse: /राति|बिहान|दिउँसो|साँझ/,
  22037. meridiemHour: function (hour, meridiem) {
  22038. if (hour === 12) {
  22039. hour = 0;
  22040. }
  22041. if (meridiem === 'राति') {
  22042. return hour < 4 ? hour : hour + 12;
  22043. } else if (meridiem === 'बिहान') {
  22044. return hour;
  22045. } else if (meridiem === 'दिउँसो') {
  22046. return hour >= 10 ? hour : hour + 12;
  22047. } else if (meridiem === 'साँझ') {
  22048. return hour + 12;
  22049. }
  22050. },
  22051. meridiem: function (hour, minute, isLower) {
  22052. if (hour < 3) {
  22053. return 'राति';
  22054. } else if (hour < 12) {
  22055. return 'बिहान';
  22056. } else if (hour < 16) {
  22057. return 'दिउँसो';
  22058. } else if (hour < 20) {
  22059. return 'साँझ';
  22060. } else {
  22061. return 'राति';
  22062. }
  22063. },
  22064. calendar: {
  22065. sameDay: '[आज] LT',
  22066. nextDay: '[भोलि] LT',
  22067. nextWeek: '[आउँदो] dddd[,] LT',
  22068. lastDay: '[हिजो] LT',
  22069. lastWeek: '[गएको] dddd[,] LT',
  22070. sameElse: 'L',
  22071. },
  22072. relativeTime: {
  22073. future: '%sमा',
  22074. past: '%s अगाडि',
  22075. s: 'केही क्षण',
  22076. ss: '%d सेकेण्ड',
  22077. m: 'एक मिनेट',
  22078. mm: '%d मिनेट',
  22079. h: 'एक घण्टा',
  22080. hh: '%d घण्टा',
  22081. d: 'एक दिन',
  22082. dd: '%d दिन',
  22083. M: 'एक महिना',
  22084. MM: '%d महिना',
  22085. y: 'एक बर्ष',
  22086. yy: '%d बर्ष',
  22087. },
  22088. week: {
  22089. dow: 0, // Sunday is the first day of the week.
  22090. doy: 6, // The week that contains Jan 6th is the first week of the year.
  22091. },
  22092. });
  22093. //! moment.js locale configuration
  22094. var monthsShortWithDots$1 =
  22095. 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split('_'),
  22096. monthsShortWithoutDots$1 =
  22097. 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_'),
  22098. monthsParse$8 = [
  22099. /^jan/i,
  22100. /^feb/i,
  22101. /^maart|mrt.?$/i,
  22102. /^apr/i,
  22103. /^mei$/i,
  22104. /^jun[i.]?$/i,
  22105. /^jul[i.]?$/i,
  22106. /^aug/i,
  22107. /^sep/i,
  22108. /^okt/i,
  22109. /^nov/i,
  22110. /^dec/i,
  22111. ],
  22112. monthsRegex$8 =
  22113. /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;
  22114. hooks.defineLocale('nl-be', {
  22115. months: 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split(
  22116. '_'
  22117. ),
  22118. monthsShort: function (m, format) {
  22119. if (!m) {
  22120. return monthsShortWithDots$1;
  22121. } else if (/-MMM-/.test(format)) {
  22122. return monthsShortWithoutDots$1[m.month()];
  22123. } else {
  22124. return monthsShortWithDots$1[m.month()];
  22125. }
  22126. },
  22127. monthsRegex: monthsRegex$8,
  22128. monthsShortRegex: monthsRegex$8,
  22129. monthsStrictRegex:
  22130. /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i,
  22131. monthsShortStrictRegex:
  22132. /^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i,
  22133. monthsParse: monthsParse$8,
  22134. longMonthsParse: monthsParse$8,
  22135. shortMonthsParse: monthsParse$8,
  22136. weekdays:
  22137. 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split('_'),
  22138. weekdaysShort: 'zo._ma._di._wo._do._vr._za.'.split('_'),
  22139. weekdaysMin: 'zo_ma_di_wo_do_vr_za'.split('_'),
  22140. weekdaysParseExact: true,
  22141. longDateFormat: {
  22142. LT: 'HH:mm',
  22143. LTS: 'HH:mm:ss',
  22144. L: 'DD/MM/YYYY',
  22145. LL: 'D MMMM YYYY',
  22146. LLL: 'D MMMM YYYY HH:mm',
  22147. LLLL: 'dddd D MMMM YYYY HH:mm',
  22148. },
  22149. calendar: {
  22150. sameDay: '[vandaag om] LT',
  22151. nextDay: '[morgen om] LT',
  22152. nextWeek: 'dddd [om] LT',
  22153. lastDay: '[gisteren om] LT',
  22154. lastWeek: '[afgelopen] dddd [om] LT',
  22155. sameElse: 'L',
  22156. },
  22157. relativeTime: {
  22158. future: 'over %s',
  22159. past: '%s geleden',
  22160. s: 'een paar seconden',
  22161. ss: '%d seconden',
  22162. m: 'één minuut',
  22163. mm: '%d minuten',
  22164. h: 'één uur',
  22165. hh: '%d uur',
  22166. d: 'één dag',
  22167. dd: '%d dagen',
  22168. M: 'één maand',
  22169. MM: '%d maanden',
  22170. y: 'één jaar',
  22171. yy: '%d jaar',
  22172. },
  22173. dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/,
  22174. ordinal: function (number) {
  22175. return (
  22176. number +
  22177. (number === 1 || number === 8 || number >= 20 ? 'ste' : 'de')
  22178. );
  22179. },
  22180. week: {
  22181. dow: 1, // Monday is the first day of the week.
  22182. doy: 4, // The week that contains Jan 4th is the first week of the year.
  22183. },
  22184. });
  22185. //! moment.js locale configuration
  22186. var monthsShortWithDots$2 =
  22187. 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split('_'),
  22188. monthsShortWithoutDots$2 =
  22189. 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_'),
  22190. monthsParse$9 = [
  22191. /^jan/i,
  22192. /^feb/i,
  22193. /^maart|mrt.?$/i,
  22194. /^apr/i,
  22195. /^mei$/i,
  22196. /^jun[i.]?$/i,
  22197. /^jul[i.]?$/i,
  22198. /^aug/i,
  22199. /^sep/i,
  22200. /^okt/i,
  22201. /^nov/i,
  22202. /^dec/i,
  22203. ],
  22204. monthsRegex$9 =
  22205. /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;
  22206. hooks.defineLocale('nl', {
  22207. months: 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split(
  22208. '_'
  22209. ),
  22210. monthsShort: function (m, format) {
  22211. if (!m) {
  22212. return monthsShortWithDots$2;
  22213. } else if (/-MMM-/.test(format)) {
  22214. return monthsShortWithoutDots$2[m.month()];
  22215. } else {
  22216. return monthsShortWithDots$2[m.month()];
  22217. }
  22218. },
  22219. monthsRegex: monthsRegex$9,
  22220. monthsShortRegex: monthsRegex$9,
  22221. monthsStrictRegex:
  22222. /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i,
  22223. monthsShortStrictRegex:
  22224. /^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i,
  22225. monthsParse: monthsParse$9,
  22226. longMonthsParse: monthsParse$9,
  22227. shortMonthsParse: monthsParse$9,
  22228. weekdays:
  22229. 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split('_'),
  22230. weekdaysShort: 'zo._ma._di._wo._do._vr._za.'.split('_'),
  22231. weekdaysMin: 'zo_ma_di_wo_do_vr_za'.split('_'),
  22232. weekdaysParseExact: true,
  22233. longDateFormat: {
  22234. LT: 'HH:mm',
  22235. LTS: 'HH:mm:ss',
  22236. L: 'DD-MM-YYYY',
  22237. LL: 'D MMMM YYYY',
  22238. LLL: 'D MMMM YYYY HH:mm',
  22239. LLLL: 'dddd D MMMM YYYY HH:mm',
  22240. },
  22241. calendar: {
  22242. sameDay: '[vandaag om] LT',
  22243. nextDay: '[morgen om] LT',
  22244. nextWeek: 'dddd [om] LT',
  22245. lastDay: '[gisteren om] LT',
  22246. lastWeek: '[afgelopen] dddd [om] LT',
  22247. sameElse: 'L',
  22248. },
  22249. relativeTime: {
  22250. future: 'over %s',
  22251. past: '%s geleden',
  22252. s: 'een paar seconden',
  22253. ss: '%d seconden',
  22254. m: 'één minuut',
  22255. mm: '%d minuten',
  22256. h: 'één uur',
  22257. hh: '%d uur',
  22258. d: 'één dag',
  22259. dd: '%d dagen',
  22260. w: 'één week',
  22261. ww: '%d weken',
  22262. M: 'één maand',
  22263. MM: '%d maanden',
  22264. y: 'één jaar',
  22265. yy: '%d jaar',
  22266. },
  22267. dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/,
  22268. ordinal: function (number) {
  22269. return (
  22270. number +
  22271. (number === 1 || number === 8 || number >= 20 ? 'ste' : 'de')
  22272. );
  22273. },
  22274. week: {
  22275. dow: 1, // Monday is the first day of the week.
  22276. doy: 4, // The week that contains Jan 4th is the first week of the year.
  22277. },
  22278. });
  22279. //! moment.js locale configuration
  22280. hooks.defineLocale('nn', {
  22281. months: 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split(
  22282. '_'
  22283. ),
  22284. monthsShort:
  22285. 'jan._feb._mars_apr._mai_juni_juli_aug._sep._okt._nov._des.'.split('_'),
  22286. monthsParseExact: true,
  22287. weekdays: 'sundag_måndag_tysdag_onsdag_torsdag_fredag_laurdag'.split('_'),
  22288. weekdaysShort: 'su._må._ty._on._to._fr._lau.'.split('_'),
  22289. weekdaysMin: 'su_må_ty_on_to_fr_la'.split('_'),
  22290. weekdaysParseExact: true,
  22291. longDateFormat: {
  22292. LT: 'HH:mm',
  22293. LTS: 'HH:mm:ss',
  22294. L: 'DD.MM.YYYY',
  22295. LL: 'D. MMMM YYYY',
  22296. LLL: 'D. MMMM YYYY [kl.] H:mm',
  22297. LLLL: 'dddd D. MMMM YYYY [kl.] HH:mm',
  22298. },
  22299. calendar: {
  22300. sameDay: '[I dag klokka] LT',
  22301. nextDay: '[I morgon klokka] LT',
  22302. nextWeek: 'dddd [klokka] LT',
  22303. lastDay: '[I går klokka] LT',
  22304. lastWeek: '[Føregåande] dddd [klokka] LT',
  22305. sameElse: 'L',
  22306. },
  22307. relativeTime: {
  22308. future: 'om %s',
  22309. past: '%s sidan',
  22310. s: 'nokre sekund',
  22311. ss: '%d sekund',
  22312. m: 'eit minutt',
  22313. mm: '%d minutt',
  22314. h: 'ein time',
  22315. hh: '%d timar',
  22316. d: 'ein dag',
  22317. dd: '%d dagar',
  22318. w: 'ei veke',
  22319. ww: '%d veker',
  22320. M: 'ein månad',
  22321. MM: '%d månader',
  22322. y: 'eit år',
  22323. yy: '%d år',
  22324. },
  22325. dayOfMonthOrdinalParse: /\d{1,2}\./,
  22326. ordinal: '%d.',
  22327. week: {
  22328. dow: 1, // Monday is the first day of the week.
  22329. doy: 4, // The week that contains Jan 4th is the first week of the year.
  22330. },
  22331. });
  22332. //! moment.js locale configuration
  22333. hooks.defineLocale('oc-lnc', {
  22334. months: {
  22335. standalone:
  22336. 'genièr_febrièr_març_abril_mai_junh_julhet_agost_setembre_octòbre_novembre_decembre'.split(
  22337. '_'
  22338. ),
  22339. format: "de genièr_de febrièr_de març_d'abril_de mai_de junh_de julhet_d'agost_de setembre_d'octòbre_de novembre_de decembre".split(
  22340. '_'
  22341. ),
  22342. isFormat: /D[oD]?(\s)+MMMM/,
  22343. },
  22344. monthsShort:
  22345. 'gen._febr._març_abr._mai_junh_julh._ago._set._oct._nov._dec.'.split(
  22346. '_'
  22347. ),
  22348. monthsParseExact: true,
  22349. weekdays: 'dimenge_diluns_dimars_dimècres_dijòus_divendres_dissabte'.split(
  22350. '_'
  22351. ),
  22352. weekdaysShort: 'dg._dl._dm._dc._dj._dv._ds.'.split('_'),
  22353. weekdaysMin: 'dg_dl_dm_dc_dj_dv_ds'.split('_'),
  22354. weekdaysParseExact: true,
  22355. longDateFormat: {
  22356. LT: 'H:mm',
  22357. LTS: 'H:mm:ss',
  22358. L: 'DD/MM/YYYY',
  22359. LL: 'D MMMM [de] YYYY',
  22360. ll: 'D MMM YYYY',
  22361. LLL: 'D MMMM [de] YYYY [a] H:mm',
  22362. lll: 'D MMM YYYY, H:mm',
  22363. LLLL: 'dddd D MMMM [de] YYYY [a] H:mm',
  22364. llll: 'ddd D MMM YYYY, H:mm',
  22365. },
  22366. calendar: {
  22367. sameDay: '[uèi a] LT',
  22368. nextDay: '[deman a] LT',
  22369. nextWeek: 'dddd [a] LT',
  22370. lastDay: '[ièr a] LT',
  22371. lastWeek: 'dddd [passat a] LT',
  22372. sameElse: 'L',
  22373. },
  22374. relativeTime: {
  22375. future: "d'aquí %s",
  22376. past: 'fa %s',
  22377. s: 'unas segondas',
  22378. ss: '%d segondas',
  22379. m: 'una minuta',
  22380. mm: '%d minutas',
  22381. h: 'una ora',
  22382. hh: '%d oras',
  22383. d: 'un jorn',
  22384. dd: '%d jorns',
  22385. M: 'un mes',
  22386. MM: '%d meses',
  22387. y: 'un an',
  22388. yy: '%d ans',
  22389. },
  22390. dayOfMonthOrdinalParse: /\d{1,2}(r|n|t|è|a)/,
  22391. ordinal: function (number, period) {
  22392. var output =
  22393. number === 1
  22394. ? 'r'
  22395. : number === 2
  22396. ? 'n'
  22397. : number === 3
  22398. ? 'r'
  22399. : number === 4
  22400. ? 't'
  22401. : 'è';
  22402. if (period === 'w' || period === 'W') {
  22403. output = 'a';
  22404. }
  22405. return number + output;
  22406. },
  22407. week: {
  22408. dow: 1, // Monday is the first day of the week.
  22409. doy: 4,
  22410. },
  22411. });
  22412. //! moment.js locale configuration
  22413. var symbolMap$f = {
  22414. 1: '੧',
  22415. 2: '੨',
  22416. 3: '੩',
  22417. 4: '੪',
  22418. 5: '੫',
  22419. 6: '੬',
  22420. 7: '੭',
  22421. 8: '੮',
  22422. 9: '੯',
  22423. 0: '੦',
  22424. },
  22425. numberMap$e = {
  22426. '੧': '1',
  22427. '੨': '2',
  22428. '੩': '3',
  22429. '੪': '4',
  22430. '੫': '5',
  22431. '੬': '6',
  22432. '੭': '7',
  22433. '੮': '8',
  22434. '੯': '9',
  22435. '੦': '0',
  22436. };
  22437. hooks.defineLocale('pa-in', {
  22438. // There are months name as per Nanakshahi Calendar but they are not used as rigidly in modern Punjabi.
  22439. months: 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split(
  22440. '_'
  22441. ),
  22442. monthsShort:
  22443. 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split(
  22444. '_'
  22445. ),
  22446. weekdays: 'ਐਤਵਾਰ_ਸੋਮਵਾਰ_ਮੰਗਲਵਾਰ_ਬੁਧਵਾਰ_ਵੀਰਵਾਰ_ਸ਼ੁੱਕਰਵਾਰ_ਸ਼ਨੀਚਰਵਾਰ'.split(
  22447. '_'
  22448. ),
  22449. weekdaysShort: 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'),
  22450. weekdaysMin: 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'),
  22451. longDateFormat: {
  22452. LT: 'A h:mm ਵਜੇ',
  22453. LTS: 'A h:mm:ss ਵਜੇ',
  22454. L: 'DD/MM/YYYY',
  22455. LL: 'D MMMM YYYY',
  22456. LLL: 'D MMMM YYYY, A h:mm ਵਜੇ',
  22457. LLLL: 'dddd, D MMMM YYYY, A h:mm ਵਜੇ',
  22458. },
  22459. calendar: {
  22460. sameDay: '[ਅਜ] LT',
  22461. nextDay: '[ਕਲ] LT',
  22462. nextWeek: '[ਅਗਲਾ] dddd, LT',
  22463. lastDay: '[ਕਲ] LT',
  22464. lastWeek: '[ਪਿਛਲੇ] dddd, LT',
  22465. sameElse: 'L',
  22466. },
  22467. relativeTime: {
  22468. future: '%s ਵਿੱਚ',
  22469. past: '%s ਪਿਛਲੇ',
  22470. s: 'ਕੁਝ ਸਕਿੰਟ',
  22471. ss: '%d ਸਕਿੰਟ',
  22472. m: 'ਇਕ ਮਿੰਟ',
  22473. mm: '%d ਮਿੰਟ',
  22474. h: 'ਇੱਕ ਘੰਟਾ',
  22475. hh: '%d ਘੰਟੇ',
  22476. d: 'ਇੱਕ ਦਿਨ',
  22477. dd: '%d ਦਿਨ',
  22478. M: 'ਇੱਕ ਮਹੀਨਾ',
  22479. MM: '%d ਮਹੀਨੇ',
  22480. y: 'ਇੱਕ ਸਾਲ',
  22481. yy: '%d ਸਾਲ',
  22482. },
  22483. preparse: function (string) {
  22484. return string.replace(/[੧੨੩੪੫੬੭੮੯੦]/g, function (match) {
  22485. return numberMap$e[match];
  22486. });
  22487. },
  22488. postformat: function (string) {
  22489. return string.replace(/\d/g, function (match) {
  22490. return symbolMap$f[match];
  22491. });
  22492. },
  22493. // Punjabi notation for meridiems are quite fuzzy in practice. While there exists
  22494. // a rigid notion of a 'Pahar' it is not used as rigidly in modern Punjabi.
  22495. meridiemParse: /ਰਾਤ|ਸਵੇਰ|ਦੁਪਹਿਰ|ਸ਼ਾਮ/,
  22496. meridiemHour: function (hour, meridiem) {
  22497. if (hour === 12) {
  22498. hour = 0;
  22499. }
  22500. if (meridiem === 'ਰਾਤ') {
  22501. return hour < 4 ? hour : hour + 12;
  22502. } else if (meridiem === 'ਸਵੇਰ') {
  22503. return hour;
  22504. } else if (meridiem === 'ਦੁਪਹਿਰ') {
  22505. return hour >= 10 ? hour : hour + 12;
  22506. } else if (meridiem === 'ਸ਼ਾਮ') {
  22507. return hour + 12;
  22508. }
  22509. },
  22510. meridiem: function (hour, minute, isLower) {
  22511. if (hour < 4) {
  22512. return 'ਰਾਤ';
  22513. } else if (hour < 10) {
  22514. return 'ਸਵੇਰ';
  22515. } else if (hour < 17) {
  22516. return 'ਦੁਪਹਿਰ';
  22517. } else if (hour < 20) {
  22518. return 'ਸ਼ਾਮ';
  22519. } else {
  22520. return 'ਰਾਤ';
  22521. }
  22522. },
  22523. week: {
  22524. dow: 0, // Sunday is the first day of the week.
  22525. doy: 6, // The week that contains Jan 6th is the first week of the year.
  22526. },
  22527. });
  22528. //! moment.js locale configuration
  22529. var monthsNominative =
  22530. 'styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień'.split(
  22531. '_'
  22532. ),
  22533. monthsSubjective =
  22534. 'stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia'.split(
  22535. '_'
  22536. ),
  22537. monthsParse$a = [
  22538. /^sty/i,
  22539. /^lut/i,
  22540. /^mar/i,
  22541. /^kwi/i,
  22542. /^maj/i,
  22543. /^cze/i,
  22544. /^lip/i,
  22545. /^sie/i,
  22546. /^wrz/i,
  22547. /^paź/i,
  22548. /^lis/i,
  22549. /^gru/i,
  22550. ];
  22551. function plural$3(n) {
  22552. return n % 10 < 5 && n % 10 > 1 && ~~(n / 10) % 10 !== 1;
  22553. }
  22554. function translate$8(number, withoutSuffix, key) {
  22555. var result = number + ' ';
  22556. switch (key) {
  22557. case 'ss':
  22558. return result + (plural$3(number) ? 'sekundy' : 'sekund');
  22559. case 'm':
  22560. return withoutSuffix ? 'minuta' : 'minutę';
  22561. case 'mm':
  22562. return result + (plural$3(number) ? 'minuty' : 'minut');
  22563. case 'h':
  22564. return withoutSuffix ? 'godzina' : 'godzinę';
  22565. case 'hh':
  22566. return result + (plural$3(number) ? 'godziny' : 'godzin');
  22567. case 'ww':
  22568. return result + (plural$3(number) ? 'tygodnie' : 'tygodni');
  22569. case 'MM':
  22570. return result + (plural$3(number) ? 'miesiące' : 'miesięcy');
  22571. case 'yy':
  22572. return result + (plural$3(number) ? 'lata' : 'lat');
  22573. }
  22574. }
  22575. hooks.defineLocale('pl', {
  22576. months: function (momentToFormat, format) {
  22577. if (!momentToFormat) {
  22578. return monthsNominative;
  22579. } else if (/D MMMM/.test(format)) {
  22580. return monthsSubjective[momentToFormat.month()];
  22581. } else {
  22582. return monthsNominative[momentToFormat.month()];
  22583. }
  22584. },
  22585. monthsShort: 'sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru'.split('_'),
  22586. monthsParse: monthsParse$a,
  22587. longMonthsParse: monthsParse$a,
  22588. shortMonthsParse: monthsParse$a,
  22589. weekdays:
  22590. 'niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota'.split('_'),
  22591. weekdaysShort: 'ndz_pon_wt_śr_czw_pt_sob'.split('_'),
  22592. weekdaysMin: 'Nd_Pn_Wt_Śr_Cz_Pt_So'.split('_'),
  22593. longDateFormat: {
  22594. LT: 'HH:mm',
  22595. LTS: 'HH:mm:ss',
  22596. L: 'DD.MM.YYYY',
  22597. LL: 'D MMMM YYYY',
  22598. LLL: 'D MMMM YYYY HH:mm',
  22599. LLLL: 'dddd, D MMMM YYYY HH:mm',
  22600. },
  22601. calendar: {
  22602. sameDay: '[Dziś o] LT',
  22603. nextDay: '[Jutro o] LT',
  22604. nextWeek: function () {
  22605. switch (this.day()) {
  22606. case 0:
  22607. return '[W niedzielę o] LT';
  22608. case 2:
  22609. return '[We wtorek o] LT';
  22610. case 3:
  22611. return '[W środę o] LT';
  22612. case 6:
  22613. return '[W sobotę o] LT';
  22614. default:
  22615. return '[W] dddd [o] LT';
  22616. }
  22617. },
  22618. lastDay: '[Wczoraj o] LT',
  22619. lastWeek: function () {
  22620. switch (this.day()) {
  22621. case 0:
  22622. return '[W zeszłą niedzielę o] LT';
  22623. case 3:
  22624. return '[W zeszłą środę o] LT';
  22625. case 6:
  22626. return '[W zeszłą sobotę o] LT';
  22627. default:
  22628. return '[W zeszły] dddd [o] LT';
  22629. }
  22630. },
  22631. sameElse: 'L',
  22632. },
  22633. relativeTime: {
  22634. future: 'za %s',
  22635. past: '%s temu',
  22636. s: 'kilka sekund',
  22637. ss: translate$8,
  22638. m: translate$8,
  22639. mm: translate$8,
  22640. h: translate$8,
  22641. hh: translate$8,
  22642. d: '1 dzień',
  22643. dd: '%d dni',
  22644. w: 'tydzień',
  22645. ww: translate$8,
  22646. M: 'miesiąc',
  22647. MM: translate$8,
  22648. y: 'rok',
  22649. yy: translate$8,
  22650. },
  22651. dayOfMonthOrdinalParse: /\d{1,2}\./,
  22652. ordinal: '%d.',
  22653. week: {
  22654. dow: 1, // Monday is the first day of the week.
  22655. doy: 4, // The week that contains Jan 4th is the first week of the year.
  22656. },
  22657. });
  22658. //! moment.js locale configuration
  22659. hooks.defineLocale('pt-br', {
  22660. months: 'janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro'.split(
  22661. '_'
  22662. ),
  22663. monthsShort: 'jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez'.split('_'),
  22664. weekdays:
  22665. 'domingo_segunda-feira_terça-feira_quarta-feira_quinta-feira_sexta-feira_sábado'.split(
  22666. '_'
  22667. ),
  22668. weekdaysShort: 'dom_seg_ter_qua_qui_sex_sáb'.split('_'),
  22669. weekdaysMin: 'do_2ª_3ª_4ª_5ª_6ª_sá'.split('_'),
  22670. weekdaysParseExact: true,
  22671. longDateFormat: {
  22672. LT: 'HH:mm',
  22673. LTS: 'HH:mm:ss',
  22674. L: 'DD/MM/YYYY',
  22675. LL: 'D [de] MMMM [de] YYYY',
  22676. LLL: 'D [de] MMMM [de] YYYY [às] HH:mm',
  22677. LLLL: 'dddd, D [de] MMMM [de] YYYY [às] HH:mm',
  22678. },
  22679. calendar: {
  22680. sameDay: '[Hoje às] LT',
  22681. nextDay: '[Amanhã às] LT',
  22682. nextWeek: 'dddd [às] LT',
  22683. lastDay: '[Ontem às] LT',
  22684. lastWeek: function () {
  22685. return this.day() === 0 || this.day() === 6
  22686. ? '[Último] dddd [às] LT' // Saturday + Sunday
  22687. : '[Última] dddd [às] LT'; // Monday - Friday
  22688. },
  22689. sameElse: 'L',
  22690. },
  22691. relativeTime: {
  22692. future: 'em %s',
  22693. past: 'há %s',
  22694. s: 'poucos segundos',
  22695. ss: '%d segundos',
  22696. m: 'um minuto',
  22697. mm: '%d minutos',
  22698. h: 'uma hora',
  22699. hh: '%d horas',
  22700. d: 'um dia',
  22701. dd: '%d dias',
  22702. M: 'um mês',
  22703. MM: '%d meses',
  22704. y: 'um ano',
  22705. yy: '%d anos',
  22706. },
  22707. dayOfMonthOrdinalParse: /\d{1,2}º/,
  22708. ordinal: '%dº',
  22709. invalidDate: 'Data inválida',
  22710. });
  22711. //! moment.js locale configuration
  22712. hooks.defineLocale('pt', {
  22713. months: 'janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro'.split(
  22714. '_'
  22715. ),
  22716. monthsShort: 'jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez'.split('_'),
  22717. weekdays:
  22718. 'Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado'.split(
  22719. '_'
  22720. ),
  22721. weekdaysShort: 'Dom_Seg_Ter_Qua_Qui_Sex_Sáb'.split('_'),
  22722. weekdaysMin: 'Do_2ª_3ª_4ª_5ª_6ª_Sá'.split('_'),
  22723. weekdaysParseExact: true,
  22724. longDateFormat: {
  22725. LT: 'HH:mm',
  22726. LTS: 'HH:mm:ss',
  22727. L: 'DD/MM/YYYY',
  22728. LL: 'D [de] MMMM [de] YYYY',
  22729. LLL: 'D [de] MMMM [de] YYYY HH:mm',
  22730. LLLL: 'dddd, D [de] MMMM [de] YYYY HH:mm',
  22731. },
  22732. calendar: {
  22733. sameDay: '[Hoje às] LT',
  22734. nextDay: '[Amanhã às] LT',
  22735. nextWeek: 'dddd [às] LT',
  22736. lastDay: '[Ontem às] LT',
  22737. lastWeek: function () {
  22738. return this.day() === 0 || this.day() === 6
  22739. ? '[Último] dddd [às] LT' // Saturday + Sunday
  22740. : '[Última] dddd [às] LT'; // Monday - Friday
  22741. },
  22742. sameElse: 'L',
  22743. },
  22744. relativeTime: {
  22745. future: 'em %s',
  22746. past: 'há %s',
  22747. s: 'segundos',
  22748. ss: '%d segundos',
  22749. m: 'um minuto',
  22750. mm: '%d minutos',
  22751. h: 'uma hora',
  22752. hh: '%d horas',
  22753. d: 'um dia',
  22754. dd: '%d dias',
  22755. w: 'uma semana',
  22756. ww: '%d semanas',
  22757. M: 'um mês',
  22758. MM: '%d meses',
  22759. y: 'um ano',
  22760. yy: '%d anos',
  22761. },
  22762. dayOfMonthOrdinalParse: /\d{1,2}º/,
  22763. ordinal: '%dº',
  22764. week: {
  22765. dow: 1, // Monday is the first day of the week.
  22766. doy: 4, // The week that contains Jan 4th is the first week of the year.
  22767. },
  22768. });
  22769. //! moment.js locale configuration
  22770. function relativeTimeWithPlural$2(number, withoutSuffix, key) {
  22771. var format = {
  22772. ss: 'secunde',
  22773. mm: 'minute',
  22774. hh: 'ore',
  22775. dd: 'zile',
  22776. ww: 'săptămâni',
  22777. MM: 'luni',
  22778. yy: 'ani',
  22779. },
  22780. separator = ' ';
  22781. if (number % 100 >= 20 || (number >= 100 && number % 100 === 0)) {
  22782. separator = ' de ';
  22783. }
  22784. return number + separator + format[key];
  22785. }
  22786. hooks.defineLocale('ro', {
  22787. months: 'ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie'.split(
  22788. '_'
  22789. ),
  22790. monthsShort:
  22791. 'ian._feb._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.'.split(
  22792. '_'
  22793. ),
  22794. monthsParseExact: true,
  22795. weekdays: 'duminică_luni_marți_miercuri_joi_vineri_sâmbătă'.split('_'),
  22796. weekdaysShort: 'Dum_Lun_Mar_Mie_Joi_Vin_Sâm'.split('_'),
  22797. weekdaysMin: 'Du_Lu_Ma_Mi_Jo_Vi_Sâ'.split('_'),
  22798. longDateFormat: {
  22799. LT: 'H:mm',
  22800. LTS: 'H:mm:ss',
  22801. L: 'DD.MM.YYYY',
  22802. LL: 'D MMMM YYYY',
  22803. LLL: 'D MMMM YYYY H:mm',
  22804. LLLL: 'dddd, D MMMM YYYY H:mm',
  22805. },
  22806. calendar: {
  22807. sameDay: '[azi la] LT',
  22808. nextDay: '[mâine la] LT',
  22809. nextWeek: 'dddd [la] LT',
  22810. lastDay: '[ieri la] LT',
  22811. lastWeek: '[fosta] dddd [la] LT',
  22812. sameElse: 'L',
  22813. },
  22814. relativeTime: {
  22815. future: 'peste %s',
  22816. past: '%s în urmă',
  22817. s: 'câteva secunde',
  22818. ss: relativeTimeWithPlural$2,
  22819. m: 'un minut',
  22820. mm: relativeTimeWithPlural$2,
  22821. h: 'o oră',
  22822. hh: relativeTimeWithPlural$2,
  22823. d: 'o zi',
  22824. dd: relativeTimeWithPlural$2,
  22825. w: 'o săptămână',
  22826. ww: relativeTimeWithPlural$2,
  22827. M: 'o lună',
  22828. MM: relativeTimeWithPlural$2,
  22829. y: 'un an',
  22830. yy: relativeTimeWithPlural$2,
  22831. },
  22832. week: {
  22833. dow: 1, // Monday is the first day of the week.
  22834. doy: 7, // The week that contains Jan 7th is the first week of the year.
  22835. },
  22836. });
  22837. //! moment.js locale configuration
  22838. function plural$4(word, num) {
  22839. var forms = word.split('_');
  22840. return num % 10 === 1 && num % 100 !== 11
  22841. ? forms[0]
  22842. : num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20)
  22843. ? forms[1]
  22844. : forms[2];
  22845. }
  22846. function relativeTimeWithPlural$3(number, withoutSuffix, key) {
  22847. var format = {
  22848. ss: withoutSuffix ? 'секунда_секунды_секунд' : 'секунду_секунды_секунд',
  22849. mm: withoutSuffix ? 'минута_минуты_минут' : 'минуту_минуты_минут',
  22850. hh: 'час_часа_часов',
  22851. dd: 'день_дня_дней',
  22852. ww: 'неделя_недели_недель',
  22853. MM: 'месяц_месяца_месяцев',
  22854. yy: 'год_года_лет',
  22855. };
  22856. if (key === 'm') {
  22857. return withoutSuffix ? 'минута' : 'минуту';
  22858. } else {
  22859. return number + ' ' + plural$4(format[key], +number);
  22860. }
  22861. }
  22862. var monthsParse$b = [
  22863. /^янв/i,
  22864. /^фев/i,
  22865. /^мар/i,
  22866. /^апр/i,
  22867. /^ма[йя]/i,
  22868. /^июн/i,
  22869. /^июл/i,
  22870. /^авг/i,
  22871. /^сен/i,
  22872. /^окт/i,
  22873. /^ноя/i,
  22874. /^дек/i,
  22875. ];
  22876. // http://new.gramota.ru/spravka/rules/139-prop : § 103
  22877. // Сокращения месяцев: http://new.gramota.ru/spravka/buro/search-answer?s=242637
  22878. // CLDR data: http://www.unicode.org/cldr/charts/28/summary/ru.html#1753
  22879. hooks.defineLocale('ru', {
  22880. months: {
  22881. format: 'января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря'.split(
  22882. '_'
  22883. ),
  22884. standalone:
  22885. 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split(
  22886. '_'
  22887. ),
  22888. },
  22889. monthsShort: {
  22890. // по CLDR именно "июл." и "июн.", но какой смысл менять букву на точку?
  22891. format: 'янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.'.split(
  22892. '_'
  22893. ),
  22894. standalone:
  22895. 'янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.'.split(
  22896. '_'
  22897. ),
  22898. },
  22899. weekdays: {
  22900. standalone:
  22901. 'воскресенье_понедельник_вторник_среда_четверг_пятница_суббота'.split(
  22902. '_'
  22903. ),
  22904. format: 'воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу'.split(
  22905. '_'
  22906. ),
  22907. isFormat: /\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?] ?dddd/,
  22908. },
  22909. weekdaysShort: 'вс_пн_вт_ср_чт_пт_сб'.split('_'),
  22910. weekdaysMin: 'вс_пн_вт_ср_чт_пт_сб'.split('_'),
  22911. monthsParse: monthsParse$b,
  22912. longMonthsParse: monthsParse$b,
  22913. shortMonthsParse: monthsParse$b,
  22914. // полные названия с падежами, по три буквы, для некоторых, по 4 буквы, сокращения с точкой и без точки
  22915. monthsRegex:
  22916. /^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i,
  22917. // копия предыдущего
  22918. monthsShortRegex:
  22919. /^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i,
  22920. // полные названия с падежами
  22921. monthsStrictRegex:
  22922. /^(январ[яь]|феврал[яь]|марта?|апрел[яь]|ма[яй]|июн[яь]|июл[яь]|августа?|сентябр[яь]|октябр[яь]|ноябр[яь]|декабр[яь])/i,
  22923. // Выражение, которое соответствует только сокращённым формам
  22924. monthsShortStrictRegex:
  22925. /^(янв\.|февр?\.|мар[т.]|апр\.|ма[яй]|июн[ья.]|июл[ья.]|авг\.|сент?\.|окт\.|нояб?\.|дек\.)/i,
  22926. longDateFormat: {
  22927. LT: 'H:mm',
  22928. LTS: 'H:mm:ss',
  22929. L: 'DD.MM.YYYY',
  22930. LL: 'D MMMM YYYY г.',
  22931. LLL: 'D MMMM YYYY г., H:mm',
  22932. LLLL: 'dddd, D MMMM YYYY г., H:mm',
  22933. },
  22934. calendar: {
  22935. sameDay: '[Сегодня, в] LT',
  22936. nextDay: '[Завтра, в] LT',
  22937. lastDay: '[Вчера, в] LT',
  22938. nextWeek: function (now) {
  22939. if (now.week() !== this.week()) {
  22940. switch (this.day()) {
  22941. case 0:
  22942. return '[В следующее] dddd, [в] LT';
  22943. case 1:
  22944. case 2:
  22945. case 4:
  22946. return '[В следующий] dddd, [в] LT';
  22947. case 3:
  22948. case 5:
  22949. case 6:
  22950. return '[В следующую] dddd, [в] LT';
  22951. }
  22952. } else {
  22953. if (this.day() === 2) {
  22954. return '[Во] dddd, [в] LT';
  22955. } else {
  22956. return '[В] dddd, [в] LT';
  22957. }
  22958. }
  22959. },
  22960. lastWeek: function (now) {
  22961. if (now.week() !== this.week()) {
  22962. switch (this.day()) {
  22963. case 0:
  22964. return '[В прошлое] dddd, [в] LT';
  22965. case 1:
  22966. case 2:
  22967. case 4:
  22968. return '[В прошлый] dddd, [в] LT';
  22969. case 3:
  22970. case 5:
  22971. case 6:
  22972. return '[В прошлую] dddd, [в] LT';
  22973. }
  22974. } else {
  22975. if (this.day() === 2) {
  22976. return '[Во] dddd, [в] LT';
  22977. } else {
  22978. return '[В] dddd, [в] LT';
  22979. }
  22980. }
  22981. },
  22982. sameElse: 'L',
  22983. },
  22984. relativeTime: {
  22985. future: 'через %s',
  22986. past: '%s назад',
  22987. s: 'несколько секунд',
  22988. ss: relativeTimeWithPlural$3,
  22989. m: relativeTimeWithPlural$3,
  22990. mm: relativeTimeWithPlural$3,
  22991. h: 'час',
  22992. hh: relativeTimeWithPlural$3,
  22993. d: 'день',
  22994. dd: relativeTimeWithPlural$3,
  22995. w: 'неделя',
  22996. ww: relativeTimeWithPlural$3,
  22997. M: 'месяц',
  22998. MM: relativeTimeWithPlural$3,
  22999. y: 'год',
  23000. yy: relativeTimeWithPlural$3,
  23001. },
  23002. meridiemParse: /ночи|утра|дня|вечера/i,
  23003. isPM: function (input) {
  23004. return /^(дня|вечера)$/.test(input);
  23005. },
  23006. meridiem: function (hour, minute, isLower) {
  23007. if (hour < 4) {
  23008. return 'ночи';
  23009. } else if (hour < 12) {
  23010. return 'утра';
  23011. } else if (hour < 17) {
  23012. return 'дня';
  23013. } else {
  23014. return 'вечера';
  23015. }
  23016. },
  23017. dayOfMonthOrdinalParse: /\d{1,2}-(й|го|я)/,
  23018. ordinal: function (number, period) {
  23019. switch (period) {
  23020. case 'M':
  23021. case 'd':
  23022. case 'DDD':
  23023. return number + '-й';
  23024. case 'D':
  23025. return number + '-го';
  23026. case 'w':
  23027. case 'W':
  23028. return number + '-я';
  23029. default:
  23030. return number;
  23031. }
  23032. },
  23033. week: {
  23034. dow: 1, // Monday is the first day of the week.
  23035. doy: 4, // The week that contains Jan 4th is the first week of the year.
  23036. },
  23037. });
  23038. //! moment.js locale configuration
  23039. var months$9 = [
  23040. 'جنوري',
  23041. 'فيبروري',
  23042. 'مارچ',
  23043. 'اپريل',
  23044. 'مئي',
  23045. 'جون',
  23046. 'جولاءِ',
  23047. 'آگسٽ',
  23048. 'سيپٽمبر',
  23049. 'آڪٽوبر',
  23050. 'نومبر',
  23051. 'ڊسمبر',
  23052. ],
  23053. days$1 = ['آچر', 'سومر', 'اڱارو', 'اربع', 'خميس', 'جمع', 'ڇنڇر'];
  23054. hooks.defineLocale('sd', {
  23055. months: months$9,
  23056. monthsShort: months$9,
  23057. weekdays: days$1,
  23058. weekdaysShort: days$1,
  23059. weekdaysMin: days$1,
  23060. longDateFormat: {
  23061. LT: 'HH:mm',
  23062. LTS: 'HH:mm:ss',
  23063. L: 'DD/MM/YYYY',
  23064. LL: 'D MMMM YYYY',
  23065. LLL: 'D MMMM YYYY HH:mm',
  23066. LLLL: 'dddd، D MMMM YYYY HH:mm',
  23067. },
  23068. meridiemParse: /صبح|شام/,
  23069. isPM: function (input) {
  23070. return 'شام' === input;
  23071. },
  23072. meridiem: function (hour, minute, isLower) {
  23073. if (hour < 12) {
  23074. return 'صبح';
  23075. }
  23076. return 'شام';
  23077. },
  23078. calendar: {
  23079. sameDay: '[اڄ] LT',
  23080. nextDay: '[سڀاڻي] LT',
  23081. nextWeek: 'dddd [اڳين هفتي تي] LT',
  23082. lastDay: '[ڪالهه] LT',
  23083. lastWeek: '[گزريل هفتي] dddd [تي] LT',
  23084. sameElse: 'L',
  23085. },
  23086. relativeTime: {
  23087. future: '%s پوء',
  23088. past: '%s اڳ',
  23089. s: 'چند سيڪنڊ',
  23090. ss: '%d سيڪنڊ',
  23091. m: 'هڪ منٽ',
  23092. mm: '%d منٽ',
  23093. h: 'هڪ ڪلاڪ',
  23094. hh: '%d ڪلاڪ',
  23095. d: 'هڪ ڏينهن',
  23096. dd: '%d ڏينهن',
  23097. M: 'هڪ مهينو',
  23098. MM: '%d مهينا',
  23099. y: 'هڪ سال',
  23100. yy: '%d سال',
  23101. },
  23102. preparse: function (string) {
  23103. return string.replace(/،/g, ',');
  23104. },
  23105. postformat: function (string) {
  23106. return string.replace(/,/g, '،');
  23107. },
  23108. week: {
  23109. dow: 1, // Monday is the first day of the week.
  23110. doy: 4, // The week that contains Jan 4th is the first week of the year.
  23111. },
  23112. });
  23113. //! moment.js locale configuration
  23114. hooks.defineLocale('se', {
  23115. months: 'ođđajagemánnu_guovvamánnu_njukčamánnu_cuoŋománnu_miessemánnu_geassemánnu_suoidnemánnu_borgemánnu_čakčamánnu_golggotmánnu_skábmamánnu_juovlamánnu'.split(
  23116. '_'
  23117. ),
  23118. monthsShort:
  23119. 'ođđj_guov_njuk_cuo_mies_geas_suoi_borg_čakč_golg_skáb_juov'.split('_'),
  23120. weekdays:
  23121. 'sotnabeaivi_vuossárga_maŋŋebárga_gaskavahkku_duorastat_bearjadat_lávvardat'.split(
  23122. '_'
  23123. ),
  23124. weekdaysShort: 'sotn_vuos_maŋ_gask_duor_bear_láv'.split('_'),
  23125. weekdaysMin: 's_v_m_g_d_b_L'.split('_'),
  23126. longDateFormat: {
  23127. LT: 'HH:mm',
  23128. LTS: 'HH:mm:ss',
  23129. L: 'DD.MM.YYYY',
  23130. LL: 'MMMM D. [b.] YYYY',
  23131. LLL: 'MMMM D. [b.] YYYY [ti.] HH:mm',
  23132. LLLL: 'dddd, MMMM D. [b.] YYYY [ti.] HH:mm',
  23133. },
  23134. calendar: {
  23135. sameDay: '[otne ti] LT',
  23136. nextDay: '[ihttin ti] LT',
  23137. nextWeek: 'dddd [ti] LT',
  23138. lastDay: '[ikte ti] LT',
  23139. lastWeek: '[ovddit] dddd [ti] LT',
  23140. sameElse: 'L',
  23141. },
  23142. relativeTime: {
  23143. future: '%s geažes',
  23144. past: 'maŋit %s',
  23145. s: 'moadde sekunddat',
  23146. ss: '%d sekunddat',
  23147. m: 'okta minuhta',
  23148. mm: '%d minuhtat',
  23149. h: 'okta diimmu',
  23150. hh: '%d diimmut',
  23151. d: 'okta beaivi',
  23152. dd: '%d beaivvit',
  23153. M: 'okta mánnu',
  23154. MM: '%d mánut',
  23155. y: 'okta jahki',
  23156. yy: '%d jagit',
  23157. },
  23158. dayOfMonthOrdinalParse: /\d{1,2}\./,
  23159. ordinal: '%d.',
  23160. week: {
  23161. dow: 1, // Monday is the first day of the week.
  23162. doy: 4, // The week that contains Jan 4th is the first week of the year.
  23163. },
  23164. });
  23165. //! moment.js locale configuration
  23166. /*jshint -W100*/
  23167. hooks.defineLocale('si', {
  23168. months: 'ජනවාරි_පෙබරවාරි_මාර්තු_අප්‍රේල්_මැයි_ජූනි_ජූලි_අගෝස්තු_සැප්තැම්බර්_ඔක්තෝබර්_නොවැම්බර්_දෙසැම්බර්'.split(
  23169. '_'
  23170. ),
  23171. monthsShort: 'ජන_පෙබ_මාර්_අප්_මැයි_ජූනි_ජූලි_අගෝ_සැප්_ඔක්_නොවැ_දෙසැ'.split(
  23172. '_'
  23173. ),
  23174. weekdays:
  23175. 'ඉරිදා_සඳුදා_අඟහරුවාදා_බදාදා_බ්‍රහස්පතින්දා_සිකුරාදා_සෙනසුරාදා'.split(
  23176. '_'
  23177. ),
  23178. weekdaysShort: 'ඉරි_සඳු_අඟ_බදා_බ්‍රහ_සිකු_සෙන'.split('_'),
  23179. weekdaysMin: 'ඉ_ස_අ_බ_බ්‍ර_සි_සෙ'.split('_'),
  23180. weekdaysParseExact: true,
  23181. longDateFormat: {
  23182. LT: 'a h:mm',
  23183. LTS: 'a h:mm:ss',
  23184. L: 'YYYY/MM/DD',
  23185. LL: 'YYYY MMMM D',
  23186. LLL: 'YYYY MMMM D, a h:mm',
  23187. LLLL: 'YYYY MMMM D [වැනි] dddd, a h:mm:ss',
  23188. },
  23189. calendar: {
  23190. sameDay: '[අද] LT[ට]',
  23191. nextDay: '[හෙට] LT[ට]',
  23192. nextWeek: 'dddd LT[ට]',
  23193. lastDay: '[ඊයේ] LT[ට]',
  23194. lastWeek: '[පසුගිය] dddd LT[ට]',
  23195. sameElse: 'L',
  23196. },
  23197. relativeTime: {
  23198. future: '%sකින්',
  23199. past: '%sකට පෙර',
  23200. s: 'තත්පර කිහිපය',
  23201. ss: 'තත්පර %d',
  23202. m: 'මිනිත්තුව',
  23203. mm: 'මිනිත්තු %d',
  23204. h: 'පැය',
  23205. hh: 'පැය %d',
  23206. d: 'දිනය',
  23207. dd: 'දින %d',
  23208. M: 'මාසය',
  23209. MM: 'මාස %d',
  23210. y: 'වසර',
  23211. yy: 'වසර %d',
  23212. },
  23213. dayOfMonthOrdinalParse: /\d{1,2} වැනි/,
  23214. ordinal: function (number) {
  23215. return number + ' වැනි';
  23216. },
  23217. meridiemParse: /පෙර වරු|පස් වරු|පෙ.ව|ප.ව./,
  23218. isPM: function (input) {
  23219. return input === 'ප.ව.' || input === 'පස් වරු';
  23220. },
  23221. meridiem: function (hours, minutes, isLower) {
  23222. if (hours > 11) {
  23223. return isLower ? 'ප.ව.' : 'පස් වරු';
  23224. } else {
  23225. return isLower ? 'පෙ.ව.' : 'පෙර වරු';
  23226. }
  23227. },
  23228. });
  23229. //! moment.js locale configuration
  23230. var months$a =
  23231. 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split(
  23232. '_'
  23233. ),
  23234. monthsShort$7 = 'jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec'.split('_');
  23235. function plural$5(n) {
  23236. return n > 1 && n < 5;
  23237. }
  23238. function translate$9(number, withoutSuffix, key, isFuture) {
  23239. var result = number + ' ';
  23240. switch (key) {
  23241. case 's': // a few seconds / in a few seconds / a few seconds ago
  23242. return withoutSuffix || isFuture ? 'pár sekúnd' : 'pár sekundami';
  23243. case 'ss': // 9 seconds / in 9 seconds / 9 seconds ago
  23244. if (withoutSuffix || isFuture) {
  23245. return result + (plural$5(number) ? 'sekundy' : 'sekúnd');
  23246. } else {
  23247. return result + 'sekundami';
  23248. }
  23249. case 'm': // a minute / in a minute / a minute ago
  23250. return withoutSuffix ? 'minúta' : isFuture ? 'minútu' : 'minútou';
  23251. case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago
  23252. if (withoutSuffix || isFuture) {
  23253. return result + (plural$5(number) ? 'minúty' : 'minút');
  23254. } else {
  23255. return result + 'minútami';
  23256. }
  23257. case 'h': // an hour / in an hour / an hour ago
  23258. return withoutSuffix ? 'hodina' : isFuture ? 'hodinu' : 'hodinou';
  23259. case 'hh': // 9 hours / in 9 hours / 9 hours ago
  23260. if (withoutSuffix || isFuture) {
  23261. return result + (plural$5(number) ? 'hodiny' : 'hodín');
  23262. } else {
  23263. return result + 'hodinami';
  23264. }
  23265. case 'd': // a day / in a day / a day ago
  23266. return withoutSuffix || isFuture ? 'deň' : 'dňom';
  23267. case 'dd': // 9 days / in 9 days / 9 days ago
  23268. if (withoutSuffix || isFuture) {
  23269. return result + (plural$5(number) ? 'dni' : 'dní');
  23270. } else {
  23271. return result + 'dňami';
  23272. }
  23273. case 'M': // a month / in a month / a month ago
  23274. return withoutSuffix || isFuture ? 'mesiac' : 'mesiacom';
  23275. case 'MM': // 9 months / in 9 months / 9 months ago
  23276. if (withoutSuffix || isFuture) {
  23277. return result + (plural$5(number) ? 'mesiace' : 'mesiacov');
  23278. } else {
  23279. return result + 'mesiacmi';
  23280. }
  23281. case 'y': // a year / in a year / a year ago
  23282. return withoutSuffix || isFuture ? 'rok' : 'rokom';
  23283. case 'yy': // 9 years / in 9 years / 9 years ago
  23284. if (withoutSuffix || isFuture) {
  23285. return result + (plural$5(number) ? 'roky' : 'rokov');
  23286. } else {
  23287. return result + 'rokmi';
  23288. }
  23289. }
  23290. }
  23291. hooks.defineLocale('sk', {
  23292. months: months$a,
  23293. monthsShort: monthsShort$7,
  23294. weekdays: 'nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota'.split('_'),
  23295. weekdaysShort: 'ne_po_ut_st_št_pi_so'.split('_'),
  23296. weekdaysMin: 'ne_po_ut_st_št_pi_so'.split('_'),
  23297. longDateFormat: {
  23298. LT: 'H:mm',
  23299. LTS: 'H:mm:ss',
  23300. L: 'DD.MM.YYYY',
  23301. LL: 'D. MMMM YYYY',
  23302. LLL: 'D. MMMM YYYY H:mm',
  23303. LLLL: 'dddd D. MMMM YYYY H:mm',
  23304. },
  23305. calendar: {
  23306. sameDay: '[dnes o] LT',
  23307. nextDay: '[zajtra o] LT',
  23308. nextWeek: function () {
  23309. switch (this.day()) {
  23310. case 0:
  23311. return '[v nedeľu o] LT';
  23312. case 1:
  23313. case 2:
  23314. return '[v] dddd [o] LT';
  23315. case 3:
  23316. return '[v stredu o] LT';
  23317. case 4:
  23318. return '[vo štvrtok o] LT';
  23319. case 5:
  23320. return '[v piatok o] LT';
  23321. case 6:
  23322. return '[v sobotu o] LT';
  23323. }
  23324. },
  23325. lastDay: '[včera o] LT',
  23326. lastWeek: function () {
  23327. switch (this.day()) {
  23328. case 0:
  23329. return '[minulú nedeľu o] LT';
  23330. case 1:
  23331. case 2:
  23332. return '[minulý] dddd [o] LT';
  23333. case 3:
  23334. return '[minulú stredu o] LT';
  23335. case 4:
  23336. case 5:
  23337. return '[minulý] dddd [o] LT';
  23338. case 6:
  23339. return '[minulú sobotu o] LT';
  23340. }
  23341. },
  23342. sameElse: 'L',
  23343. },
  23344. relativeTime: {
  23345. future: 'za %s',
  23346. past: 'pred %s',
  23347. s: translate$9,
  23348. ss: translate$9,
  23349. m: translate$9,
  23350. mm: translate$9,
  23351. h: translate$9,
  23352. hh: translate$9,
  23353. d: translate$9,
  23354. dd: translate$9,
  23355. M: translate$9,
  23356. MM: translate$9,
  23357. y: translate$9,
  23358. yy: translate$9,
  23359. },
  23360. dayOfMonthOrdinalParse: /\d{1,2}\./,
  23361. ordinal: '%d.',
  23362. week: {
  23363. dow: 1, // Monday is the first day of the week.
  23364. doy: 4, // The week that contains Jan 4th is the first week of the year.
  23365. },
  23366. });
  23367. //! moment.js locale configuration
  23368. function processRelativeTime$7(number, withoutSuffix, key, isFuture) {
  23369. var result = number + ' ';
  23370. switch (key) {
  23371. case 's':
  23372. return withoutSuffix || isFuture
  23373. ? 'nekaj sekund'
  23374. : 'nekaj sekundami';
  23375. case 'ss':
  23376. if (number === 1) {
  23377. result += withoutSuffix ? 'sekundo' : 'sekundi';
  23378. } else if (number === 2) {
  23379. result += withoutSuffix || isFuture ? 'sekundi' : 'sekundah';
  23380. } else if (number < 5) {
  23381. result += withoutSuffix || isFuture ? 'sekunde' : 'sekundah';
  23382. } else {
  23383. result += 'sekund';
  23384. }
  23385. return result;
  23386. case 'm':
  23387. return withoutSuffix ? 'ena minuta' : 'eno minuto';
  23388. case 'mm':
  23389. if (number === 1) {
  23390. result += withoutSuffix ? 'minuta' : 'minuto';
  23391. } else if (number === 2) {
  23392. result += withoutSuffix || isFuture ? 'minuti' : 'minutama';
  23393. } else if (number < 5) {
  23394. result += withoutSuffix || isFuture ? 'minute' : 'minutami';
  23395. } else {
  23396. result += withoutSuffix || isFuture ? 'minut' : 'minutami';
  23397. }
  23398. return result;
  23399. case 'h':
  23400. return withoutSuffix ? 'ena ura' : 'eno uro';
  23401. case 'hh':
  23402. if (number === 1) {
  23403. result += withoutSuffix ? 'ura' : 'uro';
  23404. } else if (number === 2) {
  23405. result += withoutSuffix || isFuture ? 'uri' : 'urama';
  23406. } else if (number < 5) {
  23407. result += withoutSuffix || isFuture ? 'ure' : 'urami';
  23408. } else {
  23409. result += withoutSuffix || isFuture ? 'ur' : 'urami';
  23410. }
  23411. return result;
  23412. case 'd':
  23413. return withoutSuffix || isFuture ? 'en dan' : 'enim dnem';
  23414. case 'dd':
  23415. if (number === 1) {
  23416. result += withoutSuffix || isFuture ? 'dan' : 'dnem';
  23417. } else if (number === 2) {
  23418. result += withoutSuffix || isFuture ? 'dni' : 'dnevoma';
  23419. } else {
  23420. result += withoutSuffix || isFuture ? 'dni' : 'dnevi';
  23421. }
  23422. return result;
  23423. case 'M':
  23424. return withoutSuffix || isFuture ? 'en mesec' : 'enim mesecem';
  23425. case 'MM':
  23426. if (number === 1) {
  23427. result += withoutSuffix || isFuture ? 'mesec' : 'mesecem';
  23428. } else if (number === 2) {
  23429. result += withoutSuffix || isFuture ? 'meseca' : 'mesecema';
  23430. } else if (number < 5) {
  23431. result += withoutSuffix || isFuture ? 'mesece' : 'meseci';
  23432. } else {
  23433. result += withoutSuffix || isFuture ? 'mesecev' : 'meseci';
  23434. }
  23435. return result;
  23436. case 'y':
  23437. return withoutSuffix || isFuture ? 'eno leto' : 'enim letom';
  23438. case 'yy':
  23439. if (number === 1) {
  23440. result += withoutSuffix || isFuture ? 'leto' : 'letom';
  23441. } else if (number === 2) {
  23442. result += withoutSuffix || isFuture ? 'leti' : 'letoma';
  23443. } else if (number < 5) {
  23444. result += withoutSuffix || isFuture ? 'leta' : 'leti';
  23445. } else {
  23446. result += withoutSuffix || isFuture ? 'let' : 'leti';
  23447. }
  23448. return result;
  23449. }
  23450. }
  23451. hooks.defineLocale('sl', {
  23452. months: 'januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december'.split(
  23453. '_'
  23454. ),
  23455. monthsShort:
  23456. 'jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.'.split(
  23457. '_'
  23458. ),
  23459. monthsParseExact: true,
  23460. weekdays: 'nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota'.split('_'),
  23461. weekdaysShort: 'ned._pon._tor._sre._čet._pet._sob.'.split('_'),
  23462. weekdaysMin: 'ne_po_to_sr_če_pe_so'.split('_'),
  23463. weekdaysParseExact: true,
  23464. longDateFormat: {
  23465. LT: 'H:mm',
  23466. LTS: 'H:mm:ss',
  23467. L: 'DD. MM. YYYY',
  23468. LL: 'D. MMMM YYYY',
  23469. LLL: 'D. MMMM YYYY H:mm',
  23470. LLLL: 'dddd, D. MMMM YYYY H:mm',
  23471. },
  23472. calendar: {
  23473. sameDay: '[danes ob] LT',
  23474. nextDay: '[jutri ob] LT',
  23475. nextWeek: function () {
  23476. switch (this.day()) {
  23477. case 0:
  23478. return '[v] [nedeljo] [ob] LT';
  23479. case 3:
  23480. return '[v] [sredo] [ob] LT';
  23481. case 6:
  23482. return '[v] [soboto] [ob] LT';
  23483. case 1:
  23484. case 2:
  23485. case 4:
  23486. case 5:
  23487. return '[v] dddd [ob] LT';
  23488. }
  23489. },
  23490. lastDay: '[včeraj ob] LT',
  23491. lastWeek: function () {
  23492. switch (this.day()) {
  23493. case 0:
  23494. return '[prejšnjo] [nedeljo] [ob] LT';
  23495. case 3:
  23496. return '[prejšnjo] [sredo] [ob] LT';
  23497. case 6:
  23498. return '[prejšnjo] [soboto] [ob] LT';
  23499. case 1:
  23500. case 2:
  23501. case 4:
  23502. case 5:
  23503. return '[prejšnji] dddd [ob] LT';
  23504. }
  23505. },
  23506. sameElse: 'L',
  23507. },
  23508. relativeTime: {
  23509. future: 'čez %s',
  23510. past: 'pred %s',
  23511. s: processRelativeTime$7,
  23512. ss: processRelativeTime$7,
  23513. m: processRelativeTime$7,
  23514. mm: processRelativeTime$7,
  23515. h: processRelativeTime$7,
  23516. hh: processRelativeTime$7,
  23517. d: processRelativeTime$7,
  23518. dd: processRelativeTime$7,
  23519. M: processRelativeTime$7,
  23520. MM: processRelativeTime$7,
  23521. y: processRelativeTime$7,
  23522. yy: processRelativeTime$7,
  23523. },
  23524. dayOfMonthOrdinalParse: /\d{1,2}\./,
  23525. ordinal: '%d.',
  23526. week: {
  23527. dow: 1, // Monday is the first day of the week.
  23528. doy: 7, // The week that contains Jan 7th is the first week of the year.
  23529. },
  23530. });
  23531. //! moment.js locale configuration
  23532. hooks.defineLocale('sq', {
  23533. months: 'Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor'.split(
  23534. '_'
  23535. ),
  23536. monthsShort: 'Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj'.split('_'),
  23537. weekdays: 'E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë'.split(
  23538. '_'
  23539. ),
  23540. weekdaysShort: 'Die_Hën_Mar_Mër_Enj_Pre_Sht'.split('_'),
  23541. weekdaysMin: 'D_H_Ma_Më_E_P_Sh'.split('_'),
  23542. weekdaysParseExact: true,
  23543. meridiemParse: /PD|MD/,
  23544. isPM: function (input) {
  23545. return input.charAt(0) === 'M';
  23546. },
  23547. meridiem: function (hours, minutes, isLower) {
  23548. return hours < 12 ? 'PD' : 'MD';
  23549. },
  23550. longDateFormat: {
  23551. LT: 'HH:mm',
  23552. LTS: 'HH:mm:ss',
  23553. L: 'DD/MM/YYYY',
  23554. LL: 'D MMMM YYYY',
  23555. LLL: 'D MMMM YYYY HH:mm',
  23556. LLLL: 'dddd, D MMMM YYYY HH:mm',
  23557. },
  23558. calendar: {
  23559. sameDay: '[Sot në] LT',
  23560. nextDay: '[Nesër në] LT',
  23561. nextWeek: 'dddd [në] LT',
  23562. lastDay: '[Dje në] LT',
  23563. lastWeek: 'dddd [e kaluar në] LT',
  23564. sameElse: 'L',
  23565. },
  23566. relativeTime: {
  23567. future: 'në %s',
  23568. past: '%s më parë',
  23569. s: 'disa sekonda',
  23570. ss: '%d sekonda',
  23571. m: 'një minutë',
  23572. mm: '%d minuta',
  23573. h: 'një orë',
  23574. hh: '%d orë',
  23575. d: 'një ditë',
  23576. dd: '%d ditë',
  23577. M: 'një muaj',
  23578. MM: '%d muaj',
  23579. y: 'një vit',
  23580. yy: '%d vite',
  23581. },
  23582. dayOfMonthOrdinalParse: /\d{1,2}\./,
  23583. ordinal: '%d.',
  23584. week: {
  23585. dow: 1, // Monday is the first day of the week.
  23586. doy: 4, // The week that contains Jan 4th is the first week of the year.
  23587. },
  23588. });
  23589. //! moment.js locale configuration
  23590. var translator$1 = {
  23591. words: {
  23592. //Different grammatical cases
  23593. ss: ['секунда', 'секунде', 'секунди'],
  23594. m: ['један минут', 'једног минута'],
  23595. mm: ['минут', 'минута', 'минута'],
  23596. h: ['један сат', 'једног сата'],
  23597. hh: ['сат', 'сата', 'сати'],
  23598. d: ['један дан', 'једног дана'],
  23599. dd: ['дан', 'дана', 'дана'],
  23600. M: ['један месец', 'једног месеца'],
  23601. MM: ['месец', 'месеца', 'месеци'],
  23602. y: ['једну годину', 'једне године'],
  23603. yy: ['годину', 'године', 'година'],
  23604. },
  23605. correctGrammaticalCase: function (number, wordKey) {
  23606. if (
  23607. number % 10 >= 1 &&
  23608. number % 10 <= 4 &&
  23609. (number % 100 < 10 || number % 100 >= 20)
  23610. ) {
  23611. return number % 10 === 1 ? wordKey[0] : wordKey[1];
  23612. }
  23613. return wordKey[2];
  23614. },
  23615. translate: function (number, withoutSuffix, key, isFuture) {
  23616. var wordKey = translator$1.words[key],
  23617. word;
  23618. if (key.length === 1) {
  23619. // Nominativ
  23620. if (key === 'y' && withoutSuffix) return 'једна година';
  23621. return isFuture || withoutSuffix ? wordKey[0] : wordKey[1];
  23622. }
  23623. word = translator$1.correctGrammaticalCase(number, wordKey);
  23624. // Nominativ
  23625. if (key === 'yy' && withoutSuffix && word === 'годину') {
  23626. return number + ' година';
  23627. }
  23628. return number + ' ' + word;
  23629. },
  23630. };
  23631. hooks.defineLocale('sr-cyrl', {
  23632. months: 'јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар'.split(
  23633. '_'
  23634. ),
  23635. monthsShort:
  23636. 'јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.'.split('_'),
  23637. monthsParseExact: true,
  23638. weekdays: 'недеља_понедељак_уторак_среда_четвртак_петак_субота'.split('_'),
  23639. weekdaysShort: 'нед._пон._уто._сре._чет._пет._суб.'.split('_'),
  23640. weekdaysMin: 'не_по_ут_ср_че_пе_су'.split('_'),
  23641. weekdaysParseExact: true,
  23642. longDateFormat: {
  23643. LT: 'H:mm',
  23644. LTS: 'H:mm:ss',
  23645. L: 'D. M. YYYY.',
  23646. LL: 'D. MMMM YYYY.',
  23647. LLL: 'D. MMMM YYYY. H:mm',
  23648. LLLL: 'dddd, D. MMMM YYYY. H:mm',
  23649. },
  23650. calendar: {
  23651. sameDay: '[данас у] LT',
  23652. nextDay: '[сутра у] LT',
  23653. nextWeek: function () {
  23654. switch (this.day()) {
  23655. case 0:
  23656. return '[у] [недељу] [у] LT';
  23657. case 3:
  23658. return '[у] [среду] [у] LT';
  23659. case 6:
  23660. return '[у] [суботу] [у] LT';
  23661. case 1:
  23662. case 2:
  23663. case 4:
  23664. case 5:
  23665. return '[у] dddd [у] LT';
  23666. }
  23667. },
  23668. lastDay: '[јуче у] LT',
  23669. lastWeek: function () {
  23670. var lastWeekDays = [
  23671. '[прошле] [недеље] [у] LT',
  23672. '[прошлог] [понедељка] [у] LT',
  23673. '[прошлог] [уторка] [у] LT',
  23674. '[прошле] [среде] [у] LT',
  23675. '[прошлог] [четвртка] [у] LT',
  23676. '[прошлог] [петка] [у] LT',
  23677. '[прошле] [суботе] [у] LT',
  23678. ];
  23679. return lastWeekDays[this.day()];
  23680. },
  23681. sameElse: 'L',
  23682. },
  23683. relativeTime: {
  23684. future: 'за %s',
  23685. past: 'пре %s',
  23686. s: 'неколико секунди',
  23687. ss: translator$1.translate,
  23688. m: translator$1.translate,
  23689. mm: translator$1.translate,
  23690. h: translator$1.translate,
  23691. hh: translator$1.translate,
  23692. d: translator$1.translate,
  23693. dd: translator$1.translate,
  23694. M: translator$1.translate,
  23695. MM: translator$1.translate,
  23696. y: translator$1.translate,
  23697. yy: translator$1.translate,
  23698. },
  23699. dayOfMonthOrdinalParse: /\d{1,2}\./,
  23700. ordinal: '%d.',
  23701. week: {
  23702. dow: 1, // Monday is the first day of the week.
  23703. doy: 7, // The week that contains Jan 1st is the first week of the year.
  23704. },
  23705. });
  23706. //! moment.js locale configuration
  23707. var translator$2 = {
  23708. words: {
  23709. //Different grammatical cases
  23710. ss: ['sekunda', 'sekunde', 'sekundi'],
  23711. m: ['jedan minut', 'jednog minuta'],
  23712. mm: ['minut', 'minuta', 'minuta'],
  23713. h: ['jedan sat', 'jednog sata'],
  23714. hh: ['sat', 'sata', 'sati'],
  23715. d: ['jedan dan', 'jednog dana'],
  23716. dd: ['dan', 'dana', 'dana'],
  23717. M: ['jedan mesec', 'jednog meseca'],
  23718. MM: ['mesec', 'meseca', 'meseci'],
  23719. y: ['jednu godinu', 'jedne godine'],
  23720. yy: ['godinu', 'godine', 'godina'],
  23721. },
  23722. correctGrammaticalCase: function (number, wordKey) {
  23723. if (
  23724. number % 10 >= 1 &&
  23725. number % 10 <= 4 &&
  23726. (number % 100 < 10 || number % 100 >= 20)
  23727. ) {
  23728. return number % 10 === 1 ? wordKey[0] : wordKey[1];
  23729. }
  23730. return wordKey[2];
  23731. },
  23732. translate: function (number, withoutSuffix, key, isFuture) {
  23733. var wordKey = translator$2.words[key],
  23734. word;
  23735. if (key.length === 1) {
  23736. // Nominativ
  23737. if (key === 'y' && withoutSuffix) return 'jedna godina';
  23738. return isFuture || withoutSuffix ? wordKey[0] : wordKey[1];
  23739. }
  23740. word = translator$2.correctGrammaticalCase(number, wordKey);
  23741. // Nominativ
  23742. if (key === 'yy' && withoutSuffix && word === 'godinu') {
  23743. return number + ' godina';
  23744. }
  23745. return number + ' ' + word;
  23746. },
  23747. };
  23748. hooks.defineLocale('sr', {
  23749. months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split(
  23750. '_'
  23751. ),
  23752. monthsShort:
  23753. 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'),
  23754. monthsParseExact: true,
  23755. weekdays: 'nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota'.split(
  23756. '_'
  23757. ),
  23758. weekdaysShort: 'ned._pon._uto._sre._čet._pet._sub.'.split('_'),
  23759. weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'),
  23760. weekdaysParseExact: true,
  23761. longDateFormat: {
  23762. LT: 'H:mm',
  23763. LTS: 'H:mm:ss',
  23764. L: 'D. M. YYYY.',
  23765. LL: 'D. MMMM YYYY.',
  23766. LLL: 'D. MMMM YYYY. H:mm',
  23767. LLLL: 'dddd, D. MMMM YYYY. H:mm',
  23768. },
  23769. calendar: {
  23770. sameDay: '[danas u] LT',
  23771. nextDay: '[sutra u] LT',
  23772. nextWeek: function () {
  23773. switch (this.day()) {
  23774. case 0:
  23775. return '[u] [nedelju] [u] LT';
  23776. case 3:
  23777. return '[u] [sredu] [u] LT';
  23778. case 6:
  23779. return '[u] [subotu] [u] LT';
  23780. case 1:
  23781. case 2:
  23782. case 4:
  23783. case 5:
  23784. return '[u] dddd [u] LT';
  23785. }
  23786. },
  23787. lastDay: '[juče u] LT',
  23788. lastWeek: function () {
  23789. var lastWeekDays = [
  23790. '[prošle] [nedelje] [u] LT',
  23791. '[prošlog] [ponedeljka] [u] LT',
  23792. '[prošlog] [utorka] [u] LT',
  23793. '[prošle] [srede] [u] LT',
  23794. '[prošlog] [četvrtka] [u] LT',
  23795. '[prošlog] [petka] [u] LT',
  23796. '[prošle] [subote] [u] LT',
  23797. ];
  23798. return lastWeekDays[this.day()];
  23799. },
  23800. sameElse: 'L',
  23801. },
  23802. relativeTime: {
  23803. future: 'za %s',
  23804. past: 'pre %s',
  23805. s: 'nekoliko sekundi',
  23806. ss: translator$2.translate,
  23807. m: translator$2.translate,
  23808. mm: translator$2.translate,
  23809. h: translator$2.translate,
  23810. hh: translator$2.translate,
  23811. d: translator$2.translate,
  23812. dd: translator$2.translate,
  23813. M: translator$2.translate,
  23814. MM: translator$2.translate,
  23815. y: translator$2.translate,
  23816. yy: translator$2.translate,
  23817. },
  23818. dayOfMonthOrdinalParse: /\d{1,2}\./,
  23819. ordinal: '%d.',
  23820. week: {
  23821. dow: 1, // Monday is the first day of the week.
  23822. doy: 7, // The week that contains Jan 7th is the first week of the year.
  23823. },
  23824. });
  23825. //! moment.js locale configuration
  23826. hooks.defineLocale('ss', {
  23827. months: "Bhimbidvwane_Indlovana_Indlov'lenkhulu_Mabasa_Inkhwekhweti_Inhlaba_Kholwane_Ingci_Inyoni_Imphala_Lweti_Ingongoni".split(
  23828. '_'
  23829. ),
  23830. monthsShort: 'Bhi_Ina_Inu_Mab_Ink_Inh_Kho_Igc_Iny_Imp_Lwe_Igo'.split('_'),
  23831. weekdays:
  23832. 'Lisontfo_Umsombuluko_Lesibili_Lesitsatfu_Lesine_Lesihlanu_Umgcibelo'.split(
  23833. '_'
  23834. ),
  23835. weekdaysShort: 'Lis_Umb_Lsb_Les_Lsi_Lsh_Umg'.split('_'),
  23836. weekdaysMin: 'Li_Us_Lb_Lt_Ls_Lh_Ug'.split('_'),
  23837. weekdaysParseExact: true,
  23838. longDateFormat: {
  23839. LT: 'h:mm A',
  23840. LTS: 'h:mm:ss A',
  23841. L: 'DD/MM/YYYY',
  23842. LL: 'D MMMM YYYY',
  23843. LLL: 'D MMMM YYYY h:mm A',
  23844. LLLL: 'dddd, D MMMM YYYY h:mm A',
  23845. },
  23846. calendar: {
  23847. sameDay: '[Namuhla nga] LT',
  23848. nextDay: '[Kusasa nga] LT',
  23849. nextWeek: 'dddd [nga] LT',
  23850. lastDay: '[Itolo nga] LT',
  23851. lastWeek: 'dddd [leliphelile] [nga] LT',
  23852. sameElse: 'L',
  23853. },
  23854. relativeTime: {
  23855. future: 'nga %s',
  23856. past: 'wenteka nga %s',
  23857. s: 'emizuzwana lomcane',
  23858. ss: '%d mzuzwana',
  23859. m: 'umzuzu',
  23860. mm: '%d emizuzu',
  23861. h: 'lihora',
  23862. hh: '%d emahora',
  23863. d: 'lilanga',
  23864. dd: '%d emalanga',
  23865. M: 'inyanga',
  23866. MM: '%d tinyanga',
  23867. y: 'umnyaka',
  23868. yy: '%d iminyaka',
  23869. },
  23870. meridiemParse: /ekuseni|emini|entsambama|ebusuku/,
  23871. meridiem: function (hours, minutes, isLower) {
  23872. if (hours < 11) {
  23873. return 'ekuseni';
  23874. } else if (hours < 15) {
  23875. return 'emini';
  23876. } else if (hours < 19) {
  23877. return 'entsambama';
  23878. } else {
  23879. return 'ebusuku';
  23880. }
  23881. },
  23882. meridiemHour: function (hour, meridiem) {
  23883. if (hour === 12) {
  23884. hour = 0;
  23885. }
  23886. if (meridiem === 'ekuseni') {
  23887. return hour;
  23888. } else if (meridiem === 'emini') {
  23889. return hour >= 11 ? hour : hour + 12;
  23890. } else if (meridiem === 'entsambama' || meridiem === 'ebusuku') {
  23891. if (hour === 0) {
  23892. return 0;
  23893. }
  23894. return hour + 12;
  23895. }
  23896. },
  23897. dayOfMonthOrdinalParse: /\d{1,2}/,
  23898. ordinal: '%d',
  23899. week: {
  23900. dow: 1, // Monday is the first day of the week.
  23901. doy: 4, // The week that contains Jan 4th is the first week of the year.
  23902. },
  23903. });
  23904. //! moment.js locale configuration
  23905. hooks.defineLocale('sv', {
  23906. months: 'januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december'.split(
  23907. '_'
  23908. ),
  23909. monthsShort: 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'),
  23910. weekdays: 'söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag'.split('_'),
  23911. weekdaysShort: 'sön_mån_tis_ons_tor_fre_lör'.split('_'),
  23912. weekdaysMin: 'sö_må_ti_on_to_fr_lö'.split('_'),
  23913. longDateFormat: {
  23914. LT: 'HH:mm',
  23915. LTS: 'HH:mm:ss',
  23916. L: 'YYYY-MM-DD',
  23917. LL: 'D MMMM YYYY',
  23918. LLL: 'D MMMM YYYY [kl.] HH:mm',
  23919. LLLL: 'dddd D MMMM YYYY [kl.] HH:mm',
  23920. lll: 'D MMM YYYY HH:mm',
  23921. llll: 'ddd D MMM YYYY HH:mm',
  23922. },
  23923. calendar: {
  23924. sameDay: '[Idag] LT',
  23925. nextDay: '[Imorgon] LT',
  23926. lastDay: '[Igår] LT',
  23927. nextWeek: '[På] dddd LT',
  23928. lastWeek: '[I] dddd[s] LT',
  23929. sameElse: 'L',
  23930. },
  23931. relativeTime: {
  23932. future: 'om %s',
  23933. past: 'för %s sedan',
  23934. s: 'några sekunder',
  23935. ss: '%d sekunder',
  23936. m: 'en minut',
  23937. mm: '%d minuter',
  23938. h: 'en timme',
  23939. hh: '%d timmar',
  23940. d: 'en dag',
  23941. dd: '%d dagar',
  23942. M: 'en månad',
  23943. MM: '%d månader',
  23944. y: 'ett år',
  23945. yy: '%d år',
  23946. },
  23947. dayOfMonthOrdinalParse: /\d{1,2}(\:e|\:a)/,
  23948. ordinal: function (number) {
  23949. var b = number % 10,
  23950. output =
  23951. ~~((number % 100) / 10) === 1
  23952. ? ':e'
  23953. : b === 1
  23954. ? ':a'
  23955. : b === 2
  23956. ? ':a'
  23957. : b === 3
  23958. ? ':e'
  23959. : ':e';
  23960. return number + output;
  23961. },
  23962. week: {
  23963. dow: 1, // Monday is the first day of the week.
  23964. doy: 4, // The week that contains Jan 4th is the first week of the year.
  23965. },
  23966. });
  23967. //! moment.js locale configuration
  23968. hooks.defineLocale('sw', {
  23969. months: 'Januari_Februari_Machi_Aprili_Mei_Juni_Julai_Agosti_Septemba_Oktoba_Novemba_Desemba'.split(
  23970. '_'
  23971. ),
  23972. monthsShort: 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ago_Sep_Okt_Nov_Des'.split('_'),
  23973. weekdays:
  23974. 'Jumapili_Jumatatu_Jumanne_Jumatano_Alhamisi_Ijumaa_Jumamosi'.split(
  23975. '_'
  23976. ),
  23977. weekdaysShort: 'Jpl_Jtat_Jnne_Jtan_Alh_Ijm_Jmos'.split('_'),
  23978. weekdaysMin: 'J2_J3_J4_J5_Al_Ij_J1'.split('_'),
  23979. weekdaysParseExact: true,
  23980. longDateFormat: {
  23981. LT: 'hh:mm A',
  23982. LTS: 'HH:mm:ss',
  23983. L: 'DD.MM.YYYY',
  23984. LL: 'D MMMM YYYY',
  23985. LLL: 'D MMMM YYYY HH:mm',
  23986. LLLL: 'dddd, D MMMM YYYY HH:mm',
  23987. },
  23988. calendar: {
  23989. sameDay: '[leo saa] LT',
  23990. nextDay: '[kesho saa] LT',
  23991. nextWeek: '[wiki ijayo] dddd [saat] LT',
  23992. lastDay: '[jana] LT',
  23993. lastWeek: '[wiki iliyopita] dddd [saat] LT',
  23994. sameElse: 'L',
  23995. },
  23996. relativeTime: {
  23997. future: '%s baadaye',
  23998. past: 'tokea %s',
  23999. s: 'hivi punde',
  24000. ss: 'sekunde %d',
  24001. m: 'dakika moja',
  24002. mm: 'dakika %d',
  24003. h: 'saa limoja',
  24004. hh: 'masaa %d',
  24005. d: 'siku moja',
  24006. dd: 'siku %d',
  24007. M: 'mwezi mmoja',
  24008. MM: 'miezi %d',
  24009. y: 'mwaka mmoja',
  24010. yy: 'miaka %d',
  24011. },
  24012. week: {
  24013. dow: 1, // Monday is the first day of the week.
  24014. doy: 7, // The week that contains Jan 7th is the first week of the year.
  24015. },
  24016. });
  24017. //! moment.js locale configuration
  24018. var symbolMap$g = {
  24019. 1: '௧',
  24020. 2: '௨',
  24021. 3: '௩',
  24022. 4: '௪',
  24023. 5: '௫',
  24024. 6: '௬',
  24025. 7: '௭',
  24026. 8: '௮',
  24027. 9: '௯',
  24028. 0: '௦',
  24029. },
  24030. numberMap$f = {
  24031. '௧': '1',
  24032. '௨': '2',
  24033. '௩': '3',
  24034. '௪': '4',
  24035. '௫': '5',
  24036. '௬': '6',
  24037. '௭': '7',
  24038. '௮': '8',
  24039. '௯': '9',
  24040. '௦': '0',
  24041. };
  24042. hooks.defineLocale('ta', {
  24043. months: 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split(
  24044. '_'
  24045. ),
  24046. monthsShort:
  24047. 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split(
  24048. '_'
  24049. ),
  24050. weekdays:
  24051. 'ஞாயிற்றுக்கிழமை_திங்கட்கிழமை_செவ்வாய்கிழமை_புதன்கிழமை_வியாழக்கிழமை_வெள்ளிக்கிழமை_சனிக்கிழமை'.split(
  24052. '_'
  24053. ),
  24054. weekdaysShort: 'ஞாயிறு_திங்கள்_செவ்வாய்_புதன்_வியாழன்_வெள்ளி_சனி'.split(
  24055. '_'
  24056. ),
  24057. weekdaysMin: 'ஞா_தி_செ_பு_வி_வெ_ச'.split('_'),
  24058. longDateFormat: {
  24059. LT: 'HH:mm',
  24060. LTS: 'HH:mm:ss',
  24061. L: 'DD/MM/YYYY',
  24062. LL: 'D MMMM YYYY',
  24063. LLL: 'D MMMM YYYY, HH:mm',
  24064. LLLL: 'dddd, D MMMM YYYY, HH:mm',
  24065. },
  24066. calendar: {
  24067. sameDay: '[இன்று] LT',
  24068. nextDay: '[நாளை] LT',
  24069. nextWeek: 'dddd, LT',
  24070. lastDay: '[நேற்று] LT',
  24071. lastWeek: '[கடந்த வாரம்] dddd, LT',
  24072. sameElse: 'L',
  24073. },
  24074. relativeTime: {
  24075. future: '%s இல்',
  24076. past: '%s முன்',
  24077. s: 'ஒரு சில விநாடிகள்',
  24078. ss: '%d விநாடிகள்',
  24079. m: 'ஒரு நிமிடம்',
  24080. mm: '%d நிமிடங்கள்',
  24081. h: 'ஒரு மணி நேரம்',
  24082. hh: '%d மணி நேரம்',
  24083. d: 'ஒரு நாள்',
  24084. dd: '%d நாட்கள்',
  24085. M: 'ஒரு மாதம்',
  24086. MM: '%d மாதங்கள்',
  24087. y: 'ஒரு வருடம்',
  24088. yy: '%d ஆண்டுகள்',
  24089. },
  24090. dayOfMonthOrdinalParse: /\d{1,2}வது/,
  24091. ordinal: function (number) {
  24092. return number + 'வது';
  24093. },
  24094. preparse: function (string) {
  24095. return string.replace(/[௧௨௩௪௫௬௭௮௯௦]/g, function (match) {
  24096. return numberMap$f[match];
  24097. });
  24098. },
  24099. postformat: function (string) {
  24100. return string.replace(/\d/g, function (match) {
  24101. return symbolMap$g[match];
  24102. });
  24103. },
  24104. // refer http://ta.wikipedia.org/s/1er1
  24105. meridiemParse: /யாமம்|வைகறை|காலை|நண்பகல்|எற்பாடு|மாலை/,
  24106. meridiem: function (hour, minute, isLower) {
  24107. if (hour < 2) {
  24108. return ' யாமம்';
  24109. } else if (hour < 6) {
  24110. return ' வைகறை'; // வைகறை
  24111. } else if (hour < 10) {
  24112. return ' காலை'; // காலை
  24113. } else if (hour < 14) {
  24114. return ' நண்பகல்'; // நண்பகல்
  24115. } else if (hour < 18) {
  24116. return ' எற்பாடு'; // எற்பாடு
  24117. } else if (hour < 22) {
  24118. return ' மாலை'; // மாலை
  24119. } else {
  24120. return ' யாமம்';
  24121. }
  24122. },
  24123. meridiemHour: function (hour, meridiem) {
  24124. if (hour === 12) {
  24125. hour = 0;
  24126. }
  24127. if (meridiem === 'யாமம்') {
  24128. return hour < 2 ? hour : hour + 12;
  24129. } else if (meridiem === 'வைகறை' || meridiem === 'காலை') {
  24130. return hour;
  24131. } else if (meridiem === 'நண்பகல்') {
  24132. return hour >= 10 ? hour : hour + 12;
  24133. } else {
  24134. return hour + 12;
  24135. }
  24136. },
  24137. week: {
  24138. dow: 0, // Sunday is the first day of the week.
  24139. doy: 6, // The week that contains Jan 6th is the first week of the year.
  24140. },
  24141. });
  24142. //! moment.js locale configuration
  24143. hooks.defineLocale('te', {
  24144. months: 'జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జులై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్'.split(
  24145. '_'
  24146. ),
  24147. monthsShort:
  24148. 'జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జులై_ఆగ._సెప్._అక్టో._నవ._డిసె.'.split(
  24149. '_'
  24150. ),
  24151. monthsParseExact: true,
  24152. weekdays:
  24153. 'ఆదివారం_సోమవారం_మంగళవారం_బుధవారం_గురువారం_శుక్రవారం_శనివారం'.split(
  24154. '_'
  24155. ),
  24156. weekdaysShort: 'ఆది_సోమ_మంగళ_బుధ_గురు_శుక్ర_శని'.split('_'),
  24157. weekdaysMin: 'ఆ_సో_మం_బు_గు_శు_శ'.split('_'),
  24158. longDateFormat: {
  24159. LT: 'A h:mm',
  24160. LTS: 'A h:mm:ss',
  24161. L: 'DD/MM/YYYY',
  24162. LL: 'D MMMM YYYY',
  24163. LLL: 'D MMMM YYYY, A h:mm',
  24164. LLLL: 'dddd, D MMMM YYYY, A h:mm',
  24165. },
  24166. calendar: {
  24167. sameDay: '[నేడు] LT',
  24168. nextDay: '[రేపు] LT',
  24169. nextWeek: 'dddd, LT',
  24170. lastDay: '[నిన్న] LT',
  24171. lastWeek: '[గత] dddd, LT',
  24172. sameElse: 'L',
  24173. },
  24174. relativeTime: {
  24175. future: '%s లో',
  24176. past: '%s క్రితం',
  24177. s: 'కొన్ని క్షణాలు',
  24178. ss: '%d సెకన్లు',
  24179. m: 'ఒక నిమిషం',
  24180. mm: '%d నిమిషాలు',
  24181. h: 'ఒక గంట',
  24182. hh: '%d గంటలు',
  24183. d: 'ఒక రోజు',
  24184. dd: '%d రోజులు',
  24185. M: 'ఒక నెల',
  24186. MM: '%d నెలలు',
  24187. y: 'ఒక సంవత్సరం',
  24188. yy: '%d సంవత్సరాలు',
  24189. },
  24190. dayOfMonthOrdinalParse: /\d{1,2}వ/,
  24191. ordinal: '%dవ',
  24192. meridiemParse: /రాత్రి|ఉదయం|మధ్యాహ్నం|సాయంత్రం/,
  24193. meridiemHour: function (hour, meridiem) {
  24194. if (hour === 12) {
  24195. hour = 0;
  24196. }
  24197. if (meridiem === 'రాత్రి') {
  24198. return hour < 4 ? hour : hour + 12;
  24199. } else if (meridiem === 'ఉదయం') {
  24200. return hour;
  24201. } else if (meridiem === 'మధ్యాహ్నం') {
  24202. return hour >= 10 ? hour : hour + 12;
  24203. } else if (meridiem === 'సాయంత్రం') {
  24204. return hour + 12;
  24205. }
  24206. },
  24207. meridiem: function (hour, minute, isLower) {
  24208. if (hour < 4) {
  24209. return 'రాత్రి';
  24210. } else if (hour < 10) {
  24211. return 'ఉదయం';
  24212. } else if (hour < 17) {
  24213. return 'మధ్యాహ్నం';
  24214. } else if (hour < 20) {
  24215. return 'సాయంత్రం';
  24216. } else {
  24217. return 'రాత్రి';
  24218. }
  24219. },
  24220. week: {
  24221. dow: 0, // Sunday is the first day of the week.
  24222. doy: 6, // The week that contains Jan 6th is the first week of the year.
  24223. },
  24224. });
  24225. //! moment.js locale configuration
  24226. hooks.defineLocale('tet', {
  24227. months: 'Janeiru_Fevereiru_Marsu_Abril_Maiu_Juñu_Jullu_Agustu_Setembru_Outubru_Novembru_Dezembru'.split(
  24228. '_'
  24229. ),
  24230. monthsShort: 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'),
  24231. weekdays: 'Domingu_Segunda_Tersa_Kuarta_Kinta_Sesta_Sabadu'.split('_'),
  24232. weekdaysShort: 'Dom_Seg_Ters_Kua_Kint_Sest_Sab'.split('_'),
  24233. weekdaysMin: 'Do_Seg_Te_Ku_Ki_Ses_Sa'.split('_'),
  24234. longDateFormat: {
  24235. LT: 'HH:mm',
  24236. LTS: 'HH:mm:ss',
  24237. L: 'DD/MM/YYYY',
  24238. LL: 'D MMMM YYYY',
  24239. LLL: 'D MMMM YYYY HH:mm',
  24240. LLLL: 'dddd, D MMMM YYYY HH:mm',
  24241. },
  24242. calendar: {
  24243. sameDay: '[Ohin iha] LT',
  24244. nextDay: '[Aban iha] LT',
  24245. nextWeek: 'dddd [iha] LT',
  24246. lastDay: '[Horiseik iha] LT',
  24247. lastWeek: 'dddd [semana kotuk] [iha] LT',
  24248. sameElse: 'L',
  24249. },
  24250. relativeTime: {
  24251. future: 'iha %s',
  24252. past: '%s liuba',
  24253. s: 'segundu balun',
  24254. ss: 'segundu %d',
  24255. m: 'minutu ida',
  24256. mm: 'minutu %d',
  24257. h: 'oras ida',
  24258. hh: 'oras %d',
  24259. d: 'loron ida',
  24260. dd: 'loron %d',
  24261. M: 'fulan ida',
  24262. MM: 'fulan %d',
  24263. y: 'tinan ida',
  24264. yy: 'tinan %d',
  24265. },
  24266. dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
  24267. ordinal: function (number) {
  24268. var b = number % 10,
  24269. output =
  24270. ~~((number % 100) / 10) === 1
  24271. ? 'th'
  24272. : b === 1
  24273. ? 'st'
  24274. : b === 2
  24275. ? 'nd'
  24276. : b === 3
  24277. ? 'rd'
  24278. : 'th';
  24279. return number + output;
  24280. },
  24281. week: {
  24282. dow: 1, // Monday is the first day of the week.
  24283. doy: 4, // The week that contains Jan 4th is the first week of the year.
  24284. },
  24285. });
  24286. //! moment.js locale configuration
  24287. var suffixes$3 = {
  24288. 0: '-ум',
  24289. 1: '-ум',
  24290. 2: '-юм',
  24291. 3: '-юм',
  24292. 4: '-ум',
  24293. 5: '-ум',
  24294. 6: '-ум',
  24295. 7: '-ум',
  24296. 8: '-ум',
  24297. 9: '-ум',
  24298. 10: '-ум',
  24299. 12: '-ум',
  24300. 13: '-ум',
  24301. 20: '-ум',
  24302. 30: '-юм',
  24303. 40: '-ум',
  24304. 50: '-ум',
  24305. 60: '-ум',
  24306. 70: '-ум',
  24307. 80: '-ум',
  24308. 90: '-ум',
  24309. 100: '-ум',
  24310. };
  24311. hooks.defineLocale('tg', {
  24312. months: {
  24313. format: 'январи_феврали_марти_апрели_майи_июни_июли_августи_сентябри_октябри_ноябри_декабри'.split(
  24314. '_'
  24315. ),
  24316. standalone:
  24317. 'январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр'.split(
  24318. '_'
  24319. ),
  24320. },
  24321. monthsShort: 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'),
  24322. weekdays: 'якшанбе_душанбе_сешанбе_чоршанбе_панҷшанбе_ҷумъа_шанбе'.split(
  24323. '_'
  24324. ),
  24325. weekdaysShort: 'яшб_дшб_сшб_чшб_пшб_ҷум_шнб'.split('_'),
  24326. weekdaysMin: 'яш_дш_сш_чш_пш_ҷм_шб'.split('_'),
  24327. longDateFormat: {
  24328. LT: 'HH:mm',
  24329. LTS: 'HH:mm:ss',
  24330. L: 'DD.MM.YYYY',
  24331. LL: 'D MMMM YYYY',
  24332. LLL: 'D MMMM YYYY HH:mm',
  24333. LLLL: 'dddd, D MMMM YYYY HH:mm',
  24334. },
  24335. calendar: {
  24336. sameDay: '[Имрӯз соати] LT',
  24337. nextDay: '[Фардо соати] LT',
  24338. lastDay: '[Дирӯз соати] LT',
  24339. nextWeek: 'dddd[и] [ҳафтаи оянда соати] LT',
  24340. lastWeek: 'dddd[и] [ҳафтаи гузашта соати] LT',
  24341. sameElse: 'L',
  24342. },
  24343. relativeTime: {
  24344. future: 'баъди %s',
  24345. past: '%s пеш',
  24346. s: 'якчанд сония',
  24347. m: 'як дақиқа',
  24348. mm: '%d дақиқа',
  24349. h: 'як соат',
  24350. hh: '%d соат',
  24351. d: 'як рӯз',
  24352. dd: '%d рӯз',
  24353. M: 'як моҳ',
  24354. MM: '%d моҳ',
  24355. y: 'як сол',
  24356. yy: '%d сол',
  24357. },
  24358. meridiemParse: /шаб|субҳ|рӯз|бегоҳ/,
  24359. meridiemHour: function (hour, meridiem) {
  24360. if (hour === 12) {
  24361. hour = 0;
  24362. }
  24363. if (meridiem === 'шаб') {
  24364. return hour < 4 ? hour : hour + 12;
  24365. } else if (meridiem === 'субҳ') {
  24366. return hour;
  24367. } else if (meridiem === 'рӯз') {
  24368. return hour >= 11 ? hour : hour + 12;
  24369. } else if (meridiem === 'бегоҳ') {
  24370. return hour + 12;
  24371. }
  24372. },
  24373. meridiem: function (hour, minute, isLower) {
  24374. if (hour < 4) {
  24375. return 'шаб';
  24376. } else if (hour < 11) {
  24377. return 'субҳ';
  24378. } else if (hour < 16) {
  24379. return 'рӯз';
  24380. } else if (hour < 19) {
  24381. return 'бегоҳ';
  24382. } else {
  24383. return 'шаб';
  24384. }
  24385. },
  24386. dayOfMonthOrdinalParse: /\d{1,2}-(ум|юм)/,
  24387. ordinal: function (number) {
  24388. var a = number % 10,
  24389. b = number >= 100 ? 100 : null;
  24390. return number + (suffixes$3[number] || suffixes$3[a] || suffixes$3[b]);
  24391. },
  24392. week: {
  24393. dow: 1, // Monday is the first day of the week.
  24394. doy: 7, // The week that contains Jan 1th is the first week of the year.
  24395. },
  24396. });
  24397. //! moment.js locale configuration
  24398. hooks.defineLocale('th', {
  24399. months: 'มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม'.split(
  24400. '_'
  24401. ),
  24402. monthsShort:
  24403. 'ม.ค._ก.พ._มี.ค._เม.ย._พ.ค._มิ.ย._ก.ค._ส.ค._ก.ย._ต.ค._พ.ย._ธ.ค.'.split(
  24404. '_'
  24405. ),
  24406. monthsParseExact: true,
  24407. weekdays: 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์'.split('_'),
  24408. weekdaysShort: 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์'.split('_'), // yes, three characters difference
  24409. weekdaysMin: 'อา._จ._อ._พ._พฤ._ศ._ส.'.split('_'),
  24410. weekdaysParseExact: true,
  24411. longDateFormat: {
  24412. LT: 'H:mm',
  24413. LTS: 'H:mm:ss',
  24414. L: 'DD/MM/YYYY',
  24415. LL: 'D MMMM YYYY',
  24416. LLL: 'D MMMM YYYY เวลา H:mm',
  24417. LLLL: 'วันddddที่ D MMMM YYYY เวลา H:mm',
  24418. },
  24419. meridiemParse: /ก่อนเที่ยง|หลังเที่ยง/,
  24420. isPM: function (input) {
  24421. return input === 'หลังเที่ยง';
  24422. },
  24423. meridiem: function (hour, minute, isLower) {
  24424. if (hour < 12) {
  24425. return 'ก่อนเที่ยง';
  24426. } else {
  24427. return 'หลังเที่ยง';
  24428. }
  24429. },
  24430. calendar: {
  24431. sameDay: '[วันนี้ เวลา] LT',
  24432. nextDay: '[พรุ่งนี้ เวลา] LT',
  24433. nextWeek: 'dddd[หน้า เวลา] LT',
  24434. lastDay: '[เมื่อวานนี้ เวลา] LT',
  24435. lastWeek: '[วัน]dddd[ที่แล้ว เวลา] LT',
  24436. sameElse: 'L',
  24437. },
  24438. relativeTime: {
  24439. future: 'อีก %s',
  24440. past: '%sที่แล้ว',
  24441. s: 'ไม่กี่วินาที',
  24442. ss: '%d วินาที',
  24443. m: '1 นาที',
  24444. mm: '%d นาที',
  24445. h: '1 ชั่วโมง',
  24446. hh: '%d ชั่วโมง',
  24447. d: '1 วัน',
  24448. dd: '%d วัน',
  24449. w: '1 สัปดาห์',
  24450. ww: '%d สัปดาห์',
  24451. M: '1 เดือน',
  24452. MM: '%d เดือน',
  24453. y: '1 ปี',
  24454. yy: '%d ปี',
  24455. },
  24456. });
  24457. //! moment.js locale configuration
  24458. var suffixes$4 = {
  24459. 1: "'inji",
  24460. 5: "'inji",
  24461. 8: "'inji",
  24462. 70: "'inji",
  24463. 80: "'inji",
  24464. 2: "'nji",
  24465. 7: "'nji",
  24466. 20: "'nji",
  24467. 50: "'nji",
  24468. 3: "'ünji",
  24469. 4: "'ünji",
  24470. 100: "'ünji",
  24471. 6: "'njy",
  24472. 9: "'unjy",
  24473. 10: "'unjy",
  24474. 30: "'unjy",
  24475. 60: "'ynjy",
  24476. 90: "'ynjy",
  24477. };
  24478. hooks.defineLocale('tk', {
  24479. months: 'Ýanwar_Fewral_Mart_Aprel_Maý_Iýun_Iýul_Awgust_Sentýabr_Oktýabr_Noýabr_Dekabr'.split(
  24480. '_'
  24481. ),
  24482. monthsShort: 'Ýan_Few_Mar_Apr_Maý_Iýn_Iýl_Awg_Sen_Okt_Noý_Dek'.split('_'),
  24483. weekdays: 'Ýekşenbe_Duşenbe_Sişenbe_Çarşenbe_Penşenbe_Anna_Şenbe'.split(
  24484. '_'
  24485. ),
  24486. weekdaysShort: 'Ýek_Duş_Siş_Çar_Pen_Ann_Şen'.split('_'),
  24487. weekdaysMin: 'Ýk_Dş_Sş_Çr_Pn_An_Şn'.split('_'),
  24488. longDateFormat: {
  24489. LT: 'HH:mm',
  24490. LTS: 'HH:mm:ss',
  24491. L: 'DD.MM.YYYY',
  24492. LL: 'D MMMM YYYY',
  24493. LLL: 'D MMMM YYYY HH:mm',
  24494. LLLL: 'dddd, D MMMM YYYY HH:mm',
  24495. },
  24496. calendar: {
  24497. sameDay: '[bugün sagat] LT',
  24498. nextDay: '[ertir sagat] LT',
  24499. nextWeek: '[indiki] dddd [sagat] LT',
  24500. lastDay: '[düýn] LT',
  24501. lastWeek: '[geçen] dddd [sagat] LT',
  24502. sameElse: 'L',
  24503. },
  24504. relativeTime: {
  24505. future: '%s soň',
  24506. past: '%s öň',
  24507. s: 'birnäçe sekunt',
  24508. m: 'bir minut',
  24509. mm: '%d minut',
  24510. h: 'bir sagat',
  24511. hh: '%d sagat',
  24512. d: 'bir gün',
  24513. dd: '%d gün',
  24514. M: 'bir aý',
  24515. MM: '%d aý',
  24516. y: 'bir ýyl',
  24517. yy: '%d ýyl',
  24518. },
  24519. ordinal: function (number, period) {
  24520. switch (period) {
  24521. case 'd':
  24522. case 'D':
  24523. case 'Do':
  24524. case 'DD':
  24525. return number;
  24526. default:
  24527. if (number === 0) {
  24528. // special case for zero
  24529. return number + "'unjy";
  24530. }
  24531. var a = number % 10,
  24532. b = (number % 100) - a,
  24533. c = number >= 100 ? 100 : null;
  24534. return number + (suffixes$4[a] || suffixes$4[b] || suffixes$4[c]);
  24535. }
  24536. },
  24537. week: {
  24538. dow: 1, // Monday is the first day of the week.
  24539. doy: 7, // The week that contains Jan 7th is the first week of the year.
  24540. },
  24541. });
  24542. //! moment.js locale configuration
  24543. hooks.defineLocale('tl-ph', {
  24544. months: 'Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre'.split(
  24545. '_'
  24546. ),
  24547. monthsShort: 'Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis'.split('_'),
  24548. weekdays: 'Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado'.split(
  24549. '_'
  24550. ),
  24551. weekdaysShort: 'Lin_Lun_Mar_Miy_Huw_Biy_Sab'.split('_'),
  24552. weekdaysMin: 'Li_Lu_Ma_Mi_Hu_Bi_Sab'.split('_'),
  24553. longDateFormat: {
  24554. LT: 'HH:mm',
  24555. LTS: 'HH:mm:ss',
  24556. L: 'MM/D/YYYY',
  24557. LL: 'MMMM D, YYYY',
  24558. LLL: 'MMMM D, YYYY HH:mm',
  24559. LLLL: 'dddd, MMMM DD, YYYY HH:mm',
  24560. },
  24561. calendar: {
  24562. sameDay: 'LT [ngayong araw]',
  24563. nextDay: '[Bukas ng] LT',
  24564. nextWeek: 'LT [sa susunod na] dddd',
  24565. lastDay: 'LT [kahapon]',
  24566. lastWeek: 'LT [noong nakaraang] dddd',
  24567. sameElse: 'L',
  24568. },
  24569. relativeTime: {
  24570. future: 'sa loob ng %s',
  24571. past: '%s ang nakalipas',
  24572. s: 'ilang segundo',
  24573. ss: '%d segundo',
  24574. m: 'isang minuto',
  24575. mm: '%d minuto',
  24576. h: 'isang oras',
  24577. hh: '%d oras',
  24578. d: 'isang araw',
  24579. dd: '%d araw',
  24580. M: 'isang buwan',
  24581. MM: '%d buwan',
  24582. y: 'isang taon',
  24583. yy: '%d taon',
  24584. },
  24585. dayOfMonthOrdinalParse: /\d{1,2}/,
  24586. ordinal: function (number) {
  24587. return number;
  24588. },
  24589. week: {
  24590. dow: 1, // Monday is the first day of the week.
  24591. doy: 4, // The week that contains Jan 4th is the first week of the year.
  24592. },
  24593. });
  24594. //! moment.js locale configuration
  24595. var numbersNouns = 'pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut'.split('_');
  24596. function translateFuture(output) {
  24597. var time = output;
  24598. time =
  24599. output.indexOf('jaj') !== -1
  24600. ? time.slice(0, -3) + 'leS'
  24601. : output.indexOf('jar') !== -1
  24602. ? time.slice(0, -3) + 'waQ'
  24603. : output.indexOf('DIS') !== -1
  24604. ? time.slice(0, -3) + 'nem'
  24605. : time + ' pIq';
  24606. return time;
  24607. }
  24608. function translatePast(output) {
  24609. var time = output;
  24610. time =
  24611. output.indexOf('jaj') !== -1
  24612. ? time.slice(0, -3) + 'Hu’'
  24613. : output.indexOf('jar') !== -1
  24614. ? time.slice(0, -3) + 'wen'
  24615. : output.indexOf('DIS') !== -1
  24616. ? time.slice(0, -3) + 'ben'
  24617. : time + ' ret';
  24618. return time;
  24619. }
  24620. function translate$a(number, withoutSuffix, string, isFuture) {
  24621. var numberNoun = numberAsNoun(number);
  24622. switch (string) {
  24623. case 'ss':
  24624. return numberNoun + ' lup';
  24625. case 'mm':
  24626. return numberNoun + ' tup';
  24627. case 'hh':
  24628. return numberNoun + ' rep';
  24629. case 'dd':
  24630. return numberNoun + ' jaj';
  24631. case 'MM':
  24632. return numberNoun + ' jar';
  24633. case 'yy':
  24634. return numberNoun + ' DIS';
  24635. }
  24636. }
  24637. function numberAsNoun(number) {
  24638. var hundred = Math.floor((number % 1000) / 100),
  24639. ten = Math.floor((number % 100) / 10),
  24640. one = number % 10,
  24641. word = '';
  24642. if (hundred > 0) {
  24643. word += numbersNouns[hundred] + 'vatlh';
  24644. }
  24645. if (ten > 0) {
  24646. word += (word !== '' ? ' ' : '') + numbersNouns[ten] + 'maH';
  24647. }
  24648. if (one > 0) {
  24649. word += (word !== '' ? ' ' : '') + numbersNouns[one];
  24650. }
  24651. return word === '' ? 'pagh' : word;
  24652. }
  24653. hooks.defineLocale('tlh', {
  24654. months: 'tera’ jar wa’_tera’ jar cha’_tera’ jar wej_tera’ jar loS_tera’ jar vagh_tera’ jar jav_tera’ jar Soch_tera’ jar chorgh_tera’ jar Hut_tera’ jar wa’maH_tera’ jar wa’maH wa’_tera’ jar wa’maH cha’'.split(
  24655. '_'
  24656. ),
  24657. monthsShort:
  24658. 'jar wa’_jar cha’_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa’maH_jar wa’maH wa’_jar wa’maH cha’'.split(
  24659. '_'
  24660. ),
  24661. monthsParseExact: true,
  24662. weekdays: 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split(
  24663. '_'
  24664. ),
  24665. weekdaysShort:
  24666. 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'),
  24667. weekdaysMin:
  24668. 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'),
  24669. longDateFormat: {
  24670. LT: 'HH:mm',
  24671. LTS: 'HH:mm:ss',
  24672. L: 'DD.MM.YYYY',
  24673. LL: 'D MMMM YYYY',
  24674. LLL: 'D MMMM YYYY HH:mm',
  24675. LLLL: 'dddd, D MMMM YYYY HH:mm',
  24676. },
  24677. calendar: {
  24678. sameDay: '[DaHjaj] LT',
  24679. nextDay: '[wa’leS] LT',
  24680. nextWeek: 'LLL',
  24681. lastDay: '[wa’Hu’] LT',
  24682. lastWeek: 'LLL',
  24683. sameElse: 'L',
  24684. },
  24685. relativeTime: {
  24686. future: translateFuture,
  24687. past: translatePast,
  24688. s: 'puS lup',
  24689. ss: translate$a,
  24690. m: 'wa’ tup',
  24691. mm: translate$a,
  24692. h: 'wa’ rep',
  24693. hh: translate$a,
  24694. d: 'wa’ jaj',
  24695. dd: translate$a,
  24696. M: 'wa’ jar',
  24697. MM: translate$a,
  24698. y: 'wa’ DIS',
  24699. yy: translate$a,
  24700. },
  24701. dayOfMonthOrdinalParse: /\d{1,2}\./,
  24702. ordinal: '%d.',
  24703. week: {
  24704. dow: 1, // Monday is the first day of the week.
  24705. doy: 4, // The week that contains Jan 4th is the first week of the year.
  24706. },
  24707. });
  24708. //! moment.js locale configuration
  24709. var suffixes$5 = {
  24710. 1: "'inci",
  24711. 5: "'inci",
  24712. 8: "'inci",
  24713. 70: "'inci",
  24714. 80: "'inci",
  24715. 2: "'nci",
  24716. 7: "'nci",
  24717. 20: "'nci",
  24718. 50: "'nci",
  24719. 3: "'üncü",
  24720. 4: "'üncü",
  24721. 100: "'üncü",
  24722. 6: "'ncı",
  24723. 9: "'uncu",
  24724. 10: "'uncu",
  24725. 30: "'uncu",
  24726. 60: "'ıncı",
  24727. 90: "'ıncı",
  24728. };
  24729. hooks.defineLocale('tr', {
  24730. months: 'Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık'.split(
  24731. '_'
  24732. ),
  24733. monthsShort: 'Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara'.split('_'),
  24734. weekdays: 'Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi'.split(
  24735. '_'
  24736. ),
  24737. weekdaysShort: 'Paz_Pzt_Sal_Çar_Per_Cum_Cmt'.split('_'),
  24738. weekdaysMin: 'Pz_Pt_Sa_Ça_Pe_Cu_Ct'.split('_'),
  24739. meridiem: function (hours, minutes, isLower) {
  24740. if (hours < 12) {
  24741. return isLower ? 'öö' : 'ÖÖ';
  24742. } else {
  24743. return isLower ? 'ös' : 'ÖS';
  24744. }
  24745. },
  24746. meridiemParse: /öö|ÖÖ|ös|ÖS/,
  24747. isPM: function (input) {
  24748. return input === 'ös' || input === 'ÖS';
  24749. },
  24750. longDateFormat: {
  24751. LT: 'HH:mm',
  24752. LTS: 'HH:mm:ss',
  24753. L: 'DD.MM.YYYY',
  24754. LL: 'D MMMM YYYY',
  24755. LLL: 'D MMMM YYYY HH:mm',
  24756. LLLL: 'dddd, D MMMM YYYY HH:mm',
  24757. },
  24758. calendar: {
  24759. sameDay: '[bugün saat] LT',
  24760. nextDay: '[yarın saat] LT',
  24761. nextWeek: '[gelecek] dddd [saat] LT',
  24762. lastDay: '[dün] LT',
  24763. lastWeek: '[geçen] dddd [saat] LT',
  24764. sameElse: 'L',
  24765. },
  24766. relativeTime: {
  24767. future: '%s sonra',
  24768. past: '%s önce',
  24769. s: 'birkaç saniye',
  24770. ss: '%d saniye',
  24771. m: 'bir dakika',
  24772. mm: '%d dakika',
  24773. h: 'bir saat',
  24774. hh: '%d saat',
  24775. d: 'bir gün',
  24776. dd: '%d gün',
  24777. w: 'bir hafta',
  24778. ww: '%d hafta',
  24779. M: 'bir ay',
  24780. MM: '%d ay',
  24781. y: 'bir yıl',
  24782. yy: '%d yıl',
  24783. },
  24784. ordinal: function (number, period) {
  24785. switch (period) {
  24786. case 'd':
  24787. case 'D':
  24788. case 'Do':
  24789. case 'DD':
  24790. return number;
  24791. default:
  24792. if (number === 0) {
  24793. // special case for zero
  24794. return number + "'ıncı";
  24795. }
  24796. var a = number % 10,
  24797. b = (number % 100) - a,
  24798. c = number >= 100 ? 100 : null;
  24799. return number + (suffixes$5[a] || suffixes$5[b] || suffixes$5[c]);
  24800. }
  24801. },
  24802. week: {
  24803. dow: 1, // Monday is the first day of the week.
  24804. doy: 7, // The week that contains Jan 7th is the first week of the year.
  24805. },
  24806. });
  24807. //! moment.js locale configuration
  24808. // After the year there should be a slash and the amount of years since December 26, 1979 in Roman numerals.
  24809. // This is currently too difficult (maybe even impossible) to add.
  24810. hooks.defineLocale('tzl', {
  24811. months: 'Januar_Fevraglh_Març_Avrïu_Mai_Gün_Julia_Guscht_Setemvar_Listopäts_Noemvar_Zecemvar'.split(
  24812. '_'
  24813. ),
  24814. monthsShort: 'Jan_Fev_Mar_Avr_Mai_Gün_Jul_Gus_Set_Lis_Noe_Zec'.split('_'),
  24815. weekdays: 'Súladi_Lúneçi_Maitzi_Márcuri_Xhúadi_Viénerçi_Sáturi'.split('_'),
  24816. weekdaysShort: 'Súl_Lún_Mai_Már_Xhú_Vié_Sát'.split('_'),
  24817. weekdaysMin: 'Sú_Lú_Ma_Má_Xh_Vi_Sá'.split('_'),
  24818. longDateFormat: {
  24819. LT: 'HH.mm',
  24820. LTS: 'HH.mm.ss',
  24821. L: 'DD.MM.YYYY',
  24822. LL: 'D. MMMM [dallas] YYYY',
  24823. LLL: 'D. MMMM [dallas] YYYY HH.mm',
  24824. LLLL: 'dddd, [li] D. MMMM [dallas] YYYY HH.mm',
  24825. },
  24826. meridiemParse: /d\'o|d\'a/i,
  24827. isPM: function (input) {
  24828. return "d'o" === input.toLowerCase();
  24829. },
  24830. meridiem: function (hours, minutes, isLower) {
  24831. if (hours > 11) {
  24832. return isLower ? "d'o" : "D'O";
  24833. } else {
  24834. return isLower ? "d'a" : "D'A";
  24835. }
  24836. },
  24837. calendar: {
  24838. sameDay: '[oxhi à] LT',
  24839. nextDay: '[demà à] LT',
  24840. nextWeek: 'dddd [à] LT',
  24841. lastDay: '[ieiri à] LT',
  24842. lastWeek: '[sür el] dddd [lasteu à] LT',
  24843. sameElse: 'L',
  24844. },
  24845. relativeTime: {
  24846. future: 'osprei %s',
  24847. past: 'ja%s',
  24848. s: processRelativeTime$8,
  24849. ss: processRelativeTime$8,
  24850. m: processRelativeTime$8,
  24851. mm: processRelativeTime$8,
  24852. h: processRelativeTime$8,
  24853. hh: processRelativeTime$8,
  24854. d: processRelativeTime$8,
  24855. dd: processRelativeTime$8,
  24856. M: processRelativeTime$8,
  24857. MM: processRelativeTime$8,
  24858. y: processRelativeTime$8,
  24859. yy: processRelativeTime$8,
  24860. },
  24861. dayOfMonthOrdinalParse: /\d{1,2}\./,
  24862. ordinal: '%d.',
  24863. week: {
  24864. dow: 1, // Monday is the first day of the week.
  24865. doy: 4, // The week that contains Jan 4th is the first week of the year.
  24866. },
  24867. });
  24868. function processRelativeTime$8(number, withoutSuffix, key, isFuture) {
  24869. var format = {
  24870. s: ['viensas secunds', "'iensas secunds"],
  24871. ss: [number + ' secunds', '' + number + ' secunds'],
  24872. m: ["'n míut", "'iens míut"],
  24873. mm: [number + ' míuts', '' + number + ' míuts'],
  24874. h: ["'n þora", "'iensa þora"],
  24875. hh: [number + ' þoras', '' + number + ' þoras'],
  24876. d: ["'n ziua", "'iensa ziua"],
  24877. dd: [number + ' ziuas', '' + number + ' ziuas'],
  24878. M: ["'n mes", "'iens mes"],
  24879. MM: [number + ' mesen', '' + number + ' mesen'],
  24880. y: ["'n ar", "'iens ar"],
  24881. yy: [number + ' ars', '' + number + ' ars'],
  24882. };
  24883. return isFuture
  24884. ? format[key][0]
  24885. : withoutSuffix
  24886. ? format[key][0]
  24887. : format[key][1];
  24888. }
  24889. //! moment.js locale configuration
  24890. hooks.defineLocale('tzm-latn', {
  24891. months: 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split(
  24892. '_'
  24893. ),
  24894. monthsShort:
  24895. 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split(
  24896. '_'
  24897. ),
  24898. weekdays: 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'),
  24899. weekdaysShort: 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'),
  24900. weekdaysMin: 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'),
  24901. longDateFormat: {
  24902. LT: 'HH:mm',
  24903. LTS: 'HH:mm:ss',
  24904. L: 'DD/MM/YYYY',
  24905. LL: 'D MMMM YYYY',
  24906. LLL: 'D MMMM YYYY HH:mm',
  24907. LLLL: 'dddd D MMMM YYYY HH:mm',
  24908. },
  24909. calendar: {
  24910. sameDay: '[asdkh g] LT',
  24911. nextDay: '[aska g] LT',
  24912. nextWeek: 'dddd [g] LT',
  24913. lastDay: '[assant g] LT',
  24914. lastWeek: 'dddd [g] LT',
  24915. sameElse: 'L',
  24916. },
  24917. relativeTime: {
  24918. future: 'dadkh s yan %s',
  24919. past: 'yan %s',
  24920. s: 'imik',
  24921. ss: '%d imik',
  24922. m: 'minuḍ',
  24923. mm: '%d minuḍ',
  24924. h: 'saɛa',
  24925. hh: '%d tassaɛin',
  24926. d: 'ass',
  24927. dd: '%d ossan',
  24928. M: 'ayowr',
  24929. MM: '%d iyyirn',
  24930. y: 'asgas',
  24931. yy: '%d isgasn',
  24932. },
  24933. week: {
  24934. dow: 6, // Saturday is the first day of the week.
  24935. doy: 12, // The week that contains Jan 12th is the first week of the year.
  24936. },
  24937. });
  24938. //! moment.js locale configuration
  24939. hooks.defineLocale('tzm', {
  24940. months: 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split(
  24941. '_'
  24942. ),
  24943. monthsShort:
  24944. 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split(
  24945. '_'
  24946. ),
  24947. weekdays: 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'),
  24948. weekdaysShort: 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'),
  24949. weekdaysMin: 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'),
  24950. longDateFormat: {
  24951. LT: 'HH:mm',
  24952. LTS: 'HH:mm:ss',
  24953. L: 'DD/MM/YYYY',
  24954. LL: 'D MMMM YYYY',
  24955. LLL: 'D MMMM YYYY HH:mm',
  24956. LLLL: 'dddd D MMMM YYYY HH:mm',
  24957. },
  24958. calendar: {
  24959. sameDay: '[ⴰⵙⴷⵅ ⴴ] LT',
  24960. nextDay: '[ⴰⵙⴽⴰ ⴴ] LT',
  24961. nextWeek: 'dddd [ⴴ] LT',
  24962. lastDay: '[ⴰⵚⴰⵏⵜ ⴴ] LT',
  24963. lastWeek: 'dddd [ⴴ] LT',
  24964. sameElse: 'L',
  24965. },
  24966. relativeTime: {
  24967. future: 'ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s',
  24968. past: 'ⵢⴰⵏ %s',
  24969. s: 'ⵉⵎⵉⴽ',
  24970. ss: '%d ⵉⵎⵉⴽ',
  24971. m: 'ⵎⵉⵏⵓⴺ',
  24972. mm: '%d ⵎⵉⵏⵓⴺ',
  24973. h: 'ⵙⴰⵄⴰ',
  24974. hh: '%d ⵜⴰⵙⵙⴰⵄⵉⵏ',
  24975. d: 'ⴰⵙⵙ',
  24976. dd: '%d oⵙⵙⴰⵏ',
  24977. M: 'ⴰⵢoⵓⵔ',
  24978. MM: '%d ⵉⵢⵢⵉⵔⵏ',
  24979. y: 'ⴰⵙⴳⴰⵙ',
  24980. yy: '%d ⵉⵙⴳⴰⵙⵏ',
  24981. },
  24982. week: {
  24983. dow: 6, // Saturday is the first day of the week.
  24984. doy: 12, // The week that contains Jan 12th is the first week of the year.
  24985. },
  24986. });
  24987. //! moment.js locale configuration
  24988. hooks.defineLocale('ug-cn', {
  24989. months: 'يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر'.split(
  24990. '_'
  24991. ),
  24992. monthsShort:
  24993. 'يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر'.split(
  24994. '_'
  24995. ),
  24996. weekdays: 'يەكشەنبە_دۈشەنبە_سەيشەنبە_چارشەنبە_پەيشەنبە_جۈمە_شەنبە'.split(
  24997. '_'
  24998. ),
  24999. weekdaysShort: 'يە_دۈ_سە_چا_پە_جۈ_شە'.split('_'),
  25000. weekdaysMin: 'يە_دۈ_سە_چا_پە_جۈ_شە'.split('_'),
  25001. longDateFormat: {
  25002. LT: 'HH:mm',
  25003. LTS: 'HH:mm:ss',
  25004. L: 'YYYY-MM-DD',
  25005. LL: 'YYYY-يىلىM-ئاينىڭD-كۈنى',
  25006. LLL: 'YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm',
  25007. LLLL: 'dddd، YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm',
  25008. },
  25009. meridiemParse: /يېرىم كېچە|سەھەر|چۈشتىن بۇرۇن|چۈش|چۈشتىن كېيىن|كەچ/,
  25010. meridiemHour: function (hour, meridiem) {
  25011. if (hour === 12) {
  25012. hour = 0;
  25013. }
  25014. if (
  25015. meridiem === 'يېرىم كېچە' ||
  25016. meridiem === 'سەھەر' ||
  25017. meridiem === 'چۈشتىن بۇرۇن'
  25018. ) {
  25019. return hour;
  25020. } else if (meridiem === 'چۈشتىن كېيىن' || meridiem === 'كەچ') {
  25021. return hour + 12;
  25022. } else {
  25023. return hour >= 11 ? hour : hour + 12;
  25024. }
  25025. },
  25026. meridiem: function (hour, minute, isLower) {
  25027. var hm = hour * 100 + minute;
  25028. if (hm < 600) {
  25029. return 'يېرىم كېچە';
  25030. } else if (hm < 900) {
  25031. return 'سەھەر';
  25032. } else if (hm < 1130) {
  25033. return 'چۈشتىن بۇرۇن';
  25034. } else if (hm < 1230) {
  25035. return 'چۈش';
  25036. } else if (hm < 1800) {
  25037. return 'چۈشتىن كېيىن';
  25038. } else {
  25039. return 'كەچ';
  25040. }
  25041. },
  25042. calendar: {
  25043. sameDay: '[بۈگۈن سائەت] LT',
  25044. nextDay: '[ئەتە سائەت] LT',
  25045. nextWeek: '[كېلەركى] dddd [سائەت] LT',
  25046. lastDay: '[تۆنۈگۈن] LT',
  25047. lastWeek: '[ئالدىنقى] dddd [سائەت] LT',
  25048. sameElse: 'L',
  25049. },
  25050. relativeTime: {
  25051. future: '%s كېيىن',
  25052. past: '%s بۇرۇن',
  25053. s: 'نەچچە سېكونت',
  25054. ss: '%d سېكونت',
  25055. m: 'بىر مىنۇت',
  25056. mm: '%d مىنۇت',
  25057. h: 'بىر سائەت',
  25058. hh: '%d سائەت',
  25059. d: 'بىر كۈن',
  25060. dd: '%d كۈن',
  25061. M: 'بىر ئاي',
  25062. MM: '%d ئاي',
  25063. y: 'بىر يىل',
  25064. yy: '%d يىل',
  25065. },
  25066. dayOfMonthOrdinalParse: /\d{1,2}(-كۈنى|-ئاي|-ھەپتە)/,
  25067. ordinal: function (number, period) {
  25068. switch (period) {
  25069. case 'd':
  25070. case 'D':
  25071. case 'DDD':
  25072. return number + '-كۈنى';
  25073. case 'w':
  25074. case 'W':
  25075. return number + '-ھەپتە';
  25076. default:
  25077. return number;
  25078. }
  25079. },
  25080. preparse: function (string) {
  25081. return string.replace(/،/g, ',');
  25082. },
  25083. postformat: function (string) {
  25084. return string.replace(/,/g, '،');
  25085. },
  25086. week: {
  25087. // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
  25088. dow: 1, // Monday is the first day of the week.
  25089. doy: 7, // The week that contains Jan 1st is the first week of the year.
  25090. },
  25091. });
  25092. //! moment.js locale configuration
  25093. function plural$6(word, num) {
  25094. var forms = word.split('_');
  25095. return num % 10 === 1 && num % 100 !== 11
  25096. ? forms[0]
  25097. : num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20)
  25098. ? forms[1]
  25099. : forms[2];
  25100. }
  25101. function relativeTimeWithPlural$4(number, withoutSuffix, key) {
  25102. var format = {
  25103. ss: withoutSuffix ? 'секунда_секунди_секунд' : 'секунду_секунди_секунд',
  25104. mm: withoutSuffix ? 'хвилина_хвилини_хвилин' : 'хвилину_хвилини_хвилин',
  25105. hh: withoutSuffix ? 'година_години_годин' : 'годину_години_годин',
  25106. dd: 'день_дні_днів',
  25107. MM: 'місяць_місяці_місяців',
  25108. yy: 'рік_роки_років',
  25109. };
  25110. if (key === 'm') {
  25111. return withoutSuffix ? 'хвилина' : 'хвилину';
  25112. } else if (key === 'h') {
  25113. return withoutSuffix ? 'година' : 'годину';
  25114. } else {
  25115. return number + ' ' + plural$6(format[key], +number);
  25116. }
  25117. }
  25118. function weekdaysCaseReplace(m, format) {
  25119. var weekdays = {
  25120. nominative:
  25121. 'неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота'.split(
  25122. '_'
  25123. ),
  25124. accusative:
  25125. 'неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу'.split(
  25126. '_'
  25127. ),
  25128. genitive:
  25129. 'неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи'.split(
  25130. '_'
  25131. ),
  25132. },
  25133. nounCase;
  25134. if (m === true) {
  25135. return weekdays['nominative']
  25136. .slice(1, 7)
  25137. .concat(weekdays['nominative'].slice(0, 1));
  25138. }
  25139. if (!m) {
  25140. return weekdays['nominative'];
  25141. }
  25142. nounCase = /(\[[ВвУу]\]) ?dddd/.test(format)
  25143. ? 'accusative'
  25144. : /\[?(?:минулої|наступної)? ?\] ?dddd/.test(format)
  25145. ? 'genitive'
  25146. : 'nominative';
  25147. return weekdays[nounCase][m.day()];
  25148. }
  25149. function processHoursFunction(str) {
  25150. return function () {
  25151. return str + 'о' + (this.hours() === 11 ? 'б' : '') + '] LT';
  25152. };
  25153. }
  25154. hooks.defineLocale('uk', {
  25155. months: {
  25156. format: 'січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня'.split(
  25157. '_'
  25158. ),
  25159. standalone:
  25160. 'січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень'.split(
  25161. '_'
  25162. ),
  25163. },
  25164. monthsShort: 'січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд'.split(
  25165. '_'
  25166. ),
  25167. weekdays: weekdaysCaseReplace,
  25168. weekdaysShort: 'нд_пн_вт_ср_чт_пт_сб'.split('_'),
  25169. weekdaysMin: 'нд_пн_вт_ср_чт_пт_сб'.split('_'),
  25170. longDateFormat: {
  25171. LT: 'HH:mm',
  25172. LTS: 'HH:mm:ss',
  25173. L: 'DD.MM.YYYY',
  25174. LL: 'D MMMM YYYY р.',
  25175. LLL: 'D MMMM YYYY р., HH:mm',
  25176. LLLL: 'dddd, D MMMM YYYY р., HH:mm',
  25177. },
  25178. calendar: {
  25179. sameDay: processHoursFunction('[Сьогодні '),
  25180. nextDay: processHoursFunction('[Завтра '),
  25181. lastDay: processHoursFunction('[Вчора '),
  25182. nextWeek: processHoursFunction('[У] dddd ['),
  25183. lastWeek: function () {
  25184. switch (this.day()) {
  25185. case 0:
  25186. case 3:
  25187. case 5:
  25188. case 6:
  25189. return processHoursFunction('[Минулої] dddd [').call(this);
  25190. case 1:
  25191. case 2:
  25192. case 4:
  25193. return processHoursFunction('[Минулого] dddd [').call(this);
  25194. }
  25195. },
  25196. sameElse: 'L',
  25197. },
  25198. relativeTime: {
  25199. future: 'за %s',
  25200. past: '%s тому',
  25201. s: 'декілька секунд',
  25202. ss: relativeTimeWithPlural$4,
  25203. m: relativeTimeWithPlural$4,
  25204. mm: relativeTimeWithPlural$4,
  25205. h: 'годину',
  25206. hh: relativeTimeWithPlural$4,
  25207. d: 'день',
  25208. dd: relativeTimeWithPlural$4,
  25209. M: 'місяць',
  25210. MM: relativeTimeWithPlural$4,
  25211. y: 'рік',
  25212. yy: relativeTimeWithPlural$4,
  25213. },
  25214. // M. E.: those two are virtually unused but a user might want to implement them for his/her website for some reason
  25215. meridiemParse: /ночі|ранку|дня|вечора/,
  25216. isPM: function (input) {
  25217. return /^(дня|вечора)$/.test(input);
  25218. },
  25219. meridiem: function (hour, minute, isLower) {
  25220. if (hour < 4) {
  25221. return 'ночі';
  25222. } else if (hour < 12) {
  25223. return 'ранку';
  25224. } else if (hour < 17) {
  25225. return 'дня';
  25226. } else {
  25227. return 'вечора';
  25228. }
  25229. },
  25230. dayOfMonthOrdinalParse: /\d{1,2}-(й|го)/,
  25231. ordinal: function (number, period) {
  25232. switch (period) {
  25233. case 'M':
  25234. case 'd':
  25235. case 'DDD':
  25236. case 'w':
  25237. case 'W':
  25238. return number + '-й';
  25239. case 'D':
  25240. return number + '-го';
  25241. default:
  25242. return number;
  25243. }
  25244. },
  25245. week: {
  25246. dow: 1, // Monday is the first day of the week.
  25247. doy: 7, // The week that contains Jan 7th is the first week of the year.
  25248. },
  25249. });
  25250. //! moment.js locale configuration
  25251. var months$b = [
  25252. 'جنوری',
  25253. 'فروری',
  25254. 'مارچ',
  25255. 'اپریل',
  25256. 'مئی',
  25257. 'جون',
  25258. 'جولائی',
  25259. 'اگست',
  25260. 'ستمبر',
  25261. 'اکتوبر',
  25262. 'نومبر',
  25263. 'دسمبر',
  25264. ],
  25265. days$2 = ['اتوار', 'پیر', 'منگل', 'بدھ', 'جمعرات', 'جمعہ', 'ہفتہ'];
  25266. hooks.defineLocale('ur', {
  25267. months: months$b,
  25268. monthsShort: months$b,
  25269. weekdays: days$2,
  25270. weekdaysShort: days$2,
  25271. weekdaysMin: days$2,
  25272. longDateFormat: {
  25273. LT: 'HH:mm',
  25274. LTS: 'HH:mm:ss',
  25275. L: 'DD/MM/YYYY',
  25276. LL: 'D MMMM YYYY',
  25277. LLL: 'D MMMM YYYY HH:mm',
  25278. LLLL: 'dddd، D MMMM YYYY HH:mm',
  25279. },
  25280. meridiemParse: /صبح|شام/,
  25281. isPM: function (input) {
  25282. return 'شام' === input;
  25283. },
  25284. meridiem: function (hour, minute, isLower) {
  25285. if (hour < 12) {
  25286. return 'صبح';
  25287. }
  25288. return 'شام';
  25289. },
  25290. calendar: {
  25291. sameDay: '[آج بوقت] LT',
  25292. nextDay: '[کل بوقت] LT',
  25293. nextWeek: 'dddd [بوقت] LT',
  25294. lastDay: '[گذشتہ روز بوقت] LT',
  25295. lastWeek: '[گذشتہ] dddd [بوقت] LT',
  25296. sameElse: 'L',
  25297. },
  25298. relativeTime: {
  25299. future: '%s بعد',
  25300. past: '%s قبل',
  25301. s: 'چند سیکنڈ',
  25302. ss: '%d سیکنڈ',
  25303. m: 'ایک منٹ',
  25304. mm: '%d منٹ',
  25305. h: 'ایک گھنٹہ',
  25306. hh: '%d گھنٹے',
  25307. d: 'ایک دن',
  25308. dd: '%d دن',
  25309. M: 'ایک ماہ',
  25310. MM: '%d ماہ',
  25311. y: 'ایک سال',
  25312. yy: '%d سال',
  25313. },
  25314. preparse: function (string) {
  25315. return string.replace(/،/g, ',');
  25316. },
  25317. postformat: function (string) {
  25318. return string.replace(/,/g, '،');
  25319. },
  25320. week: {
  25321. dow: 1, // Monday is the first day of the week.
  25322. doy: 4, // The week that contains Jan 4th is the first week of the year.
  25323. },
  25324. });
  25325. //! moment.js locale configuration
  25326. hooks.defineLocale('uz-latn', {
  25327. months: 'Yanvar_Fevral_Mart_Aprel_May_Iyun_Iyul_Avgust_Sentabr_Oktabr_Noyabr_Dekabr'.split(
  25328. '_'
  25329. ),
  25330. monthsShort: 'Yan_Fev_Mar_Apr_May_Iyun_Iyul_Avg_Sen_Okt_Noy_Dek'.split('_'),
  25331. weekdays:
  25332. 'Yakshanba_Dushanba_Seshanba_Chorshanba_Payshanba_Juma_Shanba'.split(
  25333. '_'
  25334. ),
  25335. weekdaysShort: 'Yak_Dush_Sesh_Chor_Pay_Jum_Shan'.split('_'),
  25336. weekdaysMin: 'Ya_Du_Se_Cho_Pa_Ju_Sha'.split('_'),
  25337. longDateFormat: {
  25338. LT: 'HH:mm',
  25339. LTS: 'HH:mm:ss',
  25340. L: 'DD/MM/YYYY',
  25341. LL: 'D MMMM YYYY',
  25342. LLL: 'D MMMM YYYY HH:mm',
  25343. LLLL: 'D MMMM YYYY, dddd HH:mm',
  25344. },
  25345. calendar: {
  25346. sameDay: '[Bugun soat] LT [da]',
  25347. nextDay: '[Ertaga] LT [da]',
  25348. nextWeek: 'dddd [kuni soat] LT [da]',
  25349. lastDay: '[Kecha soat] LT [da]',
  25350. lastWeek: "[O'tgan] dddd [kuni soat] LT [da]",
  25351. sameElse: 'L',
  25352. },
  25353. relativeTime: {
  25354. future: 'Yaqin %s ichida',
  25355. past: 'Bir necha %s oldin',
  25356. s: 'soniya',
  25357. ss: '%d soniya',
  25358. m: 'bir daqiqa',
  25359. mm: '%d daqiqa',
  25360. h: 'bir soat',
  25361. hh: '%d soat',
  25362. d: 'bir kun',
  25363. dd: '%d kun',
  25364. M: 'bir oy',
  25365. MM: '%d oy',
  25366. y: 'bir yil',
  25367. yy: '%d yil',
  25368. },
  25369. week: {
  25370. dow: 1, // Monday is the first day of the week.
  25371. doy: 7, // The week that contains Jan 7th is the first week of the year.
  25372. },
  25373. });
  25374. //! moment.js locale configuration
  25375. hooks.defineLocale('uz', {
  25376. months: 'январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр'.split(
  25377. '_'
  25378. ),
  25379. monthsShort: 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'),
  25380. weekdays: 'Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба'.split('_'),
  25381. weekdaysShort: 'Якш_Душ_Сеш_Чор_Пай_Жум_Шан'.split('_'),
  25382. weekdaysMin: 'Як_Ду_Се_Чо_Па_Жу_Ша'.split('_'),
  25383. longDateFormat: {
  25384. LT: 'HH:mm',
  25385. LTS: 'HH:mm:ss',
  25386. L: 'DD/MM/YYYY',
  25387. LL: 'D MMMM YYYY',
  25388. LLL: 'D MMMM YYYY HH:mm',
  25389. LLLL: 'D MMMM YYYY, dddd HH:mm',
  25390. },
  25391. calendar: {
  25392. sameDay: '[Бугун соат] LT [да]',
  25393. nextDay: '[Эртага] LT [да]',
  25394. nextWeek: 'dddd [куни соат] LT [да]',
  25395. lastDay: '[Кеча соат] LT [да]',
  25396. lastWeek: '[Утган] dddd [куни соат] LT [да]',
  25397. sameElse: 'L',
  25398. },
  25399. relativeTime: {
  25400. future: 'Якин %s ичида',
  25401. past: 'Бир неча %s олдин',
  25402. s: 'фурсат',
  25403. ss: '%d фурсат',
  25404. m: 'бир дакика',
  25405. mm: '%d дакика',
  25406. h: 'бир соат',
  25407. hh: '%d соат',
  25408. d: 'бир кун',
  25409. dd: '%d кун',
  25410. M: 'бир ой',
  25411. MM: '%d ой',
  25412. y: 'бир йил',
  25413. yy: '%d йил',
  25414. },
  25415. week: {
  25416. dow: 1, // Monday is the first day of the week.
  25417. doy: 7, // The week that contains Jan 4th is the first week of the year.
  25418. },
  25419. });
  25420. //! moment.js locale configuration
  25421. hooks.defineLocale('vi', {
  25422. months: 'tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12'.split(
  25423. '_'
  25424. ),
  25425. monthsShort:
  25426. 'Thg 01_Thg 02_Thg 03_Thg 04_Thg 05_Thg 06_Thg 07_Thg 08_Thg 09_Thg 10_Thg 11_Thg 12'.split(
  25427. '_'
  25428. ),
  25429. monthsParseExact: true,
  25430. weekdays: 'chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy'.split(
  25431. '_'
  25432. ),
  25433. weekdaysShort: 'CN_T2_T3_T4_T5_T6_T7'.split('_'),
  25434. weekdaysMin: 'CN_T2_T3_T4_T5_T6_T7'.split('_'),
  25435. weekdaysParseExact: true,
  25436. meridiemParse: /sa|ch/i,
  25437. isPM: function (input) {
  25438. return /^ch$/i.test(input);
  25439. },
  25440. meridiem: function (hours, minutes, isLower) {
  25441. if (hours < 12) {
  25442. return isLower ? 'sa' : 'SA';
  25443. } else {
  25444. return isLower ? 'ch' : 'CH';
  25445. }
  25446. },
  25447. longDateFormat: {
  25448. LT: 'HH:mm',
  25449. LTS: 'HH:mm:ss',
  25450. L: 'DD/MM/YYYY',
  25451. LL: 'D MMMM [năm] YYYY',
  25452. LLL: 'D MMMM [năm] YYYY HH:mm',
  25453. LLLL: 'dddd, D MMMM [năm] YYYY HH:mm',
  25454. l: 'DD/M/YYYY',
  25455. ll: 'D MMM YYYY',
  25456. lll: 'D MMM YYYY HH:mm',
  25457. llll: 'ddd, D MMM YYYY HH:mm',
  25458. },
  25459. calendar: {
  25460. sameDay: '[Hôm nay lúc] LT',
  25461. nextDay: '[Ngày mai lúc] LT',
  25462. nextWeek: 'dddd [tuần tới lúc] LT',
  25463. lastDay: '[Hôm qua lúc] LT',
  25464. lastWeek: 'dddd [tuần trước lúc] LT',
  25465. sameElse: 'L',
  25466. },
  25467. relativeTime: {
  25468. future: '%s tới',
  25469. past: '%s trước',
  25470. s: 'vài giây',
  25471. ss: '%d giây',
  25472. m: 'một phút',
  25473. mm: '%d phút',
  25474. h: 'một giờ',
  25475. hh: '%d giờ',
  25476. d: 'một ngày',
  25477. dd: '%d ngày',
  25478. w: 'một tuần',
  25479. ww: '%d tuần',
  25480. M: 'một tháng',
  25481. MM: '%d tháng',
  25482. y: 'một năm',
  25483. yy: '%d năm',
  25484. },
  25485. dayOfMonthOrdinalParse: /\d{1,2}/,
  25486. ordinal: function (number) {
  25487. return number;
  25488. },
  25489. week: {
  25490. dow: 1, // Monday is the first day of the week.
  25491. doy: 4, // The week that contains Jan 4th is the first week of the year.
  25492. },
  25493. });
  25494. //! moment.js locale configuration
  25495. hooks.defineLocale('x-pseudo', {
  25496. months: 'J~áñúá~rý_F~ébrú~árý_~Márc~h_Áp~ríl_~Máý_~Júñé~_Júl~ý_Áú~gúst~_Sép~témb~ér_Ó~ctób~ér_Ñ~óvém~bér_~Décé~mbér'.split(
  25497. '_'
  25498. ),
  25499. monthsShort:
  25500. 'J~áñ_~Féb_~Már_~Ápr_~Máý_~Júñ_~Júl_~Áúg_~Sép_~Óct_~Ñóv_~Déc'.split(
  25501. '_'
  25502. ),
  25503. monthsParseExact: true,
  25504. weekdays:
  25505. 'S~úñdá~ý_Mó~ñdáý~_Túé~sdáý~_Wéd~ñésd~áý_T~húrs~dáý_~Fríd~áý_S~átúr~dáý'.split(
  25506. '_'
  25507. ),
  25508. weekdaysShort: 'S~úñ_~Móñ_~Túé_~Wéd_~Thú_~Frí_~Sát'.split('_'),
  25509. weekdaysMin: 'S~ú_Mó~_Tú_~Wé_T~h_Fr~_Sá'.split('_'),
  25510. weekdaysParseExact: true,
  25511. longDateFormat: {
  25512. LT: 'HH:mm',
  25513. L: 'DD/MM/YYYY',
  25514. LL: 'D MMMM YYYY',
  25515. LLL: 'D MMMM YYYY HH:mm',
  25516. LLLL: 'dddd, D MMMM YYYY HH:mm',
  25517. },
  25518. calendar: {
  25519. sameDay: '[T~ódá~ý át] LT',
  25520. nextDay: '[T~ómó~rró~w át] LT',
  25521. nextWeek: 'dddd [át] LT',
  25522. lastDay: '[Ý~ést~érdá~ý át] LT',
  25523. lastWeek: '[L~ást] dddd [át] LT',
  25524. sameElse: 'L',
  25525. },
  25526. relativeTime: {
  25527. future: 'í~ñ %s',
  25528. past: '%s á~gó',
  25529. s: 'á ~féw ~sécó~ñds',
  25530. ss: '%d s~écóñ~ds',
  25531. m: 'á ~míñ~úté',
  25532. mm: '%d m~íñú~tés',
  25533. h: 'á~ñ hó~úr',
  25534. hh: '%d h~óúrs',
  25535. d: 'á ~dáý',
  25536. dd: '%d d~áýs',
  25537. M: 'á ~móñ~th',
  25538. MM: '%d m~óñt~hs',
  25539. y: 'á ~ýéár',
  25540. yy: '%d ý~éárs',
  25541. },
  25542. dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
  25543. ordinal: function (number) {
  25544. var b = number % 10,
  25545. output =
  25546. ~~((number % 100) / 10) === 1
  25547. ? 'th'
  25548. : b === 1
  25549. ? 'st'
  25550. : b === 2
  25551. ? 'nd'
  25552. : b === 3
  25553. ? 'rd'
  25554. : 'th';
  25555. return number + output;
  25556. },
  25557. week: {
  25558. dow: 1, // Monday is the first day of the week.
  25559. doy: 4, // The week that contains Jan 4th is the first week of the year.
  25560. },
  25561. });
  25562. //! moment.js locale configuration
  25563. hooks.defineLocale('yo', {
  25564. months: 'Sẹ́rẹ́_Èrèlè_Ẹrẹ̀nà_Ìgbé_Èbibi_Òkùdu_Agẹmo_Ògún_Owewe_Ọ̀wàrà_Bélú_Ọ̀pẹ̀̀'.split(
  25565. '_'
  25566. ),
  25567. monthsShort: 'Sẹ́r_Èrl_Ẹrn_Ìgb_Èbi_Òkù_Agẹ_Ògú_Owe_Ọ̀wà_Bél_Ọ̀pẹ̀̀'.split('_'),
  25568. weekdays: 'Àìkú_Ajé_Ìsẹ́gun_Ọjọ́rú_Ọjọ́bọ_Ẹtì_Àbámẹ́ta'.split('_'),
  25569. weekdaysShort: 'Àìk_Ajé_Ìsẹ́_Ọjr_Ọjb_Ẹtì_Àbá'.split('_'),
  25570. weekdaysMin: 'Àì_Aj_Ìs_Ọr_Ọb_Ẹt_Àb'.split('_'),
  25571. longDateFormat: {
  25572. LT: 'h:mm A',
  25573. LTS: 'h:mm:ss A',
  25574. L: 'DD/MM/YYYY',
  25575. LL: 'D MMMM YYYY',
  25576. LLL: 'D MMMM YYYY h:mm A',
  25577. LLLL: 'dddd, D MMMM YYYY h:mm A',
  25578. },
  25579. calendar: {
  25580. sameDay: '[Ònì ni] LT',
  25581. nextDay: '[Ọ̀la ni] LT',
  25582. nextWeek: "dddd [Ọsẹ̀ tón'bọ] [ni] LT",
  25583. lastDay: '[Àna ni] LT',
  25584. lastWeek: 'dddd [Ọsẹ̀ tólọ́] [ni] LT',
  25585. sameElse: 'L',
  25586. },
  25587. relativeTime: {
  25588. future: 'ní %s',
  25589. past: '%s kọjá',
  25590. s: 'ìsẹjú aayá die',
  25591. ss: 'aayá %d',
  25592. m: 'ìsẹjú kan',
  25593. mm: 'ìsẹjú %d',
  25594. h: 'wákati kan',
  25595. hh: 'wákati %d',
  25596. d: 'ọjọ́ kan',
  25597. dd: 'ọjọ́ %d',
  25598. M: 'osù kan',
  25599. MM: 'osù %d',
  25600. y: 'ọdún kan',
  25601. yy: 'ọdún %d',
  25602. },
  25603. dayOfMonthOrdinalParse: /ọjọ́\s\d{1,2}/,
  25604. ordinal: 'ọjọ́ %d',
  25605. week: {
  25606. dow: 1, // Monday is the first day of the week.
  25607. doy: 4, // The week that contains Jan 4th is the first week of the year.
  25608. },
  25609. });
  25610. //! moment.js locale configuration
  25611. hooks.defineLocale('zh-cn', {
  25612. months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split(
  25613. '_'
  25614. ),
  25615. monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split(
  25616. '_'
  25617. ),
  25618. weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
  25619. weekdaysShort: '周日_周一_周二_周三_周四_周五_周六'.split('_'),
  25620. weekdaysMin: '日_一_二_三_四_五_六'.split('_'),
  25621. longDateFormat: {
  25622. LT: 'HH:mm',
  25623. LTS: 'HH:mm:ss',
  25624. L: 'YYYY/MM/DD',
  25625. LL: 'YYYY年M月D日',
  25626. LLL: 'YYYY年M月D日Ah点mm分',
  25627. LLLL: 'YYYY年M月D日ddddAh点mm分',
  25628. l: 'YYYY/M/D',
  25629. ll: 'YYYY年M月D日',
  25630. lll: 'YYYY年M月D日 HH:mm',
  25631. llll: 'YYYY年M月D日dddd HH:mm',
  25632. },
  25633. meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
  25634. meridiemHour: function (hour, meridiem) {
  25635. if (hour === 12) {
  25636. hour = 0;
  25637. }
  25638. if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') {
  25639. return hour;
  25640. } else if (meridiem === '下午' || meridiem === '晚上') {
  25641. return hour + 12;
  25642. } else {
  25643. // '中午'
  25644. return hour >= 11 ? hour : hour + 12;
  25645. }
  25646. },
  25647. meridiem: function (hour, minute, isLower) {
  25648. var hm = hour * 100 + minute;
  25649. if (hm < 600) {
  25650. return '凌晨';
  25651. } else if (hm < 900) {
  25652. return '早上';
  25653. } else if (hm < 1130) {
  25654. return '上午';
  25655. } else if (hm < 1230) {
  25656. return '中午';
  25657. } else if (hm < 1800) {
  25658. return '下午';
  25659. } else {
  25660. return '晚上';
  25661. }
  25662. },
  25663. calendar: {
  25664. sameDay: '[今天]LT',
  25665. nextDay: '[明天]LT',
  25666. nextWeek: function (now) {
  25667. if (now.week() !== this.week()) {
  25668. return '[下]dddLT';
  25669. } else {
  25670. return '[本]dddLT';
  25671. }
  25672. },
  25673. lastDay: '[昨天]LT',
  25674. lastWeek: function (now) {
  25675. if (this.week() !== now.week()) {
  25676. return '[上]dddLT';
  25677. } else {
  25678. return '[本]dddLT';
  25679. }
  25680. },
  25681. sameElse: 'L',
  25682. },
  25683. dayOfMonthOrdinalParse: /\d{1,2}(日|月|周)/,
  25684. ordinal: function (number, period) {
  25685. switch (period) {
  25686. case 'd':
  25687. case 'D':
  25688. case 'DDD':
  25689. return number + '日';
  25690. case 'M':
  25691. return number + '月';
  25692. case 'w':
  25693. case 'W':
  25694. return number + '周';
  25695. default:
  25696. return number;
  25697. }
  25698. },
  25699. relativeTime: {
  25700. future: '%s后',
  25701. past: '%s前',
  25702. s: '几秒',
  25703. ss: '%d 秒',
  25704. m: '1 分钟',
  25705. mm: '%d 分钟',
  25706. h: '1 小时',
  25707. hh: '%d 小时',
  25708. d: '1 天',
  25709. dd: '%d 天',
  25710. w: '1 周',
  25711. ww: '%d 周',
  25712. M: '1 个月',
  25713. MM: '%d 个月',
  25714. y: '1 年',
  25715. yy: '%d 年',
  25716. },
  25717. week: {
  25718. // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
  25719. dow: 1, // Monday is the first day of the week.
  25720. doy: 4, // The week that contains Jan 4th is the first week of the year.
  25721. },
  25722. });
  25723. //! moment.js locale configuration
  25724. hooks.defineLocale('zh-hk', {
  25725. months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split(
  25726. '_'
  25727. ),
  25728. monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split(
  25729. '_'
  25730. ),
  25731. weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
  25732. weekdaysShort: '週日_週一_週二_週三_週四_週五_週六'.split('_'),
  25733. weekdaysMin: '日_一_二_三_四_五_六'.split('_'),
  25734. longDateFormat: {
  25735. LT: 'HH:mm',
  25736. LTS: 'HH:mm:ss',
  25737. L: 'YYYY/MM/DD',
  25738. LL: 'YYYY年M月D日',
  25739. LLL: 'YYYY年M月D日 HH:mm',
  25740. LLLL: 'YYYY年M月D日dddd HH:mm',
  25741. l: 'YYYY/M/D',
  25742. ll: 'YYYY年M月D日',
  25743. lll: 'YYYY年M月D日 HH:mm',
  25744. llll: 'YYYY年M月D日dddd HH:mm',
  25745. },
  25746. meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
  25747. meridiemHour: function (hour, meridiem) {
  25748. if (hour === 12) {
  25749. hour = 0;
  25750. }
  25751. if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') {
  25752. return hour;
  25753. } else if (meridiem === '中午') {
  25754. return hour >= 11 ? hour : hour + 12;
  25755. } else if (meridiem === '下午' || meridiem === '晚上') {
  25756. return hour + 12;
  25757. }
  25758. },
  25759. meridiem: function (hour, minute, isLower) {
  25760. var hm = hour * 100 + minute;
  25761. if (hm < 600) {
  25762. return '凌晨';
  25763. } else if (hm < 900) {
  25764. return '早上';
  25765. } else if (hm < 1200) {
  25766. return '上午';
  25767. } else if (hm === 1200) {
  25768. return '中午';
  25769. } else if (hm < 1800) {
  25770. return '下午';
  25771. } else {
  25772. return '晚上';
  25773. }
  25774. },
  25775. calendar: {
  25776. sameDay: '[今天]LT',
  25777. nextDay: '[明天]LT',
  25778. nextWeek: '[下]ddddLT',
  25779. lastDay: '[昨天]LT',
  25780. lastWeek: '[上]ddddLT',
  25781. sameElse: 'L',
  25782. },
  25783. dayOfMonthOrdinalParse: /\d{1,2}(日|月|週)/,
  25784. ordinal: function (number, period) {
  25785. switch (period) {
  25786. case 'd':
  25787. case 'D':
  25788. case 'DDD':
  25789. return number + '日';
  25790. case 'M':
  25791. return number + '月';
  25792. case 'w':
  25793. case 'W':
  25794. return number + '週';
  25795. default:
  25796. return number;
  25797. }
  25798. },
  25799. relativeTime: {
  25800. future: '%s後',
  25801. past: '%s前',
  25802. s: '幾秒',
  25803. ss: '%d 秒',
  25804. m: '1 分鐘',
  25805. mm: '%d 分鐘',
  25806. h: '1 小時',
  25807. hh: '%d 小時',
  25808. d: '1 天',
  25809. dd: '%d 天',
  25810. M: '1 個月',
  25811. MM: '%d 個月',
  25812. y: '1 年',
  25813. yy: '%d 年',
  25814. },
  25815. });
  25816. //! moment.js locale configuration
  25817. hooks.defineLocale('zh-mo', {
  25818. months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split(
  25819. '_'
  25820. ),
  25821. monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split(
  25822. '_'
  25823. ),
  25824. weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
  25825. weekdaysShort: '週日_週一_週二_週三_週四_週五_週六'.split('_'),
  25826. weekdaysMin: '日_一_二_三_四_五_六'.split('_'),
  25827. longDateFormat: {
  25828. LT: 'HH:mm',
  25829. LTS: 'HH:mm:ss',
  25830. L: 'DD/MM/YYYY',
  25831. LL: 'YYYY年M月D日',
  25832. LLL: 'YYYY年M月D日 HH:mm',
  25833. LLLL: 'YYYY年M月D日dddd HH:mm',
  25834. l: 'D/M/YYYY',
  25835. ll: 'YYYY年M月D日',
  25836. lll: 'YYYY年M月D日 HH:mm',
  25837. llll: 'YYYY年M月D日dddd HH:mm',
  25838. },
  25839. meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
  25840. meridiemHour: function (hour, meridiem) {
  25841. if (hour === 12) {
  25842. hour = 0;
  25843. }
  25844. if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') {
  25845. return hour;
  25846. } else if (meridiem === '中午') {
  25847. return hour >= 11 ? hour : hour + 12;
  25848. } else if (meridiem === '下午' || meridiem === '晚上') {
  25849. return hour + 12;
  25850. }
  25851. },
  25852. meridiem: function (hour, minute, isLower) {
  25853. var hm = hour * 100 + minute;
  25854. if (hm < 600) {
  25855. return '凌晨';
  25856. } else if (hm < 900) {
  25857. return '早上';
  25858. } else if (hm < 1130) {
  25859. return '上午';
  25860. } else if (hm < 1230) {
  25861. return '中午';
  25862. } else if (hm < 1800) {
  25863. return '下午';
  25864. } else {
  25865. return '晚上';
  25866. }
  25867. },
  25868. calendar: {
  25869. sameDay: '[今天] LT',
  25870. nextDay: '[明天] LT',
  25871. nextWeek: '[下]dddd LT',
  25872. lastDay: '[昨天] LT',
  25873. lastWeek: '[上]dddd LT',
  25874. sameElse: 'L',
  25875. },
  25876. dayOfMonthOrdinalParse: /\d{1,2}(日|月|週)/,
  25877. ordinal: function (number, period) {
  25878. switch (period) {
  25879. case 'd':
  25880. case 'D':
  25881. case 'DDD':
  25882. return number + '日';
  25883. case 'M':
  25884. return number + '月';
  25885. case 'w':
  25886. case 'W':
  25887. return number + '週';
  25888. default:
  25889. return number;
  25890. }
  25891. },
  25892. relativeTime: {
  25893. future: '%s內',
  25894. past: '%s前',
  25895. s: '幾秒',
  25896. ss: '%d 秒',
  25897. m: '1 分鐘',
  25898. mm: '%d 分鐘',
  25899. h: '1 小時',
  25900. hh: '%d 小時',
  25901. d: '1 天',
  25902. dd: '%d 天',
  25903. M: '1 個月',
  25904. MM: '%d 個月',
  25905. y: '1 年',
  25906. yy: '%d 年',
  25907. },
  25908. });
  25909. //! moment.js locale configuration
  25910. hooks.defineLocale('zh-tw', {
  25911. months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split(
  25912. '_'
  25913. ),
  25914. monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split(
  25915. '_'
  25916. ),
  25917. weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
  25918. weekdaysShort: '週日_週一_週二_週三_週四_週五_週六'.split('_'),
  25919. weekdaysMin: '日_一_二_三_四_五_六'.split('_'),
  25920. longDateFormat: {
  25921. LT: 'HH:mm',
  25922. LTS: 'HH:mm:ss',
  25923. L: 'YYYY/MM/DD',
  25924. LL: 'YYYY年M月D日',
  25925. LLL: 'YYYY年M月D日 HH:mm',
  25926. LLLL: 'YYYY年M月D日dddd HH:mm',
  25927. l: 'YYYY/M/D',
  25928. ll: 'YYYY年M月D日',
  25929. lll: 'YYYY年M月D日 HH:mm',
  25930. llll: 'YYYY年M月D日dddd HH:mm',
  25931. },
  25932. meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
  25933. meridiemHour: function (hour, meridiem) {
  25934. if (hour === 12) {
  25935. hour = 0;
  25936. }
  25937. if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') {
  25938. return hour;
  25939. } else if (meridiem === '中午') {
  25940. return hour >= 11 ? hour : hour + 12;
  25941. } else if (meridiem === '下午' || meridiem === '晚上') {
  25942. return hour + 12;
  25943. }
  25944. },
  25945. meridiem: function (hour, minute, isLower) {
  25946. var hm = hour * 100 + minute;
  25947. if (hm < 600) {
  25948. return '凌晨';
  25949. } else if (hm < 900) {
  25950. return '早上';
  25951. } else if (hm < 1130) {
  25952. return '上午';
  25953. } else if (hm < 1230) {
  25954. return '中午';
  25955. } else if (hm < 1800) {
  25956. return '下午';
  25957. } else {
  25958. return '晚上';
  25959. }
  25960. },
  25961. calendar: {
  25962. sameDay: '[今天] LT',
  25963. nextDay: '[明天] LT',
  25964. nextWeek: '[下]dddd LT',
  25965. lastDay: '[昨天] LT',
  25966. lastWeek: '[上]dddd LT',
  25967. sameElse: 'L',
  25968. },
  25969. dayOfMonthOrdinalParse: /\d{1,2}(日|月|週)/,
  25970. ordinal: function (number, period) {
  25971. switch (period) {
  25972. case 'd':
  25973. case 'D':
  25974. case 'DDD':
  25975. return number + '日';
  25976. case 'M':
  25977. return number + '月';
  25978. case 'w':
  25979. case 'W':
  25980. return number + '週';
  25981. default:
  25982. return number;
  25983. }
  25984. },
  25985. relativeTime: {
  25986. future: '%s後',
  25987. past: '%s前',
  25988. s: '幾秒',
  25989. ss: '%d 秒',
  25990. m: '1 分鐘',
  25991. mm: '%d 分鐘',
  25992. h: '1 小時',
  25993. hh: '%d 小時',
  25994. d: '1 天',
  25995. dd: '%d 天',
  25996. M: '1 個月',
  25997. MM: '%d 個月',
  25998. y: '1 年',
  25999. yy: '%d 年',
  26000. },
  26001. });
  26002. hooks.locale('en');
  26003. return hooks;
  26004. })));
  26005. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  26006. // Distributed under an MIT license: https://codemirror.net/LICENSE
  26007. (function(mod) {
  26008. if (typeof exports == "object" && typeof module == "object") // CommonJS
  26009. mod(require("../lib/codemirror"));
  26010. else if (typeof define == "function" && define.amd) // AMD
  26011. define('codemirror/mode/meta',["../lib/codemirror"], mod);
  26012. else // Plain browser env
  26013. mod(CodeMirror);
  26014. })(function(CodeMirror) {
  26015. "use strict";
  26016. CodeMirror.modeInfo = [
  26017. {name: "APL", mime: "text/apl", mode: "apl", ext: ["dyalog", "apl"]},
  26018. {name: "PGP", mimes: ["application/pgp", "application/pgp-encrypted", "application/pgp-keys", "application/pgp-signature"], mode: "asciiarmor", ext: ["asc", "pgp", "sig"]},
  26019. {name: "ASN.1", mime: "text/x-ttcn-asn", mode: "asn.1", ext: ["asn", "asn1"]},
  26020. {name: "Asterisk", mime: "text/x-asterisk", mode: "asterisk", file: /^extensions\.conf$/i},
  26021. {name: "Brainfuck", mime: "text/x-brainfuck", mode: "brainfuck", ext: ["b", "bf"]},
  26022. {name: "C", mime: "text/x-csrc", mode: "clike", ext: ["c", "h", "ino"]},
  26023. {name: "C++", mime: "text/x-c++src", mode: "clike", ext: ["cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx"], alias: ["cpp"]},
  26024. {name: "Cobol", mime: "text/x-cobol", mode: "cobol", ext: ["cob", "cpy"]},
  26025. {name: "C#", mime: "text/x-csharp", mode: "clike", ext: ["cs"], alias: ["csharp", "cs"]},
  26026. {name: "Clojure", mime: "text/x-clojure", mode: "clojure", ext: ["clj", "cljc", "cljx"]},
  26027. {name: "ClojureScript", mime: "text/x-clojurescript", mode: "clojure", ext: ["cljs"]},
  26028. {name: "Closure Stylesheets (GSS)", mime: "text/x-gss", mode: "css", ext: ["gss"]},
  26029. {name: "CMake", mime: "text/x-cmake", mode: "cmake", ext: ["cmake", "cmake.in"], file: /^CMakeLists\.txt$/},
  26030. {name: "CoffeeScript", mimes: ["application/vnd.coffeescript", "text/coffeescript", "text/x-coffeescript"], mode: "coffeescript", ext: ["coffee"], alias: ["coffee", "coffee-script"]},
  26031. {name: "Common Lisp", mime: "text/x-common-lisp", mode: "commonlisp", ext: ["cl", "lisp", "el"], alias: ["lisp"]},
  26032. {name: "Cypher", mime: "application/x-cypher-query", mode: "cypher", ext: ["cyp", "cypher"]},
  26033. {name: "Cython", mime: "text/x-cython", mode: "python", ext: ["pyx", "pxd", "pxi"]},
  26034. {name: "Crystal", mime: "text/x-crystal", mode: "crystal", ext: ["cr"]},
  26035. {name: "CSS", mime: "text/css", mode: "css", ext: ["css"]},
  26036. {name: "CQL", mime: "text/x-cassandra", mode: "sql", ext: ["cql"]},
  26037. {name: "D", mime: "text/x-d", mode: "d", ext: ["d"]},
  26038. {name: "Dart", mimes: ["application/dart", "text/x-dart"], mode: "dart", ext: ["dart"]},
  26039. {name: "diff", mime: "text/x-diff", mode: "diff", ext: ["diff", "patch"]},
  26040. {name: "Django", mime: "text/x-django", mode: "django"},
  26041. {name: "Dockerfile", mime: "text/x-dockerfile", mode: "dockerfile", file: /^Dockerfile$/},
  26042. {name: "DTD", mime: "application/xml-dtd", mode: "dtd", ext: ["dtd"]},
  26043. {name: "Dylan", mime: "text/x-dylan", mode: "dylan", ext: ["dylan", "dyl", "intr"]},
  26044. {name: "EBNF", mime: "text/x-ebnf", mode: "ebnf"},
  26045. {name: "ECL", mime: "text/x-ecl", mode: "ecl", ext: ["ecl"]},
  26046. {name: "edn", mime: "application/edn", mode: "clojure", ext: ["edn"]},
  26047. {name: "Eiffel", mime: "text/x-eiffel", mode: "eiffel", ext: ["e"]},
  26048. {name: "Elm", mime: "text/x-elm", mode: "elm", ext: ["elm"]},
  26049. {name: "Embedded Javascript", mime: "application/x-ejs", mode: "htmlembedded", ext: ["ejs"]},
  26050. {name: "Embedded Ruby", mime: "application/x-erb", mode: "htmlembedded", ext: ["erb"]},
  26051. {name: "Erlang", mime: "text/x-erlang", mode: "erlang", ext: ["erl"]},
  26052. {name: "Esper", mime: "text/x-esper", mode: "sql"},
  26053. {name: "Factor", mime: "text/x-factor", mode: "factor", ext: ["factor"]},
  26054. {name: "FCL", mime: "text/x-fcl", mode: "fcl"},
  26055. {name: "Forth", mime: "text/x-forth", mode: "forth", ext: ["forth", "fth", "4th"]},
  26056. {name: "Fortran", mime: "text/x-fortran", mode: "fortran", ext: ["f", "for", "f77", "f90", "f95"]},
  26057. {name: "F#", mime: "text/x-fsharp", mode: "mllike", ext: ["fs"], alias: ["fsharp"]},
  26058. {name: "Gas", mime: "text/x-gas", mode: "gas", ext: ["s"]},
  26059. {name: "Gherkin", mime: "text/x-feature", mode: "gherkin", ext: ["feature"]},
  26060. {name: "GitHub Flavored Markdown", mime: "text/x-gfm", mode: "gfm", file: /^(readme|contributing|history)\.md$/i},
  26061. {name: "Go", mime: "text/x-go", mode: "go", ext: ["go"]},
  26062. {name: "Groovy", mime: "text/x-groovy", mode: "groovy", ext: ["groovy", "gradle"], file: /^Jenkinsfile$/},
  26063. {name: "HAML", mime: "text/x-haml", mode: "haml", ext: ["haml"]},
  26064. {name: "Haskell", mime: "text/x-haskell", mode: "haskell", ext: ["hs"]},
  26065. {name: "Haskell (Literate)", mime: "text/x-literate-haskell", mode: "haskell-literate", ext: ["lhs"]},
  26066. {name: "Haxe", mime: "text/x-haxe", mode: "haxe", ext: ["hx"]},
  26067. {name: "HXML", mime: "text/x-hxml", mode: "haxe", ext: ["hxml"]},
  26068. {name: "ASP.NET", mime: "application/x-aspx", mode: "htmlembedded", ext: ["aspx"], alias: ["asp", "aspx"]},
  26069. {name: "HTML", mime: "text/html", mode: "htmlmixed", ext: ["html", "htm", "handlebars", "hbs"], alias: ["xhtml"]},
  26070. {name: "HTTP", mime: "message/http", mode: "http"},
  26071. {name: "IDL", mime: "text/x-idl", mode: "idl", ext: ["pro"]},
  26072. {name: "Pug", mime: "text/x-pug", mode: "pug", ext: ["jade", "pug"], alias: ["jade"]},
  26073. {name: "Java", mime: "text/x-java", mode: "clike", ext: ["java"]},
  26074. {name: "Java Server Pages", mime: "application/x-jsp", mode: "htmlembedded", ext: ["jsp"], alias: ["jsp"]},
  26075. {name: "JavaScript", mimes: ["text/javascript", "text/ecmascript", "application/javascript", "application/x-javascript", "application/ecmascript"],
  26076. mode: "javascript", ext: ["js"], alias: ["ecmascript", "js", "node"]},
  26077. {name: "JSON", mimes: ["application/json", "application/x-json"], mode: "javascript", ext: ["json", "map"], alias: ["json5"]},
  26078. {name: "JSON-LD", mime: "application/ld+json", mode: "javascript", ext: ["jsonld"], alias: ["jsonld"]},
  26079. {name: "JSX", mime: "text/jsx", mode: "jsx", ext: ["jsx"]},
  26080. {name: "Jinja2", mime: "text/jinja2", mode: "jinja2", ext: ["j2", "jinja", "jinja2"]},
  26081. {name: "Julia", mime: "text/x-julia", mode: "julia", ext: ["jl"]},
  26082. {name: "Kotlin", mime: "text/x-kotlin", mode: "clike", ext: ["kt"]},
  26083. {name: "LESS", mime: "text/x-less", mode: "css", ext: ["less"]},
  26084. {name: "LiveScript", mime: "text/x-livescript", mode: "livescript", ext: ["ls"], alias: ["ls"]},
  26085. {name: "Lua", mime: "text/x-lua", mode: "lua", ext: ["lua"]},
  26086. {name: "Markdown", mime: "text/x-markdown", mode: "markdown", ext: ["markdown", "md", "mkd"]},
  26087. {name: "mIRC", mime: "text/mirc", mode: "mirc"},
  26088. {name: "MariaDB SQL", mime: "text/x-mariadb", mode: "sql"},
  26089. {name: "Mathematica", mime: "text/x-mathematica", mode: "mathematica", ext: ["m", "nb", "wl", "wls"]},
  26090. {name: "Modelica", mime: "text/x-modelica", mode: "modelica", ext: ["mo"]},
  26091. {name: "MUMPS", mime: "text/x-mumps", mode: "mumps", ext: ["mps"]},
  26092. {name: "MS SQL", mime: "text/x-mssql", mode: "sql"},
  26093. {name: "mbox", mime: "application/mbox", mode: "mbox", ext: ["mbox"]},
  26094. {name: "MySQL", mime: "text/x-mysql", mode: "sql"},
  26095. {name: "Nginx", mime: "text/x-nginx-conf", mode: "nginx", file: /nginx.*\.conf$/i},
  26096. {name: "NSIS", mime: "text/x-nsis", mode: "nsis", ext: ["nsh", "nsi"]},
  26097. {name: "NTriples", mimes: ["application/n-triples", "application/n-quads", "text/n-triples"],
  26098. mode: "ntriples", ext: ["nt", "nq"]},
  26099. {name: "Objective-C", mime: "text/x-objectivec", mode: "clike", ext: ["m"], alias: ["objective-c", "objc"]},
  26100. {name: "Objective-C++", mime: "text/x-objectivec++", mode: "clike", ext: ["mm"], alias: ["objective-c++", "objc++"]},
  26101. {name: "OCaml", mime: "text/x-ocaml", mode: "mllike", ext: ["ml", "mli", "mll", "mly"]},
  26102. {name: "Octave", mime: "text/x-octave", mode: "octave", ext: ["m"]},
  26103. {name: "Oz", mime: "text/x-oz", mode: "oz", ext: ["oz"]},
  26104. {name: "Pascal", mime: "text/x-pascal", mode: "pascal", ext: ["p", "pas"]},
  26105. {name: "PEG.js", mime: "null", mode: "pegjs", ext: ["jsonld"]},
  26106. {name: "Perl", mime: "text/x-perl", mode: "perl", ext: ["pl", "pm"]},
  26107. {name: "PHP", mimes: ["text/x-php", "application/x-httpd-php", "application/x-httpd-php-open"], mode: "php", ext: ["php", "php3", "php4", "php5", "php7", "phtml"]},
  26108. {name: "Pig", mime: "text/x-pig", mode: "pig", ext: ["pig"]},
  26109. {name: "Plain Text", mime: "text/plain", mode: "null", ext: ["txt", "text", "conf", "def", "list", "log"]},
  26110. {name: "PLSQL", mime: "text/x-plsql", mode: "sql", ext: ["pls"]},
  26111. {name: "PostgreSQL", mime: "text/x-pgsql", mode: "sql"},
  26112. {name: "PowerShell", mime: "application/x-powershell", mode: "powershell", ext: ["ps1", "psd1", "psm1"]},
  26113. {name: "Properties files", mime: "text/x-properties", mode: "properties", ext: ["properties", "ini", "in"], alias: ["ini", "properties"]},
  26114. {name: "ProtoBuf", mime: "text/x-protobuf", mode: "protobuf", ext: ["proto"]},
  26115. {name: "Python", mime: "text/x-python", mode: "python", ext: ["BUILD", "bzl", "py", "pyw"], file: /^(BUCK|BUILD)$/},
  26116. {name: "Puppet", mime: "text/x-puppet", mode: "puppet", ext: ["pp"]},
  26117. {name: "Q", mime: "text/x-q", mode: "q", ext: ["q"]},
  26118. {name: "R", mime: "text/x-rsrc", mode: "r", ext: ["r", "R"], alias: ["rscript"]},
  26119. {name: "reStructuredText", mime: "text/x-rst", mode: "rst", ext: ["rst"], alias: ["rst"]},
  26120. {name: "RPM Changes", mime: "text/x-rpm-changes", mode: "rpm"},
  26121. {name: "RPM Spec", mime: "text/x-rpm-spec", mode: "rpm", ext: ["spec"]},
  26122. {name: "Ruby", mime: "text/x-ruby", mode: "ruby", ext: ["rb"], alias: ["jruby", "macruby", "rake", "rb", "rbx"]},
  26123. {name: "Rust", mime: "text/x-rustsrc", mode: "rust", ext: ["rs"]},
  26124. {name: "SAS", mime: "text/x-sas", mode: "sas", ext: ["sas"]},
  26125. {name: "Sass", mime: "text/x-sass", mode: "sass", ext: ["sass"]},
  26126. {name: "Scala", mime: "text/x-scala", mode: "clike", ext: ["scala"]},
  26127. {name: "Scheme", mime: "text/x-scheme", mode: "scheme", ext: ["scm", "ss"]},
  26128. {name: "SCSS", mime: "text/x-scss", mode: "css", ext: ["scss"]},
  26129. {name: "Shell", mimes: ["text/x-sh", "application/x-sh"], mode: "shell", ext: ["sh", "ksh", "bash"], alias: ["bash", "sh", "zsh"], file: /^PKGBUILD$/},
  26130. {name: "Sieve", mime: "application/sieve", mode: "sieve", ext: ["siv", "sieve"]},
  26131. {name: "Slim", mimes: ["text/x-slim", "application/x-slim"], mode: "slim", ext: ["slim"]},
  26132. {name: "Smalltalk", mime: "text/x-stsrc", mode: "smalltalk", ext: ["st"]},
  26133. {name: "Smarty", mime: "text/x-smarty", mode: "smarty", ext: ["tpl"]},
  26134. {name: "Solr", mime: "text/x-solr", mode: "solr"},
  26135. {name: "SML", mime: "text/x-sml", mode: "mllike", ext: ["sml", "sig", "fun", "smackspec"]},
  26136. {name: "Soy", mime: "text/x-soy", mode: "soy", ext: ["soy"], alias: ["closure template"]},
  26137. {name: "SPARQL", mime: "application/sparql-query", mode: "sparql", ext: ["rq", "sparql"], alias: ["sparul"]},
  26138. {name: "Spreadsheet", mime: "text/x-spreadsheet", mode: "spreadsheet", alias: ["excel", "formula"]},
  26139. {name: "SQL", mime: "text/x-sql", mode: "sql", ext: ["sql"]},
  26140. {name: "SQLite", mime: "text/x-sqlite", mode: "sql"},
  26141. {name: "Squirrel", mime: "text/x-squirrel", mode: "clike", ext: ["nut"]},
  26142. {name: "Stylus", mime: "text/x-styl", mode: "stylus", ext: ["styl"]},
  26143. {name: "Swift", mime: "text/x-swift", mode: "swift", ext: ["swift"]},
  26144. {name: "sTeX", mime: "text/x-stex", mode: "stex"},
  26145. {name: "LaTeX", mime: "text/x-latex", mode: "stex", ext: ["text", "ltx", "tex"], alias: ["tex"]},
  26146. {name: "SystemVerilog", mime: "text/x-systemverilog", mode: "verilog", ext: ["v", "sv", "svh"]},
  26147. {name: "Tcl", mime: "text/x-tcl", mode: "tcl", ext: ["tcl"]},
  26148. {name: "Textile", mime: "text/x-textile", mode: "textile", ext: ["textile"]},
  26149. {name: "TiddlyWiki", mime: "text/x-tiddlywiki", mode: "tiddlywiki"},
  26150. {name: "Tiki wiki", mime: "text/tiki", mode: "tiki"},
  26151. {name: "TOML", mime: "text/x-toml", mode: "toml", ext: ["toml"]},
  26152. {name: "Tornado", mime: "text/x-tornado", mode: "tornado"},
  26153. {name: "troff", mime: "text/troff", mode: "troff", ext: ["1", "2", "3", "4", "5", "6", "7", "8", "9"]},
  26154. {name: "TTCN", mime: "text/x-ttcn", mode: "ttcn", ext: ["ttcn", "ttcn3", "ttcnpp"]},
  26155. {name: "TTCN_CFG", mime: "text/x-ttcn-cfg", mode: "ttcn-cfg", ext: ["cfg"]},
  26156. {name: "Turtle", mime: "text/turtle", mode: "turtle", ext: ["ttl"]},
  26157. {name: "TypeScript", mime: "application/typescript", mode: "javascript", ext: ["ts"], alias: ["ts"]},
  26158. {name: "TypeScript-JSX", mime: "text/typescript-jsx", mode: "jsx", ext: ["tsx"], alias: ["tsx"]},
  26159. {name: "Twig", mime: "text/x-twig", mode: "twig"},
  26160. {name: "Web IDL", mime: "text/x-webidl", mode: "webidl", ext: ["webidl"]},
  26161. {name: "VB.NET", mime: "text/x-vb", mode: "vb", ext: ["vb"]},
  26162. {name: "VBScript", mime: "text/vbscript", mode: "vbscript", ext: ["vbs"]},
  26163. {name: "Velocity", mime: "text/velocity", mode: "velocity", ext: ["vtl"]},
  26164. {name: "Verilog", mime: "text/x-verilog", mode: "verilog", ext: ["v"]},
  26165. {name: "VHDL", mime: "text/x-vhdl", mode: "vhdl", ext: ["vhd", "vhdl"]},
  26166. {name: "Vue.js Component", mimes: ["script/x-vue", "text/x-vue"], mode: "vue", ext: ["vue"]},
  26167. {name: "XML", mimes: ["application/xml", "text/xml"], mode: "xml", ext: ["xml", "xsl", "xsd", "svg"], alias: ["rss", "wsdl", "xsd"]},
  26168. {name: "XQuery", mime: "application/xquery", mode: "xquery", ext: ["xy", "xquery"]},
  26169. {name: "Yacas", mime: "text/x-yacas", mode: "yacas", ext: ["ys"]},
  26170. {name: "YAML", mimes: ["text/x-yaml", "text/yaml"], mode: "yaml", ext: ["yaml", "yml"], alias: ["yml"]},
  26171. {name: "Z80", mime: "text/x-z80", mode: "z80", ext: ["z80"]},
  26172. {name: "mscgen", mime: "text/x-mscgen", mode: "mscgen", ext: ["mscgen", "mscin", "msc"]},
  26173. {name: "xu", mime: "text/x-xu", mode: "mscgen", ext: ["xu"]},
  26174. {name: "msgenny", mime: "text/x-msgenny", mode: "mscgen", ext: ["msgenny"]},
  26175. {name: "WebAssembly", mime: "text/webassembly", mode: "wast", ext: ["wat", "wast"]},
  26176. ];
  26177. // Ensure all modes have a mime property for backwards compatibility
  26178. for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
  26179. var info = CodeMirror.modeInfo[i];
  26180. if (info.mimes) info.mime = info.mimes[0];
  26181. }
  26182. CodeMirror.findModeByMIME = function(mime) {
  26183. mime = mime.toLowerCase();
  26184. for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
  26185. var info = CodeMirror.modeInfo[i];
  26186. if (info.mime == mime) return info;
  26187. if (info.mimes) for (var j = 0; j < info.mimes.length; j++)
  26188. if (info.mimes[j] == mime) return info;
  26189. }
  26190. if (/\+xml$/.test(mime)) return CodeMirror.findModeByMIME("application/xml")
  26191. if (/\+json$/.test(mime)) return CodeMirror.findModeByMIME("application/json")
  26192. };
  26193. CodeMirror.findModeByExtension = function(ext) {
  26194. ext = ext.toLowerCase();
  26195. for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
  26196. var info = CodeMirror.modeInfo[i];
  26197. if (info.ext) for (var j = 0; j < info.ext.length; j++)
  26198. if (info.ext[j] == ext) return info;
  26199. }
  26200. };
  26201. CodeMirror.findModeByFileName = function(filename) {
  26202. for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
  26203. var info = CodeMirror.modeInfo[i];
  26204. if (info.file && info.file.test(filename)) return info;
  26205. }
  26206. var dot = filename.lastIndexOf(".");
  26207. var ext = dot > -1 && filename.substring(dot + 1, filename.length);
  26208. if (ext) return CodeMirror.findModeByExtension(ext);
  26209. };
  26210. CodeMirror.findModeByName = function(name) {
  26211. name = name.toLowerCase();
  26212. for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
  26213. var info = CodeMirror.modeInfo[i];
  26214. if (info.name.toLowerCase() == name) return info;
  26215. if (info.alias) for (var j = 0; j < info.alias.length; j++)
  26216. if (info.alias[j].toLowerCase() == name) return info;
  26217. }
  26218. };
  26219. });
  26220. // Copyright (c) Jupyter Development Team.
  26221. // Distributed under the terms of the Modified BSD License.
  26222. define('base/js/utils',[
  26223. 'jquery',
  26224. 'codemirror/lib/codemirror',
  26225. 'moment',
  26226. 'underscore',
  26227. // silently upgrades CodeMirror
  26228. 'codemirror/mode/meta',
  26229. ], function($, CodeMirror, moment, _){
  26230. "use strict";
  26231. // keep track of which extensions have been loaded already
  26232. var extensions_loaded = [];
  26233. /**
  26234. * Whether or not an extension has been loaded
  26235. * @param {string} extension - name of the extension
  26236. * @return {boolean} true if loaded already
  26237. */
  26238. var is_loaded = function(extension) {
  26239. var ext_path = "nbextensions/" + extension;
  26240. return extensions_loaded.indexOf(ext_path) >= 0;
  26241. };
  26242. /**
  26243. * Load a single extension.
  26244. * @param {string} extension - extension path.
  26245. * @return {Promise} that resolves to an extension module handle
  26246. */
  26247. var load_extension = function (extension) {
  26248. return new Promise(function(resolve, reject) {
  26249. var ext_path = "nbextensions/" + extension;
  26250. requirejs([ext_path], function(module) {
  26251. if (!is_loaded(extension)) {
  26252. console.log("Loading extension: " + extension);
  26253. if (module && module.load_ipython_extension) {
  26254. Promise.resolve(module.load_ipython_extension()).then(function() {
  26255. resolve(module);
  26256. }).catch(reject);
  26257. }
  26258. extensions_loaded.push(ext_path);
  26259. } else {
  26260. console.log("Loaded extension already: " + extension);
  26261. resolve(module);
  26262. }
  26263. }, function(err) {
  26264. reject(err);
  26265. });
  26266. });
  26267. };
  26268. /**
  26269. * Load multiple extensions.
  26270. * Takes n-args, where each arg is a string path to the extension.
  26271. * @return {Promise} that resolves to a list of loaded module handles.
  26272. */
  26273. var load_extensions = function () {
  26274. console.log('load_extensions', arguments);
  26275. return Promise.all(Array.prototype.map.call(arguments, load_extension)).catch(function(err) {
  26276. console.error("Failed to load extension" + (err.requireModules.length>1?'s':'') + ":", err.requireModules, err);
  26277. });
  26278. };
  26279. /**
  26280. * Return a list of extensions that should be active
  26281. * The config for nbextensions comes in as a dict where keys are
  26282. * nbextensions paths and the values are a bool indicating if it
  26283. * should be active. This returns a list of nbextension paths
  26284. * where the value is true
  26285. */
  26286. function filter_extensions(nbext_config) {
  26287. var active = [];
  26288. Object.keys(nbext_config).forEach(function (nbext) {
  26289. if (nbext_config[nbext]) {active.push(nbext);}
  26290. });
  26291. return active;
  26292. }
  26293. /**
  26294. * Wait for a config section to load, and then load the extensions specified
  26295. * in a 'load_extensions' key inside it.
  26296. */
  26297. function load_extensions_from_config(section) {
  26298. return section.loaded.then(function() {
  26299. if (section.data.load_extensions) {
  26300. var active = filter_extensions(section.data.load_extensions);
  26301. return load_extensions.apply(this, active);
  26302. }
  26303. }).catch(utils.reject('Could not load nbextensions from ' + section.section_name + ' config file'));
  26304. }
  26305. //============================================================================
  26306. // Cross-browser RegEx Split
  26307. //============================================================================
  26308. // This code has been MODIFIED from the code licensed below to not replace the
  26309. // default browser split. The license is reproduced here.
  26310. // see http://blog.stevenlevithan.com/archives/cross-browser-split for more info:
  26311. /*!
  26312. * Cross-Browser Split 1.1.1
  26313. * Copyright 2007-2012 Steven Levithan <stevenlevithan.com>
  26314. * Available under the MIT License
  26315. * ECMAScript compliant, uniform cross-browser split method
  26316. */
  26317. /**
  26318. * Splits a string into an array of strings using a regex or string
  26319. * separator. Matches of the separator are not included in the result array.
  26320. * However, if `separator` is a regex that contains capturing groups,
  26321. * backreferences are spliced into the result each time `separator` is
  26322. * matched. Fixes browser bugs compared to the native
  26323. * `String.prototype.split` and can be used reliably cross-browser.
  26324. * @param {String} str String to split.
  26325. * @param {RegExp} separator Regex to use for separating
  26326. * the string.
  26327. * @param {Number} [limit] Maximum number of items to include in the result
  26328. * array.
  26329. * @returns {Array} Array of substrings.
  26330. * @example
  26331. *
  26332. * // Basic use
  26333. * regex_split('a b c d', ' ');
  26334. * // -> ['a', 'b', 'c', 'd']
  26335. *
  26336. * // With limit
  26337. * regex_split('a b c d', ' ', 2);
  26338. * // -> ['a', 'b']
  26339. *
  26340. * // Backreferences in result array
  26341. * regex_split('..word1 word2..', /([a-z]+)(\d+)/i);
  26342. * // -> ['..', 'word', '1', ' ', 'word', '2', '..']
  26343. */
  26344. var regex_split = function (str, separator, limit) {
  26345. var output = [],
  26346. flags = (separator.ignoreCase ? "i" : "") +
  26347. (separator.multiline ? "m" : "") +
  26348. (separator.extended ? "x" : "") + // Proposed for ES6
  26349. (separator.sticky ? "y" : ""), // Firefox 3+
  26350. lastLastIndex = 0,
  26351. separator2, match, lastIndex, lastLength;
  26352. // Make `global` and avoid `lastIndex` issues by working with a copy
  26353. separator = new RegExp(separator.source, flags + "g");
  26354. var compliantExecNpcg = typeof(/()??/.exec("")[1]) === "undefined";
  26355. if (!compliantExecNpcg) {
  26356. // Doesn't need flags gy, but they don't hurt
  26357. separator2 = new RegExp("^" + separator.source + "$(?!\\s)", flags);
  26358. }
  26359. /* Values for `limit`, per the spec:
  26360. * If undefined: 4294967295 // Math.pow(2, 32) - 1
  26361. * If 0, Infinity, or NaN: 0
  26362. * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296;
  26363. * If negative number: 4294967296 - Math.floor(Math.abs(limit))
  26364. * If other: Type-convert, then use the above rules
  26365. */
  26366. limit = typeof(limit) === "undefined" ?
  26367. -1 >>> 0 : // Math.pow(2, 32) - 1
  26368. limit >>> 0; // ToUint32(limit)
  26369. for (match = separator.exec(str); match; match = separator.exec(str)) {
  26370. // `separator.lastIndex` is not reliable cross-browser
  26371. lastIndex = match.index + match[0].length;
  26372. if (lastIndex > lastLastIndex) {
  26373. output.push(str.slice(lastLastIndex, match.index));
  26374. // Fix browsers whose `exec` methods don't consistently return `undefined` for
  26375. // nonparticipating capturing groups
  26376. if (!compliantExecNpcg && match.length > 1) {
  26377. match[0].replace(separator2, function () {
  26378. for (var i = 1; i < arguments.length - 2; i++) {
  26379. if (typeof(arguments[i]) === "undefined") {
  26380. match[i] = undefined;
  26381. }
  26382. }
  26383. });
  26384. }
  26385. if (match.length > 1 && match.index < str.length) {
  26386. Array.prototype.push.apply(output, match.slice(1));
  26387. }
  26388. lastLength = match[0].length;
  26389. lastLastIndex = lastIndex;
  26390. if (output.length >= limit) {
  26391. break;
  26392. }
  26393. }
  26394. if (separator.lastIndex === match.index) {
  26395. separator.lastIndex++; // Avoid an infinite loop
  26396. }
  26397. }
  26398. if (lastLastIndex === str.length) {
  26399. if (lastLength || !separator.test("")) {
  26400. output.push("");
  26401. }
  26402. } else {
  26403. output.push(str.slice(lastLastIndex));
  26404. }
  26405. return output.length > limit ? output.slice(0, limit) : output;
  26406. };
  26407. //============================================================================
  26408. // End contributed Cross-browser RegEx Split
  26409. //============================================================================
  26410. var uuid = function () {
  26411. /**
  26412. * http://www.ietf.org/rfc/rfc4122.txt
  26413. */
  26414. var s = [];
  26415. var hexDigits = "0123456789abcdef";
  26416. for (var i = 0; i < 32; i++) {
  26417. s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
  26418. }
  26419. s[12] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
  26420. s[16] = hexDigits.substr((s[16] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
  26421. var uuid = s.join("");
  26422. return uuid;
  26423. };
  26424. var _ANSI_COLORS = [
  26425. "ansi-black",
  26426. "ansi-red",
  26427. "ansi-green",
  26428. "ansi-yellow",
  26429. "ansi-blue",
  26430. "ansi-magenta",
  26431. "ansi-cyan",
  26432. "ansi-white",
  26433. "ansi-black-intense",
  26434. "ansi-red-intense",
  26435. "ansi-green-intense",
  26436. "ansi-yellow-intense",
  26437. "ansi-blue-intense",
  26438. "ansi-magenta-intense",
  26439. "ansi-cyan-intense",
  26440. "ansi-white-intense",
  26441. ];
  26442. function _pushColoredChunk(chunk, fg, bg, bold, underline, inverse, out) {
  26443. if (chunk) {
  26444. var classes = [];
  26445. var styles = [];
  26446. if (bold && typeof fg === "number" && 0 <= fg && fg < 8) {
  26447. fg += 8; // Bold text uses "intense" colors
  26448. }
  26449. if (inverse) {
  26450. [fg, bg] = [bg, fg];
  26451. }
  26452. if (typeof fg === "number") {
  26453. classes.push(_ANSI_COLORS[fg] + "-fg");
  26454. } else if (fg.length) {
  26455. styles.push("color: rgb(" + fg + ")");
  26456. } else if (inverse) {
  26457. classes.push("ansi-default-inverse-fg");
  26458. }
  26459. if (typeof bg === "number") {
  26460. classes.push(_ANSI_COLORS[bg] + "-bg");
  26461. } else if (bg.length) {
  26462. styles.push("background-color: rgb(" + bg + ")");
  26463. } else if (inverse) {
  26464. classes.push("ansi-default-inverse-bg");
  26465. }
  26466. if (bold) {
  26467. classes.push("ansi-bold");
  26468. }
  26469. if (underline) {
  26470. classes.push("ansi-underline");
  26471. }
  26472. if (classes.length || styles.length) {
  26473. out.push("<span");
  26474. if (classes.length) {
  26475. out.push(' class="' + classes.join(" ") + '"');
  26476. }
  26477. if (styles.length) {
  26478. out.push(' style="' + styles.join("; ") + '"');
  26479. }
  26480. out.push(">");
  26481. out.push(chunk);
  26482. out.push("</span>");
  26483. } else {
  26484. out.push(chunk);
  26485. }
  26486. }
  26487. }
  26488. function _getExtendedColors(numbers) {
  26489. var r, g, b;
  26490. var n = numbers.shift();
  26491. if (n === 2 && numbers.length >= 3) {
  26492. // 24-bit RGB
  26493. r = numbers.shift();
  26494. g = numbers.shift();
  26495. b = numbers.shift();
  26496. if ([r, g, b].some(function (c) { return c < 0 || 255 < c; })) {
  26497. throw new RangeError("Invalid range for RGB colors");
  26498. }
  26499. } else if (n === 5 && numbers.length >= 1) {
  26500. // 256 colors
  26501. var idx = numbers.shift();
  26502. if (idx < 0) {
  26503. throw new RangeError("Color index must be >= 0");
  26504. } else if (idx < 16) {
  26505. // 16 default terminal colors
  26506. return idx;
  26507. } else if (idx < 232) {
  26508. // 6x6x6 color cube, see https://stackoverflow.com/a/27165165/500098
  26509. r = Math.floor((idx - 16) / 36);
  26510. r = r > 0 ? 55 + r * 40 : 0;
  26511. g = Math.floor(((idx - 16) % 36) / 6);
  26512. g = g > 0 ? 55 + g * 40 : 0;
  26513. b = (idx - 16) % 6;
  26514. b = b > 0 ? 55 + b * 40 : 0;
  26515. } else if (idx < 256) {
  26516. // grayscale, see https://stackoverflow.com/a/27165165/500098
  26517. r = g = b = (idx - 232) * 10 + 8;
  26518. } else {
  26519. throw new RangeError("Color index must be < 256");
  26520. }
  26521. } else {
  26522. throw new RangeError("Invalid extended color specification");
  26523. }
  26524. return [r, g, b];
  26525. }
  26526. function _ansispan(str) {
  26527. var ansi_re = /\x1b\[(.*?)([@-~])/g;
  26528. var fg = [];
  26529. var bg = [];
  26530. var bold = false;
  26531. var underline = false;
  26532. var inverse = false;
  26533. var match;
  26534. var out = [];
  26535. var numbers = [];
  26536. var start = 0;
  26537. str += "\x1b[m"; // Ensure markup for trailing text
  26538. while ((match = ansi_re.exec(str))) {
  26539. if (match[2] === "m") {
  26540. var items = match[1].split(";");
  26541. for (var i = 0; i < items.length; i++) {
  26542. var item = items[i];
  26543. if (item === "") {
  26544. numbers.push(0);
  26545. } else if (item.search(/^\d+$/) !== -1) {
  26546. numbers.push(parseInt(item));
  26547. } else {
  26548. // Ignored: Invalid color specification
  26549. numbers.length = 0;
  26550. break;
  26551. }
  26552. }
  26553. } else {
  26554. // Ignored: Not a color code
  26555. }
  26556. var chunk = str.substring(start, match.index);
  26557. _pushColoredChunk(chunk, fg, bg, bold, underline, inverse, out);
  26558. start = ansi_re.lastIndex;
  26559. while (numbers.length) {
  26560. var n = numbers.shift();
  26561. switch (n) {
  26562. case 0:
  26563. fg = bg = [];
  26564. bold = false;
  26565. underline = false;
  26566. inverse = false;
  26567. break;
  26568. case 1:
  26569. case 5:
  26570. bold = true;
  26571. break;
  26572. case 4:
  26573. underline = true;
  26574. break;
  26575. case 7:
  26576. inverse = true;
  26577. break;
  26578. case 21:
  26579. case 22:
  26580. bold = false;
  26581. break;
  26582. case 24:
  26583. underline = false;
  26584. break;
  26585. case 27:
  26586. inverse = false;
  26587. break;
  26588. case 30:
  26589. case 31:
  26590. case 32:
  26591. case 33:
  26592. case 34:
  26593. case 35:
  26594. case 36:
  26595. case 37:
  26596. fg = n - 30;
  26597. break;
  26598. case 38:
  26599. try {
  26600. fg = _getExtendedColors(numbers);
  26601. } catch(e) {
  26602. numbers.length = 0;
  26603. }
  26604. break;
  26605. case 39:
  26606. fg = [];
  26607. break;
  26608. case 40:
  26609. case 41:
  26610. case 42:
  26611. case 43:
  26612. case 44:
  26613. case 45:
  26614. case 46:
  26615. case 47:
  26616. bg = n - 40;
  26617. break;
  26618. case 48:
  26619. try {
  26620. bg = _getExtendedColors(numbers);
  26621. } catch(e) {
  26622. numbers.length = 0;
  26623. }
  26624. break;
  26625. case 49:
  26626. bg = [];
  26627. break;
  26628. case 90:
  26629. case 91:
  26630. case 92:
  26631. case 93:
  26632. case 94:
  26633. case 95:
  26634. case 96:
  26635. case 97:
  26636. fg = n - 90 + 8;
  26637. break;
  26638. case 100:
  26639. case 101:
  26640. case 102:
  26641. case 103:
  26642. case 104:
  26643. case 105:
  26644. case 106:
  26645. case 107:
  26646. bg = n - 100 + 8;
  26647. break;
  26648. default:
  26649. // Unknown codes are ignored
  26650. }
  26651. }
  26652. }
  26653. return out.join("");
  26654. }
  26655. // Transform ANSI color escape codes into HTML <span> tags with CSS
  26656. // classes such as "ansi-green-intense-fg".
  26657. // The actual colors used are set in the CSS file.
  26658. // This is supposed to have the same behavior as nbconvert.filters.ansi2html()
  26659. function fixConsole(txt) {
  26660. txt = _.escape(txt);
  26661. // color ansi codes (and remove non-color escape sequences)
  26662. txt = _ansispan(txt);
  26663. return txt;
  26664. }
  26665. // Remove chunks that should be overridden by the effect of
  26666. // carriage return characters
  26667. function fixCarriageReturn(txt) {
  26668. txt = txt.replace(/\r+\n/gm, '\n'); // \r followed by \n --> newline
  26669. while (txt.search(/\r[^$]/g) > -1) {
  26670. var base = txt.match(/^(.*)\r+/m)[1];
  26671. var insert = txt.match(/\r+(.*)$/m)[1];
  26672. insert = insert + base.slice(insert.length, base.length);
  26673. txt = txt.replace(/\r+.*$/m, '\r').replace(/^.*\r/m, insert);
  26674. }
  26675. return txt;
  26676. }
  26677. // Remove characters that are overridden by backspace characters
  26678. function fixBackspace(txt) {
  26679. var tmp = txt;
  26680. do {
  26681. txt = tmp;
  26682. // Cancel out anything-but-newline followed by backspace
  26683. tmp = txt.replace(/[^\n]\x08/gm, '');
  26684. } while (tmp.length < txt.length);
  26685. return txt;
  26686. }
  26687. // Remove characters overridden by backspace and carriage return
  26688. function fixOverwrittenChars(txt) {
  26689. return fixCarriageReturn(fixBackspace(txt));
  26690. }
  26691. // Locate any URLs and convert them to an anchor tag
  26692. function autoLinkUrls(txt) {
  26693. return txt.replace(/(^|\s)(https?|ftp)(:[^'"<>\s]+)/gi,
  26694. "$1<a target=\"_blank\" href=\"$2$3\">$2$3</a>");
  26695. }
  26696. var points_to_pixels = function (points) {
  26697. /**
  26698. * A reasonably good way of converting between points and pixels.
  26699. */
  26700. var test = $('<div style="display: none; width: 10000pt; padding:0; border:0;"></div>');
  26701. $('body').append(test);
  26702. var pixel_per_point = test.width()/10000;
  26703. test.remove();
  26704. return Math.floor(points*pixel_per_point);
  26705. };
  26706. var always_new = function (constructor) {
  26707. /**
  26708. * wrapper around contructor to avoid requiring `var a = new constructor()`
  26709. * useful for passing constructors as callbacks,
  26710. * not for programmer laziness.
  26711. * from https://programmers.stackexchange.com/questions/118798
  26712. */
  26713. return function () {
  26714. var obj = Object.create(constructor.prototype);
  26715. constructor.apply(obj, arguments);
  26716. return obj;
  26717. };
  26718. };
  26719. var url_path_join = function () {
  26720. /**
  26721. * join a sequence of url components with '/'
  26722. */
  26723. var url = '';
  26724. for (var i = 0; i < arguments.length; i++) {
  26725. if (arguments[i] === '') {
  26726. continue;
  26727. }
  26728. if (url.length > 0 && url[url.length-1] != '/') {
  26729. url = url + '/' + arguments[i];
  26730. } else {
  26731. url = url + arguments[i];
  26732. }
  26733. }
  26734. url = url.replace(/\/\/+/, '/');
  26735. return url;
  26736. };
  26737. var url_path_split = function (path) {
  26738. /**
  26739. * Like os.path.split for URLs.
  26740. * Always returns two strings, the directory path and the base filename
  26741. */
  26742. var idx = path.lastIndexOf('/');
  26743. if (idx === -1) {
  26744. return ['', path];
  26745. } else {
  26746. return [ path.slice(0, idx), path.slice(idx + 1) ];
  26747. }
  26748. };
  26749. var parse_url = function (url) {
  26750. /**
  26751. * an `a` element with an href allows attr-access to the parsed segments of a URL
  26752. * a = parse_url("http://localhost:8888/path/name#hash")
  26753. * a.protocol = "http:"
  26754. * a.host = "localhost:8888"
  26755. * a.hostname = "localhost"
  26756. * a.port = 8888
  26757. * a.pathname = "/path/name"
  26758. * a.hash = "#hash"
  26759. */
  26760. var a = document.createElement("a");
  26761. a.href = url;
  26762. return a;
  26763. };
  26764. var encode_uri_components = function (uri) {
  26765. /**
  26766. * encode just the components of a multi-segment uri,
  26767. * leaving '/' separators
  26768. */
  26769. return uri.split('/').map(encodeURIComponent).join('/');
  26770. };
  26771. var url_join_encode = function () {
  26772. /**
  26773. * join a sequence of url components with '/',
  26774. * encoding each component with encodeURIComponent
  26775. */
  26776. return encode_uri_components(url_path_join.apply(null, arguments));
  26777. };
  26778. var splitext = function (filename) {
  26779. /**
  26780. * mimic Python os.path.splitext
  26781. * Returns ['base', '.ext']
  26782. */
  26783. var idx = filename.lastIndexOf('.');
  26784. if (idx > 0) {
  26785. return [filename.slice(0, idx), filename.slice(idx)];
  26786. } else {
  26787. return [filename, ''];
  26788. }
  26789. };
  26790. var escape_html = function (text) {
  26791. /**
  26792. * escape text to HTML
  26793. */
  26794. return $("<div/>").text(text).html();
  26795. };
  26796. var get_body_data = function(key) {
  26797. /**
  26798. * get a url-encoded item from body.data and decode it
  26799. * we should never have any encoded URLs anywhere else in code
  26800. * until we are building an actual request
  26801. */
  26802. var val = $('body').data(key);
  26803. if (typeof val === 'undefined')
  26804. return val;
  26805. return decodeURIComponent(val);
  26806. };
  26807. var to_absolute_cursor_pos = function (cm, cursor) {
  26808. console.warn('`utils.to_absolute_cursor_pos(cm, pos)` is deprecated. Use `cm.indexFromPos(cursor)`');
  26809. return cm.indexFromPos(cursor);
  26810. };
  26811. var from_absolute_cursor_pos = function (cm, cursor_pos) {
  26812. console.warn('`utils.from_absolute_cursor_pos(cm, pos)` is deprecated. Use `cm.posFromIndex(index)`');
  26813. return cm.posFromIndex(cursor_pos);
  26814. };
  26815. // https://stackoverflow.com/questions/2400935/browser-detection-in-javascript
  26816. var browser = (function() {
  26817. if (typeof navigator === 'undefined') {
  26818. // navigator undefined in node
  26819. return 'None';
  26820. }
  26821. var N= navigator.appName, ua= navigator.userAgent, tem;
  26822. var M= ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
  26823. if (M && (tem= ua.match(/version\/([\.\d]+)/i)) !== null) M[2]= tem[1];
  26824. M= M? [M[1], M[2]]: [N, navigator.appVersion,'-?'];
  26825. return M;
  26826. })();
  26827. // https://stackoverflow.com/questions/11219582/how-to-detect-my-browser-version-and-operating-system-using-javascript
  26828. var platform = (function () {
  26829. if (typeof navigator === 'undefined') {
  26830. // navigator undefined in node
  26831. return 'None';
  26832. }
  26833. var OSName="None";
  26834. if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";
  26835. if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";
  26836. if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";
  26837. if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";
  26838. return OSName;
  26839. })();
  26840. var get_url_param = function (name) {
  26841. // get a URL parameter. I cannot believe we actually need this.
  26842. // Based on https://stackoverflow.com/a/25359264/938949
  26843. var match = new RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
  26844. if (match){
  26845. return decodeURIComponent(match[1] || '');
  26846. }
  26847. };
  26848. var is_or_has = function (a, b) {
  26849. /**
  26850. * Is b a child of a or a itself?
  26851. */
  26852. return a.has(b).length !==0 || a.is(b);
  26853. };
  26854. var is_focused = function (e) {
  26855. /**
  26856. * Is element e, or one of its children focused?
  26857. */
  26858. e = $(e);
  26859. var target = $(document.activeElement);
  26860. if (target.length > 0) {
  26861. if (is_or_has(e, target)) {
  26862. return true;
  26863. } else {
  26864. return false;
  26865. }
  26866. } else {
  26867. return false;
  26868. }
  26869. };
  26870. var mergeopt = function(_class, options, overwrite){
  26871. options = options || {};
  26872. overwrite = overwrite || {};
  26873. return $.extend(true, {}, _class.options_default, options, overwrite);
  26874. };
  26875. var ajax_error_msg = function (jqXHR) {
  26876. /**
  26877. * Return a JSON error message if there is one,
  26878. * otherwise the basic HTTP status text.
  26879. */
  26880. if (jqXHR.responseJSON && jqXHR.responseJSON.traceback) {
  26881. return jqXHR.responseJSON.traceback;
  26882. } else if (jqXHR.responseJSON && jqXHR.responseJSON.message) {
  26883. return jqXHR.responseJSON.message;
  26884. } else {
  26885. return jqXHR.statusText;
  26886. }
  26887. };
  26888. var log_ajax_error = function (jqXHR, status, error) {
  26889. /**
  26890. * log ajax failures with informative messages
  26891. */
  26892. var msg = "API request failed (" + jqXHR.status + "): ";
  26893. console.log(jqXHR);
  26894. msg += ajax_error_msg(jqXHR);
  26895. console.log(msg);
  26896. };
  26897. var requireCodeMirrorMode = function (mode, callback, errback) {
  26898. /**
  26899. * find a predefined mode or detect from CM metadata then
  26900. * require and callback with the resolvable mode string: mime or
  26901. * custom name
  26902. */
  26903. var modename = (typeof mode == "string") ? mode :
  26904. mode.mode || mode.name;
  26905. // simplest, cheapest check by mode name: mode may also have config
  26906. if (CodeMirror.modes.hasOwnProperty(modename)) {
  26907. // return the full mode object, if it has a name
  26908. callback(mode.name ? mode : modename);
  26909. return;
  26910. }
  26911. // *somehow* get back a CM.modeInfo-like object that has .mode and
  26912. // .mime
  26913. var info = (mode && mode.mode && mode.mime && mode) ||
  26914. CodeMirror.findModeByName(modename) ||
  26915. CodeMirror.findModeByExtension(modename.split(".").slice(-1)[0]) ||
  26916. CodeMirror.findModeByMIME(modename) ||
  26917. {mode: modename, mime: modename};
  26918. requirejs([
  26919. // might want to use CodeMirror.modeURL here
  26920. ['codemirror/mode', info.mode, info.mode].join('/'),
  26921. ], function() {
  26922. // return the original mode, as from a kernelspec on first load
  26923. // or the mimetype, as for most highlighting
  26924. callback(mode.name ? mode : info.mime);
  26925. }, errback
  26926. );
  26927. };
  26928. /** Error type for wrapped XHR errors. */
  26929. var XHR_ERROR = 'XhrError';
  26930. /**
  26931. * Wraps an AJAX error as an Error object.
  26932. */
  26933. var wrap_ajax_error = function (jqXHR, status, error) {
  26934. var wrapped_error = new Error(ajax_error_msg(jqXHR));
  26935. wrapped_error.name = XHR_ERROR;
  26936. // provide xhr response
  26937. wrapped_error.xhr = jqXHR;
  26938. wrapped_error.xhr_status = status;
  26939. wrapped_error.xhr_error = error;
  26940. return wrapped_error;
  26941. };
  26942. var ajax = function (url, settings) {
  26943. // like $.ajax, but ensure XSRF or Authorization header is set
  26944. if (typeof url === "object") {
  26945. // called with single argument: $.ajax({url: '...'})
  26946. settings = url;
  26947. url = settings.url;
  26948. delete settings.url;
  26949. }
  26950. settings = _add_auth_header(settings);
  26951. return $.ajax(url, settings);
  26952. };
  26953. var _get_cookie = function (name) {
  26954. // from tornado docs: http://www.tornadoweb.org/en/stable/guide/security.html
  26955. var r = document.cookie.match("\\b" + name + "=([^;]*)\\b");
  26956. return r ? r[1] : undefined;
  26957. }
  26958. var _add_auth_header = function (settings) {
  26959. /**
  26960. * Adds auth header to jquery ajax settings
  26961. */
  26962. settings = settings || {};
  26963. if (!settings.headers) {
  26964. settings.headers = {};
  26965. }
  26966. if (!settings.headers.Authorization) {
  26967. var xsrf_token = _get_cookie('_xsrf');
  26968. if (xsrf_token) {
  26969. settings.headers['X-XSRFToken'] = xsrf_token;
  26970. }
  26971. }
  26972. return settings;
  26973. };
  26974. var promising_ajax = function(url, settings) {
  26975. /**
  26976. * Like $.ajax, but returning an ES6 promise. success and error settings
  26977. * will be ignored.
  26978. */
  26979. settings = settings || {};
  26980. return new Promise(function(resolve, reject) {
  26981. settings.success = function(data, status, jqXHR) {
  26982. resolve(data);
  26983. };
  26984. settings.error = function(jqXHR, status, error) {
  26985. log_ajax_error(jqXHR, status, error);
  26986. reject(wrap_ajax_error(jqXHR, status, error));
  26987. };
  26988. ajax(url, settings);
  26989. });
  26990. };
  26991. var WrappedError = function(message, error){
  26992. /**
  26993. * Wrappable Error class
  26994. *
  26995. * The Error class doesn't actually act on `this`. Instead it always
  26996. * returns a new instance of Error. Here we capture that instance so we
  26997. * can apply it's properties to `this`.
  26998. */
  26999. var tmp = Error.apply(this, [message]);
  27000. // Copy the properties of the error over to this.
  27001. var properties = Object.getOwnPropertyNames(tmp);
  27002. for (var i = 0; i < properties.length; i++) {
  27003. this[properties[i]] = tmp[properties[i]];
  27004. }
  27005. // Keep a stack of the original error messages.
  27006. if (error instanceof WrappedError) {
  27007. this.error_stack = error.error_stack;
  27008. } else {
  27009. this.error_stack = [error];
  27010. }
  27011. this.error_stack.push(tmp);
  27012. return this;
  27013. };
  27014. WrappedError.prototype = Object.create(Error.prototype, {});
  27015. var load_class = function(class_name, module_name, registry) {
  27016. /**
  27017. * Tries to load a class
  27018. *
  27019. * Tries to load a class from a module using require.js, if a module
  27020. * is specified, otherwise tries to load a class from the global
  27021. * registry, if the global registry is provided.
  27022. */
  27023. return new Promise(function(resolve, reject) {
  27024. // Try loading the view module using require.js
  27025. if (module_name) {
  27026. requirejs([module_name], function(module) {
  27027. if (module[class_name] === undefined) {
  27028. reject(new Error('Class '+class_name+' not found in module '+module_name));
  27029. } else {
  27030. resolve(module[class_name]);
  27031. }
  27032. }, reject);
  27033. } else {
  27034. if (registry && registry[class_name]) {
  27035. resolve(registry[class_name]);
  27036. } else {
  27037. reject(new Error('Class '+class_name+' not found in registry '));
  27038. }
  27039. }
  27040. });
  27041. };
  27042. var resolve_promises_dict = function(d) {
  27043. /**
  27044. * Resolve a promiseful dictionary.
  27045. * Returns a single Promise.
  27046. */
  27047. var keys = Object.keys(d);
  27048. var values = [];
  27049. keys.forEach(function(key) {
  27050. values.push(d[key]);
  27051. });
  27052. return Promise.all(values).then(function(v) {
  27053. d = {};
  27054. for(var i=0; i<keys.length; i++) {
  27055. d[keys[i]] = v[i];
  27056. }
  27057. return d;
  27058. });
  27059. };
  27060. var reject = function(message, log) {
  27061. /**
  27062. * Creates a wrappable Promise rejection function.
  27063. *
  27064. * Creates a function that returns a Promise.reject with a new WrappedError
  27065. * that has the provided message and wraps the original error that
  27066. * caused the promise to reject.
  27067. */
  27068. return function(error) {
  27069. var wrapped_error = new WrappedError(message, error);
  27070. if (log) {
  27071. console.error(message, " -- ", error);
  27072. }
  27073. return Promise.reject(wrapped_error);
  27074. };
  27075. };
  27076. var typeset = function(element, text) {
  27077. /**
  27078. * Apply MathJax rendering to an element, and optionally set its text
  27079. *
  27080. * If MathJax is not available, make no changes.
  27081. *
  27082. * Returns the output any number of typeset elements, or undefined if
  27083. * MathJax was not available.
  27084. *
  27085. * Parameters
  27086. * ----------
  27087. * element: Node, NodeList, or jQuery selection
  27088. * text: option string
  27089. */
  27090. var $el = element.jquery ? element : $(element);
  27091. if(arguments.length > 1){
  27092. $el.text(text);
  27093. }
  27094. if(!window.MathJax){
  27095. return;
  27096. }
  27097. $el.map(function(){
  27098. // MathJax takes a DOM node: $.map makes `this` the context
  27099. MathJax.Hub.Queue(["Typeset", MathJax.Hub, this]);
  27100. try {
  27101. MathJax.Hub.Queue(
  27102. ["Require", MathJax.Ajax, "[MathJax]/extensions/TeX/AMSmath.js"],
  27103. function() { MathJax.InputJax.TeX.resetEquationNumbers(); }
  27104. );
  27105. } catch (e) {
  27106. console.error("Error queueing resetEquationNumbers:", e);
  27107. }
  27108. });
  27109. };
  27110. var parse_b64_data_uri = function(uri) {
  27111. /**
  27112. * Parses a base64 encoded data-uri to extract mimetype and the
  27113. * base64 string.
  27114. *
  27115. * For example, given 'data:image/png;base64,iVBORw', it will return
  27116. * ["image/png", "iVBORw"]
  27117. *
  27118. * Parameters
  27119. */
  27120. // For performance reasons, the non-greedy ? qualifiers are crucial so
  27121. // that the matcher stops early on big blobs. Without them, it will try
  27122. // to match the whole blob which can take ages
  27123. var regex = /^data:(.+?\/.+?);base64,/;
  27124. var matches = uri.match(regex);
  27125. var mime = matches[1];
  27126. // matches[0] contains the whole data-uri prefix
  27127. var b64_data = uri.slice(matches[0].length);
  27128. return [mime, b64_data];
  27129. };
  27130. var time = {};
  27131. time.milliseconds = {};
  27132. time.milliseconds.s = 1000;
  27133. time.milliseconds.m = 60 * time.milliseconds.s;
  27134. time.milliseconds.h = 60 * time.milliseconds.m;
  27135. time.milliseconds.d = 24 * time.milliseconds.h;
  27136. time.thresholds = {
  27137. // moment.js thresholds in milliseconds
  27138. s: moment.relativeTimeThreshold('s') * time.milliseconds.s,
  27139. m: moment.relativeTimeThreshold('m') * time.milliseconds.m,
  27140. h: moment.relativeTimeThreshold('h') * time.milliseconds.h,
  27141. d: moment.relativeTimeThreshold('d') * time.milliseconds.d,
  27142. };
  27143. time.timeout_from_dt = function (dt) {
  27144. /** compute a timeout based on dt
  27145. input and output both in milliseconds
  27146. use moment's relative time thresholds:
  27147. - 10 seconds if in 'seconds ago' territory
  27148. - 1 minute if in 'minutes ago'
  27149. - 1 hour otherwise
  27150. */
  27151. if (dt < time.thresholds.s) {
  27152. return 10 * time.milliseconds.s;
  27153. } else if (dt < time.thresholds.m) {
  27154. return time.milliseconds.m;
  27155. } else {
  27156. return time.milliseconds.h;
  27157. }
  27158. };
  27159. var format_datetime = function(date) {
  27160. var text = moment(date).fromNow();
  27161. return text === 'a few seconds ago' ? 'seconds ago' : text;
  27162. };
  27163. var datetime_sort_helper = function(a, b, order) {
  27164. if (moment(a).isBefore(moment(b))) {
  27165. return (order == 1) ? -1 : 1;
  27166. } else if (moment(a).isSame(moment(b))) {
  27167. return 0;
  27168. } else {
  27169. return (order == 1) ? 1 : -1;
  27170. }
  27171. };
  27172. /**
  27173. source: https://github.com/sindresorhus/pretty-bytes
  27174. The MIT License (MIT)
  27175. Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
  27176. Permission is hereby granted, free of charge, to any person obtaining a copy
  27177. of this software and associated documentation files (the "Software"), to deal
  27178. in the Software without restriction, including without limitation the rights
  27179. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  27180. copies of the Software, and to permit persons to whom the Software is
  27181. furnished to do so, subject to the following conditions:
  27182. The above copyright notice and this permission notice shall be included in
  27183. all copies or substantial portions of the Software.
  27184. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  27185. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  27186. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  27187. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  27188. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  27189. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  27190. THE SOFTWARE.
  27191. **/
  27192. var format_filesize = function(num) {
  27193. if (num === undefined || num === null)
  27194. return;
  27195. var UNITS = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
  27196. if (!Number.isFinite(num)) {
  27197. console.error("Expected finite number, got ", typeof(num) + ": " + num);
  27198. }
  27199. var neg = num < 0;
  27200. if (neg) {
  27201. num = -num;
  27202. }
  27203. if (num < 1) {
  27204. return (neg ? '-' : '') + num + ' B';
  27205. }
  27206. var exponent = Math.min(Math.floor(Math.log10(num) / 3), UNITS.length - 1);
  27207. var numStr = Number((num / Math.pow(1000, exponent)).toPrecision(3));
  27208. var unit = UNITS[exponent];
  27209. return (neg ? '-' : '') + numStr + ' ' + unit;
  27210. }
  27211. // javascript stores text as utf16 and string indices use "code units",
  27212. // which stores high-codepoint characters as "surrogate pairs",
  27213. // which occupy two indices in the javascript string.
  27214. // We need to translate cursor_pos in the protocol (in characters)
  27215. // to js offset (with surrogate pairs taking two spots).
  27216. function js_idx_to_char_idx (js_idx, text) {
  27217. var char_idx = js_idx;
  27218. for (var i = 0; i + 1 < text.length && i < js_idx; i++) {
  27219. var char_code = text.charCodeAt(i);
  27220. // check for surrogate pair
  27221. if (char_code >= 0xD800 && char_code <= 0xDBFF) {
  27222. var next_char_code = text.charCodeAt(i+1);
  27223. if (next_char_code >= 0xDC00 && next_char_code <= 0xDFFF) {
  27224. char_idx--;
  27225. i++;
  27226. }
  27227. }
  27228. }
  27229. return char_idx;
  27230. }
  27231. function char_idx_to_js_idx (char_idx, text) {
  27232. var js_idx = char_idx;
  27233. for (var i = 0; i + 1 < text.length && i < js_idx; i++) {
  27234. var char_code = text.charCodeAt(i);
  27235. // check for surrogate pair
  27236. if (char_code >= 0xD800 && char_code <= 0xDBFF) {
  27237. var next_char_code = text.charCodeAt(i+1);
  27238. if (next_char_code >= 0xDC00 && next_char_code <= 0xDFFF) {
  27239. js_idx++;
  27240. i++;
  27241. }
  27242. }
  27243. }
  27244. return js_idx;
  27245. }
  27246. if ('𝐚'.length === 1) {
  27247. // If javascript fixes string indices of non-BMP characters,
  27248. // don't keep shifting offsets to compensate for surrogate pairs
  27249. char_idx_to_js_idx = js_idx_to_char_idx = function (idx, text) { return idx; };
  27250. }
  27251. // Test if a drag'n'drop event contains a file (as opposed to an HTML
  27252. // element/text from the document)
  27253. var dnd_contain_file = function(event) {
  27254. // As per the HTML5 drag'n'drop spec, the dataTransfer.types should
  27255. // contain one "Files" type if a file is being dragged
  27256. // https://www.w3.org/TR/2011/WD-html5-20110113/dnd.html#dom-datatransfer-types
  27257. if (event.dataTransfer.types) {
  27258. for (var i = 0; i < event.dataTransfer.types.length; i++) {
  27259. if (event.dataTransfer.types[i] == "Files") {
  27260. return true;
  27261. }
  27262. }
  27263. }
  27264. return false;
  27265. };
  27266. var throttle = function(fn, time) {
  27267. var pending = null;
  27268. return function () {
  27269. if (pending) return;
  27270. pending = setTimeout(run, time);
  27271. return function () {
  27272. clearTimeout(pending);
  27273. pending = null;
  27274. }
  27275. }
  27276. function run () {
  27277. pending = null;
  27278. fn();
  27279. }
  27280. }
  27281. var change_favicon = function (src) {
  27282. var link = document.createElement('link'),
  27283. oldLink = document.getElementById('favicon');
  27284. link.id = 'favicon';
  27285. link.type = 'image/x-icon';
  27286. link.rel = 'shortcut icon';
  27287. link.href = utils.url_path_join(utils.get_body_data('baseUrl'), src);
  27288. if (oldLink && (link.href === oldLink.href)) {
  27289. // This favicon is already set, don't modify the DOM.
  27290. return;
  27291. }
  27292. if (oldLink) document.head.removeChild(oldLink);
  27293. document.head.appendChild(link);
  27294. };
  27295. var utils = {
  27296. throttle: throttle,
  27297. is_loaded: is_loaded,
  27298. load_extension: load_extension,
  27299. load_extensions: load_extensions,
  27300. filter_extensions: filter_extensions,
  27301. load_extensions_from_config: load_extensions_from_config,
  27302. regex_split : regex_split,
  27303. uuid : uuid,
  27304. fixConsole : fixConsole,
  27305. fixCarriageReturn : fixCarriageReturn,
  27306. fixBackspace : fixBackspace,
  27307. fixOverwrittenChars: fixOverwrittenChars,
  27308. autoLinkUrls : autoLinkUrls,
  27309. points_to_pixels : points_to_pixels,
  27310. get_body_data : get_body_data,
  27311. parse_url : parse_url,
  27312. url_path_split : url_path_split,
  27313. url_path_join : url_path_join,
  27314. url_join_encode : url_join_encode,
  27315. encode_uri_components : encode_uri_components,
  27316. splitext : splitext,
  27317. escape_html : escape_html,
  27318. always_new : always_new,
  27319. to_absolute_cursor_pos : to_absolute_cursor_pos,
  27320. from_absolute_cursor_pos : from_absolute_cursor_pos,
  27321. browser : browser,
  27322. platform: platform,
  27323. get_url_param: get_url_param,
  27324. is_or_has : is_or_has,
  27325. is_focused : is_focused,
  27326. mergeopt: mergeopt,
  27327. requireCodeMirrorMode : requireCodeMirrorMode,
  27328. XHR_ERROR : XHR_ERROR,
  27329. ajax : ajax,
  27330. ajax_error_msg : ajax_error_msg,
  27331. log_ajax_error : log_ajax_error,
  27332. wrap_ajax_error : wrap_ajax_error,
  27333. promising_ajax : promising_ajax,
  27334. WrappedError: WrappedError,
  27335. load_class: load_class,
  27336. resolve_promises_dict: resolve_promises_dict,
  27337. reject: reject,
  27338. typeset: typeset,
  27339. parse_b64_data_uri: parse_b64_data_uri,
  27340. time: time,
  27341. format_datetime: format_datetime,
  27342. format_filesize: format_filesize,
  27343. datetime_sort_helper: datetime_sort_helper,
  27344. dnd_contain_file: dnd_contain_file,
  27345. js_idx_to_char_idx: js_idx_to_char_idx,
  27346. char_idx_to_js_idx: char_idx_to_js_idx,
  27347. _ansispan:_ansispan,
  27348. change_favicon: change_favicon
  27349. };
  27350. return utils;
  27351. });
  27352. /**
  27353. * @preserve jed.js https://github.com/SlexAxton/Jed
  27354. */
  27355. /*
  27356. -----------
  27357. A gettext compatible i18n library for modern JavaScript Applications
  27358. by Alex Sexton - AlexSexton [at] gmail - @SlexAxton
  27359. MIT License
  27360. A jQuery Foundation project - requires CLA to contribute -
  27361. https://contribute.jquery.org/CLA/
  27362. Jed offers the entire applicable GNU gettext spec'd set of
  27363. functions, but also offers some nicer wrappers around them.
  27364. The api for gettext was written for a language with no function
  27365. overloading, so Jed allows a little more of that.
  27366. Many thanks to Joshua I. Miller - unrtst@cpan.org - who wrote
  27367. gettext.js back in 2008. I was able to vet a lot of my ideas
  27368. against his. I also made sure Jed passed against his tests
  27369. in order to offer easy upgrades -- jsgettext.berlios.de
  27370. */
  27371. (function (root, undef) {
  27372. // Set up some underscore-style functions, if you already have
  27373. // underscore, feel free to delete this section, and use it
  27374. // directly, however, the amount of functions used doesn't
  27375. // warrant having underscore as a full dependency.
  27376. // Underscore 1.3.0 was used to port and is licensed
  27377. // under the MIT License by Jeremy Ashkenas.
  27378. var ArrayProto = Array.prototype,
  27379. ObjProto = Object.prototype,
  27380. slice = ArrayProto.slice,
  27381. hasOwnProp = ObjProto.hasOwnProperty,
  27382. nativeForEach = ArrayProto.forEach,
  27383. breaker = {};
  27384. // We're not using the OOP style _ so we don't need the
  27385. // extra level of indirection. This still means that you
  27386. // sub out for real `_` though.
  27387. var _ = {
  27388. forEach : function( obj, iterator, context ) {
  27389. var i, l, key;
  27390. if ( obj === null ) {
  27391. return;
  27392. }
  27393. if ( nativeForEach && obj.forEach === nativeForEach ) {
  27394. obj.forEach( iterator, context );
  27395. }
  27396. else if ( obj.length === +obj.length ) {
  27397. for ( i = 0, l = obj.length; i < l; i++ ) {
  27398. if ( i in obj && iterator.call( context, obj[i], i, obj ) === breaker ) {
  27399. return;
  27400. }
  27401. }
  27402. }
  27403. else {
  27404. for ( key in obj) {
  27405. if ( hasOwnProp.call( obj, key ) ) {
  27406. if ( iterator.call (context, obj[key], key, obj ) === breaker ) {
  27407. return;
  27408. }
  27409. }
  27410. }
  27411. }
  27412. },
  27413. extend : function( obj ) {
  27414. this.forEach( slice.call( arguments, 1 ), function ( source ) {
  27415. for ( var prop in source ) {
  27416. obj[prop] = source[prop];
  27417. }
  27418. });
  27419. return obj;
  27420. }
  27421. };
  27422. // END Miniature underscore impl
  27423. // Jed is a constructor function
  27424. var Jed = function ( options ) {
  27425. // Some minimal defaults
  27426. this.defaults = {
  27427. "locale_data" : {
  27428. "messages" : {
  27429. "" : {
  27430. "domain" : "messages",
  27431. "lang" : "en",
  27432. "plural_forms" : "nplurals=2; plural=(n != 1);"
  27433. }
  27434. // There are no default keys, though
  27435. }
  27436. },
  27437. // The default domain if one is missing
  27438. "domain" : "messages",
  27439. // enable debug mode to log untranslated strings to the console
  27440. "debug" : false
  27441. };
  27442. // Mix in the sent options with the default options
  27443. this.options = _.extend( {}, this.defaults, options );
  27444. this.textdomain( this.options.domain );
  27445. if ( options.domain && ! this.options.locale_data[ this.options.domain ] ) {
  27446. throw new Error('Text domain set to non-existent domain: `' + options.domain + '`');
  27447. }
  27448. };
  27449. // The gettext spec sets this character as the default
  27450. // delimiter for context lookups.
  27451. // e.g.: context\u0004key
  27452. // If your translation company uses something different,
  27453. // just change this at any time and it will use that instead.
  27454. Jed.context_delimiter = String.fromCharCode( 4 );
  27455. function getPluralFormFunc ( plural_form_string ) {
  27456. return Jed.PF.compile( plural_form_string || "nplurals=2; plural=(n != 1);");
  27457. }
  27458. function Chain( key, i18n ){
  27459. this._key = key;
  27460. this._i18n = i18n;
  27461. }
  27462. // Create a chainable api for adding args prettily
  27463. _.extend( Chain.prototype, {
  27464. onDomain : function ( domain ) {
  27465. this._domain = domain;
  27466. return this;
  27467. },
  27468. withContext : function ( context ) {
  27469. this._context = context;
  27470. return this;
  27471. },
  27472. ifPlural : function ( num, pkey ) {
  27473. this._val = num;
  27474. this._pkey = pkey;
  27475. return this;
  27476. },
  27477. fetch : function ( sArr ) {
  27478. if ( {}.toString.call( sArr ) != '[object Array]' ) {
  27479. sArr = [].slice.call(arguments, 0);
  27480. }
  27481. return ( sArr && sArr.length ? Jed.sprintf : function(x){ return x; } )(
  27482. this._i18n.dcnpgettext(this._domain, this._context, this._key, this._pkey, this._val),
  27483. sArr
  27484. );
  27485. }
  27486. });
  27487. // Add functions to the Jed prototype.
  27488. // These will be the functions on the object that's returned
  27489. // from creating a `new Jed()`
  27490. // These seem redundant, but they gzip pretty well.
  27491. _.extend( Jed.prototype, {
  27492. // The sexier api start point
  27493. translate : function ( key ) {
  27494. return new Chain( key, this );
  27495. },
  27496. textdomain : function ( domain ) {
  27497. if ( ! domain ) {
  27498. return this._textdomain;
  27499. }
  27500. this._textdomain = domain;
  27501. },
  27502. gettext : function ( key ) {
  27503. return this.dcnpgettext.call( this, undef, undef, key );
  27504. },
  27505. dgettext : function ( domain, key ) {
  27506. return this.dcnpgettext.call( this, domain, undef, key );
  27507. },
  27508. dcgettext : function ( domain , key /*, category */ ) {
  27509. // Ignores the category anyways
  27510. return this.dcnpgettext.call( this, domain, undef, key );
  27511. },
  27512. ngettext : function ( skey, pkey, val ) {
  27513. return this.dcnpgettext.call( this, undef, undef, skey, pkey, val );
  27514. },
  27515. dngettext : function ( domain, skey, pkey, val ) {
  27516. return this.dcnpgettext.call( this, domain, undef, skey, pkey, val );
  27517. },
  27518. dcngettext : function ( domain, skey, pkey, val/*, category */) {
  27519. return this.dcnpgettext.call( this, domain, undef, skey, pkey, val );
  27520. },
  27521. pgettext : function ( context, key ) {
  27522. return this.dcnpgettext.call( this, undef, context, key );
  27523. },
  27524. dpgettext : function ( domain, context, key ) {
  27525. return this.dcnpgettext.call( this, domain, context, key );
  27526. },
  27527. dcpgettext : function ( domain, context, key/*, category */) {
  27528. return this.dcnpgettext.call( this, domain, context, key );
  27529. },
  27530. npgettext : function ( context, skey, pkey, val ) {
  27531. return this.dcnpgettext.call( this, undef, context, skey, pkey, val );
  27532. },
  27533. dnpgettext : function ( domain, context, skey, pkey, val ) {
  27534. return this.dcnpgettext.call( this, domain, context, skey, pkey, val );
  27535. },
  27536. // The most fully qualified gettext function. It has every option.
  27537. // Since it has every option, we can use it from every other method.
  27538. // This is the bread and butter.
  27539. // Technically there should be one more argument in this function for 'Category',
  27540. // but since we never use it, we might as well not waste the bytes to define it.
  27541. dcnpgettext : function ( domain, context, singular_key, plural_key, val ) {
  27542. // Set some defaults
  27543. plural_key = plural_key || singular_key;
  27544. // Use the global domain default if one
  27545. // isn't explicitly passed in
  27546. domain = domain || this._textdomain;
  27547. var fallback;
  27548. // Handle special cases
  27549. // No options found
  27550. if ( ! this.options ) {
  27551. // There's likely something wrong, but we'll return the correct key for english
  27552. // We do this by instantiating a brand new Jed instance with the default set
  27553. // for everything that could be broken.
  27554. fallback = new Jed();
  27555. return fallback.dcnpgettext.call( fallback, undefined, undefined, singular_key, plural_key, val );
  27556. }
  27557. // No translation data provided
  27558. if ( ! this.options.locale_data ) {
  27559. throw new Error('No locale data provided.');
  27560. }
  27561. if ( ! this.options.locale_data[ domain ] ) {
  27562. throw new Error('Domain `' + domain + '` was not found.');
  27563. }
  27564. if ( ! this.options.locale_data[ domain ][ "" ] ) {
  27565. throw new Error('No locale meta information provided.');
  27566. }
  27567. // Make sure we have a truthy key. Otherwise we might start looking
  27568. // into the empty string key, which is the options for the locale
  27569. // data.
  27570. if ( ! singular_key ) {
  27571. throw new Error('No translation key found.');
  27572. }
  27573. var key = context ? context + Jed.context_delimiter + singular_key : singular_key,
  27574. locale_data = this.options.locale_data,
  27575. dict = locale_data[ domain ],
  27576. defaultConf = (locale_data.messages || this.defaults.locale_data.messages)[""],
  27577. pluralForms = dict[""].plural_forms || dict[""]["Plural-Forms"] || dict[""]["plural-forms"] || defaultConf.plural_forms || defaultConf["Plural-Forms"] || defaultConf["plural-forms"],
  27578. val_list,
  27579. res;
  27580. var val_idx;
  27581. if (val === undefined) {
  27582. // No value passed in; assume singular key lookup.
  27583. val_idx = 0;
  27584. } else {
  27585. // Value has been passed in; use plural-forms calculations.
  27586. // Handle invalid numbers, but try casting strings for good measure
  27587. if ( typeof val != 'number' ) {
  27588. val = parseInt( val, 10 );
  27589. if ( isNaN( val ) ) {
  27590. throw new Error('The number that was passed in is not a number.');
  27591. }
  27592. }
  27593. val_idx = getPluralFormFunc(pluralForms)(val);
  27594. }
  27595. // Throw an error if a domain isn't found
  27596. if ( ! dict ) {
  27597. throw new Error('No domain named `' + domain + '` could be found.');
  27598. }
  27599. val_list = dict[ key ];
  27600. // If there is no match, then revert back to
  27601. // english style singular/plural with the keys passed in.
  27602. if ( ! val_list || val_idx > val_list.length ) {
  27603. if (this.options.missing_key_callback) {
  27604. this.options.missing_key_callback(key, domain);
  27605. }
  27606. res = [ singular_key, plural_key ];
  27607. // collect untranslated strings
  27608. if (this.options.debug===true) {
  27609. console.log(res[ getPluralFormFunc(pluralForms)( val ) ]);
  27610. }
  27611. return res[ getPluralFormFunc()( val ) ];
  27612. }
  27613. res = val_list[ val_idx ];
  27614. // This includes empty strings on purpose
  27615. if ( ! res ) {
  27616. res = [ singular_key, plural_key ];
  27617. return res[ getPluralFormFunc()( val ) ];
  27618. }
  27619. return res;
  27620. }
  27621. });
  27622. // We add in sprintf capabilities for post translation value interolation
  27623. // This is not internally used, so you can remove it if you have this
  27624. // available somewhere else, or want to use a different system.
  27625. // We _slightly_ modify the normal sprintf behavior to more gracefully handle
  27626. // undefined values.
  27627. /**
  27628. sprintf() for JavaScript 0.7-beta1
  27629. http://www.diveintojavascript.com/projects/javascript-sprintf
  27630. Copyright (c) Alexandru Marasteanu <alexaholic [at) gmail (dot] com>
  27631. All rights reserved.
  27632. Redistribution and use in source and binary forms, with or without
  27633. modification, are permitted provided that the following conditions are met:
  27634. * Redistributions of source code must retain the above copyright
  27635. notice, this list of conditions and the following disclaimer.
  27636. * Redistributions in binary form must reproduce the above copyright
  27637. notice, this list of conditions and the following disclaimer in the
  27638. documentation and/or other materials provided with the distribution.
  27639. * Neither the name of sprintf() for JavaScript nor the
  27640. names of its contributors may be used to endorse or promote products
  27641. derived from this software without specific prior written permission.
  27642. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  27643. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  27644. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  27645. DISCLAIMED. IN NO EVENT SHALL Alexandru Marasteanu BE LIABLE FOR ANY
  27646. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  27647. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  27648. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  27649. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27650. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  27651. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27652. */
  27653. var sprintf = (function() {
  27654. function get_type(variable) {
  27655. return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase();
  27656. }
  27657. function str_repeat(input, multiplier) {
  27658. for (var output = []; multiplier > 0; output[--multiplier] = input) {/* do nothing */}
  27659. return output.join('');
  27660. }
  27661. var str_format = function() {
  27662. if (!str_format.cache.hasOwnProperty(arguments[0])) {
  27663. str_format.cache[arguments[0]] = str_format.parse(arguments[0]);
  27664. }
  27665. return str_format.format.call(null, str_format.cache[arguments[0]], arguments);
  27666. };
  27667. str_format.format = function(parse_tree, argv) {
  27668. var cursor = 1, tree_length = parse_tree.length, node_type = '', arg, output = [], i, k, match, pad, pad_character, pad_length;
  27669. for (i = 0; i < tree_length; i++) {
  27670. node_type = get_type(parse_tree[i]);
  27671. if (node_type === 'string') {
  27672. output.push(parse_tree[i]);
  27673. }
  27674. else if (node_type === 'array') {
  27675. match = parse_tree[i]; // convenience purposes only
  27676. if (match[2]) { // keyword argument
  27677. arg = argv[cursor];
  27678. for (k = 0; k < match[2].length; k++) {
  27679. if (!arg.hasOwnProperty(match[2][k])) {
  27680. throw(sprintf('[sprintf] property "%s" does not exist', match[2][k]));
  27681. }
  27682. arg = arg[match[2][k]];
  27683. }
  27684. }
  27685. else if (match[1]) { // positional argument (explicit)
  27686. arg = argv[match[1]];
  27687. }
  27688. else { // positional argument (implicit)
  27689. arg = argv[cursor++];
  27690. }
  27691. if (/[^s]/.test(match[8]) && (get_type(arg) != 'number')) {
  27692. throw(sprintf('[sprintf] expecting number but found %s', get_type(arg)));
  27693. }
  27694. // Jed EDIT
  27695. if ( typeof arg == 'undefined' || arg === null ) {
  27696. arg = '';
  27697. }
  27698. // Jed EDIT
  27699. switch (match[8]) {
  27700. case 'b': arg = arg.toString(2); break;
  27701. case 'c': arg = String.fromCharCode(arg); break;
  27702. case 'd': arg = parseInt(arg, 10); break;
  27703. case 'e': arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential(); break;
  27704. case 'f': arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg); break;
  27705. case 'o': arg = arg.toString(8); break;
  27706. case 's': arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg); break;
  27707. case 'u': arg = Math.abs(arg); break;
  27708. case 'x': arg = arg.toString(16); break;
  27709. case 'X': arg = arg.toString(16).toUpperCase(); break;
  27710. }
  27711. arg = (/[def]/.test(match[8]) && match[3] && arg >= 0 ? '+'+ arg : arg);
  27712. pad_character = match[4] ? match[4] == '0' ? '0' : match[4].charAt(1) : ' ';
  27713. pad_length = match[6] - String(arg).length;
  27714. pad = match[6] ? str_repeat(pad_character, pad_length) : '';
  27715. output.push(match[5] ? arg + pad : pad + arg);
  27716. }
  27717. }
  27718. return output.join('');
  27719. };
  27720. str_format.cache = {};
  27721. str_format.parse = function(fmt) {
  27722. var _fmt = fmt, match = [], parse_tree = [], arg_names = 0;
  27723. while (_fmt) {
  27724. if ((match = /^[^\x25]+/.exec(_fmt)) !== null) {
  27725. parse_tree.push(match[0]);
  27726. }
  27727. else if ((match = /^\x25{2}/.exec(_fmt)) !== null) {
  27728. parse_tree.push('%');
  27729. }
  27730. else if ((match = /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(_fmt)) !== null) {
  27731. if (match[2]) {
  27732. arg_names |= 1;
  27733. var field_list = [], replacement_field = match[2], field_match = [];
  27734. if ((field_match = /^([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {
  27735. field_list.push(field_match[1]);
  27736. while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') {
  27737. if ((field_match = /^\.([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {
  27738. field_list.push(field_match[1]);
  27739. }
  27740. else if ((field_match = /^\[(\d+)\]/.exec(replacement_field)) !== null) {
  27741. field_list.push(field_match[1]);
  27742. }
  27743. else {
  27744. throw('[sprintf] huh?');
  27745. }
  27746. }
  27747. }
  27748. else {
  27749. throw('[sprintf] huh?');
  27750. }
  27751. match[2] = field_list;
  27752. }
  27753. else {
  27754. arg_names |= 2;
  27755. }
  27756. if (arg_names === 3) {
  27757. throw('[sprintf] mixing positional and named placeholders is not (yet) supported');
  27758. }
  27759. parse_tree.push(match);
  27760. }
  27761. else {
  27762. throw('[sprintf] huh?');
  27763. }
  27764. _fmt = _fmt.substring(match[0].length);
  27765. }
  27766. return parse_tree;
  27767. };
  27768. return str_format;
  27769. })();
  27770. var vsprintf = function(fmt, argv) {
  27771. argv.unshift(fmt);
  27772. return sprintf.apply(null, argv);
  27773. };
  27774. Jed.parse_plural = function ( plural_forms, n ) {
  27775. plural_forms = plural_forms.replace(/n/g, n);
  27776. return Jed.parse_expression(plural_forms);
  27777. };
  27778. Jed.sprintf = function ( fmt, args ) {
  27779. if ( {}.toString.call( args ) == '[object Array]' ) {
  27780. return vsprintf( fmt, [].slice.call(args) );
  27781. }
  27782. return sprintf.apply(this, [].slice.call(arguments) );
  27783. };
  27784. Jed.prototype.sprintf = function () {
  27785. return Jed.sprintf.apply(this, arguments);
  27786. };
  27787. // END sprintf Implementation
  27788. // Start the Plural forms section
  27789. // This is a full plural form expression parser. It is used to avoid
  27790. // running 'eval' or 'new Function' directly against the plural
  27791. // forms.
  27792. //
  27793. // This can be important if you get translations done through a 3rd
  27794. // party vendor. I encourage you to use this instead, however, I
  27795. // also will provide a 'precompiler' that you can use at build time
  27796. // to output valid/safe function representations of the plural form
  27797. // expressions. This means you can build this code out for the most
  27798. // part.
  27799. Jed.PF = {};
  27800. Jed.PF.parse = function ( p ) {
  27801. var plural_str = Jed.PF.extractPluralExpr( p );
  27802. return Jed.PF.parser.parse.call(Jed.PF.parser, plural_str);
  27803. };
  27804. Jed.PF.compile = function ( p ) {
  27805. // Handle trues and falses as 0 and 1
  27806. function imply( val ) {
  27807. return (val === true ? 1 : val ? val : 0);
  27808. }
  27809. var ast = Jed.PF.parse( p );
  27810. return function ( n ) {
  27811. return imply( Jed.PF.interpreter( ast )( n ) );
  27812. };
  27813. };
  27814. Jed.PF.interpreter = function ( ast ) {
  27815. return function ( n ) {
  27816. var res;
  27817. switch ( ast.type ) {
  27818. case 'GROUP':
  27819. return Jed.PF.interpreter( ast.expr )( n );
  27820. case 'TERNARY':
  27821. if ( Jed.PF.interpreter( ast.expr )( n ) ) {
  27822. return Jed.PF.interpreter( ast.truthy )( n );
  27823. }
  27824. return Jed.PF.interpreter( ast.falsey )( n );
  27825. case 'OR':
  27826. return Jed.PF.interpreter( ast.left )( n ) || Jed.PF.interpreter( ast.right )( n );
  27827. case 'AND':
  27828. return Jed.PF.interpreter( ast.left )( n ) && Jed.PF.interpreter( ast.right )( n );
  27829. case 'LT':
  27830. return Jed.PF.interpreter( ast.left )( n ) < Jed.PF.interpreter( ast.right )( n );
  27831. case 'GT':
  27832. return Jed.PF.interpreter( ast.left )( n ) > Jed.PF.interpreter( ast.right )( n );
  27833. case 'LTE':
  27834. return Jed.PF.interpreter( ast.left )( n ) <= Jed.PF.interpreter( ast.right )( n );
  27835. case 'GTE':
  27836. return Jed.PF.interpreter( ast.left )( n ) >= Jed.PF.interpreter( ast.right )( n );
  27837. case 'EQ':
  27838. return Jed.PF.interpreter( ast.left )( n ) == Jed.PF.interpreter( ast.right )( n );
  27839. case 'NEQ':
  27840. return Jed.PF.interpreter( ast.left )( n ) != Jed.PF.interpreter( ast.right )( n );
  27841. case 'MOD':
  27842. return Jed.PF.interpreter( ast.left )( n ) % Jed.PF.interpreter( ast.right )( n );
  27843. case 'VAR':
  27844. return n;
  27845. case 'NUM':
  27846. return ast.val;
  27847. default:
  27848. throw new Error("Invalid Token found.");
  27849. }
  27850. };
  27851. };
  27852. Jed.PF.extractPluralExpr = function ( p ) {
  27853. // trim first
  27854. p = p.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
  27855. if (! /;\s*$/.test(p)) {
  27856. p = p.concat(';');
  27857. }
  27858. var nplurals_re = /nplurals\=(\d+);/,
  27859. plural_re = /plural\=(.*);/,
  27860. nplurals_matches = p.match( nplurals_re ),
  27861. res = {},
  27862. plural_matches;
  27863. // Find the nplurals number
  27864. if ( nplurals_matches.length > 1 ) {
  27865. res.nplurals = nplurals_matches[1];
  27866. }
  27867. else {
  27868. throw new Error('nplurals not found in plural_forms string: ' + p );
  27869. }
  27870. // remove that data to get to the formula
  27871. p = p.replace( nplurals_re, "" );
  27872. plural_matches = p.match( plural_re );
  27873. if (!( plural_matches && plural_matches.length > 1 ) ) {
  27874. throw new Error('`plural` expression not found: ' + p);
  27875. }
  27876. return plural_matches[ 1 ];
  27877. };
  27878. /* Jison generated parser */
  27879. Jed.PF.parser = (function(){
  27880. var parser = {trace: function trace() { },
  27881. yy: {},
  27882. symbols_: {"error":2,"expressions":3,"e":4,"EOF":5,"?":6,":":7,"||":8,"&&":9,"<":10,"<=":11,">":12,">=":13,"!=":14,"==":15,"%":16,"(":17,")":18,"n":19,"NUMBER":20,"$accept":0,"$end":1},
  27883. terminals_: {2:"error",5:"EOF",6:"?",7:":",8:"||",9:"&&",10:"<",11:"<=",12:">",13:">=",14:"!=",15:"==",16:"%",17:"(",18:")",19:"n",20:"NUMBER"},
  27884. productions_: [0,[3,2],[4,5],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,1],[4,1]],
  27885. performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
  27886. var $0 = $$.length - 1;
  27887. switch (yystate) {
  27888. case 1: return { type : 'GROUP', expr: $$[$0-1] };
  27889. break;
  27890. case 2:this.$ = { type: 'TERNARY', expr: $$[$0-4], truthy : $$[$0-2], falsey: $$[$0] };
  27891. break;
  27892. case 3:this.$ = { type: "OR", left: $$[$0-2], right: $$[$0] };
  27893. break;
  27894. case 4:this.$ = { type: "AND", left: $$[$0-2], right: $$[$0] };
  27895. break;
  27896. case 5:this.$ = { type: 'LT', left: $$[$0-2], right: $$[$0] };
  27897. break;
  27898. case 6:this.$ = { type: 'LTE', left: $$[$0-2], right: $$[$0] };
  27899. break;
  27900. case 7:this.$ = { type: 'GT', left: $$[$0-2], right: $$[$0] };
  27901. break;
  27902. case 8:this.$ = { type: 'GTE', left: $$[$0-2], right: $$[$0] };
  27903. break;
  27904. case 9:this.$ = { type: 'NEQ', left: $$[$0-2], right: $$[$0] };
  27905. break;
  27906. case 10:this.$ = { type: 'EQ', left: $$[$0-2], right: $$[$0] };
  27907. break;
  27908. case 11:this.$ = { type: 'MOD', left: $$[$0-2], right: $$[$0] };
  27909. break;
  27910. case 12:this.$ = { type: 'GROUP', expr: $$[$0-1] };
  27911. break;
  27912. case 13:this.$ = { type: 'VAR' };
  27913. break;
  27914. case 14:this.$ = { type: 'NUM', val: Number(yytext) };
  27915. break;
  27916. }
  27917. },
  27918. table: [{3:1,4:2,17:[1,3],19:[1,4],20:[1,5]},{1:[3]},{5:[1,6],6:[1,7],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16]},{4:17,17:[1,3],19:[1,4],20:[1,5]},{5:[2,13],6:[2,13],7:[2,13],8:[2,13],9:[2,13],10:[2,13],11:[2,13],12:[2,13],13:[2,13],14:[2,13],15:[2,13],16:[2,13],18:[2,13]},{5:[2,14],6:[2,14],7:[2,14],8:[2,14],9:[2,14],10:[2,14],11:[2,14],12:[2,14],13:[2,14],14:[2,14],15:[2,14],16:[2,14],18:[2,14]},{1:[2,1]},{4:18,17:[1,3],19:[1,4],20:[1,5]},{4:19,17:[1,3],19:[1,4],20:[1,5]},{4:20,17:[1,3],19:[1,4],20:[1,5]},{4:21,17:[1,3],19:[1,4],20:[1,5]},{4:22,17:[1,3],19:[1,4],20:[1,5]},{4:23,17:[1,3],19:[1,4],20:[1,5]},{4:24,17:[1,3],19:[1,4],20:[1,5]},{4:25,17:[1,3],19:[1,4],20:[1,5]},{4:26,17:[1,3],19:[1,4],20:[1,5]},{4:27,17:[1,3],19:[1,4],20:[1,5]},{6:[1,7],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[1,28]},{6:[1,7],7:[1,29],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16]},{5:[2,3],6:[2,3],7:[2,3],8:[2,3],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,3]},{5:[2,4],6:[2,4],7:[2,4],8:[2,4],9:[2,4],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,4]},{5:[2,5],6:[2,5],7:[2,5],8:[2,5],9:[2,5],10:[2,5],11:[2,5],12:[2,5],13:[2,5],14:[2,5],15:[2,5],16:[1,16],18:[2,5]},{5:[2,6],6:[2,6],7:[2,6],8:[2,6],9:[2,6],10:[2,6],11:[2,6],12:[2,6],13:[2,6],14:[2,6],15:[2,6],16:[1,16],18:[2,6]},{5:[2,7],6:[2,7],7:[2,7],8:[2,7],9:[2,7],10:[2,7],11:[2,7],12:[2,7],13:[2,7],14:[2,7],15:[2,7],16:[1,16],18:[2,7]},{5:[2,8],6:[2,8],7:[2,8],8:[2,8],9:[2,8],10:[2,8],11:[2,8],12:[2,8],13:[2,8],14:[2,8],15:[2,8],16:[1,16],18:[2,8]},{5:[2,9],6:[2,9],7:[2,9],8:[2,9],9:[2,9],10:[2,9],11:[2,9],12:[2,9],13:[2,9],14:[2,9],15:[2,9],16:[1,16],18:[2,9]},{5:[2,10],6:[2,10],7:[2,10],8:[2,10],9:[2,10],10:[2,10],11:[2,10],12:[2,10],13:[2,10],14:[2,10],15:[2,10],16:[1,16],18:[2,10]},{5:[2,11],6:[2,11],7:[2,11],8:[2,11],9:[2,11],10:[2,11],11:[2,11],12:[2,11],13:[2,11],14:[2,11],15:[2,11],16:[2,11],18:[2,11]},{5:[2,12],6:[2,12],7:[2,12],8:[2,12],9:[2,12],10:[2,12],11:[2,12],12:[2,12],13:[2,12],14:[2,12],15:[2,12],16:[2,12],18:[2,12]},{4:30,17:[1,3],19:[1,4],20:[1,5]},{5:[2,2],6:[1,7],7:[2,2],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,2]}],
  27919. defaultActions: {6:[2,1]},
  27920. parseError: function parseError(str, hash) {
  27921. throw new Error(str);
  27922. },
  27923. parse: function parse(input) {
  27924. var self = this,
  27925. stack = [0],
  27926. vstack = [null], // semantic value stack
  27927. lstack = [], // location stack
  27928. table = this.table,
  27929. yytext = '',
  27930. yylineno = 0,
  27931. yyleng = 0,
  27932. recovering = 0,
  27933. TERROR = 2,
  27934. EOF = 1;
  27935. //this.reductionCount = this.shiftCount = 0;
  27936. this.lexer.setInput(input);
  27937. this.lexer.yy = this.yy;
  27938. this.yy.lexer = this.lexer;
  27939. if (typeof this.lexer.yylloc == 'undefined')
  27940. this.lexer.yylloc = {};
  27941. var yyloc = this.lexer.yylloc;
  27942. lstack.push(yyloc);
  27943. if (typeof this.yy.parseError === 'function')
  27944. this.parseError = this.yy.parseError;
  27945. function popStack (n) {
  27946. stack.length = stack.length - 2*n;
  27947. vstack.length = vstack.length - n;
  27948. lstack.length = lstack.length - n;
  27949. }
  27950. function lex() {
  27951. var token;
  27952. token = self.lexer.lex() || 1; // $end = 1
  27953. // if token isn't its numeric value, convert
  27954. if (typeof token !== 'number') {
  27955. token = self.symbols_[token] || token;
  27956. }
  27957. return token;
  27958. }
  27959. var symbol, preErrorSymbol, state, action, a, r, yyval={},p,len,newState, expected;
  27960. while (true) {
  27961. // retreive state number from top of stack
  27962. state = stack[stack.length-1];
  27963. // use default actions if available
  27964. if (this.defaultActions[state]) {
  27965. action = this.defaultActions[state];
  27966. } else {
  27967. if (symbol == null)
  27968. symbol = lex();
  27969. // read action for current state and first input
  27970. action = table[state] && table[state][symbol];
  27971. }
  27972. // handle parse error
  27973. _handle_error:
  27974. if (typeof action === 'undefined' || !action.length || !action[0]) {
  27975. if (!recovering) {
  27976. // Report error
  27977. expected = [];
  27978. for (p in table[state]) if (this.terminals_[p] && p > 2) {
  27979. expected.push("'"+this.terminals_[p]+"'");
  27980. }
  27981. var errStr = '';
  27982. if (this.lexer.showPosition) {
  27983. errStr = 'Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+expected.join(', ') + ", got '" + this.terminals_[symbol]+ "'";
  27984. } else {
  27985. errStr = 'Parse error on line '+(yylineno+1)+": Unexpected " +
  27986. (symbol == 1 /*EOF*/ ? "end of input" :
  27987. ("'"+(this.terminals_[symbol] || symbol)+"'"));
  27988. }
  27989. this.parseError(errStr,
  27990. {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected});
  27991. }
  27992. // just recovered from another error
  27993. if (recovering == 3) {
  27994. if (symbol == EOF) {
  27995. throw new Error(errStr || 'Parsing halted.');
  27996. }
  27997. // discard current lookahead and grab another
  27998. yyleng = this.lexer.yyleng;
  27999. yytext = this.lexer.yytext;
  28000. yylineno = this.lexer.yylineno;
  28001. yyloc = this.lexer.yylloc;
  28002. symbol = lex();
  28003. }
  28004. // try to recover from error
  28005. while (1) {
  28006. // check for error recovery rule in this state
  28007. if ((TERROR.toString()) in table[state]) {
  28008. break;
  28009. }
  28010. if (state == 0) {
  28011. throw new Error(errStr || 'Parsing halted.');
  28012. }
  28013. popStack(1);
  28014. state = stack[stack.length-1];
  28015. }
  28016. preErrorSymbol = symbol; // save the lookahead token
  28017. symbol = TERROR; // insert generic error symbol as new lookahead
  28018. state = stack[stack.length-1];
  28019. action = table[state] && table[state][TERROR];
  28020. recovering = 3; // allow 3 real symbols to be shifted before reporting a new error
  28021. }
  28022. // this shouldn't happen, unless resolve defaults are off
  28023. if (action[0] instanceof Array && action.length > 1) {
  28024. throw new Error('Parse Error: multiple actions possible at state: '+state+', token: '+symbol);
  28025. }
  28026. switch (action[0]) {
  28027. case 1: // shift
  28028. //this.shiftCount++;
  28029. stack.push(symbol);
  28030. vstack.push(this.lexer.yytext);
  28031. lstack.push(this.lexer.yylloc);
  28032. stack.push(action[1]); // push state
  28033. symbol = null;
  28034. if (!preErrorSymbol) { // normal execution/no error
  28035. yyleng = this.lexer.yyleng;
  28036. yytext = this.lexer.yytext;
  28037. yylineno = this.lexer.yylineno;
  28038. yyloc = this.lexer.yylloc;
  28039. if (recovering > 0)
  28040. recovering--;
  28041. } else { // error just occurred, resume old lookahead f/ before error
  28042. symbol = preErrorSymbol;
  28043. preErrorSymbol = null;
  28044. }
  28045. break;
  28046. case 2: // reduce
  28047. //this.reductionCount++;
  28048. len = this.productions_[action[1]][1];
  28049. // perform semantic action
  28050. yyval.$ = vstack[vstack.length-len]; // default to $$ = $1
  28051. // default location, uses first token for firsts, last for lasts
  28052. yyval._$ = {
  28053. first_line: lstack[lstack.length-(len||1)].first_line,
  28054. last_line: lstack[lstack.length-1].last_line,
  28055. first_column: lstack[lstack.length-(len||1)].first_column,
  28056. last_column: lstack[lstack.length-1].last_column
  28057. };
  28058. r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
  28059. if (typeof r !== 'undefined') {
  28060. return r;
  28061. }
  28062. // pop off stack
  28063. if (len) {
  28064. stack = stack.slice(0,-1*len*2);
  28065. vstack = vstack.slice(0, -1*len);
  28066. lstack = lstack.slice(0, -1*len);
  28067. }
  28068. stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce)
  28069. vstack.push(yyval.$);
  28070. lstack.push(yyval._$);
  28071. // goto new state = table[STATE][NONTERMINAL]
  28072. newState = table[stack[stack.length-2]][stack[stack.length-1]];
  28073. stack.push(newState);
  28074. break;
  28075. case 3: // accept
  28076. return true;
  28077. }
  28078. }
  28079. return true;
  28080. }};/* Jison generated lexer */
  28081. var lexer = (function(){
  28082. var lexer = ({EOF:1,
  28083. parseError:function parseError(str, hash) {
  28084. if (this.yy.parseError) {
  28085. this.yy.parseError(str, hash);
  28086. } else {
  28087. throw new Error(str);
  28088. }
  28089. },
  28090. setInput:function (input) {
  28091. this._input = input;
  28092. this._more = this._less = this.done = false;
  28093. this.yylineno = this.yyleng = 0;
  28094. this.yytext = this.matched = this.match = '';
  28095. this.conditionStack = ['INITIAL'];
  28096. this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0};
  28097. return this;
  28098. },
  28099. input:function () {
  28100. var ch = this._input[0];
  28101. this.yytext+=ch;
  28102. this.yyleng++;
  28103. this.match+=ch;
  28104. this.matched+=ch;
  28105. var lines = ch.match(/\n/);
  28106. if (lines) this.yylineno++;
  28107. this._input = this._input.slice(1);
  28108. return ch;
  28109. },
  28110. unput:function (ch) {
  28111. this._input = ch + this._input;
  28112. return this;
  28113. },
  28114. more:function () {
  28115. this._more = true;
  28116. return this;
  28117. },
  28118. pastInput:function () {
  28119. var past = this.matched.substr(0, this.matched.length - this.match.length);
  28120. return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
  28121. },
  28122. upcomingInput:function () {
  28123. var next = this.match;
  28124. if (next.length < 20) {
  28125. next += this._input.substr(0, 20-next.length);
  28126. }
  28127. return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, "");
  28128. },
  28129. showPosition:function () {
  28130. var pre = this.pastInput();
  28131. var c = new Array(pre.length + 1).join("-");
  28132. return pre + this.upcomingInput() + "\n" + c+"^";
  28133. },
  28134. next:function () {
  28135. if (this.done) {
  28136. return this.EOF;
  28137. }
  28138. if (!this._input) this.done = true;
  28139. var token,
  28140. match,
  28141. col,
  28142. lines;
  28143. if (!this._more) {
  28144. this.yytext = '';
  28145. this.match = '';
  28146. }
  28147. var rules = this._currentRules();
  28148. for (var i=0;i < rules.length; i++) {
  28149. match = this._input.match(this.rules[rules[i]]);
  28150. if (match) {
  28151. lines = match[0].match(/\n.*/g);
  28152. if (lines) this.yylineno += lines.length;
  28153. this.yylloc = {first_line: this.yylloc.last_line,
  28154. last_line: this.yylineno+1,
  28155. first_column: this.yylloc.last_column,
  28156. last_column: lines ? lines[lines.length-1].length-1 : this.yylloc.last_column + match[0].length}
  28157. this.yytext += match[0];
  28158. this.match += match[0];
  28159. this.matches = match;
  28160. this.yyleng = this.yytext.length;
  28161. this._more = false;
  28162. this._input = this._input.slice(match[0].length);
  28163. this.matched += match[0];
  28164. token = this.performAction.call(this, this.yy, this, rules[i],this.conditionStack[this.conditionStack.length-1]);
  28165. if (token) return token;
  28166. else return;
  28167. }
  28168. }
  28169. if (this._input === "") {
  28170. return this.EOF;
  28171. } else {
  28172. this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),
  28173. {text: "", token: null, line: this.yylineno});
  28174. }
  28175. },
  28176. lex:function lex() {
  28177. var r = this.next();
  28178. if (typeof r !== 'undefined') {
  28179. return r;
  28180. } else {
  28181. return this.lex();
  28182. }
  28183. },
  28184. begin:function begin(condition) {
  28185. this.conditionStack.push(condition);
  28186. },
  28187. popState:function popState() {
  28188. return this.conditionStack.pop();
  28189. },
  28190. _currentRules:function _currentRules() {
  28191. return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;
  28192. },
  28193. topState:function () {
  28194. return this.conditionStack[this.conditionStack.length-2];
  28195. },
  28196. pushState:function begin(condition) {
  28197. this.begin(condition);
  28198. }});
  28199. lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
  28200. var YYSTATE=YY_START;
  28201. switch($avoiding_name_collisions) {
  28202. case 0:/* skip whitespace */
  28203. break;
  28204. case 1:return 20
  28205. break;
  28206. case 2:return 19
  28207. break;
  28208. case 3:return 8
  28209. break;
  28210. case 4:return 9
  28211. break;
  28212. case 5:return 6
  28213. break;
  28214. case 6:return 7
  28215. break;
  28216. case 7:return 11
  28217. break;
  28218. case 8:return 13
  28219. break;
  28220. case 9:return 10
  28221. break;
  28222. case 10:return 12
  28223. break;
  28224. case 11:return 14
  28225. break;
  28226. case 12:return 15
  28227. break;
  28228. case 13:return 16
  28229. break;
  28230. case 14:return 17
  28231. break;
  28232. case 15:return 18
  28233. break;
  28234. case 16:return 5
  28235. break;
  28236. case 17:return 'INVALID'
  28237. break;
  28238. }
  28239. };
  28240. lexer.rules = [/^\s+/,/^[0-9]+(\.[0-9]+)?\b/,/^n\b/,/^\|\|/,/^&&/,/^\?/,/^:/,/^<=/,/^>=/,/^</,/^>/,/^!=/,/^==/,/^%/,/^\(/,/^\)/,/^$/,/^./];
  28241. lexer.conditions = {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],"inclusive":true}};return lexer;})()
  28242. parser.lexer = lexer;
  28243. return parser;
  28244. })();
  28245. // End parser
  28246. // Handle node, amd, and global systems
  28247. if (typeof exports !== 'undefined') {
  28248. if (typeof module !== 'undefined' && module.exports) {
  28249. exports = module.exports = Jed;
  28250. }
  28251. exports.Jed = Jed;
  28252. }
  28253. else {
  28254. if (typeof define === 'function' && define.amd) {
  28255. define('jed',[],function() {
  28256. return Jed;
  28257. });
  28258. }
  28259. // Leak a global regardless of module system
  28260. root['Jed'] = Jed;
  28261. }
  28262. })(this);
  28263. // Copyright (c) Jupyter Development Team.
  28264. // Distributed under the terms of the Modified BSD License.
  28265. // Module to handle i18n ( Internationalization ) and translated UI
  28266. define('base/js/i18n',[
  28267. 'jed'
  28268. ], function(Jed) {
  28269. "use strict";
  28270. var i18n = new Jed(document.nbjs_translations);
  28271. i18n._ = i18n.gettext;
  28272. i18n.msg = i18n; // Just a place holder until the init promise resolves.
  28273. return i18n;
  28274. });
  28275. /*!
  28276. * Bootstrap v3.4.1 (https://getbootstrap.com/)
  28277. * Copyright 2011-2019 Twitter, Inc.
  28278. * Licensed under the MIT license
  28279. */
  28280. if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");!function(t){"use strict";var e=jQuery.fn.jquery.split(" ")[0].split(".");if(e[0]<2&&e[1]<9||1==e[0]&&9==e[1]&&e[2]<1||3<e[0])throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(),function(n){"use strict";n.fn.emulateTransitionEnd=function(t){var e=!1,i=this;n(this).one("bsTransitionEnd",function(){e=!0});return setTimeout(function(){e||n(i).trigger(n.support.transition.end)},t),this},n(function(){n.support.transition=function o(){var t=document.createElement("bootstrap"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var i in e)if(t.style[i]!==undefined)return{end:e[i]};return!1}(),n.support.transition&&(n.event.special.bsTransitionEnd={bindType:n.support.transition.end,delegateType:n.support.transition.end,handle:function(t){if(n(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}})})}(jQuery),function(s){"use strict";var e='[data-dismiss="alert"]',a=function(t){s(t).on("click",e,this.close)};a.VERSION="3.4.1",a.TRANSITION_DURATION=150,a.prototype.close=function(t){var e=s(this),i=e.attr("data-target");i||(i=(i=e.attr("href"))&&i.replace(/.*(?=#[^\s]*$)/,"")),i="#"===i?[]:i;var o=s(document).find(i);function n(){o.detach().trigger("closed.bs.alert").remove()}t&&t.preventDefault(),o.length||(o=e.closest(".alert")),o.trigger(t=s.Event("close.bs.alert")),t.isDefaultPrevented()||(o.removeClass("in"),s.support.transition&&o.hasClass("fade")?o.one("bsTransitionEnd",n).emulateTransitionEnd(a.TRANSITION_DURATION):n())};var t=s.fn.alert;s.fn.alert=function o(i){return this.each(function(){var t=s(this),e=t.data("bs.alert");e||t.data("bs.alert",e=new a(this)),"string"==typeof i&&e[i].call(t)})},s.fn.alert.Constructor=a,s.fn.alert.noConflict=function(){return s.fn.alert=t,this},s(document).on("click.bs.alert.data-api",e,a.prototype.close)}(jQuery),function(s){"use strict";var n=function(t,e){this.$element=s(t),this.options=s.extend({},n.DEFAULTS,e),this.isLoading=!1};function i(o){return this.each(function(){var t=s(this),e=t.data("bs.button"),i="object"==typeof o&&o;e||t.data("bs.button",e=new n(this,i)),"toggle"==o?e.toggle():o&&e.setState(o)})}n.VERSION="3.4.1",n.DEFAULTS={loadingText:"loading..."},n.prototype.setState=function(t){var e="disabled",i=this.$element,o=i.is("input")?"val":"html",n=i.data();t+="Text",null==n.resetText&&i.data("resetText",i[o]()),setTimeout(s.proxy(function(){i[o](null==n[t]?this.options[t]:n[t]),"loadingText"==t?(this.isLoading=!0,i.addClass(e).attr(e,e).prop(e,!0)):this.isLoading&&(this.isLoading=!1,i.removeClass(e).removeAttr(e).prop(e,!1))},this),0)},n.prototype.toggle=function(){var t=!0,e=this.$element.closest('[data-toggle="buttons"]');if(e.length){var i=this.$element.find("input");"radio"==i.prop("type")?(i.prop("checked")&&(t=!1),e.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==i.prop("type")&&(i.prop("checked")!==this.$element.hasClass("active")&&(t=!1),this.$element.toggleClass("active")),i.prop("checked",this.$element.hasClass("active")),t&&i.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var t=s.fn.button;s.fn.button=i,s.fn.button.Constructor=n,s.fn.button.noConflict=function(){return s.fn.button=t,this},s(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(t){var e=s(t.target).closest(".btn");i.call(e,"toggle"),s(t.target).is('input[type="radio"], input[type="checkbox"]')||(t.preventDefault(),e.is("input,button")?e.trigger("focus"):e.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(t){s(t.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(t.type))})}(jQuery),function(p){"use strict";var c=function(t,e){this.$element=p(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=e,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",p.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",p.proxy(this.pause,this)).on("mouseleave.bs.carousel",p.proxy(this.cycle,this))};function r(n){return this.each(function(){var t=p(this),e=t.data("bs.carousel"),i=p.extend({},c.DEFAULTS,t.data(),"object"==typeof n&&n),o="string"==typeof n?n:i.slide;e||t.data("bs.carousel",e=new c(this,i)),"number"==typeof n?e.to(n):o?e[o]():i.interval&&e.pause().cycle()})}c.VERSION="3.4.1",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(t){if(!/input|textarea/i.test(t.target.tagName)){switch(t.which){case 37:this.prev();break;case 39:this.next();break;default:return}t.preventDefault()}},c.prototype.cycle=function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(p.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(t){return this.$items=t.parent().children(".item"),this.$items.index(t||this.$active)},c.prototype.getItemForDirection=function(t,e){var i=this.getItemIndex(e);if(("prev"==t&&0===i||"next"==t&&i==this.$items.length-1)&&!this.options.wrap)return e;var o=(i+("prev"==t?-1:1))%this.$items.length;return this.$items.eq(o)},c.prototype.to=function(t){var e=this,i=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(t>this.$items.length-1||t<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){e.to(t)}):i==t?this.pause().cycle():this.slide(i<t?"next":"prev",this.$items.eq(t))},c.prototype.pause=function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&p.support.transition&&(this.$element.trigger(p.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){if(!this.sliding)return this.slide("next")},c.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},c.prototype.slide=function(t,e){var i=this.$element.find(".item.active"),o=e||this.getItemForDirection(t,i),n=this.interval,s="next"==t?"left":"right",a=this;if(o.hasClass("active"))return this.sliding=!1;var r=o[0],l=p.Event("slide.bs.carousel",{relatedTarget:r,direction:s});if(this.$element.trigger(l),!l.isDefaultPrevented()){if(this.sliding=!0,n&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var h=p(this.$indicators.children()[this.getItemIndex(o)]);h&&h.addClass("active")}var d=p.Event("slid.bs.carousel",{relatedTarget:r,direction:s});return p.support.transition&&this.$element.hasClass("slide")?(o.addClass(t),"object"==typeof o&&o.length&&o[0].offsetWidth,i.addClass(s),o.addClass(s),i.one("bsTransitionEnd",function(){o.removeClass([t,s].join(" ")).addClass("active"),i.removeClass(["active",s].join(" ")),a.sliding=!1,setTimeout(function(){a.$element.trigger(d)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(i.removeClass("active"),o.addClass("active"),this.sliding=!1,this.$element.trigger(d)),n&&this.cycle(),this}};var t=p.fn.carousel;p.fn.carousel=r,p.fn.carousel.Constructor=c,p.fn.carousel.noConflict=function(){return p.fn.carousel=t,this};var e=function(t){var e=p(this),i=e.attr("href");i&&(i=i.replace(/.*(?=#[^\s]+$)/,""));var o=e.attr("data-target")||i,n=p(document).find(o);if(n.hasClass("carousel")){var s=p.extend({},n.data(),e.data()),a=e.attr("data-slide-to");a&&(s.interval=!1),r.call(n,s),a&&n.data("bs.carousel").to(a),t.preventDefault()}};p(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),p(window).on("load",function(){p('[data-ride="carousel"]').each(function(){var t=p(this);r.call(t,t.data())})})}(jQuery),function(a){"use strict";var r=function(t,e){this.$element=a(t),this.options=a.extend({},r.DEFAULTS,e),this.$trigger=a('[data-toggle="collapse"][href="#'+t.id+'"],[data-toggle="collapse"][data-target="#'+t.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};function n(t){var e,i=t.attr("data-target")||(e=t.attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"");return a(document).find(i)}function l(o){return this.each(function(){var t=a(this),e=t.data("bs.collapse"),i=a.extend({},r.DEFAULTS,t.data(),"object"==typeof o&&o);!e&&i.toggle&&/show|hide/.test(o)&&(i.toggle=!1),e||t.data("bs.collapse",e=new r(this,i)),"string"==typeof o&&e[o]()})}r.VERSION="3.4.1",r.TRANSITION_DURATION=350,r.DEFAULTS={toggle:!0},r.prototype.dimension=function(){return this.$element.hasClass("width")?"width":"height"},r.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var t,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(t=e.data("bs.collapse"))&&t.transitioning)){var i=a.Event("show.bs.collapse");if(this.$element.trigger(i),!i.isDefaultPrevented()){e&&e.length&&(l.call(e,"hide"),t||e.data("bs.collapse",null));var o=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[o](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var n=function(){this.$element.removeClass("collapsing").addClass("collapse in")[o](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return n.call(this);var s=a.camelCase(["scroll",o].join("-"));this.$element.one("bsTransitionEnd",a.proxy(n,this)).emulateTransitionEnd(r.TRANSITION_DURATION)[o](this.$element[0][s])}}}},r.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var t=a.Event("hide.bs.collapse");if(this.$element.trigger(t),!t.isDefaultPrevented()){var e=this.dimension();this.$element[e](this.$element[e]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var i=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};if(!a.support.transition)return i.call(this);this.$element[e](0).one("bsTransitionEnd",a.proxy(i,this)).emulateTransitionEnd(r.TRANSITION_DURATION)}}},r.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},r.prototype.getParent=function(){return a(document).find(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(t,e){var i=a(e);this.addAriaAndCollapsedClass(n(i),i)},this)).end()},r.prototype.addAriaAndCollapsedClass=function(t,e){var i=t.hasClass("in");t.attr("aria-expanded",i),e.toggleClass("collapsed",!i).attr("aria-expanded",i)};var t=a.fn.collapse;a.fn.collapse=l,a.fn.collapse.Constructor=r,a.fn.collapse.noConflict=function(){return a.fn.collapse=t,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(t){var e=a(this);e.attr("data-target")||t.preventDefault();var i=n(e),o=i.data("bs.collapse")?"toggle":e.data();l.call(i,o)})}(jQuery),function(a){"use strict";var r='[data-toggle="dropdown"]',o=function(t){a(t).on("click.bs.dropdown",this.toggle)};function l(t){var e=t.attr("data-target");e||(e=(e=t.attr("href"))&&/#[A-Za-z]/.test(e)&&e.replace(/.*(?=#[^\s]*$)/,""));var i="#"!==e?a(document).find(e):null;return i&&i.length?i:t.parent()}function s(o){o&&3===o.which||(a(".dropdown-backdrop").remove(),a(r).each(function(){var t=a(this),e=l(t),i={relatedTarget:this};e.hasClass("open")&&(o&&"click"==o.type&&/input|textarea/i.test(o.target.tagName)&&a.contains(e[0],o.target)||(e.trigger(o=a.Event("hide.bs.dropdown",i)),o.isDefaultPrevented()||(t.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",i)))))}))}o.VERSION="3.4.1",o.prototype.toggle=function(t){var e=a(this);if(!e.is(".disabled, :disabled")){var i=l(e),o=i.hasClass("open");if(s(),!o){"ontouchstart"in document.documentElement&&!i.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",s);var n={relatedTarget:this};if(i.trigger(t=a.Event("show.bs.dropdown",n)),t.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),i.toggleClass("open").trigger(a.Event("shown.bs.dropdown",n))}return!1}},o.prototype.keydown=function(t){if(/(38|40|27|32)/.test(t.which)&&!/input|textarea/i.test(t.target.tagName)){var e=a(this);if(t.preventDefault(),t.stopPropagation(),!e.is(".disabled, :disabled")){var i=l(e),o=i.hasClass("open");if(!o&&27!=t.which||o&&27==t.which)return 27==t.which&&i.find(r).trigger("focus"),e.trigger("click");var n=i.find(".dropdown-menu li:not(.disabled):visible a");if(n.length){var s=n.index(t.target);38==t.which&&0<s&&s--,40==t.which&&s<n.length-1&&s++,~s||(s=0),n.eq(s).trigger("focus")}}}};var t=a.fn.dropdown;a.fn.dropdown=function e(i){return this.each(function(){var t=a(this),e=t.data("bs.dropdown");e||t.data("bs.dropdown",e=new o(this)),"string"==typeof i&&e[i].call(t)})},a.fn.dropdown.Constructor=o,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=t,this},a(document).on("click.bs.dropdown.data-api",s).on("click.bs.dropdown.data-api",".dropdown form",function(t){t.stopPropagation()}).on("click.bs.dropdown.data-api",r,o.prototype.toggle).on("keydown.bs.dropdown.data-api",r,o.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",o.prototype.keydown)}(jQuery),function(a){"use strict";var s=function(t,e){this.options=e,this.$body=a(document.body),this.$element=a(t),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.fixedContent=".navbar-fixed-top, .navbar-fixed-bottom",this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};function r(o,n){return this.each(function(){var t=a(this),e=t.data("bs.modal"),i=a.extend({},s.DEFAULTS,t.data(),"object"==typeof o&&o);e||t.data("bs.modal",e=new s(this,i)),"string"==typeof o?e[o](n):i.show&&e.show(n)})}s.VERSION="3.4.1",s.TRANSITION_DURATION=300,s.BACKDROP_TRANSITION_DURATION=150,s.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},s.prototype.toggle=function(t){return this.isShown?this.hide():this.show(t)},s.prototype.show=function(i){var o=this,t=a.Event("show.bs.modal",{relatedTarget:i});this.$element.trigger(t),this.isShown||t.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){o.$element.one("mouseup.dismiss.bs.modal",function(t){a(t.target).is(o.$element)&&(o.ignoreBackdropClick=!0)})}),this.backdrop(function(){var t=a.support.transition&&o.$element.hasClass("fade");o.$element.parent().length||o.$element.appendTo(o.$body),o.$element.show().scrollTop(0),o.adjustDialog(),t&&o.$element[0].offsetWidth,o.$element.addClass("in"),o.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:i});t?o.$dialog.one("bsTransitionEnd",function(){o.$element.trigger("focus").trigger(e)}).emulateTransitionEnd(s.TRANSITION_DURATION):o.$element.trigger("focus").trigger(e)}))},s.prototype.hide=function(t){t&&t.preventDefault(),t=a.Event("hide.bs.modal"),this.$element.trigger(t),this.isShown&&!t.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(s.TRANSITION_DURATION):this.hideModal())},s.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(t){document===t.target||this.$element[0]===t.target||this.$element.has(t.target).length||this.$element.trigger("focus")},this))},s.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",a.proxy(function(t){27==t.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},s.prototype.resize=function(){this.isShown?a(window).on("resize.bs.modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.modal")},s.prototype.hideModal=function(){var t=this;this.$element.hide(),this.backdrop(function(){t.$body.removeClass("modal-open"),t.resetAdjustments(),t.resetScrollbar(),t.$element.trigger("hidden.bs.modal")})},s.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},s.prototype.backdrop=function(t){var e=this,i=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var o=a.support.transition&&i;if(this.$backdrop=a(document.createElement("div")).addClass("modal-backdrop "+i).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(t){this.ignoreBackdropClick?this.ignoreBackdropClick=!1:t.target===t.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide())},this)),o&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!t)return;o?this.$backdrop.one("bsTransitionEnd",t).emulateTransitionEnd(s.BACKDROP_TRANSITION_DURATION):t()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var n=function(){e.removeBackdrop(),t&&t()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",n).emulateTransitionEnd(s.BACKDROP_TRANSITION_DURATION):n()}else t&&t()},s.prototype.handleUpdate=function(){this.adjustDialog()},s.prototype.adjustDialog=function(){var t=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&t?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!t?this.scrollbarWidth:""})},s.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},s.prototype.checkScrollbar=function(){var t=window.innerWidth;if(!t){var e=document.documentElement.getBoundingClientRect();t=e.right-Math.abs(e.left)}this.bodyIsOverflowing=document.body.clientWidth<t,this.scrollbarWidth=this.measureScrollbar()},s.prototype.setScrollbar=function(){var t=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"";var n=this.scrollbarWidth;this.bodyIsOverflowing&&(this.$body.css("padding-right",t+n),a(this.fixedContent).each(function(t,e){var i=e.style.paddingRight,o=a(e).css("padding-right");a(e).data("padding-right",i).css("padding-right",parseFloat(o)+n+"px")}))},s.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad),a(this.fixedContent).each(function(t,e){var i=a(e).data("padding-right");a(e).removeData("padding-right"),e.style.paddingRight=i||""})},s.prototype.measureScrollbar=function(){var t=document.createElement("div");t.className="modal-scrollbar-measure",this.$body.append(t);var e=t.offsetWidth-t.clientWidth;return this.$body[0].removeChild(t),e};var t=a.fn.modal;a.fn.modal=r,a.fn.modal.Constructor=s,a.fn.modal.noConflict=function(){return a.fn.modal=t,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(t){var e=a(this),i=e.attr("href"),o=e.attr("data-target")||i&&i.replace(/.*(?=#[^\s]+$)/,""),n=a(document).find(o),s=n.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(i)&&i},n.data(),e.data());e.is("a")&&t.preventDefault(),n.one("show.bs.modal",function(t){t.isDefaultPrevented()||n.one("hidden.bs.modal",function(){e.is(":visible")&&e.trigger("focus")})}),r.call(n,s,this)})}(jQuery),function(g){"use strict";var o=["sanitize","whiteList","sanitizeFn"],a=["background","cite","href","itemtype","longdesc","poster","src","xlink:href"],t={"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},r=/^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi,l=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;function u(t,e){var i=t.nodeName.toLowerCase();if(-1!==g.inArray(i,e))return-1===g.inArray(i,a)||Boolean(t.nodeValue.match(r)||t.nodeValue.match(l));for(var o=g(e).filter(function(t,e){return e instanceof RegExp}),n=0,s=o.length;n<s;n++)if(i.match(o[n]))return!0;return!1}function n(t,e,i){if(0===t.length)return t;if(i&&"function"==typeof i)return i(t);if(!document.implementation||!document.implementation.createHTMLDocument)return t;var o=document.implementation.createHTMLDocument("sanitization");o.body.innerHTML=t;for(var n=g.map(e,function(t,e){return e}),s=g(o.body).find("*"),a=0,r=s.length;a<r;a++){var l=s[a],h=l.nodeName.toLowerCase();if(-1!==g.inArray(h,n))for(var d=g.map(l.attributes,function(t){return t}),p=[].concat(e["*"]||[],e[h]||[]),c=0,f=d.length;c<f;c++)u(d[c],p)||l.removeAttribute(d[c].nodeName);else l.parentNode.removeChild(l)}return o.body.innerHTML}var m=function(t,e){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",t,e)};m.VERSION="3.4.1",m.TRANSITION_DURATION=150,m.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0},sanitize:!0,sanitizeFn:null,whiteList:t},m.prototype.init=function(t,e,i){if(this.enabled=!0,this.type=t,this.$element=g(e),this.options=this.getOptions(i),this.$viewport=this.options.viewport&&g(document).find(g.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var o=this.options.trigger.split(" "),n=o.length;n--;){var s=o[n];if("click"==s)this.$element.on("click."+this.type,this.options.selector,g.proxy(this.toggle,this));else if("manual"!=s){var a="hover"==s?"mouseenter":"focusin",r="hover"==s?"mouseleave":"focusout";this.$element.on(a+"."+this.type,this.options.selector,g.proxy(this.enter,this)),this.$element.on(r+"."+this.type,this.options.selector,g.proxy(this.leave,this))}}this.options.selector?this._options=g.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},m.prototype.getDefaults=function(){return m.DEFAULTS},m.prototype.getOptions=function(t){var e=this.$element.data();for(var i in e)e.hasOwnProperty(i)&&-1!==g.inArray(i,o)&&delete e[i];return(t=g.extend({},this.getDefaults(),e,t)).delay&&"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),t.sanitize&&(t.template=n(t.template,t.whiteList,t.sanitizeFn)),t},m.prototype.getDelegateOptions=function(){var i={},o=this.getDefaults();return this._options&&g.each(this._options,function(t,e){o[t]!=e&&(i[t]=e)}),i},m.prototype.enter=function(t){var e=t instanceof this.constructor?t:g(t.currentTarget).data("bs."+this.type);if(e||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e)),t instanceof g.Event&&(e.inState["focusin"==t.type?"focus":"hover"]=!0),e.tip().hasClass("in")||"in"==e.hoverState)e.hoverState="in";else{if(clearTimeout(e.timeout),e.hoverState="in",!e.options.delay||!e.options.delay.show)return e.show();e.timeout=setTimeout(function(){"in"==e.hoverState&&e.show()},e.options.delay.show)}},m.prototype.isInStateTrue=function(){for(var t in this.inState)if(this.inState[t])return!0;return!1},m.prototype.leave=function(t){var e=t instanceof this.constructor?t:g(t.currentTarget).data("bs."+this.type);if(e||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e)),t instanceof g.Event&&(e.inState["focusout"==t.type?"focus":"hover"]=!1),!e.isInStateTrue()){if(clearTimeout(e.timeout),e.hoverState="out",!e.options.delay||!e.options.delay.hide)return e.hide();e.timeout=setTimeout(function(){"out"==e.hoverState&&e.hide()},e.options.delay.hide)}},m.prototype.show=function(){var t=g.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(t);var e=g.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(t.isDefaultPrevented()||!e)return;var i=this,o=this.tip(),n=this.getUID(this.type);this.setContent(),o.attr("id",n),this.$element.attr("aria-describedby",n),this.options.animation&&o.addClass("fade");var s="function"==typeof this.options.placement?this.options.placement.call(this,o[0],this.$element[0]):this.options.placement,a=/\s?auto?\s?/i,r=a.test(s);r&&(s=s.replace(a,"")||"top"),o.detach().css({top:0,left:0,display:"block"}).addClass(s).data("bs."+this.type,this),this.options.container?o.appendTo(g(document).find(this.options.container)):o.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var l=this.getPosition(),h=o[0].offsetWidth,d=o[0].offsetHeight;if(r){var p=s,c=this.getPosition(this.$viewport);s="bottom"==s&&l.bottom+d>c.bottom?"top":"top"==s&&l.top-d<c.top?"bottom":"right"==s&&l.right+h>c.width?"left":"left"==s&&l.left-h<c.left?"right":s,o.removeClass(p).addClass(s)}var f=this.getCalculatedOffset(s,l,h,d);this.applyPlacement(f,s);var u=function(){var t=i.hoverState;i.$element.trigger("shown.bs."+i.type),i.hoverState=null,"out"==t&&i.leave(i)};g.support.transition&&this.$tip.hasClass("fade")?o.one("bsTransitionEnd",u).emulateTransitionEnd(m.TRANSITION_DURATION):u()}},m.prototype.applyPlacement=function(t,e){var i=this.tip(),o=i[0].offsetWidth,n=i[0].offsetHeight,s=parseInt(i.css("margin-top"),10),a=parseInt(i.css("margin-left"),10);isNaN(s)&&(s=0),isNaN(a)&&(a=0),t.top+=s,t.left+=a,g.offset.setOffset(i[0],g.extend({using:function(t){i.css({top:Math.round(t.top),left:Math.round(t.left)})}},t),0),i.addClass("in");var r=i[0].offsetWidth,l=i[0].offsetHeight;"top"==e&&l!=n&&(t.top=t.top+n-l);var h=this.getViewportAdjustedDelta(e,t,r,l);h.left?t.left+=h.left:t.top+=h.top;var d=/top|bottom/.test(e),p=d?2*h.left-o+r:2*h.top-n+l,c=d?"offsetWidth":"offsetHeight";i.offset(t),this.replaceArrow(p,i[0][c],d)},m.prototype.replaceArrow=function(t,e,i){this.arrow().css(i?"left":"top",50*(1-t/e)+"%").css(i?"top":"left","")},m.prototype.setContent=function(){var t=this.tip(),e=this.getTitle();this.options.html?(this.options.sanitize&&(e=n(e,this.options.whiteList,this.options.sanitizeFn)),t.find(".tooltip-inner").html(e)):t.find(".tooltip-inner").text(e),t.removeClass("fade in top bottom left right")},m.prototype.hide=function(t){var e=this,i=g(this.$tip),o=g.Event("hide.bs."+this.type);function n(){"in"!=e.hoverState&&i.detach(),e.$element&&e.$element.removeAttr("aria-describedby").trigger("hidden.bs."+e.type),t&&t()}if(this.$element.trigger(o),!o.isDefaultPrevented())return i.removeClass("in"),g.support.transition&&i.hasClass("fade")?i.one("bsTransitionEnd",n).emulateTransitionEnd(m.TRANSITION_DURATION):n(),this.hoverState=null,this},m.prototype.fixTitle=function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("data-original-title"))&&t.attr("data-original-title",t.attr("title")||"").attr("title","")},m.prototype.hasContent=function(){return this.getTitle()},m.prototype.getPosition=function(t){var e=(t=t||this.$element)[0],i="BODY"==e.tagName,o=e.getBoundingClientRect();null==o.width&&(o=g.extend({},o,{width:o.right-o.left,height:o.bottom-o.top}));var n=window.SVGElement&&e instanceof window.SVGElement,s=i?{top:0,left:0}:n?null:t.offset(),a={scroll:i?document.documentElement.scrollTop||document.body.scrollTop:t.scrollTop()},r=i?{width:g(window).width(),height:g(window).height()}:null;return g.extend({},o,a,r,s)},m.prototype.getCalculatedOffset=function(t,e,i,o){return"bottom"==t?{top:e.top+e.height,left:e.left+e.width/2-i/2}:"top"==t?{top:e.top-o,left:e.left+e.width/2-i/2}:"left"==t?{top:e.top+e.height/2-o/2,left:e.left-i}:{top:e.top+e.height/2-o/2,left:e.left+e.width}},m.prototype.getViewportAdjustedDelta=function(t,e,i,o){var n={top:0,left:0};if(!this.$viewport)return n;var s=this.options.viewport&&this.options.viewport.padding||0,a=this.getPosition(this.$viewport);if(/right|left/.test(t)){var r=e.top-s-a.scroll,l=e.top+s-a.scroll+o;r<a.top?n.top=a.top-r:l>a.top+a.height&&(n.top=a.top+a.height-l)}else{var h=e.left-s,d=e.left+s+i;h<a.left?n.left=a.left-h:d>a.right&&(n.left=a.left+a.width-d)}return n},m.prototype.getTitle=function(){var t=this.$element,e=this.options;return t.attr("data-original-title")||("function"==typeof e.title?e.title.call(t[0]):e.title)},m.prototype.getUID=function(t){for(;t+=~~(1e6*Math.random()),document.getElementById(t););return t},m.prototype.tip=function(){if(!this.$tip&&(this.$tip=g(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},m.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},m.prototype.enable=function(){this.enabled=!0},m.prototype.disable=function(){this.enabled=!1},m.prototype.toggleEnabled=function(){this.enabled=!this.enabled},m.prototype.toggle=function(t){var e=this;t&&((e=g(t.currentTarget).data("bs."+this.type))||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e))),t?(e.inState.click=!e.inState.click,e.isInStateTrue()?e.enter(e):e.leave(e)):e.tip().hasClass("in")?e.leave(e):e.enter(e)},m.prototype.destroy=function(){var t=this;clearTimeout(this.timeout),this.hide(function(){t.$element.off("."+t.type).removeData("bs."+t.type),t.$tip&&t.$tip.detach(),t.$tip=null,t.$arrow=null,t.$viewport=null,t.$element=null})},m.prototype.sanitizeHtml=function(t){return n(t,this.options.whiteList,this.options.sanitizeFn)};var e=g.fn.tooltip;g.fn.tooltip=function i(o){return this.each(function(){var t=g(this),e=t.data("bs.tooltip"),i="object"==typeof o&&o;!e&&/destroy|hide/.test(o)||(e||t.data("bs.tooltip",e=new m(this,i)),"string"==typeof o&&e[o]())})},g.fn.tooltip.Constructor=m,g.fn.tooltip.noConflict=function(){return g.fn.tooltip=e,this}}(jQuery),function(n){"use strict";var s=function(t,e){this.init("popover",t,e)};if(!n.fn.tooltip)throw new Error("Popover requires tooltip.js");s.VERSION="3.4.1",s.DEFAULTS=n.extend({},n.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),((s.prototype=n.extend({},n.fn.tooltip.Constructor.prototype)).constructor=s).prototype.getDefaults=function(){return s.DEFAULTS},s.prototype.setContent=function(){var t=this.tip(),e=this.getTitle(),i=this.getContent();if(this.options.html){var o=typeof i;this.options.sanitize&&(e=this.sanitizeHtml(e),"string"===o&&(i=this.sanitizeHtml(i))),t.find(".popover-title").html(e),t.find(".popover-content").children().detach().end()["string"===o?"html":"append"](i)}else t.find(".popover-title").text(e),t.find(".popover-content").children().detach().end().text(i);t.removeClass("fade top bottom left right in"),t.find(".popover-title").html()||t.find(".popover-title").hide()},s.prototype.hasContent=function(){return this.getTitle()||this.getContent()},s.prototype.getContent=function(){var t=this.$element,e=this.options;return t.attr("data-content")||("function"==typeof e.content?e.content.call(t[0]):e.content)},s.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var t=n.fn.popover;n.fn.popover=function e(o){return this.each(function(){var t=n(this),e=t.data("bs.popover"),i="object"==typeof o&&o;!e&&/destroy|hide/.test(o)||(e||t.data("bs.popover",e=new s(this,i)),"string"==typeof o&&e[o]())})},n.fn.popover.Constructor=s,n.fn.popover.noConflict=function(){return n.fn.popover=t,this}}(jQuery),function(s){"use strict";function n(t,e){this.$body=s(document.body),this.$scrollElement=s(t).is(document.body)?s(window):s(t),this.options=s.extend({},n.DEFAULTS,e),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",s.proxy(this.process,this)),this.refresh(),this.process()}function e(o){return this.each(function(){var t=s(this),e=t.data("bs.scrollspy"),i="object"==typeof o&&o;e||t.data("bs.scrollspy",e=new n(this,i)),"string"==typeof o&&e[o]()})}n.VERSION="3.4.1",n.DEFAULTS={offset:10},n.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},n.prototype.refresh=function(){var t=this,o="offset",n=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),s.isWindow(this.$scrollElement[0])||(o="position",n=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var t=s(this),e=t.data("target")||t.attr("href"),i=/^#./.test(e)&&s(e);return i&&i.length&&i.is(":visible")&&[[i[o]().top+n,e]]||null}).sort(function(t,e){return t[0]-e[0]}).each(function(){t.offsets.push(this[0]),t.targets.push(this[1])})},n.prototype.process=function(){var t,e=this.$scrollElement.scrollTop()+this.options.offset,i=this.getScrollHeight(),o=this.options.offset+i-this.$scrollElement.height(),n=this.offsets,s=this.targets,a=this.activeTarget;if(this.scrollHeight!=i&&this.refresh(),o<=e)return a!=(t=s[s.length-1])&&this.activate(t);if(a&&e<n[0])return this.activeTarget=null,this.clear();for(t=n.length;t--;)a!=s[t]&&e>=n[t]&&(n[t+1]===undefined||e<n[t+1])&&this.activate(s[t])},n.prototype.activate=function(t){this.activeTarget=t,this.clear();var e=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',i=s(e).parents("li").addClass("active");i.parent(".dropdown-menu").length&&(i=i.closest("li.dropdown").addClass("active")),i.trigger("activate.bs.scrollspy")},n.prototype.clear=function(){s(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var t=s.fn.scrollspy;s.fn.scrollspy=e,s.fn.scrollspy.Constructor=n,s.fn.scrollspy.noConflict=function(){return s.fn.scrollspy=t,this},s(window).on("load.bs.scrollspy.data-api",function(){s('[data-spy="scroll"]').each(function(){var t=s(this);e.call(t,t.data())})})}(jQuery),function(r){"use strict";var a=function(t){this.element=r(t)};function e(i){return this.each(function(){var t=r(this),e=t.data("bs.tab");e||t.data("bs.tab",e=new a(this)),"string"==typeof i&&e[i]()})}a.VERSION="3.4.1",a.TRANSITION_DURATION=150,a.prototype.show=function(){var t=this.element,e=t.closest("ul:not(.dropdown-menu)"),i=t.data("target");if(i||(i=(i=t.attr("href"))&&i.replace(/.*(?=#[^\s]*$)/,"")),!t.parent("li").hasClass("active")){var o=e.find(".active:last a"),n=r.Event("hide.bs.tab",{relatedTarget:t[0]}),s=r.Event("show.bs.tab",{relatedTarget:o[0]});if(o.trigger(n),t.trigger(s),!s.isDefaultPrevented()&&!n.isDefaultPrevented()){var a=r(document).find(i);this.activate(t.closest("li"),e),this.activate(a,a.parent(),function(){o.trigger({type:"hidden.bs.tab",relatedTarget:t[0]}),t.trigger({type:"shown.bs.tab",relatedTarget:o[0]})})}}},a.prototype.activate=function(t,e,i){var o=e.find("> .active"),n=i&&r.support.transition&&(o.length&&o.hasClass("fade")||!!e.find("> .fade").length);function s(){o.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),t.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),n?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu").length&&t.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),i&&i()}o.length&&n?o.one("bsTransitionEnd",s).emulateTransitionEnd(a.TRANSITION_DURATION):s(),o.removeClass("in")};var t=r.fn.tab;r.fn.tab=e,r.fn.tab.Constructor=a,r.fn.tab.noConflict=function(){return r.fn.tab=t,this};var i=function(t){t.preventDefault(),e.call(r(this),"show")};r(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',i).on("click.bs.tab.data-api",'[data-toggle="pill"]',i)}(jQuery),function(l){"use strict";var h=function(t,e){this.options=l.extend({},h.DEFAULTS,e);var i=this.options.target===h.DEFAULTS.target?l(this.options.target):l(document).find(this.options.target);this.$target=i.on("scroll.bs.affix.data-api",l.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",l.proxy(this.checkPositionWithEventLoop,this)),this.$element=l(t),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};function i(o){return this.each(function(){var t=l(this),e=t.data("bs.affix"),i="object"==typeof o&&o;e||t.data("bs.affix",e=new h(this,i)),"string"==typeof o&&e[o]()})}h.VERSION="3.4.1",h.RESET="affix affix-top affix-bottom",h.DEFAULTS={offset:0,target:window},h.prototype.getState=function(t,e,i,o){var n=this.$target.scrollTop(),s=this.$element.offset(),a=this.$target.height();if(null!=i&&"top"==this.affixed)return n<i&&"top";if("bottom"==this.affixed)return null!=i?!(n+this.unpin<=s.top)&&"bottom":!(n+a<=t-o)&&"bottom";var r=null==this.affixed,l=r?n:s.top;return null!=i&&n<=i?"top":null!=o&&t-o<=l+(r?a:e)&&"bottom"},h.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(h.RESET).addClass("affix");var t=this.$target.scrollTop(),e=this.$element.offset();return this.pinnedOffset=e.top-t},h.prototype.checkPositionWithEventLoop=function(){setTimeout(l.proxy(this.checkPosition,this),1)},h.prototype.checkPosition=function(){if(this.$element.is(":visible")){var t=this.$element.height(),e=this.options.offset,i=e.top,o=e.bottom,n=Math.max(l(document).height(),l(document.body).height());"object"!=typeof e&&(o=i=e),"function"==typeof i&&(i=e.top(this.$element)),"function"==typeof o&&(o=e.bottom(this.$element));var s=this.getState(n,t,i,o);if(this.affixed!=s){null!=this.unpin&&this.$element.css("top","");var a="affix"+(s?"-"+s:""),r=l.Event(a+".bs.affix");if(this.$element.trigger(r),r.isDefaultPrevented())return;this.affixed=s,this.unpin="bottom"==s?this.getPinnedOffset():null,this.$element.removeClass(h.RESET).addClass(a).trigger(a.replace("affix","affixed")+".bs.affix")}"bottom"==s&&this.$element.offset({top:n-t-o})}};var t=l.fn.affix;l.fn.affix=i,l.fn.affix.Constructor=h,l.fn.affix.noConflict=function(){return l.fn.affix=t,this},l(window).on("load",function(){l('[data-spy="affix"]').each(function(){var t=l(this),e=t.data();e.offset=e.offset||{},null!=e.offsetBottom&&(e.offset.bottom=e.offsetBottom),null!=e.offsetTop&&(e.offset.top=e.offsetTop),i.call(t,e)})})}(jQuery);
  28281. define("bootstrap", ["jquery"], (function (global) {
  28282. return function () {
  28283. var ret, fn;
  28284. return ret || global.bootstrap;
  28285. };
  28286. }(this)));
  28287. // Copyright (c) Jupyter Development Team.
  28288. // Distributed under the terms of the Modified BSD License.
  28289. define('base/js/dialog',['jquery',
  28290. 'codemirror/lib/codemirror',
  28291. 'bootstrap',
  28292. 'base/js/i18n'],
  28293. function($, CodeMirror, bs, i18n) {
  28294. "use strict";
  28295. /**
  28296. * A wrapper around bootstrap modal for easier use
  28297. * Pass it an option dictionary with the following properties:
  28298. *
  28299. * - body : <string> or <DOM node>, main content of the dialog
  28300. * if pass a <string> it will be wrapped in a p tag and
  28301. * html element escaped, unless you specify sanitize=false
  28302. * option.
  28303. * - title : Dialog title, default to empty string.
  28304. * - buttons : dict of btn_options who keys are button label.
  28305. * see btn_options below for description
  28306. * - open : callback to trigger on dialog open.
  28307. * - destroy:
  28308. * - notebook : notebook instance
  28309. * - keyboard_manager: keyboard manager instance.
  28310. *
  28311. * Unlike bootstrap modals, the backdrop options is set by default
  28312. * to 'static'.
  28313. *
  28314. * The rest of the options are passed as is to bootstrap modals.
  28315. *
  28316. * btn_options: dict with the following property:
  28317. *
  28318. * - click : callback to trigger on click
  28319. * - class : css classes to add to button.
  28320. *
  28321. *
  28322. *
  28323. **/
  28324. var modal = function (options) {
  28325. var modal = $("<div/>")
  28326. .addClass("modal")
  28327. .addClass("fade")
  28328. .attr("role", "dialog");
  28329. var dialog = $("<div/>")
  28330. .addClass("modal-dialog")
  28331. .appendTo(modal);
  28332. var dialog_content = $("<div/>")
  28333. .addClass("modal-content")
  28334. .appendTo(dialog);
  28335. if(typeof(options.body) === 'string' && options.sanitize !== false){
  28336. options.body = $("<p/>").text(options.body);
  28337. }
  28338. dialog_content.append(
  28339. $("<div/>")
  28340. .addClass("modal-header")
  28341. .mousedown(function() {
  28342. $(".modal").draggable({handle: '.modal-header'});
  28343. })
  28344. .append($("<button>")
  28345. .attr("type", "button")
  28346. .attr("aria-label", i18n.msg._("close"))
  28347. .addClass("close")
  28348. .attr("data-dismiss", "modal")
  28349. .attr("aria-hidden", "true")
  28350. .html("&times;")
  28351. ).append(
  28352. $("<h4/>")
  28353. .addClass('modal-title')
  28354. .text(options.title || "")
  28355. )
  28356. ).append(
  28357. $("<div/>")
  28358. .addClass("modal-body")
  28359. .append(
  28360. options.body || $("<p/>")
  28361. )
  28362. );
  28363. var footer = $("<div/>").addClass("modal-footer");
  28364. var default_button;
  28365. for (var label in options.buttons) {
  28366. var btn_opts = options.buttons[label];
  28367. var button = $("<button/>")
  28368. .addClass("btn btn-default btn-sm")
  28369. .attr("data-dismiss", "modal")
  28370. .text(i18n.msg.translate(label).fetch());
  28371. if (btn_opts.id) {
  28372. button.attr('id', btn_opts.id);
  28373. }
  28374. if (btn_opts.click) {
  28375. button.click($.proxy(btn_opts.click, dialog_content));
  28376. }
  28377. if (btn_opts.class) {
  28378. button.addClass(btn_opts.class);
  28379. }
  28380. footer.append(button);
  28381. if (options.default_button && label === options.default_button) {
  28382. default_button = button;
  28383. }
  28384. }
  28385. if (!options.default_button) {
  28386. default_button = footer.find("button").last();
  28387. }
  28388. dialog_content.append(footer);
  28389. // hook up on-open event
  28390. modal.on("shown.bs.modal", function () {
  28391. setTimeout(function () {
  28392. default_button.focus();
  28393. if (options.open) {
  28394. $.proxy(options.open, modal)();
  28395. }
  28396. }, 0);
  28397. });
  28398. // destroy modal on hide, unless explicitly asked not to
  28399. if (options.destroy === undefined || options.destroy) {
  28400. modal.on("hidden.bs.modal", function () {
  28401. modal.remove();
  28402. });
  28403. }
  28404. modal.on("hidden.bs.modal", function () {
  28405. if (options.notebook) {
  28406. var cell = options.notebook.get_selected_cell();
  28407. if (cell) cell.select();
  28408. }
  28409. if (options.keyboard_manager) {
  28410. options.keyboard_manager.enable();
  28411. options.keyboard_manager.command_mode();
  28412. }
  28413. if (options.focus_button) {
  28414. $(options.focus_button).focus();
  28415. }
  28416. });
  28417. if (options.keyboard_manager) {
  28418. options.keyboard_manager.disable();
  28419. }
  28420. if(options.backdrop === undefined){
  28421. options.backdrop = 'static';
  28422. }
  28423. return modal.modal(options);
  28424. };
  28425. var kernel_modal = function (options) {
  28426. /**
  28427. * only one kernel dialog should be open at a time -- but
  28428. * other modal dialogs can still be open
  28429. */
  28430. $('.kernel-modal').modal('hide');
  28431. var dialog = modal(options);
  28432. dialog.addClass('kernel-modal');
  28433. return dialog;
  28434. };
  28435. var edit_metadata = function (options) {
  28436. options.name = options.name || "Cell";
  28437. var error_div = $('<div/>').css('color', 'red');
  28438. var message_cell =
  28439. i18n.msg._("Manually edit the JSON below to manipulate the metadata for this cell.");
  28440. var message_notebook =
  28441. i18n.msg._("Manually edit the JSON below to manipulate the metadata for this notebook.");
  28442. var message_end =
  28443. i18n.msg._(" We recommend putting custom metadata attributes in an appropriately named substructure," +
  28444. " so they don't conflict with those of others.");
  28445. var message;
  28446. if (options.name === 'Notebook') {
  28447. message = message_notebook + message_end;
  28448. } else {
  28449. message = message_cell + message_end;
  28450. }
  28451. var textarea = $('<textarea/>')
  28452. .attr('rows', '13')
  28453. .attr('cols', '80')
  28454. .attr('name', 'metadata')
  28455. .text(JSON.stringify(options.md || {}, null, 2));
  28456. var dialogform = $('<div/>').attr('title', i18n.msg._('Edit the metadata'))
  28457. .append(
  28458. $('<form/>').append(
  28459. $('<fieldset/>').append(
  28460. $('<label/>')
  28461. .attr('for','metadata')
  28462. .text(message)
  28463. )
  28464. .append(error_div)
  28465. .append($('<br/>'))
  28466. .append(textarea)
  28467. )
  28468. );
  28469. var editor = CodeMirror.fromTextArea(textarea[0], {
  28470. lineNumbers: true,
  28471. matchBrackets: true,
  28472. indentUnit: 2,
  28473. autoIndent: true,
  28474. mode: 'application/json',
  28475. });
  28476. var title_msg;
  28477. if (options.name === "Notebook") {
  28478. title_msg = i18n.msg._("Edit Notebook Metadata");
  28479. } else {
  28480. title_msg = i18n.msg._("Edit Cell Metadata");
  28481. }
  28482. // This statement is used simply so that message extraction
  28483. // will pick up the strings.
  28484. var button_labels = [ i18n.msg._("Cancel"), i18n.msg._("Edit"), i18n.msg._("OK"), i18n.msg._("Apply")];
  28485. var modal_obj = modal({
  28486. title: title_msg,
  28487. body: dialogform,
  28488. default_button: "Cancel",
  28489. buttons: {
  28490. Cancel: {},
  28491. Edit: { class : "btn-primary",
  28492. click: function() {
  28493. /**
  28494. * validate json and set it
  28495. */
  28496. var new_md;
  28497. try {
  28498. new_md = JSON.parse(editor.getValue());
  28499. } catch(e) {
  28500. console.log(e);
  28501. error_div.text(i18n.msg._('WARNING: Could not save invalid JSON.'));
  28502. return false;
  28503. }
  28504. options.callback(new_md);
  28505. options.notebook.apply_directionality();
  28506. }
  28507. }
  28508. },
  28509. notebook: options.notebook,
  28510. keyboard_manager: options.keyboard_manager,
  28511. });
  28512. modal_obj.on('shown.bs.modal', function(){ editor.refresh(); });
  28513. modal_obj.on('hide.bs.modal', function(){
  28514. options.edit_metadata_button ? options.edit_metadata_button.focus() : "";});
  28515. };
  28516. var edit_attachments = function (options) {
  28517. // This shows the Edit Attachments dialog. This dialog allows the
  28518. // user to delete attachments. We show a list of attachments to
  28519. // the user and he can mark some of them for deletion. The deletion
  28520. // is applied when the 'Apply' button of this dialog is pressed.
  28521. var message;
  28522. var attachments_list;
  28523. if (Object.keys(options.attachments).length == 0) {
  28524. message = i18n.msg._("There are no attachments for this cell.");
  28525. attachments_list = $('<div>');
  28526. } else {
  28527. message = i18n.msg._("Current cell attachments");
  28528. attachments_list = $('<div>')
  28529. .addClass('list_container')
  28530. .append(
  28531. $('<div>')
  28532. .addClass('row list_header')
  28533. .append(
  28534. $('<div>')
  28535. .text(i18n.msg._('Attachments'))
  28536. )
  28537. );
  28538. // This is a set containing keys of attachments to be deleted when
  28539. // the Apply button is clicked
  28540. var to_delete = {};
  28541. var refresh_attachments_list = function() {
  28542. $(attachments_list).find('.row').remove();
  28543. for (var key in options.attachments) {
  28544. var mime = Object.keys(options.attachments[key])[0];
  28545. var deleted = key in to_delete;
  28546. // This ensures the current value of key is captured since
  28547. // javascript only has function scope
  28548. var btn;
  28549. // Trash/restore button
  28550. (function(){
  28551. var _key = key;
  28552. btn = $('<button>')
  28553. .addClass('btn btn-default btn-xs')
  28554. .css('display', 'inline-block');
  28555. if (deleted) {
  28556. btn.attr('title', i18n.msg._('Restore'))
  28557. .append(
  28558. $('<i>')
  28559. .addClass('fa fa-plus')
  28560. );
  28561. btn.click(function() {
  28562. delete to_delete[_key];
  28563. refresh_attachments_list();
  28564. });
  28565. } else {
  28566. btn.attr('title', i18n.msg._('Delete'))
  28567. .addClass('btn-danger')
  28568. .append(
  28569. $('<i>')
  28570. .addClass('fa fa-trash')
  28571. );
  28572. btn.click(function() {
  28573. to_delete[_key] = true;
  28574. refresh_attachments_list();
  28575. });
  28576. }
  28577. return btn;
  28578. })();
  28579. var row = $('<div>')
  28580. .addClass('col-md-12 att_row')
  28581. .append(
  28582. $('<div>')
  28583. .addClass('row')
  28584. .append(
  28585. $('<div>')
  28586. .addClass('att-name col-xs-4')
  28587. .text(key)
  28588. )
  28589. .append(
  28590. $('<div>')
  28591. .addClass('col-xs-4 text-muted')
  28592. .text(mime)
  28593. )
  28594. .append(
  28595. $('<div>')
  28596. .addClass('item-buttons pull-right')
  28597. .append(btn)
  28598. )
  28599. );
  28600. if (deleted) {
  28601. row.find('.att-name')
  28602. .css('text-decoration', 'line-through');
  28603. }
  28604. attachments_list.append($('<div>')
  28605. .addClass('list_item row')
  28606. .append(row)
  28607. );
  28608. }
  28609. };
  28610. refresh_attachments_list();
  28611. }
  28612. var dialogform = $('<div/>')
  28613. .attr('title', i18n.msg._('Edit attachments'))
  28614. .append(message)
  28615. .append('<br />')
  28616. .append(attachments_list);
  28617. var title_msg;
  28618. if ( options.name === "Notebook" ) {
  28619. title_msg = i18n.msg._("Edit Notebook Attachments");
  28620. } else {
  28621. title_msg = i18n.msg._("Edit Cell Attachments");
  28622. }
  28623. var modal_obj = modal({
  28624. title: title_msg,
  28625. body: dialogform,
  28626. buttons: {
  28627. Apply: { class : "btn-primary",
  28628. click: function() {
  28629. for (var key in to_delete) {
  28630. delete options.attachments[key];
  28631. }
  28632. options.callback(options.attachments);
  28633. }
  28634. },
  28635. Cancel: {}
  28636. },
  28637. notebook: options.notebook,
  28638. keyboard_manager: options.keyboard_manager,
  28639. });
  28640. };
  28641. var insert_image = function (options) {
  28642. var message =
  28643. i18n.msg._("Select a file to insert.");
  28644. var file_input = $('<input/>')
  28645. .attr('type', 'file')
  28646. .attr('accept', 'image/*')
  28647. .attr('name', 'file')
  28648. .on('change', function(file) {
  28649. var $btn = $(modal_obj).find('#btn_ok');
  28650. if (this.files.length > 0) {
  28651. $btn.removeClass('disabled');
  28652. } else {
  28653. $btn.addClass('disabled');
  28654. }
  28655. });
  28656. var dialogform = $('<div/>').attr('title', i18n.msg._('Edit attachments'))
  28657. .append(
  28658. $('<form id="insert-image-form" />').append(
  28659. $('<fieldset/>').append(
  28660. $('<label/>')
  28661. .attr('for','file')
  28662. .text(message)
  28663. )
  28664. .append($('<br/>'))
  28665. .append(file_input)
  28666. )
  28667. );
  28668. var modal_obj = modal({
  28669. title: i18n.msg._("Select a file"),
  28670. body: dialogform,
  28671. buttons: {
  28672. OK: {
  28673. id : 'btn_ok',
  28674. class : "btn-primary disabled",
  28675. click: function() {
  28676. options.callback(file_input[0].files[0]);
  28677. }
  28678. },
  28679. Cancel: {}
  28680. },
  28681. notebook: options.notebook,
  28682. keyboard_manager: options.keyboard_manager,
  28683. });
  28684. };
  28685. var dialog = {
  28686. modal : modal,
  28687. kernel_modal : kernel_modal,
  28688. edit_metadata : edit_metadata,
  28689. edit_attachments : edit_attachments,
  28690. insert_image : insert_image
  28691. };
  28692. return dialog;
  28693. });
  28694. // Copyright (c) Jupyter Development Team.
  28695. // Distributed under the terms of the Modified BSD License.
  28696. define('base/js/mathjaxutils',[
  28697. 'jquery',
  28698. 'base/js/utils',
  28699. 'base/js/i18n',
  28700. 'base/js/dialog',
  28701. ], function($, utils, i18n, dialog) {
  28702. "use strict";
  28703. var init = function () {
  28704. if (window.MathJax) {
  28705. // MathJax loaded
  28706. MathJax.Hub.Config({
  28707. tex2jax: {
  28708. inlineMath: [ ['$','$'], ["\\(","\\)"] ],
  28709. displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
  28710. processEscapes: true,
  28711. processEnvironments: true
  28712. },
  28713. TeX: {
  28714. extensions: ['newcommand.js', 'begingroup.js'] // For \gdef
  28715. },
  28716. MathML: {
  28717. extensions: ['content-mathml.js']
  28718. },
  28719. // Center justify equations in code and markdown cells. Elsewhere
  28720. // we use CSS to left justify single line equations in code cells.
  28721. displayAlign: 'center',
  28722. "HTML-CSS": {
  28723. availableFonts: [],
  28724. imageFont: null,
  28725. preferredFont: null,
  28726. webFont: "STIX-Web",
  28727. styles: {'.MathJax_Display': {"margin": 0}},
  28728. linebreaks: { automatic: true }
  28729. },
  28730. });
  28731. MathJax.Hub.Configured();
  28732. } else if (window.mathjax_url !== "") {
  28733. // This statement is used simply so that message extraction
  28734. // will pick up the strings. The actual setting of the text
  28735. // for the button is in dialog.js.
  28736. var button_labels = [ i18n.msg._("OK") ];
  28737. // Don't have MathJax, but should. Show dialog.
  28738. dialog.modal({
  28739. title : i18n.msg.sprintf(i18n.msg._("Failed to retrieve MathJax from '%s'",window.mathjax_url)),
  28740. body : $("<p/>").addClass('dialog').text(
  28741. i18n.msg._("Math/LaTeX rendering will be disabled.")
  28742. ),
  28743. buttons : {
  28744. OK : {class: "btn-danger"}
  28745. }
  28746. });
  28747. }
  28748. };
  28749. // Some magic for deferring mathematical expressions to MathJax
  28750. // by hiding them from the Markdown parser.
  28751. // Some of the code here is adapted with permission from Davide Cervone
  28752. // under the terms of the Apache2 license governing the MathJax project.
  28753. // Other minor modifications are also due to StackExchange and are used with
  28754. // permission.
  28755. // MATHSPLIT contains the pattern for math delimiters and special symbols
  28756. // needed for searching for math in the text input.
  28757. var MATHSPLIT = /(\$\$?|\\(?:begin|end)\{[a-z]*\*?\}|\\[{}$]|[{}]|(?:\n\s*)+|@@\d+@@|\\\\(?:\(|\)|\[|\]))/i;
  28758. // The math is in blocks i through j, so
  28759. // collect it into one block and clear the others.
  28760. // Replace &, <, and > by named entities.
  28761. // For IE, put <br> at the ends of comments since IE removes \n.
  28762. // Clear the current math positions and store the index of the
  28763. // math, then push the math string onto the storage array.
  28764. // The preProcess function is called on all blocks if it has been passed in
  28765. var process_math = function (i, j, pre_process, math, blocks) {
  28766. var block = blocks.slice(i, j + 1).join("").replace(/&/g, "&amp;") // use HTML entity for &
  28767. .replace(/</g, "&lt;") // use HTML entity for <
  28768. .replace(/>/g, "&gt;") // use HTML entity for >
  28769. ;
  28770. if (utils.browser === 'msie') {
  28771. block = block.replace(/(%[^\n]*)\n/g, "$1<br/>\n");
  28772. }
  28773. while (j > i) {
  28774. blocks[j] = "";
  28775. j--;
  28776. }
  28777. blocks[i] = "@@" + math.length + "@@"; // replace the current block text with a unique tag to find later
  28778. if (pre_process){
  28779. block = pre_process(block);
  28780. }
  28781. math.push(block);
  28782. return blocks;
  28783. };
  28784. // Break up the text into its component parts and search
  28785. // through them for math delimiters, braces, linebreaks, etc.
  28786. // Math delimiters must match and braces must balance.
  28787. // Don't allow math to pass through a double linebreak
  28788. // (which will be a paragraph).
  28789. //
  28790. var remove_math = function (text) {
  28791. var math = []; // stores math strings for later
  28792. var start;
  28793. var end;
  28794. var last;
  28795. var braces;
  28796. // Except for extreme edge cases, this should catch precisely those pieces of the markdown
  28797. // source that will later be turned into code spans. While MathJax will not TeXify code spans,
  28798. // we still have to consider them at this point; the following issue has happened several times:
  28799. //
  28800. // `$foo` and `$bar` are varibales. --> <code>$foo ` and `$bar</code> are variables.
  28801. var hasCodeSpans = /`/.test(text),
  28802. de_tilde;
  28803. if (hasCodeSpans) {
  28804. var tilde = function (wholematch) {
  28805. return wholematch.replace(/\$/g, "~D");
  28806. }
  28807. text = text.replace(/~/g, "~T")
  28808. .replace(/(^|[^\\])(`+)([^\n]*?[^`\n])\2(?!`)/gm, tilde)
  28809. .replace(/^\s{0,3}(`{3,})(.|\n)*?\1/gm, tilde);
  28810. de_tilde = function (text) {
  28811. return text.replace(/~([TD])/g, function (wholematch, character) {
  28812. return { T: "~", D: "$" }[character];
  28813. });
  28814. };
  28815. } else {
  28816. de_tilde = function (text) { return text; };
  28817. }
  28818. var blocks = utils.regex_split(text.replace(/\r\n?/g, "\n"),MATHSPLIT);
  28819. for (var i = 1, m = blocks.length; i < m; i += 2) {
  28820. var block = blocks[i];
  28821. if (block.charAt(0) === "@") {
  28822. //
  28823. // Things that look like our math markers will get
  28824. // stored and then retrieved along with the math.
  28825. //
  28826. blocks[i] = "@@" + math.length + "@@";
  28827. math.push(block);
  28828. }
  28829. else if (start) {
  28830. //
  28831. // If we are in math, look for the end delimiter,
  28832. // but don't go past double line breaks, and
  28833. // and balance braces within the math.
  28834. //
  28835. if (block === end) {
  28836. if (braces) {
  28837. last = i;
  28838. }
  28839. else {
  28840. blocks = process_math(start, i, de_tilde, math, blocks);
  28841. start = null;
  28842. end = null;
  28843. last = null;
  28844. }
  28845. }
  28846. else if (block.match(/\n.*\n/)) {
  28847. if (last) {
  28848. i = last;
  28849. blocks = process_math(start, i, de_tilde, math, blocks);
  28850. }
  28851. start = null;
  28852. end = null;
  28853. last = null;
  28854. braces = 0;
  28855. }
  28856. else if (block === "{") {
  28857. braces++;
  28858. }
  28859. else if (block === "}" && braces) {
  28860. braces--;
  28861. }
  28862. }
  28863. else {
  28864. //
  28865. // Look for math start delimiters and when
  28866. // found, set up the end delimiter.
  28867. //
  28868. if (block === "$" || block === "$$") {
  28869. start = i;
  28870. end = block;
  28871. braces = 0;
  28872. }
  28873. else if (block === "\\\\\(" || block === "\\\\\[") {
  28874. start = i;
  28875. end = block.slice(-1) === "(" ? "\\\\\)" : "\\\\\]";
  28876. braces = 0;
  28877. }
  28878. else if (block.substr(1, 5) === "begin") {
  28879. start = i;
  28880. end = "\\end" + block.substr(6);
  28881. braces = 0;
  28882. }
  28883. }
  28884. }
  28885. if (last) {
  28886. blocks = process_math(start, last, de_tilde, math, blocks);
  28887. start = null;
  28888. end = null;
  28889. last = null;
  28890. }
  28891. return [de_tilde(blocks.join("")), math];
  28892. };
  28893. //
  28894. // Put back the math strings that were saved,
  28895. // and clear the math array (no need to keep it around).
  28896. //
  28897. var replace_math = function (text, math) {
  28898. //
  28899. // Replaces a math placeholder with its corresponding group.
  28900. // The math delimiters "\\(", "\\[", "\\)" and "\\]" are replaced
  28901. // removing one backslash in order to be interpreted correctly by MathJax.
  28902. //
  28903. var math_group_process = function (match, n) {
  28904. var math_group = math[n];
  28905. if (math_group.substr(0, 3) === "\\\\\(" && math_group.substr(math_group.length - 3) === "\\\\\)") {
  28906. math_group = "\\\(" + math_group.substring(3, math_group.length - 3) + "\\\)";
  28907. } else if (math_group.substr(0, 3) === "\\\\\[" && math_group.substr(math_group.length - 3) === "\\\\\]") {
  28908. math_group = "\\\[" + math_group.substring(3, math_group.length - 3) + "\\\]";
  28909. }
  28910. return math_group;
  28911. };
  28912. // Replace all the math group placeholders in the text
  28913. // with the saved strings.
  28914. text = text.replace(/@@(\d+)@@/g, math_group_process);
  28915. return text;
  28916. };
  28917. var mathjaxutils = {
  28918. init : init,
  28919. remove_math : remove_math,
  28920. replace_math : replace_math
  28921. };
  28922. return mathjaxutils;
  28923. });
  28924. define('components/sanitizer/index',[],() => { return /******/ (() => { // webpackBootstrap
  28925. /******/ var __webpack_modules__ = ({
  28926. /***/ 8299:
  28927. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  28928. __webpack_require__(9122);
  28929. module.exports = __webpack_require__(8544).RegExp.escape;
  28930. /***/ }),
  28931. /***/ 6819:
  28932. /***/ ((module) => {
  28933. module.exports = function (it) {
  28934. if (typeof it != 'function') throw TypeError(it + ' is not a function!');
  28935. return it;
  28936. };
  28937. /***/ }),
  28938. /***/ 9855:
  28939. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  28940. var cof = __webpack_require__(3679);
  28941. module.exports = function (it, msg) {
  28942. if (typeof it != 'number' && cof(it) != 'Number') throw TypeError(msg);
  28943. return +it;
  28944. };
  28945. /***/ }),
  28946. /***/ 4339:
  28947. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  28948. // 22.1.3.31 Array.prototype[@@unscopables]
  28949. var UNSCOPABLES = __webpack_require__(3336)('unscopables');
  28950. var ArrayProto = Array.prototype;
  28951. if (ArrayProto[UNSCOPABLES] == undefined) __webpack_require__(8012)(ArrayProto, UNSCOPABLES, {});
  28952. module.exports = function (key) {
  28953. ArrayProto[UNSCOPABLES][key] = true;
  28954. };
  28955. /***/ }),
  28956. /***/ 1330:
  28957. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  28958. var at = __webpack_require__(3593)(true);
  28959. // `AdvanceStringIndex` abstract operation
  28960. // https://tc39.github.io/ecma262/#sec-advancestringindex
  28961. module.exports = function (S, index, unicode) {
  28962. return index + (unicode ? at(S, index).length : 1);
  28963. };
  28964. /***/ }),
  28965. /***/ 2702:
  28966. /***/ ((module) => {
  28967. module.exports = function (it, Constructor, name, forbiddenField) {
  28968. if (!(it instanceof Constructor) || forbiddenField !== undefined && forbiddenField in it) {
  28969. throw TypeError(name + ': incorrect invocation!');
  28970. }
  28971. return it;
  28972. };
  28973. /***/ }),
  28974. /***/ 6154:
  28975. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  28976. var isObject = __webpack_require__(7156);
  28977. module.exports = function (it) {
  28978. if (!isObject(it)) throw TypeError(it + ' is not an object!');
  28979. return it;
  28980. };
  28981. /***/ }),
  28982. /***/ 2147:
  28983. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  28984. // 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
  28985. var toObject = __webpack_require__(2515);
  28986. var toAbsoluteIndex = __webpack_require__(6241);
  28987. var toLength = __webpack_require__(8315);
  28988. module.exports = [].copyWithin || function copyWithin(target /* = 0 */, start /* = 0, end = @length */) {
  28989. var O = toObject(this);
  28990. var len = toLength(O.length);
  28991. var to = toAbsoluteIndex(target, len);
  28992. var from = toAbsoluteIndex(start, len);
  28993. var end = arguments.length > 2 ? arguments[2] : undefined;
  28994. var count = Math.min((end === undefined ? len : toAbsoluteIndex(end, len)) - from, len - to);
  28995. var inc = 1;
  28996. if (from < to && to < from + count) {
  28997. inc = -1;
  28998. from += count - 1;
  28999. to += count - 1;
  29000. }
  29001. while (count-- > 0) {
  29002. if (from in O) O[to] = O[from];else delete O[to];
  29003. to += inc;
  29004. from += inc;
  29005. }
  29006. return O;
  29007. };
  29008. /***/ }),
  29009. /***/ 1132:
  29010. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29011. // 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
  29012. var toObject = __webpack_require__(2515);
  29013. var toAbsoluteIndex = __webpack_require__(6241);
  29014. var toLength = __webpack_require__(8315);
  29015. module.exports = function fill(value /* , start = 0, end = @length */) {
  29016. var O = toObject(this);
  29017. var length = toLength(O.length);
  29018. var aLen = arguments.length;
  29019. var index = toAbsoluteIndex(aLen > 1 ? arguments[1] : undefined, length);
  29020. var end = aLen > 2 ? arguments[2] : undefined;
  29021. var endPos = end === undefined ? length : toAbsoluteIndex(end, length);
  29022. while (endPos > index) O[index++] = value;
  29023. return O;
  29024. };
  29025. /***/ }),
  29026. /***/ 5273:
  29027. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29028. var forOf = __webpack_require__(2734);
  29029. module.exports = function (iter, ITERATOR) {
  29030. var result = [];
  29031. forOf(iter, false, result.push, result, ITERATOR);
  29032. return result;
  29033. };
  29034. /***/ }),
  29035. /***/ 4687:
  29036. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29037. // false -> Array#indexOf
  29038. // true -> Array#includes
  29039. var toIObject = __webpack_require__(8499);
  29040. var toLength = __webpack_require__(8315);
  29041. var toAbsoluteIndex = __webpack_require__(6241);
  29042. module.exports = function (IS_INCLUDES) {
  29043. return function ($this, el, fromIndex) {
  29044. var O = toIObject($this);
  29045. var length = toLength(O.length);
  29046. var index = toAbsoluteIndex(fromIndex, length);
  29047. var value;
  29048. // Array#includes uses SameValueZero equality algorithm
  29049. // eslint-disable-next-line no-self-compare
  29050. if (IS_INCLUDES && el != el) while (length > index) {
  29051. value = O[index++];
  29052. // eslint-disable-next-line no-self-compare
  29053. if (value != value) return true;
  29054. // Array#indexOf ignores holes, Array#includes - not
  29055. } else for (; length > index; index++) if (IS_INCLUDES || index in O) {
  29056. if (O[index] === el) return IS_INCLUDES || index || 0;
  29057. }
  29058. return !IS_INCLUDES && -1;
  29059. };
  29060. };
  29061. /***/ }),
  29062. /***/ 3970:
  29063. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29064. // 0 -> Array#forEach
  29065. // 1 -> Array#map
  29066. // 2 -> Array#filter
  29067. // 3 -> Array#some
  29068. // 4 -> Array#every
  29069. // 5 -> Array#find
  29070. // 6 -> Array#findIndex
  29071. var ctx = __webpack_require__(566);
  29072. var IObject = __webpack_require__(331);
  29073. var toObject = __webpack_require__(2515);
  29074. var toLength = __webpack_require__(8315);
  29075. var asc = __webpack_require__(5486);
  29076. module.exports = function (TYPE, $create) {
  29077. var IS_MAP = TYPE == 1;
  29078. var IS_FILTER = TYPE == 2;
  29079. var IS_SOME = TYPE == 3;
  29080. var IS_EVERY = TYPE == 4;
  29081. var IS_FIND_INDEX = TYPE == 6;
  29082. var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  29083. var create = $create || asc;
  29084. return function ($this, callbackfn, that) {
  29085. var O = toObject($this);
  29086. var self = IObject(O);
  29087. var f = ctx(callbackfn, that, 3);
  29088. var length = toLength(self.length);
  29089. var index = 0;
  29090. var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
  29091. var val, res;
  29092. for (; length > index; index++) if (NO_HOLES || index in self) {
  29093. val = self[index];
  29094. res = f(val, index, O);
  29095. if (TYPE) {
  29096. if (IS_MAP) result[index] = res; // map
  29097. else if (res) switch (TYPE) {
  29098. case 3:
  29099. return true;
  29100. // some
  29101. case 5:
  29102. return val;
  29103. // find
  29104. case 6:
  29105. return index;
  29106. // findIndex
  29107. case 2:
  29108. result.push(val);
  29109. // filter
  29110. } else if (IS_EVERY) return false; // every
  29111. }
  29112. }
  29113. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
  29114. };
  29115. };
  29116. /***/ }),
  29117. /***/ 6419:
  29118. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29119. var aFunction = __webpack_require__(6819);
  29120. var toObject = __webpack_require__(2515);
  29121. var IObject = __webpack_require__(331);
  29122. var toLength = __webpack_require__(8315);
  29123. module.exports = function (that, callbackfn, aLen, memo, isRight) {
  29124. aFunction(callbackfn);
  29125. var O = toObject(that);
  29126. var self = IObject(O);
  29127. var length = toLength(O.length);
  29128. var index = isRight ? length - 1 : 0;
  29129. var i = isRight ? -1 : 1;
  29130. if (aLen < 2) for (;;) {
  29131. if (index in self) {
  29132. memo = self[index];
  29133. index += i;
  29134. break;
  29135. }
  29136. index += i;
  29137. if (isRight ? index < 0 : length <= index) {
  29138. throw TypeError('Reduce of empty array with no initial value');
  29139. }
  29140. }
  29141. for (; isRight ? index >= 0 : length > index; index += i) if (index in self) {
  29142. memo = callbackfn(memo, self[index], index, O);
  29143. }
  29144. return memo;
  29145. };
  29146. /***/ }),
  29147. /***/ 2642:
  29148. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29149. var isObject = __webpack_require__(7156);
  29150. var isArray = __webpack_require__(1320);
  29151. var SPECIES = __webpack_require__(3336)('species');
  29152. module.exports = function (original) {
  29153. var C;
  29154. if (isArray(original)) {
  29155. C = original.constructor;
  29156. // cross-realm fallback
  29157. if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
  29158. if (isObject(C)) {
  29159. C = C[SPECIES];
  29160. if (C === null) C = undefined;
  29161. }
  29162. }
  29163. return C === undefined ? Array : C;
  29164. };
  29165. /***/ }),
  29166. /***/ 5486:
  29167. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29168. // 9.4.2.3 ArraySpeciesCreate(originalArray, length)
  29169. var speciesConstructor = __webpack_require__(2642);
  29170. module.exports = function (original, length) {
  29171. return new (speciesConstructor(original))(length);
  29172. };
  29173. /***/ }),
  29174. /***/ 8327:
  29175. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29176. var aFunction = __webpack_require__(6819);
  29177. var isObject = __webpack_require__(7156);
  29178. var invoke = __webpack_require__(2765);
  29179. var arraySlice = [].slice;
  29180. var factories = {};
  29181. var construct = function construct(F, len, args) {
  29182. if (!(len in factories)) {
  29183. for (var n = [], i = 0; i < len; i++) n[i] = 'a[' + i + ']';
  29184. // eslint-disable-next-line no-new-func
  29185. factories[len] = Function('F,a', 'return new F(' + n.join(',') + ')');
  29186. }
  29187. return factories[len](F, args);
  29188. };
  29189. module.exports = Function.bind || function bind(that /* , ...args */) {
  29190. var fn = aFunction(this);
  29191. var partArgs = arraySlice.call(arguments, 1);
  29192. var bound = function bound( /* args... */
  29193. ) {
  29194. var args = partArgs.concat(arraySlice.call(arguments));
  29195. return this instanceof bound ? construct(fn, args.length, args) : invoke(fn, args, that);
  29196. };
  29197. if (isObject(fn.prototype)) bound.prototype = fn.prototype;
  29198. return bound;
  29199. };
  29200. /***/ }),
  29201. /***/ 2858:
  29202. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29203. // getting tag from 19.1.3.6 Object.prototype.toString()
  29204. var cof = __webpack_require__(3679);
  29205. var TAG = __webpack_require__(3336)('toStringTag');
  29206. // ES3 wrong here
  29207. var ARG = cof(function () {
  29208. return arguments;
  29209. }()) == 'Arguments';
  29210. // fallback for IE11 Script Access Denied error
  29211. var tryGet = function tryGet(it, key) {
  29212. try {
  29213. return it[key];
  29214. } catch (e) {/* empty */}
  29215. };
  29216. module.exports = function (it) {
  29217. var O, T, B;
  29218. return it === undefined ? 'Undefined' : it === null ? 'Null'
  29219. // @@toStringTag case
  29220. : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
  29221. // builtinTag case
  29222. : ARG ? cof(O)
  29223. // ES3 arguments fallback
  29224. : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
  29225. };
  29226. /***/ }),
  29227. /***/ 3679:
  29228. /***/ ((module) => {
  29229. var toString = {}.toString;
  29230. module.exports = function (it) {
  29231. return toString.call(it).slice(8, -1);
  29232. };
  29233. /***/ }),
  29234. /***/ 4396:
  29235. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29236. var dP = (__webpack_require__(4835).f);
  29237. var create = __webpack_require__(4275);
  29238. var redefineAll = __webpack_require__(7228);
  29239. var ctx = __webpack_require__(566);
  29240. var anInstance = __webpack_require__(2702);
  29241. var forOf = __webpack_require__(2734);
  29242. var $iterDefine = __webpack_require__(4873);
  29243. var step = __webpack_require__(7218);
  29244. var setSpecies = __webpack_require__(4798);
  29245. var DESCRIPTORS = __webpack_require__(4926);
  29246. var fastKey = (__webpack_require__(3763).fastKey);
  29247. var validate = __webpack_require__(8546);
  29248. var SIZE = DESCRIPTORS ? '_s' : 'size';
  29249. var getEntry = function getEntry(that, key) {
  29250. // fast case
  29251. var index = fastKey(key);
  29252. var entry;
  29253. if (index !== 'F') return that._i[index];
  29254. // frozen object case
  29255. for (entry = that._f; entry; entry = entry.n) {
  29256. if (entry.k == key) return entry;
  29257. }
  29258. };
  29259. module.exports = {
  29260. getConstructor: function getConstructor(wrapper, NAME, IS_MAP, ADDER) {
  29261. var C = wrapper(function (that, iterable) {
  29262. anInstance(that, C, NAME, '_i');
  29263. that._t = NAME; // collection type
  29264. that._i = create(null); // index
  29265. that._f = undefined; // first entry
  29266. that._l = undefined; // last entry
  29267. that[SIZE] = 0; // size
  29268. if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);
  29269. });
  29270. redefineAll(C.prototype, {
  29271. // 23.1.3.1 Map.prototype.clear()
  29272. // 23.2.3.2 Set.prototype.clear()
  29273. clear: function clear() {
  29274. for (var that = validate(this, NAME), data = that._i, entry = that._f; entry; entry = entry.n) {
  29275. entry.r = true;
  29276. if (entry.p) entry.p = entry.p.n = undefined;
  29277. delete data[entry.i];
  29278. }
  29279. that._f = that._l = undefined;
  29280. that[SIZE] = 0;
  29281. },
  29282. // 23.1.3.3 Map.prototype.delete(key)
  29283. // 23.2.3.4 Set.prototype.delete(value)
  29284. 'delete': function _delete(key) {
  29285. var that = validate(this, NAME);
  29286. var entry = getEntry(that, key);
  29287. if (entry) {
  29288. var next = entry.n;
  29289. var prev = entry.p;
  29290. delete that._i[entry.i];
  29291. entry.r = true;
  29292. if (prev) prev.n = next;
  29293. if (next) next.p = prev;
  29294. if (that._f == entry) that._f = next;
  29295. if (that._l == entry) that._l = prev;
  29296. that[SIZE]--;
  29297. }
  29298. return !!entry;
  29299. },
  29300. // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
  29301. // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
  29302. forEach: function forEach(callbackfn /* , that = undefined */) {
  29303. validate(this, NAME);
  29304. var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
  29305. var entry;
  29306. while (entry = entry ? entry.n : this._f) {
  29307. f(entry.v, entry.k, this);
  29308. // revert to the last existing entry
  29309. while (entry && entry.r) entry = entry.p;
  29310. }
  29311. },
  29312. // 23.1.3.7 Map.prototype.has(key)
  29313. // 23.2.3.7 Set.prototype.has(value)
  29314. has: function has(key) {
  29315. return !!getEntry(validate(this, NAME), key);
  29316. }
  29317. });
  29318. if (DESCRIPTORS) dP(C.prototype, 'size', {
  29319. get: function get() {
  29320. return validate(this, NAME)[SIZE];
  29321. }
  29322. });
  29323. return C;
  29324. },
  29325. def: function def(that, key, value) {
  29326. var entry = getEntry(that, key);
  29327. var prev, index;
  29328. // change existing entry
  29329. if (entry) {
  29330. entry.v = value;
  29331. // create new entry
  29332. } else {
  29333. that._l = entry = {
  29334. i: index = fastKey(key, true),
  29335. // <- index
  29336. k: key,
  29337. // <- key
  29338. v: value,
  29339. // <- value
  29340. p: prev = that._l,
  29341. // <- previous entry
  29342. n: undefined,
  29343. // <- next entry
  29344. r: false // <- removed
  29345. };
  29346. if (!that._f) that._f = entry;
  29347. if (prev) prev.n = entry;
  29348. that[SIZE]++;
  29349. // add to index
  29350. if (index !== 'F') that._i[index] = entry;
  29351. }
  29352. return that;
  29353. },
  29354. getEntry: getEntry,
  29355. setStrong: function setStrong(C, NAME, IS_MAP) {
  29356. // add .keys, .values, .entries, [@@iterator]
  29357. // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
  29358. $iterDefine(C, NAME, function (iterated, kind) {
  29359. this._t = validate(iterated, NAME); // target
  29360. this._k = kind; // kind
  29361. this._l = undefined; // previous
  29362. }, function () {
  29363. var that = this;
  29364. var kind = that._k;
  29365. var entry = that._l;
  29366. // revert to the last existing entry
  29367. while (entry && entry.r) entry = entry.p;
  29368. // get next entry
  29369. if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) {
  29370. // or finish the iteration
  29371. that._t = undefined;
  29372. return step(1);
  29373. }
  29374. // return step by kind
  29375. if (kind == 'keys') return step(0, entry.k);
  29376. if (kind == 'values') return step(0, entry.v);
  29377. return step(0, [entry.k, entry.v]);
  29378. }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
  29379. // add [@@species], 23.1.2.2, 23.2.2.2
  29380. setSpecies(NAME);
  29381. }
  29382. };
  29383. /***/ }),
  29384. /***/ 1872:
  29385. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29386. // https://github.com/DavidBruant/Map-Set.prototype.toJSON
  29387. var classof = __webpack_require__(2858);
  29388. var from = __webpack_require__(5273);
  29389. module.exports = function (NAME) {
  29390. return function toJSON() {
  29391. if (classof(this) != NAME) throw TypeError(NAME + "#toJSON isn't generic");
  29392. return from(this);
  29393. };
  29394. };
  29395. /***/ }),
  29396. /***/ 4495:
  29397. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29398. var redefineAll = __webpack_require__(7228);
  29399. var getWeak = (__webpack_require__(3763).getWeak);
  29400. var anObject = __webpack_require__(6154);
  29401. var isObject = __webpack_require__(7156);
  29402. var anInstance = __webpack_require__(2702);
  29403. var forOf = __webpack_require__(2734);
  29404. var createArrayMethod = __webpack_require__(3970);
  29405. var $has = __webpack_require__(5389);
  29406. var validate = __webpack_require__(8546);
  29407. var arrayFind = createArrayMethod(5);
  29408. var arrayFindIndex = createArrayMethod(6);
  29409. var id = 0;
  29410. // fallback for uncaught frozen keys
  29411. var uncaughtFrozenStore = function uncaughtFrozenStore(that) {
  29412. return that._l || (that._l = new UncaughtFrozenStore());
  29413. };
  29414. var UncaughtFrozenStore = function UncaughtFrozenStore() {
  29415. this.a = [];
  29416. };
  29417. var findUncaughtFrozen = function findUncaughtFrozen(store, key) {
  29418. return arrayFind(store.a, function (it) {
  29419. return it[0] === key;
  29420. });
  29421. };
  29422. UncaughtFrozenStore.prototype = {
  29423. get: function get(key) {
  29424. var entry = findUncaughtFrozen(this, key);
  29425. if (entry) return entry[1];
  29426. },
  29427. has: function has(key) {
  29428. return !!findUncaughtFrozen(this, key);
  29429. },
  29430. set: function set(key, value) {
  29431. var entry = findUncaughtFrozen(this, key);
  29432. if (entry) entry[1] = value;else this.a.push([key, value]);
  29433. },
  29434. 'delete': function _delete(key) {
  29435. var index = arrayFindIndex(this.a, function (it) {
  29436. return it[0] === key;
  29437. });
  29438. if (~index) this.a.splice(index, 1);
  29439. return !!~index;
  29440. }
  29441. };
  29442. module.exports = {
  29443. getConstructor: function getConstructor(wrapper, NAME, IS_MAP, ADDER) {
  29444. var C = wrapper(function (that, iterable) {
  29445. anInstance(that, C, NAME, '_i');
  29446. that._t = NAME; // collection type
  29447. that._i = id++; // collection id
  29448. that._l = undefined; // leak store for uncaught frozen objects
  29449. if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);
  29450. });
  29451. redefineAll(C.prototype, {
  29452. // 23.3.3.2 WeakMap.prototype.delete(key)
  29453. // 23.4.3.3 WeakSet.prototype.delete(value)
  29454. 'delete': function _delete(key) {
  29455. if (!isObject(key)) return false;
  29456. var data = getWeak(key);
  29457. if (data === true) return uncaughtFrozenStore(validate(this, NAME))['delete'](key);
  29458. return data && $has(data, this._i) && delete data[this._i];
  29459. },
  29460. // 23.3.3.4 WeakMap.prototype.has(key)
  29461. // 23.4.3.4 WeakSet.prototype.has(value)
  29462. has: function has(key) {
  29463. if (!isObject(key)) return false;
  29464. var data = getWeak(key);
  29465. if (data === true) return uncaughtFrozenStore(validate(this, NAME)).has(key);
  29466. return data && $has(data, this._i);
  29467. }
  29468. });
  29469. return C;
  29470. },
  29471. def: function def(that, key, value) {
  29472. var data = getWeak(anObject(key), true);
  29473. if (data === true) uncaughtFrozenStore(that).set(key, value);else data[that._i] = value;
  29474. return that;
  29475. },
  29476. ufstore: uncaughtFrozenStore
  29477. };
  29478. /***/ }),
  29479. /***/ 1966:
  29480. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29481. var global = __webpack_require__(7381);
  29482. var $export = __webpack_require__(5913);
  29483. var redefine = __webpack_require__(7278);
  29484. var redefineAll = __webpack_require__(7228);
  29485. var meta = __webpack_require__(3763);
  29486. var forOf = __webpack_require__(2734);
  29487. var anInstance = __webpack_require__(2702);
  29488. var isObject = __webpack_require__(7156);
  29489. var fails = __webpack_require__(5810);
  29490. var $iterDetect = __webpack_require__(5508);
  29491. var setToStringTag = __webpack_require__(8094);
  29492. var inheritIfRequired = __webpack_require__(3654);
  29493. module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {
  29494. var Base = global[NAME];
  29495. var C = Base;
  29496. var ADDER = IS_MAP ? 'set' : 'add';
  29497. var proto = C && C.prototype;
  29498. var O = {};
  29499. var fixMethod = function fixMethod(KEY) {
  29500. var fn = proto[KEY];
  29501. redefine(proto, KEY, KEY == 'delete' ? function (a) {
  29502. return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
  29503. } : KEY == 'has' ? function has(a) {
  29504. return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
  29505. } : KEY == 'get' ? function get(a) {
  29506. return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a);
  29507. } : KEY == 'add' ? function add(a) {
  29508. fn.call(this, a === 0 ? 0 : a);
  29509. return this;
  29510. } : function set(a, b) {
  29511. fn.call(this, a === 0 ? 0 : a, b);
  29512. return this;
  29513. });
  29514. };
  29515. if (typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () {
  29516. new C().entries().next();
  29517. }))) {
  29518. // create collection constructor
  29519. C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
  29520. redefineAll(C.prototype, methods);
  29521. meta.NEED = true;
  29522. } else {
  29523. var instance = new C();
  29524. // early implementations not supports chaining
  29525. var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;
  29526. // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false
  29527. var THROWS_ON_PRIMITIVES = fails(function () {
  29528. instance.has(1);
  29529. });
  29530. // most early implementations doesn't supports iterables, most modern - not close it correctly
  29531. var ACCEPT_ITERABLES = $iterDetect(function (iter) {
  29532. new C(iter);
  29533. }); // eslint-disable-line no-new
  29534. // for early implementations -0 and +0 not the same
  29535. var BUGGY_ZERO = !IS_WEAK && fails(function () {
  29536. // V8 ~ Chromium 42- fails only with 5+ elements
  29537. var $instance = new C();
  29538. var index = 5;
  29539. while (index--) $instance[ADDER](index, index);
  29540. return !$instance.has(-0);
  29541. });
  29542. if (!ACCEPT_ITERABLES) {
  29543. C = wrapper(function (target, iterable) {
  29544. anInstance(target, C, NAME);
  29545. var that = inheritIfRequired(new Base(), target, C);
  29546. if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);
  29547. return that;
  29548. });
  29549. C.prototype = proto;
  29550. proto.constructor = C;
  29551. }
  29552. if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {
  29553. fixMethod('delete');
  29554. fixMethod('has');
  29555. IS_MAP && fixMethod('get');
  29556. }
  29557. if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER);
  29558. // weak collections should not contains .clear method
  29559. if (IS_WEAK && proto.clear) delete proto.clear;
  29560. }
  29561. setToStringTag(C, NAME);
  29562. O[NAME] = C;
  29563. $export($export.G + $export.W + $export.F * (C != Base), O);
  29564. if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP);
  29565. return C;
  29566. };
  29567. /***/ }),
  29568. /***/ 8544:
  29569. /***/ ((module) => {
  29570. var core = module.exports = {
  29571. version: '2.6.12'
  29572. };
  29573. if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
  29574. /***/ }),
  29575. /***/ 1348:
  29576. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29577. var $defineProperty = __webpack_require__(4835);
  29578. var createDesc = __webpack_require__(6256);
  29579. module.exports = function (object, index, value) {
  29580. if (index in object) $defineProperty.f(object, index, createDesc(0, value));else object[index] = value;
  29581. };
  29582. /***/ }),
  29583. /***/ 566:
  29584. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29585. // optional / simple context binding
  29586. var aFunction = __webpack_require__(6819);
  29587. module.exports = function (fn, that, length) {
  29588. aFunction(fn);
  29589. if (that === undefined) return fn;
  29590. switch (length) {
  29591. case 1:
  29592. return function (a) {
  29593. return fn.call(that, a);
  29594. };
  29595. case 2:
  29596. return function (a, b) {
  29597. return fn.call(that, a, b);
  29598. };
  29599. case 3:
  29600. return function (a, b, c) {
  29601. return fn.call(that, a, b, c);
  29602. };
  29603. }
  29604. return function /* ...args */
  29605. () {
  29606. return fn.apply(that, arguments);
  29607. };
  29608. };
  29609. /***/ }),
  29610. /***/ 2115:
  29611. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29612. // 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString()
  29613. var fails = __webpack_require__(5810);
  29614. var getTime = Date.prototype.getTime;
  29615. var $toISOString = Date.prototype.toISOString;
  29616. var lz = function lz(num) {
  29617. return num > 9 ? num : '0' + num;
  29618. };
  29619. // PhantomJS / old WebKit has a broken implementations
  29620. module.exports = fails(function () {
  29621. return $toISOString.call(new Date(-5e13 - 1)) != '0385-07-25T07:06:39.999Z';
  29622. }) || !fails(function () {
  29623. $toISOString.call(new Date(NaN));
  29624. }) ? function toISOString() {
  29625. if (!isFinite(getTime.call(this))) throw RangeError('Invalid time value');
  29626. var d = this;
  29627. var y = d.getUTCFullYear();
  29628. var m = d.getUTCMilliseconds();
  29629. var s = y < 0 ? '-' : y > 9999 ? '+' : '';
  29630. return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) + '-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) + 'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) + ':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z';
  29631. } : $toISOString;
  29632. /***/ }),
  29633. /***/ 296:
  29634. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29635. var anObject = __webpack_require__(6154);
  29636. var toPrimitive = __webpack_require__(8537);
  29637. var NUMBER = 'number';
  29638. module.exports = function (hint) {
  29639. if (hint !== 'string' && hint !== NUMBER && hint !== 'default') throw TypeError('Incorrect hint');
  29640. return toPrimitive(anObject(this), hint != NUMBER);
  29641. };
  29642. /***/ }),
  29643. /***/ 408:
  29644. /***/ ((module) => {
  29645. // 7.2.1 RequireObjectCoercible(argument)
  29646. module.exports = function (it) {
  29647. if (it == undefined) throw TypeError("Can't call method on " + it);
  29648. return it;
  29649. };
  29650. /***/ }),
  29651. /***/ 4926:
  29652. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29653. // Thank's IE8 for his funny defineProperty
  29654. module.exports = !__webpack_require__(5810)(function () {
  29655. return Object.defineProperty({}, 'a', {
  29656. get: function get() {
  29657. return 7;
  29658. }
  29659. }).a != 7;
  29660. });
  29661. /***/ }),
  29662. /***/ 2241:
  29663. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29664. var isObject = __webpack_require__(7156);
  29665. var document = (__webpack_require__(7381).document);
  29666. // typeof document.createElement is 'object' in old IE
  29667. var is = isObject(document) && isObject(document.createElement);
  29668. module.exports = function (it) {
  29669. return is ? document.createElement(it) : {};
  29670. };
  29671. /***/ }),
  29672. /***/ 6921:
  29673. /***/ ((module) => {
  29674. // IE 8- don't enum bug keys
  29675. module.exports = 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'.split(',');
  29676. /***/ }),
  29677. /***/ 8727:
  29678. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29679. // all enumerable object keys, includes symbols
  29680. var getKeys = __webpack_require__(9924);
  29681. var gOPS = __webpack_require__(5421);
  29682. var pIE = __webpack_require__(4616);
  29683. module.exports = function (it) {
  29684. var result = getKeys(it);
  29685. var getSymbols = gOPS.f;
  29686. if (getSymbols) {
  29687. var symbols = getSymbols(it);
  29688. var isEnum = pIE.f;
  29689. var i = 0;
  29690. var key;
  29691. while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);
  29692. }
  29693. return result;
  29694. };
  29695. /***/ }),
  29696. /***/ 5913:
  29697. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29698. var global = __webpack_require__(7381);
  29699. var core = __webpack_require__(8544);
  29700. var hide = __webpack_require__(8012);
  29701. var redefine = __webpack_require__(7278);
  29702. var ctx = __webpack_require__(566);
  29703. var PROTOTYPE = 'prototype';
  29704. var $export = function $export(type, name, source) {
  29705. var IS_FORCED = type & $export.F;
  29706. var IS_GLOBAL = type & $export.G;
  29707. var IS_STATIC = type & $export.S;
  29708. var IS_PROTO = type & $export.P;
  29709. var IS_BIND = type & $export.B;
  29710. var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE];
  29711. var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
  29712. var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
  29713. var key, own, out, exp;
  29714. if (IS_GLOBAL) source = name;
  29715. for (key in source) {
  29716. // contains in native
  29717. own = !IS_FORCED && target && target[key] !== undefined;
  29718. // export native or passed
  29719. out = (own ? target : source)[key];
  29720. // bind timers to global for call from export context
  29721. exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
  29722. // extend global
  29723. if (target) redefine(target, key, out, type & $export.U);
  29724. // export
  29725. if (exports[key] != out) hide(exports, key, exp);
  29726. if (IS_PROTO && expProto[key] != out) expProto[key] = out;
  29727. }
  29728. };
  29729. global.core = core;
  29730. // type bitmap
  29731. $export.F = 1; // forced
  29732. $export.G = 2; // global
  29733. $export.S = 4; // static
  29734. $export.P = 8; // proto
  29735. $export.B = 16; // bind
  29736. $export.W = 32; // wrap
  29737. $export.U = 64; // safe
  29738. $export.R = 128; // real proto method for `library`
  29739. module.exports = $export;
  29740. /***/ }),
  29741. /***/ 3483:
  29742. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29743. var MATCH = __webpack_require__(3336)('match');
  29744. module.exports = function (KEY) {
  29745. var re = /./;
  29746. try {
  29747. '/./'[KEY](re);
  29748. } catch (e) {
  29749. try {
  29750. re[MATCH] = false;
  29751. return !'/./'[KEY](re);
  29752. } catch (f) {/* empty */}
  29753. }
  29754. return true;
  29755. };
  29756. /***/ }),
  29757. /***/ 5810:
  29758. /***/ ((module) => {
  29759. module.exports = function (exec) {
  29760. try {
  29761. return !!exec();
  29762. } catch (e) {
  29763. return true;
  29764. }
  29765. };
  29766. /***/ }),
  29767. /***/ 8644:
  29768. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29769. __webpack_require__(5997);
  29770. var redefine = __webpack_require__(7278);
  29771. var hide = __webpack_require__(8012);
  29772. var fails = __webpack_require__(5810);
  29773. var defined = __webpack_require__(408);
  29774. var wks = __webpack_require__(3336);
  29775. var regexpExec = __webpack_require__(6997);
  29776. var SPECIES = wks('species');
  29777. var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
  29778. // #replace needs built-in support for named groups.
  29779. // #match works fine because it just return the exec results, even if it has
  29780. // a "grops" property.
  29781. var re = /./;
  29782. re.exec = function () {
  29783. var result = [];
  29784. result.groups = {
  29785. a: '7'
  29786. };
  29787. return result;
  29788. };
  29789. return ''.replace(re, '$<a>') !== '7';
  29790. });
  29791. var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = function () {
  29792. // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
  29793. var re = /(?:)/;
  29794. var originalExec = re.exec;
  29795. re.exec = function () {
  29796. return originalExec.apply(this, arguments);
  29797. };
  29798. var result = 'ab'.split(re);
  29799. return result.length === 2 && result[0] === 'a' && result[1] === 'b';
  29800. }();
  29801. module.exports = function (KEY, length, exec) {
  29802. var SYMBOL = wks(KEY);
  29803. var DELEGATES_TO_SYMBOL = !fails(function () {
  29804. // String methods call symbol-named RegEp methods
  29805. var O = {};
  29806. O[SYMBOL] = function () {
  29807. return 7;
  29808. };
  29809. return ''[KEY](O) != 7;
  29810. });
  29811. var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL ? !fails(function () {
  29812. // Symbol-named RegExp methods call .exec
  29813. var execCalled = false;
  29814. var re = /a/;
  29815. re.exec = function () {
  29816. execCalled = true;
  29817. return null;
  29818. };
  29819. if (KEY === 'split') {
  29820. // RegExp[@@split] doesn't call the regex's exec method, but first creates
  29821. // a new one. We need to return the patched regex when creating the new one.
  29822. re.constructor = {};
  29823. re.constructor[SPECIES] = function () {
  29824. return re;
  29825. };
  29826. }
  29827. re[SYMBOL]('');
  29828. return !execCalled;
  29829. }) : undefined;
  29830. if (!DELEGATES_TO_SYMBOL || !DELEGATES_TO_EXEC || KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS || KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC) {
  29831. var nativeRegExpMethod = /./[SYMBOL];
  29832. var fns = exec(defined, SYMBOL, ''[KEY], function maybeCallNative(nativeMethod, regexp, str, arg2, forceStringMethod) {
  29833. if (regexp.exec === regexpExec) {
  29834. if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
  29835. // The native String method already delegates to @@method (this
  29836. // polyfilled function), leasing to infinite recursion.
  29837. // We avoid it by directly calling the native @@method method.
  29838. return {
  29839. done: true,
  29840. value: nativeRegExpMethod.call(regexp, str, arg2)
  29841. };
  29842. }
  29843. return {
  29844. done: true,
  29845. value: nativeMethod.call(str, regexp, arg2)
  29846. };
  29847. }
  29848. return {
  29849. done: false
  29850. };
  29851. });
  29852. var strfn = fns[0];
  29853. var rxfn = fns[1];
  29854. redefine(String.prototype, KEY, strfn);
  29855. hide(RegExp.prototype, SYMBOL, length == 2
  29856. // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
  29857. // 21.2.5.11 RegExp.prototype[@@split](string, limit)
  29858. ? function (string, arg) {
  29859. return rxfn.call(string, this, arg);
  29860. }
  29861. // 21.2.5.6 RegExp.prototype[@@match](string)
  29862. // 21.2.5.9 RegExp.prototype[@@search](string)
  29863. : function (string) {
  29864. return rxfn.call(string, this);
  29865. });
  29866. }
  29867. };
  29868. /***/ }),
  29869. /***/ 2188:
  29870. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29871. // 21.2.5.3 get RegExp.prototype.flags
  29872. var anObject = __webpack_require__(6154);
  29873. module.exports = function () {
  29874. var that = anObject(this);
  29875. var result = '';
  29876. if (that.global) result += 'g';
  29877. if (that.ignoreCase) result += 'i';
  29878. if (that.multiline) result += 'm';
  29879. if (that.unicode) result += 'u';
  29880. if (that.sticky) result += 'y';
  29881. return result;
  29882. };
  29883. /***/ }),
  29884. /***/ 3120:
  29885. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29886. // https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray
  29887. var isArray = __webpack_require__(1320);
  29888. var isObject = __webpack_require__(7156);
  29889. var toLength = __webpack_require__(8315);
  29890. var ctx = __webpack_require__(566);
  29891. var IS_CONCAT_SPREADABLE = __webpack_require__(3336)('isConcatSpreadable');
  29892. function flattenIntoArray(target, original, source, sourceLen, start, depth, mapper, thisArg) {
  29893. var targetIndex = start;
  29894. var sourceIndex = 0;
  29895. var mapFn = mapper ? ctx(mapper, thisArg, 3) : false;
  29896. var element, spreadable;
  29897. while (sourceIndex < sourceLen) {
  29898. if (sourceIndex in source) {
  29899. element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];
  29900. spreadable = false;
  29901. if (isObject(element)) {
  29902. spreadable = element[IS_CONCAT_SPREADABLE];
  29903. spreadable = spreadable !== undefined ? !!spreadable : isArray(element);
  29904. }
  29905. if (spreadable && depth > 0) {
  29906. targetIndex = flattenIntoArray(target, original, element, toLength(element.length), targetIndex, depth - 1) - 1;
  29907. } else {
  29908. if (targetIndex >= 0x1fffffffffffff) throw TypeError();
  29909. target[targetIndex] = element;
  29910. }
  29911. targetIndex++;
  29912. }
  29913. sourceIndex++;
  29914. }
  29915. return targetIndex;
  29916. }
  29917. module.exports = flattenIntoArray;
  29918. /***/ }),
  29919. /***/ 2734:
  29920. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29921. var ctx = __webpack_require__(566);
  29922. var call = __webpack_require__(2471);
  29923. var isArrayIter = __webpack_require__(7063);
  29924. var anObject = __webpack_require__(6154);
  29925. var toLength = __webpack_require__(8315);
  29926. var getIterFn = __webpack_require__(7637);
  29927. var BREAK = {};
  29928. var RETURN = {};
  29929. var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
  29930. var iterFn = ITERATOR ? function () {
  29931. return iterable;
  29932. } : getIterFn(iterable);
  29933. var f = ctx(fn, that, entries ? 2 : 1);
  29934. var index = 0;
  29935. var length, step, iterator, result;
  29936. if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
  29937. // fast case for arrays with default iterator
  29938. if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) {
  29939. result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
  29940. if (result === BREAK || result === RETURN) return result;
  29941. } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
  29942. result = call(iterator, f, step.value, entries);
  29943. if (result === BREAK || result === RETURN) return result;
  29944. }
  29945. };
  29946. exports.BREAK = BREAK;
  29947. exports.RETURN = RETURN;
  29948. /***/ }),
  29949. /***/ 1174:
  29950. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29951. module.exports = __webpack_require__(3192)('native-function-to-string', Function.toString);
  29952. /***/ }),
  29953. /***/ 7381:
  29954. /***/ ((module) => {
  29955. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  29956. var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self
  29957. // eslint-disable-next-line no-new-func
  29958. : Function('return this')();
  29959. if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
  29960. /***/ }),
  29961. /***/ 5389:
  29962. /***/ ((module) => {
  29963. var hasOwnProperty = {}.hasOwnProperty;
  29964. module.exports = function (it, key) {
  29965. return hasOwnProperty.call(it, key);
  29966. };
  29967. /***/ }),
  29968. /***/ 8012:
  29969. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29970. var dP = __webpack_require__(4835);
  29971. var createDesc = __webpack_require__(6256);
  29972. module.exports = __webpack_require__(4926) ? function (object, key, value) {
  29973. return dP.f(object, key, createDesc(1, value));
  29974. } : function (object, key, value) {
  29975. object[key] = value;
  29976. return object;
  29977. };
  29978. /***/ }),
  29979. /***/ 1225:
  29980. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29981. var document = (__webpack_require__(7381).document);
  29982. module.exports = document && document.documentElement;
  29983. /***/ }),
  29984. /***/ 5142:
  29985. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29986. module.exports = !__webpack_require__(4926) && !__webpack_require__(5810)(function () {
  29987. return Object.defineProperty(__webpack_require__(2241)('div'), 'a', {
  29988. get: function get() {
  29989. return 7;
  29990. }
  29991. }).a != 7;
  29992. });
  29993. /***/ }),
  29994. /***/ 3654:
  29995. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  29996. var isObject = __webpack_require__(7156);
  29997. var setPrototypeOf = (__webpack_require__(6931).set);
  29998. module.exports = function (that, target, C) {
  29999. var S = target.constructor;
  30000. var P;
  30001. if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf) {
  30002. setPrototypeOf(that, P);
  30003. }
  30004. return that;
  30005. };
  30006. /***/ }),
  30007. /***/ 2765:
  30008. /***/ ((module) => {
  30009. // fast apply, http://jsperf.lnkit.com/fast-apply/5
  30010. module.exports = function (fn, args, that) {
  30011. var un = that === undefined;
  30012. switch (args.length) {
  30013. case 0:
  30014. return un ? fn() : fn.call(that);
  30015. case 1:
  30016. return un ? fn(args[0]) : fn.call(that, args[0]);
  30017. case 2:
  30018. return un ? fn(args[0], args[1]) : fn.call(that, args[0], args[1]);
  30019. case 3:
  30020. return un ? fn(args[0], args[1], args[2]) : fn.call(that, args[0], args[1], args[2]);
  30021. case 4:
  30022. return un ? fn(args[0], args[1], args[2], args[3]) : fn.call(that, args[0], args[1], args[2], args[3]);
  30023. }
  30024. return fn.apply(that, args);
  30025. };
  30026. /***/ }),
  30027. /***/ 331:
  30028. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30029. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  30030. var cof = __webpack_require__(3679);
  30031. // eslint-disable-next-line no-prototype-builtins
  30032. module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
  30033. return cof(it) == 'String' ? it.split('') : Object(it);
  30034. };
  30035. /***/ }),
  30036. /***/ 7063:
  30037. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30038. // check on default Array iterator
  30039. var Iterators = __webpack_require__(5301);
  30040. var ITERATOR = __webpack_require__(3336)('iterator');
  30041. var ArrayProto = Array.prototype;
  30042. module.exports = function (it) {
  30043. return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
  30044. };
  30045. /***/ }),
  30046. /***/ 1320:
  30047. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30048. // 7.2.2 IsArray(argument)
  30049. var cof = __webpack_require__(3679);
  30050. module.exports = Array.isArray || function isArray(arg) {
  30051. return cof(arg) == 'Array';
  30052. };
  30053. /***/ }),
  30054. /***/ 5127:
  30055. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30056. // 20.1.2.3 Number.isInteger(number)
  30057. var isObject = __webpack_require__(7156);
  30058. var floor = Math.floor;
  30059. module.exports = function isInteger(it) {
  30060. return !isObject(it) && isFinite(it) && floor(it) === it;
  30061. };
  30062. /***/ }),
  30063. /***/ 7156:
  30064. /***/ ((module) => {
  30065. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  30066. module.exports = function (it) {
  30067. return _typeof(it) === 'object' ? it !== null : typeof it === 'function';
  30068. };
  30069. /***/ }),
  30070. /***/ 1993:
  30071. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30072. // 7.2.8 IsRegExp(argument)
  30073. var isObject = __webpack_require__(7156);
  30074. var cof = __webpack_require__(3679);
  30075. var MATCH = __webpack_require__(3336)('match');
  30076. module.exports = function (it) {
  30077. var isRegExp;
  30078. return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp');
  30079. };
  30080. /***/ }),
  30081. /***/ 2471:
  30082. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30083. // call something on iterator step with safe closing on error
  30084. var anObject = __webpack_require__(6154);
  30085. module.exports = function (iterator, fn, value, entries) {
  30086. try {
  30087. return entries ? fn(anObject(value)[0], value[1]) : fn(value);
  30088. // 7.4.6 IteratorClose(iterator, completion)
  30089. } catch (e) {
  30090. var ret = iterator['return'];
  30091. if (ret !== undefined) anObject(ret.call(iterator));
  30092. throw e;
  30093. }
  30094. };
  30095. /***/ }),
  30096. /***/ 8258:
  30097. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30098. var create = __webpack_require__(4275);
  30099. var descriptor = __webpack_require__(6256);
  30100. var setToStringTag = __webpack_require__(8094);
  30101. var IteratorPrototype = {};
  30102. // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
  30103. __webpack_require__(8012)(IteratorPrototype, __webpack_require__(3336)('iterator'), function () {
  30104. return this;
  30105. });
  30106. module.exports = function (Constructor, NAME, next) {
  30107. Constructor.prototype = create(IteratorPrototype, {
  30108. next: descriptor(1, next)
  30109. });
  30110. setToStringTag(Constructor, NAME + ' Iterator');
  30111. };
  30112. /***/ }),
  30113. /***/ 4873:
  30114. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30115. var LIBRARY = __webpack_require__(4219);
  30116. var $export = __webpack_require__(5913);
  30117. var redefine = __webpack_require__(7278);
  30118. var hide = __webpack_require__(8012);
  30119. var Iterators = __webpack_require__(5301);
  30120. var $iterCreate = __webpack_require__(8258);
  30121. var setToStringTag = __webpack_require__(8094);
  30122. var getPrototypeOf = __webpack_require__(4153);
  30123. var ITERATOR = __webpack_require__(3336)('iterator');
  30124. var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
  30125. var FF_ITERATOR = '@@iterator';
  30126. var KEYS = 'keys';
  30127. var VALUES = 'values';
  30128. var returnThis = function returnThis() {
  30129. return this;
  30130. };
  30131. module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
  30132. $iterCreate(Constructor, NAME, next);
  30133. var getMethod = function getMethod(kind) {
  30134. if (!BUGGY && kind in proto) return proto[kind];
  30135. switch (kind) {
  30136. case KEYS:
  30137. return function keys() {
  30138. return new Constructor(this, kind);
  30139. };
  30140. case VALUES:
  30141. return function values() {
  30142. return new Constructor(this, kind);
  30143. };
  30144. }
  30145. return function entries() {
  30146. return new Constructor(this, kind);
  30147. };
  30148. };
  30149. var TAG = NAME + ' Iterator';
  30150. var DEF_VALUES = DEFAULT == VALUES;
  30151. var VALUES_BUG = false;
  30152. var proto = Base.prototype;
  30153. var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
  30154. var $default = $native || getMethod(DEFAULT);
  30155. var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
  30156. var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
  30157. var methods, key, IteratorPrototype;
  30158. // Fix native
  30159. if ($anyNative) {
  30160. IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
  30161. if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
  30162. // Set @@toStringTag to native iterators
  30163. setToStringTag(IteratorPrototype, TAG, true);
  30164. // fix for some old engines
  30165. if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);
  30166. }
  30167. }
  30168. // fix Array#{values, @@iterator}.name in V8 / FF
  30169. if (DEF_VALUES && $native && $native.name !== VALUES) {
  30170. VALUES_BUG = true;
  30171. $default = function values() {
  30172. return $native.call(this);
  30173. };
  30174. }
  30175. // Define iterator
  30176. if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
  30177. hide(proto, ITERATOR, $default);
  30178. }
  30179. // Plug for library
  30180. Iterators[NAME] = $default;
  30181. Iterators[TAG] = returnThis;
  30182. if (DEFAULT) {
  30183. methods = {
  30184. values: DEF_VALUES ? $default : getMethod(VALUES),
  30185. keys: IS_SET ? $default : getMethod(KEYS),
  30186. entries: $entries
  30187. };
  30188. if (FORCED) for (key in methods) {
  30189. if (!(key in proto)) redefine(proto, key, methods[key]);
  30190. } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
  30191. }
  30192. return methods;
  30193. };
  30194. /***/ }),
  30195. /***/ 5508:
  30196. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30197. var ITERATOR = __webpack_require__(3336)('iterator');
  30198. var SAFE_CLOSING = false;
  30199. try {
  30200. var riter = [7][ITERATOR]();
  30201. riter['return'] = function () {
  30202. SAFE_CLOSING = true;
  30203. };
  30204. // eslint-disable-next-line no-throw-literal
  30205. Array.from(riter, function () {
  30206. throw 2;
  30207. });
  30208. } catch (e) {/* empty */}
  30209. module.exports = function (exec, skipClosing) {
  30210. if (!skipClosing && !SAFE_CLOSING) return false;
  30211. var safe = false;
  30212. try {
  30213. var arr = [7];
  30214. var iter = arr[ITERATOR]();
  30215. iter.next = function () {
  30216. return {
  30217. done: safe = true
  30218. };
  30219. };
  30220. arr[ITERATOR] = function () {
  30221. return iter;
  30222. };
  30223. exec(arr);
  30224. } catch (e) {/* empty */}
  30225. return safe;
  30226. };
  30227. /***/ }),
  30228. /***/ 7218:
  30229. /***/ ((module) => {
  30230. module.exports = function (done, value) {
  30231. return {
  30232. value: value,
  30233. done: !!done
  30234. };
  30235. };
  30236. /***/ }),
  30237. /***/ 5301:
  30238. /***/ ((module) => {
  30239. module.exports = {};
  30240. /***/ }),
  30241. /***/ 4219:
  30242. /***/ ((module) => {
  30243. module.exports = false;
  30244. /***/ }),
  30245. /***/ 4774:
  30246. /***/ ((module) => {
  30247. // 20.2.2.14 Math.expm1(x)
  30248. var $expm1 = Math.expm1;
  30249. module.exports = !$expm1
  30250. // Old FF bug
  30251. || $expm1(10) > 22025.465794806719 || $expm1(10) < 22025.4657948067165168
  30252. // Tor Browser bug
  30253. || $expm1(-2e-17) != -2e-17 ? function expm1(x) {
  30254. return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : Math.exp(x) - 1;
  30255. } : $expm1;
  30256. /***/ }),
  30257. /***/ 3800:
  30258. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30259. // 20.2.2.16 Math.fround(x)
  30260. var sign = __webpack_require__(4012);
  30261. var pow = Math.pow;
  30262. var EPSILON = pow(2, -52);
  30263. var EPSILON32 = pow(2, -23);
  30264. var MAX32 = pow(2, 127) * (2 - EPSILON32);
  30265. var MIN32 = pow(2, -126);
  30266. var roundTiesToEven = function roundTiesToEven(n) {
  30267. return n + 1 / EPSILON - 1 / EPSILON;
  30268. };
  30269. module.exports = Math.fround || function fround(x) {
  30270. var $abs = Math.abs(x);
  30271. var $sign = sign(x);
  30272. var a, result;
  30273. if ($abs < MIN32) return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32;
  30274. a = (1 + EPSILON32 / EPSILON) * $abs;
  30275. result = a - (a - $abs);
  30276. // eslint-disable-next-line no-self-compare
  30277. if (result > MAX32 || result != result) return $sign * Infinity;
  30278. return $sign * result;
  30279. };
  30280. /***/ }),
  30281. /***/ 5447:
  30282. /***/ ((module) => {
  30283. // 20.2.2.20 Math.log1p(x)
  30284. module.exports = Math.log1p || function log1p(x) {
  30285. return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : Math.log(1 + x);
  30286. };
  30287. /***/ }),
  30288. /***/ 8124:
  30289. /***/ ((module) => {
  30290. // https://rwaldron.github.io/proposal-math-extensions/
  30291. module.exports = Math.scale || function scale(x, inLow, inHigh, outLow, outHigh) {
  30292. if (arguments.length === 0
  30293. // eslint-disable-next-line no-self-compare
  30294. || x != x
  30295. // eslint-disable-next-line no-self-compare
  30296. || inLow != inLow
  30297. // eslint-disable-next-line no-self-compare
  30298. || inHigh != inHigh
  30299. // eslint-disable-next-line no-self-compare
  30300. || outLow != outLow
  30301. // eslint-disable-next-line no-self-compare
  30302. || outHigh != outHigh) return NaN;
  30303. if (x === Infinity || x === -Infinity) return x;
  30304. return (x - inLow) * (outHigh - outLow) / (inHigh - inLow) + outLow;
  30305. };
  30306. /***/ }),
  30307. /***/ 4012:
  30308. /***/ ((module) => {
  30309. // 20.2.2.28 Math.sign(x)
  30310. module.exports = Math.sign || function sign(x) {
  30311. // eslint-disable-next-line no-self-compare
  30312. return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;
  30313. };
  30314. /***/ }),
  30315. /***/ 3763:
  30316. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30317. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  30318. var META = __webpack_require__(7936)('meta');
  30319. var isObject = __webpack_require__(7156);
  30320. var has = __webpack_require__(5389);
  30321. var setDesc = (__webpack_require__(4835).f);
  30322. var id = 0;
  30323. var isExtensible = Object.isExtensible || function () {
  30324. return true;
  30325. };
  30326. var FREEZE = !__webpack_require__(5810)(function () {
  30327. return isExtensible(Object.preventExtensions({}));
  30328. });
  30329. var setMeta = function setMeta(it) {
  30330. setDesc(it, META, {
  30331. value: {
  30332. i: 'O' + ++id,
  30333. // object ID
  30334. w: {} // weak collections IDs
  30335. }
  30336. });
  30337. };
  30338. var fastKey = function fastKey(it, create) {
  30339. // return primitive with prefix
  30340. if (!isObject(it)) return _typeof(it) == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
  30341. if (!has(it, META)) {
  30342. // can't set metadata to uncaught frozen object
  30343. if (!isExtensible(it)) return 'F';
  30344. // not necessary to add metadata
  30345. if (!create) return 'E';
  30346. // add missing metadata
  30347. setMeta(it);
  30348. // return object ID
  30349. }
  30350. return it[META].i;
  30351. };
  30352. var getWeak = function getWeak(it, create) {
  30353. if (!has(it, META)) {
  30354. // can't set metadata to uncaught frozen object
  30355. if (!isExtensible(it)) return true;
  30356. // not necessary to add metadata
  30357. if (!create) return false;
  30358. // add missing metadata
  30359. setMeta(it);
  30360. // return hash weak collections IDs
  30361. }
  30362. return it[META].w;
  30363. };
  30364. // add metadata on freeze-family methods calling
  30365. var onFreeze = function onFreeze(it) {
  30366. if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);
  30367. return it;
  30368. };
  30369. var meta = module.exports = {
  30370. KEY: META,
  30371. NEED: false,
  30372. fastKey: fastKey,
  30373. getWeak: getWeak,
  30374. onFreeze: onFreeze
  30375. };
  30376. /***/ }),
  30377. /***/ 8953:
  30378. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30379. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  30380. var Map = __webpack_require__(8969);
  30381. var $export = __webpack_require__(5913);
  30382. var shared = __webpack_require__(3192)('metadata');
  30383. var store = shared.store || (shared.store = new (__webpack_require__(3491))());
  30384. var getOrCreateMetadataMap = function getOrCreateMetadataMap(target, targetKey, create) {
  30385. var targetMetadata = store.get(target);
  30386. if (!targetMetadata) {
  30387. if (!create) return undefined;
  30388. store.set(target, targetMetadata = new Map());
  30389. }
  30390. var keyMetadata = targetMetadata.get(targetKey);
  30391. if (!keyMetadata) {
  30392. if (!create) return undefined;
  30393. targetMetadata.set(targetKey, keyMetadata = new Map());
  30394. }
  30395. return keyMetadata;
  30396. };
  30397. var ordinaryHasOwnMetadata = function ordinaryHasOwnMetadata(MetadataKey, O, P) {
  30398. var metadataMap = getOrCreateMetadataMap(O, P, false);
  30399. return metadataMap === undefined ? false : metadataMap.has(MetadataKey);
  30400. };
  30401. var ordinaryGetOwnMetadata = function ordinaryGetOwnMetadata(MetadataKey, O, P) {
  30402. var metadataMap = getOrCreateMetadataMap(O, P, false);
  30403. return metadataMap === undefined ? undefined : metadataMap.get(MetadataKey);
  30404. };
  30405. var ordinaryDefineOwnMetadata = function ordinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {
  30406. getOrCreateMetadataMap(O, P, true).set(MetadataKey, MetadataValue);
  30407. };
  30408. var ordinaryOwnMetadataKeys = function ordinaryOwnMetadataKeys(target, targetKey) {
  30409. var metadataMap = getOrCreateMetadataMap(target, targetKey, false);
  30410. var keys = [];
  30411. if (metadataMap) metadataMap.forEach(function (_, key) {
  30412. keys.push(key);
  30413. });
  30414. return keys;
  30415. };
  30416. var toMetaKey = function toMetaKey(it) {
  30417. return it === undefined || _typeof(it) == 'symbol' ? it : String(it);
  30418. };
  30419. var exp = function exp(O) {
  30420. $export($export.S, 'Reflect', O);
  30421. };
  30422. module.exports = {
  30423. store: store,
  30424. map: getOrCreateMetadataMap,
  30425. has: ordinaryHasOwnMetadata,
  30426. get: ordinaryGetOwnMetadata,
  30427. set: ordinaryDefineOwnMetadata,
  30428. keys: ordinaryOwnMetadataKeys,
  30429. key: toMetaKey,
  30430. exp: exp
  30431. };
  30432. /***/ }),
  30433. /***/ 1842:
  30434. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30435. var global = __webpack_require__(7381);
  30436. var macrotask = (__webpack_require__(8220).set);
  30437. var Observer = global.MutationObserver || global.WebKitMutationObserver;
  30438. var process = global.process;
  30439. var Promise = global.Promise;
  30440. var isNode = __webpack_require__(3679)(process) == 'process';
  30441. module.exports = function () {
  30442. var head, last, notify;
  30443. var flush = function flush() {
  30444. var parent, fn;
  30445. if (isNode && (parent = process.domain)) parent.exit();
  30446. while (head) {
  30447. fn = head.fn;
  30448. head = head.next;
  30449. try {
  30450. fn();
  30451. } catch (e) {
  30452. if (head) notify();else last = undefined;
  30453. throw e;
  30454. }
  30455. }
  30456. last = undefined;
  30457. if (parent) parent.enter();
  30458. };
  30459. // Node.js
  30460. if (isNode) {
  30461. notify = function notify() {
  30462. process.nextTick(flush);
  30463. };
  30464. // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339
  30465. } else if (Observer && !(global.navigator && global.navigator.standalone)) {
  30466. var toggle = true;
  30467. var node = document.createTextNode('');
  30468. new Observer(flush).observe(node, {
  30469. characterData: true
  30470. }); // eslint-disable-line no-new
  30471. notify = function notify() {
  30472. node.data = toggle = !toggle;
  30473. };
  30474. // environments with maybe non-completely correct, but existent Promise
  30475. } else if (Promise && Promise.resolve) {
  30476. // Promise.resolve without an argument throws an error in LG WebOS 2
  30477. var promise = Promise.resolve(undefined);
  30478. notify = function notify() {
  30479. promise.then(flush);
  30480. };
  30481. // for other environments - macrotask based on:
  30482. // - setImmediate
  30483. // - MessageChannel
  30484. // - window.postMessag
  30485. // - onreadystatechange
  30486. // - setTimeout
  30487. } else {
  30488. notify = function notify() {
  30489. // strange IE + webpack dev server bug - use .call(global)
  30490. macrotask.call(global, flush);
  30491. };
  30492. }
  30493. return function (fn) {
  30494. var task = {
  30495. fn: fn,
  30496. next: undefined
  30497. };
  30498. if (last) last.next = task;
  30499. if (!head) {
  30500. head = task;
  30501. notify();
  30502. }
  30503. last = task;
  30504. };
  30505. };
  30506. /***/ }),
  30507. /***/ 4086:
  30508. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30509. // 25.4.1.5 NewPromiseCapability(C)
  30510. var aFunction = __webpack_require__(6819);
  30511. function PromiseCapability(C) {
  30512. var resolve, reject;
  30513. this.promise = new C(function ($$resolve, $$reject) {
  30514. if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
  30515. resolve = $$resolve;
  30516. reject = $$reject;
  30517. });
  30518. this.resolve = aFunction(resolve);
  30519. this.reject = aFunction(reject);
  30520. }
  30521. module.exports.f = function (C) {
  30522. return new PromiseCapability(C);
  30523. };
  30524. /***/ }),
  30525. /***/ 8559:
  30526. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30527. // 19.1.2.1 Object.assign(target, source, ...)
  30528. var DESCRIPTORS = __webpack_require__(4926);
  30529. var getKeys = __webpack_require__(9924);
  30530. var gOPS = __webpack_require__(5421);
  30531. var pIE = __webpack_require__(4616);
  30532. var toObject = __webpack_require__(2515);
  30533. var IObject = __webpack_require__(331);
  30534. var $assign = Object.assign;
  30535. // should work with symbols and should have deterministic property order (V8 bug)
  30536. module.exports = !$assign || __webpack_require__(5810)(function () {
  30537. var A = {};
  30538. var B = {};
  30539. // eslint-disable-next-line no-undef
  30540. var S = Symbol();
  30541. var K = 'abcdefghijklmnopqrst';
  30542. A[S] = 7;
  30543. K.split('').forEach(function (k) {
  30544. B[k] = k;
  30545. });
  30546. return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
  30547. }) ? function assign(target, source) {
  30548. // eslint-disable-line no-unused-vars
  30549. var T = toObject(target);
  30550. var aLen = arguments.length;
  30551. var index = 1;
  30552. var getSymbols = gOPS.f;
  30553. var isEnum = pIE.f;
  30554. while (aLen > index) {
  30555. var S = IObject(arguments[index++]);
  30556. var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);
  30557. var length = keys.length;
  30558. var j = 0;
  30559. var key;
  30560. while (length > j) {
  30561. key = keys[j++];
  30562. if (!DESCRIPTORS || isEnum.call(S, key)) T[key] = S[key];
  30563. }
  30564. }
  30565. return T;
  30566. } : $assign;
  30567. /***/ }),
  30568. /***/ 4275:
  30569. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30570. // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
  30571. var anObject = __webpack_require__(6154);
  30572. var dPs = __webpack_require__(6447);
  30573. var enumBugKeys = __webpack_require__(6921);
  30574. var IE_PROTO = __webpack_require__(8662)('IE_PROTO');
  30575. var Empty = function Empty() {/* empty */};
  30576. var PROTOTYPE = 'prototype';
  30577. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  30578. var _createDict = function createDict() {
  30579. // Thrash, waste and sodomy: IE GC bug
  30580. var iframe = __webpack_require__(2241)('iframe');
  30581. var i = enumBugKeys.length;
  30582. var lt = '<';
  30583. var gt = '>';
  30584. var iframeDocument;
  30585. iframe.style.display = 'none';
  30586. (__webpack_require__(1225).appendChild)(iframe);
  30587. iframe.src = 'javascript:'; // eslint-disable-line no-script-url
  30588. // createDict = iframe.contentWindow.Object;
  30589. // html.removeChild(iframe);
  30590. iframeDocument = iframe.contentWindow.document;
  30591. iframeDocument.open();
  30592. iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
  30593. iframeDocument.close();
  30594. _createDict = iframeDocument.F;
  30595. while (i--) delete _createDict[PROTOTYPE][enumBugKeys[i]];
  30596. return _createDict();
  30597. };
  30598. module.exports = Object.create || function create(O, Properties) {
  30599. var result;
  30600. if (O !== null) {
  30601. Empty[PROTOTYPE] = anObject(O);
  30602. result = new Empty();
  30603. Empty[PROTOTYPE] = null;
  30604. // add "__proto__" for Object.getPrototypeOf polyfill
  30605. result[IE_PROTO] = O;
  30606. } else result = _createDict();
  30607. return Properties === undefined ? result : dPs(result, Properties);
  30608. };
  30609. /***/ }),
  30610. /***/ 4835:
  30611. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  30612. var anObject = __webpack_require__(6154);
  30613. var IE8_DOM_DEFINE = __webpack_require__(5142);
  30614. var toPrimitive = __webpack_require__(8537);
  30615. var dP = Object.defineProperty;
  30616. exports.f = __webpack_require__(4926) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
  30617. anObject(O);
  30618. P = toPrimitive(P, true);
  30619. anObject(Attributes);
  30620. if (IE8_DOM_DEFINE) try {
  30621. return dP(O, P, Attributes);
  30622. } catch (e) {/* empty */}
  30623. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
  30624. if ('value' in Attributes) O[P] = Attributes.value;
  30625. return O;
  30626. };
  30627. /***/ }),
  30628. /***/ 6447:
  30629. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30630. var dP = __webpack_require__(4835);
  30631. var anObject = __webpack_require__(6154);
  30632. var getKeys = __webpack_require__(9924);
  30633. module.exports = __webpack_require__(4926) ? Object.defineProperties : function defineProperties(O, Properties) {
  30634. anObject(O);
  30635. var keys = getKeys(Properties);
  30636. var length = keys.length;
  30637. var i = 0;
  30638. var P;
  30639. while (length > i) dP.f(O, P = keys[i++], Properties[P]);
  30640. return O;
  30641. };
  30642. /***/ }),
  30643. /***/ 8249:
  30644. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30645. // Forced replacement prototype accessors methods
  30646. module.exports = __webpack_require__(4219) || !__webpack_require__(5810)(function () {
  30647. var K = Math.random();
  30648. // In FF throws only define methods
  30649. // eslint-disable-next-line no-undef, no-useless-call
  30650. __defineSetter__.call(null, K, function () {/* empty */});
  30651. delete __webpack_require__(7381)[K];
  30652. });
  30653. /***/ }),
  30654. /***/ 3299:
  30655. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  30656. var pIE = __webpack_require__(4616);
  30657. var createDesc = __webpack_require__(6256);
  30658. var toIObject = __webpack_require__(8499);
  30659. var toPrimitive = __webpack_require__(8537);
  30660. var has = __webpack_require__(5389);
  30661. var IE8_DOM_DEFINE = __webpack_require__(5142);
  30662. var gOPD = Object.getOwnPropertyDescriptor;
  30663. exports.f = __webpack_require__(4926) ? gOPD : function getOwnPropertyDescriptor(O, P) {
  30664. O = toIObject(O);
  30665. P = toPrimitive(P, true);
  30666. if (IE8_DOM_DEFINE) try {
  30667. return gOPD(O, P);
  30668. } catch (e) {/* empty */}
  30669. if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);
  30670. };
  30671. /***/ }),
  30672. /***/ 3136:
  30673. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30674. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  30675. // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
  30676. var toIObject = __webpack_require__(8499);
  30677. var gOPN = (__webpack_require__(2982).f);
  30678. var toString = {}.toString;
  30679. var windowNames = (typeof window === "undefined" ? "undefined" : _typeof(window)) == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
  30680. var getWindowNames = function getWindowNames(it) {
  30681. try {
  30682. return gOPN(it);
  30683. } catch (e) {
  30684. return windowNames.slice();
  30685. }
  30686. };
  30687. module.exports.f = function getOwnPropertyNames(it) {
  30688. return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
  30689. };
  30690. /***/ }),
  30691. /***/ 2982:
  30692. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  30693. // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
  30694. var $keys = __webpack_require__(7960);
  30695. var hiddenKeys = (__webpack_require__(6921).concat)('length', 'prototype');
  30696. exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  30697. return $keys(O, hiddenKeys);
  30698. };
  30699. /***/ }),
  30700. /***/ 5421:
  30701. /***/ ((__unused_webpack_module, exports) => {
  30702. exports.f = Object.getOwnPropertySymbols;
  30703. /***/ }),
  30704. /***/ 4153:
  30705. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30706. // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
  30707. var has = __webpack_require__(5389);
  30708. var toObject = __webpack_require__(2515);
  30709. var IE_PROTO = __webpack_require__(8662)('IE_PROTO');
  30710. var ObjectProto = Object.prototype;
  30711. module.exports = Object.getPrototypeOf || function (O) {
  30712. O = toObject(O);
  30713. if (has(O, IE_PROTO)) return O[IE_PROTO];
  30714. if (typeof O.constructor == 'function' && O instanceof O.constructor) {
  30715. return O.constructor.prototype;
  30716. }
  30717. return O instanceof Object ? ObjectProto : null;
  30718. };
  30719. /***/ }),
  30720. /***/ 7960:
  30721. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30722. var has = __webpack_require__(5389);
  30723. var toIObject = __webpack_require__(8499);
  30724. var arrayIndexOf = __webpack_require__(4687)(false);
  30725. var IE_PROTO = __webpack_require__(8662)('IE_PROTO');
  30726. module.exports = function (object, names) {
  30727. var O = toIObject(object);
  30728. var i = 0;
  30729. var result = [];
  30730. var key;
  30731. for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
  30732. // Don't enum bug & hidden keys
  30733. while (names.length > i) if (has(O, key = names[i++])) {
  30734. ~arrayIndexOf(result, key) || result.push(key);
  30735. }
  30736. return result;
  30737. };
  30738. /***/ }),
  30739. /***/ 9924:
  30740. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30741. // 19.1.2.14 / 15.2.3.14 Object.keys(O)
  30742. var $keys = __webpack_require__(7960);
  30743. var enumBugKeys = __webpack_require__(6921);
  30744. module.exports = Object.keys || function keys(O) {
  30745. return $keys(O, enumBugKeys);
  30746. };
  30747. /***/ }),
  30748. /***/ 4616:
  30749. /***/ ((__unused_webpack_module, exports) => {
  30750. exports.f = {}.propertyIsEnumerable;
  30751. /***/ }),
  30752. /***/ 4057:
  30753. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30754. // most Object methods by ES6 should accept primitives
  30755. var $export = __webpack_require__(5913);
  30756. var core = __webpack_require__(8544);
  30757. var fails = __webpack_require__(5810);
  30758. module.exports = function (KEY, exec) {
  30759. var fn = (core.Object || {})[KEY] || Object[KEY];
  30760. var exp = {};
  30761. exp[KEY] = exec(fn);
  30762. $export($export.S + $export.F * fails(function () {
  30763. fn(1);
  30764. }), 'Object', exp);
  30765. };
  30766. /***/ }),
  30767. /***/ 8941:
  30768. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30769. var DESCRIPTORS = __webpack_require__(4926);
  30770. var getKeys = __webpack_require__(9924);
  30771. var toIObject = __webpack_require__(8499);
  30772. var isEnum = (__webpack_require__(4616).f);
  30773. module.exports = function (isEntries) {
  30774. return function (it) {
  30775. var O = toIObject(it);
  30776. var keys = getKeys(O);
  30777. var length = keys.length;
  30778. var i = 0;
  30779. var result = [];
  30780. var key;
  30781. while (length > i) {
  30782. key = keys[i++];
  30783. if (!DESCRIPTORS || isEnum.call(O, key)) {
  30784. result.push(isEntries ? [key, O[key]] : O[key]);
  30785. }
  30786. }
  30787. return result;
  30788. };
  30789. };
  30790. /***/ }),
  30791. /***/ 2600:
  30792. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30793. // all object keys, includes non-enumerable and symbols
  30794. var gOPN = __webpack_require__(2982);
  30795. var gOPS = __webpack_require__(5421);
  30796. var anObject = __webpack_require__(6154);
  30797. var Reflect = (__webpack_require__(7381).Reflect);
  30798. module.exports = Reflect && Reflect.ownKeys || function ownKeys(it) {
  30799. var keys = gOPN.f(anObject(it));
  30800. var getSymbols = gOPS.f;
  30801. return getSymbols ? keys.concat(getSymbols(it)) : keys;
  30802. };
  30803. /***/ }),
  30804. /***/ 5031:
  30805. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30806. var $parseFloat = (__webpack_require__(7381).parseFloat);
  30807. var $trim = (__webpack_require__(618).trim);
  30808. module.exports = 1 / $parseFloat(__webpack_require__(3596) + '-0') !== -Infinity ? function parseFloat(str) {
  30809. var string = $trim(String(str), 3);
  30810. var result = $parseFloat(string);
  30811. return result === 0 && string.charAt(0) == '-' ? -0 : result;
  30812. } : $parseFloat;
  30813. /***/ }),
  30814. /***/ 6971:
  30815. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30816. var $parseInt = (__webpack_require__(7381).parseInt);
  30817. var $trim = (__webpack_require__(618).trim);
  30818. var ws = __webpack_require__(3596);
  30819. var hex = /^[-+]?0[xX]/;
  30820. module.exports = $parseInt(ws + '08') !== 8 || $parseInt(ws + '0x16') !== 22 ? function parseInt(str, radix) {
  30821. var string = $trim(String(str), 3);
  30822. return $parseInt(string, radix >>> 0 || (hex.test(string) ? 16 : 10));
  30823. } : $parseInt;
  30824. /***/ }),
  30825. /***/ 8228:
  30826. /***/ ((module) => {
  30827. module.exports = function (exec) {
  30828. try {
  30829. return {
  30830. e: false,
  30831. v: exec()
  30832. };
  30833. } catch (e) {
  30834. return {
  30835. e: true,
  30836. v: e
  30837. };
  30838. }
  30839. };
  30840. /***/ }),
  30841. /***/ 3507:
  30842. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30843. var anObject = __webpack_require__(6154);
  30844. var isObject = __webpack_require__(7156);
  30845. var newPromiseCapability = __webpack_require__(4086);
  30846. module.exports = function (C, x) {
  30847. anObject(C);
  30848. if (isObject(x) && x.constructor === C) return x;
  30849. var promiseCapability = newPromiseCapability.f(C);
  30850. var resolve = promiseCapability.resolve;
  30851. resolve(x);
  30852. return promiseCapability.promise;
  30853. };
  30854. /***/ }),
  30855. /***/ 6256:
  30856. /***/ ((module) => {
  30857. module.exports = function (bitmap, value) {
  30858. return {
  30859. enumerable: !(bitmap & 1),
  30860. configurable: !(bitmap & 2),
  30861. writable: !(bitmap & 4),
  30862. value: value
  30863. };
  30864. };
  30865. /***/ }),
  30866. /***/ 7228:
  30867. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30868. var redefine = __webpack_require__(7278);
  30869. module.exports = function (target, src, safe) {
  30870. for (var key in src) redefine(target, key, src[key], safe);
  30871. return target;
  30872. };
  30873. /***/ }),
  30874. /***/ 7278:
  30875. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30876. var global = __webpack_require__(7381);
  30877. var hide = __webpack_require__(8012);
  30878. var has = __webpack_require__(5389);
  30879. var SRC = __webpack_require__(7936)('src');
  30880. var $toString = __webpack_require__(1174);
  30881. var TO_STRING = 'toString';
  30882. var TPL = ('' + $toString).split(TO_STRING);
  30883. (__webpack_require__(8544).inspectSource) = function (it) {
  30884. return $toString.call(it);
  30885. };
  30886. (module.exports = function (O, key, val, safe) {
  30887. var isFunction = typeof val == 'function';
  30888. if (isFunction) has(val, 'name') || hide(val, 'name', key);
  30889. if (O[key] === val) return;
  30890. if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
  30891. if (O === global) {
  30892. O[key] = val;
  30893. } else if (!safe) {
  30894. delete O[key];
  30895. hide(O, key, val);
  30896. } else if (O[key]) {
  30897. O[key] = val;
  30898. } else {
  30899. hide(O, key, val);
  30900. }
  30901. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  30902. })(Function.prototype, TO_STRING, function toString() {
  30903. return typeof this == 'function' && this[SRC] || $toString.call(this);
  30904. });
  30905. /***/ }),
  30906. /***/ 4585:
  30907. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30908. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  30909. var classof = __webpack_require__(2858);
  30910. var builtinExec = RegExp.prototype.exec;
  30911. // `RegExpExec` abstract operation
  30912. // https://tc39.github.io/ecma262/#sec-regexpexec
  30913. module.exports = function (R, S) {
  30914. var exec = R.exec;
  30915. if (typeof exec === 'function') {
  30916. var result = exec.call(R, S);
  30917. if (_typeof(result) !== 'object') {
  30918. throw new TypeError('RegExp exec method returned something other than an Object or null');
  30919. }
  30920. return result;
  30921. }
  30922. if (classof(R) !== 'RegExp') {
  30923. throw new TypeError('RegExp#exec called on incompatible receiver');
  30924. }
  30925. return builtinExec.call(R, S);
  30926. };
  30927. /***/ }),
  30928. /***/ 6997:
  30929. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30930. var regexpFlags = __webpack_require__(2188);
  30931. var nativeExec = RegExp.prototype.exec;
  30932. // This always refers to the native implementation, because the
  30933. // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
  30934. // which loads this file before patching the method.
  30935. var nativeReplace = String.prototype.replace;
  30936. var patchedExec = nativeExec;
  30937. var LAST_INDEX = 'lastIndex';
  30938. var UPDATES_LAST_INDEX_WRONG = function () {
  30939. var re1 = /a/,
  30940. re2 = /b*/g;
  30941. nativeExec.call(re1, 'a');
  30942. nativeExec.call(re2, 'a');
  30943. return re1[LAST_INDEX] !== 0 || re2[LAST_INDEX] !== 0;
  30944. }();
  30945. // nonparticipating capturing group, copied from es5-shim's String#split patch.
  30946. var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
  30947. var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED;
  30948. if (PATCH) {
  30949. patchedExec = function exec(str) {
  30950. var re = this;
  30951. var lastIndex, reCopy, match, i;
  30952. if (NPCG_INCLUDED) {
  30953. reCopy = new RegExp('^' + re.source + '$(?!\\s)', regexpFlags.call(re));
  30954. }
  30955. if (UPDATES_LAST_INDEX_WRONG) lastIndex = re[LAST_INDEX];
  30956. match = nativeExec.call(re, str);
  30957. if (UPDATES_LAST_INDEX_WRONG && match) {
  30958. re[LAST_INDEX] = re.global ? match.index + match[0].length : lastIndex;
  30959. }
  30960. if (NPCG_INCLUDED && match && match.length > 1) {
  30961. // Fix browsers whose `exec` methods don't consistently return `undefined`
  30962. // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
  30963. // eslint-disable-next-line no-loop-func
  30964. nativeReplace.call(match[0], reCopy, function () {
  30965. for (i = 1; i < arguments.length - 2; i++) {
  30966. if (arguments[i] === undefined) match[i] = undefined;
  30967. }
  30968. });
  30969. }
  30970. return match;
  30971. };
  30972. }
  30973. module.exports = patchedExec;
  30974. /***/ }),
  30975. /***/ 6813:
  30976. /***/ ((module) => {
  30977. module.exports = function (regExp, replace) {
  30978. var replacer = replace === Object(replace) ? function (part) {
  30979. return replace[part];
  30980. } : replace;
  30981. return function (it) {
  30982. return String(it).replace(regExp, replacer);
  30983. };
  30984. };
  30985. /***/ }),
  30986. /***/ 4261:
  30987. /***/ ((module) => {
  30988. // 7.2.9 SameValue(x, y)
  30989. module.exports = Object.is || function is(x, y) {
  30990. // eslint-disable-next-line no-self-compare
  30991. return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
  30992. };
  30993. /***/ }),
  30994. /***/ 7598:
  30995. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  30996. // https://tc39.github.io/proposal-setmap-offrom/
  30997. var $export = __webpack_require__(5913);
  30998. var aFunction = __webpack_require__(6819);
  30999. var ctx = __webpack_require__(566);
  31000. var forOf = __webpack_require__(2734);
  31001. module.exports = function (COLLECTION) {
  31002. $export($export.S, COLLECTION, {
  31003. from: function from(source /* , mapFn, thisArg */) {
  31004. var mapFn = arguments[1];
  31005. var mapping, A, n, cb;
  31006. aFunction(this);
  31007. mapping = mapFn !== undefined;
  31008. if (mapping) aFunction(mapFn);
  31009. if (source == undefined) return new this();
  31010. A = [];
  31011. if (mapping) {
  31012. n = 0;
  31013. cb = ctx(mapFn, arguments[2], 2);
  31014. forOf(source, false, function (nextItem) {
  31015. A.push(cb(nextItem, n++));
  31016. });
  31017. } else {
  31018. forOf(source, false, A.push, A);
  31019. }
  31020. return new this(A);
  31021. }
  31022. });
  31023. };
  31024. /***/ }),
  31025. /***/ 5329:
  31026. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  31027. // https://tc39.github.io/proposal-setmap-offrom/
  31028. var $export = __webpack_require__(5913);
  31029. module.exports = function (COLLECTION) {
  31030. $export($export.S, COLLECTION, {
  31031. of: function of() {
  31032. var length = arguments.length;
  31033. var A = new Array(length);
  31034. while (length--) A[length] = arguments[length];
  31035. return new this(A);
  31036. }
  31037. });
  31038. };
  31039. /***/ }),
  31040. /***/ 6931:
  31041. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  31042. // Works with __proto__ only. Old v8 can't work with null proto objects.
  31043. /* eslint-disable no-proto */
  31044. var isObject = __webpack_require__(7156);
  31045. var anObject = __webpack_require__(6154);
  31046. var check = function check(O, proto) {
  31047. anObject(O);
  31048. if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!");
  31049. };
  31050. module.exports = {
  31051. set: Object.setPrototypeOf || ('__proto__' in {} ?
  31052. // eslint-disable-line
  31053. function (test, buggy, set) {
  31054. try {
  31055. set = __webpack_require__(566)(Function.call, (__webpack_require__(3299).f)(Object.prototype, '__proto__').set, 2);
  31056. set(test, []);
  31057. buggy = !(test instanceof Array);
  31058. } catch (e) {
  31059. buggy = true;
  31060. }
  31061. return function setPrototypeOf(O, proto) {
  31062. check(O, proto);
  31063. if (buggy) O.__proto__ = proto;else set(O, proto);
  31064. return O;
  31065. };
  31066. }({}, false) : undefined),
  31067. check: check
  31068. };
  31069. /***/ }),
  31070. /***/ 4798:
  31071. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  31072. var global = __webpack_require__(7381);
  31073. var dP = __webpack_require__(4835);
  31074. var DESCRIPTORS = __webpack_require__(4926);
  31075. var SPECIES = __webpack_require__(3336)('species');
  31076. module.exports = function (KEY) {
  31077. var C = global[KEY];
  31078. if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {
  31079. configurable: true,
  31080. get: function get() {
  31081. return this;
  31082. }
  31083. });
  31084. };
  31085. /***/ }),
  31086. /***/ 8094:
  31087. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  31088. var def = (__webpack_require__(4835).f);
  31089. var has = __webpack_require__(5389);
  31090. var TAG = __webpack_require__(3336)('toStringTag');
  31091. module.exports = function (it, tag, stat) {
  31092. if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, {
  31093. configurable: true,
  31094. value: tag
  31095. });
  31096. };
  31097. /***/ }),
  31098. /***/ 8662:
  31099. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  31100. var shared = __webpack_require__(3192)('keys');
  31101. var uid = __webpack_require__(7936);
  31102. module.exports = function (key) {
  31103. return shared[key] || (shared[key] = uid(key));
  31104. };
  31105. /***/ }),
  31106. /***/ 3192:
  31107. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  31108. var core = __webpack_require__(8544);
  31109. var global = __webpack_require__(7381);
  31110. var SHARED = '__core-js_shared__';
  31111. var store = global[SHARED] || (global[SHARED] = {});
  31112. (module.exports = function (key, value) {
  31113. return store[key] || (store[key] = value !== undefined ? value : {});
  31114. })('versions', []).push({
  31115. version: core.version,
  31116. mode: __webpack_require__(4219) ? 'pure' : 'global',
  31117. copyright: '© 2020 Denis Pushkarev (zloirock.ru)'
  31118. });
  31119. /***/ }),
  31120. /***/ 2035:
  31121. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  31122. // 7.3.20 SpeciesConstructor(O, defaultConstructor)
  31123. var anObject = __webpack_require__(6154);
  31124. var aFunction = __webpack_require__(6819);
  31125. var SPECIES = __webpack_require__(3336)('species');
  31126. module.exports = function (O, D) {
  31127. var C = anObject(O).constructor;
  31128. var S;
  31129. return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);
  31130. };
  31131. /***/ }),
  31132. /***/ 1411:
  31133. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  31134. var fails = __webpack_require__(5810);
  31135. module.exports = function (method, arg) {
  31136. return !!method && fails(function () {
  31137. // eslint-disable-next-line no-useless-call
  31138. arg ? method.call(null, function () {/* empty */}, 1) : method.call(null);
  31139. });
  31140. };
  31141. /***/ }),
  31142. /***/ 3593:
  31143. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  31144. var toInteger = __webpack_require__(3230);
  31145. var defined = __webpack_require__(408);
  31146. // true -> String#at
  31147. // false -> String#codePointAt
  31148. module.exports = function (TO_STRING) {
  31149. return function (that, pos) {
  31150. var s = String(defined(that));
  31151. var i = toInteger(pos);
  31152. var l = s.length;
  31153. var a, b;
  31154. if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
  31155. a = s.charCodeAt(i);
  31156. return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff ? TO_STRING ? s.charAt(i) : a : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
  31157. };
  31158. };
  31159. /***/ }),
  31160. /***/ 2376:
  31161. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  31162. // helper for String#{startsWith, endsWith, includes}
  31163. var isRegExp = __webpack_require__(1993);
  31164. var defined = __webpack_require__(408);
  31165. module.exports = function (that, searchString, NAME) {
  31166. if (isRegExp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!");
  31167. return String(defined(that));
  31168. };
  31169. /***/ }),
  31170. /***/ 9927:
  31171. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  31172. var $export = __webpack_require__(5913);
  31173. var fails = __webpack_require__(5810);
  31174. var defined = __webpack_require__(408);
  31175. var quot = /"/g;
  31176. // B.2.3.2.1 CreateHTML(string, tag, attribute, value)
  31177. var createHTML = function createHTML(string, tag, attribute, value) {
  31178. var S = String(defined(string));
  31179. var p1 = '<' + tag;
  31180. if (attribute !== '') p1 += ' ' + attribute + '="' + String(value).replace(quot, '&quot;') + '"';
  31181. return p1 + '>' + S + '</' + tag + '>';
  31182. };
  31183. module.exports = function (NAME, exec) {
  31184. var O = {};
  31185. O[NAME] = exec(createHTML);
  31186. $export($export.P + $export.F * fails(function () {
  31187. var test = ''[NAME]('"');
  31188. return test !== test.toLowerCase() || test.split('"').length > 3;
  31189. }), 'String', O);
  31190. };
  31191. /***/ }),
  31192. /***/ 1925:
  31193. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  31194. // https://github.com/tc39/proposal-string-pad-start-end
  31195. var toLength = __webpack_require__(8315);
  31196. var repeat = __webpack_require__(1924);
  31197. var defined = __webpack_require__(408);
  31198. module.exports = function (that, maxLength, fillString, left) {
  31199. var S = String(defined(that));
  31200. var stringLength = S.length;
  31201. var fillStr = fillString === undefined ? ' ' : String(fillString);
  31202. var intMaxLength = toLength(maxLength);
  31203. if (intMaxLength <= stringLength || fillStr == '') return S;
  31204. var fillLen = intMaxLength - stringLength;
  31205. var stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length));
  31206. if (stringFiller.length > fillLen) stringFiller = stringFiller.slice(0, fillLen);
  31207. return left ? stringFiller + S : S + stringFiller;
  31208. };
  31209. /***/ }),
  31210. /***/ 1924:
  31211. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  31212. var toInteger = __webpack_require__(3230);
  31213. var defined = __webpack_require__(408);
  31214. module.exports = function repeat(count) {
  31215. var str = String(defined(this));
  31216. var res = '';
  31217. var n = toInteger(count);
  31218. if (n < 0 || n == Infinity) throw RangeError("Count can't be negative");
  31219. for (; n > 0; (n >>>= 1) && (str += str)) if (n & 1) res += str;
  31220. return res;
  31221. };
  31222. /***/ }),
  31223. /***/ 618:
  31224. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  31225. var $export = __webpack_require__(5913);
  31226. var defined = __webpack_require__(408);
  31227. var fails = __webpack_require__(5810);
  31228. var spaces = __webpack_require__(3596);
  31229. var space = '[' + spaces + ']';
  31230. var non = "\u200B\x85";
  31231. var ltrim = RegExp('^' + space + space + '*');
  31232. var rtrim = RegExp(space + space + '*$');
  31233. var exporter = function exporter(KEY, exec, ALIAS) {
  31234. var exp = {};
  31235. var FORCE = fails(function () {
  31236. return !!spaces[KEY]() || non[KEY]() != non;
  31237. });
  31238. var fn = exp[KEY] = FORCE ? exec(trim) : spaces[KEY];
  31239. if (ALIAS) exp[ALIAS] = fn;
  31240. $export($export.P + $export.F * FORCE, 'String', exp);
  31241. };
  31242. // 1 -> String#trimLeft
  31243. // 2 -> String#trimRight
  31244. // 3 -> String#trim
  31245. var trim = exporter.trim = function (string, TYPE) {
  31246. string = String(defined(string));
  31247. if (TYPE & 1) string = string.replace(ltrim, '');
  31248. if (TYPE & 2) string = string.replace(rtrim, '');
  31249. return string;
  31250. };
  31251. module.exports = exporter;
  31252. /***/ }),
  31253. /***/ 3596:
  31254. /***/ ((module) => {
  31255. module.exports = "\t\n\x0B\f\r \xA0\u1680\u180E\u2000\u2001\u2002\u2003" + "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF";
  31256. /***/ }),
  31257. /***/ 8220:
  31258. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  31259. var ctx = __webpack_require__(566);
  31260. var invoke = __webpack_require__(2765);
  31261. var html = __webpack_require__(1225);
  31262. var cel = __webpack_require__(2241);
  31263. var global = __webpack_require__(7381);
  31264. var process = global.process;
  31265. var setTask = global.setImmediate;
  31266. var clearTask = global.clearImmediate;
  31267. var MessageChannel = global.MessageChannel;
  31268. var Dispatch = global.Dispatch;
  31269. var counter = 0;
  31270. var queue = {};
  31271. var ONREADYSTATECHANGE = 'onreadystatechange';
  31272. var defer, channel, port;
  31273. var run = function run() {
  31274. var id = +this;
  31275. // eslint-disable-next-line no-prototype-builtins
  31276. if (queue.hasOwnProperty(id)) {
  31277. var fn = queue[id];
  31278. delete queue[id];
  31279. fn();
  31280. }
  31281. };
  31282. var listener = function listener(event) {
  31283. run.call(event.data);
  31284. };
  31285. // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
  31286. if (!setTask || !clearTask) {
  31287. setTask = function setImmediate(fn) {
  31288. var args = [];
  31289. var i = 1;
  31290. while (arguments.length > i) args.push(arguments[i++]);
  31291. queue[++counter] = function () {
  31292. // eslint-disable-next-line no-new-func
  31293. invoke(typeof fn == 'function' ? fn : Function(fn), args);
  31294. };
  31295. defer(counter);
  31296. return counter;
  31297. };
  31298. clearTask = function clearImmediate(id) {
  31299. delete queue[id];
  31300. };
  31301. // Node.js 0.8-
  31302. if (__webpack_require__(3679)(process) == 'process') {
  31303. defer = function defer(id) {
  31304. process.nextTick(ctx(run, id, 1));
  31305. };
  31306. // Sphere (JS game engine) Dispatch API
  31307. } else if (Dispatch && Dispatch.now) {
  31308. defer = function defer(id) {
  31309. Dispatch.now(ctx(run, id, 1));
  31310. };
  31311. // Browsers with MessageChannel, includes WebWorkers
  31312. } else if (MessageChannel) {
  31313. channel = new MessageChannel();
  31314. port = channel.port2;
  31315. channel.port1.onmessage = listener;
  31316. defer = ctx(port.postMessage, port, 1);
  31317. // Browsers with postMessage, skip WebWorkers
  31318. // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
  31319. } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) {
  31320. defer = function defer(id) {
  31321. global.postMessage(id + '', '*');
  31322. };
  31323. global.addEventListener('message', listener, false);
  31324. // IE8-
  31325. } else if (ONREADYSTATECHANGE in cel('script')) {
  31326. defer = function defer(id) {
  31327. html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () {
  31328. html.removeChild(this);
  31329. run.call(id);
  31330. };
  31331. };
  31332. // Rest old browsers
  31333. } else {
  31334. defer = function defer(id) {
  31335. setTimeout(ctx(run, id, 1), 0);
  31336. };
  31337. }
  31338. }
  31339. module.exports = {
  31340. set: setTask,
  31341. clear: clearTask
  31342. };
  31343. /***/ }),
  31344. /***/ 6241:
  31345. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  31346. var toInteger = __webpack_require__(3230);
  31347. var max = Math.max;
  31348. var min = Math.min;
  31349. module.exports = function (index, length) {
  31350. index = toInteger(index);
  31351. return index < 0 ? max(index + length, 0) : min(index, length);
  31352. };
  31353. /***/ }),
  31354. /***/ 3472:
  31355. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  31356. // https://tc39.github.io/ecma262/#sec-toindex
  31357. var toInteger = __webpack_require__(3230);
  31358. var toLength = __webpack_require__(8315);
  31359. module.exports = function (it) {
  31360. if (it === undefined) return 0;
  31361. var number = toInteger(it);
  31362. var length = toLength(number);
  31363. if (number !== length) throw RangeError('Wrong length!');
  31364. return length;
  31365. };
  31366. /***/ }),
  31367. /***/ 3230:
  31368. /***/ ((module) => {
  31369. // 7.1.4 ToInteger
  31370. var ceil = Math.ceil;
  31371. var floor = Math.floor;
  31372. module.exports = function (it) {
  31373. return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
  31374. };
  31375. /***/ }),
  31376. /***/ 8499:
  31377. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  31378. // to indexed object, toObject with fallback for non-array-like ES3 strings
  31379. var IObject = __webpack_require__(331);
  31380. var defined = __webpack_require__(408);
  31381. module.exports = function (it) {
  31382. return IObject(defined(it));
  31383. };
  31384. /***/ }),
  31385. /***/ 8315:
  31386. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  31387. // 7.1.15 ToLength
  31388. var toInteger = __webpack_require__(3230);
  31389. var min = Math.min;
  31390. module.exports = function (it) {
  31391. return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
  31392. };
  31393. /***/ }),
  31394. /***/ 2515:
  31395. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  31396. // 7.1.13 ToObject(argument)
  31397. var defined = __webpack_require__(408);
  31398. module.exports = function (it) {
  31399. return Object(defined(it));
  31400. };
  31401. /***/ }),
  31402. /***/ 8537:
  31403. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  31404. // 7.1.1 ToPrimitive(input [, PreferredType])
  31405. var isObject = __webpack_require__(7156);
  31406. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  31407. // and the second argument - flag - preferred type is a string
  31408. module.exports = function (it, S) {
  31409. if (!isObject(it)) return it;
  31410. var fn, val;
  31411. if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
  31412. if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
  31413. if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
  31414. throw TypeError("Can't convert object to primitive value");
  31415. };
  31416. /***/ }),
  31417. /***/ 431:
  31418. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  31419. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  31420. if (__webpack_require__(4926)) {
  31421. var LIBRARY = __webpack_require__(4219);
  31422. var global = __webpack_require__(7381);
  31423. var fails = __webpack_require__(5810);
  31424. var $export = __webpack_require__(5913);
  31425. var $typed = __webpack_require__(9161);
  31426. var $buffer = __webpack_require__(9782);
  31427. var ctx = __webpack_require__(566);
  31428. var anInstance = __webpack_require__(2702);
  31429. var propertyDesc = __webpack_require__(6256);
  31430. var hide = __webpack_require__(8012);
  31431. var redefineAll = __webpack_require__(7228);
  31432. var toInteger = __webpack_require__(3230);
  31433. var toLength = __webpack_require__(8315);
  31434. var toIndex = __webpack_require__(3472);
  31435. var toAbsoluteIndex = __webpack_require__(6241);
  31436. var toPrimitive = __webpack_require__(8537);
  31437. var has = __webpack_require__(5389);
  31438. var classof = __webpack_require__(2858);
  31439. var isObject = __webpack_require__(7156);
  31440. var toObject = __webpack_require__(2515);
  31441. var isArrayIter = __webpack_require__(7063);
  31442. var create = __webpack_require__(4275);
  31443. var getPrototypeOf = __webpack_require__(4153);
  31444. var gOPN = (__webpack_require__(2982).f);
  31445. var getIterFn = __webpack_require__(7637);
  31446. var uid = __webpack_require__(7936);
  31447. var wks = __webpack_require__(3336);
  31448. var createArrayMethod = __webpack_require__(3970);
  31449. var createArrayIncludes = __webpack_require__(4687);
  31450. var speciesConstructor = __webpack_require__(2035);
  31451. var ArrayIterators = __webpack_require__(4806);
  31452. var Iterators = __webpack_require__(5301);
  31453. var $iterDetect = __webpack_require__(5508);
  31454. var setSpecies = __webpack_require__(4798);
  31455. var arrayFill = __webpack_require__(1132);
  31456. var arrayCopyWithin = __webpack_require__(2147);
  31457. var $DP = __webpack_require__(4835);
  31458. var $GOPD = __webpack_require__(3299);
  31459. var dP = $DP.f;
  31460. var gOPD = $GOPD.f;
  31461. var RangeError = global.RangeError;
  31462. var TypeError = global.TypeError;
  31463. var Uint8Array = global.Uint8Array;
  31464. var ARRAY_BUFFER = 'ArrayBuffer';
  31465. var SHARED_BUFFER = 'Shared' + ARRAY_BUFFER;
  31466. var BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT';
  31467. var PROTOTYPE = 'prototype';
  31468. var ArrayProto = Array[PROTOTYPE];
  31469. var $ArrayBuffer = $buffer.ArrayBuffer;
  31470. var $DataView = $buffer.DataView;
  31471. var arrayForEach = createArrayMethod(0);
  31472. var arrayFilter = createArrayMethod(2);
  31473. var arraySome = createArrayMethod(3);
  31474. var arrayEvery = createArrayMethod(4);
  31475. var arrayFind = createArrayMethod(5);
  31476. var arrayFindIndex = createArrayMethod(6);
  31477. var arrayIncludes = createArrayIncludes(true);
  31478. var arrayIndexOf = createArrayIncludes(false);
  31479. var arrayValues = ArrayIterators.values;
  31480. var arrayKeys = ArrayIterators.keys;
  31481. var arrayEntries = ArrayIterators.entries;
  31482. var arrayLastIndexOf = ArrayProto.lastIndexOf;
  31483. var arrayReduce = ArrayProto.reduce;
  31484. var arrayReduceRight = ArrayProto.reduceRight;
  31485. var arrayJoin = ArrayProto.join;
  31486. var arraySort = ArrayProto.sort;
  31487. var arraySlice = ArrayProto.slice;
  31488. var arrayToString = ArrayProto.toString;
  31489. var arrayToLocaleString = ArrayProto.toLocaleString;
  31490. var ITERATOR = wks('iterator');
  31491. var TAG = wks('toStringTag');
  31492. var TYPED_CONSTRUCTOR = uid('typed_constructor');
  31493. var DEF_CONSTRUCTOR = uid('def_constructor');
  31494. var ALL_CONSTRUCTORS = $typed.CONSTR;
  31495. var TYPED_ARRAY = $typed.TYPED;
  31496. var VIEW = $typed.VIEW;
  31497. var WRONG_LENGTH = 'Wrong length!';
  31498. var $map = createArrayMethod(1, function (O, length) {
  31499. return allocate(speciesConstructor(O, O[DEF_CONSTRUCTOR]), length);
  31500. });
  31501. var LITTLE_ENDIAN = fails(function () {
  31502. // eslint-disable-next-line no-undef
  31503. return new Uint8Array(new Uint16Array([1]).buffer)[0] === 1;
  31504. });
  31505. var FORCED_SET = !!Uint8Array && !!Uint8Array[PROTOTYPE].set && fails(function () {
  31506. new Uint8Array(1).set({});
  31507. });
  31508. var toOffset = function toOffset(it, BYTES) {
  31509. var offset = toInteger(it);
  31510. if (offset < 0 || offset % BYTES) throw RangeError('Wrong offset!');
  31511. return offset;
  31512. };
  31513. var validate = function validate(it) {
  31514. if (isObject(it) && TYPED_ARRAY in it) return it;
  31515. throw TypeError(it + ' is not a typed array!');
  31516. };
  31517. var allocate = function allocate(C, length) {
  31518. if (!(isObject(C) && TYPED_CONSTRUCTOR in C)) {
  31519. throw TypeError('It is not a typed array constructor!');
  31520. }
  31521. return new C(length);
  31522. };
  31523. var speciesFromList = function speciesFromList(O, list) {
  31524. return fromList(speciesConstructor(O, O[DEF_CONSTRUCTOR]), list);
  31525. };
  31526. var fromList = function fromList(C, list) {
  31527. var index = 0;
  31528. var length = list.length;
  31529. var result = allocate(C, length);
  31530. while (length > index) result[index] = list[index++];
  31531. return result;
  31532. };
  31533. var addGetter = function addGetter(it, key, internal) {
  31534. dP(it, key, {
  31535. get: function get() {
  31536. return this._d[internal];
  31537. }
  31538. });
  31539. };
  31540. var $from = function from(source /* , mapfn, thisArg */) {
  31541. var O = toObject(source);
  31542. var aLen = arguments.length;
  31543. var mapfn = aLen > 1 ? arguments[1] : undefined;
  31544. var mapping = mapfn !== undefined;
  31545. var iterFn = getIterFn(O);
  31546. var i, length, values, result, step, iterator;
  31547. if (iterFn != undefined && !isArrayIter(iterFn)) {
  31548. for (iterator = iterFn.call(O), values = [], i = 0; !(step = iterator.next()).done; i++) {
  31549. values.push(step.value);
  31550. }
  31551. O = values;
  31552. }
  31553. if (mapping && aLen > 2) mapfn = ctx(mapfn, arguments[2], 2);
  31554. for (i = 0, length = toLength(O.length), result = allocate(this, length); length > i; i++) {
  31555. result[i] = mapping ? mapfn(O[i], i) : O[i];
  31556. }
  31557. return result;
  31558. };
  31559. var $of = function of( /* ...items */
  31560. ) {
  31561. var index = 0;
  31562. var length = arguments.length;
  31563. var result = allocate(this, length);
  31564. while (length > index) result[index] = arguments[index++];
  31565. return result;
  31566. };
  31567. // iOS Safari 6.x fails here
  31568. var TO_LOCALE_BUG = !!Uint8Array && fails(function () {
  31569. arrayToLocaleString.call(new Uint8Array(1));
  31570. });
  31571. var $toLocaleString = function toLocaleString() {
  31572. return arrayToLocaleString.apply(TO_LOCALE_BUG ? arraySlice.call(validate(this)) : validate(this), arguments);
  31573. };
  31574. var proto = {
  31575. copyWithin: function copyWithin(target, start /* , end */) {
  31576. return arrayCopyWithin.call(validate(this), target, start, arguments.length > 2 ? arguments[2] : undefined);
  31577. },
  31578. every: function every(callbackfn /* , thisArg */) {
  31579. return arrayEvery(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  31580. },
  31581. fill: function fill(value /* , start, end */) {
  31582. // eslint-disable-line no-unused-vars
  31583. return arrayFill.apply(validate(this), arguments);
  31584. },
  31585. filter: function filter(callbackfn /* , thisArg */) {
  31586. return speciesFromList(this, arrayFilter(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined));
  31587. },
  31588. find: function find(predicate /* , thisArg */) {
  31589. return arrayFind(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
  31590. },
  31591. findIndex: function findIndex(predicate /* , thisArg */) {
  31592. return arrayFindIndex(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
  31593. },
  31594. forEach: function forEach(callbackfn /* , thisArg */) {
  31595. arrayForEach(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  31596. },
  31597. indexOf: function indexOf(searchElement /* , fromIndex */) {
  31598. return arrayIndexOf(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);
  31599. },
  31600. includes: function includes(searchElement /* , fromIndex */) {
  31601. return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);
  31602. },
  31603. join: function join(separator) {
  31604. // eslint-disable-line no-unused-vars
  31605. return arrayJoin.apply(validate(this), arguments);
  31606. },
  31607. lastIndexOf: function lastIndexOf(searchElement /* , fromIndex */) {
  31608. // eslint-disable-line no-unused-vars
  31609. return arrayLastIndexOf.apply(validate(this), arguments);
  31610. },
  31611. map: function map(mapfn /* , thisArg */) {
  31612. return $map(validate(this), mapfn, arguments.length > 1 ? arguments[1] : undefined);
  31613. },
  31614. reduce: function reduce(callbackfn /* , initialValue */) {
  31615. // eslint-disable-line no-unused-vars
  31616. return arrayReduce.apply(validate(this), arguments);
  31617. },
  31618. reduceRight: function reduceRight(callbackfn /* , initialValue */) {
  31619. // eslint-disable-line no-unused-vars
  31620. return arrayReduceRight.apply(validate(this), arguments);
  31621. },
  31622. reverse: function reverse() {
  31623. var that = this;
  31624. var length = validate(that).length;
  31625. var middle = Math.floor(length / 2);
  31626. var index = 0;
  31627. var value;
  31628. while (index < middle) {
  31629. value = that[index];
  31630. that[index++] = that[--length];
  31631. that[length] = value;
  31632. }
  31633. return that;
  31634. },
  31635. some: function some(callbackfn /* , thisArg */) {
  31636. return arraySome(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  31637. },
  31638. sort: function sort(comparefn) {
  31639. return arraySort.call(validate(this), comparefn);
  31640. },
  31641. subarray: function subarray(begin, end) {
  31642. var O = validate(this);
  31643. var length = O.length;
  31644. var $begin = toAbsoluteIndex(begin, length);
  31645. return new (speciesConstructor(O, O[DEF_CONSTRUCTOR]))(O.buffer, O.byteOffset + $begin * O.BYTES_PER_ELEMENT, toLength((end === undefined ? length : toAbsoluteIndex(end, length)) - $begin));
  31646. }
  31647. };
  31648. var $slice = function slice(start, end) {
  31649. return speciesFromList(this, arraySlice.call(validate(this), start, end));
  31650. };
  31651. var $set = function set(arrayLike /* , offset */) {
  31652. validate(this);
  31653. var offset = toOffset(arguments[1], 1);
  31654. var length = this.length;
  31655. var src = toObject(arrayLike);
  31656. var len = toLength(src.length);
  31657. var index = 0;
  31658. if (len + offset > length) throw RangeError(WRONG_LENGTH);
  31659. while (index < len) this[offset + index] = src[index++];
  31660. };
  31661. var $iterators = {
  31662. entries: function entries() {
  31663. return arrayEntries.call(validate(this));
  31664. },
  31665. keys: function keys() {
  31666. return arrayKeys.call(validate(this));
  31667. },
  31668. values: function values() {
  31669. return arrayValues.call(validate(this));
  31670. }
  31671. };
  31672. var isTAIndex = function isTAIndex(target, key) {
  31673. return isObject(target) && target[TYPED_ARRAY] && _typeof(key) != 'symbol' && key in target && String(+key) == String(key);
  31674. };
  31675. var $getDesc = function getOwnPropertyDescriptor(target, key) {
  31676. return isTAIndex(target, key = toPrimitive(key, true)) ? propertyDesc(2, target[key]) : gOPD(target, key);
  31677. };
  31678. var $setDesc = function defineProperty(target, key, desc) {
  31679. if (isTAIndex(target, key = toPrimitive(key, true)) && isObject(desc) && has(desc, 'value') && !has(desc, 'get') && !has(desc, 'set')
  31680. // TODO: add validation descriptor w/o calling accessors
  31681. && !desc.configurable && (!has(desc, 'writable') || desc.writable) && (!has(desc, 'enumerable') || desc.enumerable)) {
  31682. target[key] = desc.value;
  31683. return target;
  31684. }
  31685. return dP(target, key, desc);
  31686. };
  31687. if (!ALL_CONSTRUCTORS) {
  31688. $GOPD.f = $getDesc;
  31689. $DP.f = $setDesc;
  31690. }
  31691. $export($export.S + $export.F * !ALL_CONSTRUCTORS, 'Object', {
  31692. getOwnPropertyDescriptor: $getDesc,
  31693. defineProperty: $setDesc
  31694. });
  31695. if (fails(function () {
  31696. arrayToString.call({});
  31697. })) {
  31698. arrayToString = arrayToLocaleString = function toString() {
  31699. return arrayJoin.call(this);
  31700. };
  31701. }
  31702. var $TypedArrayPrototype$ = redefineAll({}, proto);
  31703. redefineAll($TypedArrayPrototype$, $iterators);
  31704. hide($TypedArrayPrototype$, ITERATOR, $iterators.values);
  31705. redefineAll($TypedArrayPrototype$, {
  31706. slice: $slice,
  31707. set: $set,
  31708. constructor: function constructor() {/* noop */},
  31709. toString: arrayToString,
  31710. toLocaleString: $toLocaleString
  31711. });
  31712. addGetter($TypedArrayPrototype$, 'buffer', 'b');
  31713. addGetter($TypedArrayPrototype$, 'byteOffset', 'o');
  31714. addGetter($TypedArrayPrototype$, 'byteLength', 'l');
  31715. addGetter($TypedArrayPrototype$, 'length', 'e');
  31716. dP($TypedArrayPrototype$, TAG, {
  31717. get: function get() {
  31718. return this[TYPED_ARRAY];
  31719. }
  31720. });
  31721. // eslint-disable-next-line max-statements
  31722. module.exports = function (KEY, BYTES, wrapper, CLAMPED) {
  31723. CLAMPED = !!CLAMPED;
  31724. var NAME = KEY + (CLAMPED ? 'Clamped' : '') + 'Array';
  31725. var GETTER = 'get' + KEY;
  31726. var SETTER = 'set' + KEY;
  31727. var TypedArray = global[NAME];
  31728. var Base = TypedArray || {};
  31729. var TAC = TypedArray && getPrototypeOf(TypedArray);
  31730. var FORCED = !TypedArray || !$typed.ABV;
  31731. var O = {};
  31732. var TypedArrayPrototype = TypedArray && TypedArray[PROTOTYPE];
  31733. var getter = function getter(that, index) {
  31734. var data = that._d;
  31735. return data.v[GETTER](index * BYTES + data.o, LITTLE_ENDIAN);
  31736. };
  31737. var setter = function setter(that, index, value) {
  31738. var data = that._d;
  31739. if (CLAMPED) value = (value = Math.round(value)) < 0 ? 0 : value > 0xff ? 0xff : value & 0xff;
  31740. data.v[SETTER](index * BYTES + data.o, value, LITTLE_ENDIAN);
  31741. };
  31742. var addElement = function addElement(that, index) {
  31743. dP(that, index, {
  31744. get: function get() {
  31745. return getter(this, index);
  31746. },
  31747. set: function set(value) {
  31748. return setter(this, index, value);
  31749. },
  31750. enumerable: true
  31751. });
  31752. };
  31753. if (FORCED) {
  31754. TypedArray = wrapper(function (that, data, $offset, $length) {
  31755. anInstance(that, TypedArray, NAME, '_d');
  31756. var index = 0;
  31757. var offset = 0;
  31758. var buffer, byteLength, length, klass;
  31759. if (!isObject(data)) {
  31760. length = toIndex(data);
  31761. byteLength = length * BYTES;
  31762. buffer = new $ArrayBuffer(byteLength);
  31763. } else if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) {
  31764. buffer = data;
  31765. offset = toOffset($offset, BYTES);
  31766. var $len = data.byteLength;
  31767. if ($length === undefined) {
  31768. if ($len % BYTES) throw RangeError(WRONG_LENGTH);
  31769. byteLength = $len - offset;
  31770. if (byteLength < 0) throw RangeError(WRONG_LENGTH);
  31771. } else {
  31772. byteLength = toLength($length) * BYTES;
  31773. if (byteLength + offset > $len) throw RangeError(WRONG_LENGTH);
  31774. }
  31775. length = byteLength / BYTES;
  31776. } else if (TYPED_ARRAY in data) {
  31777. return fromList(TypedArray, data);
  31778. } else {
  31779. return $from.call(TypedArray, data);
  31780. }
  31781. hide(that, '_d', {
  31782. b: buffer,
  31783. o: offset,
  31784. l: byteLength,
  31785. e: length,
  31786. v: new $DataView(buffer)
  31787. });
  31788. while (index < length) addElement(that, index++);
  31789. });
  31790. TypedArrayPrototype = TypedArray[PROTOTYPE] = create($TypedArrayPrototype$);
  31791. hide(TypedArrayPrototype, 'constructor', TypedArray);
  31792. } else if (!fails(function () {
  31793. TypedArray(1);
  31794. }) || !fails(function () {
  31795. new TypedArray(-1); // eslint-disable-line no-new
  31796. }) || !$iterDetect(function (iter) {
  31797. new TypedArray(); // eslint-disable-line no-new
  31798. new TypedArray(null); // eslint-disable-line no-new
  31799. new TypedArray(1.5); // eslint-disable-line no-new
  31800. new TypedArray(iter); // eslint-disable-line no-new
  31801. }, true)) {
  31802. TypedArray = wrapper(function (that, data, $offset, $length) {
  31803. anInstance(that, TypedArray, NAME);
  31804. var klass;
  31805. // `ws` module bug, temporarily remove validation length for Uint8Array
  31806. // https://github.com/websockets/ws/pull/645
  31807. if (!isObject(data)) return new Base(toIndex(data));
  31808. if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) {
  31809. return $length !== undefined ? new Base(data, toOffset($offset, BYTES), $length) : $offset !== undefined ? new Base(data, toOffset($offset, BYTES)) : new Base(data);
  31810. }
  31811. if (TYPED_ARRAY in data) return fromList(TypedArray, data);
  31812. return $from.call(TypedArray, data);
  31813. });
  31814. arrayForEach(TAC !== Function.prototype ? gOPN(Base).concat(gOPN(TAC)) : gOPN(Base), function (key) {
  31815. if (!(key in TypedArray)) hide(TypedArray, key, Base[key]);
  31816. });
  31817. TypedArray[PROTOTYPE] = TypedArrayPrototype;
  31818. if (!LIBRARY) TypedArrayPrototype.constructor = TypedArray;
  31819. }
  31820. var $nativeIterator = TypedArrayPrototype[ITERATOR];
  31821. var CORRECT_ITER_NAME = !!$nativeIterator && ($nativeIterator.name == 'values' || $nativeIterator.name == undefined);
  31822. var $iterator = $iterators.values;
  31823. hide(TypedArray, TYPED_CONSTRUCTOR, true);
  31824. hide(TypedArrayPrototype, TYPED_ARRAY, NAME);
  31825. hide(TypedArrayPrototype, VIEW, true);
  31826. hide(TypedArrayPrototype, DEF_CONSTRUCTOR, TypedArray);
  31827. if (CLAMPED ? new TypedArray(1)[TAG] != NAME : !(TAG in TypedArrayPrototype)) {
  31828. dP(TypedArrayPrototype, TAG, {
  31829. get: function get() {
  31830. return NAME;
  31831. }
  31832. });
  31833. }
  31834. O[NAME] = TypedArray;
  31835. $export($export.G + $export.W + $export.F * (TypedArray != Base), O);
  31836. $export($export.S, NAME, {
  31837. BYTES_PER_ELEMENT: BYTES
  31838. });
  31839. $export($export.S + $export.F * fails(function () {
  31840. Base.of.call(TypedArray, 1);
  31841. }), NAME, {
  31842. from: $from,
  31843. of: $of
  31844. });
  31845. if (!(BYTES_PER_ELEMENT in TypedArrayPrototype)) hide(TypedArrayPrototype, BYTES_PER_ELEMENT, BYTES);
  31846. $export($export.P, NAME, proto);
  31847. setSpecies(NAME);
  31848. $export($export.P + $export.F * FORCED_SET, NAME, {
  31849. set: $set
  31850. });
  31851. $export($export.P + $export.F * !CORRECT_ITER_NAME, NAME, $iterators);
  31852. if (!LIBRARY && TypedArrayPrototype.toString != arrayToString) TypedArrayPrototype.toString = arrayToString;
  31853. $export($export.P + $export.F * fails(function () {
  31854. new TypedArray(1).slice();
  31855. }), NAME, {
  31856. slice: $slice
  31857. });
  31858. $export($export.P + $export.F * (fails(function () {
  31859. return [1, 2].toLocaleString() != new TypedArray([1, 2]).toLocaleString();
  31860. }) || !fails(function () {
  31861. TypedArrayPrototype.toLocaleString.call([1, 2]);
  31862. })), NAME, {
  31863. toLocaleString: $toLocaleString
  31864. });
  31865. Iterators[NAME] = CORRECT_ITER_NAME ? $nativeIterator : $iterator;
  31866. if (!LIBRARY && !CORRECT_ITER_NAME) hide(TypedArrayPrototype, ITERATOR, $iterator);
  31867. };
  31868. } else module.exports = function () {/* empty */};
  31869. /***/ }),
  31870. /***/ 9782:
  31871. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  31872. var global = __webpack_require__(7381);
  31873. var DESCRIPTORS = __webpack_require__(4926);
  31874. var LIBRARY = __webpack_require__(4219);
  31875. var $typed = __webpack_require__(9161);
  31876. var hide = __webpack_require__(8012);
  31877. var redefineAll = __webpack_require__(7228);
  31878. var fails = __webpack_require__(5810);
  31879. var anInstance = __webpack_require__(2702);
  31880. var toInteger = __webpack_require__(3230);
  31881. var toLength = __webpack_require__(8315);
  31882. var toIndex = __webpack_require__(3472);
  31883. var gOPN = (__webpack_require__(2982).f);
  31884. var dP = (__webpack_require__(4835).f);
  31885. var arrayFill = __webpack_require__(1132);
  31886. var setToStringTag = __webpack_require__(8094);
  31887. var ARRAY_BUFFER = 'ArrayBuffer';
  31888. var DATA_VIEW = 'DataView';
  31889. var PROTOTYPE = 'prototype';
  31890. var WRONG_LENGTH = 'Wrong length!';
  31891. var WRONG_INDEX = 'Wrong index!';
  31892. var $ArrayBuffer = global[ARRAY_BUFFER];
  31893. var $DataView = global[DATA_VIEW];
  31894. var Math = global.Math;
  31895. var RangeError = global.RangeError;
  31896. // eslint-disable-next-line no-shadow-restricted-names
  31897. var Infinity = global.Infinity;
  31898. var BaseBuffer = $ArrayBuffer;
  31899. var abs = Math.abs;
  31900. var pow = Math.pow;
  31901. var floor = Math.floor;
  31902. var log = Math.log;
  31903. var LN2 = Math.LN2;
  31904. var BUFFER = 'buffer';
  31905. var BYTE_LENGTH = 'byteLength';
  31906. var BYTE_OFFSET = 'byteOffset';
  31907. var $BUFFER = DESCRIPTORS ? '_b' : BUFFER;
  31908. var $LENGTH = DESCRIPTORS ? '_l' : BYTE_LENGTH;
  31909. var $OFFSET = DESCRIPTORS ? '_o' : BYTE_OFFSET;
  31910. // IEEE754 conversions based on https://github.com/feross/ieee754
  31911. function packIEEE754(value, mLen, nBytes) {
  31912. var buffer = new Array(nBytes);
  31913. var eLen = nBytes * 8 - mLen - 1;
  31914. var eMax = (1 << eLen) - 1;
  31915. var eBias = eMax >> 1;
  31916. var rt = mLen === 23 ? pow(2, -24) - pow(2, -77) : 0;
  31917. var i = 0;
  31918. var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
  31919. var e, m, c;
  31920. value = abs(value);
  31921. // eslint-disable-next-line no-self-compare
  31922. if (value != value || value === Infinity) {
  31923. // eslint-disable-next-line no-self-compare
  31924. m = value != value ? 1 : 0;
  31925. e = eMax;
  31926. } else {
  31927. e = floor(log(value) / LN2);
  31928. if (value * (c = pow(2, -e)) < 1) {
  31929. e--;
  31930. c *= 2;
  31931. }
  31932. if (e + eBias >= 1) {
  31933. value += rt / c;
  31934. } else {
  31935. value += rt * pow(2, 1 - eBias);
  31936. }
  31937. if (value * c >= 2) {
  31938. e++;
  31939. c /= 2;
  31940. }
  31941. if (e + eBias >= eMax) {
  31942. m = 0;
  31943. e = eMax;
  31944. } else if (e + eBias >= 1) {
  31945. m = (value * c - 1) * pow(2, mLen);
  31946. e = e + eBias;
  31947. } else {
  31948. m = value * pow(2, eBias - 1) * pow(2, mLen);
  31949. e = 0;
  31950. }
  31951. }
  31952. for (; mLen >= 8; buffer[i++] = m & 255, m /= 256, mLen -= 8);
  31953. e = e << mLen | m;
  31954. eLen += mLen;
  31955. for (; eLen > 0; buffer[i++] = e & 255, e /= 256, eLen -= 8);
  31956. buffer[--i] |= s * 128;
  31957. return buffer;
  31958. }
  31959. function unpackIEEE754(buffer, mLen, nBytes) {
  31960. var eLen = nBytes * 8 - mLen - 1;
  31961. var eMax = (1 << eLen) - 1;
  31962. var eBias = eMax >> 1;
  31963. var nBits = eLen - 7;
  31964. var i = nBytes - 1;
  31965. var s = buffer[i--];
  31966. var e = s & 127;
  31967. var m;
  31968. s >>= 7;
  31969. for (; nBits > 0; e = e * 256 + buffer[i], i--, nBits -= 8);
  31970. m = e & (1 << -nBits) - 1;
  31971. e >>= -nBits;
  31972. nBits += mLen;
  31973. for (; nBits > 0; m = m * 256 + buffer[i], i--, nBits -= 8);
  31974. if (e === 0) {
  31975. e = 1 - eBias;
  31976. } else if (e === eMax) {
  31977. return m ? NaN : s ? -Infinity : Infinity;
  31978. } else {
  31979. m = m + pow(2, mLen);
  31980. e = e - eBias;
  31981. }
  31982. return (s ? -1 : 1) * m * pow(2, e - mLen);
  31983. }
  31984. function unpackI32(bytes) {
  31985. return bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0];
  31986. }
  31987. function packI8(it) {
  31988. return [it & 0xff];
  31989. }
  31990. function packI16(it) {
  31991. return [it & 0xff, it >> 8 & 0xff];
  31992. }
  31993. function packI32(it) {
  31994. return [it & 0xff, it >> 8 & 0xff, it >> 16 & 0xff, it >> 24 & 0xff];
  31995. }
  31996. function packF64(it) {
  31997. return packIEEE754(it, 52, 8);
  31998. }
  31999. function packF32(it) {
  32000. return packIEEE754(it, 23, 4);
  32001. }
  32002. function addGetter(C, key, internal) {
  32003. dP(C[PROTOTYPE], key, {
  32004. get: function get() {
  32005. return this[internal];
  32006. }
  32007. });
  32008. }
  32009. function get(view, bytes, index, isLittleEndian) {
  32010. var numIndex = +index;
  32011. var intIndex = toIndex(numIndex);
  32012. if (intIndex + bytes > view[$LENGTH]) throw RangeError(WRONG_INDEX);
  32013. var store = view[$BUFFER]._b;
  32014. var start = intIndex + view[$OFFSET];
  32015. var pack = store.slice(start, start + bytes);
  32016. return isLittleEndian ? pack : pack.reverse();
  32017. }
  32018. function set(view, bytes, index, conversion, value, isLittleEndian) {
  32019. var numIndex = +index;
  32020. var intIndex = toIndex(numIndex);
  32021. if (intIndex + bytes > view[$LENGTH]) throw RangeError(WRONG_INDEX);
  32022. var store = view[$BUFFER]._b;
  32023. var start = intIndex + view[$OFFSET];
  32024. var pack = conversion(+value);
  32025. for (var i = 0; i < bytes; i++) store[start + i] = pack[isLittleEndian ? i : bytes - i - 1];
  32026. }
  32027. if (!$typed.ABV) {
  32028. $ArrayBuffer = function ArrayBuffer(length) {
  32029. anInstance(this, $ArrayBuffer, ARRAY_BUFFER);
  32030. var byteLength = toIndex(length);
  32031. this._b = arrayFill.call(new Array(byteLength), 0);
  32032. this[$LENGTH] = byteLength;
  32033. };
  32034. $DataView = function DataView(buffer, byteOffset, byteLength) {
  32035. anInstance(this, $DataView, DATA_VIEW);
  32036. anInstance(buffer, $ArrayBuffer, DATA_VIEW);
  32037. var bufferLength = buffer[$LENGTH];
  32038. var offset = toInteger(byteOffset);
  32039. if (offset < 0 || offset > bufferLength) throw RangeError('Wrong offset!');
  32040. byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength);
  32041. if (offset + byteLength > bufferLength) throw RangeError(WRONG_LENGTH);
  32042. this[$BUFFER] = buffer;
  32043. this[$OFFSET] = offset;
  32044. this[$LENGTH] = byteLength;
  32045. };
  32046. if (DESCRIPTORS) {
  32047. addGetter($ArrayBuffer, BYTE_LENGTH, '_l');
  32048. addGetter($DataView, BUFFER, '_b');
  32049. addGetter($DataView, BYTE_LENGTH, '_l');
  32050. addGetter($DataView, BYTE_OFFSET, '_o');
  32051. }
  32052. redefineAll($DataView[PROTOTYPE], {
  32053. getInt8: function getInt8(byteOffset) {
  32054. return get(this, 1, byteOffset)[0] << 24 >> 24;
  32055. },
  32056. getUint8: function getUint8(byteOffset) {
  32057. return get(this, 1, byteOffset)[0];
  32058. },
  32059. getInt16: function getInt16(byteOffset /* , littleEndian */) {
  32060. var bytes = get(this, 2, byteOffset, arguments[1]);
  32061. return (bytes[1] << 8 | bytes[0]) << 16 >> 16;
  32062. },
  32063. getUint16: function getUint16(byteOffset /* , littleEndian */) {
  32064. var bytes = get(this, 2, byteOffset, arguments[1]);
  32065. return bytes[1] << 8 | bytes[0];
  32066. },
  32067. getInt32: function getInt32(byteOffset /* , littleEndian */) {
  32068. return unpackI32(get(this, 4, byteOffset, arguments[1]));
  32069. },
  32070. getUint32: function getUint32(byteOffset /* , littleEndian */) {
  32071. return unpackI32(get(this, 4, byteOffset, arguments[1])) >>> 0;
  32072. },
  32073. getFloat32: function getFloat32(byteOffset /* , littleEndian */) {
  32074. return unpackIEEE754(get(this, 4, byteOffset, arguments[1]), 23, 4);
  32075. },
  32076. getFloat64: function getFloat64(byteOffset /* , littleEndian */) {
  32077. return unpackIEEE754(get(this, 8, byteOffset, arguments[1]), 52, 8);
  32078. },
  32079. setInt8: function setInt8(byteOffset, value) {
  32080. set(this, 1, byteOffset, packI8, value);
  32081. },
  32082. setUint8: function setUint8(byteOffset, value) {
  32083. set(this, 1, byteOffset, packI8, value);
  32084. },
  32085. setInt16: function setInt16(byteOffset, value /* , littleEndian */) {
  32086. set(this, 2, byteOffset, packI16, value, arguments[2]);
  32087. },
  32088. setUint16: function setUint16(byteOffset, value /* , littleEndian */) {
  32089. set(this, 2, byteOffset, packI16, value, arguments[2]);
  32090. },
  32091. setInt32: function setInt32(byteOffset, value /* , littleEndian */) {
  32092. set(this, 4, byteOffset, packI32, value, arguments[2]);
  32093. },
  32094. setUint32: function setUint32(byteOffset, value /* , littleEndian */) {
  32095. set(this, 4, byteOffset, packI32, value, arguments[2]);
  32096. },
  32097. setFloat32: function setFloat32(byteOffset, value /* , littleEndian */) {
  32098. set(this, 4, byteOffset, packF32, value, arguments[2]);
  32099. },
  32100. setFloat64: function setFloat64(byteOffset, value /* , littleEndian */) {
  32101. set(this, 8, byteOffset, packF64, value, arguments[2]);
  32102. }
  32103. });
  32104. } else {
  32105. if (!fails(function () {
  32106. $ArrayBuffer(1);
  32107. }) || !fails(function () {
  32108. new $ArrayBuffer(-1); // eslint-disable-line no-new
  32109. }) || fails(function () {
  32110. new $ArrayBuffer(); // eslint-disable-line no-new
  32111. new $ArrayBuffer(1.5); // eslint-disable-line no-new
  32112. new $ArrayBuffer(NaN); // eslint-disable-line no-new
  32113. return $ArrayBuffer.name != ARRAY_BUFFER;
  32114. })) {
  32115. $ArrayBuffer = function ArrayBuffer(length) {
  32116. anInstance(this, $ArrayBuffer);
  32117. return new BaseBuffer(toIndex(length));
  32118. };
  32119. var ArrayBufferProto = $ArrayBuffer[PROTOTYPE] = BaseBuffer[PROTOTYPE];
  32120. for (var keys = gOPN(BaseBuffer), j = 0, key; keys.length > j;) {
  32121. if (!((key = keys[j++]) in $ArrayBuffer)) hide($ArrayBuffer, key, BaseBuffer[key]);
  32122. }
  32123. if (!LIBRARY) ArrayBufferProto.constructor = $ArrayBuffer;
  32124. }
  32125. // iOS Safari 7.x bug
  32126. var view = new $DataView(new $ArrayBuffer(2));
  32127. var $setInt8 = $DataView[PROTOTYPE].setInt8;
  32128. view.setInt8(0, 2147483648);
  32129. view.setInt8(1, 2147483649);
  32130. if (view.getInt8(0) || !view.getInt8(1)) redefineAll($DataView[PROTOTYPE], {
  32131. setInt8: function setInt8(byteOffset, value) {
  32132. $setInt8.call(this, byteOffset, value << 24 >> 24);
  32133. },
  32134. setUint8: function setUint8(byteOffset, value) {
  32135. $setInt8.call(this, byteOffset, value << 24 >> 24);
  32136. }
  32137. }, true);
  32138. }
  32139. setToStringTag($ArrayBuffer, ARRAY_BUFFER);
  32140. setToStringTag($DataView, DATA_VIEW);
  32141. hide($DataView[PROTOTYPE], $typed.VIEW, true);
  32142. exports[ARRAY_BUFFER] = $ArrayBuffer;
  32143. exports[DATA_VIEW] = $DataView;
  32144. /***/ }),
  32145. /***/ 9161:
  32146. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  32147. var global = __webpack_require__(7381);
  32148. var hide = __webpack_require__(8012);
  32149. var uid = __webpack_require__(7936);
  32150. var TYPED = uid('typed_array');
  32151. var VIEW = uid('view');
  32152. var ABV = !!(global.ArrayBuffer && global.DataView);
  32153. var CONSTR = ABV;
  32154. var i = 0;
  32155. var l = 9;
  32156. var Typed;
  32157. var TypedArrayConstructors = 'Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array'.split(',');
  32158. while (i < l) {
  32159. if (Typed = global[TypedArrayConstructors[i++]]) {
  32160. hide(Typed.prototype, TYPED, true);
  32161. hide(Typed.prototype, VIEW, true);
  32162. } else CONSTR = false;
  32163. }
  32164. module.exports = {
  32165. ABV: ABV,
  32166. CONSTR: CONSTR,
  32167. TYPED: TYPED,
  32168. VIEW: VIEW
  32169. };
  32170. /***/ }),
  32171. /***/ 7936:
  32172. /***/ ((module) => {
  32173. var id = 0;
  32174. var px = Math.random();
  32175. module.exports = function (key) {
  32176. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
  32177. };
  32178. /***/ }),
  32179. /***/ 851:
  32180. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  32181. var global = __webpack_require__(7381);
  32182. var navigator = global.navigator;
  32183. module.exports = navigator && navigator.userAgent || '';
  32184. /***/ }),
  32185. /***/ 8546:
  32186. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  32187. var isObject = __webpack_require__(7156);
  32188. module.exports = function (it, TYPE) {
  32189. if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!');
  32190. return it;
  32191. };
  32192. /***/ }),
  32193. /***/ 5721:
  32194. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  32195. var global = __webpack_require__(7381);
  32196. var core = __webpack_require__(8544);
  32197. var LIBRARY = __webpack_require__(4219);
  32198. var wksExt = __webpack_require__(9078);
  32199. var defineProperty = (__webpack_require__(4835).f);
  32200. module.exports = function (name) {
  32201. var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
  32202. if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, {
  32203. value: wksExt.f(name)
  32204. });
  32205. };
  32206. /***/ }),
  32207. /***/ 9078:
  32208. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  32209. exports.f = __webpack_require__(3336);
  32210. /***/ }),
  32211. /***/ 3336:
  32212. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  32213. var store = __webpack_require__(3192)('wks');
  32214. var uid = __webpack_require__(7936);
  32215. var _Symbol = (__webpack_require__(7381).Symbol);
  32216. var USE_SYMBOL = typeof _Symbol == 'function';
  32217. var $exports = module.exports = function (name) {
  32218. return store[name] || (store[name] = USE_SYMBOL && _Symbol[name] || (USE_SYMBOL ? _Symbol : uid)('Symbol.' + name));
  32219. };
  32220. $exports.store = store;
  32221. /***/ }),
  32222. /***/ 7637:
  32223. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  32224. var classof = __webpack_require__(2858);
  32225. var ITERATOR = __webpack_require__(3336)('iterator');
  32226. var Iterators = __webpack_require__(5301);
  32227. module.exports = (__webpack_require__(8544).getIteratorMethod) = function (it) {
  32228. if (it != undefined) return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)];
  32229. };
  32230. /***/ }),
  32231. /***/ 9122:
  32232. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32233. // https://github.com/benjamingr/RexExp.escape
  32234. var $export = __webpack_require__(5913);
  32235. var $re = __webpack_require__(6813)(/[\\^$*+?.()|[\]{}]/g, '\\$&');
  32236. $export($export.S, 'RegExp', {
  32237. escape: function escape(it) {
  32238. return $re(it);
  32239. }
  32240. });
  32241. /***/ }),
  32242. /***/ 4611:
  32243. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32244. // 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
  32245. var $export = __webpack_require__(5913);
  32246. $export($export.P, 'Array', {
  32247. copyWithin: __webpack_require__(2147)
  32248. });
  32249. __webpack_require__(4339)('copyWithin');
  32250. /***/ }),
  32251. /***/ 9892:
  32252. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32253. var $export = __webpack_require__(5913);
  32254. var $every = __webpack_require__(3970)(4);
  32255. $export($export.P + $export.F * !__webpack_require__(1411)([].every, true), 'Array', {
  32256. // 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg])
  32257. every: function every(callbackfn /* , thisArg */) {
  32258. return $every(this, callbackfn, arguments[1]);
  32259. }
  32260. });
  32261. /***/ }),
  32262. /***/ 9217:
  32263. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32264. // 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
  32265. var $export = __webpack_require__(5913);
  32266. $export($export.P, 'Array', {
  32267. fill: __webpack_require__(1132)
  32268. });
  32269. __webpack_require__(4339)('fill');
  32270. /***/ }),
  32271. /***/ 9355:
  32272. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32273. var $export = __webpack_require__(5913);
  32274. var $filter = __webpack_require__(3970)(2);
  32275. $export($export.P + $export.F * !__webpack_require__(1411)([].filter, true), 'Array', {
  32276. // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg])
  32277. filter: function filter(callbackfn /* , thisArg */) {
  32278. return $filter(this, callbackfn, arguments[1]);
  32279. }
  32280. });
  32281. /***/ }),
  32282. /***/ 109:
  32283. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32284. // 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined)
  32285. var $export = __webpack_require__(5913);
  32286. var $find = __webpack_require__(3970)(6);
  32287. var KEY = 'findIndex';
  32288. var forced = true;
  32289. // Shouldn't skip holes
  32290. if (KEY in []) Array(1)[KEY](function () {
  32291. forced = false;
  32292. });
  32293. $export($export.P + $export.F * forced, 'Array', {
  32294. findIndex: function findIndex(callbackfn /* , that = undefined */) {
  32295. return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  32296. }
  32297. });
  32298. __webpack_require__(4339)(KEY);
  32299. /***/ }),
  32300. /***/ 4138:
  32301. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32302. // 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined)
  32303. var $export = __webpack_require__(5913);
  32304. var $find = __webpack_require__(3970)(5);
  32305. var KEY = 'find';
  32306. var forced = true;
  32307. // Shouldn't skip holes
  32308. if (KEY in []) Array(1)[KEY](function () {
  32309. forced = false;
  32310. });
  32311. $export($export.P + $export.F * forced, 'Array', {
  32312. find: function find(callbackfn /* , that = undefined */) {
  32313. return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  32314. }
  32315. });
  32316. __webpack_require__(4339)(KEY);
  32317. /***/ }),
  32318. /***/ 791:
  32319. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32320. var $export = __webpack_require__(5913);
  32321. var $forEach = __webpack_require__(3970)(0);
  32322. var STRICT = __webpack_require__(1411)([].forEach, true);
  32323. $export($export.P + $export.F * !STRICT, 'Array', {
  32324. // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg])
  32325. forEach: function forEach(callbackfn /* , thisArg */) {
  32326. return $forEach(this, callbackfn, arguments[1]);
  32327. }
  32328. });
  32329. /***/ }),
  32330. /***/ 8671:
  32331. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32332. var ctx = __webpack_require__(566);
  32333. var $export = __webpack_require__(5913);
  32334. var toObject = __webpack_require__(2515);
  32335. var call = __webpack_require__(2471);
  32336. var isArrayIter = __webpack_require__(7063);
  32337. var toLength = __webpack_require__(8315);
  32338. var createProperty = __webpack_require__(1348);
  32339. var getIterFn = __webpack_require__(7637);
  32340. $export($export.S + $export.F * !__webpack_require__(5508)(function (iter) {
  32341. Array.from(iter);
  32342. }), 'Array', {
  32343. // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
  32344. from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
  32345. var O = toObject(arrayLike);
  32346. var C = typeof this == 'function' ? this : Array;
  32347. var aLen = arguments.length;
  32348. var mapfn = aLen > 1 ? arguments[1] : undefined;
  32349. var mapping = mapfn !== undefined;
  32350. var index = 0;
  32351. var iterFn = getIterFn(O);
  32352. var length, result, step, iterator;
  32353. if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);
  32354. // if object isn't iterable or it's array with default iterator - use simple case
  32355. if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) {
  32356. for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) {
  32357. createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value);
  32358. }
  32359. } else {
  32360. length = toLength(O.length);
  32361. for (result = new C(length); length > index; index++) {
  32362. createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
  32363. }
  32364. }
  32365. result.length = index;
  32366. return result;
  32367. }
  32368. });
  32369. /***/ }),
  32370. /***/ 4751:
  32371. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32372. var $export = __webpack_require__(5913);
  32373. var $indexOf = __webpack_require__(4687)(false);
  32374. var $native = [].indexOf;
  32375. var NEGATIVE_ZERO = !!$native && 1 / [1].indexOf(1, -0) < 0;
  32376. $export($export.P + $export.F * (NEGATIVE_ZERO || !__webpack_require__(1411)($native)), 'Array', {
  32377. // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex])
  32378. indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
  32379. return NEGATIVE_ZERO
  32380. // convert -0 to +0
  32381. ? $native.apply(this, arguments) || 0 : $indexOf(this, searchElement, arguments[1]);
  32382. }
  32383. });
  32384. /***/ }),
  32385. /***/ 1621:
  32386. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32387. // 22.1.2.2 / 15.4.3.2 Array.isArray(arg)
  32388. var $export = __webpack_require__(5913);
  32389. $export($export.S, 'Array', {
  32390. isArray: __webpack_require__(1320)
  32391. });
  32392. /***/ }),
  32393. /***/ 4806:
  32394. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  32395. var addToUnscopables = __webpack_require__(4339);
  32396. var step = __webpack_require__(7218);
  32397. var Iterators = __webpack_require__(5301);
  32398. var toIObject = __webpack_require__(8499);
  32399. // 22.1.3.4 Array.prototype.entries()
  32400. // 22.1.3.13 Array.prototype.keys()
  32401. // 22.1.3.29 Array.prototype.values()
  32402. // 22.1.3.30 Array.prototype[@@iterator]()
  32403. module.exports = __webpack_require__(4873)(Array, 'Array', function (iterated, kind) {
  32404. this._t = toIObject(iterated); // target
  32405. this._i = 0; // next index
  32406. this._k = kind; // kind
  32407. // 22.1.5.2.1 %ArrayIteratorPrototype%.next()
  32408. }, function () {
  32409. var O = this._t;
  32410. var kind = this._k;
  32411. var index = this._i++;
  32412. if (!O || index >= O.length) {
  32413. this._t = undefined;
  32414. return step(1);
  32415. }
  32416. if (kind == 'keys') return step(0, index);
  32417. if (kind == 'values') return step(0, O[index]);
  32418. return step(0, [index, O[index]]);
  32419. }, 'values');
  32420. // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
  32421. Iterators.Arguments = Iterators.Array;
  32422. addToUnscopables('keys');
  32423. addToUnscopables('values');
  32424. addToUnscopables('entries');
  32425. /***/ }),
  32426. /***/ 9437:
  32427. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32428. // 22.1.3.13 Array.prototype.join(separator)
  32429. var $export = __webpack_require__(5913);
  32430. var toIObject = __webpack_require__(8499);
  32431. var arrayJoin = [].join;
  32432. // fallback for not array-like strings
  32433. $export($export.P + $export.F * (__webpack_require__(331) != Object || !__webpack_require__(1411)(arrayJoin)), 'Array', {
  32434. join: function join(separator) {
  32435. return arrayJoin.call(toIObject(this), separator === undefined ? ',' : separator);
  32436. }
  32437. });
  32438. /***/ }),
  32439. /***/ 9822:
  32440. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32441. var $export = __webpack_require__(5913);
  32442. var toIObject = __webpack_require__(8499);
  32443. var toInteger = __webpack_require__(3230);
  32444. var toLength = __webpack_require__(8315);
  32445. var $native = [].lastIndexOf;
  32446. var NEGATIVE_ZERO = !!$native && 1 / [1].lastIndexOf(1, -0) < 0;
  32447. $export($export.P + $export.F * (NEGATIVE_ZERO || !__webpack_require__(1411)($native)), 'Array', {
  32448. // 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex])
  32449. lastIndexOf: function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) {
  32450. // convert -0 to +0
  32451. if (NEGATIVE_ZERO) return $native.apply(this, arguments) || 0;
  32452. var O = toIObject(this);
  32453. var length = toLength(O.length);
  32454. var index = length - 1;
  32455. if (arguments.length > 1) index = Math.min(index, toInteger(arguments[1]));
  32456. if (index < 0) index = length + index;
  32457. for (; index >= 0; index--) if (index in O) if (O[index] === searchElement) return index || 0;
  32458. return -1;
  32459. }
  32460. });
  32461. /***/ }),
  32462. /***/ 633:
  32463. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32464. var $export = __webpack_require__(5913);
  32465. var $map = __webpack_require__(3970)(1);
  32466. $export($export.P + $export.F * !__webpack_require__(1411)([].map, true), 'Array', {
  32467. // 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg])
  32468. map: function map(callbackfn /* , thisArg */) {
  32469. return $map(this, callbackfn, arguments[1]);
  32470. }
  32471. });
  32472. /***/ }),
  32473. /***/ 6705:
  32474. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32475. var $export = __webpack_require__(5913);
  32476. var createProperty = __webpack_require__(1348);
  32477. // WebKit Array.of isn't generic
  32478. $export($export.S + $export.F * __webpack_require__(5810)(function () {
  32479. function F() {/* empty */}
  32480. return !(Array.of.call(F) instanceof F);
  32481. }), 'Array', {
  32482. // 22.1.2.3 Array.of( ...items)
  32483. of: function of( /* ...args */
  32484. ) {
  32485. var index = 0;
  32486. var aLen = arguments.length;
  32487. var result = new (typeof this == 'function' ? this : Array)(aLen);
  32488. while (aLen > index) createProperty(result, index, arguments[index++]);
  32489. result.length = aLen;
  32490. return result;
  32491. }
  32492. });
  32493. /***/ }),
  32494. /***/ 8738:
  32495. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32496. var $export = __webpack_require__(5913);
  32497. var $reduce = __webpack_require__(6419);
  32498. $export($export.P + $export.F * !__webpack_require__(1411)([].reduceRight, true), 'Array', {
  32499. // 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue])
  32500. reduceRight: function reduceRight(callbackfn /* , initialValue */) {
  32501. return $reduce(this, callbackfn, arguments.length, arguments[1], true);
  32502. }
  32503. });
  32504. /***/ }),
  32505. /***/ 9121:
  32506. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32507. var $export = __webpack_require__(5913);
  32508. var $reduce = __webpack_require__(6419);
  32509. $export($export.P + $export.F * !__webpack_require__(1411)([].reduce, true), 'Array', {
  32510. // 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue])
  32511. reduce: function reduce(callbackfn /* , initialValue */) {
  32512. return $reduce(this, callbackfn, arguments.length, arguments[1], false);
  32513. }
  32514. });
  32515. /***/ }),
  32516. /***/ 7263:
  32517. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32518. var $export = __webpack_require__(5913);
  32519. var html = __webpack_require__(1225);
  32520. var cof = __webpack_require__(3679);
  32521. var toAbsoluteIndex = __webpack_require__(6241);
  32522. var toLength = __webpack_require__(8315);
  32523. var arraySlice = [].slice;
  32524. // fallback for not array-like ES3 strings and DOM objects
  32525. $export($export.P + $export.F * __webpack_require__(5810)(function () {
  32526. if (html) arraySlice.call(html);
  32527. }), 'Array', {
  32528. slice: function slice(begin, end) {
  32529. var len = toLength(this.length);
  32530. var klass = cof(this);
  32531. end = end === undefined ? len : end;
  32532. if (klass == 'Array') return arraySlice.call(this, begin, end);
  32533. var start = toAbsoluteIndex(begin, len);
  32534. var upTo = toAbsoluteIndex(end, len);
  32535. var size = toLength(upTo - start);
  32536. var cloned = new Array(size);
  32537. var i = 0;
  32538. for (; i < size; i++) cloned[i] = klass == 'String' ? this.charAt(start + i) : this[start + i];
  32539. return cloned;
  32540. }
  32541. });
  32542. /***/ }),
  32543. /***/ 9253:
  32544. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32545. var $export = __webpack_require__(5913);
  32546. var $some = __webpack_require__(3970)(3);
  32547. $export($export.P + $export.F * !__webpack_require__(1411)([].some, true), 'Array', {
  32548. // 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg])
  32549. some: function some(callbackfn /* , thisArg */) {
  32550. return $some(this, callbackfn, arguments[1]);
  32551. }
  32552. });
  32553. /***/ }),
  32554. /***/ 919:
  32555. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32556. var $export = __webpack_require__(5913);
  32557. var aFunction = __webpack_require__(6819);
  32558. var toObject = __webpack_require__(2515);
  32559. var fails = __webpack_require__(5810);
  32560. var $sort = [].sort;
  32561. var test = [1, 2, 3];
  32562. $export($export.P + $export.F * (fails(function () {
  32563. // IE8-
  32564. test.sort(undefined);
  32565. }) || !fails(function () {
  32566. // V8 bug
  32567. test.sort(null);
  32568. // Old WebKit
  32569. }) || !__webpack_require__(1411)($sort)), 'Array', {
  32570. // 22.1.3.25 Array.prototype.sort(comparefn)
  32571. sort: function sort(comparefn) {
  32572. return comparefn === undefined ? $sort.call(toObject(this)) : $sort.call(toObject(this), aFunction(comparefn));
  32573. }
  32574. });
  32575. /***/ }),
  32576. /***/ 3821:
  32577. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32578. __webpack_require__(4798)('Array');
  32579. /***/ }),
  32580. /***/ 8384:
  32581. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32582. // 20.3.3.1 / 15.9.4.4 Date.now()
  32583. var $export = __webpack_require__(5913);
  32584. $export($export.S, 'Date', {
  32585. now: function now() {
  32586. return new Date().getTime();
  32587. }
  32588. });
  32589. /***/ }),
  32590. /***/ 9701:
  32591. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32592. // 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString()
  32593. var $export = __webpack_require__(5913);
  32594. var toISOString = __webpack_require__(2115);
  32595. // PhantomJS / old WebKit has a broken implementations
  32596. $export($export.P + $export.F * (Date.prototype.toISOString !== toISOString), 'Date', {
  32597. toISOString: toISOString
  32598. });
  32599. /***/ }),
  32600. /***/ 2334:
  32601. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32602. var $export = __webpack_require__(5913);
  32603. var toObject = __webpack_require__(2515);
  32604. var toPrimitive = __webpack_require__(8537);
  32605. $export($export.P + $export.F * __webpack_require__(5810)(function () {
  32606. return new Date(NaN).toJSON() !== null || Date.prototype.toJSON.call({
  32607. toISOString: function toISOString() {
  32608. return 1;
  32609. }
  32610. }) !== 1;
  32611. }), 'Date', {
  32612. // eslint-disable-next-line no-unused-vars
  32613. toJSON: function toJSON(key) {
  32614. var O = toObject(this);
  32615. var pv = toPrimitive(O);
  32616. return typeof pv == 'number' && !isFinite(pv) ? null : O.toISOString();
  32617. }
  32618. });
  32619. /***/ }),
  32620. /***/ 3233:
  32621. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32622. var TO_PRIMITIVE = __webpack_require__(3336)('toPrimitive');
  32623. var proto = Date.prototype;
  32624. if (!(TO_PRIMITIVE in proto)) __webpack_require__(8012)(proto, TO_PRIMITIVE, __webpack_require__(296));
  32625. /***/ }),
  32626. /***/ 1325:
  32627. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32628. var DateProto = Date.prototype;
  32629. var INVALID_DATE = 'Invalid Date';
  32630. var TO_STRING = 'toString';
  32631. var $toString = DateProto[TO_STRING];
  32632. var getTime = DateProto.getTime;
  32633. if (new Date(NaN) + '' != INVALID_DATE) {
  32634. __webpack_require__(7278)(DateProto, TO_STRING, function toString() {
  32635. var value = getTime.call(this);
  32636. // eslint-disable-next-line no-self-compare
  32637. return value === value ? $toString.call(this) : INVALID_DATE;
  32638. });
  32639. }
  32640. /***/ }),
  32641. /***/ 161:
  32642. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32643. // 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...)
  32644. var $export = __webpack_require__(5913);
  32645. $export($export.P, 'Function', {
  32646. bind: __webpack_require__(8327)
  32647. });
  32648. /***/ }),
  32649. /***/ 15:
  32650. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32651. var isObject = __webpack_require__(7156);
  32652. var getPrototypeOf = __webpack_require__(4153);
  32653. var HAS_INSTANCE = __webpack_require__(3336)('hasInstance');
  32654. var FunctionProto = Function.prototype;
  32655. // 19.2.3.6 Function.prototype[@@hasInstance](V)
  32656. if (!(HAS_INSTANCE in FunctionProto)) (__webpack_require__(4835).f)(FunctionProto, HAS_INSTANCE, {
  32657. value: function value(O) {
  32658. if (typeof this != 'function' || !isObject(O)) return false;
  32659. if (!isObject(this.prototype)) return O instanceof this;
  32660. // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this:
  32661. while (O = getPrototypeOf(O)) if (this.prototype === O) return true;
  32662. return false;
  32663. }
  32664. });
  32665. /***/ }),
  32666. /***/ 6042:
  32667. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32668. var dP = (__webpack_require__(4835).f);
  32669. var FProto = Function.prototype;
  32670. var nameRE = /^\s*function ([^ (]*)/;
  32671. var NAME = 'name';
  32672. // 19.2.4.2 name
  32673. NAME in FProto || __webpack_require__(4926) && dP(FProto, NAME, {
  32674. configurable: true,
  32675. get: function get() {
  32676. try {
  32677. return ('' + this).match(nameRE)[1];
  32678. } catch (e) {
  32679. return '';
  32680. }
  32681. }
  32682. });
  32683. /***/ }),
  32684. /***/ 8969:
  32685. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  32686. var strong = __webpack_require__(4396);
  32687. var validate = __webpack_require__(8546);
  32688. var MAP = 'Map';
  32689. // 23.1 Map Objects
  32690. module.exports = __webpack_require__(1966)(MAP, function (get) {
  32691. return function Map() {
  32692. return get(this, arguments.length > 0 ? arguments[0] : undefined);
  32693. };
  32694. }, {
  32695. // 23.1.3.6 Map.prototype.get(key)
  32696. get: function get(key) {
  32697. var entry = strong.getEntry(validate(this, MAP), key);
  32698. return entry && entry.v;
  32699. },
  32700. // 23.1.3.9 Map.prototype.set(key, value)
  32701. set: function set(key, value) {
  32702. return strong.def(validate(this, MAP), key === 0 ? 0 : key, value);
  32703. }
  32704. }, strong, true);
  32705. /***/ }),
  32706. /***/ 4717:
  32707. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32708. // 20.2.2.3 Math.acosh(x)
  32709. var $export = __webpack_require__(5913);
  32710. var log1p = __webpack_require__(5447);
  32711. var sqrt = Math.sqrt;
  32712. var $acosh = Math.acosh;
  32713. $export($export.S + $export.F * !($acosh
  32714. // V8 bug: https://code.google.com/p/v8/issues/detail?id=3509
  32715. && Math.floor($acosh(Number.MAX_VALUE)) == 710
  32716. // Tor Browser bug: Math.acosh(Infinity) -> NaN
  32717. && $acosh(Infinity) == Infinity), 'Math', {
  32718. acosh: function acosh(x) {
  32719. return (x = +x) < 1 ? NaN : x > 94906265.62425156 ? Math.log(x) + Math.LN2 : log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1));
  32720. }
  32721. });
  32722. /***/ }),
  32723. /***/ 7292:
  32724. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32725. // 20.2.2.5 Math.asinh(x)
  32726. var $export = __webpack_require__(5913);
  32727. var $asinh = Math.asinh;
  32728. function asinh(x) {
  32729. return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : Math.log(x + Math.sqrt(x * x + 1));
  32730. }
  32731. // Tor Browser bug: Math.asinh(0) -> -0
  32732. $export($export.S + $export.F * !($asinh && 1 / $asinh(0) > 0), 'Math', {
  32733. asinh: asinh
  32734. });
  32735. /***/ }),
  32736. /***/ 1840:
  32737. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32738. // 20.2.2.7 Math.atanh(x)
  32739. var $export = __webpack_require__(5913);
  32740. var $atanh = Math.atanh;
  32741. // Tor Browser bug: Math.atanh(-0) -> 0
  32742. $export($export.S + $export.F * !($atanh && 1 / $atanh(-0) < 0), 'Math', {
  32743. atanh: function atanh(x) {
  32744. return (x = +x) == 0 ? x : Math.log((1 + x) / (1 - x)) / 2;
  32745. }
  32746. });
  32747. /***/ }),
  32748. /***/ 3255:
  32749. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32750. // 20.2.2.9 Math.cbrt(x)
  32751. var $export = __webpack_require__(5913);
  32752. var sign = __webpack_require__(4012);
  32753. $export($export.S, 'Math', {
  32754. cbrt: function cbrt(x) {
  32755. return sign(x = +x) * Math.pow(Math.abs(x), 1 / 3);
  32756. }
  32757. });
  32758. /***/ }),
  32759. /***/ 5728:
  32760. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32761. // 20.2.2.11 Math.clz32(x)
  32762. var $export = __webpack_require__(5913);
  32763. $export($export.S, 'Math', {
  32764. clz32: function clz32(x) {
  32765. return (x >>>= 0) ? 31 - Math.floor(Math.log(x + 0.5) * Math.LOG2E) : 32;
  32766. }
  32767. });
  32768. /***/ }),
  32769. /***/ 6255:
  32770. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32771. // 20.2.2.12 Math.cosh(x)
  32772. var $export = __webpack_require__(5913);
  32773. var exp = Math.exp;
  32774. $export($export.S, 'Math', {
  32775. cosh: function cosh(x) {
  32776. return (exp(x = +x) + exp(-x)) / 2;
  32777. }
  32778. });
  32779. /***/ }),
  32780. /***/ 2834:
  32781. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32782. // 20.2.2.14 Math.expm1(x)
  32783. var $export = __webpack_require__(5913);
  32784. var $expm1 = __webpack_require__(4774);
  32785. $export($export.S + $export.F * ($expm1 != Math.expm1), 'Math', {
  32786. expm1: $expm1
  32787. });
  32788. /***/ }),
  32789. /***/ 4489:
  32790. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32791. // 20.2.2.16 Math.fround(x)
  32792. var $export = __webpack_require__(5913);
  32793. $export($export.S, 'Math', {
  32794. fround: __webpack_require__(3800)
  32795. });
  32796. /***/ }),
  32797. /***/ 575:
  32798. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32799. // 20.2.2.17 Math.hypot([value1[, value2[, … ]]])
  32800. var $export = __webpack_require__(5913);
  32801. var abs = Math.abs;
  32802. $export($export.S, 'Math', {
  32803. hypot: function hypot(value1, value2) {
  32804. // eslint-disable-line no-unused-vars
  32805. var sum = 0;
  32806. var i = 0;
  32807. var aLen = arguments.length;
  32808. var larg = 0;
  32809. var arg, div;
  32810. while (i < aLen) {
  32811. arg = abs(arguments[i++]);
  32812. if (larg < arg) {
  32813. div = larg / arg;
  32814. sum = sum * div * div + 1;
  32815. larg = arg;
  32816. } else if (arg > 0) {
  32817. div = arg / larg;
  32818. sum += div * div;
  32819. } else sum += arg;
  32820. }
  32821. return larg === Infinity ? Infinity : larg * Math.sqrt(sum);
  32822. }
  32823. });
  32824. /***/ }),
  32825. /***/ 1369:
  32826. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32827. // 20.2.2.18 Math.imul(x, y)
  32828. var $export = __webpack_require__(5913);
  32829. var $imul = Math.imul;
  32830. // some WebKit versions fails with big numbers, some has wrong arity
  32831. $export($export.S + $export.F * __webpack_require__(5810)(function () {
  32832. return $imul(0xffffffff, 5) != -5 || $imul.length != 2;
  32833. }), 'Math', {
  32834. imul: function imul(x, y) {
  32835. var UINT16 = 0xffff;
  32836. var xn = +x;
  32837. var yn = +y;
  32838. var xl = UINT16 & xn;
  32839. var yl = UINT16 & yn;
  32840. return 0 | xl * yl + ((UINT16 & xn >>> 16) * yl + xl * (UINT16 & yn >>> 16) << 16 >>> 0);
  32841. }
  32842. });
  32843. /***/ }),
  32844. /***/ 2751:
  32845. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32846. // 20.2.2.21 Math.log10(x)
  32847. var $export = __webpack_require__(5913);
  32848. $export($export.S, 'Math', {
  32849. log10: function log10(x) {
  32850. return Math.log(x) * Math.LOG10E;
  32851. }
  32852. });
  32853. /***/ }),
  32854. /***/ 9617:
  32855. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32856. // 20.2.2.20 Math.log1p(x)
  32857. var $export = __webpack_require__(5913);
  32858. $export($export.S, 'Math', {
  32859. log1p: __webpack_require__(5447)
  32860. });
  32861. /***/ }),
  32862. /***/ 3656:
  32863. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32864. // 20.2.2.22 Math.log2(x)
  32865. var $export = __webpack_require__(5913);
  32866. $export($export.S, 'Math', {
  32867. log2: function log2(x) {
  32868. return Math.log(x) / Math.LN2;
  32869. }
  32870. });
  32871. /***/ }),
  32872. /***/ 1850:
  32873. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32874. // 20.2.2.28 Math.sign(x)
  32875. var $export = __webpack_require__(5913);
  32876. $export($export.S, 'Math', {
  32877. sign: __webpack_require__(4012)
  32878. });
  32879. /***/ }),
  32880. /***/ 5424:
  32881. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32882. // 20.2.2.30 Math.sinh(x)
  32883. var $export = __webpack_require__(5913);
  32884. var expm1 = __webpack_require__(4774);
  32885. var exp = Math.exp;
  32886. // V8 near Chromium 38 has a problem with very small numbers
  32887. $export($export.S + $export.F * __webpack_require__(5810)(function () {
  32888. return !Math.sinh(-2e-17) != -2e-17;
  32889. }), 'Math', {
  32890. sinh: function sinh(x) {
  32891. return Math.abs(x = +x) < 1 ? (expm1(x) - expm1(-x)) / 2 : (exp(x - 1) - exp(-x - 1)) * (Math.E / 2);
  32892. }
  32893. });
  32894. /***/ }),
  32895. /***/ 230:
  32896. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32897. // 20.2.2.33 Math.tanh(x)
  32898. var $export = __webpack_require__(5913);
  32899. var expm1 = __webpack_require__(4774);
  32900. var exp = Math.exp;
  32901. $export($export.S, 'Math', {
  32902. tanh: function tanh(x) {
  32903. var a = expm1(x = +x);
  32904. var b = expm1(-x);
  32905. return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x));
  32906. }
  32907. });
  32908. /***/ }),
  32909. /***/ 8471:
  32910. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32911. // 20.2.2.34 Math.trunc(x)
  32912. var $export = __webpack_require__(5913);
  32913. $export($export.S, 'Math', {
  32914. trunc: function trunc(it) {
  32915. return (it > 0 ? Math.floor : Math.ceil)(it);
  32916. }
  32917. });
  32918. /***/ }),
  32919. /***/ 440:
  32920. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  32921. var global = __webpack_require__(7381);
  32922. var has = __webpack_require__(5389);
  32923. var cof = __webpack_require__(3679);
  32924. var inheritIfRequired = __webpack_require__(3654);
  32925. var toPrimitive = __webpack_require__(8537);
  32926. var fails = __webpack_require__(5810);
  32927. var gOPN = (__webpack_require__(2982).f);
  32928. var gOPD = (__webpack_require__(3299).f);
  32929. var dP = (__webpack_require__(4835).f);
  32930. var $trim = (__webpack_require__(618).trim);
  32931. var NUMBER = 'Number';
  32932. var $Number = global[NUMBER];
  32933. var Base = $Number;
  32934. var proto = $Number.prototype;
  32935. // Opera ~12 has broken Object#toString
  32936. var BROKEN_COF = cof(__webpack_require__(4275)(proto)) == NUMBER;
  32937. var TRIM = ('trim' in String.prototype);
  32938. // 7.1.3 ToNumber(argument)
  32939. var toNumber = function toNumber(argument) {
  32940. var it = toPrimitive(argument, false);
  32941. if (typeof it == 'string' && it.length > 2) {
  32942. it = TRIM ? it.trim() : $trim(it, 3);
  32943. var first = it.charCodeAt(0);
  32944. var third, radix, maxCode;
  32945. if (first === 43 || first === 45) {
  32946. third = it.charCodeAt(2);
  32947. if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
  32948. } else if (first === 48) {
  32949. switch (it.charCodeAt(1)) {
  32950. case 66:
  32951. case 98:
  32952. radix = 2;
  32953. maxCode = 49;
  32954. break;
  32955. // fast equal /^0b[01]+$/i
  32956. case 79:
  32957. case 111:
  32958. radix = 8;
  32959. maxCode = 55;
  32960. break;
  32961. // fast equal /^0o[0-7]+$/i
  32962. default:
  32963. return +it;
  32964. }
  32965. for (var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++) {
  32966. code = digits.charCodeAt(i);
  32967. // parseInt parses a string to a first unavailable symbol
  32968. // but ToNumber should return NaN if a string contains unavailable symbols
  32969. if (code < 48 || code > maxCode) return NaN;
  32970. }
  32971. return parseInt(digits, radix);
  32972. }
  32973. }
  32974. return +it;
  32975. };
  32976. if (!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')) {
  32977. $Number = function Number(value) {
  32978. var it = arguments.length < 1 ? 0 : value;
  32979. var that = this;
  32980. return that instanceof $Number
  32981. // check on 1..constructor(foo) case
  32982. && (BROKEN_COF ? fails(function () {
  32983. proto.valueOf.call(that);
  32984. }) : cof(that) != NUMBER) ? inheritIfRequired(new Base(toNumber(it)), that, $Number) : toNumber(it);
  32985. };
  32986. for (var keys = __webpack_require__(4926) ? gOPN(Base) : (
  32987. // ES3:
  32988. 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
  32989. // ES6 (in case, if modules with ES6 Number statics required before):
  32990. 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' + 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger').split(','), j = 0, key; keys.length > j; j++) {
  32991. if (has(Base, key = keys[j]) && !has($Number, key)) {
  32992. dP($Number, key, gOPD(Base, key));
  32993. }
  32994. }
  32995. $Number.prototype = proto;
  32996. proto.constructor = $Number;
  32997. __webpack_require__(7278)(global, NUMBER, $Number);
  32998. }
  32999. /***/ }),
  33000. /***/ 1914:
  33001. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33002. // 20.1.2.1 Number.EPSILON
  33003. var $export = __webpack_require__(5913);
  33004. $export($export.S, 'Number', {
  33005. EPSILON: Math.pow(2, -52)
  33006. });
  33007. /***/ }),
  33008. /***/ 4117:
  33009. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33010. // 20.1.2.2 Number.isFinite(number)
  33011. var $export = __webpack_require__(5913);
  33012. var _isFinite = (__webpack_require__(7381).isFinite);
  33013. $export($export.S, 'Number', {
  33014. isFinite: function isFinite(it) {
  33015. return typeof it == 'number' && _isFinite(it);
  33016. }
  33017. });
  33018. /***/ }),
  33019. /***/ 9619:
  33020. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33021. // 20.1.2.3 Number.isInteger(number)
  33022. var $export = __webpack_require__(5913);
  33023. $export($export.S, 'Number', {
  33024. isInteger: __webpack_require__(5127)
  33025. });
  33026. /***/ }),
  33027. /***/ 5849:
  33028. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33029. // 20.1.2.4 Number.isNaN(number)
  33030. var $export = __webpack_require__(5913);
  33031. $export($export.S, 'Number', {
  33032. isNaN: function isNaN(number) {
  33033. // eslint-disable-next-line no-self-compare
  33034. return number != number;
  33035. }
  33036. });
  33037. /***/ }),
  33038. /***/ 4750:
  33039. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33040. // 20.1.2.5 Number.isSafeInteger(number)
  33041. var $export = __webpack_require__(5913);
  33042. var isInteger = __webpack_require__(5127);
  33043. var abs = Math.abs;
  33044. $export($export.S, 'Number', {
  33045. isSafeInteger: function isSafeInteger(number) {
  33046. return isInteger(number) && abs(number) <= 0x1fffffffffffff;
  33047. }
  33048. });
  33049. /***/ }),
  33050. /***/ 1550:
  33051. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33052. // 20.1.2.6 Number.MAX_SAFE_INTEGER
  33053. var $export = __webpack_require__(5913);
  33054. $export($export.S, 'Number', {
  33055. MAX_SAFE_INTEGER: 0x1fffffffffffff
  33056. });
  33057. /***/ }),
  33058. /***/ 3529:
  33059. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33060. // 20.1.2.10 Number.MIN_SAFE_INTEGER
  33061. var $export = __webpack_require__(5913);
  33062. $export($export.S, 'Number', {
  33063. MIN_SAFE_INTEGER: -0x1fffffffffffff
  33064. });
  33065. /***/ }),
  33066. /***/ 2791:
  33067. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33068. var $export = __webpack_require__(5913);
  33069. var $parseFloat = __webpack_require__(5031);
  33070. // 20.1.2.12 Number.parseFloat(string)
  33071. $export($export.S + $export.F * (Number.parseFloat != $parseFloat), 'Number', {
  33072. parseFloat: $parseFloat
  33073. });
  33074. /***/ }),
  33075. /***/ 6831:
  33076. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33077. var $export = __webpack_require__(5913);
  33078. var $parseInt = __webpack_require__(6971);
  33079. // 20.1.2.13 Number.parseInt(string, radix)
  33080. $export($export.S + $export.F * (Number.parseInt != $parseInt), 'Number', {
  33081. parseInt: $parseInt
  33082. });
  33083. /***/ }),
  33084. /***/ 1077:
  33085. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33086. var $export = __webpack_require__(5913);
  33087. var toInteger = __webpack_require__(3230);
  33088. var aNumberValue = __webpack_require__(9855);
  33089. var repeat = __webpack_require__(1924);
  33090. var $toFixed = 1.0.toFixed;
  33091. var floor = Math.floor;
  33092. var data = [0, 0, 0, 0, 0, 0];
  33093. var ERROR = 'Number.toFixed: incorrect invocation!';
  33094. var ZERO = '0';
  33095. var multiply = function multiply(n, c) {
  33096. var i = -1;
  33097. var c2 = c;
  33098. while (++i < 6) {
  33099. c2 += n * data[i];
  33100. data[i] = c2 % 1e7;
  33101. c2 = floor(c2 / 1e7);
  33102. }
  33103. };
  33104. var divide = function divide(n) {
  33105. var i = 6;
  33106. var c = 0;
  33107. while (--i >= 0) {
  33108. c += data[i];
  33109. data[i] = floor(c / n);
  33110. c = c % n * 1e7;
  33111. }
  33112. };
  33113. var numToString = function numToString() {
  33114. var i = 6;
  33115. var s = '';
  33116. while (--i >= 0) {
  33117. if (s !== '' || i === 0 || data[i] !== 0) {
  33118. var t = String(data[i]);
  33119. s = s === '' ? t : s + repeat.call(ZERO, 7 - t.length) + t;
  33120. }
  33121. }
  33122. return s;
  33123. };
  33124. var pow = function pow(x, n, acc) {
  33125. return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc);
  33126. };
  33127. var log = function log(x) {
  33128. var n = 0;
  33129. var x2 = x;
  33130. while (x2 >= 4096) {
  33131. n += 12;
  33132. x2 /= 4096;
  33133. }
  33134. while (x2 >= 2) {
  33135. n += 1;
  33136. x2 /= 2;
  33137. }
  33138. return n;
  33139. };
  33140. $export($export.P + $export.F * (!!$toFixed && (0.00008.toFixed(3) !== '0.000' || 0.9.toFixed(0) !== '1' || 1.255.toFixed(2) !== '1.25' || 1000000000000000128.0.toFixed(0) !== '1000000000000000128') || !__webpack_require__(5810)(function () {
  33141. // V8 ~ Android 4.3-
  33142. $toFixed.call({});
  33143. })), 'Number', {
  33144. toFixed: function toFixed(fractionDigits) {
  33145. var x = aNumberValue(this, ERROR);
  33146. var f = toInteger(fractionDigits);
  33147. var s = '';
  33148. var m = ZERO;
  33149. var e, z, j, k;
  33150. if (f < 0 || f > 20) throw RangeError(ERROR);
  33151. // eslint-disable-next-line no-self-compare
  33152. if (x != x) return 'NaN';
  33153. if (x <= -1e21 || x >= 1e21) return String(x);
  33154. if (x < 0) {
  33155. s = '-';
  33156. x = -x;
  33157. }
  33158. if (x > 1e-21) {
  33159. e = log(x * pow(2, 69, 1)) - 69;
  33160. z = e < 0 ? x * pow(2, -e, 1) : x / pow(2, e, 1);
  33161. z *= 0x10000000000000;
  33162. e = 52 - e;
  33163. if (e > 0) {
  33164. multiply(0, z);
  33165. j = f;
  33166. while (j >= 7) {
  33167. multiply(1e7, 0);
  33168. j -= 7;
  33169. }
  33170. multiply(pow(10, j, 1), 0);
  33171. j = e - 1;
  33172. while (j >= 23) {
  33173. divide(1 << 23);
  33174. j -= 23;
  33175. }
  33176. divide(1 << j);
  33177. multiply(1, 1);
  33178. divide(2);
  33179. m = numToString();
  33180. } else {
  33181. multiply(0, z);
  33182. multiply(1 << -e, 0);
  33183. m = numToString() + repeat.call(ZERO, f);
  33184. }
  33185. }
  33186. if (f > 0) {
  33187. k = m.length;
  33188. m = s + (k <= f ? '0.' + repeat.call(ZERO, f - k) + m : m.slice(0, k - f) + '.' + m.slice(k - f));
  33189. } else {
  33190. m = s + m;
  33191. }
  33192. return m;
  33193. }
  33194. });
  33195. /***/ }),
  33196. /***/ 820:
  33197. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33198. var $export = __webpack_require__(5913);
  33199. var $fails = __webpack_require__(5810);
  33200. var aNumberValue = __webpack_require__(9855);
  33201. var $toPrecision = 1.0.toPrecision;
  33202. $export($export.P + $export.F * ($fails(function () {
  33203. // IE7-
  33204. return $toPrecision.call(1, undefined) !== '1';
  33205. }) || !$fails(function () {
  33206. // V8 ~ Android 4.3-
  33207. $toPrecision.call({});
  33208. })), 'Number', {
  33209. toPrecision: function toPrecision(precision) {
  33210. var that = aNumberValue(this, 'Number#toPrecision: incorrect invocation!');
  33211. return precision === undefined ? $toPrecision.call(that) : $toPrecision.call(that, precision);
  33212. }
  33213. });
  33214. /***/ }),
  33215. /***/ 5331:
  33216. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33217. // 19.1.3.1 Object.assign(target, source)
  33218. var $export = __webpack_require__(5913);
  33219. $export($export.S + $export.F, 'Object', {
  33220. assign: __webpack_require__(8559)
  33221. });
  33222. /***/ }),
  33223. /***/ 3290:
  33224. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33225. var $export = __webpack_require__(5913);
  33226. // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
  33227. $export($export.S, 'Object', {
  33228. create: __webpack_require__(4275)
  33229. });
  33230. /***/ }),
  33231. /***/ 8424:
  33232. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33233. var $export = __webpack_require__(5913);
  33234. // 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties)
  33235. $export($export.S + $export.F * !__webpack_require__(4926), 'Object', {
  33236. defineProperties: __webpack_require__(6447)
  33237. });
  33238. /***/ }),
  33239. /***/ 3690:
  33240. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33241. var $export = __webpack_require__(5913);
  33242. // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
  33243. $export($export.S + $export.F * !__webpack_require__(4926), 'Object', {
  33244. defineProperty: (__webpack_require__(4835).f)
  33245. });
  33246. /***/ }),
  33247. /***/ 754:
  33248. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33249. // 19.1.2.5 Object.freeze(O)
  33250. var isObject = __webpack_require__(7156);
  33251. var meta = (__webpack_require__(3763).onFreeze);
  33252. __webpack_require__(4057)('freeze', function ($freeze) {
  33253. return function freeze(it) {
  33254. return $freeze && isObject(it) ? $freeze(meta(it)) : it;
  33255. };
  33256. });
  33257. /***/ }),
  33258. /***/ 2357:
  33259. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33260. // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
  33261. var toIObject = __webpack_require__(8499);
  33262. var $getOwnPropertyDescriptor = (__webpack_require__(3299).f);
  33263. __webpack_require__(4057)('getOwnPropertyDescriptor', function () {
  33264. return function getOwnPropertyDescriptor(it, key) {
  33265. return $getOwnPropertyDescriptor(toIObject(it), key);
  33266. };
  33267. });
  33268. /***/ }),
  33269. /***/ 6022:
  33270. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33271. // 19.1.2.7 Object.getOwnPropertyNames(O)
  33272. __webpack_require__(4057)('getOwnPropertyNames', function () {
  33273. return (__webpack_require__(3136).f);
  33274. });
  33275. /***/ }),
  33276. /***/ 6667:
  33277. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33278. // 19.1.2.9 Object.getPrototypeOf(O)
  33279. var toObject = __webpack_require__(2515);
  33280. var $getPrototypeOf = __webpack_require__(4153);
  33281. __webpack_require__(4057)('getPrototypeOf', function () {
  33282. return function getPrototypeOf(it) {
  33283. return $getPrototypeOf(toObject(it));
  33284. };
  33285. });
  33286. /***/ }),
  33287. /***/ 4919:
  33288. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33289. // 19.1.2.11 Object.isExtensible(O)
  33290. var isObject = __webpack_require__(7156);
  33291. __webpack_require__(4057)('isExtensible', function ($isExtensible) {
  33292. return function isExtensible(it) {
  33293. return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false;
  33294. };
  33295. });
  33296. /***/ }),
  33297. /***/ 9219:
  33298. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33299. // 19.1.2.12 Object.isFrozen(O)
  33300. var isObject = __webpack_require__(7156);
  33301. __webpack_require__(4057)('isFrozen', function ($isFrozen) {
  33302. return function isFrozen(it) {
  33303. return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true;
  33304. };
  33305. });
  33306. /***/ }),
  33307. /***/ 3270:
  33308. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33309. // 19.1.2.13 Object.isSealed(O)
  33310. var isObject = __webpack_require__(7156);
  33311. __webpack_require__(4057)('isSealed', function ($isSealed) {
  33312. return function isSealed(it) {
  33313. return isObject(it) ? $isSealed ? $isSealed(it) : false : true;
  33314. };
  33315. });
  33316. /***/ }),
  33317. /***/ 2456:
  33318. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33319. // 19.1.3.10 Object.is(value1, value2)
  33320. var $export = __webpack_require__(5913);
  33321. $export($export.S, 'Object', {
  33322. is: __webpack_require__(4261)
  33323. });
  33324. /***/ }),
  33325. /***/ 2506:
  33326. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33327. // 19.1.2.14 Object.keys(O)
  33328. var toObject = __webpack_require__(2515);
  33329. var $keys = __webpack_require__(9924);
  33330. __webpack_require__(4057)('keys', function () {
  33331. return function keys(it) {
  33332. return $keys(toObject(it));
  33333. };
  33334. });
  33335. /***/ }),
  33336. /***/ 6527:
  33337. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33338. // 19.1.2.15 Object.preventExtensions(O)
  33339. var isObject = __webpack_require__(7156);
  33340. var meta = (__webpack_require__(3763).onFreeze);
  33341. __webpack_require__(4057)('preventExtensions', function ($preventExtensions) {
  33342. return function preventExtensions(it) {
  33343. return $preventExtensions && isObject(it) ? $preventExtensions(meta(it)) : it;
  33344. };
  33345. });
  33346. /***/ }),
  33347. /***/ 7571:
  33348. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33349. // 19.1.2.17 Object.seal(O)
  33350. var isObject = __webpack_require__(7156);
  33351. var meta = (__webpack_require__(3763).onFreeze);
  33352. __webpack_require__(4057)('seal', function ($seal) {
  33353. return function seal(it) {
  33354. return $seal && isObject(it) ? $seal(meta(it)) : it;
  33355. };
  33356. });
  33357. /***/ }),
  33358. /***/ 8490:
  33359. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33360. // 19.1.3.19 Object.setPrototypeOf(O, proto)
  33361. var $export = __webpack_require__(5913);
  33362. $export($export.S, 'Object', {
  33363. setPrototypeOf: (__webpack_require__(6931).set)
  33364. });
  33365. /***/ }),
  33366. /***/ 4554:
  33367. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33368. // 19.1.3.6 Object.prototype.toString()
  33369. var classof = __webpack_require__(2858);
  33370. var test = {};
  33371. test[__webpack_require__(3336)('toStringTag')] = 'z';
  33372. if (test + '' != '[object z]') {
  33373. __webpack_require__(7278)(Object.prototype, 'toString', function toString() {
  33374. return '[object ' + classof(this) + ']';
  33375. }, true);
  33376. }
  33377. /***/ }),
  33378. /***/ 3271:
  33379. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33380. var $export = __webpack_require__(5913);
  33381. var $parseFloat = __webpack_require__(5031);
  33382. // 18.2.4 parseFloat(string)
  33383. $export($export.G + $export.F * (parseFloat != $parseFloat), {
  33384. parseFloat: $parseFloat
  33385. });
  33386. /***/ }),
  33387. /***/ 317:
  33388. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33389. var $export = __webpack_require__(5913);
  33390. var $parseInt = __webpack_require__(6971);
  33391. // 18.2.5 parseInt(string, radix)
  33392. $export($export.G + $export.F * (parseInt != $parseInt), {
  33393. parseInt: $parseInt
  33394. });
  33395. /***/ }),
  33396. /***/ 829:
  33397. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33398. var LIBRARY = __webpack_require__(4219);
  33399. var global = __webpack_require__(7381);
  33400. var ctx = __webpack_require__(566);
  33401. var classof = __webpack_require__(2858);
  33402. var $export = __webpack_require__(5913);
  33403. var isObject = __webpack_require__(7156);
  33404. var aFunction = __webpack_require__(6819);
  33405. var anInstance = __webpack_require__(2702);
  33406. var forOf = __webpack_require__(2734);
  33407. var speciesConstructor = __webpack_require__(2035);
  33408. var task = (__webpack_require__(8220).set);
  33409. var microtask = __webpack_require__(1842)();
  33410. var newPromiseCapabilityModule = __webpack_require__(4086);
  33411. var perform = __webpack_require__(8228);
  33412. var userAgent = __webpack_require__(851);
  33413. var promiseResolve = __webpack_require__(3507);
  33414. var PROMISE = 'Promise';
  33415. var TypeError = global.TypeError;
  33416. var process = global.process;
  33417. var versions = process && process.versions;
  33418. var v8 = versions && versions.v8 || '';
  33419. var $Promise = global[PROMISE];
  33420. var isNode = classof(process) == 'process';
  33421. var empty = function empty() {/* empty */};
  33422. var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper;
  33423. var newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f;
  33424. var USE_NATIVE = !!function () {
  33425. try {
  33426. // correct subclassing with @@species support
  33427. var promise = $Promise.resolve(1);
  33428. var FakePromise = (promise.constructor = {})[__webpack_require__(3336)('species')] = function (exec) {
  33429. exec(empty, empty);
  33430. };
  33431. // unhandled rejections tracking support, NodeJS Promise without it fails @@species test
  33432. return (isNode || typeof PromiseRejectionEvent == 'function') && promise.then(empty) instanceof FakePromise
  33433. // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
  33434. // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
  33435. // we can't detect it synchronously, so just check versions
  33436. && v8.indexOf('6.6') !== 0 && userAgent.indexOf('Chrome/66') === -1;
  33437. } catch (e) {/* empty */}
  33438. }();
  33439. // helpers
  33440. var isThenable = function isThenable(it) {
  33441. var then;
  33442. return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
  33443. };
  33444. var notify = function notify(promise, isReject) {
  33445. if (promise._n) return;
  33446. promise._n = true;
  33447. var chain = promise._c;
  33448. microtask(function () {
  33449. var value = promise._v;
  33450. var ok = promise._s == 1;
  33451. var i = 0;
  33452. var run = function run(reaction) {
  33453. var handler = ok ? reaction.ok : reaction.fail;
  33454. var resolve = reaction.resolve;
  33455. var reject = reaction.reject;
  33456. var domain = reaction.domain;
  33457. var result, then, exited;
  33458. try {
  33459. if (handler) {
  33460. if (!ok) {
  33461. if (promise._h == 2) onHandleUnhandled(promise);
  33462. promise._h = 1;
  33463. }
  33464. if (handler === true) result = value;else {
  33465. if (domain) domain.enter();
  33466. result = handler(value); // may throw
  33467. if (domain) {
  33468. domain.exit();
  33469. exited = true;
  33470. }
  33471. }
  33472. if (result === reaction.promise) {
  33473. reject(TypeError('Promise-chain cycle'));
  33474. } else if (then = isThenable(result)) {
  33475. then.call(result, resolve, reject);
  33476. } else resolve(result);
  33477. } else reject(value);
  33478. } catch (e) {
  33479. if (domain && !exited) domain.exit();
  33480. reject(e);
  33481. }
  33482. };
  33483. while (chain.length > i) run(chain[i++]); // variable length - can't use forEach
  33484. promise._c = [];
  33485. promise._n = false;
  33486. if (isReject && !promise._h) onUnhandled(promise);
  33487. });
  33488. };
  33489. var onUnhandled = function onUnhandled(promise) {
  33490. task.call(global, function () {
  33491. var value = promise._v;
  33492. var unhandled = isUnhandled(promise);
  33493. var result, handler, console;
  33494. if (unhandled) {
  33495. result = perform(function () {
  33496. if (isNode) {
  33497. process.emit('unhandledRejection', value, promise);
  33498. } else if (handler = global.onunhandledrejection) {
  33499. handler({
  33500. promise: promise,
  33501. reason: value
  33502. });
  33503. } else if ((console = global.console) && console.error) {
  33504. console.error('Unhandled promise rejection', value);
  33505. }
  33506. });
  33507. // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
  33508. promise._h = isNode || isUnhandled(promise) ? 2 : 1;
  33509. }
  33510. promise._a = undefined;
  33511. if (unhandled && result.e) throw result.v;
  33512. });
  33513. };
  33514. var isUnhandled = function isUnhandled(promise) {
  33515. return promise._h !== 1 && (promise._a || promise._c).length === 0;
  33516. };
  33517. var onHandleUnhandled = function onHandleUnhandled(promise) {
  33518. task.call(global, function () {
  33519. var handler;
  33520. if (isNode) {
  33521. process.emit('rejectionHandled', promise);
  33522. } else if (handler = global.onrejectionhandled) {
  33523. handler({
  33524. promise: promise,
  33525. reason: promise._v
  33526. });
  33527. }
  33528. });
  33529. };
  33530. var $reject = function $reject(value) {
  33531. var promise = this;
  33532. if (promise._d) return;
  33533. promise._d = true;
  33534. promise = promise._w || promise; // unwrap
  33535. promise._v = value;
  33536. promise._s = 2;
  33537. if (!promise._a) promise._a = promise._c.slice();
  33538. notify(promise, true);
  33539. };
  33540. var $resolve = function $resolve(value) {
  33541. var promise = this;
  33542. var then;
  33543. if (promise._d) return;
  33544. promise._d = true;
  33545. promise = promise._w || promise; // unwrap
  33546. try {
  33547. if (promise === value) throw TypeError("Promise can't be resolved itself");
  33548. if (then = isThenable(value)) {
  33549. microtask(function () {
  33550. var wrapper = {
  33551. _w: promise,
  33552. _d: false
  33553. }; // wrap
  33554. try {
  33555. then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
  33556. } catch (e) {
  33557. $reject.call(wrapper, e);
  33558. }
  33559. });
  33560. } else {
  33561. promise._v = value;
  33562. promise._s = 1;
  33563. notify(promise, false);
  33564. }
  33565. } catch (e) {
  33566. $reject.call({
  33567. _w: promise,
  33568. _d: false
  33569. }, e); // wrap
  33570. }
  33571. };
  33572. // constructor polyfill
  33573. if (!USE_NATIVE) {
  33574. // 25.4.3.1 Promise(executor)
  33575. $Promise = function Promise(executor) {
  33576. anInstance(this, $Promise, PROMISE, '_h');
  33577. aFunction(executor);
  33578. Internal.call(this);
  33579. try {
  33580. executor(ctx($resolve, this, 1), ctx($reject, this, 1));
  33581. } catch (err) {
  33582. $reject.call(this, err);
  33583. }
  33584. };
  33585. // eslint-disable-next-line no-unused-vars
  33586. Internal = function Promise(executor) {
  33587. this._c = []; // <- awaiting reactions
  33588. this._a = undefined; // <- checked in isUnhandled reactions
  33589. this._s = 0; // <- state
  33590. this._d = false; // <- done
  33591. this._v = undefined; // <- value
  33592. this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled
  33593. this._n = false; // <- notify
  33594. };
  33595. Internal.prototype = __webpack_require__(7228)($Promise.prototype, {
  33596. // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
  33597. then: function then(onFulfilled, onRejected) {
  33598. var reaction = newPromiseCapability(speciesConstructor(this, $Promise));
  33599. reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
  33600. reaction.fail = typeof onRejected == 'function' && onRejected;
  33601. reaction.domain = isNode ? process.domain : undefined;
  33602. this._c.push(reaction);
  33603. if (this._a) this._a.push(reaction);
  33604. if (this._s) notify(this, false);
  33605. return reaction.promise;
  33606. },
  33607. // 25.4.5.1 Promise.prototype.catch(onRejected)
  33608. 'catch': function _catch(onRejected) {
  33609. return this.then(undefined, onRejected);
  33610. }
  33611. });
  33612. OwnPromiseCapability = function OwnPromiseCapability() {
  33613. var promise = new Internal();
  33614. this.promise = promise;
  33615. this.resolve = ctx($resolve, promise, 1);
  33616. this.reject = ctx($reject, promise, 1);
  33617. };
  33618. newPromiseCapabilityModule.f = newPromiseCapability = function newPromiseCapability(C) {
  33619. return C === $Promise || C === Wrapper ? new OwnPromiseCapability(C) : newGenericPromiseCapability(C);
  33620. };
  33621. }
  33622. $export($export.G + $export.W + $export.F * !USE_NATIVE, {
  33623. Promise: $Promise
  33624. });
  33625. __webpack_require__(8094)($Promise, PROMISE);
  33626. __webpack_require__(4798)(PROMISE);
  33627. Wrapper = __webpack_require__(8544)[PROMISE];
  33628. // statics
  33629. $export($export.S + $export.F * !USE_NATIVE, PROMISE, {
  33630. // 25.4.4.5 Promise.reject(r)
  33631. reject: function reject(r) {
  33632. var capability = newPromiseCapability(this);
  33633. var $$reject = capability.reject;
  33634. $$reject(r);
  33635. return capability.promise;
  33636. }
  33637. });
  33638. $export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {
  33639. // 25.4.4.6 Promise.resolve(x)
  33640. resolve: function resolve(x) {
  33641. return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x);
  33642. }
  33643. });
  33644. $export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(5508)(function (iter) {
  33645. $Promise.all(iter)['catch'](empty);
  33646. })), PROMISE, {
  33647. // 25.4.4.1 Promise.all(iterable)
  33648. all: function all(iterable) {
  33649. var C = this;
  33650. var capability = newPromiseCapability(C);
  33651. var resolve = capability.resolve;
  33652. var reject = capability.reject;
  33653. var result = perform(function () {
  33654. var values = [];
  33655. var index = 0;
  33656. var remaining = 1;
  33657. forOf(iterable, false, function (promise) {
  33658. var $index = index++;
  33659. var alreadyCalled = false;
  33660. values.push(undefined);
  33661. remaining++;
  33662. C.resolve(promise).then(function (value) {
  33663. if (alreadyCalled) return;
  33664. alreadyCalled = true;
  33665. values[$index] = value;
  33666. --remaining || resolve(values);
  33667. }, reject);
  33668. });
  33669. --remaining || resolve(values);
  33670. });
  33671. if (result.e) reject(result.v);
  33672. return capability.promise;
  33673. },
  33674. // 25.4.4.4 Promise.race(iterable)
  33675. race: function race(iterable) {
  33676. var C = this;
  33677. var capability = newPromiseCapability(C);
  33678. var reject = capability.reject;
  33679. var result = perform(function () {
  33680. forOf(iterable, false, function (promise) {
  33681. C.resolve(promise).then(capability.resolve, reject);
  33682. });
  33683. });
  33684. if (result.e) reject(result.v);
  33685. return capability.promise;
  33686. }
  33687. });
  33688. /***/ }),
  33689. /***/ 1220:
  33690. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33691. // 26.1.1 Reflect.apply(target, thisArgument, argumentsList)
  33692. var $export = __webpack_require__(5913);
  33693. var aFunction = __webpack_require__(6819);
  33694. var anObject = __webpack_require__(6154);
  33695. var rApply = ((__webpack_require__(7381).Reflect) || {}).apply;
  33696. var fApply = Function.apply;
  33697. // MS Edge argumentsList argument is optional
  33698. $export($export.S + $export.F * !__webpack_require__(5810)(function () {
  33699. rApply(function () {/* empty */});
  33700. }), 'Reflect', {
  33701. apply: function apply(target, thisArgument, argumentsList) {
  33702. var T = aFunction(target);
  33703. var L = anObject(argumentsList);
  33704. return rApply ? rApply(T, thisArgument, L) : fApply.call(T, thisArgument, L);
  33705. }
  33706. });
  33707. /***/ }),
  33708. /***/ 9263:
  33709. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33710. // 26.1.2 Reflect.construct(target, argumentsList [, newTarget])
  33711. var $export = __webpack_require__(5913);
  33712. var create = __webpack_require__(4275);
  33713. var aFunction = __webpack_require__(6819);
  33714. var anObject = __webpack_require__(6154);
  33715. var isObject = __webpack_require__(7156);
  33716. var fails = __webpack_require__(5810);
  33717. var bind = __webpack_require__(8327);
  33718. var rConstruct = ((__webpack_require__(7381).Reflect) || {}).construct;
  33719. // MS Edge supports only 2 arguments and argumentsList argument is optional
  33720. // FF Nightly sets third argument as `new.target`, but does not create `this` from it
  33721. var NEW_TARGET_BUG = fails(function () {
  33722. function F() {/* empty */}
  33723. return !(rConstruct(function () {/* empty */}, [], F) instanceof F);
  33724. });
  33725. var ARGS_BUG = !fails(function () {
  33726. rConstruct(function () {/* empty */});
  33727. });
  33728. $export($export.S + $export.F * (NEW_TARGET_BUG || ARGS_BUG), 'Reflect', {
  33729. construct: function construct(Target, args /* , newTarget */) {
  33730. aFunction(Target);
  33731. anObject(args);
  33732. var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]);
  33733. if (ARGS_BUG && !NEW_TARGET_BUG) return rConstruct(Target, args, newTarget);
  33734. if (Target == newTarget) {
  33735. // w/o altered newTarget, optimization for 0-4 arguments
  33736. switch (args.length) {
  33737. case 0:
  33738. return new Target();
  33739. case 1:
  33740. return new Target(args[0]);
  33741. case 2:
  33742. return new Target(args[0], args[1]);
  33743. case 3:
  33744. return new Target(args[0], args[1], args[2]);
  33745. case 4:
  33746. return new Target(args[0], args[1], args[2], args[3]);
  33747. }
  33748. // w/o altered newTarget, lot of arguments case
  33749. var $args = [null];
  33750. $args.push.apply($args, args);
  33751. return new (bind.apply(Target, $args))();
  33752. }
  33753. // with altered newTarget, not support built-in constructors
  33754. var proto = newTarget.prototype;
  33755. var instance = create(isObject(proto) ? proto : Object.prototype);
  33756. var result = Function.apply.call(Target, instance, args);
  33757. return isObject(result) ? result : instance;
  33758. }
  33759. });
  33760. /***/ }),
  33761. /***/ 7622:
  33762. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33763. // 26.1.3 Reflect.defineProperty(target, propertyKey, attributes)
  33764. var dP = __webpack_require__(4835);
  33765. var $export = __webpack_require__(5913);
  33766. var anObject = __webpack_require__(6154);
  33767. var toPrimitive = __webpack_require__(8537);
  33768. // MS Edge has broken Reflect.defineProperty - throwing instead of returning false
  33769. $export($export.S + $export.F * __webpack_require__(5810)(function () {
  33770. // eslint-disable-next-line no-undef
  33771. Reflect.defineProperty(dP.f({}, 1, {
  33772. value: 1
  33773. }), 1, {
  33774. value: 2
  33775. });
  33776. }), 'Reflect', {
  33777. defineProperty: function defineProperty(target, propertyKey, attributes) {
  33778. anObject(target);
  33779. propertyKey = toPrimitive(propertyKey, true);
  33780. anObject(attributes);
  33781. try {
  33782. dP.f(target, propertyKey, attributes);
  33783. return true;
  33784. } catch (e) {
  33785. return false;
  33786. }
  33787. }
  33788. });
  33789. /***/ }),
  33790. /***/ 9060:
  33791. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33792. // 26.1.4 Reflect.deleteProperty(target, propertyKey)
  33793. var $export = __webpack_require__(5913);
  33794. var gOPD = (__webpack_require__(3299).f);
  33795. var anObject = __webpack_require__(6154);
  33796. $export($export.S, 'Reflect', {
  33797. deleteProperty: function deleteProperty(target, propertyKey) {
  33798. var desc = gOPD(anObject(target), propertyKey);
  33799. return desc && !desc.configurable ? false : delete target[propertyKey];
  33800. }
  33801. });
  33802. /***/ }),
  33803. /***/ 980:
  33804. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33805. // 26.1.5 Reflect.enumerate(target)
  33806. var $export = __webpack_require__(5913);
  33807. var anObject = __webpack_require__(6154);
  33808. var Enumerate = function Enumerate(iterated) {
  33809. this._t = anObject(iterated); // target
  33810. this._i = 0; // next index
  33811. var keys = this._k = []; // keys
  33812. var key;
  33813. for (key in iterated) keys.push(key);
  33814. };
  33815. __webpack_require__(8258)(Enumerate, 'Object', function () {
  33816. var that = this;
  33817. var keys = that._k;
  33818. var key;
  33819. do {
  33820. if (that._i >= keys.length) return {
  33821. value: undefined,
  33822. done: true
  33823. };
  33824. } while (!((key = keys[that._i++]) in that._t));
  33825. return {
  33826. value: key,
  33827. done: false
  33828. };
  33829. });
  33830. $export($export.S, 'Reflect', {
  33831. enumerate: function enumerate(target) {
  33832. return new Enumerate(target);
  33833. }
  33834. });
  33835. /***/ }),
  33836. /***/ 8484:
  33837. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33838. // 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey)
  33839. var gOPD = __webpack_require__(3299);
  33840. var $export = __webpack_require__(5913);
  33841. var anObject = __webpack_require__(6154);
  33842. $export($export.S, 'Reflect', {
  33843. getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey) {
  33844. return gOPD.f(anObject(target), propertyKey);
  33845. }
  33846. });
  33847. /***/ }),
  33848. /***/ 9869:
  33849. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33850. // 26.1.8 Reflect.getPrototypeOf(target)
  33851. var $export = __webpack_require__(5913);
  33852. var getProto = __webpack_require__(4153);
  33853. var anObject = __webpack_require__(6154);
  33854. $export($export.S, 'Reflect', {
  33855. getPrototypeOf: function getPrototypeOf(target) {
  33856. return getProto(anObject(target));
  33857. }
  33858. });
  33859. /***/ }),
  33860. /***/ 6175:
  33861. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33862. // 26.1.6 Reflect.get(target, propertyKey [, receiver])
  33863. var gOPD = __webpack_require__(3299);
  33864. var getPrototypeOf = __webpack_require__(4153);
  33865. var has = __webpack_require__(5389);
  33866. var $export = __webpack_require__(5913);
  33867. var isObject = __webpack_require__(7156);
  33868. var anObject = __webpack_require__(6154);
  33869. function get(target, propertyKey /* , receiver */) {
  33870. var receiver = arguments.length < 3 ? target : arguments[2];
  33871. var desc, proto;
  33872. if (anObject(target) === receiver) return target[propertyKey];
  33873. if (desc = gOPD.f(target, propertyKey)) return has(desc, 'value') ? desc.value : desc.get !== undefined ? desc.get.call(receiver) : undefined;
  33874. if (isObject(proto = getPrototypeOf(target))) return get(proto, propertyKey, receiver);
  33875. }
  33876. $export($export.S, 'Reflect', {
  33877. get: get
  33878. });
  33879. /***/ }),
  33880. /***/ 1285:
  33881. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33882. // 26.1.9 Reflect.has(target, propertyKey)
  33883. var $export = __webpack_require__(5913);
  33884. $export($export.S, 'Reflect', {
  33885. has: function has(target, propertyKey) {
  33886. return propertyKey in target;
  33887. }
  33888. });
  33889. /***/ }),
  33890. /***/ 4854:
  33891. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33892. // 26.1.10 Reflect.isExtensible(target)
  33893. var $export = __webpack_require__(5913);
  33894. var anObject = __webpack_require__(6154);
  33895. var $isExtensible = Object.isExtensible;
  33896. $export($export.S, 'Reflect', {
  33897. isExtensible: function isExtensible(target) {
  33898. anObject(target);
  33899. return $isExtensible ? $isExtensible(target) : true;
  33900. }
  33901. });
  33902. /***/ }),
  33903. /***/ 6647:
  33904. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33905. // 26.1.11 Reflect.ownKeys(target)
  33906. var $export = __webpack_require__(5913);
  33907. $export($export.S, 'Reflect', {
  33908. ownKeys: __webpack_require__(2600)
  33909. });
  33910. /***/ }),
  33911. /***/ 7903:
  33912. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33913. // 26.1.12 Reflect.preventExtensions(target)
  33914. var $export = __webpack_require__(5913);
  33915. var anObject = __webpack_require__(6154);
  33916. var $preventExtensions = Object.preventExtensions;
  33917. $export($export.S, 'Reflect', {
  33918. preventExtensions: function preventExtensions(target) {
  33919. anObject(target);
  33920. try {
  33921. if ($preventExtensions) $preventExtensions(target);
  33922. return true;
  33923. } catch (e) {
  33924. return false;
  33925. }
  33926. }
  33927. });
  33928. /***/ }),
  33929. /***/ 3113:
  33930. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33931. // 26.1.14 Reflect.setPrototypeOf(target, proto)
  33932. var $export = __webpack_require__(5913);
  33933. var setProto = __webpack_require__(6931);
  33934. if (setProto) $export($export.S, 'Reflect', {
  33935. setPrototypeOf: function setPrototypeOf(target, proto) {
  33936. setProto.check(target, proto);
  33937. try {
  33938. setProto.set(target, proto);
  33939. return true;
  33940. } catch (e) {
  33941. return false;
  33942. }
  33943. }
  33944. });
  33945. /***/ }),
  33946. /***/ 5197:
  33947. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33948. // 26.1.13 Reflect.set(target, propertyKey, V [, receiver])
  33949. var dP = __webpack_require__(4835);
  33950. var gOPD = __webpack_require__(3299);
  33951. var getPrototypeOf = __webpack_require__(4153);
  33952. var has = __webpack_require__(5389);
  33953. var $export = __webpack_require__(5913);
  33954. var createDesc = __webpack_require__(6256);
  33955. var anObject = __webpack_require__(6154);
  33956. var isObject = __webpack_require__(7156);
  33957. function set(target, propertyKey, V /* , receiver */) {
  33958. var receiver = arguments.length < 4 ? target : arguments[3];
  33959. var ownDesc = gOPD.f(anObject(target), propertyKey);
  33960. var existingDescriptor, proto;
  33961. if (!ownDesc) {
  33962. if (isObject(proto = getPrototypeOf(target))) {
  33963. return set(proto, propertyKey, V, receiver);
  33964. }
  33965. ownDesc = createDesc(0);
  33966. }
  33967. if (has(ownDesc, 'value')) {
  33968. if (ownDesc.writable === false || !isObject(receiver)) return false;
  33969. if (existingDescriptor = gOPD.f(receiver, propertyKey)) {
  33970. if (existingDescriptor.get || existingDescriptor.set || existingDescriptor.writable === false) return false;
  33971. existingDescriptor.value = V;
  33972. dP.f(receiver, propertyKey, existingDescriptor);
  33973. } else dP.f(receiver, propertyKey, createDesc(0, V));
  33974. return true;
  33975. }
  33976. return ownDesc.set === undefined ? false : (ownDesc.set.call(receiver, V), true);
  33977. }
  33978. $export($export.S, 'Reflect', {
  33979. set: set
  33980. });
  33981. /***/ }),
  33982. /***/ 2566:
  33983. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  33984. var global = __webpack_require__(7381);
  33985. var inheritIfRequired = __webpack_require__(3654);
  33986. var dP = (__webpack_require__(4835).f);
  33987. var gOPN = (__webpack_require__(2982).f);
  33988. var isRegExp = __webpack_require__(1993);
  33989. var $flags = __webpack_require__(2188);
  33990. var $RegExp = global.RegExp;
  33991. var Base = $RegExp;
  33992. var proto = $RegExp.prototype;
  33993. var re1 = /a/g;
  33994. var re2 = /a/g;
  33995. // "new" creates a new object, old webkit buggy here
  33996. var CORRECT_NEW = new $RegExp(re1) !== re1;
  33997. if (__webpack_require__(4926) && (!CORRECT_NEW || __webpack_require__(5810)(function () {
  33998. re2[__webpack_require__(3336)('match')] = false;
  33999. // RegExp constructor can alter flags and IsRegExp works correct with @@match
  34000. return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i';
  34001. }))) {
  34002. $RegExp = function RegExp(p, f) {
  34003. var tiRE = this instanceof $RegExp;
  34004. var piRE = isRegExp(p);
  34005. var fiU = f === undefined;
  34006. return !tiRE && piRE && p.constructor === $RegExp && fiU ? p : inheritIfRequired(CORRECT_NEW ? new Base(piRE && !fiU ? p.source : p, f) : Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? $flags.call(p) : f), tiRE ? this : proto, $RegExp);
  34007. };
  34008. var proxy = function proxy(key) {
  34009. key in $RegExp || dP($RegExp, key, {
  34010. configurable: true,
  34011. get: function get() {
  34012. return Base[key];
  34013. },
  34014. set: function set(it) {
  34015. Base[key] = it;
  34016. }
  34017. });
  34018. };
  34019. for (var keys = gOPN(Base), i = 0; keys.length > i;) proxy(keys[i++]);
  34020. proto.constructor = $RegExp;
  34021. $RegExp.prototype = proto;
  34022. __webpack_require__(7278)(global, 'RegExp', $RegExp);
  34023. }
  34024. __webpack_require__(4798)('RegExp');
  34025. /***/ }),
  34026. /***/ 5997:
  34027. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34028. var regexpExec = __webpack_require__(6997);
  34029. __webpack_require__(5913)({
  34030. target: 'RegExp',
  34031. proto: true,
  34032. forced: regexpExec !== /./.exec
  34033. }, {
  34034. exec: regexpExec
  34035. });
  34036. /***/ }),
  34037. /***/ 7181:
  34038. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34039. // 21.2.5.3 get RegExp.prototype.flags()
  34040. if (__webpack_require__(4926) && /./g.flags != 'g') (__webpack_require__(4835).f)(RegExp.prototype, 'flags', {
  34041. configurable: true,
  34042. get: __webpack_require__(2188)
  34043. });
  34044. /***/ }),
  34045. /***/ 8682:
  34046. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34047. var anObject = __webpack_require__(6154);
  34048. var toLength = __webpack_require__(8315);
  34049. var advanceStringIndex = __webpack_require__(1330);
  34050. var regExpExec = __webpack_require__(4585);
  34051. // @@match logic
  34052. __webpack_require__(8644)('match', 1, function (defined, MATCH, $match, maybeCallNative) {
  34053. return [
  34054. // `String.prototype.match` method
  34055. // https://tc39.github.io/ecma262/#sec-string.prototype.match
  34056. function match(regexp) {
  34057. var O = defined(this);
  34058. var fn = regexp == undefined ? undefined : regexp[MATCH];
  34059. return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
  34060. },
  34061. // `RegExp.prototype[@@match]` method
  34062. // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@match
  34063. function (regexp) {
  34064. var res = maybeCallNative($match, regexp, this);
  34065. if (res.done) return res.value;
  34066. var rx = anObject(regexp);
  34067. var S = String(this);
  34068. if (!rx.global) return regExpExec(rx, S);
  34069. var fullUnicode = rx.unicode;
  34070. rx.lastIndex = 0;
  34071. var A = [];
  34072. var n = 0;
  34073. var result;
  34074. while ((result = regExpExec(rx, S)) !== null) {
  34075. var matchStr = String(result[0]);
  34076. A[n] = matchStr;
  34077. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  34078. n++;
  34079. }
  34080. return n === 0 ? null : A;
  34081. }];
  34082. });
  34083. /***/ }),
  34084. /***/ 8514:
  34085. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34086. var anObject = __webpack_require__(6154);
  34087. var toObject = __webpack_require__(2515);
  34088. var toLength = __webpack_require__(8315);
  34089. var toInteger = __webpack_require__(3230);
  34090. var advanceStringIndex = __webpack_require__(1330);
  34091. var regExpExec = __webpack_require__(4585);
  34092. var max = Math.max;
  34093. var min = Math.min;
  34094. var floor = Math.floor;
  34095. var SUBSTITUTION_SYMBOLS = /\$([$&`']|\d\d?|<[^>]*>)/g;
  34096. var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&`']|\d\d?)/g;
  34097. var maybeToString = function maybeToString(it) {
  34098. return it === undefined ? it : String(it);
  34099. };
  34100. // @@replace logic
  34101. __webpack_require__(8644)('replace', 2, function (defined, REPLACE, $replace, maybeCallNative) {
  34102. return [
  34103. // `String.prototype.replace` method
  34104. // https://tc39.github.io/ecma262/#sec-string.prototype.replace
  34105. function replace(searchValue, replaceValue) {
  34106. var O = defined(this);
  34107. var fn = searchValue == undefined ? undefined : searchValue[REPLACE];
  34108. return fn !== undefined ? fn.call(searchValue, O, replaceValue) : $replace.call(String(O), searchValue, replaceValue);
  34109. },
  34110. // `RegExp.prototype[@@replace]` method
  34111. // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
  34112. function (regexp, replaceValue) {
  34113. var res = maybeCallNative($replace, regexp, this, replaceValue);
  34114. if (res.done) return res.value;
  34115. var rx = anObject(regexp);
  34116. var S = String(this);
  34117. var functionalReplace = typeof replaceValue === 'function';
  34118. if (!functionalReplace) replaceValue = String(replaceValue);
  34119. var global = rx.global;
  34120. if (global) {
  34121. var fullUnicode = rx.unicode;
  34122. rx.lastIndex = 0;
  34123. }
  34124. var results = [];
  34125. while (true) {
  34126. var result = regExpExec(rx, S);
  34127. if (result === null) break;
  34128. results.push(result);
  34129. if (!global) break;
  34130. var matchStr = String(result[0]);
  34131. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  34132. }
  34133. var accumulatedResult = '';
  34134. var nextSourcePosition = 0;
  34135. for (var i = 0; i < results.length; i++) {
  34136. result = results[i];
  34137. var matched = String(result[0]);
  34138. var position = max(min(toInteger(result.index), S.length), 0);
  34139. var captures = [];
  34140. // NOTE: This is equivalent to
  34141. // captures = result.slice(1).map(maybeToString)
  34142. // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
  34143. // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
  34144. // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
  34145. for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
  34146. var namedCaptures = result.groups;
  34147. if (functionalReplace) {
  34148. var replacerArgs = [matched].concat(captures, position, S);
  34149. if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
  34150. var replacement = String(replaceValue.apply(undefined, replacerArgs));
  34151. } else {
  34152. replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
  34153. }
  34154. if (position >= nextSourcePosition) {
  34155. accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
  34156. nextSourcePosition = position + matched.length;
  34157. }
  34158. }
  34159. return accumulatedResult + S.slice(nextSourcePosition);
  34160. }];
  34161. // https://tc39.github.io/ecma262/#sec-getsubstitution
  34162. function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
  34163. var tailPos = position + matched.length;
  34164. var m = captures.length;
  34165. var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
  34166. if (namedCaptures !== undefined) {
  34167. namedCaptures = toObject(namedCaptures);
  34168. symbols = SUBSTITUTION_SYMBOLS;
  34169. }
  34170. return $replace.call(replacement, symbols, function (match, ch) {
  34171. var capture;
  34172. switch (ch.charAt(0)) {
  34173. case '$':
  34174. return '$';
  34175. case '&':
  34176. return matched;
  34177. case '`':
  34178. return str.slice(0, position);
  34179. case "'":
  34180. return str.slice(tailPos);
  34181. case '<':
  34182. capture = namedCaptures[ch.slice(1, -1)];
  34183. break;
  34184. default:
  34185. // \d\d?
  34186. var n = +ch;
  34187. if (n === 0) return match;
  34188. if (n > m) {
  34189. var f = floor(n / 10);
  34190. if (f === 0) return match;
  34191. if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
  34192. return match;
  34193. }
  34194. capture = captures[n - 1];
  34195. }
  34196. return capture === undefined ? '' : capture;
  34197. });
  34198. }
  34199. });
  34200. /***/ }),
  34201. /***/ 5105:
  34202. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34203. var anObject = __webpack_require__(6154);
  34204. var sameValue = __webpack_require__(4261);
  34205. var regExpExec = __webpack_require__(4585);
  34206. // @@search logic
  34207. __webpack_require__(8644)('search', 1, function (defined, SEARCH, $search, maybeCallNative) {
  34208. return [
  34209. // `String.prototype.search` method
  34210. // https://tc39.github.io/ecma262/#sec-string.prototype.search
  34211. function search(regexp) {
  34212. var O = defined(this);
  34213. var fn = regexp == undefined ? undefined : regexp[SEARCH];
  34214. return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));
  34215. },
  34216. // `RegExp.prototype[@@search]` method
  34217. // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search
  34218. function (regexp) {
  34219. var res = maybeCallNative($search, regexp, this);
  34220. if (res.done) return res.value;
  34221. var rx = anObject(regexp);
  34222. var S = String(this);
  34223. var previousLastIndex = rx.lastIndex;
  34224. if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
  34225. var result = regExpExec(rx, S);
  34226. if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;
  34227. return result === null ? -1 : result.index;
  34228. }];
  34229. });
  34230. /***/ }),
  34231. /***/ 5325:
  34232. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34233. var isRegExp = __webpack_require__(1993);
  34234. var anObject = __webpack_require__(6154);
  34235. var speciesConstructor = __webpack_require__(2035);
  34236. var advanceStringIndex = __webpack_require__(1330);
  34237. var toLength = __webpack_require__(8315);
  34238. var callRegExpExec = __webpack_require__(4585);
  34239. var regexpExec = __webpack_require__(6997);
  34240. var fails = __webpack_require__(5810);
  34241. var $min = Math.min;
  34242. var $push = [].push;
  34243. var $SPLIT = 'split';
  34244. var LENGTH = 'length';
  34245. var LAST_INDEX = 'lastIndex';
  34246. var MAX_UINT32 = 0xffffffff;
  34247. // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError
  34248. var SUPPORTS_Y = !fails(function () {
  34249. RegExp(MAX_UINT32, 'y');
  34250. });
  34251. // @@split logic
  34252. __webpack_require__(8644)('split', 2, function (defined, SPLIT, $split, maybeCallNative) {
  34253. var internalSplit;
  34254. if ('abbc'[$SPLIT](/(b)*/)[1] == 'c' || 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 || 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 || '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 || '.'[$SPLIT](/()()/)[LENGTH] > 1 || ''[$SPLIT](/.?/)[LENGTH]) {
  34255. // based on es5-shim implementation, need to rework it
  34256. internalSplit = function internalSplit(separator, limit) {
  34257. var string = String(this);
  34258. if (separator === undefined && limit === 0) return [];
  34259. // If `separator` is not a regex, use native split
  34260. if (!isRegExp(separator)) return $split.call(string, separator, limit);
  34261. var output = [];
  34262. var flags = (separator.ignoreCase ? 'i' : '') + (separator.multiline ? 'm' : '') + (separator.unicode ? 'u' : '') + (separator.sticky ? 'y' : '');
  34263. var lastLastIndex = 0;
  34264. var splitLimit = limit === undefined ? MAX_UINT32 : limit >>> 0;
  34265. // Make `global` and avoid `lastIndex` issues by working with a copy
  34266. var separatorCopy = new RegExp(separator.source, flags + 'g');
  34267. var match, lastIndex, lastLength;
  34268. while (match = regexpExec.call(separatorCopy, string)) {
  34269. lastIndex = separatorCopy[LAST_INDEX];
  34270. if (lastIndex > lastLastIndex) {
  34271. output.push(string.slice(lastLastIndex, match.index));
  34272. if (match[LENGTH] > 1 && match.index < string[LENGTH]) $push.apply(output, match.slice(1));
  34273. lastLength = match[0][LENGTH];
  34274. lastLastIndex = lastIndex;
  34275. if (output[LENGTH] >= splitLimit) break;
  34276. }
  34277. if (separatorCopy[LAST_INDEX] === match.index) separatorCopy[LAST_INDEX]++; // Avoid an infinite loop
  34278. }
  34279. if (lastLastIndex === string[LENGTH]) {
  34280. if (lastLength || !separatorCopy.test('')) output.push('');
  34281. } else output.push(string.slice(lastLastIndex));
  34282. return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output;
  34283. };
  34284. // Chakra, V8
  34285. } else if ('0'[$SPLIT](undefined, 0)[LENGTH]) {
  34286. internalSplit = function internalSplit(separator, limit) {
  34287. return separator === undefined && limit === 0 ? [] : $split.call(this, separator, limit);
  34288. };
  34289. } else {
  34290. internalSplit = $split;
  34291. }
  34292. return [
  34293. // `String.prototype.split` method
  34294. // https://tc39.github.io/ecma262/#sec-string.prototype.split
  34295. function split(separator, limit) {
  34296. var O = defined(this);
  34297. var splitter = separator == undefined ? undefined : separator[SPLIT];
  34298. return splitter !== undefined ? splitter.call(separator, O, limit) : internalSplit.call(String(O), separator, limit);
  34299. },
  34300. // `RegExp.prototype[@@split]` method
  34301. // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split
  34302. //
  34303. // NOTE: This cannot be properly polyfilled in engines that don't support
  34304. // the 'y' flag.
  34305. function (regexp, limit) {
  34306. var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== $split);
  34307. if (res.done) return res.value;
  34308. var rx = anObject(regexp);
  34309. var S = String(this);
  34310. var C = speciesConstructor(rx, RegExp);
  34311. var unicodeMatching = rx.unicode;
  34312. var flags = (rx.ignoreCase ? 'i' : '') + (rx.multiline ? 'm' : '') + (rx.unicode ? 'u' : '') + (SUPPORTS_Y ? 'y' : 'g');
  34313. // ^(? + rx + ) is needed, in combination with some S slicing, to
  34314. // simulate the 'y' flag.
  34315. var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
  34316. var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
  34317. if (lim === 0) return [];
  34318. if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : [];
  34319. var p = 0;
  34320. var q = 0;
  34321. var A = [];
  34322. while (q < S.length) {
  34323. splitter.lastIndex = SUPPORTS_Y ? q : 0;
  34324. var z = callRegExpExec(splitter, SUPPORTS_Y ? S : S.slice(q));
  34325. var e;
  34326. if (z === null || (e = $min(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p) {
  34327. q = advanceStringIndex(S, q, unicodeMatching);
  34328. } else {
  34329. A.push(S.slice(p, q));
  34330. if (A.length === lim) return A;
  34331. for (var i = 1; i <= z.length - 1; i++) {
  34332. A.push(z[i]);
  34333. if (A.length === lim) return A;
  34334. }
  34335. q = p = e;
  34336. }
  34337. }
  34338. A.push(S.slice(p));
  34339. return A;
  34340. }];
  34341. });
  34342. /***/ }),
  34343. /***/ 8359:
  34344. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34345. __webpack_require__(7181);
  34346. var anObject = __webpack_require__(6154);
  34347. var $flags = __webpack_require__(2188);
  34348. var DESCRIPTORS = __webpack_require__(4926);
  34349. var TO_STRING = 'toString';
  34350. var $toString = /./[TO_STRING];
  34351. var define = function define(fn) {
  34352. __webpack_require__(7278)(RegExp.prototype, TO_STRING, fn, true);
  34353. };
  34354. // 21.2.5.14 RegExp.prototype.toString()
  34355. if (__webpack_require__(5810)(function () {
  34356. return $toString.call({
  34357. source: 'a',
  34358. flags: 'b'
  34359. }) != '/a/b';
  34360. })) {
  34361. define(function toString() {
  34362. var R = anObject(this);
  34363. return '/'.concat(R.source, '/', 'flags' in R ? R.flags : !DESCRIPTORS && R instanceof RegExp ? $flags.call(R) : undefined);
  34364. });
  34365. // FF44- RegExp#toString has a wrong name
  34366. } else if ($toString.name != TO_STRING) {
  34367. define(function toString() {
  34368. return $toString.call(this);
  34369. });
  34370. }
  34371. /***/ }),
  34372. /***/ 3940:
  34373. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  34374. var strong = __webpack_require__(4396);
  34375. var validate = __webpack_require__(8546);
  34376. var SET = 'Set';
  34377. // 23.2 Set Objects
  34378. module.exports = __webpack_require__(1966)(SET, function (get) {
  34379. return function Set() {
  34380. return get(this, arguments.length > 0 ? arguments[0] : undefined);
  34381. };
  34382. }, {
  34383. // 23.2.3.1 Set.prototype.add(value)
  34384. add: function add(value) {
  34385. return strong.def(validate(this, SET), value = value === 0 ? 0 : value, value);
  34386. }
  34387. }, strong);
  34388. /***/ }),
  34389. /***/ 9718:
  34390. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34391. // B.2.3.2 String.prototype.anchor(name)
  34392. __webpack_require__(9927)('anchor', function (createHTML) {
  34393. return function anchor(name) {
  34394. return createHTML(this, 'a', 'name', name);
  34395. };
  34396. });
  34397. /***/ }),
  34398. /***/ 3845:
  34399. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34400. // B.2.3.3 String.prototype.big()
  34401. __webpack_require__(9927)('big', function (createHTML) {
  34402. return function big() {
  34403. return createHTML(this, 'big', '', '');
  34404. };
  34405. });
  34406. /***/ }),
  34407. /***/ 5803:
  34408. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34409. // B.2.3.4 String.prototype.blink()
  34410. __webpack_require__(9927)('blink', function (createHTML) {
  34411. return function blink() {
  34412. return createHTML(this, 'blink', '', '');
  34413. };
  34414. });
  34415. /***/ }),
  34416. /***/ 2222:
  34417. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34418. // B.2.3.5 String.prototype.bold()
  34419. __webpack_require__(9927)('bold', function (createHTML) {
  34420. return function bold() {
  34421. return createHTML(this, 'b', '', '');
  34422. };
  34423. });
  34424. /***/ }),
  34425. /***/ 5281:
  34426. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34427. var $export = __webpack_require__(5913);
  34428. var $at = __webpack_require__(3593)(false);
  34429. $export($export.P, 'String', {
  34430. // 21.1.3.3 String.prototype.codePointAt(pos)
  34431. codePointAt: function codePointAt(pos) {
  34432. return $at(this, pos);
  34433. }
  34434. });
  34435. /***/ }),
  34436. /***/ 3917:
  34437. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34438. // 21.1.3.6 String.prototype.endsWith(searchString [, endPosition])
  34439. var $export = __webpack_require__(5913);
  34440. var toLength = __webpack_require__(8315);
  34441. var context = __webpack_require__(2376);
  34442. var ENDS_WITH = 'endsWith';
  34443. var $endsWith = ''[ENDS_WITH];
  34444. $export($export.P + $export.F * __webpack_require__(3483)(ENDS_WITH), 'String', {
  34445. endsWith: function endsWith(searchString /* , endPosition = @length */) {
  34446. var that = context(this, searchString, ENDS_WITH);
  34447. var endPosition = arguments.length > 1 ? arguments[1] : undefined;
  34448. var len = toLength(that.length);
  34449. var end = endPosition === undefined ? len : Math.min(toLength(endPosition), len);
  34450. var search = String(searchString);
  34451. return $endsWith ? $endsWith.call(that, search, end) : that.slice(end - search.length, end) === search;
  34452. }
  34453. });
  34454. /***/ }),
  34455. /***/ 5036:
  34456. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34457. // B.2.3.6 String.prototype.fixed()
  34458. __webpack_require__(9927)('fixed', function (createHTML) {
  34459. return function fixed() {
  34460. return createHTML(this, 'tt', '', '');
  34461. };
  34462. });
  34463. /***/ }),
  34464. /***/ 6131:
  34465. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34466. // B.2.3.7 String.prototype.fontcolor(color)
  34467. __webpack_require__(9927)('fontcolor', function (createHTML) {
  34468. return function fontcolor(color) {
  34469. return createHTML(this, 'font', 'color', color);
  34470. };
  34471. });
  34472. /***/ }),
  34473. /***/ 4110:
  34474. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34475. // B.2.3.8 String.prototype.fontsize(size)
  34476. __webpack_require__(9927)('fontsize', function (createHTML) {
  34477. return function fontsize(size) {
  34478. return createHTML(this, 'font', 'size', size);
  34479. };
  34480. });
  34481. /***/ }),
  34482. /***/ 8577:
  34483. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34484. var $export = __webpack_require__(5913);
  34485. var toAbsoluteIndex = __webpack_require__(6241);
  34486. var fromCharCode = String.fromCharCode;
  34487. var $fromCodePoint = String.fromCodePoint;
  34488. // length should be 1, old FF problem
  34489. $export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
  34490. // 21.1.2.2 String.fromCodePoint(...codePoints)
  34491. fromCodePoint: function fromCodePoint(x) {
  34492. // eslint-disable-line no-unused-vars
  34493. var res = [];
  34494. var aLen = arguments.length;
  34495. var i = 0;
  34496. var code;
  34497. while (aLen > i) {
  34498. code = +arguments[i++];
  34499. if (toAbsoluteIndex(code, 0x10ffff) !== code) throw RangeError(code + ' is not a valid code point');
  34500. res.push(code < 0x10000 ? fromCharCode(code) : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00));
  34501. }
  34502. return res.join('');
  34503. }
  34504. });
  34505. /***/ }),
  34506. /***/ 5450:
  34507. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34508. // 21.1.3.7 String.prototype.includes(searchString, position = 0)
  34509. var $export = __webpack_require__(5913);
  34510. var context = __webpack_require__(2376);
  34511. var INCLUDES = 'includes';
  34512. $export($export.P + $export.F * __webpack_require__(3483)(INCLUDES), 'String', {
  34513. includes: function includes(searchString /* , position = 0 */) {
  34514. return !!~context(this, searchString, INCLUDES).indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined);
  34515. }
  34516. });
  34517. /***/ }),
  34518. /***/ 6235:
  34519. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34520. // B.2.3.9 String.prototype.italics()
  34521. __webpack_require__(9927)('italics', function (createHTML) {
  34522. return function italics() {
  34523. return createHTML(this, 'i', '', '');
  34524. };
  34525. });
  34526. /***/ }),
  34527. /***/ 6575:
  34528. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34529. var $at = __webpack_require__(3593)(true);
  34530. // 21.1.3.27 String.prototype[@@iterator]()
  34531. __webpack_require__(4873)(String, 'String', function (iterated) {
  34532. this._t = String(iterated); // target
  34533. this._i = 0; // next index
  34534. // 21.1.5.2.1 %StringIteratorPrototype%.next()
  34535. }, function () {
  34536. var O = this._t;
  34537. var index = this._i;
  34538. var point;
  34539. if (index >= O.length) return {
  34540. value: undefined,
  34541. done: true
  34542. };
  34543. point = $at(O, index);
  34544. this._i += point.length;
  34545. return {
  34546. value: point,
  34547. done: false
  34548. };
  34549. });
  34550. /***/ }),
  34551. /***/ 6495:
  34552. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34553. // B.2.3.10 String.prototype.link(url)
  34554. __webpack_require__(9927)('link', function (createHTML) {
  34555. return function link(url) {
  34556. return createHTML(this, 'a', 'href', url);
  34557. };
  34558. });
  34559. /***/ }),
  34560. /***/ 7906:
  34561. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34562. var $export = __webpack_require__(5913);
  34563. var toIObject = __webpack_require__(8499);
  34564. var toLength = __webpack_require__(8315);
  34565. $export($export.S, 'String', {
  34566. // 21.1.2.4 String.raw(callSite, ...substitutions)
  34567. raw: function raw(callSite) {
  34568. var tpl = toIObject(callSite.raw);
  34569. var len = toLength(tpl.length);
  34570. var aLen = arguments.length;
  34571. var res = [];
  34572. var i = 0;
  34573. while (len > i) {
  34574. res.push(String(tpl[i++]));
  34575. if (i < aLen) res.push(String(arguments[i]));
  34576. }
  34577. return res.join('');
  34578. }
  34579. });
  34580. /***/ }),
  34581. /***/ 9449:
  34582. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34583. var $export = __webpack_require__(5913);
  34584. $export($export.P, 'String', {
  34585. // 21.1.3.13 String.prototype.repeat(count)
  34586. repeat: __webpack_require__(1924)
  34587. });
  34588. /***/ }),
  34589. /***/ 4162:
  34590. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34591. // B.2.3.11 String.prototype.small()
  34592. __webpack_require__(9927)('small', function (createHTML) {
  34593. return function small() {
  34594. return createHTML(this, 'small', '', '');
  34595. };
  34596. });
  34597. /***/ }),
  34598. /***/ 1616:
  34599. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34600. // 21.1.3.18 String.prototype.startsWith(searchString [, position ])
  34601. var $export = __webpack_require__(5913);
  34602. var toLength = __webpack_require__(8315);
  34603. var context = __webpack_require__(2376);
  34604. var STARTS_WITH = 'startsWith';
  34605. var $startsWith = ''[STARTS_WITH];
  34606. $export($export.P + $export.F * __webpack_require__(3483)(STARTS_WITH), 'String', {
  34607. startsWith: function startsWith(searchString /* , position = 0 */) {
  34608. var that = context(this, searchString, STARTS_WITH);
  34609. var index = toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length));
  34610. var search = String(searchString);
  34611. return $startsWith ? $startsWith.call(that, search, index) : that.slice(index, index + search.length) === search;
  34612. }
  34613. });
  34614. /***/ }),
  34615. /***/ 5297:
  34616. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34617. // B.2.3.12 String.prototype.strike()
  34618. __webpack_require__(9927)('strike', function (createHTML) {
  34619. return function strike() {
  34620. return createHTML(this, 'strike', '', '');
  34621. };
  34622. });
  34623. /***/ }),
  34624. /***/ 1466:
  34625. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34626. // B.2.3.13 String.prototype.sub()
  34627. __webpack_require__(9927)('sub', function (createHTML) {
  34628. return function sub() {
  34629. return createHTML(this, 'sub', '', '');
  34630. };
  34631. });
  34632. /***/ }),
  34633. /***/ 2581:
  34634. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34635. // B.2.3.14 String.prototype.sup()
  34636. __webpack_require__(9927)('sup', function (createHTML) {
  34637. return function sup() {
  34638. return createHTML(this, 'sup', '', '');
  34639. };
  34640. });
  34641. /***/ }),
  34642. /***/ 8587:
  34643. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34644. // 21.1.3.25 String.prototype.trim()
  34645. __webpack_require__(618)('trim', function ($trim) {
  34646. return function trim() {
  34647. return $trim(this, 3);
  34648. };
  34649. });
  34650. /***/ }),
  34651. /***/ 2403:
  34652. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34653. // ECMAScript 6 symbols shim
  34654. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  34655. var global = __webpack_require__(7381);
  34656. var has = __webpack_require__(5389);
  34657. var DESCRIPTORS = __webpack_require__(4926);
  34658. var $export = __webpack_require__(5913);
  34659. var redefine = __webpack_require__(7278);
  34660. var META = (__webpack_require__(3763).KEY);
  34661. var $fails = __webpack_require__(5810);
  34662. var shared = __webpack_require__(3192);
  34663. var setToStringTag = __webpack_require__(8094);
  34664. var uid = __webpack_require__(7936);
  34665. var wks = __webpack_require__(3336);
  34666. var wksExt = __webpack_require__(9078);
  34667. var wksDefine = __webpack_require__(5721);
  34668. var enumKeys = __webpack_require__(8727);
  34669. var isArray = __webpack_require__(1320);
  34670. var anObject = __webpack_require__(6154);
  34671. var isObject = __webpack_require__(7156);
  34672. var toObject = __webpack_require__(2515);
  34673. var toIObject = __webpack_require__(8499);
  34674. var toPrimitive = __webpack_require__(8537);
  34675. var createDesc = __webpack_require__(6256);
  34676. var _create = __webpack_require__(4275);
  34677. var gOPNExt = __webpack_require__(3136);
  34678. var $GOPD = __webpack_require__(3299);
  34679. var $GOPS = __webpack_require__(5421);
  34680. var $DP = __webpack_require__(4835);
  34681. var $keys = __webpack_require__(9924);
  34682. var gOPD = $GOPD.f;
  34683. var dP = $DP.f;
  34684. var gOPN = gOPNExt.f;
  34685. var $Symbol = global.Symbol;
  34686. var $JSON = global.JSON;
  34687. var _stringify = $JSON && $JSON.stringify;
  34688. var PROTOTYPE = 'prototype';
  34689. var HIDDEN = wks('_hidden');
  34690. var TO_PRIMITIVE = wks('toPrimitive');
  34691. var isEnum = {}.propertyIsEnumerable;
  34692. var SymbolRegistry = shared('symbol-registry');
  34693. var AllSymbols = shared('symbols');
  34694. var OPSymbols = shared('op-symbols');
  34695. var ObjectProto = Object[PROTOTYPE];
  34696. var USE_NATIVE = typeof $Symbol == 'function' && !!$GOPS.f;
  34697. var QObject = global.QObject;
  34698. // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
  34699. var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
  34700. // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
  34701. var setSymbolDesc = DESCRIPTORS && $fails(function () {
  34702. return _create(dP({}, 'a', {
  34703. get: function get() {
  34704. return dP(this, 'a', {
  34705. value: 7
  34706. }).a;
  34707. }
  34708. })).a != 7;
  34709. }) ? function (it, key, D) {
  34710. var protoDesc = gOPD(ObjectProto, key);
  34711. if (protoDesc) delete ObjectProto[key];
  34712. dP(it, key, D);
  34713. if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc);
  34714. } : dP;
  34715. var wrap = function wrap(tag) {
  34716. var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
  34717. sym._k = tag;
  34718. return sym;
  34719. };
  34720. var isSymbol = USE_NATIVE && _typeof($Symbol.iterator) == 'symbol' ? function (it) {
  34721. return _typeof(it) == 'symbol';
  34722. } : function (it) {
  34723. return it instanceof $Symbol;
  34724. };
  34725. var $defineProperty = function defineProperty(it, key, D) {
  34726. if (it === ObjectProto) $defineProperty(OPSymbols, key, D);
  34727. anObject(it);
  34728. key = toPrimitive(key, true);
  34729. anObject(D);
  34730. if (has(AllSymbols, key)) {
  34731. if (!D.enumerable) {
  34732. if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {}));
  34733. it[HIDDEN][key] = true;
  34734. } else {
  34735. if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
  34736. D = _create(D, {
  34737. enumerable: createDesc(0, false)
  34738. });
  34739. }
  34740. return setSymbolDesc(it, key, D);
  34741. }
  34742. return dP(it, key, D);
  34743. };
  34744. var $defineProperties = function defineProperties(it, P) {
  34745. anObject(it);
  34746. var keys = enumKeys(P = toIObject(P));
  34747. var i = 0;
  34748. var l = keys.length;
  34749. var key;
  34750. while (l > i) $defineProperty(it, key = keys[i++], P[key]);
  34751. return it;
  34752. };
  34753. var $create = function create(it, P) {
  34754. return P === undefined ? _create(it) : $defineProperties(_create(it), P);
  34755. };
  34756. var $propertyIsEnumerable = function propertyIsEnumerable(key) {
  34757. var E = isEnum.call(this, key = toPrimitive(key, true));
  34758. if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false;
  34759. return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
  34760. };
  34761. var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
  34762. it = toIObject(it);
  34763. key = toPrimitive(key, true);
  34764. if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return;
  34765. var D = gOPD(it, key);
  34766. if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
  34767. return D;
  34768. };
  34769. var $getOwnPropertyNames = function getOwnPropertyNames(it) {
  34770. var names = gOPN(toIObject(it));
  34771. var result = [];
  34772. var i = 0;
  34773. var key;
  34774. while (names.length > i) {
  34775. if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);
  34776. }
  34777. return result;
  34778. };
  34779. var $getOwnPropertySymbols = function getOwnPropertySymbols(it) {
  34780. var IS_OP = it === ObjectProto;
  34781. var names = gOPN(IS_OP ? OPSymbols : toIObject(it));
  34782. var result = [];
  34783. var i = 0;
  34784. var key;
  34785. while (names.length > i) {
  34786. if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]);
  34787. }
  34788. return result;
  34789. };
  34790. // 19.4.1.1 Symbol([description])
  34791. if (!USE_NATIVE) {
  34792. $Symbol = function _Symbol() {
  34793. if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');
  34794. var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
  34795. var $set = function $set(value) {
  34796. if (this === ObjectProto) $set.call(OPSymbols, value);
  34797. if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
  34798. setSymbolDesc(this, tag, createDesc(1, value));
  34799. };
  34800. if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, {
  34801. configurable: true,
  34802. set: $set
  34803. });
  34804. return wrap(tag);
  34805. };
  34806. redefine($Symbol[PROTOTYPE], 'toString', function toString() {
  34807. return this._k;
  34808. });
  34809. $GOPD.f = $getOwnPropertyDescriptor;
  34810. $DP.f = $defineProperty;
  34811. (__webpack_require__(2982).f) = gOPNExt.f = $getOwnPropertyNames;
  34812. (__webpack_require__(4616).f) = $propertyIsEnumerable;
  34813. $GOPS.f = $getOwnPropertySymbols;
  34814. if (DESCRIPTORS && !__webpack_require__(4219)) {
  34815. redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
  34816. }
  34817. wksExt.f = function (name) {
  34818. return wrap(wks(name));
  34819. };
  34820. }
  34821. $export($export.G + $export.W + $export.F * !USE_NATIVE, {
  34822. Symbol: $Symbol
  34823. });
  34824. for (var es6Symbols =
  34825. // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14
  34826. 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'.split(','), j = 0; es6Symbols.length > j;) wks(es6Symbols[j++]);
  34827. for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]);
  34828. $export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
  34829. // 19.4.2.1 Symbol.for(key)
  34830. 'for': function _for(key) {
  34831. return has(SymbolRegistry, key += '') ? SymbolRegistry[key] : SymbolRegistry[key] = $Symbol(key);
  34832. },
  34833. // 19.4.2.5 Symbol.keyFor(sym)
  34834. keyFor: function keyFor(sym) {
  34835. if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');
  34836. for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;
  34837. },
  34838. useSetter: function useSetter() {
  34839. setter = true;
  34840. },
  34841. useSimple: function useSimple() {
  34842. setter = false;
  34843. }
  34844. });
  34845. $export($export.S + $export.F * !USE_NATIVE, 'Object', {
  34846. // 19.1.2.2 Object.create(O [, Properties])
  34847. create: $create,
  34848. // 19.1.2.4 Object.defineProperty(O, P, Attributes)
  34849. defineProperty: $defineProperty,
  34850. // 19.1.2.3 Object.defineProperties(O, Properties)
  34851. defineProperties: $defineProperties,
  34852. // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
  34853. getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
  34854. // 19.1.2.7 Object.getOwnPropertyNames(O)
  34855. getOwnPropertyNames: $getOwnPropertyNames,
  34856. // 19.1.2.8 Object.getOwnPropertySymbols(O)
  34857. getOwnPropertySymbols: $getOwnPropertySymbols
  34858. });
  34859. // Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
  34860. // https://bugs.chromium.org/p/v8/issues/detail?id=3443
  34861. var FAILS_ON_PRIMITIVES = $fails(function () {
  34862. $GOPS.f(1);
  34863. });
  34864. $export($export.S + $export.F * FAILS_ON_PRIMITIVES, 'Object', {
  34865. getOwnPropertySymbols: function getOwnPropertySymbols(it) {
  34866. return $GOPS.f(toObject(it));
  34867. }
  34868. });
  34869. // 24.3.2 JSON.stringify(value [, replacer [, space]])
  34870. $JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {
  34871. var S = $Symbol();
  34872. // MS Edge converts symbol values to JSON as {}
  34873. // WebKit converts symbol values to JSON as null
  34874. // V8 throws on boxed symbols
  34875. return _stringify([S]) != '[null]' || _stringify({
  34876. a: S
  34877. }) != '{}' || _stringify(Object(S)) != '{}';
  34878. })), 'JSON', {
  34879. stringify: function stringify(it) {
  34880. var args = [it];
  34881. var i = 1;
  34882. var replacer, $replacer;
  34883. while (arguments.length > i) args.push(arguments[i++]);
  34884. $replacer = replacer = args[1];
  34885. if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
  34886. if (!isArray(replacer)) replacer = function replacer(key, value) {
  34887. if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
  34888. if (!isSymbol(value)) return value;
  34889. };
  34890. args[1] = replacer;
  34891. return _stringify.apply($JSON, args);
  34892. }
  34893. });
  34894. // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
  34895. $Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(8012)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
  34896. // 19.4.3.5 Symbol.prototype[@@toStringTag]
  34897. setToStringTag($Symbol, 'Symbol');
  34898. // 20.2.1.9 Math[@@toStringTag]
  34899. setToStringTag(Math, 'Math', true);
  34900. // 24.3.3 JSON[@@toStringTag]
  34901. setToStringTag(global.JSON, 'JSON', true);
  34902. /***/ }),
  34903. /***/ 7195:
  34904. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34905. var $export = __webpack_require__(5913);
  34906. var $typed = __webpack_require__(9161);
  34907. var buffer = __webpack_require__(9782);
  34908. var anObject = __webpack_require__(6154);
  34909. var toAbsoluteIndex = __webpack_require__(6241);
  34910. var toLength = __webpack_require__(8315);
  34911. var isObject = __webpack_require__(7156);
  34912. var ArrayBuffer = (__webpack_require__(7381).ArrayBuffer);
  34913. var speciesConstructor = __webpack_require__(2035);
  34914. var $ArrayBuffer = buffer.ArrayBuffer;
  34915. var $DataView = buffer.DataView;
  34916. var $isView = $typed.ABV && ArrayBuffer.isView;
  34917. var $slice = $ArrayBuffer.prototype.slice;
  34918. var VIEW = $typed.VIEW;
  34919. var ARRAY_BUFFER = 'ArrayBuffer';
  34920. $export($export.G + $export.W + $export.F * (ArrayBuffer !== $ArrayBuffer), {
  34921. ArrayBuffer: $ArrayBuffer
  34922. });
  34923. $export($export.S + $export.F * !$typed.CONSTR, ARRAY_BUFFER, {
  34924. // 24.1.3.1 ArrayBuffer.isView(arg)
  34925. isView: function isView(it) {
  34926. return $isView && $isView(it) || isObject(it) && VIEW in it;
  34927. }
  34928. });
  34929. $export($export.P + $export.U + $export.F * __webpack_require__(5810)(function () {
  34930. return !new $ArrayBuffer(2).slice(1, undefined).byteLength;
  34931. }), ARRAY_BUFFER, {
  34932. // 24.1.4.3 ArrayBuffer.prototype.slice(start, end)
  34933. slice: function slice(start, end) {
  34934. if ($slice !== undefined && end === undefined) return $slice.call(anObject(this), start); // FF fix
  34935. var len = anObject(this).byteLength;
  34936. var first = toAbsoluteIndex(start, len);
  34937. var fin = toAbsoluteIndex(end === undefined ? len : end, len);
  34938. var result = new (speciesConstructor(this, $ArrayBuffer))(toLength(fin - first));
  34939. var viewS = new $DataView(this);
  34940. var viewT = new $DataView(result);
  34941. var index = 0;
  34942. while (first < fin) {
  34943. viewT.setUint8(index++, viewS.getUint8(first++));
  34944. }
  34945. return result;
  34946. }
  34947. });
  34948. __webpack_require__(4798)(ARRAY_BUFFER);
  34949. /***/ }),
  34950. /***/ 5345:
  34951. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34952. var $export = __webpack_require__(5913);
  34953. $export($export.G + $export.W + $export.F * !(__webpack_require__(9161).ABV), {
  34954. DataView: (__webpack_require__(9782).DataView)
  34955. });
  34956. /***/ }),
  34957. /***/ 8824:
  34958. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34959. __webpack_require__(431)('Float32', 4, function (init) {
  34960. return function Float32Array(data, byteOffset, length) {
  34961. return init(this, data, byteOffset, length);
  34962. };
  34963. });
  34964. /***/ }),
  34965. /***/ 6472:
  34966. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34967. __webpack_require__(431)('Float64', 8, function (init) {
  34968. return function Float64Array(data, byteOffset, length) {
  34969. return init(this, data, byteOffset, length);
  34970. };
  34971. });
  34972. /***/ }),
  34973. /***/ 7683:
  34974. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34975. __webpack_require__(431)('Int16', 2, function (init) {
  34976. return function Int16Array(data, byteOffset, length) {
  34977. return init(this, data, byteOffset, length);
  34978. };
  34979. });
  34980. /***/ }),
  34981. /***/ 4797:
  34982. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34983. __webpack_require__(431)('Int32', 4, function (init) {
  34984. return function Int32Array(data, byteOffset, length) {
  34985. return init(this, data, byteOffset, length);
  34986. };
  34987. });
  34988. /***/ }),
  34989. /***/ 6670:
  34990. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34991. __webpack_require__(431)('Int8', 1, function (init) {
  34992. return function Int8Array(data, byteOffset, length) {
  34993. return init(this, data, byteOffset, length);
  34994. };
  34995. });
  34996. /***/ }),
  34997. /***/ 1123:
  34998. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  34999. __webpack_require__(431)('Uint16', 2, function (init) {
  35000. return function Uint16Array(data, byteOffset, length) {
  35001. return init(this, data, byteOffset, length);
  35002. };
  35003. });
  35004. /***/ }),
  35005. /***/ 4871:
  35006. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35007. __webpack_require__(431)('Uint32', 4, function (init) {
  35008. return function Uint32Array(data, byteOffset, length) {
  35009. return init(this, data, byteOffset, length);
  35010. };
  35011. });
  35012. /***/ }),
  35013. /***/ 7736:
  35014. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35015. __webpack_require__(431)('Uint8', 1, function (init) {
  35016. return function Uint8Array(data, byteOffset, length) {
  35017. return init(this, data, byteOffset, length);
  35018. };
  35019. });
  35020. /***/ }),
  35021. /***/ 4457:
  35022. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35023. __webpack_require__(431)('Uint8', 1, function (init) {
  35024. return function Uint8ClampedArray(data, byteOffset, length) {
  35025. return init(this, data, byteOffset, length);
  35026. };
  35027. }, true);
  35028. /***/ }),
  35029. /***/ 3491:
  35030. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  35031. var global = __webpack_require__(7381);
  35032. var each = __webpack_require__(3970)(0);
  35033. var redefine = __webpack_require__(7278);
  35034. var meta = __webpack_require__(3763);
  35035. var assign = __webpack_require__(8559);
  35036. var weak = __webpack_require__(4495);
  35037. var isObject = __webpack_require__(7156);
  35038. var validate = __webpack_require__(8546);
  35039. var NATIVE_WEAK_MAP = __webpack_require__(8546);
  35040. var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;
  35041. var WEAK_MAP = 'WeakMap';
  35042. var getWeak = meta.getWeak;
  35043. var isExtensible = Object.isExtensible;
  35044. var uncaughtFrozenStore = weak.ufstore;
  35045. var InternalMap;
  35046. var wrapper = function wrapper(get) {
  35047. return function WeakMap() {
  35048. return get(this, arguments.length > 0 ? arguments[0] : undefined);
  35049. };
  35050. };
  35051. var methods = {
  35052. // 23.3.3.3 WeakMap.prototype.get(key)
  35053. get: function get(key) {
  35054. if (isObject(key)) {
  35055. var data = getWeak(key);
  35056. if (data === true) return uncaughtFrozenStore(validate(this, WEAK_MAP)).get(key);
  35057. return data ? data[this._i] : undefined;
  35058. }
  35059. },
  35060. // 23.3.3.5 WeakMap.prototype.set(key, value)
  35061. set: function set(key, value) {
  35062. return weak.def(validate(this, WEAK_MAP), key, value);
  35063. }
  35064. };
  35065. // 23.3 WeakMap Objects
  35066. var $WeakMap = module.exports = __webpack_require__(1966)(WEAK_MAP, wrapper, methods, weak, true, true);
  35067. // IE11 WeakMap frozen keys fix
  35068. if (NATIVE_WEAK_MAP && IS_IE11) {
  35069. InternalMap = weak.getConstructor(wrapper, WEAK_MAP);
  35070. assign(InternalMap.prototype, methods);
  35071. meta.NEED = true;
  35072. each(['delete', 'has', 'get', 'set'], function (key) {
  35073. var proto = $WeakMap.prototype;
  35074. var method = proto[key];
  35075. redefine(proto, key, function (a, b) {
  35076. // store frozen objects on internal weakmap shim
  35077. if (isObject(a) && !isExtensible(a)) {
  35078. if (!this._f) this._f = new InternalMap();
  35079. var result = this._f[key](a, b);
  35080. return key == 'set' ? this : result;
  35081. // store all the rest on native weakmap
  35082. }
  35083. return method.call(this, a, b);
  35084. });
  35085. });
  35086. }
  35087. /***/ }),
  35088. /***/ 6332:
  35089. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35090. var weak = __webpack_require__(4495);
  35091. var validate = __webpack_require__(8546);
  35092. var WEAK_SET = 'WeakSet';
  35093. // 23.4 WeakSet Objects
  35094. __webpack_require__(1966)(WEAK_SET, function (get) {
  35095. return function WeakSet() {
  35096. return get(this, arguments.length > 0 ? arguments[0] : undefined);
  35097. };
  35098. }, {
  35099. // 23.4.3.1 WeakSet.prototype.add(value)
  35100. add: function add(value) {
  35101. return weak.def(validate(this, WEAK_SET), value, true);
  35102. }
  35103. }, weak, false, true);
  35104. /***/ }),
  35105. /***/ 6032:
  35106. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35107. // https://tc39.github.io/proposal-flatMap/#sec-Array.prototype.flatMap
  35108. var $export = __webpack_require__(5913);
  35109. var flattenIntoArray = __webpack_require__(3120);
  35110. var toObject = __webpack_require__(2515);
  35111. var toLength = __webpack_require__(8315);
  35112. var aFunction = __webpack_require__(6819);
  35113. var arraySpeciesCreate = __webpack_require__(5486);
  35114. $export($export.P, 'Array', {
  35115. flatMap: function flatMap(callbackfn /* , thisArg */) {
  35116. var O = toObject(this);
  35117. var sourceLen, A;
  35118. aFunction(callbackfn);
  35119. sourceLen = toLength(O.length);
  35120. A = arraySpeciesCreate(O, 0);
  35121. flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments[1]);
  35122. return A;
  35123. }
  35124. });
  35125. __webpack_require__(4339)('flatMap');
  35126. /***/ }),
  35127. /***/ 732:
  35128. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35129. // https://tc39.github.io/proposal-flatMap/#sec-Array.prototype.flatten
  35130. var $export = __webpack_require__(5913);
  35131. var flattenIntoArray = __webpack_require__(3120);
  35132. var toObject = __webpack_require__(2515);
  35133. var toLength = __webpack_require__(8315);
  35134. var toInteger = __webpack_require__(3230);
  35135. var arraySpeciesCreate = __webpack_require__(5486);
  35136. $export($export.P, 'Array', {
  35137. flatten: function flatten( /* depthArg = 1 */
  35138. ) {
  35139. var depthArg = arguments[0];
  35140. var O = toObject(this);
  35141. var sourceLen = toLength(O.length);
  35142. var A = arraySpeciesCreate(O, 0);
  35143. flattenIntoArray(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toInteger(depthArg));
  35144. return A;
  35145. }
  35146. });
  35147. __webpack_require__(4339)('flatten');
  35148. /***/ }),
  35149. /***/ 2963:
  35150. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35151. // https://github.com/tc39/Array.prototype.includes
  35152. var $export = __webpack_require__(5913);
  35153. var $includes = __webpack_require__(4687)(true);
  35154. $export($export.P, 'Array', {
  35155. includes: function includes(el /* , fromIndex = 0 */) {
  35156. return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
  35157. }
  35158. });
  35159. __webpack_require__(4339)('includes');
  35160. /***/ }),
  35161. /***/ 6321:
  35162. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35163. // https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-09/sept-25.md#510-globalasap-for-enqueuing-a-microtask
  35164. var $export = __webpack_require__(5913);
  35165. var microtask = __webpack_require__(1842)();
  35166. var process = (__webpack_require__(7381).process);
  35167. var isNode = __webpack_require__(3679)(process) == 'process';
  35168. $export($export.G, {
  35169. asap: function asap(fn) {
  35170. var domain = isNode && process.domain;
  35171. microtask(domain ? domain.bind(fn) : fn);
  35172. }
  35173. });
  35174. /***/ }),
  35175. /***/ 7469:
  35176. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35177. // https://github.com/ljharb/proposal-is-error
  35178. var $export = __webpack_require__(5913);
  35179. var cof = __webpack_require__(3679);
  35180. $export($export.S, 'Error', {
  35181. isError: function isError(it) {
  35182. return cof(it) === 'Error';
  35183. }
  35184. });
  35185. /***/ }),
  35186. /***/ 6426:
  35187. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35188. // https://github.com/tc39/proposal-global
  35189. var $export = __webpack_require__(5913);
  35190. $export($export.G, {
  35191. global: __webpack_require__(7381)
  35192. });
  35193. /***/ }),
  35194. /***/ 3591:
  35195. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35196. // https://tc39.github.io/proposal-setmap-offrom/#sec-map.from
  35197. __webpack_require__(7598)('Map');
  35198. /***/ }),
  35199. /***/ 9992:
  35200. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35201. // https://tc39.github.io/proposal-setmap-offrom/#sec-map.of
  35202. __webpack_require__(5329)('Map');
  35203. /***/ }),
  35204. /***/ 8455:
  35205. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35206. // https://github.com/DavidBruant/Map-Set.prototype.toJSON
  35207. var $export = __webpack_require__(5913);
  35208. $export($export.P + $export.R, 'Map', {
  35209. toJSON: __webpack_require__(1872)('Map')
  35210. });
  35211. /***/ }),
  35212. /***/ 4097:
  35213. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35214. // https://rwaldron.github.io/proposal-math-extensions/
  35215. var $export = __webpack_require__(5913);
  35216. $export($export.S, 'Math', {
  35217. clamp: function clamp(x, lower, upper) {
  35218. return Math.min(upper, Math.max(lower, x));
  35219. }
  35220. });
  35221. /***/ }),
  35222. /***/ 5813:
  35223. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35224. // https://rwaldron.github.io/proposal-math-extensions/
  35225. var $export = __webpack_require__(5913);
  35226. $export($export.S, 'Math', {
  35227. DEG_PER_RAD: Math.PI / 180
  35228. });
  35229. /***/ }),
  35230. /***/ 7245:
  35231. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35232. // https://rwaldron.github.io/proposal-math-extensions/
  35233. var $export = __webpack_require__(5913);
  35234. var RAD_PER_DEG = 180 / Math.PI;
  35235. $export($export.S, 'Math', {
  35236. degrees: function degrees(radians) {
  35237. return radians * RAD_PER_DEG;
  35238. }
  35239. });
  35240. /***/ }),
  35241. /***/ 6756:
  35242. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35243. // https://rwaldron.github.io/proposal-math-extensions/
  35244. var $export = __webpack_require__(5913);
  35245. var scale = __webpack_require__(8124);
  35246. var fround = __webpack_require__(3800);
  35247. $export($export.S, 'Math', {
  35248. fscale: function fscale(x, inLow, inHigh, outLow, outHigh) {
  35249. return fround(scale(x, inLow, inHigh, outLow, outHigh));
  35250. }
  35251. });
  35252. /***/ }),
  35253. /***/ 8392:
  35254. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35255. // https://gist.github.com/BrendanEich/4294d5c212a6d2254703
  35256. var $export = __webpack_require__(5913);
  35257. $export($export.S, 'Math', {
  35258. iaddh: function iaddh(x0, x1, y0, y1) {
  35259. var $x0 = x0 >>> 0;
  35260. var $x1 = x1 >>> 0;
  35261. var $y0 = y0 >>> 0;
  35262. return $x1 + (y1 >>> 0) + (($x0 & $y0 | ($x0 | $y0) & ~($x0 + $y0 >>> 0)) >>> 31) | 0;
  35263. }
  35264. });
  35265. /***/ }),
  35266. /***/ 3735:
  35267. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35268. // https://gist.github.com/BrendanEich/4294d5c212a6d2254703
  35269. var $export = __webpack_require__(5913);
  35270. $export($export.S, 'Math', {
  35271. imulh: function imulh(u, v) {
  35272. var UINT16 = 0xffff;
  35273. var $u = +u;
  35274. var $v = +v;
  35275. var u0 = $u & UINT16;
  35276. var v0 = $v & UINT16;
  35277. var u1 = $u >> 16;
  35278. var v1 = $v >> 16;
  35279. var t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16);
  35280. return u1 * v1 + (t >> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >> 16);
  35281. }
  35282. });
  35283. /***/ }),
  35284. /***/ 1111:
  35285. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35286. // https://gist.github.com/BrendanEich/4294d5c212a6d2254703
  35287. var $export = __webpack_require__(5913);
  35288. $export($export.S, 'Math', {
  35289. isubh: function isubh(x0, x1, y0, y1) {
  35290. var $x0 = x0 >>> 0;
  35291. var $x1 = x1 >>> 0;
  35292. var $y0 = y0 >>> 0;
  35293. return $x1 - (y1 >>> 0) - ((~$x0 & $y0 | ~($x0 ^ $y0) & $x0 - $y0 >>> 0) >>> 31) | 0;
  35294. }
  35295. });
  35296. /***/ }),
  35297. /***/ 3037:
  35298. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35299. // https://rwaldron.github.io/proposal-math-extensions/
  35300. var $export = __webpack_require__(5913);
  35301. $export($export.S, 'Math', {
  35302. RAD_PER_DEG: 180 / Math.PI
  35303. });
  35304. /***/ }),
  35305. /***/ 8422:
  35306. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35307. // https://rwaldron.github.io/proposal-math-extensions/
  35308. var $export = __webpack_require__(5913);
  35309. var DEG_PER_RAD = Math.PI / 180;
  35310. $export($export.S, 'Math', {
  35311. radians: function radians(degrees) {
  35312. return degrees * DEG_PER_RAD;
  35313. }
  35314. });
  35315. /***/ }),
  35316. /***/ 1818:
  35317. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35318. // https://rwaldron.github.io/proposal-math-extensions/
  35319. var $export = __webpack_require__(5913);
  35320. $export($export.S, 'Math', {
  35321. scale: __webpack_require__(8124)
  35322. });
  35323. /***/ }),
  35324. /***/ 7371:
  35325. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35326. // http://jfbastien.github.io/papers/Math.signbit.html
  35327. var $export = __webpack_require__(5913);
  35328. $export($export.S, 'Math', {
  35329. signbit: function signbit(x) {
  35330. // eslint-disable-next-line no-self-compare
  35331. return (x = +x) != x ? x : x == 0 ? 1 / x == Infinity : x > 0;
  35332. }
  35333. });
  35334. /***/ }),
  35335. /***/ 7883:
  35336. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35337. // https://gist.github.com/BrendanEich/4294d5c212a6d2254703
  35338. var $export = __webpack_require__(5913);
  35339. $export($export.S, 'Math', {
  35340. umulh: function umulh(u, v) {
  35341. var UINT16 = 0xffff;
  35342. var $u = +u;
  35343. var $v = +v;
  35344. var u0 = $u & UINT16;
  35345. var v0 = $v & UINT16;
  35346. var u1 = $u >>> 16;
  35347. var v1 = $v >>> 16;
  35348. var t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16);
  35349. return u1 * v1 + (t >>> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >>> 16);
  35350. }
  35351. });
  35352. /***/ }),
  35353. /***/ 6792:
  35354. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35355. var $export = __webpack_require__(5913);
  35356. var toObject = __webpack_require__(2515);
  35357. var aFunction = __webpack_require__(6819);
  35358. var $defineProperty = __webpack_require__(4835);
  35359. // B.2.2.2 Object.prototype.__defineGetter__(P, getter)
  35360. __webpack_require__(4926) && $export($export.P + __webpack_require__(8249), 'Object', {
  35361. __defineGetter__: function __defineGetter__(P, getter) {
  35362. $defineProperty.f(toObject(this), P, {
  35363. get: aFunction(getter),
  35364. enumerable: true,
  35365. configurable: true
  35366. });
  35367. }
  35368. });
  35369. /***/ }),
  35370. /***/ 88:
  35371. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35372. var $export = __webpack_require__(5913);
  35373. var toObject = __webpack_require__(2515);
  35374. var aFunction = __webpack_require__(6819);
  35375. var $defineProperty = __webpack_require__(4835);
  35376. // B.2.2.3 Object.prototype.__defineSetter__(P, setter)
  35377. __webpack_require__(4926) && $export($export.P + __webpack_require__(8249), 'Object', {
  35378. __defineSetter__: function __defineSetter__(P, setter) {
  35379. $defineProperty.f(toObject(this), P, {
  35380. set: aFunction(setter),
  35381. enumerable: true,
  35382. configurable: true
  35383. });
  35384. }
  35385. });
  35386. /***/ }),
  35387. /***/ 8217:
  35388. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35389. // https://github.com/tc39/proposal-object-values-entries
  35390. var $export = __webpack_require__(5913);
  35391. var $entries = __webpack_require__(8941)(true);
  35392. $export($export.S, 'Object', {
  35393. entries: function entries(it) {
  35394. return $entries(it);
  35395. }
  35396. });
  35397. /***/ }),
  35398. /***/ 9168:
  35399. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35400. // https://github.com/tc39/proposal-object-getownpropertydescriptors
  35401. var $export = __webpack_require__(5913);
  35402. var ownKeys = __webpack_require__(2600);
  35403. var toIObject = __webpack_require__(8499);
  35404. var gOPD = __webpack_require__(3299);
  35405. var createProperty = __webpack_require__(1348);
  35406. $export($export.S, 'Object', {
  35407. getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
  35408. var O = toIObject(object);
  35409. var getDesc = gOPD.f;
  35410. var keys = ownKeys(O);
  35411. var result = {};
  35412. var i = 0;
  35413. var key, desc;
  35414. while (keys.length > i) {
  35415. desc = getDesc(O, key = keys[i++]);
  35416. if (desc !== undefined) createProperty(result, key, desc);
  35417. }
  35418. return result;
  35419. }
  35420. });
  35421. /***/ }),
  35422. /***/ 2095:
  35423. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35424. var $export = __webpack_require__(5913);
  35425. var toObject = __webpack_require__(2515);
  35426. var toPrimitive = __webpack_require__(8537);
  35427. var getPrototypeOf = __webpack_require__(4153);
  35428. var getOwnPropertyDescriptor = (__webpack_require__(3299).f);
  35429. // B.2.2.4 Object.prototype.__lookupGetter__(P)
  35430. __webpack_require__(4926) && $export($export.P + __webpack_require__(8249), 'Object', {
  35431. __lookupGetter__: function __lookupGetter__(P) {
  35432. var O = toObject(this);
  35433. var K = toPrimitive(P, true);
  35434. var D;
  35435. do {
  35436. if (D = getOwnPropertyDescriptor(O, K)) return D.get;
  35437. } while (O = getPrototypeOf(O));
  35438. }
  35439. });
  35440. /***/ }),
  35441. /***/ 2889:
  35442. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35443. var $export = __webpack_require__(5913);
  35444. var toObject = __webpack_require__(2515);
  35445. var toPrimitive = __webpack_require__(8537);
  35446. var getPrototypeOf = __webpack_require__(4153);
  35447. var getOwnPropertyDescriptor = (__webpack_require__(3299).f);
  35448. // B.2.2.5 Object.prototype.__lookupSetter__(P)
  35449. __webpack_require__(4926) && $export($export.P + __webpack_require__(8249), 'Object', {
  35450. __lookupSetter__: function __lookupSetter__(P) {
  35451. var O = toObject(this);
  35452. var K = toPrimitive(P, true);
  35453. var D;
  35454. do {
  35455. if (D = getOwnPropertyDescriptor(O, K)) return D.set;
  35456. } while (O = getPrototypeOf(O));
  35457. }
  35458. });
  35459. /***/ }),
  35460. /***/ 6351:
  35461. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35462. // https://github.com/tc39/proposal-object-values-entries
  35463. var $export = __webpack_require__(5913);
  35464. var $values = __webpack_require__(8941)(false);
  35465. $export($export.S, 'Object', {
  35466. values: function values(it) {
  35467. return $values(it);
  35468. }
  35469. });
  35470. /***/ }),
  35471. /***/ 5613:
  35472. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35473. // https://github.com/zenparsing/es-observable
  35474. var $export = __webpack_require__(5913);
  35475. var global = __webpack_require__(7381);
  35476. var core = __webpack_require__(8544);
  35477. var microtask = __webpack_require__(1842)();
  35478. var OBSERVABLE = __webpack_require__(3336)('observable');
  35479. var aFunction = __webpack_require__(6819);
  35480. var anObject = __webpack_require__(6154);
  35481. var anInstance = __webpack_require__(2702);
  35482. var redefineAll = __webpack_require__(7228);
  35483. var hide = __webpack_require__(8012);
  35484. var forOf = __webpack_require__(2734);
  35485. var RETURN = forOf.RETURN;
  35486. var getMethod = function getMethod(fn) {
  35487. return fn == null ? undefined : aFunction(fn);
  35488. };
  35489. var cleanupSubscription = function cleanupSubscription(subscription) {
  35490. var cleanup = subscription._c;
  35491. if (cleanup) {
  35492. subscription._c = undefined;
  35493. cleanup();
  35494. }
  35495. };
  35496. var subscriptionClosed = function subscriptionClosed(subscription) {
  35497. return subscription._o === undefined;
  35498. };
  35499. var closeSubscription = function closeSubscription(subscription) {
  35500. if (!subscriptionClosed(subscription)) {
  35501. subscription._o = undefined;
  35502. cleanupSubscription(subscription);
  35503. }
  35504. };
  35505. var Subscription = function Subscription(observer, subscriber) {
  35506. anObject(observer);
  35507. this._c = undefined;
  35508. this._o = observer;
  35509. observer = new SubscriptionObserver(this);
  35510. try {
  35511. var cleanup = subscriber(observer);
  35512. var subscription = cleanup;
  35513. if (cleanup != null) {
  35514. if (typeof cleanup.unsubscribe === 'function') cleanup = function cleanup() {
  35515. subscription.unsubscribe();
  35516. };else aFunction(cleanup);
  35517. this._c = cleanup;
  35518. }
  35519. } catch (e) {
  35520. observer.error(e);
  35521. return;
  35522. }
  35523. if (subscriptionClosed(this)) cleanupSubscription(this);
  35524. };
  35525. Subscription.prototype = redefineAll({}, {
  35526. unsubscribe: function unsubscribe() {
  35527. closeSubscription(this);
  35528. }
  35529. });
  35530. var SubscriptionObserver = function SubscriptionObserver(subscription) {
  35531. this._s = subscription;
  35532. };
  35533. SubscriptionObserver.prototype = redefineAll({}, {
  35534. next: function next(value) {
  35535. var subscription = this._s;
  35536. if (!subscriptionClosed(subscription)) {
  35537. var observer = subscription._o;
  35538. try {
  35539. var m = getMethod(observer.next);
  35540. if (m) return m.call(observer, value);
  35541. } catch (e) {
  35542. try {
  35543. closeSubscription(subscription);
  35544. } finally {
  35545. throw e;
  35546. }
  35547. }
  35548. }
  35549. },
  35550. error: function error(value) {
  35551. var subscription = this._s;
  35552. if (subscriptionClosed(subscription)) throw value;
  35553. var observer = subscription._o;
  35554. subscription._o = undefined;
  35555. try {
  35556. var m = getMethod(observer.error);
  35557. if (!m) throw value;
  35558. value = m.call(observer, value);
  35559. } catch (e) {
  35560. try {
  35561. cleanupSubscription(subscription);
  35562. } finally {
  35563. throw e;
  35564. }
  35565. }
  35566. cleanupSubscription(subscription);
  35567. return value;
  35568. },
  35569. complete: function complete(value) {
  35570. var subscription = this._s;
  35571. if (!subscriptionClosed(subscription)) {
  35572. var observer = subscription._o;
  35573. subscription._o = undefined;
  35574. try {
  35575. var m = getMethod(observer.complete);
  35576. value = m ? m.call(observer, value) : undefined;
  35577. } catch (e) {
  35578. try {
  35579. cleanupSubscription(subscription);
  35580. } finally {
  35581. throw e;
  35582. }
  35583. }
  35584. cleanupSubscription(subscription);
  35585. return value;
  35586. }
  35587. }
  35588. });
  35589. var $Observable = function Observable(subscriber) {
  35590. anInstance(this, $Observable, 'Observable', '_f')._f = aFunction(subscriber);
  35591. };
  35592. redefineAll($Observable.prototype, {
  35593. subscribe: function subscribe(observer) {
  35594. return new Subscription(observer, this._f);
  35595. },
  35596. forEach: function forEach(fn) {
  35597. var that = this;
  35598. return new (core.Promise || global.Promise)(function (resolve, reject) {
  35599. aFunction(fn);
  35600. var subscription = that.subscribe({
  35601. next: function next(value) {
  35602. try {
  35603. return fn(value);
  35604. } catch (e) {
  35605. reject(e);
  35606. subscription.unsubscribe();
  35607. }
  35608. },
  35609. error: reject,
  35610. complete: resolve
  35611. });
  35612. });
  35613. }
  35614. });
  35615. redefineAll($Observable, {
  35616. from: function from(x) {
  35617. var C = typeof this === 'function' ? this : $Observable;
  35618. var method = getMethod(anObject(x)[OBSERVABLE]);
  35619. if (method) {
  35620. var observable = anObject(method.call(x));
  35621. return observable.constructor === C ? observable : new C(function (observer) {
  35622. return observable.subscribe(observer);
  35623. });
  35624. }
  35625. return new C(function (observer) {
  35626. var done = false;
  35627. microtask(function () {
  35628. if (!done) {
  35629. try {
  35630. if (forOf(x, false, function (it) {
  35631. observer.next(it);
  35632. if (done) return RETURN;
  35633. }) === RETURN) return;
  35634. } catch (e) {
  35635. if (done) throw e;
  35636. observer.error(e);
  35637. return;
  35638. }
  35639. observer.complete();
  35640. }
  35641. });
  35642. return function () {
  35643. done = true;
  35644. };
  35645. });
  35646. },
  35647. of: function of() {
  35648. for (var i = 0, l = arguments.length, items = new Array(l); i < l;) items[i] = arguments[i++];
  35649. return new (typeof this === 'function' ? this : $Observable)(function (observer) {
  35650. var done = false;
  35651. microtask(function () {
  35652. if (!done) {
  35653. for (var j = 0; j < items.length; ++j) {
  35654. observer.next(items[j]);
  35655. if (done) return;
  35656. }
  35657. observer.complete();
  35658. }
  35659. });
  35660. return function () {
  35661. done = true;
  35662. };
  35663. });
  35664. }
  35665. });
  35666. hide($Observable.prototype, OBSERVABLE, function () {
  35667. return this;
  35668. });
  35669. $export($export.G, {
  35670. Observable: $Observable
  35671. });
  35672. __webpack_require__(4798)('Observable');
  35673. /***/ }),
  35674. /***/ 8088:
  35675. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35676. // https://github.com/tc39/proposal-promise-finally
  35677. var $export = __webpack_require__(5913);
  35678. var core = __webpack_require__(8544);
  35679. var global = __webpack_require__(7381);
  35680. var speciesConstructor = __webpack_require__(2035);
  35681. var promiseResolve = __webpack_require__(3507);
  35682. $export($export.P + $export.R, 'Promise', {
  35683. 'finally': function _finally(onFinally) {
  35684. var C = speciesConstructor(this, core.Promise || global.Promise);
  35685. var isFunction = typeof onFinally == 'function';
  35686. return this.then(isFunction ? function (x) {
  35687. return promiseResolve(C, onFinally()).then(function () {
  35688. return x;
  35689. });
  35690. } : onFinally, isFunction ? function (e) {
  35691. return promiseResolve(C, onFinally()).then(function () {
  35692. throw e;
  35693. });
  35694. } : onFinally);
  35695. }
  35696. });
  35697. /***/ }),
  35698. /***/ 5414:
  35699. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35700. // https://github.com/tc39/proposal-promise-try
  35701. var $export = __webpack_require__(5913);
  35702. var newPromiseCapability = __webpack_require__(4086);
  35703. var perform = __webpack_require__(8228);
  35704. $export($export.S, 'Promise', {
  35705. 'try': function _try(callbackfn) {
  35706. var promiseCapability = newPromiseCapability.f(this);
  35707. var result = perform(callbackfn);
  35708. (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v);
  35709. return promiseCapability.promise;
  35710. }
  35711. });
  35712. /***/ }),
  35713. /***/ 2812:
  35714. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35715. var metadata = __webpack_require__(8953);
  35716. var anObject = __webpack_require__(6154);
  35717. var toMetaKey = metadata.key;
  35718. var ordinaryDefineOwnMetadata = metadata.set;
  35719. metadata.exp({
  35720. defineMetadata: function defineMetadata(metadataKey, metadataValue, target, targetKey) {
  35721. ordinaryDefineOwnMetadata(metadataKey, metadataValue, anObject(target), toMetaKey(targetKey));
  35722. }
  35723. });
  35724. /***/ }),
  35725. /***/ 2835:
  35726. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35727. var metadata = __webpack_require__(8953);
  35728. var anObject = __webpack_require__(6154);
  35729. var toMetaKey = metadata.key;
  35730. var getOrCreateMetadataMap = metadata.map;
  35731. var store = metadata.store;
  35732. metadata.exp({
  35733. deleteMetadata: function deleteMetadata(metadataKey, target /* , targetKey */) {
  35734. var targetKey = arguments.length < 3 ? undefined : toMetaKey(arguments[2]);
  35735. var metadataMap = getOrCreateMetadataMap(anObject(target), targetKey, false);
  35736. if (metadataMap === undefined || !metadataMap['delete'](metadataKey)) return false;
  35737. if (metadataMap.size) return true;
  35738. var targetMetadata = store.get(target);
  35739. targetMetadata['delete'](targetKey);
  35740. return !!targetMetadata.size || store['delete'](target);
  35741. }
  35742. });
  35743. /***/ }),
  35744. /***/ 710:
  35745. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35746. var Set = __webpack_require__(3940);
  35747. var from = __webpack_require__(5273);
  35748. var metadata = __webpack_require__(8953);
  35749. var anObject = __webpack_require__(6154);
  35750. var getPrototypeOf = __webpack_require__(4153);
  35751. var ordinaryOwnMetadataKeys = metadata.keys;
  35752. var toMetaKey = metadata.key;
  35753. var ordinaryMetadataKeys = function ordinaryMetadataKeys(O, P) {
  35754. var oKeys = ordinaryOwnMetadataKeys(O, P);
  35755. var parent = getPrototypeOf(O);
  35756. if (parent === null) return oKeys;
  35757. var pKeys = ordinaryMetadataKeys(parent, P);
  35758. return pKeys.length ? oKeys.length ? from(new Set(oKeys.concat(pKeys))) : pKeys : oKeys;
  35759. };
  35760. metadata.exp({
  35761. getMetadataKeys: function getMetadataKeys(target /* , targetKey */) {
  35762. return ordinaryMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1]));
  35763. }
  35764. });
  35765. /***/ }),
  35766. /***/ 7415:
  35767. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35768. var metadata = __webpack_require__(8953);
  35769. var anObject = __webpack_require__(6154);
  35770. var getPrototypeOf = __webpack_require__(4153);
  35771. var ordinaryHasOwnMetadata = metadata.has;
  35772. var ordinaryGetOwnMetadata = metadata.get;
  35773. var toMetaKey = metadata.key;
  35774. var ordinaryGetMetadata = function ordinaryGetMetadata(MetadataKey, O, P) {
  35775. var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P);
  35776. if (hasOwn) return ordinaryGetOwnMetadata(MetadataKey, O, P);
  35777. var parent = getPrototypeOf(O);
  35778. return parent !== null ? ordinaryGetMetadata(MetadataKey, parent, P) : undefined;
  35779. };
  35780. metadata.exp({
  35781. getMetadata: function getMetadata(metadataKey, target /* , targetKey */) {
  35782. return ordinaryGetMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
  35783. }
  35784. });
  35785. /***/ }),
  35786. /***/ 60:
  35787. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35788. var metadata = __webpack_require__(8953);
  35789. var anObject = __webpack_require__(6154);
  35790. var ordinaryOwnMetadataKeys = metadata.keys;
  35791. var toMetaKey = metadata.key;
  35792. metadata.exp({
  35793. getOwnMetadataKeys: function getOwnMetadataKeys(target /* , targetKey */) {
  35794. return ordinaryOwnMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1]));
  35795. }
  35796. });
  35797. /***/ }),
  35798. /***/ 3666:
  35799. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35800. var metadata = __webpack_require__(8953);
  35801. var anObject = __webpack_require__(6154);
  35802. var ordinaryGetOwnMetadata = metadata.get;
  35803. var toMetaKey = metadata.key;
  35804. metadata.exp({
  35805. getOwnMetadata: function getOwnMetadata(metadataKey, target /* , targetKey */) {
  35806. return ordinaryGetOwnMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
  35807. }
  35808. });
  35809. /***/ }),
  35810. /***/ 7216:
  35811. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35812. var metadata = __webpack_require__(8953);
  35813. var anObject = __webpack_require__(6154);
  35814. var getPrototypeOf = __webpack_require__(4153);
  35815. var ordinaryHasOwnMetadata = metadata.has;
  35816. var toMetaKey = metadata.key;
  35817. var ordinaryHasMetadata = function ordinaryHasMetadata(MetadataKey, O, P) {
  35818. var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P);
  35819. if (hasOwn) return true;
  35820. var parent = getPrototypeOf(O);
  35821. return parent !== null ? ordinaryHasMetadata(MetadataKey, parent, P) : false;
  35822. };
  35823. metadata.exp({
  35824. hasMetadata: function hasMetadata(metadataKey, target /* , targetKey */) {
  35825. return ordinaryHasMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
  35826. }
  35827. });
  35828. /***/ }),
  35829. /***/ 3470:
  35830. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35831. var metadata = __webpack_require__(8953);
  35832. var anObject = __webpack_require__(6154);
  35833. var ordinaryHasOwnMetadata = metadata.has;
  35834. var toMetaKey = metadata.key;
  35835. metadata.exp({
  35836. hasOwnMetadata: function hasOwnMetadata(metadataKey, target /* , targetKey */) {
  35837. return ordinaryHasOwnMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
  35838. }
  35839. });
  35840. /***/ }),
  35841. /***/ 2161:
  35842. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35843. var $metadata = __webpack_require__(8953);
  35844. var anObject = __webpack_require__(6154);
  35845. var aFunction = __webpack_require__(6819);
  35846. var toMetaKey = $metadata.key;
  35847. var ordinaryDefineOwnMetadata = $metadata.set;
  35848. $metadata.exp({
  35849. metadata: function metadata(metadataKey, metadataValue) {
  35850. return function decorator(target, targetKey) {
  35851. ordinaryDefineOwnMetadata(metadataKey, metadataValue, (targetKey !== undefined ? anObject : aFunction)(target), toMetaKey(targetKey));
  35852. };
  35853. }
  35854. });
  35855. /***/ }),
  35856. /***/ 922:
  35857. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35858. // https://tc39.github.io/proposal-setmap-offrom/#sec-set.from
  35859. __webpack_require__(7598)('Set');
  35860. /***/ }),
  35861. /***/ 3798:
  35862. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35863. // https://tc39.github.io/proposal-setmap-offrom/#sec-set.of
  35864. __webpack_require__(5329)('Set');
  35865. /***/ }),
  35866. /***/ 188:
  35867. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35868. // https://github.com/DavidBruant/Map-Set.prototype.toJSON
  35869. var $export = __webpack_require__(5913);
  35870. $export($export.P + $export.R, 'Set', {
  35871. toJSON: __webpack_require__(1872)('Set')
  35872. });
  35873. /***/ }),
  35874. /***/ 6696:
  35875. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35876. // https://github.com/mathiasbynens/String.prototype.at
  35877. var $export = __webpack_require__(5913);
  35878. var $at = __webpack_require__(3593)(true);
  35879. var $fails = __webpack_require__(5810);
  35880. var FORCED = $fails(function () {
  35881. return '𠮷'.at(0) !== '𠮷';
  35882. });
  35883. $export($export.P + $export.F * FORCED, 'String', {
  35884. at: function at(pos) {
  35885. return $at(this, pos);
  35886. }
  35887. });
  35888. /***/ }),
  35889. /***/ 7593:
  35890. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35891. // https://tc39.github.io/String.prototype.matchAll/
  35892. var $export = __webpack_require__(5913);
  35893. var defined = __webpack_require__(408);
  35894. var toLength = __webpack_require__(8315);
  35895. var isRegExp = __webpack_require__(1993);
  35896. var getFlags = __webpack_require__(2188);
  35897. var RegExpProto = RegExp.prototype;
  35898. var $RegExpStringIterator = function $RegExpStringIterator(regexp, string) {
  35899. this._r = regexp;
  35900. this._s = string;
  35901. };
  35902. __webpack_require__(8258)($RegExpStringIterator, 'RegExp String', function next() {
  35903. var match = this._r.exec(this._s);
  35904. return {
  35905. value: match,
  35906. done: match === null
  35907. };
  35908. });
  35909. $export($export.P, 'String', {
  35910. matchAll: function matchAll(regexp) {
  35911. defined(this);
  35912. if (!isRegExp(regexp)) throw TypeError(regexp + ' is not a regexp!');
  35913. var S = String(this);
  35914. var flags = 'flags' in RegExpProto ? String(regexp.flags) : getFlags.call(regexp);
  35915. var rx = new RegExp(regexp.source, ~flags.indexOf('g') ? flags : 'g' + flags);
  35916. rx.lastIndex = toLength(regexp.lastIndex);
  35917. return new $RegExpStringIterator(rx, S);
  35918. }
  35919. });
  35920. /***/ }),
  35921. /***/ 2123:
  35922. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35923. // https://github.com/tc39/proposal-string-pad-start-end
  35924. var $export = __webpack_require__(5913);
  35925. var $pad = __webpack_require__(1925);
  35926. var userAgent = __webpack_require__(851);
  35927. // https://github.com/zloirock/core-js/issues/280
  35928. var WEBKIT_BUG = /Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(userAgent);
  35929. $export($export.P + $export.F * WEBKIT_BUG, 'String', {
  35930. padEnd: function padEnd(maxLength /* , fillString = ' ' */) {
  35931. return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false);
  35932. }
  35933. });
  35934. /***/ }),
  35935. /***/ 9391:
  35936. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35937. // https://github.com/tc39/proposal-string-pad-start-end
  35938. var $export = __webpack_require__(5913);
  35939. var $pad = __webpack_require__(1925);
  35940. var userAgent = __webpack_require__(851);
  35941. // https://github.com/zloirock/core-js/issues/280
  35942. var WEBKIT_BUG = /Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(userAgent);
  35943. $export($export.P + $export.F * WEBKIT_BUG, 'String', {
  35944. padStart: function padStart(maxLength /* , fillString = ' ' */) {
  35945. return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true);
  35946. }
  35947. });
  35948. /***/ }),
  35949. /***/ 6541:
  35950. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35951. // https://github.com/sebmarkbage/ecmascript-string-left-right-trim
  35952. __webpack_require__(618)('trimLeft', function ($trim) {
  35953. return function trimLeft() {
  35954. return $trim(this, 1);
  35955. };
  35956. }, 'trimStart');
  35957. /***/ }),
  35958. /***/ 1767:
  35959. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35960. // https://github.com/sebmarkbage/ecmascript-string-left-right-trim
  35961. __webpack_require__(618)('trimRight', function ($trim) {
  35962. return function trimRight() {
  35963. return $trim(this, 2);
  35964. };
  35965. }, 'trimEnd');
  35966. /***/ }),
  35967. /***/ 4870:
  35968. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35969. __webpack_require__(5721)('asyncIterator');
  35970. /***/ }),
  35971. /***/ 7937:
  35972. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35973. __webpack_require__(5721)('observable');
  35974. /***/ }),
  35975. /***/ 3884:
  35976. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35977. // https://github.com/tc39/proposal-global
  35978. var $export = __webpack_require__(5913);
  35979. $export($export.S, 'System', {
  35980. global: __webpack_require__(7381)
  35981. });
  35982. /***/ }),
  35983. /***/ 2177:
  35984. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35985. // https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.from
  35986. __webpack_require__(7598)('WeakMap');
  35987. /***/ }),
  35988. /***/ 9737:
  35989. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35990. // https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.of
  35991. __webpack_require__(5329)('WeakMap');
  35992. /***/ }),
  35993. /***/ 8791:
  35994. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  35995. // https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.from
  35996. __webpack_require__(7598)('WeakSet');
  35997. /***/ }),
  35998. /***/ 5704:
  35999. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  36000. // https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.of
  36001. __webpack_require__(5329)('WeakSet');
  36002. /***/ }),
  36003. /***/ 1094:
  36004. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  36005. var $iterators = __webpack_require__(4806);
  36006. var getKeys = __webpack_require__(9924);
  36007. var redefine = __webpack_require__(7278);
  36008. var global = __webpack_require__(7381);
  36009. var hide = __webpack_require__(8012);
  36010. var Iterators = __webpack_require__(5301);
  36011. var wks = __webpack_require__(3336);
  36012. var ITERATOR = wks('iterator');
  36013. var TO_STRING_TAG = wks('toStringTag');
  36014. var ArrayValues = Iterators.Array;
  36015. var DOMIterables = {
  36016. CSSRuleList: true,
  36017. // TODO: Not spec compliant, should be false.
  36018. CSSStyleDeclaration: false,
  36019. CSSValueList: false,
  36020. ClientRectList: false,
  36021. DOMRectList: false,
  36022. DOMStringList: false,
  36023. DOMTokenList: true,
  36024. DataTransferItemList: false,
  36025. FileList: false,
  36026. HTMLAllCollection: false,
  36027. HTMLCollection: false,
  36028. HTMLFormElement: false,
  36029. HTMLSelectElement: false,
  36030. MediaList: true,
  36031. // TODO: Not spec compliant, should be false.
  36032. MimeTypeArray: false,
  36033. NamedNodeMap: false,
  36034. NodeList: true,
  36035. PaintRequestList: false,
  36036. Plugin: false,
  36037. PluginArray: false,
  36038. SVGLengthList: false,
  36039. SVGNumberList: false,
  36040. SVGPathSegList: false,
  36041. SVGPointList: false,
  36042. SVGStringList: false,
  36043. SVGTransformList: false,
  36044. SourceBufferList: false,
  36045. StyleSheetList: true,
  36046. // TODO: Not spec compliant, should be false.
  36047. TextTrackCueList: false,
  36048. TextTrackList: false,
  36049. TouchList: false
  36050. };
  36051. for (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++) {
  36052. var NAME = collections[i];
  36053. var explicit = DOMIterables[NAME];
  36054. var Collection = global[NAME];
  36055. var proto = Collection && Collection.prototype;
  36056. var key;
  36057. if (proto) {
  36058. if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues);
  36059. if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);
  36060. Iterators[NAME] = ArrayValues;
  36061. if (explicit) for (key in $iterators) if (!proto[key]) redefine(proto, key, $iterators[key], true);
  36062. }
  36063. }
  36064. /***/ }),
  36065. /***/ 1605:
  36066. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  36067. var $export = __webpack_require__(5913);
  36068. var $task = __webpack_require__(8220);
  36069. $export($export.G + $export.B, {
  36070. setImmediate: $task.set,
  36071. clearImmediate: $task.clear
  36072. });
  36073. /***/ }),
  36074. /***/ 2113:
  36075. /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
  36076. // ie9- setTimeout & setInterval additional parameters fix
  36077. var global = __webpack_require__(7381);
  36078. var $export = __webpack_require__(5913);
  36079. var userAgent = __webpack_require__(851);
  36080. var slice = [].slice;
  36081. var MSIE = /MSIE .\./.test(userAgent); // <- dirty ie9- check
  36082. var wrap = function wrap(set) {
  36083. return function (fn, time /* , ...args */) {
  36084. var boundArgs = arguments.length > 2;
  36085. var args = boundArgs ? slice.call(arguments, 2) : false;
  36086. return set(boundArgs ? function () {
  36087. // eslint-disable-next-line no-new-func
  36088. (typeof fn == 'function' ? fn : Function(fn)).apply(this, args);
  36089. } : fn, time);
  36090. };
  36091. };
  36092. $export($export.G + $export.B + $export.F * MSIE, {
  36093. setTimeout: wrap(global.setTimeout),
  36094. setInterval: wrap(global.setInterval)
  36095. });
  36096. /***/ }),
  36097. /***/ 2234:
  36098. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  36099. __webpack_require__(2403);
  36100. __webpack_require__(3290);
  36101. __webpack_require__(3690);
  36102. __webpack_require__(8424);
  36103. __webpack_require__(2357);
  36104. __webpack_require__(6667);
  36105. __webpack_require__(2506);
  36106. __webpack_require__(6022);
  36107. __webpack_require__(754);
  36108. __webpack_require__(7571);
  36109. __webpack_require__(6527);
  36110. __webpack_require__(9219);
  36111. __webpack_require__(3270);
  36112. __webpack_require__(4919);
  36113. __webpack_require__(5331);
  36114. __webpack_require__(2456);
  36115. __webpack_require__(8490);
  36116. __webpack_require__(4554);
  36117. __webpack_require__(161);
  36118. __webpack_require__(6042);
  36119. __webpack_require__(15);
  36120. __webpack_require__(317);
  36121. __webpack_require__(3271);
  36122. __webpack_require__(440);
  36123. __webpack_require__(1077);
  36124. __webpack_require__(820);
  36125. __webpack_require__(1914);
  36126. __webpack_require__(4117);
  36127. __webpack_require__(9619);
  36128. __webpack_require__(5849);
  36129. __webpack_require__(4750);
  36130. __webpack_require__(1550);
  36131. __webpack_require__(3529);
  36132. __webpack_require__(2791);
  36133. __webpack_require__(6831);
  36134. __webpack_require__(4717);
  36135. __webpack_require__(7292);
  36136. __webpack_require__(1840);
  36137. __webpack_require__(3255);
  36138. __webpack_require__(5728);
  36139. __webpack_require__(6255);
  36140. __webpack_require__(2834);
  36141. __webpack_require__(4489);
  36142. __webpack_require__(575);
  36143. __webpack_require__(1369);
  36144. __webpack_require__(2751);
  36145. __webpack_require__(9617);
  36146. __webpack_require__(3656);
  36147. __webpack_require__(1850);
  36148. __webpack_require__(5424);
  36149. __webpack_require__(230);
  36150. __webpack_require__(8471);
  36151. __webpack_require__(8577);
  36152. __webpack_require__(7906);
  36153. __webpack_require__(8587);
  36154. __webpack_require__(6575);
  36155. __webpack_require__(5281);
  36156. __webpack_require__(3917);
  36157. __webpack_require__(5450);
  36158. __webpack_require__(9449);
  36159. __webpack_require__(1616);
  36160. __webpack_require__(9718);
  36161. __webpack_require__(3845);
  36162. __webpack_require__(5803);
  36163. __webpack_require__(2222);
  36164. __webpack_require__(5036);
  36165. __webpack_require__(6131);
  36166. __webpack_require__(4110);
  36167. __webpack_require__(6235);
  36168. __webpack_require__(6495);
  36169. __webpack_require__(4162);
  36170. __webpack_require__(5297);
  36171. __webpack_require__(1466);
  36172. __webpack_require__(2581);
  36173. __webpack_require__(8384);
  36174. __webpack_require__(2334);
  36175. __webpack_require__(9701);
  36176. __webpack_require__(1325);
  36177. __webpack_require__(3233);
  36178. __webpack_require__(1621);
  36179. __webpack_require__(8671);
  36180. __webpack_require__(6705);
  36181. __webpack_require__(9437);
  36182. __webpack_require__(7263);
  36183. __webpack_require__(919);
  36184. __webpack_require__(791);
  36185. __webpack_require__(633);
  36186. __webpack_require__(9355);
  36187. __webpack_require__(9253);
  36188. __webpack_require__(9892);
  36189. __webpack_require__(9121);
  36190. __webpack_require__(8738);
  36191. __webpack_require__(4751);
  36192. __webpack_require__(9822);
  36193. __webpack_require__(4611);
  36194. __webpack_require__(9217);
  36195. __webpack_require__(4138);
  36196. __webpack_require__(109);
  36197. __webpack_require__(3821);
  36198. __webpack_require__(4806);
  36199. __webpack_require__(2566);
  36200. __webpack_require__(5997);
  36201. __webpack_require__(8359);
  36202. __webpack_require__(7181);
  36203. __webpack_require__(8682);
  36204. __webpack_require__(8514);
  36205. __webpack_require__(5105);
  36206. __webpack_require__(5325);
  36207. __webpack_require__(829);
  36208. __webpack_require__(8969);
  36209. __webpack_require__(3940);
  36210. __webpack_require__(3491);
  36211. __webpack_require__(6332);
  36212. __webpack_require__(7195);
  36213. __webpack_require__(5345);
  36214. __webpack_require__(6670);
  36215. __webpack_require__(7736);
  36216. __webpack_require__(4457);
  36217. __webpack_require__(7683);
  36218. __webpack_require__(1123);
  36219. __webpack_require__(4797);
  36220. __webpack_require__(4871);
  36221. __webpack_require__(8824);
  36222. __webpack_require__(6472);
  36223. __webpack_require__(1220);
  36224. __webpack_require__(9263);
  36225. __webpack_require__(7622);
  36226. __webpack_require__(9060);
  36227. __webpack_require__(980);
  36228. __webpack_require__(6175);
  36229. __webpack_require__(8484);
  36230. __webpack_require__(9869);
  36231. __webpack_require__(1285);
  36232. __webpack_require__(4854);
  36233. __webpack_require__(6647);
  36234. __webpack_require__(7903);
  36235. __webpack_require__(5197);
  36236. __webpack_require__(3113);
  36237. __webpack_require__(2963);
  36238. __webpack_require__(6032);
  36239. __webpack_require__(732);
  36240. __webpack_require__(6696);
  36241. __webpack_require__(9391);
  36242. __webpack_require__(2123);
  36243. __webpack_require__(6541);
  36244. __webpack_require__(1767);
  36245. __webpack_require__(7593);
  36246. __webpack_require__(4870);
  36247. __webpack_require__(7937);
  36248. __webpack_require__(9168);
  36249. __webpack_require__(6351);
  36250. __webpack_require__(8217);
  36251. __webpack_require__(6792);
  36252. __webpack_require__(88);
  36253. __webpack_require__(2095);
  36254. __webpack_require__(2889);
  36255. __webpack_require__(8455);
  36256. __webpack_require__(188);
  36257. __webpack_require__(9992);
  36258. __webpack_require__(3798);
  36259. __webpack_require__(9737);
  36260. __webpack_require__(5704);
  36261. __webpack_require__(3591);
  36262. __webpack_require__(922);
  36263. __webpack_require__(2177);
  36264. __webpack_require__(8791);
  36265. __webpack_require__(6426);
  36266. __webpack_require__(3884);
  36267. __webpack_require__(7469);
  36268. __webpack_require__(4097);
  36269. __webpack_require__(5813);
  36270. __webpack_require__(7245);
  36271. __webpack_require__(6756);
  36272. __webpack_require__(8392);
  36273. __webpack_require__(1111);
  36274. __webpack_require__(3735);
  36275. __webpack_require__(3037);
  36276. __webpack_require__(8422);
  36277. __webpack_require__(1818);
  36278. __webpack_require__(7883);
  36279. __webpack_require__(7371);
  36280. __webpack_require__(8088);
  36281. __webpack_require__(5414);
  36282. __webpack_require__(2812);
  36283. __webpack_require__(2835);
  36284. __webpack_require__(7415);
  36285. __webpack_require__(710);
  36286. __webpack_require__(3666);
  36287. __webpack_require__(60);
  36288. __webpack_require__(7216);
  36289. __webpack_require__(3470);
  36290. __webpack_require__(2161);
  36291. __webpack_require__(6321);
  36292. __webpack_require__(5613);
  36293. __webpack_require__(2113);
  36294. __webpack_require__(1605);
  36295. __webpack_require__(1094);
  36296. module.exports = __webpack_require__(8544);
  36297. /***/ }),
  36298. /***/ 4036:
  36299. /***/ ((module) => {
  36300. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  36301. var isMergeableObject = function isMergeableObject(value) {
  36302. return isNonNullObject(value) && !isSpecial(value);
  36303. };
  36304. function isNonNullObject(value) {
  36305. return !!value && _typeof(value) === 'object';
  36306. }
  36307. function isSpecial(value) {
  36308. var stringValue = Object.prototype.toString.call(value);
  36309. return stringValue === '[object RegExp]' || stringValue === '[object Date]' || isReactElement(value);
  36310. }
  36311. // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
  36312. var canUseSymbol = typeof Symbol === 'function' && Symbol["for"];
  36313. var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol["for"]('react.element') : 0xeac7;
  36314. function isReactElement(value) {
  36315. return value.$$typeof === REACT_ELEMENT_TYPE;
  36316. }
  36317. function emptyTarget(val) {
  36318. return Array.isArray(val) ? [] : {};
  36319. }
  36320. function cloneUnlessOtherwiseSpecified(value, options) {
  36321. return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
  36322. }
  36323. function defaultArrayMerge(target, source, options) {
  36324. return target.concat(source).map(function (element) {
  36325. return cloneUnlessOtherwiseSpecified(element, options);
  36326. });
  36327. }
  36328. function getMergeFunction(key, options) {
  36329. if (!options.customMerge) {
  36330. return deepmerge;
  36331. }
  36332. var customMerge = options.customMerge(key);
  36333. return typeof customMerge === 'function' ? customMerge : deepmerge;
  36334. }
  36335. function getEnumerableOwnPropertySymbols(target) {
  36336. return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function (symbol) {
  36337. return Object.propertyIsEnumerable.call(target, symbol);
  36338. }) : [];
  36339. }
  36340. function getKeys(target) {
  36341. return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
  36342. }
  36343. function propertyIsOnObject(object, property) {
  36344. try {
  36345. return property in object;
  36346. } catch (_) {
  36347. return false;
  36348. }
  36349. }
  36350. // Protects from prototype poisoning and unexpected merging up the prototype chain.
  36351. function propertyIsUnsafe(target, key) {
  36352. return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
  36353. && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
  36354. && Object.propertyIsEnumerable.call(target, key)); // and also unsafe if they're nonenumerable.
  36355. }
  36356. function mergeObject(target, source, options) {
  36357. var destination = {};
  36358. if (options.isMergeableObject(target)) {
  36359. getKeys(target).forEach(function (key) {
  36360. destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
  36361. });
  36362. }
  36363. getKeys(source).forEach(function (key) {
  36364. if (propertyIsUnsafe(target, key)) {
  36365. return;
  36366. }
  36367. if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
  36368. destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
  36369. } else {
  36370. destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
  36371. }
  36372. });
  36373. return destination;
  36374. }
  36375. function deepmerge(target, source, options) {
  36376. options = options || {};
  36377. options.arrayMerge = options.arrayMerge || defaultArrayMerge;
  36378. options.isMergeableObject = options.isMergeableObject || isMergeableObject;
  36379. // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
  36380. // implementations can use it. The caller may not replace it.
  36381. options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
  36382. var sourceIsArray = Array.isArray(source);
  36383. var targetIsArray = Array.isArray(target);
  36384. var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
  36385. if (!sourceAndTargetTypesMatch) {
  36386. return cloneUnlessOtherwiseSpecified(source, options);
  36387. } else if (sourceIsArray) {
  36388. return options.arrayMerge(target, source, options);
  36389. } else {
  36390. return mergeObject(target, source, options);
  36391. }
  36392. }
  36393. deepmerge.all = function deepmergeAll(array, options) {
  36394. if (!Array.isArray(array)) {
  36395. throw new Error('first argument should be an array');
  36396. }
  36397. return array.reduce(function (prev, next) {
  36398. return deepmerge(prev, next, options);
  36399. }, {});
  36400. };
  36401. var deepmerge_1 = deepmerge;
  36402. module.exports = deepmerge_1;
  36403. /***/ }),
  36404. /***/ 3117:
  36405. /***/ ((__unused_webpack_module, exports) => {
  36406. Object.defineProperty(exports, "__esModule", ({
  36407. value: true
  36408. }));
  36409. exports.attributeNames = exports.elementNames = void 0;
  36410. exports.elementNames = new Map([["altglyph", "altGlyph"], ["altglyphdef", "altGlyphDef"], ["altglyphitem", "altGlyphItem"], ["animatecolor", "animateColor"], ["animatemotion", "animateMotion"], ["animatetransform", "animateTransform"], ["clippath", "clipPath"], ["feblend", "feBlend"], ["fecolormatrix", "feColorMatrix"], ["fecomponenttransfer", "feComponentTransfer"], ["fecomposite", "feComposite"], ["feconvolvematrix", "feConvolveMatrix"], ["fediffuselighting", "feDiffuseLighting"], ["fedisplacementmap", "feDisplacementMap"], ["fedistantlight", "feDistantLight"], ["fedropshadow", "feDropShadow"], ["feflood", "feFlood"], ["fefunca", "feFuncA"], ["fefuncb", "feFuncB"], ["fefuncg", "feFuncG"], ["fefuncr", "feFuncR"], ["fegaussianblur", "feGaussianBlur"], ["feimage", "feImage"], ["femerge", "feMerge"], ["femergenode", "feMergeNode"], ["femorphology", "feMorphology"], ["feoffset", "feOffset"], ["fepointlight", "fePointLight"], ["fespecularlighting", "feSpecularLighting"], ["fespotlight", "feSpotLight"], ["fetile", "feTile"], ["feturbulence", "feTurbulence"], ["foreignobject", "foreignObject"], ["glyphref", "glyphRef"], ["lineargradient", "linearGradient"], ["radialgradient", "radialGradient"], ["textpath", "textPath"]]);
  36411. exports.attributeNames = new Map([["definitionurl", "definitionURL"], ["attributename", "attributeName"], ["attributetype", "attributeType"], ["basefrequency", "baseFrequency"], ["baseprofile", "baseProfile"], ["calcmode", "calcMode"], ["clippathunits", "clipPathUnits"], ["diffuseconstant", "diffuseConstant"], ["edgemode", "edgeMode"], ["filterunits", "filterUnits"], ["glyphref", "glyphRef"], ["gradienttransform", "gradientTransform"], ["gradientunits", "gradientUnits"], ["kernelmatrix", "kernelMatrix"], ["kernelunitlength", "kernelUnitLength"], ["keypoints", "keyPoints"], ["keysplines", "keySplines"], ["keytimes", "keyTimes"], ["lengthadjust", "lengthAdjust"], ["limitingconeangle", "limitingConeAngle"], ["markerheight", "markerHeight"], ["markerunits", "markerUnits"], ["markerwidth", "markerWidth"], ["maskcontentunits", "maskContentUnits"], ["maskunits", "maskUnits"], ["numoctaves", "numOctaves"], ["pathlength", "pathLength"], ["patterncontentunits", "patternContentUnits"], ["patterntransform", "patternTransform"], ["patternunits", "patternUnits"], ["pointsatx", "pointsAtX"], ["pointsaty", "pointsAtY"], ["pointsatz", "pointsAtZ"], ["preservealpha", "preserveAlpha"], ["preserveaspectratio", "preserveAspectRatio"], ["primitiveunits", "primitiveUnits"], ["refx", "refX"], ["refy", "refY"], ["repeatcount", "repeatCount"], ["repeatdur", "repeatDur"], ["requiredextensions", "requiredExtensions"], ["requiredfeatures", "requiredFeatures"], ["specularconstant", "specularConstant"], ["specularexponent", "specularExponent"], ["spreadmethod", "spreadMethod"], ["startoffset", "startOffset"], ["stddeviation", "stdDeviation"], ["stitchtiles", "stitchTiles"], ["surfacescale", "surfaceScale"], ["systemlanguage", "systemLanguage"], ["tablevalues", "tableValues"], ["targetx", "targetX"], ["targety", "targetY"], ["textlength", "textLength"], ["viewbox", "viewBox"], ["viewtarget", "viewTarget"], ["xchannelselector", "xChannelSelector"], ["ychannelselector", "yChannelSelector"], ["zoomandpan", "zoomAndPan"]]);
  36412. /***/ }),
  36413. /***/ 1671:
  36414. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  36415. var __assign = this && this.__assign || function () {
  36416. __assign = Object.assign || function (t) {
  36417. for (var s, i = 1, n = arguments.length; i < n; i++) {
  36418. s = arguments[i];
  36419. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  36420. }
  36421. return t;
  36422. };
  36423. return __assign.apply(this, arguments);
  36424. };
  36425. var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
  36426. if (k2 === undefined) k2 = k;
  36427. Object.defineProperty(o, k2, {
  36428. enumerable: true,
  36429. get: function get() {
  36430. return m[k];
  36431. }
  36432. });
  36433. } : function (o, m, k, k2) {
  36434. if (k2 === undefined) k2 = k;
  36435. o[k2] = m[k];
  36436. });
  36437. var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
  36438. Object.defineProperty(o, "default", {
  36439. enumerable: true,
  36440. value: v
  36441. });
  36442. } : function (o, v) {
  36443. o["default"] = v;
  36444. });
  36445. var __importStar = this && this.__importStar || function (mod) {
  36446. if (mod && mod.__esModule) return mod;
  36447. var result = {};
  36448. if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  36449. __setModuleDefault(result, mod);
  36450. return result;
  36451. };
  36452. Object.defineProperty(exports, "__esModule", ({
  36453. value: true
  36454. }));
  36455. /*
  36456. * Module dependencies
  36457. */
  36458. var ElementType = __importStar(__webpack_require__(7304));
  36459. var entities_1 = __webpack_require__(7531);
  36460. /**
  36461. * Mixed-case SVG and MathML tags & attributes
  36462. * recognized by the HTML parser.
  36463. *
  36464. * @see https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inforeign
  36465. */
  36466. var foreignNames_1 = __webpack_require__(3117);
  36467. var unencodedElements = new Set(["style", "script", "xmp", "iframe", "noembed", "noframes", "plaintext", "noscript"]);
  36468. /**
  36469. * Format attributes
  36470. */
  36471. function formatAttributes(attributes, opts) {
  36472. if (!attributes) return;
  36473. return Object.keys(attributes).map(function (key) {
  36474. var _a, _b;
  36475. var value = (_a = attributes[key]) !== null && _a !== void 0 ? _a : "";
  36476. if (opts.xmlMode === "foreign") {
  36477. /* Fix up mixed-case attribute names */
  36478. key = (_b = foreignNames_1.attributeNames.get(key)) !== null && _b !== void 0 ? _b : key;
  36479. }
  36480. if (!opts.emptyAttrs && !opts.xmlMode && value === "") {
  36481. return key;
  36482. }
  36483. return key + "=\"" + (opts.decodeEntities !== false ? entities_1.encodeXML(value) : value.replace(/"/g, "&quot;")) + "\"";
  36484. }).join(" ");
  36485. }
  36486. /**
  36487. * Self-enclosing tags
  36488. */
  36489. var singleTag = new Set(["area", "base", "basefont", "br", "col", "command", "embed", "frame", "hr", "img", "input", "isindex", "keygen", "link", "meta", "param", "source", "track", "wbr"]);
  36490. /**
  36491. * Renders a DOM node or an array of DOM nodes to a string.
  36492. *
  36493. * Can be thought of as the equivalent of the `outerHTML` of the passed node(s).
  36494. *
  36495. * @param node Node to be rendered.
  36496. * @param options Changes serialization behavior
  36497. */
  36498. function render(node, options) {
  36499. if (options === void 0) {
  36500. options = {};
  36501. }
  36502. var nodes = "length" in node ? node : [node];
  36503. var output = "";
  36504. for (var i = 0; i < nodes.length; i++) {
  36505. output += renderNode(nodes[i], options);
  36506. }
  36507. return output;
  36508. }
  36509. exports["default"] = render;
  36510. function renderNode(node, options) {
  36511. switch (node.type) {
  36512. case ElementType.Root:
  36513. return render(node.children, options);
  36514. case ElementType.Directive:
  36515. case ElementType.Doctype:
  36516. return renderDirective(node);
  36517. case ElementType.Comment:
  36518. return renderComment(node);
  36519. case ElementType.CDATA:
  36520. return renderCdata(node);
  36521. case ElementType.Script:
  36522. case ElementType.Style:
  36523. case ElementType.Tag:
  36524. return renderTag(node, options);
  36525. case ElementType.Text:
  36526. return renderText(node, options);
  36527. }
  36528. }
  36529. var foreignModeIntegrationPoints = new Set(["mi", "mo", "mn", "ms", "mtext", "annotation-xml", "foreignObject", "desc", "title"]);
  36530. var foreignElements = new Set(["svg", "math"]);
  36531. function renderTag(elem, opts) {
  36532. var _a;
  36533. // Handle SVG / MathML in HTML
  36534. if (opts.xmlMode === "foreign") {
  36535. /* Fix up mixed-case element names */
  36536. elem.name = (_a = foreignNames_1.elementNames.get(elem.name)) !== null && _a !== void 0 ? _a : elem.name;
  36537. /* Exit foreign mode at integration points */
  36538. if (elem.parent && foreignModeIntegrationPoints.has(elem.parent.name)) {
  36539. opts = __assign(__assign({}, opts), {
  36540. xmlMode: false
  36541. });
  36542. }
  36543. }
  36544. if (!opts.xmlMode && foreignElements.has(elem.name)) {
  36545. opts = __assign(__assign({}, opts), {
  36546. xmlMode: "foreign"
  36547. });
  36548. }
  36549. var tag = "<" + elem.name;
  36550. var attribs = formatAttributes(elem.attribs, opts);
  36551. if (attribs) {
  36552. tag += " " + attribs;
  36553. }
  36554. if (elem.children.length === 0 && (opts.xmlMode ?
  36555. // In XML mode or foreign mode, and user hasn't explicitly turned off self-closing tags
  36556. opts.selfClosingTags !== false :
  36557. // User explicitly asked for self-closing tags, even in HTML mode
  36558. opts.selfClosingTags && singleTag.has(elem.name))) {
  36559. if (!opts.xmlMode) tag += " ";
  36560. tag += "/>";
  36561. } else {
  36562. tag += ">";
  36563. if (elem.children.length > 0) {
  36564. tag += render(elem.children, opts);
  36565. }
  36566. if (opts.xmlMode || !singleTag.has(elem.name)) {
  36567. tag += "</" + elem.name + ">";
  36568. }
  36569. }
  36570. return tag;
  36571. }
  36572. function renderDirective(elem) {
  36573. return "<" + elem.data + ">";
  36574. }
  36575. function renderText(elem, opts) {
  36576. var data = elem.data || "";
  36577. // If entities weren't decoded, no need to encode them back
  36578. if (opts.decodeEntities !== false && !(!opts.xmlMode && elem.parent && unencodedElements.has(elem.parent.name))) {
  36579. data = entities_1.encodeXML(data);
  36580. }
  36581. return data;
  36582. }
  36583. function renderCdata(elem) {
  36584. return "<![CDATA[" + elem.children[0].data + "]]>";
  36585. }
  36586. function renderComment(elem) {
  36587. return "<!--" + elem.data + "-->";
  36588. }
  36589. /***/ }),
  36590. /***/ 7304:
  36591. /***/ ((__unused_webpack_module, exports) => {
  36592. Object.defineProperty(exports, "__esModule", ({
  36593. value: true
  36594. }));
  36595. exports.Doctype = exports.CDATA = exports.Tag = exports.Style = exports.Script = exports.Comment = exports.Directive = exports.Text = exports.Root = exports.isTag = exports.ElementType = void 0;
  36596. /** Types of elements found in htmlparser2's DOM */
  36597. var ElementType;
  36598. (function (ElementType) {
  36599. /** Type for the root element of a document */
  36600. ElementType["Root"] = "root";
  36601. /** Type for Text */
  36602. ElementType["Text"] = "text";
  36603. /** Type for <? ... ?> */
  36604. ElementType["Directive"] = "directive";
  36605. /** Type for <!-- ... --> */
  36606. ElementType["Comment"] = "comment";
  36607. /** Type for <script> tags */
  36608. ElementType["Script"] = "script";
  36609. /** Type for <style> tags */
  36610. ElementType["Style"] = "style";
  36611. /** Type for Any tag */
  36612. ElementType["Tag"] = "tag";
  36613. /** Type for <![CDATA[ ... ]]> */
  36614. ElementType["CDATA"] = "cdata";
  36615. /** Type for <!doctype ...> */
  36616. ElementType["Doctype"] = "doctype";
  36617. })(ElementType = exports.ElementType || (exports.ElementType = {}));
  36618. /**
  36619. * Tests whether an element is a tag or not.
  36620. *
  36621. * @param elem Element to test
  36622. */
  36623. function isTag(elem) {
  36624. return elem.type === ElementType.Tag || elem.type === ElementType.Script || elem.type === ElementType.Style;
  36625. }
  36626. exports.isTag = isTag;
  36627. // Exports for backwards compatibility
  36628. /** Type for the root element of a document */
  36629. exports.Root = ElementType.Root;
  36630. /** Type for Text */
  36631. exports.Text = ElementType.Text;
  36632. /** Type for <? ... ?> */
  36633. exports.Directive = ElementType.Directive;
  36634. /** Type for <!-- ... --> */
  36635. exports.Comment = ElementType.Comment;
  36636. /** Type for <script> tags */
  36637. exports.Script = ElementType.Script;
  36638. /** Type for <style> tags */
  36639. exports.Style = ElementType.Style;
  36640. /** Type for Any tag */
  36641. exports.Tag = ElementType.Tag;
  36642. /** Type for <![CDATA[ ... ]]> */
  36643. exports.CDATA = ElementType.CDATA;
  36644. /** Type for <!doctype ...> */
  36645. exports.Doctype = ElementType.Doctype;
  36646. /***/ }),
  36647. /***/ 1363:
  36648. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  36649. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  36650. var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
  36651. if (k2 === undefined) k2 = k;
  36652. var desc = Object.getOwnPropertyDescriptor(m, k);
  36653. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  36654. desc = {
  36655. enumerable: true,
  36656. get: function get() {
  36657. return m[k];
  36658. }
  36659. };
  36660. }
  36661. Object.defineProperty(o, k2, desc);
  36662. } : function (o, m, k, k2) {
  36663. if (k2 === undefined) k2 = k;
  36664. o[k2] = m[k];
  36665. });
  36666. var __exportStar = this && this.__exportStar || function (m, exports) {
  36667. for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
  36668. };
  36669. Object.defineProperty(exports, "__esModule", ({
  36670. value: true
  36671. }));
  36672. exports.DomHandler = void 0;
  36673. var domelementtype_1 = __webpack_require__(7304);
  36674. var node_1 = __webpack_require__(5653);
  36675. __exportStar(__webpack_require__(5653), exports);
  36676. var reWhitespace = /\s+/g;
  36677. // Default options
  36678. var defaultOpts = {
  36679. normalizeWhitespace: false,
  36680. withStartIndices: false,
  36681. withEndIndices: false,
  36682. xmlMode: false
  36683. };
  36684. var DomHandler = /** @class */function () {
  36685. /**
  36686. * @param callback Called once parsing has completed.
  36687. * @param options Settings for the handler.
  36688. * @param elementCB Callback whenever a tag is closed.
  36689. */
  36690. function DomHandler(callback, options, elementCB) {
  36691. /** The elements of the DOM */
  36692. this.dom = [];
  36693. /** The root element for the DOM */
  36694. this.root = new node_1.Document(this.dom);
  36695. /** Indicated whether parsing has been completed. */
  36696. this.done = false;
  36697. /** Stack of open tags. */
  36698. this.tagStack = [this.root];
  36699. /** A data node that is still being written to. */
  36700. this.lastNode = null;
  36701. /** Reference to the parser instance. Used for location information. */
  36702. this.parser = null;
  36703. // Make it possible to skip arguments, for backwards-compatibility
  36704. if (typeof options === "function") {
  36705. elementCB = options;
  36706. options = defaultOpts;
  36707. }
  36708. if (_typeof(callback) === "object") {
  36709. options = callback;
  36710. callback = undefined;
  36711. }
  36712. this.callback = callback !== null && callback !== void 0 ? callback : null;
  36713. this.options = options !== null && options !== void 0 ? options : defaultOpts;
  36714. this.elementCB = elementCB !== null && elementCB !== void 0 ? elementCB : null;
  36715. }
  36716. DomHandler.prototype.onparserinit = function (parser) {
  36717. this.parser = parser;
  36718. };
  36719. // Resets the handler back to starting state
  36720. DomHandler.prototype.onreset = function () {
  36721. this.dom = [];
  36722. this.root = new node_1.Document(this.dom);
  36723. this.done = false;
  36724. this.tagStack = [this.root];
  36725. this.lastNode = null;
  36726. this.parser = null;
  36727. };
  36728. // Signals the handler that parsing is done
  36729. DomHandler.prototype.onend = function () {
  36730. if (this.done) return;
  36731. this.done = true;
  36732. this.parser = null;
  36733. this.handleCallback(null);
  36734. };
  36735. DomHandler.prototype.onerror = function (error) {
  36736. this.handleCallback(error);
  36737. };
  36738. DomHandler.prototype.onclosetag = function () {
  36739. this.lastNode = null;
  36740. var elem = this.tagStack.pop();
  36741. if (this.options.withEndIndices) {
  36742. elem.endIndex = this.parser.endIndex;
  36743. }
  36744. if (this.elementCB) this.elementCB(elem);
  36745. };
  36746. DomHandler.prototype.onopentag = function (name, attribs) {
  36747. var type = this.options.xmlMode ? domelementtype_1.ElementType.Tag : undefined;
  36748. var element = new node_1.Element(name, attribs, undefined, type);
  36749. this.addNode(element);
  36750. this.tagStack.push(element);
  36751. };
  36752. DomHandler.prototype.ontext = function (data) {
  36753. var normalizeWhitespace = this.options.normalizeWhitespace;
  36754. var lastNode = this.lastNode;
  36755. if (lastNode && lastNode.type === domelementtype_1.ElementType.Text) {
  36756. if (normalizeWhitespace) {
  36757. lastNode.data = (lastNode.data + data).replace(reWhitespace, " ");
  36758. } else {
  36759. lastNode.data += data;
  36760. }
  36761. if (this.options.withEndIndices) {
  36762. lastNode.endIndex = this.parser.endIndex;
  36763. }
  36764. } else {
  36765. if (normalizeWhitespace) {
  36766. data = data.replace(reWhitespace, " ");
  36767. }
  36768. var node = new node_1.Text(data);
  36769. this.addNode(node);
  36770. this.lastNode = node;
  36771. }
  36772. };
  36773. DomHandler.prototype.oncomment = function (data) {
  36774. if (this.lastNode && this.lastNode.type === domelementtype_1.ElementType.Comment) {
  36775. this.lastNode.data += data;
  36776. return;
  36777. }
  36778. var node = new node_1.Comment(data);
  36779. this.addNode(node);
  36780. this.lastNode = node;
  36781. };
  36782. DomHandler.prototype.oncommentend = function () {
  36783. this.lastNode = null;
  36784. };
  36785. DomHandler.prototype.oncdatastart = function () {
  36786. var text = new node_1.Text("");
  36787. var node = new node_1.NodeWithChildren(domelementtype_1.ElementType.CDATA, [text]);
  36788. this.addNode(node);
  36789. text.parent = node;
  36790. this.lastNode = text;
  36791. };
  36792. DomHandler.prototype.oncdataend = function () {
  36793. this.lastNode = null;
  36794. };
  36795. DomHandler.prototype.onprocessinginstruction = function (name, data) {
  36796. var node = new node_1.ProcessingInstruction(name, data);
  36797. this.addNode(node);
  36798. };
  36799. DomHandler.prototype.handleCallback = function (error) {
  36800. if (typeof this.callback === "function") {
  36801. this.callback(error, this.dom);
  36802. } else if (error) {
  36803. throw error;
  36804. }
  36805. };
  36806. DomHandler.prototype.addNode = function (node) {
  36807. var parent = this.tagStack[this.tagStack.length - 1];
  36808. var previousSibling = parent.children[parent.children.length - 1];
  36809. if (this.options.withStartIndices) {
  36810. node.startIndex = this.parser.startIndex;
  36811. }
  36812. if (this.options.withEndIndices) {
  36813. node.endIndex = this.parser.endIndex;
  36814. }
  36815. parent.children.push(node);
  36816. if (previousSibling) {
  36817. node.prev = previousSibling;
  36818. previousSibling.next = node;
  36819. }
  36820. node.parent = parent;
  36821. this.lastNode = null;
  36822. };
  36823. return DomHandler;
  36824. }();
  36825. exports.DomHandler = DomHandler;
  36826. exports["default"] = DomHandler;
  36827. /***/ }),
  36828. /***/ 5653:
  36829. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  36830. var __extends = this && this.__extends || function () {
  36831. var _extendStatics = function extendStatics(d, b) {
  36832. _extendStatics = Object.setPrototypeOf || {
  36833. __proto__: []
  36834. } instanceof Array && function (d, b) {
  36835. d.__proto__ = b;
  36836. } || function (d, b) {
  36837. for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  36838. };
  36839. return _extendStatics(d, b);
  36840. };
  36841. return function (d, b) {
  36842. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  36843. _extendStatics(d, b);
  36844. function __() {
  36845. this.constructor = d;
  36846. }
  36847. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  36848. };
  36849. }();
  36850. var __assign = this && this.__assign || function () {
  36851. __assign = Object.assign || function (t) {
  36852. for (var s, i = 1, n = arguments.length; i < n; i++) {
  36853. s = arguments[i];
  36854. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  36855. }
  36856. return t;
  36857. };
  36858. return __assign.apply(this, arguments);
  36859. };
  36860. Object.defineProperty(exports, "__esModule", ({
  36861. value: true
  36862. }));
  36863. exports.cloneNode = exports.hasChildren = exports.isDocument = exports.isDirective = exports.isComment = exports.isText = exports.isCDATA = exports.isTag = exports.Element = exports.Document = exports.NodeWithChildren = exports.ProcessingInstruction = exports.Comment = exports.Text = exports.DataNode = exports.Node = void 0;
  36864. var domelementtype_1 = __webpack_require__(7304);
  36865. var nodeTypes = new Map([[domelementtype_1.ElementType.Tag, 1], [domelementtype_1.ElementType.Script, 1], [domelementtype_1.ElementType.Style, 1], [domelementtype_1.ElementType.Directive, 1], [domelementtype_1.ElementType.Text, 3], [domelementtype_1.ElementType.CDATA, 4], [domelementtype_1.ElementType.Comment, 8], [domelementtype_1.ElementType.Root, 9]]);
  36866. /**
  36867. * This object will be used as the prototype for Nodes when creating a
  36868. * DOM-Level-1-compliant structure.
  36869. */
  36870. var Node = /** @class */function () {
  36871. /**
  36872. *
  36873. * @param type The type of the node.
  36874. */
  36875. function Node(type) {
  36876. this.type = type;
  36877. /** Parent of the node */
  36878. this.parent = null;
  36879. /** Previous sibling */
  36880. this.prev = null;
  36881. /** Next sibling */
  36882. this.next = null;
  36883. /** The start index of the node. Requires `withStartIndices` on the handler to be `true. */
  36884. this.startIndex = null;
  36885. /** The end index of the node. Requires `withEndIndices` on the handler to be `true. */
  36886. this.endIndex = null;
  36887. }
  36888. Object.defineProperty(Node.prototype, "nodeType", {
  36889. // Read-only aliases
  36890. /**
  36891. * [DOM spec](https://dom.spec.whatwg.org/#dom-node-nodetype)-compatible
  36892. * node {@link type}.
  36893. */
  36894. get: function get() {
  36895. var _a;
  36896. return (_a = nodeTypes.get(this.type)) !== null && _a !== void 0 ? _a : 1;
  36897. },
  36898. enumerable: false,
  36899. configurable: true
  36900. });
  36901. Object.defineProperty(Node.prototype, "parentNode", {
  36902. // Read-write aliases for properties
  36903. /**
  36904. * Same as {@link parent}.
  36905. * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
  36906. */
  36907. get: function get() {
  36908. return this.parent;
  36909. },
  36910. set: function set(parent) {
  36911. this.parent = parent;
  36912. },
  36913. enumerable: false,
  36914. configurable: true
  36915. });
  36916. Object.defineProperty(Node.prototype, "previousSibling", {
  36917. /**
  36918. * Same as {@link prev}.
  36919. * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
  36920. */
  36921. get: function get() {
  36922. return this.prev;
  36923. },
  36924. set: function set(prev) {
  36925. this.prev = prev;
  36926. },
  36927. enumerable: false,
  36928. configurable: true
  36929. });
  36930. Object.defineProperty(Node.prototype, "nextSibling", {
  36931. /**
  36932. * Same as {@link next}.
  36933. * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
  36934. */
  36935. get: function get() {
  36936. return this.next;
  36937. },
  36938. set: function set(next) {
  36939. this.next = next;
  36940. },
  36941. enumerable: false,
  36942. configurable: true
  36943. });
  36944. /**
  36945. * Clone this node, and optionally its children.
  36946. *
  36947. * @param recursive Clone child nodes as well.
  36948. * @returns A clone of the node.
  36949. */
  36950. Node.prototype.cloneNode = function (recursive) {
  36951. if (recursive === void 0) {
  36952. recursive = false;
  36953. }
  36954. return cloneNode(this, recursive);
  36955. };
  36956. return Node;
  36957. }();
  36958. exports.Node = Node;
  36959. /**
  36960. * A node that contains some data.
  36961. */
  36962. var DataNode = /** @class */function (_super) {
  36963. __extends(DataNode, _super);
  36964. /**
  36965. * @param type The type of the node
  36966. * @param data The content of the data node
  36967. */
  36968. function DataNode(type, data) {
  36969. var _this = _super.call(this, type) || this;
  36970. _this.data = data;
  36971. return _this;
  36972. }
  36973. Object.defineProperty(DataNode.prototype, "nodeValue", {
  36974. /**
  36975. * Same as {@link data}.
  36976. * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
  36977. */
  36978. get: function get() {
  36979. return this.data;
  36980. },
  36981. set: function set(data) {
  36982. this.data = data;
  36983. },
  36984. enumerable: false,
  36985. configurable: true
  36986. });
  36987. return DataNode;
  36988. }(Node);
  36989. exports.DataNode = DataNode;
  36990. /**
  36991. * Text within the document.
  36992. */
  36993. var Text = /** @class */function (_super) {
  36994. __extends(Text, _super);
  36995. function Text(data) {
  36996. return _super.call(this, domelementtype_1.ElementType.Text, data) || this;
  36997. }
  36998. return Text;
  36999. }(DataNode);
  37000. exports.Text = Text;
  37001. /**
  37002. * Comments within the document.
  37003. */
  37004. var Comment = /** @class */function (_super) {
  37005. __extends(Comment, _super);
  37006. function Comment(data) {
  37007. return _super.call(this, domelementtype_1.ElementType.Comment, data) || this;
  37008. }
  37009. return Comment;
  37010. }(DataNode);
  37011. exports.Comment = Comment;
  37012. /**
  37013. * Processing instructions, including doc types.
  37014. */
  37015. var ProcessingInstruction = /** @class */function (_super) {
  37016. __extends(ProcessingInstruction, _super);
  37017. function ProcessingInstruction(name, data) {
  37018. var _this = _super.call(this, domelementtype_1.ElementType.Directive, data) || this;
  37019. _this.name = name;
  37020. return _this;
  37021. }
  37022. return ProcessingInstruction;
  37023. }(DataNode);
  37024. exports.ProcessingInstruction = ProcessingInstruction;
  37025. /**
  37026. * A `Node` that can have children.
  37027. */
  37028. var NodeWithChildren = /** @class */function (_super) {
  37029. __extends(NodeWithChildren, _super);
  37030. /**
  37031. * @param type Type of the node.
  37032. * @param children Children of the node. Only certain node types can have children.
  37033. */
  37034. function NodeWithChildren(type, children) {
  37035. var _this = _super.call(this, type) || this;
  37036. _this.children = children;
  37037. return _this;
  37038. }
  37039. Object.defineProperty(NodeWithChildren.prototype, "firstChild", {
  37040. // Aliases
  37041. /** First child of the node. */
  37042. get: function get() {
  37043. var _a;
  37044. return (_a = this.children[0]) !== null && _a !== void 0 ? _a : null;
  37045. },
  37046. enumerable: false,
  37047. configurable: true
  37048. });
  37049. Object.defineProperty(NodeWithChildren.prototype, "lastChild", {
  37050. /** Last child of the node. */
  37051. get: function get() {
  37052. return this.children.length > 0 ? this.children[this.children.length - 1] : null;
  37053. },
  37054. enumerable: false,
  37055. configurable: true
  37056. });
  37057. Object.defineProperty(NodeWithChildren.prototype, "childNodes", {
  37058. /**
  37059. * Same as {@link children}.
  37060. * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
  37061. */
  37062. get: function get() {
  37063. return this.children;
  37064. },
  37065. set: function set(children) {
  37066. this.children = children;
  37067. },
  37068. enumerable: false,
  37069. configurable: true
  37070. });
  37071. return NodeWithChildren;
  37072. }(Node);
  37073. exports.NodeWithChildren = NodeWithChildren;
  37074. /**
  37075. * The root node of the document.
  37076. */
  37077. var Document = /** @class */function (_super) {
  37078. __extends(Document, _super);
  37079. function Document(children) {
  37080. return _super.call(this, domelementtype_1.ElementType.Root, children) || this;
  37081. }
  37082. return Document;
  37083. }(NodeWithChildren);
  37084. exports.Document = Document;
  37085. /**
  37086. * An element within the DOM.
  37087. */
  37088. var Element = /** @class */function (_super) {
  37089. __extends(Element, _super);
  37090. /**
  37091. * @param name Name of the tag, eg. `div`, `span`.
  37092. * @param attribs Object mapping attribute names to attribute values.
  37093. * @param children Children of the node.
  37094. */
  37095. function Element(name, attribs, children, type) {
  37096. if (children === void 0) {
  37097. children = [];
  37098. }
  37099. if (type === void 0) {
  37100. type = name === "script" ? domelementtype_1.ElementType.Script : name === "style" ? domelementtype_1.ElementType.Style : domelementtype_1.ElementType.Tag;
  37101. }
  37102. var _this = _super.call(this, type, children) || this;
  37103. _this.name = name;
  37104. _this.attribs = attribs;
  37105. return _this;
  37106. }
  37107. Object.defineProperty(Element.prototype, "tagName", {
  37108. // DOM Level 1 aliases
  37109. /**
  37110. * Same as {@link name}.
  37111. * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
  37112. */
  37113. get: function get() {
  37114. return this.name;
  37115. },
  37116. set: function set(name) {
  37117. this.name = name;
  37118. },
  37119. enumerable: false,
  37120. configurable: true
  37121. });
  37122. Object.defineProperty(Element.prototype, "attributes", {
  37123. get: function get() {
  37124. var _this = this;
  37125. return Object.keys(this.attribs).map(function (name) {
  37126. var _a, _b;
  37127. return {
  37128. name: name,
  37129. value: _this.attribs[name],
  37130. namespace: (_a = _this["x-attribsNamespace"]) === null || _a === void 0 ? void 0 : _a[name],
  37131. prefix: (_b = _this["x-attribsPrefix"]) === null || _b === void 0 ? void 0 : _b[name]
  37132. };
  37133. });
  37134. },
  37135. enumerable: false,
  37136. configurable: true
  37137. });
  37138. return Element;
  37139. }(NodeWithChildren);
  37140. exports.Element = Element;
  37141. /**
  37142. * @param node Node to check.
  37143. * @returns `true` if the node is a `Element`, `false` otherwise.
  37144. */
  37145. function isTag(node) {
  37146. return (0, domelementtype_1.isTag)(node);
  37147. }
  37148. exports.isTag = isTag;
  37149. /**
  37150. * @param node Node to check.
  37151. * @returns `true` if the node has the type `CDATA`, `false` otherwise.
  37152. */
  37153. function isCDATA(node) {
  37154. return node.type === domelementtype_1.ElementType.CDATA;
  37155. }
  37156. exports.isCDATA = isCDATA;
  37157. /**
  37158. * @param node Node to check.
  37159. * @returns `true` if the node has the type `Text`, `false` otherwise.
  37160. */
  37161. function isText(node) {
  37162. return node.type === domelementtype_1.ElementType.Text;
  37163. }
  37164. exports.isText = isText;
  37165. /**
  37166. * @param node Node to check.
  37167. * @returns `true` if the node has the type `Comment`, `false` otherwise.
  37168. */
  37169. function isComment(node) {
  37170. return node.type === domelementtype_1.ElementType.Comment;
  37171. }
  37172. exports.isComment = isComment;
  37173. /**
  37174. * @param node Node to check.
  37175. * @returns `true` if the node has the type `ProcessingInstruction`, `false` otherwise.
  37176. */
  37177. function isDirective(node) {
  37178. return node.type === domelementtype_1.ElementType.Directive;
  37179. }
  37180. exports.isDirective = isDirective;
  37181. /**
  37182. * @param node Node to check.
  37183. * @returns `true` if the node has the type `ProcessingInstruction`, `false` otherwise.
  37184. */
  37185. function isDocument(node) {
  37186. return node.type === domelementtype_1.ElementType.Root;
  37187. }
  37188. exports.isDocument = isDocument;
  37189. /**
  37190. * @param node Node to check.
  37191. * @returns `true` if the node is a `NodeWithChildren` (has children), `false` otherwise.
  37192. */
  37193. function hasChildren(node) {
  37194. return Object.prototype.hasOwnProperty.call(node, "children");
  37195. }
  37196. exports.hasChildren = hasChildren;
  37197. /**
  37198. * Clone a node, and optionally its children.
  37199. *
  37200. * @param recursive Clone child nodes as well.
  37201. * @returns A clone of the node.
  37202. */
  37203. function cloneNode(node, recursive) {
  37204. if (recursive === void 0) {
  37205. recursive = false;
  37206. }
  37207. var result;
  37208. if (isText(node)) {
  37209. result = new Text(node.data);
  37210. } else if (isComment(node)) {
  37211. result = new Comment(node.data);
  37212. } else if (isTag(node)) {
  37213. var children = recursive ? cloneChildren(node.children) : [];
  37214. var clone_1 = new Element(node.name, __assign({}, node.attribs), children);
  37215. children.forEach(function (child) {
  37216. return child.parent = clone_1;
  37217. });
  37218. if (node.namespace != null) {
  37219. clone_1.namespace = node.namespace;
  37220. }
  37221. if (node["x-attribsNamespace"]) {
  37222. clone_1["x-attribsNamespace"] = __assign({}, node["x-attribsNamespace"]);
  37223. }
  37224. if (node["x-attribsPrefix"]) {
  37225. clone_1["x-attribsPrefix"] = __assign({}, node["x-attribsPrefix"]);
  37226. }
  37227. result = clone_1;
  37228. } else if (isCDATA(node)) {
  37229. var children = recursive ? cloneChildren(node.children) : [];
  37230. var clone_2 = new NodeWithChildren(domelementtype_1.ElementType.CDATA, children);
  37231. children.forEach(function (child) {
  37232. return child.parent = clone_2;
  37233. });
  37234. result = clone_2;
  37235. } else if (isDocument(node)) {
  37236. var children = recursive ? cloneChildren(node.children) : [];
  37237. var clone_3 = new Document(children);
  37238. children.forEach(function (child) {
  37239. return child.parent = clone_3;
  37240. });
  37241. if (node["x-mode"]) {
  37242. clone_3["x-mode"] = node["x-mode"];
  37243. }
  37244. result = clone_3;
  37245. } else if (isDirective(node)) {
  37246. var instruction = new ProcessingInstruction(node.name, node.data);
  37247. if (node["x-name"] != null) {
  37248. instruction["x-name"] = node["x-name"];
  37249. instruction["x-publicId"] = node["x-publicId"];
  37250. instruction["x-systemId"] = node["x-systemId"];
  37251. }
  37252. result = instruction;
  37253. } else {
  37254. throw new Error("Not implemented yet: ".concat(node.type));
  37255. }
  37256. result.startIndex = node.startIndex;
  37257. result.endIndex = node.endIndex;
  37258. if (node.sourceCodeLocation != null) {
  37259. result.sourceCodeLocation = node.sourceCodeLocation;
  37260. }
  37261. return result;
  37262. }
  37263. exports.cloneNode = cloneNode;
  37264. function cloneChildren(childs) {
  37265. var children = childs.map(function (child) {
  37266. return cloneNode(child, true);
  37267. });
  37268. for (var i = 1; i < children.length; i++) {
  37269. children[i].prev = children[i - 1];
  37270. children[i - 1].next = children[i];
  37271. }
  37272. return children;
  37273. }
  37274. /***/ }),
  37275. /***/ 3625:
  37276. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  37277. Object.defineProperty(exports, "__esModule", ({
  37278. value: true
  37279. }));
  37280. exports.getFeed = void 0;
  37281. var stringify_1 = __webpack_require__(3633);
  37282. var legacy_1 = __webpack_require__(7344);
  37283. /**
  37284. * Get the feed object from the root of a DOM tree.
  37285. *
  37286. * @param doc - The DOM to to extract the feed from.
  37287. * @returns The feed.
  37288. */
  37289. function getFeed(doc) {
  37290. var feedRoot = getOneElement(isValidFeed, doc);
  37291. return !feedRoot ? null : feedRoot.name === "feed" ? getAtomFeed(feedRoot) : getRssFeed(feedRoot);
  37292. }
  37293. exports.getFeed = getFeed;
  37294. /**
  37295. * Parse an Atom feed.
  37296. *
  37297. * @param feedRoot The root of the feed.
  37298. * @returns The parsed feed.
  37299. */
  37300. function getAtomFeed(feedRoot) {
  37301. var _a;
  37302. var childs = feedRoot.children;
  37303. var feed = {
  37304. type: "atom",
  37305. items: (0, legacy_1.getElementsByTagName)("entry", childs).map(function (item) {
  37306. var _a;
  37307. var children = item.children;
  37308. var entry = {
  37309. media: getMediaElements(children)
  37310. };
  37311. addConditionally(entry, "id", "id", children);
  37312. addConditionally(entry, "title", "title", children);
  37313. var href = (_a = getOneElement("link", children)) === null || _a === void 0 ? void 0 : _a.attribs.href;
  37314. if (href) {
  37315. entry.link = href;
  37316. }
  37317. var description = fetch("summary", children) || fetch("content", children);
  37318. if (description) {
  37319. entry.description = description;
  37320. }
  37321. var pubDate = fetch("updated", children);
  37322. if (pubDate) {
  37323. entry.pubDate = new Date(pubDate);
  37324. }
  37325. return entry;
  37326. })
  37327. };
  37328. addConditionally(feed, "id", "id", childs);
  37329. addConditionally(feed, "title", "title", childs);
  37330. var href = (_a = getOneElement("link", childs)) === null || _a === void 0 ? void 0 : _a.attribs.href;
  37331. if (href) {
  37332. feed.link = href;
  37333. }
  37334. addConditionally(feed, "description", "subtitle", childs);
  37335. var updated = fetch("updated", childs);
  37336. if (updated) {
  37337. feed.updated = new Date(updated);
  37338. }
  37339. addConditionally(feed, "author", "email", childs, true);
  37340. return feed;
  37341. }
  37342. /**
  37343. * Parse a RSS feed.
  37344. *
  37345. * @param feedRoot The root of the feed.
  37346. * @returns The parsed feed.
  37347. */
  37348. function getRssFeed(feedRoot) {
  37349. var _a, _b;
  37350. var childs = (_b = (_a = getOneElement("channel", feedRoot.children)) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : [];
  37351. var feed = {
  37352. type: feedRoot.name.substr(0, 3),
  37353. id: "",
  37354. items: (0, legacy_1.getElementsByTagName)("item", feedRoot.children).map(function (item) {
  37355. var children = item.children;
  37356. var entry = {
  37357. media: getMediaElements(children)
  37358. };
  37359. addConditionally(entry, "id", "guid", children);
  37360. addConditionally(entry, "title", "title", children);
  37361. addConditionally(entry, "link", "link", children);
  37362. addConditionally(entry, "description", "description", children);
  37363. var pubDate = fetch("pubDate", children);
  37364. if (pubDate) entry.pubDate = new Date(pubDate);
  37365. return entry;
  37366. })
  37367. };
  37368. addConditionally(feed, "title", "title", childs);
  37369. addConditionally(feed, "link", "link", childs);
  37370. addConditionally(feed, "description", "description", childs);
  37371. var updated = fetch("lastBuildDate", childs);
  37372. if (updated) {
  37373. feed.updated = new Date(updated);
  37374. }
  37375. addConditionally(feed, "author", "managingEditor", childs, true);
  37376. return feed;
  37377. }
  37378. var MEDIA_KEYS_STRING = ["url", "type", "lang"];
  37379. var MEDIA_KEYS_INT = ["fileSize", "bitrate", "framerate", "samplingrate", "channels", "duration", "height", "width"];
  37380. /**
  37381. * Get all media elements of a feed item.
  37382. *
  37383. * @param where Nodes to search in.
  37384. * @returns Media elements.
  37385. */
  37386. function getMediaElements(where) {
  37387. return (0, legacy_1.getElementsByTagName)("media:content", where).map(function (elem) {
  37388. var attribs = elem.attribs;
  37389. var media = {
  37390. medium: attribs.medium,
  37391. isDefault: !!attribs.isDefault
  37392. };
  37393. for (var _i = 0, MEDIA_KEYS_STRING_1 = MEDIA_KEYS_STRING; _i < MEDIA_KEYS_STRING_1.length; _i++) {
  37394. var attrib = MEDIA_KEYS_STRING_1[_i];
  37395. if (attribs[attrib]) {
  37396. media[attrib] = attribs[attrib];
  37397. }
  37398. }
  37399. for (var _a = 0, MEDIA_KEYS_INT_1 = MEDIA_KEYS_INT; _a < MEDIA_KEYS_INT_1.length; _a++) {
  37400. var attrib = MEDIA_KEYS_INT_1[_a];
  37401. if (attribs[attrib]) {
  37402. media[attrib] = parseInt(attribs[attrib], 10);
  37403. }
  37404. }
  37405. if (attribs.expression) {
  37406. media.expression = attribs.expression;
  37407. }
  37408. return media;
  37409. });
  37410. }
  37411. /**
  37412. * Get one element by tag name.
  37413. *
  37414. * @param tagName Tag name to look for
  37415. * @param node Node to search in
  37416. * @returns The element or null
  37417. */
  37418. function getOneElement(tagName, node) {
  37419. return (0, legacy_1.getElementsByTagName)(tagName, node, true, 1)[0];
  37420. }
  37421. /**
  37422. * Get the text content of an element with a certain tag name.
  37423. *
  37424. * @param tagName Tag name to look for.
  37425. * @param where Node to search in.
  37426. * @param recurse Whether to recurse into child nodes.
  37427. * @returns The text content of the element.
  37428. */
  37429. function fetch(tagName, where, recurse) {
  37430. if (recurse === void 0) {
  37431. recurse = false;
  37432. }
  37433. return (0, stringify_1.textContent)((0, legacy_1.getElementsByTagName)(tagName, where, recurse, 1)).trim();
  37434. }
  37435. /**
  37436. * Adds a property to an object if it has a value.
  37437. *
  37438. * @param obj Object to be extended
  37439. * @param prop Property name
  37440. * @param tagName Tag name that contains the conditionally added property
  37441. * @param where Element to search for the property
  37442. * @param recurse Whether to recurse into child nodes.
  37443. */
  37444. function addConditionally(obj, prop, tagName, where, recurse) {
  37445. if (recurse === void 0) {
  37446. recurse = false;
  37447. }
  37448. var val = fetch(tagName, where, recurse);
  37449. if (val) obj[prop] = val;
  37450. }
  37451. /**
  37452. * Checks if an element is a feed root node.
  37453. *
  37454. * @param value The name of the element to check.
  37455. * @returns Whether an element is a feed root node.
  37456. */
  37457. function isValidFeed(value) {
  37458. return value === "rss" || value === "feed" || value === "rdf:RDF";
  37459. }
  37460. /***/ }),
  37461. /***/ 3757:
  37462. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  37463. Object.defineProperty(exports, "__esModule", ({
  37464. value: true
  37465. }));
  37466. exports.uniqueSort = exports.compareDocumentPosition = exports.removeSubsets = void 0;
  37467. var domhandler_1 = __webpack_require__(1363);
  37468. /**
  37469. * Given an array of nodes, remove any member that is contained by another.
  37470. *
  37471. * @param nodes Nodes to filter.
  37472. * @returns Remaining nodes that aren't subtrees of each other.
  37473. */
  37474. function removeSubsets(nodes) {
  37475. var idx = nodes.length;
  37476. /*
  37477. * Check if each node (or one of its ancestors) is already contained in the
  37478. * array.
  37479. */
  37480. while (--idx >= 0) {
  37481. var node = nodes[idx];
  37482. /*
  37483. * Remove the node if it is not unique.
  37484. * We are going through the array from the end, so we only
  37485. * have to check nodes that preceed the node under consideration in the array.
  37486. */
  37487. if (idx > 0 && nodes.lastIndexOf(node, idx - 1) >= 0) {
  37488. nodes.splice(idx, 1);
  37489. continue;
  37490. }
  37491. for (var ancestor = node.parent; ancestor; ancestor = ancestor.parent) {
  37492. if (nodes.includes(ancestor)) {
  37493. nodes.splice(idx, 1);
  37494. break;
  37495. }
  37496. }
  37497. }
  37498. return nodes;
  37499. }
  37500. exports.removeSubsets = removeSubsets;
  37501. /**
  37502. * Compare the position of one node against another node in any other document.
  37503. * The return value is a bitmask with the following values:
  37504. *
  37505. * Document order:
  37506. * > There is an ordering, document order, defined on all the nodes in the
  37507. * > document corresponding to the order in which the first character of the
  37508. * > XML representation of each node occurs in the XML representation of the
  37509. * > document after expansion of general entities. Thus, the document element
  37510. * > node will be the first node. Element nodes occur before their children.
  37511. * > Thus, document order orders element nodes in order of the occurrence of
  37512. * > their start-tag in the XML (after expansion of entities). The attribute
  37513. * > nodes of an element occur after the element and before its children. The
  37514. * > relative order of attribute nodes is implementation-dependent./
  37515. *
  37516. * Source:
  37517. * http://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-document-order
  37518. *
  37519. * @param nodeA The first node to use in the comparison
  37520. * @param nodeB The second node to use in the comparison
  37521. * @returns A bitmask describing the input nodes' relative position.
  37522. *
  37523. * See http://dom.spec.whatwg.org/#dom-node-comparedocumentposition for
  37524. * a description of these values.
  37525. */
  37526. function compareDocumentPosition(nodeA, nodeB) {
  37527. var aParents = [];
  37528. var bParents = [];
  37529. if (nodeA === nodeB) {
  37530. return 0;
  37531. }
  37532. var current = (0, domhandler_1.hasChildren)(nodeA) ? nodeA : nodeA.parent;
  37533. while (current) {
  37534. aParents.unshift(current);
  37535. current = current.parent;
  37536. }
  37537. current = (0, domhandler_1.hasChildren)(nodeB) ? nodeB : nodeB.parent;
  37538. while (current) {
  37539. bParents.unshift(current);
  37540. current = current.parent;
  37541. }
  37542. var maxIdx = Math.min(aParents.length, bParents.length);
  37543. var idx = 0;
  37544. while (idx < maxIdx && aParents[idx] === bParents[idx]) {
  37545. idx++;
  37546. }
  37547. if (idx === 0) {
  37548. return 1 /* DISCONNECTED */;
  37549. }
  37550. var sharedParent = aParents[idx - 1];
  37551. var siblings = sharedParent.children;
  37552. var aSibling = aParents[idx];
  37553. var bSibling = bParents[idx];
  37554. if (siblings.indexOf(aSibling) > siblings.indexOf(bSibling)) {
  37555. if (sharedParent === nodeB) {
  37556. return 4 /* FOLLOWING */ | 16 /* CONTAINED_BY */;
  37557. }
  37558. return 4 /* FOLLOWING */;
  37559. }
  37560. if (sharedParent === nodeA) {
  37561. return 2 /* PRECEDING */ | 8 /* CONTAINS */;
  37562. }
  37563. return 2 /* PRECEDING */;
  37564. }
  37565. exports.compareDocumentPosition = compareDocumentPosition;
  37566. /**
  37567. * Sort an array of nodes based on their relative position in the document and
  37568. * remove any duplicate nodes. If the array contains nodes that do not belong
  37569. * to the same document, sort order is unspecified.
  37570. *
  37571. * @param nodes Array of DOM nodes.
  37572. * @returns Collection of unique nodes, sorted in document order.
  37573. */
  37574. function uniqueSort(nodes) {
  37575. nodes = nodes.filter(function (node, i, arr) {
  37576. return !arr.includes(node, i + 1);
  37577. });
  37578. nodes.sort(function (a, b) {
  37579. var relative = compareDocumentPosition(a, b);
  37580. if (relative & 2 /* PRECEDING */) {
  37581. return -1;
  37582. } else if (relative & 4 /* FOLLOWING */) {
  37583. return 1;
  37584. }
  37585. return 0;
  37586. });
  37587. return nodes;
  37588. }
  37589. exports.uniqueSort = uniqueSort;
  37590. /***/ }),
  37591. /***/ 5511:
  37592. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  37593. var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
  37594. if (k2 === undefined) k2 = k;
  37595. Object.defineProperty(o, k2, {
  37596. enumerable: true,
  37597. get: function get() {
  37598. return m[k];
  37599. }
  37600. });
  37601. } : function (o, m, k, k2) {
  37602. if (k2 === undefined) k2 = k;
  37603. o[k2] = m[k];
  37604. });
  37605. var __exportStar = this && this.__exportStar || function (m, exports) {
  37606. for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
  37607. };
  37608. Object.defineProperty(exports, "__esModule", ({
  37609. value: true
  37610. }));
  37611. exports.hasChildren = exports.isDocument = exports.isComment = exports.isText = exports.isCDATA = exports.isTag = void 0;
  37612. __exportStar(__webpack_require__(3633), exports);
  37613. __exportStar(__webpack_require__(6530), exports);
  37614. __exportStar(__webpack_require__(1833), exports);
  37615. __exportStar(__webpack_require__(7062), exports);
  37616. __exportStar(__webpack_require__(7344), exports);
  37617. __exportStar(__webpack_require__(3757), exports);
  37618. __exportStar(__webpack_require__(3625), exports);
  37619. /** @deprecated Use these methods from `domhandler` directly. */
  37620. var domhandler_1 = __webpack_require__(1363);
  37621. Object.defineProperty(exports, "isTag", ({
  37622. enumerable: true,
  37623. get: function get() {
  37624. return domhandler_1.isTag;
  37625. }
  37626. }));
  37627. Object.defineProperty(exports, "isCDATA", ({
  37628. enumerable: true,
  37629. get: function get() {
  37630. return domhandler_1.isCDATA;
  37631. }
  37632. }));
  37633. Object.defineProperty(exports, "isText", ({
  37634. enumerable: true,
  37635. get: function get() {
  37636. return domhandler_1.isText;
  37637. }
  37638. }));
  37639. Object.defineProperty(exports, "isComment", ({
  37640. enumerable: true,
  37641. get: function get() {
  37642. return domhandler_1.isComment;
  37643. }
  37644. }));
  37645. Object.defineProperty(exports, "isDocument", ({
  37646. enumerable: true,
  37647. get: function get() {
  37648. return domhandler_1.isDocument;
  37649. }
  37650. }));
  37651. Object.defineProperty(exports, "hasChildren", ({
  37652. enumerable: true,
  37653. get: function get() {
  37654. return domhandler_1.hasChildren;
  37655. }
  37656. }));
  37657. /***/ }),
  37658. /***/ 7344:
  37659. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  37660. Object.defineProperty(exports, "__esModule", ({
  37661. value: true
  37662. }));
  37663. exports.getElementsByTagType = exports.getElementsByTagName = exports.getElementById = exports.getElements = exports.testElement = void 0;
  37664. var domhandler_1 = __webpack_require__(1363);
  37665. var querying_1 = __webpack_require__(7062);
  37666. var Checks = {
  37667. tag_name: function tag_name(name) {
  37668. if (typeof name === "function") {
  37669. return function (elem) {
  37670. return (0, domhandler_1.isTag)(elem) && name(elem.name);
  37671. };
  37672. } else if (name === "*") {
  37673. return domhandler_1.isTag;
  37674. }
  37675. return function (elem) {
  37676. return (0, domhandler_1.isTag)(elem) && elem.name === name;
  37677. };
  37678. },
  37679. tag_type: function tag_type(type) {
  37680. if (typeof type === "function") {
  37681. return function (elem) {
  37682. return type(elem.type);
  37683. };
  37684. }
  37685. return function (elem) {
  37686. return elem.type === type;
  37687. };
  37688. },
  37689. tag_contains: function tag_contains(data) {
  37690. if (typeof data === "function") {
  37691. return function (elem) {
  37692. return (0, domhandler_1.isText)(elem) && data(elem.data);
  37693. };
  37694. }
  37695. return function (elem) {
  37696. return (0, domhandler_1.isText)(elem) && elem.data === data;
  37697. };
  37698. }
  37699. };
  37700. /**
  37701. * @param attrib Attribute to check.
  37702. * @param value Attribute value to look for.
  37703. * @returns A function to check whether the a node has an attribute with a particular value.
  37704. */
  37705. function getAttribCheck(attrib, value) {
  37706. if (typeof value === "function") {
  37707. return function (elem) {
  37708. return (0, domhandler_1.isTag)(elem) && value(elem.attribs[attrib]);
  37709. };
  37710. }
  37711. return function (elem) {
  37712. return (0, domhandler_1.isTag)(elem) && elem.attribs[attrib] === value;
  37713. };
  37714. }
  37715. /**
  37716. * @param a First function to combine.
  37717. * @param b Second function to combine.
  37718. * @returns A function taking a node and returning `true` if either
  37719. * of the input functions returns `true` for the node.
  37720. */
  37721. function combineFuncs(a, b) {
  37722. return function (elem) {
  37723. return a(elem) || b(elem);
  37724. };
  37725. }
  37726. /**
  37727. * @param options An object describing nodes to look for.
  37728. * @returns A function executing all checks in `options` and returning `true`
  37729. * if any of them match a node.
  37730. */
  37731. function compileTest(options) {
  37732. var funcs = Object.keys(options).map(function (key) {
  37733. var value = options[key];
  37734. return Object.prototype.hasOwnProperty.call(Checks, key) ? Checks[key](value) : getAttribCheck(key, value);
  37735. });
  37736. return funcs.length === 0 ? null : funcs.reduce(combineFuncs);
  37737. }
  37738. /**
  37739. * @param options An object describing nodes to look for.
  37740. * @param node The element to test.
  37741. * @returns Whether the element matches the description in `options`.
  37742. */
  37743. function testElement(options, node) {
  37744. var test = compileTest(options);
  37745. return test ? test(node) : true;
  37746. }
  37747. exports.testElement = testElement;
  37748. /**
  37749. * @param options An object describing nodes to look for.
  37750. * @param nodes Nodes to search through.
  37751. * @param recurse Also consider child nodes.
  37752. * @param limit Maximum number of nodes to return.
  37753. * @returns All nodes that match `options`.
  37754. */
  37755. function getElements(options, nodes, recurse, limit) {
  37756. if (limit === void 0) {
  37757. limit = Infinity;
  37758. }
  37759. var test = compileTest(options);
  37760. return test ? (0, querying_1.filter)(test, nodes, recurse, limit) : [];
  37761. }
  37762. exports.getElements = getElements;
  37763. /**
  37764. * @param id The unique ID attribute value to look for.
  37765. * @param nodes Nodes to search through.
  37766. * @param recurse Also consider child nodes.
  37767. * @returns The node with the supplied ID.
  37768. */
  37769. function getElementById(id, nodes, recurse) {
  37770. if (recurse === void 0) {
  37771. recurse = true;
  37772. }
  37773. if (!Array.isArray(nodes)) nodes = [nodes];
  37774. return (0, querying_1.findOne)(getAttribCheck("id", id), nodes, recurse);
  37775. }
  37776. exports.getElementById = getElementById;
  37777. /**
  37778. * @param tagName Tag name to search for.
  37779. * @param nodes Nodes to search through.
  37780. * @param recurse Also consider child nodes.
  37781. * @param limit Maximum number of nodes to return.
  37782. * @returns All nodes with the supplied `tagName`.
  37783. */
  37784. function getElementsByTagName(tagName, nodes, recurse, limit) {
  37785. if (recurse === void 0) {
  37786. recurse = true;
  37787. }
  37788. if (limit === void 0) {
  37789. limit = Infinity;
  37790. }
  37791. return (0, querying_1.filter)(Checks.tag_name(tagName), nodes, recurse, limit);
  37792. }
  37793. exports.getElementsByTagName = getElementsByTagName;
  37794. /**
  37795. * @param type Element type to look for.
  37796. * @param nodes Nodes to search through.
  37797. * @param recurse Also consider child nodes.
  37798. * @param limit Maximum number of nodes to return.
  37799. * @returns All nodes with the supplied `type`.
  37800. */
  37801. function getElementsByTagType(type, nodes, recurse, limit) {
  37802. if (recurse === void 0) {
  37803. recurse = true;
  37804. }
  37805. if (limit === void 0) {
  37806. limit = Infinity;
  37807. }
  37808. return (0, querying_1.filter)(Checks.tag_type(type), nodes, recurse, limit);
  37809. }
  37810. exports.getElementsByTagType = getElementsByTagType;
  37811. /***/ }),
  37812. /***/ 1833:
  37813. /***/ ((__unused_webpack_module, exports) => {
  37814. Object.defineProperty(exports, "__esModule", ({
  37815. value: true
  37816. }));
  37817. exports.prepend = exports.prependChild = exports.append = exports.appendChild = exports.replaceElement = exports.removeElement = void 0;
  37818. /**
  37819. * Remove an element from the dom
  37820. *
  37821. * @param elem The element to be removed
  37822. */
  37823. function removeElement(elem) {
  37824. if (elem.prev) elem.prev.next = elem.next;
  37825. if (elem.next) elem.next.prev = elem.prev;
  37826. if (elem.parent) {
  37827. var childs = elem.parent.children;
  37828. childs.splice(childs.lastIndexOf(elem), 1);
  37829. }
  37830. }
  37831. exports.removeElement = removeElement;
  37832. /**
  37833. * Replace an element in the dom
  37834. *
  37835. * @param elem The element to be replaced
  37836. * @param replacement The element to be added
  37837. */
  37838. function replaceElement(elem, replacement) {
  37839. var prev = replacement.prev = elem.prev;
  37840. if (prev) {
  37841. prev.next = replacement;
  37842. }
  37843. var next = replacement.next = elem.next;
  37844. if (next) {
  37845. next.prev = replacement;
  37846. }
  37847. var parent = replacement.parent = elem.parent;
  37848. if (parent) {
  37849. var childs = parent.children;
  37850. childs[childs.lastIndexOf(elem)] = replacement;
  37851. }
  37852. }
  37853. exports.replaceElement = replaceElement;
  37854. /**
  37855. * Append a child to an element.
  37856. *
  37857. * @param elem The element to append to.
  37858. * @param child The element to be added as a child.
  37859. */
  37860. function appendChild(elem, child) {
  37861. removeElement(child);
  37862. child.next = null;
  37863. child.parent = elem;
  37864. if (elem.children.push(child) > 1) {
  37865. var sibling = elem.children[elem.children.length - 2];
  37866. sibling.next = child;
  37867. child.prev = sibling;
  37868. } else {
  37869. child.prev = null;
  37870. }
  37871. }
  37872. exports.appendChild = appendChild;
  37873. /**
  37874. * Append an element after another.
  37875. *
  37876. * @param elem The element to append after.
  37877. * @param next The element be added.
  37878. */
  37879. function append(elem, next) {
  37880. removeElement(next);
  37881. var parent = elem.parent;
  37882. var currNext = elem.next;
  37883. next.next = currNext;
  37884. next.prev = elem;
  37885. elem.next = next;
  37886. next.parent = parent;
  37887. if (currNext) {
  37888. currNext.prev = next;
  37889. if (parent) {
  37890. var childs = parent.children;
  37891. childs.splice(childs.lastIndexOf(currNext), 0, next);
  37892. }
  37893. } else if (parent) {
  37894. parent.children.push(next);
  37895. }
  37896. }
  37897. exports.append = append;
  37898. /**
  37899. * Prepend a child to an element.
  37900. *
  37901. * @param elem The element to prepend before.
  37902. * @param child The element to be added as a child.
  37903. */
  37904. function prependChild(elem, child) {
  37905. removeElement(child);
  37906. child.parent = elem;
  37907. child.prev = null;
  37908. if (elem.children.unshift(child) !== 1) {
  37909. var sibling = elem.children[1];
  37910. sibling.prev = child;
  37911. child.next = sibling;
  37912. } else {
  37913. child.next = null;
  37914. }
  37915. }
  37916. exports.prependChild = prependChild;
  37917. /**
  37918. * Prepend an element before another.
  37919. *
  37920. * @param elem The element to prepend before.
  37921. * @param prev The element be added.
  37922. */
  37923. function prepend(elem, prev) {
  37924. removeElement(prev);
  37925. var parent = elem.parent;
  37926. if (parent) {
  37927. var childs = parent.children;
  37928. childs.splice(childs.indexOf(elem), 0, prev);
  37929. }
  37930. if (elem.prev) {
  37931. elem.prev.next = prev;
  37932. }
  37933. prev.parent = parent;
  37934. prev.prev = elem.prev;
  37935. prev.next = elem;
  37936. elem.prev = prev;
  37937. }
  37938. exports.prepend = prepend;
  37939. /***/ }),
  37940. /***/ 7062:
  37941. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  37942. Object.defineProperty(exports, "__esModule", ({
  37943. value: true
  37944. }));
  37945. exports.findAll = exports.existsOne = exports.findOne = exports.findOneChild = exports.find = exports.filter = void 0;
  37946. var domhandler_1 = __webpack_require__(1363);
  37947. /**
  37948. * Search a node and its children for nodes passing a test function.
  37949. *
  37950. * @param test Function to test nodes on.
  37951. * @param node Node to search. Will be included in the result set if it matches.
  37952. * @param recurse Also consider child nodes.
  37953. * @param limit Maximum number of nodes to return.
  37954. * @returns All nodes passing `test`.
  37955. */
  37956. function filter(test, node, recurse, limit) {
  37957. if (recurse === void 0) {
  37958. recurse = true;
  37959. }
  37960. if (limit === void 0) {
  37961. limit = Infinity;
  37962. }
  37963. if (!Array.isArray(node)) node = [node];
  37964. return find(test, node, recurse, limit);
  37965. }
  37966. exports.filter = filter;
  37967. /**
  37968. * Search an array of node and its children for nodes passing a test function.
  37969. *
  37970. * @param test Function to test nodes on.
  37971. * @param nodes Array of nodes to search.
  37972. * @param recurse Also consider child nodes.
  37973. * @param limit Maximum number of nodes to return.
  37974. * @returns All nodes passing `test`.
  37975. */
  37976. function find(test, nodes, recurse, limit) {
  37977. var result = [];
  37978. for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
  37979. var elem = nodes_1[_i];
  37980. if (test(elem)) {
  37981. result.push(elem);
  37982. if (--limit <= 0) break;
  37983. }
  37984. if (recurse && (0, domhandler_1.hasChildren)(elem) && elem.children.length > 0) {
  37985. var children = find(test, elem.children, recurse, limit);
  37986. result.push.apply(result, children);
  37987. limit -= children.length;
  37988. if (limit <= 0) break;
  37989. }
  37990. }
  37991. return result;
  37992. }
  37993. exports.find = find;
  37994. /**
  37995. * Finds the first element inside of an array that matches a test function.
  37996. *
  37997. * @param test Function to test nodes on.
  37998. * @param nodes Array of nodes to search.
  37999. * @returns The first node in the array that passes `test`.
  38000. */
  38001. function findOneChild(test, nodes) {
  38002. return nodes.find(test);
  38003. }
  38004. exports.findOneChild = findOneChild;
  38005. /**
  38006. * Finds one element in a tree that passes a test.
  38007. *
  38008. * @param test Function to test nodes on.
  38009. * @param nodes Array of nodes to search.
  38010. * @param recurse Also consider child nodes.
  38011. * @returns The first child node that passes `test`.
  38012. */
  38013. function findOne(test, nodes, recurse) {
  38014. if (recurse === void 0) {
  38015. recurse = true;
  38016. }
  38017. var elem = null;
  38018. for (var i = 0; i < nodes.length && !elem; i++) {
  38019. var checked = nodes[i];
  38020. if (!(0, domhandler_1.isTag)(checked)) {
  38021. continue;
  38022. } else if (test(checked)) {
  38023. elem = checked;
  38024. } else if (recurse && checked.children.length > 0) {
  38025. elem = findOne(test, checked.children);
  38026. }
  38027. }
  38028. return elem;
  38029. }
  38030. exports.findOne = findOne;
  38031. /**
  38032. * @param test Function to test nodes on.
  38033. * @param nodes Array of nodes to search.
  38034. * @returns Whether a tree of nodes contains at least one node passing a test.
  38035. */
  38036. function existsOne(test, nodes) {
  38037. return nodes.some(function (checked) {
  38038. return (0, domhandler_1.isTag)(checked) && (test(checked) || checked.children.length > 0 && existsOne(test, checked.children));
  38039. });
  38040. }
  38041. exports.existsOne = existsOne;
  38042. /**
  38043. * Search and array of nodes and its children for nodes passing a test function.
  38044. *
  38045. * Same as `find`, only with less options, leading to reduced complexity.
  38046. *
  38047. * @param test Function to test nodes on.
  38048. * @param nodes Array of nodes to search.
  38049. * @returns All nodes passing `test`.
  38050. */
  38051. function findAll(test, nodes) {
  38052. var _a;
  38053. var result = [];
  38054. var stack = nodes.filter(domhandler_1.isTag);
  38055. var elem;
  38056. while (elem = stack.shift()) {
  38057. var children = (_a = elem.children) === null || _a === void 0 ? void 0 : _a.filter(domhandler_1.isTag);
  38058. if (children && children.length > 0) {
  38059. stack.unshift.apply(stack, children);
  38060. }
  38061. if (test(elem)) result.push(elem);
  38062. }
  38063. return result;
  38064. }
  38065. exports.findAll = findAll;
  38066. /***/ }),
  38067. /***/ 3633:
  38068. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  38069. var __importDefault = this && this.__importDefault || function (mod) {
  38070. return mod && mod.__esModule ? mod : {
  38071. "default": mod
  38072. };
  38073. };
  38074. Object.defineProperty(exports, "__esModule", ({
  38075. value: true
  38076. }));
  38077. exports.innerText = exports.textContent = exports.getText = exports.getInnerHTML = exports.getOuterHTML = void 0;
  38078. var domhandler_1 = __webpack_require__(1363);
  38079. var dom_serializer_1 = __importDefault(__webpack_require__(1671));
  38080. var domelementtype_1 = __webpack_require__(7304);
  38081. /**
  38082. * @param node Node to get the outer HTML of.
  38083. * @param options Options for serialization.
  38084. * @deprecated Use the `dom-serializer` module directly.
  38085. * @returns `node`'s outer HTML.
  38086. */
  38087. function getOuterHTML(node, options) {
  38088. return (0, dom_serializer_1["default"])(node, options);
  38089. }
  38090. exports.getOuterHTML = getOuterHTML;
  38091. /**
  38092. * @param node Node to get the inner HTML of.
  38093. * @param options Options for serialization.
  38094. * @deprecated Use the `dom-serializer` module directly.
  38095. * @returns `node`'s inner HTML.
  38096. */
  38097. function getInnerHTML(node, options) {
  38098. return (0, domhandler_1.hasChildren)(node) ? node.children.map(function (node) {
  38099. return getOuterHTML(node, options);
  38100. }).join("") : "";
  38101. }
  38102. exports.getInnerHTML = getInnerHTML;
  38103. /**
  38104. * Get a node's inner text. Same as `textContent`, but inserts newlines for `<br>` tags.
  38105. *
  38106. * @deprecated Use `textContent` instead.
  38107. * @param node Node to get the inner text of.
  38108. * @returns `node`'s inner text.
  38109. */
  38110. function getText(node) {
  38111. if (Array.isArray(node)) return node.map(getText).join("");
  38112. if ((0, domhandler_1.isTag)(node)) return node.name === "br" ? "\n" : getText(node.children);
  38113. if ((0, domhandler_1.isCDATA)(node)) return getText(node.children);
  38114. if ((0, domhandler_1.isText)(node)) return node.data;
  38115. return "";
  38116. }
  38117. exports.getText = getText;
  38118. /**
  38119. * Get a node's text content.
  38120. *
  38121. * @param node Node to get the text content of.
  38122. * @returns `node`'s text content.
  38123. * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent}
  38124. */
  38125. function textContent(node) {
  38126. if (Array.isArray(node)) return node.map(textContent).join("");
  38127. if ((0, domhandler_1.hasChildren)(node) && !(0, domhandler_1.isComment)(node)) {
  38128. return textContent(node.children);
  38129. }
  38130. if ((0, domhandler_1.isText)(node)) return node.data;
  38131. return "";
  38132. }
  38133. exports.textContent = textContent;
  38134. /**
  38135. * Get a node's inner text.
  38136. *
  38137. * @param node Node to get the inner text of.
  38138. * @returns `node`'s inner text.
  38139. * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/innerText}
  38140. */
  38141. function innerText(node) {
  38142. if (Array.isArray(node)) return node.map(innerText).join("");
  38143. if ((0, domhandler_1.hasChildren)(node) && (node.type === domelementtype_1.ElementType.Tag || (0, domhandler_1.isCDATA)(node))) {
  38144. return innerText(node.children);
  38145. }
  38146. if ((0, domhandler_1.isText)(node)) return node.data;
  38147. return "";
  38148. }
  38149. exports.innerText = innerText;
  38150. /***/ }),
  38151. /***/ 6530:
  38152. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  38153. Object.defineProperty(exports, "__esModule", ({
  38154. value: true
  38155. }));
  38156. exports.prevElementSibling = exports.nextElementSibling = exports.getName = exports.hasAttrib = exports.getAttributeValue = exports.getSiblings = exports.getParent = exports.getChildren = void 0;
  38157. var domhandler_1 = __webpack_require__(1363);
  38158. var emptyArray = [];
  38159. /**
  38160. * Get a node's children.
  38161. *
  38162. * @param elem Node to get the children of.
  38163. * @returns `elem`'s children, or an empty array.
  38164. */
  38165. function getChildren(elem) {
  38166. var _a;
  38167. return (_a = elem.children) !== null && _a !== void 0 ? _a : emptyArray;
  38168. }
  38169. exports.getChildren = getChildren;
  38170. /**
  38171. * Get a node's parent.
  38172. *
  38173. * @param elem Node to get the parent of.
  38174. * @returns `elem`'s parent node.
  38175. */
  38176. function getParent(elem) {
  38177. return elem.parent || null;
  38178. }
  38179. exports.getParent = getParent;
  38180. /**
  38181. * Gets an elements siblings, including the element itself.
  38182. *
  38183. * Attempts to get the children through the element's parent first.
  38184. * If we don't have a parent (the element is a root node),
  38185. * we walk the element's `prev` & `next` to get all remaining nodes.
  38186. *
  38187. * @param elem Element to get the siblings of.
  38188. * @returns `elem`'s siblings.
  38189. */
  38190. function getSiblings(elem) {
  38191. var _a, _b;
  38192. var parent = getParent(elem);
  38193. if (parent != null) return getChildren(parent);
  38194. var siblings = [elem];
  38195. var prev = elem.prev,
  38196. next = elem.next;
  38197. while (prev != null) {
  38198. siblings.unshift(prev);
  38199. _a = prev, prev = _a.prev;
  38200. }
  38201. while (next != null) {
  38202. siblings.push(next);
  38203. _b = next, next = _b.next;
  38204. }
  38205. return siblings;
  38206. }
  38207. exports.getSiblings = getSiblings;
  38208. /**
  38209. * Gets an attribute from an element.
  38210. *
  38211. * @param elem Element to check.
  38212. * @param name Attribute name to retrieve.
  38213. * @returns The element's attribute value, or `undefined`.
  38214. */
  38215. function getAttributeValue(elem, name) {
  38216. var _a;
  38217. return (_a = elem.attribs) === null || _a === void 0 ? void 0 : _a[name];
  38218. }
  38219. exports.getAttributeValue = getAttributeValue;
  38220. /**
  38221. * Checks whether an element has an attribute.
  38222. *
  38223. * @param elem Element to check.
  38224. * @param name Attribute name to look for.
  38225. * @returns Returns whether `elem` has the attribute `name`.
  38226. */
  38227. function hasAttrib(elem, name) {
  38228. return elem.attribs != null && Object.prototype.hasOwnProperty.call(elem.attribs, name) && elem.attribs[name] != null;
  38229. }
  38230. exports.hasAttrib = hasAttrib;
  38231. /**
  38232. * Get the tag name of an element.
  38233. *
  38234. * @param elem The element to get the name for.
  38235. * @returns The tag name of `elem`.
  38236. */
  38237. function getName(elem) {
  38238. return elem.name;
  38239. }
  38240. exports.getName = getName;
  38241. /**
  38242. * Returns the next element sibling of a node.
  38243. *
  38244. * @param elem The element to get the next sibling of.
  38245. * @returns `elem`'s next sibling that is a tag.
  38246. */
  38247. function nextElementSibling(elem) {
  38248. var _a;
  38249. var next = elem.next;
  38250. while (next !== null && !(0, domhandler_1.isTag)(next)) _a = next, next = _a.next;
  38251. return next;
  38252. }
  38253. exports.nextElementSibling = nextElementSibling;
  38254. /**
  38255. * Returns the previous element sibling of a node.
  38256. *
  38257. * @param elem The element to get the previous sibling of.
  38258. * @returns `elem`'s previous sibling that is a tag.
  38259. */
  38260. function prevElementSibling(elem) {
  38261. var _a;
  38262. var prev = elem.prev;
  38263. while (prev !== null && !(0, domhandler_1.isTag)(prev)) _a = prev, prev = _a.prev;
  38264. return prev;
  38265. }
  38266. exports.prevElementSibling = prevElementSibling;
  38267. /***/ }),
  38268. /***/ 6347:
  38269. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  38270. var __importDefault = this && this.__importDefault || function (mod) {
  38271. return mod && mod.__esModule ? mod : {
  38272. "default": mod
  38273. };
  38274. };
  38275. Object.defineProperty(exports, "__esModule", ({
  38276. value: true
  38277. }));
  38278. exports.decodeHTML = exports.decodeHTMLStrict = exports.decodeXML = void 0;
  38279. var entities_json_1 = __importDefault(__webpack_require__(9323));
  38280. var legacy_json_1 = __importDefault(__webpack_require__(9591));
  38281. var xml_json_1 = __importDefault(__webpack_require__(2586));
  38282. var decode_codepoint_1 = __importDefault(__webpack_require__(8271));
  38283. var strictEntityRe = /&(?:[a-zA-Z0-9]+|#[xX][\da-fA-F]+|#\d+);/g;
  38284. exports.decodeXML = getStrictDecoder(xml_json_1["default"]);
  38285. exports.decodeHTMLStrict = getStrictDecoder(entities_json_1["default"]);
  38286. function getStrictDecoder(map) {
  38287. var replace = getReplacer(map);
  38288. return function (str) {
  38289. return String(str).replace(strictEntityRe, replace);
  38290. };
  38291. }
  38292. var sorter = function sorter(a, b) {
  38293. return a < b ? 1 : -1;
  38294. };
  38295. exports.decodeHTML = function () {
  38296. var legacy = Object.keys(legacy_json_1["default"]).sort(sorter);
  38297. var keys = Object.keys(entities_json_1["default"]).sort(sorter);
  38298. for (var i = 0, j = 0; i < keys.length; i++) {
  38299. if (legacy[j] === keys[i]) {
  38300. keys[i] += ";?";
  38301. j++;
  38302. } else {
  38303. keys[i] += ";";
  38304. }
  38305. }
  38306. var re = new RegExp("&(?:" + keys.join("|") + "|#[xX][\\da-fA-F]+;?|#\\d+;?)", "g");
  38307. var replace = getReplacer(entities_json_1["default"]);
  38308. function replacer(str) {
  38309. if (str.substr(-1) !== ";") str += ";";
  38310. return replace(str);
  38311. }
  38312. // TODO consider creating a merged map
  38313. return function (str) {
  38314. return String(str).replace(re, replacer);
  38315. };
  38316. }();
  38317. function getReplacer(map) {
  38318. return function replace(str) {
  38319. if (str.charAt(1) === "#") {
  38320. var secondChar = str.charAt(2);
  38321. if (secondChar === "X" || secondChar === "x") {
  38322. return decode_codepoint_1["default"](parseInt(str.substr(3), 16));
  38323. }
  38324. return decode_codepoint_1["default"](parseInt(str.substr(2), 10));
  38325. }
  38326. // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
  38327. return map[str.slice(1, -1)] || str;
  38328. };
  38329. }
  38330. /***/ }),
  38331. /***/ 8271:
  38332. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  38333. var __importDefault = this && this.__importDefault || function (mod) {
  38334. return mod && mod.__esModule ? mod : {
  38335. "default": mod
  38336. };
  38337. };
  38338. Object.defineProperty(exports, "__esModule", ({
  38339. value: true
  38340. }));
  38341. var decode_json_1 = __importDefault(__webpack_require__(3600));
  38342. // Adapted from https://github.com/mathiasbynens/he/blob/master/src/he.js#L94-L119
  38343. var fromCodePoint =
  38344. // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
  38345. String.fromCodePoint || function (codePoint) {
  38346. var output = "";
  38347. if (codePoint > 0xffff) {
  38348. codePoint -= 0x10000;
  38349. output += String.fromCharCode(codePoint >>> 10 & 0x3ff | 0xd800);
  38350. codePoint = 0xdc00 | codePoint & 0x3ff;
  38351. }
  38352. output += String.fromCharCode(codePoint);
  38353. return output;
  38354. };
  38355. function decodeCodePoint(codePoint) {
  38356. if (codePoint >= 0xd800 && codePoint <= 0xdfff || codePoint > 0x10ffff) {
  38357. return "\uFFFD";
  38358. }
  38359. if (codePoint in decode_json_1["default"]) {
  38360. codePoint = decode_json_1["default"][codePoint];
  38361. }
  38362. return fromCodePoint(codePoint);
  38363. }
  38364. exports["default"] = decodeCodePoint;
  38365. /***/ }),
  38366. /***/ 3393:
  38367. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  38368. var __importDefault = this && this.__importDefault || function (mod) {
  38369. return mod && mod.__esModule ? mod : {
  38370. "default": mod
  38371. };
  38372. };
  38373. Object.defineProperty(exports, "__esModule", ({
  38374. value: true
  38375. }));
  38376. exports.escapeUTF8 = exports.escape = exports.encodeNonAsciiHTML = exports.encodeHTML = exports.encodeXML = void 0;
  38377. var xml_json_1 = __importDefault(__webpack_require__(2586));
  38378. var inverseXML = getInverseObj(xml_json_1["default"]);
  38379. var xmlReplacer = getInverseReplacer(inverseXML);
  38380. /**
  38381. * Encodes all non-ASCII characters, as well as characters not valid in XML
  38382. * documents using XML entities.
  38383. *
  38384. * If a character has no equivalent entity, a
  38385. * numeric hexadecimal reference (eg. `&#xfc;`) will be used.
  38386. */
  38387. exports.encodeXML = getASCIIEncoder(inverseXML);
  38388. var entities_json_1 = __importDefault(__webpack_require__(9323));
  38389. var inverseHTML = getInverseObj(entities_json_1["default"]);
  38390. var htmlReplacer = getInverseReplacer(inverseHTML);
  38391. /**
  38392. * Encodes all entities and non-ASCII characters in the input.
  38393. *
  38394. * This includes characters that are valid ASCII characters in HTML documents.
  38395. * For example `#` will be encoded as `&num;`. To get a more compact output,
  38396. * consider using the `encodeNonAsciiHTML` function.
  38397. *
  38398. * If a character has no equivalent entity, a
  38399. * numeric hexadecimal reference (eg. `&#xfc;`) will be used.
  38400. */
  38401. exports.encodeHTML = getInverse(inverseHTML, htmlReplacer);
  38402. /**
  38403. * Encodes all non-ASCII characters, as well as characters not valid in HTML
  38404. * documents using HTML entities.
  38405. *
  38406. * If a character has no equivalent entity, a
  38407. * numeric hexadecimal reference (eg. `&#xfc;`) will be used.
  38408. */
  38409. exports.encodeNonAsciiHTML = getASCIIEncoder(inverseHTML);
  38410. function getInverseObj(obj) {
  38411. return Object.keys(obj).sort().reduce(function (inverse, name) {
  38412. inverse[obj[name]] = "&" + name + ";";
  38413. return inverse;
  38414. }, {});
  38415. }
  38416. function getInverseReplacer(inverse) {
  38417. var single = [];
  38418. var multiple = [];
  38419. for (var _i = 0, _a = Object.keys(inverse); _i < _a.length; _i++) {
  38420. var k = _a[_i];
  38421. if (k.length === 1) {
  38422. // Add value to single array
  38423. single.push("\\" + k);
  38424. } else {
  38425. // Add value to multiple array
  38426. multiple.push(k);
  38427. }
  38428. }
  38429. // Add ranges to single characters.
  38430. single.sort();
  38431. for (var start = 0; start < single.length - 1; start++) {
  38432. // Find the end of a run of characters
  38433. var end = start;
  38434. while (end < single.length - 1 && single[end].charCodeAt(1) + 1 === single[end + 1].charCodeAt(1)) {
  38435. end += 1;
  38436. }
  38437. var count = 1 + end - start;
  38438. // We want to replace at least three characters
  38439. if (count < 3) continue;
  38440. single.splice(start, count, single[start] + "-" + single[end]);
  38441. }
  38442. multiple.unshift("[" + single.join("") + "]");
  38443. return new RegExp(multiple.join("|"), "g");
  38444. }
  38445. // /[^\0-\x7F]/gu
  38446. var reNonASCII = /(?:[\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g;
  38447. var getCodePoint =
  38448. // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
  38449. String.prototype.codePointAt != null ?
  38450. // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
  38451. function (str) {
  38452. return str.codePointAt(0);
  38453. } :
  38454. // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  38455. function (c) {
  38456. return (c.charCodeAt(0) - 0xd800) * 0x400 + c.charCodeAt(1) - 0xdc00 + 0x10000;
  38457. };
  38458. function singleCharReplacer(c) {
  38459. return "&#x" + (c.length > 1 ? getCodePoint(c) : c.charCodeAt(0)).toString(16).toUpperCase() + ";";
  38460. }
  38461. function getInverse(inverse, re) {
  38462. return function (data) {
  38463. return data.replace(re, function (name) {
  38464. return inverse[name];
  38465. }).replace(reNonASCII, singleCharReplacer);
  38466. };
  38467. }
  38468. var reEscapeChars = new RegExp(xmlReplacer.source + "|" + reNonASCII.source, "g");
  38469. /**
  38470. * Encodes all non-ASCII characters, as well as characters not valid in XML
  38471. * documents using numeric hexadecimal reference (eg. `&#xfc;`).
  38472. *
  38473. * Have a look at `escapeUTF8` if you want a more concise output at the expense
  38474. * of reduced transportability.
  38475. *
  38476. * @param data String to escape.
  38477. */
  38478. function escape(data) {
  38479. return data.replace(reEscapeChars, singleCharReplacer);
  38480. }
  38481. exports.escape = escape;
  38482. /**
  38483. * Encodes all characters not valid in XML documents using numeric hexadecimal
  38484. * reference (eg. `&#xfc;`).
  38485. *
  38486. * Note that the output will be character-set dependent.
  38487. *
  38488. * @param data String to escape.
  38489. */
  38490. function escapeUTF8(data) {
  38491. return data.replace(xmlReplacer, singleCharReplacer);
  38492. }
  38493. exports.escapeUTF8 = escapeUTF8;
  38494. function getASCIIEncoder(obj) {
  38495. return function (data) {
  38496. return data.replace(reEscapeChars, function (c) {
  38497. return obj[c] || singleCharReplacer(c);
  38498. });
  38499. };
  38500. }
  38501. /***/ }),
  38502. /***/ 7531:
  38503. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  38504. Object.defineProperty(exports, "__esModule", ({
  38505. value: true
  38506. }));
  38507. exports.decodeXMLStrict = exports.decodeHTML5Strict = exports.decodeHTML4Strict = exports.decodeHTML5 = exports.decodeHTML4 = exports.decodeHTMLStrict = exports.decodeHTML = exports.decodeXML = exports.encodeHTML5 = exports.encodeHTML4 = exports.escapeUTF8 = exports.escape = exports.encodeNonAsciiHTML = exports.encodeHTML = exports.encodeXML = exports.encode = exports.decodeStrict = exports.decode = void 0;
  38508. var decode_1 = __webpack_require__(6347);
  38509. var encode_1 = __webpack_require__(3393);
  38510. /**
  38511. * Decodes a string with entities.
  38512. *
  38513. * @param data String to decode.
  38514. * @param level Optional level to decode at. 0 = XML, 1 = HTML. Default is 0.
  38515. * @deprecated Use `decodeXML` or `decodeHTML` directly.
  38516. */
  38517. function decode(data, level) {
  38518. return (!level || level <= 0 ? decode_1.decodeXML : decode_1.decodeHTML)(data);
  38519. }
  38520. exports.decode = decode;
  38521. /**
  38522. * Decodes a string with entities. Does not allow missing trailing semicolons for entities.
  38523. *
  38524. * @param data String to decode.
  38525. * @param level Optional level to decode at. 0 = XML, 1 = HTML. Default is 0.
  38526. * @deprecated Use `decodeHTMLStrict` or `decodeXML` directly.
  38527. */
  38528. function decodeStrict(data, level) {
  38529. return (!level || level <= 0 ? decode_1.decodeXML : decode_1.decodeHTMLStrict)(data);
  38530. }
  38531. exports.decodeStrict = decodeStrict;
  38532. /**
  38533. * Encodes a string with entities.
  38534. *
  38535. * @param data String to encode.
  38536. * @param level Optional level to encode at. 0 = XML, 1 = HTML. Default is 0.
  38537. * @deprecated Use `encodeHTML`, `encodeXML` or `encodeNonAsciiHTML` directly.
  38538. */
  38539. function encode(data, level) {
  38540. return (!level || level <= 0 ? encode_1.encodeXML : encode_1.encodeHTML)(data);
  38541. }
  38542. exports.encode = encode;
  38543. var encode_2 = __webpack_require__(3393);
  38544. Object.defineProperty(exports, "encodeXML", ({
  38545. enumerable: true,
  38546. get: function get() {
  38547. return encode_2.encodeXML;
  38548. }
  38549. }));
  38550. Object.defineProperty(exports, "encodeHTML", ({
  38551. enumerable: true,
  38552. get: function get() {
  38553. return encode_2.encodeHTML;
  38554. }
  38555. }));
  38556. Object.defineProperty(exports, "encodeNonAsciiHTML", ({
  38557. enumerable: true,
  38558. get: function get() {
  38559. return encode_2.encodeNonAsciiHTML;
  38560. }
  38561. }));
  38562. Object.defineProperty(exports, "escape", ({
  38563. enumerable: true,
  38564. get: function get() {
  38565. return encode_2.escape;
  38566. }
  38567. }));
  38568. Object.defineProperty(exports, "escapeUTF8", ({
  38569. enumerable: true,
  38570. get: function get() {
  38571. return encode_2.escapeUTF8;
  38572. }
  38573. }));
  38574. // Legacy aliases (deprecated)
  38575. Object.defineProperty(exports, "encodeHTML4", ({
  38576. enumerable: true,
  38577. get: function get() {
  38578. return encode_2.encodeHTML;
  38579. }
  38580. }));
  38581. Object.defineProperty(exports, "encodeHTML5", ({
  38582. enumerable: true,
  38583. get: function get() {
  38584. return encode_2.encodeHTML;
  38585. }
  38586. }));
  38587. var decode_2 = __webpack_require__(6347);
  38588. Object.defineProperty(exports, "decodeXML", ({
  38589. enumerable: true,
  38590. get: function get() {
  38591. return decode_2.decodeXML;
  38592. }
  38593. }));
  38594. Object.defineProperty(exports, "decodeHTML", ({
  38595. enumerable: true,
  38596. get: function get() {
  38597. return decode_2.decodeHTML;
  38598. }
  38599. }));
  38600. Object.defineProperty(exports, "decodeHTMLStrict", ({
  38601. enumerable: true,
  38602. get: function get() {
  38603. return decode_2.decodeHTMLStrict;
  38604. }
  38605. }));
  38606. // Legacy aliases (deprecated)
  38607. Object.defineProperty(exports, "decodeHTML4", ({
  38608. enumerable: true,
  38609. get: function get() {
  38610. return decode_2.decodeHTML;
  38611. }
  38612. }));
  38613. Object.defineProperty(exports, "decodeHTML5", ({
  38614. enumerable: true,
  38615. get: function get() {
  38616. return decode_2.decodeHTML;
  38617. }
  38618. }));
  38619. Object.defineProperty(exports, "decodeHTML4Strict", ({
  38620. enumerable: true,
  38621. get: function get() {
  38622. return decode_2.decodeHTMLStrict;
  38623. }
  38624. }));
  38625. Object.defineProperty(exports, "decodeHTML5Strict", ({
  38626. enumerable: true,
  38627. get: function get() {
  38628. return decode_2.decodeHTMLStrict;
  38629. }
  38630. }));
  38631. Object.defineProperty(exports, "decodeXMLStrict", ({
  38632. enumerable: true,
  38633. get: function get() {
  38634. return decode_2.decodeXML;
  38635. }
  38636. }));
  38637. /***/ }),
  38638. /***/ 2369:
  38639. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  38640. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  38641. var __extends = this && this.__extends || function () {
  38642. var _extendStatics = function extendStatics(d, b) {
  38643. _extendStatics = Object.setPrototypeOf || {
  38644. __proto__: []
  38645. } instanceof Array && function (d, b) {
  38646. d.__proto__ = b;
  38647. } || function (d, b) {
  38648. for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  38649. };
  38650. return _extendStatics(d, b);
  38651. };
  38652. return function (d, b) {
  38653. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  38654. _extendStatics(d, b);
  38655. function __() {
  38656. this.constructor = d;
  38657. }
  38658. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  38659. };
  38660. }();
  38661. var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
  38662. if (k2 === undefined) k2 = k;
  38663. Object.defineProperty(o, k2, {
  38664. enumerable: true,
  38665. get: function get() {
  38666. return m[k];
  38667. }
  38668. });
  38669. } : function (o, m, k, k2) {
  38670. if (k2 === undefined) k2 = k;
  38671. o[k2] = m[k];
  38672. });
  38673. var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
  38674. Object.defineProperty(o, "default", {
  38675. enumerable: true,
  38676. value: v
  38677. });
  38678. } : function (o, v) {
  38679. o["default"] = v;
  38680. });
  38681. var __importStar = this && this.__importStar || function (mod) {
  38682. if (mod && mod.__esModule) return mod;
  38683. var result = {};
  38684. if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  38685. __setModuleDefault(result, mod);
  38686. return result;
  38687. };
  38688. var __importDefault = this && this.__importDefault || function (mod) {
  38689. return mod && mod.__esModule ? mod : {
  38690. "default": mod
  38691. };
  38692. };
  38693. Object.defineProperty(exports, "__esModule", ({
  38694. value: true
  38695. }));
  38696. exports.parseFeed = exports.FeedHandler = void 0;
  38697. var domhandler_1 = __importDefault(__webpack_require__(1363));
  38698. var DomUtils = __importStar(__webpack_require__(5511));
  38699. var Parser_1 = __webpack_require__(8168);
  38700. var FeedItemMediaMedium;
  38701. (function (FeedItemMediaMedium) {
  38702. FeedItemMediaMedium[FeedItemMediaMedium["image"] = 0] = "image";
  38703. FeedItemMediaMedium[FeedItemMediaMedium["audio"] = 1] = "audio";
  38704. FeedItemMediaMedium[FeedItemMediaMedium["video"] = 2] = "video";
  38705. FeedItemMediaMedium[FeedItemMediaMedium["document"] = 3] = "document";
  38706. FeedItemMediaMedium[FeedItemMediaMedium["executable"] = 4] = "executable";
  38707. })(FeedItemMediaMedium || (FeedItemMediaMedium = {}));
  38708. var FeedItemMediaExpression;
  38709. (function (FeedItemMediaExpression) {
  38710. FeedItemMediaExpression[FeedItemMediaExpression["sample"] = 0] = "sample";
  38711. FeedItemMediaExpression[FeedItemMediaExpression["full"] = 1] = "full";
  38712. FeedItemMediaExpression[FeedItemMediaExpression["nonstop"] = 2] = "nonstop";
  38713. })(FeedItemMediaExpression || (FeedItemMediaExpression = {}));
  38714. // TODO: Consume data as it is coming in
  38715. var FeedHandler = /** @class */function (_super) {
  38716. __extends(FeedHandler, _super);
  38717. /**
  38718. *
  38719. * @param callback
  38720. * @param options
  38721. */
  38722. function FeedHandler(callback, options) {
  38723. var _this = this;
  38724. if (_typeof(callback) === "object") {
  38725. callback = undefined;
  38726. options = callback;
  38727. }
  38728. _this = _super.call(this, callback, options) || this;
  38729. return _this;
  38730. }
  38731. FeedHandler.prototype.onend = function () {
  38732. var _a, _b;
  38733. var feedRoot = getOneElement(isValidFeed, this.dom);
  38734. if (!feedRoot) {
  38735. this.handleCallback(new Error("couldn't find root of feed"));
  38736. return;
  38737. }
  38738. var feed = {};
  38739. if (feedRoot.name === "feed") {
  38740. var childs = feedRoot.children;
  38741. feed.type = "atom";
  38742. addConditionally(feed, "id", "id", childs);
  38743. addConditionally(feed, "title", "title", childs);
  38744. var href = getAttribute("href", getOneElement("link", childs));
  38745. if (href) {
  38746. feed.link = href;
  38747. }
  38748. addConditionally(feed, "description", "subtitle", childs);
  38749. var updated = fetch("updated", childs);
  38750. if (updated) {
  38751. feed.updated = new Date(updated);
  38752. }
  38753. addConditionally(feed, "author", "email", childs, true);
  38754. feed.items = getElements("entry", childs).map(function (item) {
  38755. var entry = {};
  38756. var children = item.children;
  38757. addConditionally(entry, "id", "id", children);
  38758. addConditionally(entry, "title", "title", children);
  38759. var href = getAttribute("href", getOneElement("link", children));
  38760. if (href) {
  38761. entry.link = href;
  38762. }
  38763. var description = fetch("summary", children) || fetch("content", children);
  38764. if (description) {
  38765. entry.description = description;
  38766. }
  38767. var pubDate = fetch("updated", children);
  38768. if (pubDate) {
  38769. entry.pubDate = new Date(pubDate);
  38770. }
  38771. entry.media = getMediaElements(children);
  38772. return entry;
  38773. });
  38774. } else {
  38775. var childs = (_b = (_a = getOneElement("channel", feedRoot.children)) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : [];
  38776. feed.type = feedRoot.name.substr(0, 3);
  38777. feed.id = "";
  38778. addConditionally(feed, "title", "title", childs);
  38779. addConditionally(feed, "link", "link", childs);
  38780. addConditionally(feed, "description", "description", childs);
  38781. var updated = fetch("lastBuildDate", childs);
  38782. if (updated) {
  38783. feed.updated = new Date(updated);
  38784. }
  38785. addConditionally(feed, "author", "managingEditor", childs, true);
  38786. feed.items = getElements("item", feedRoot.children).map(function (item) {
  38787. var entry = {};
  38788. var children = item.children;
  38789. addConditionally(entry, "id", "guid", children);
  38790. addConditionally(entry, "title", "title", children);
  38791. addConditionally(entry, "link", "link", children);
  38792. addConditionally(entry, "description", "description", children);
  38793. var pubDate = fetch("pubDate", children);
  38794. if (pubDate) entry.pubDate = new Date(pubDate);
  38795. entry.media = getMediaElements(children);
  38796. return entry;
  38797. });
  38798. }
  38799. this.feed = feed;
  38800. this.handleCallback(null);
  38801. };
  38802. return FeedHandler;
  38803. }(domhandler_1["default"]);
  38804. exports.FeedHandler = FeedHandler;
  38805. function getMediaElements(where) {
  38806. return getElements("media:content", where).map(function (elem) {
  38807. var media = {
  38808. medium: elem.attribs.medium,
  38809. isDefault: !!elem.attribs.isDefault
  38810. };
  38811. if (elem.attribs.url) {
  38812. media.url = elem.attribs.url;
  38813. }
  38814. if (elem.attribs.fileSize) {
  38815. media.fileSize = parseInt(elem.attribs.fileSize, 10);
  38816. }
  38817. if (elem.attribs.type) {
  38818. media.type = elem.attribs.type;
  38819. }
  38820. if (elem.attribs.expression) {
  38821. media.expression = elem.attribs.expression;
  38822. }
  38823. if (elem.attribs.bitrate) {
  38824. media.bitrate = parseInt(elem.attribs.bitrate, 10);
  38825. }
  38826. if (elem.attribs.framerate) {
  38827. media.framerate = parseInt(elem.attribs.framerate, 10);
  38828. }
  38829. if (elem.attribs.samplingrate) {
  38830. media.samplingrate = parseInt(elem.attribs.samplingrate, 10);
  38831. }
  38832. if (elem.attribs.channels) {
  38833. media.channels = parseInt(elem.attribs.channels, 10);
  38834. }
  38835. if (elem.attribs.duration) {
  38836. media.duration = parseInt(elem.attribs.duration, 10);
  38837. }
  38838. if (elem.attribs.height) {
  38839. media.height = parseInt(elem.attribs.height, 10);
  38840. }
  38841. if (elem.attribs.width) {
  38842. media.width = parseInt(elem.attribs.width, 10);
  38843. }
  38844. if (elem.attribs.lang) {
  38845. media.lang = elem.attribs.lang;
  38846. }
  38847. return media;
  38848. });
  38849. }
  38850. function getElements(tagName, where) {
  38851. return DomUtils.getElementsByTagName(tagName, where, true);
  38852. }
  38853. function getOneElement(tagName, node) {
  38854. return DomUtils.getElementsByTagName(tagName, node, true, 1)[0];
  38855. }
  38856. function fetch(tagName, where, recurse) {
  38857. if (recurse === void 0) {
  38858. recurse = false;
  38859. }
  38860. return DomUtils.getText(DomUtils.getElementsByTagName(tagName, where, recurse, 1)).trim();
  38861. }
  38862. function getAttribute(name, elem) {
  38863. if (!elem) {
  38864. return null;
  38865. }
  38866. var attribs = elem.attribs;
  38867. return attribs[name];
  38868. }
  38869. function addConditionally(obj, prop, what, where, recurse) {
  38870. if (recurse === void 0) {
  38871. recurse = false;
  38872. }
  38873. var tmp = fetch(what, where, recurse);
  38874. if (tmp) obj[prop] = tmp;
  38875. }
  38876. function isValidFeed(value) {
  38877. return value === "rss" || value === "feed" || value === "rdf:RDF";
  38878. }
  38879. /**
  38880. * Parse a feed.
  38881. *
  38882. * @param feed The feed that should be parsed, as a string.
  38883. * @param options Optionally, options for parsing. When using this option, you should set `xmlMode` to `true`.
  38884. */
  38885. function parseFeed(feed, options) {
  38886. if (options === void 0) {
  38887. options = {
  38888. xmlMode: true
  38889. };
  38890. }
  38891. var handler = new FeedHandler(options);
  38892. new Parser_1.Parser(handler, options).end(feed);
  38893. return handler.feed;
  38894. }
  38895. exports.parseFeed = parseFeed;
  38896. /***/ }),
  38897. /***/ 8168:
  38898. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  38899. var __importDefault = this && this.__importDefault || function (mod) {
  38900. return mod && mod.__esModule ? mod : {
  38901. "default": mod
  38902. };
  38903. };
  38904. Object.defineProperty(exports, "__esModule", ({
  38905. value: true
  38906. }));
  38907. exports.Parser = void 0;
  38908. var Tokenizer_1 = __importDefault(__webpack_require__(6506));
  38909. var formTags = new Set(["input", "option", "optgroup", "select", "button", "datalist", "textarea"]);
  38910. var pTag = new Set(["p"]);
  38911. var openImpliesClose = {
  38912. tr: new Set(["tr", "th", "td"]),
  38913. th: new Set(["th"]),
  38914. td: new Set(["thead", "th", "td"]),
  38915. body: new Set(["head", "link", "script"]),
  38916. li: new Set(["li"]),
  38917. p: pTag,
  38918. h1: pTag,
  38919. h2: pTag,
  38920. h3: pTag,
  38921. h4: pTag,
  38922. h5: pTag,
  38923. h6: pTag,
  38924. select: formTags,
  38925. input: formTags,
  38926. output: formTags,
  38927. button: formTags,
  38928. datalist: formTags,
  38929. textarea: formTags,
  38930. option: new Set(["option"]),
  38931. optgroup: new Set(["optgroup", "option"]),
  38932. dd: new Set(["dt", "dd"]),
  38933. dt: new Set(["dt", "dd"]),
  38934. address: pTag,
  38935. article: pTag,
  38936. aside: pTag,
  38937. blockquote: pTag,
  38938. details: pTag,
  38939. div: pTag,
  38940. dl: pTag,
  38941. fieldset: pTag,
  38942. figcaption: pTag,
  38943. figure: pTag,
  38944. footer: pTag,
  38945. form: pTag,
  38946. header: pTag,
  38947. hr: pTag,
  38948. main: pTag,
  38949. nav: pTag,
  38950. ol: pTag,
  38951. pre: pTag,
  38952. section: pTag,
  38953. table: pTag,
  38954. ul: pTag,
  38955. rt: new Set(["rt", "rp"]),
  38956. rp: new Set(["rt", "rp"]),
  38957. tbody: new Set(["thead", "tbody"]),
  38958. tfoot: new Set(["thead", "tbody"])
  38959. };
  38960. var voidElements = new Set(["area", "base", "basefont", "br", "col", "command", "embed", "frame", "hr", "img", "input", "isindex", "keygen", "link", "meta", "param", "source", "track", "wbr"]);
  38961. var foreignContextElements = new Set(["math", "svg"]);
  38962. var htmlIntegrationElements = new Set(["mi", "mo", "mn", "ms", "mtext", "annotation-xml", "foreignObject", "desc", "title"]);
  38963. var reNameEnd = /\s|\//;
  38964. var Parser = /** @class */function () {
  38965. function Parser(cbs, options) {
  38966. if (options === void 0) {
  38967. options = {};
  38968. }
  38969. var _a, _b, _c, _d, _e;
  38970. /** The start index of the last event. */
  38971. this.startIndex = 0;
  38972. /** The end index of the last event. */
  38973. this.endIndex = null;
  38974. this.tagname = "";
  38975. this.attribname = "";
  38976. this.attribvalue = "";
  38977. this.attribs = null;
  38978. this.stack = [];
  38979. this.foreignContext = [];
  38980. this.options = options;
  38981. this.cbs = cbs !== null && cbs !== void 0 ? cbs : {};
  38982. this.lowerCaseTagNames = (_a = options.lowerCaseTags) !== null && _a !== void 0 ? _a : !options.xmlMode;
  38983. this.lowerCaseAttributeNames = (_b = options.lowerCaseAttributeNames) !== null && _b !== void 0 ? _b : !options.xmlMode;
  38984. this.tokenizer = new ((_c = options.Tokenizer) !== null && _c !== void 0 ? _c : Tokenizer_1["default"])(this.options, this);
  38985. (_e = (_d = this.cbs).onparserinit) === null || _e === void 0 ? void 0 : _e.call(_d, this);
  38986. }
  38987. Parser.prototype.updatePosition = function (initialOffset) {
  38988. if (this.endIndex === null) {
  38989. if (this.tokenizer.sectionStart <= initialOffset) {
  38990. this.startIndex = 0;
  38991. } else {
  38992. this.startIndex = this.tokenizer.sectionStart - initialOffset;
  38993. }
  38994. } else {
  38995. this.startIndex = this.endIndex + 1;
  38996. }
  38997. this.endIndex = this.tokenizer.getAbsoluteIndex();
  38998. };
  38999. // Tokenizer event handlers
  39000. Parser.prototype.ontext = function (data) {
  39001. var _a, _b;
  39002. this.updatePosition(1);
  39003. this.endIndex--;
  39004. (_b = (_a = this.cbs).ontext) === null || _b === void 0 ? void 0 : _b.call(_a, data);
  39005. };
  39006. Parser.prototype.onopentagname = function (name) {
  39007. var _a, _b;
  39008. if (this.lowerCaseTagNames) {
  39009. name = name.toLowerCase();
  39010. }
  39011. this.tagname = name;
  39012. if (!this.options.xmlMode && Object.prototype.hasOwnProperty.call(openImpliesClose, name)) {
  39013. var el = void 0;
  39014. while (this.stack.length > 0 && openImpliesClose[name].has(el = this.stack[this.stack.length - 1])) {
  39015. this.onclosetag(el);
  39016. }
  39017. }
  39018. if (this.options.xmlMode || !voidElements.has(name)) {
  39019. this.stack.push(name);
  39020. if (foreignContextElements.has(name)) {
  39021. this.foreignContext.push(true);
  39022. } else if (htmlIntegrationElements.has(name)) {
  39023. this.foreignContext.push(false);
  39024. }
  39025. }
  39026. (_b = (_a = this.cbs).onopentagname) === null || _b === void 0 ? void 0 : _b.call(_a, name);
  39027. if (this.cbs.onopentag) this.attribs = {};
  39028. };
  39029. Parser.prototype.onopentagend = function () {
  39030. var _a, _b;
  39031. this.updatePosition(1);
  39032. if (this.attribs) {
  39033. (_b = (_a = this.cbs).onopentag) === null || _b === void 0 ? void 0 : _b.call(_a, this.tagname, this.attribs);
  39034. this.attribs = null;
  39035. }
  39036. if (!this.options.xmlMode && this.cbs.onclosetag && voidElements.has(this.tagname)) {
  39037. this.cbs.onclosetag(this.tagname);
  39038. }
  39039. this.tagname = "";
  39040. };
  39041. Parser.prototype.onclosetag = function (name) {
  39042. this.updatePosition(1);
  39043. if (this.lowerCaseTagNames) {
  39044. name = name.toLowerCase();
  39045. }
  39046. if (foreignContextElements.has(name) || htmlIntegrationElements.has(name)) {
  39047. this.foreignContext.pop();
  39048. }
  39049. if (this.stack.length && (this.options.xmlMode || !voidElements.has(name))) {
  39050. var pos = this.stack.lastIndexOf(name);
  39051. if (pos !== -1) {
  39052. if (this.cbs.onclosetag) {
  39053. pos = this.stack.length - pos;
  39054. while (pos--) {
  39055. // We know the stack has sufficient elements.
  39056. this.cbs.onclosetag(this.stack.pop());
  39057. }
  39058. } else this.stack.length = pos;
  39059. } else if (name === "p" && !this.options.xmlMode) {
  39060. this.onopentagname(name);
  39061. this.closeCurrentTag();
  39062. }
  39063. } else if (!this.options.xmlMode && (name === "br" || name === "p")) {
  39064. this.onopentagname(name);
  39065. this.closeCurrentTag();
  39066. }
  39067. };
  39068. Parser.prototype.onselfclosingtag = function () {
  39069. if (this.options.xmlMode || this.options.recognizeSelfClosing || this.foreignContext[this.foreignContext.length - 1]) {
  39070. this.closeCurrentTag();
  39071. } else {
  39072. this.onopentagend();
  39073. }
  39074. };
  39075. Parser.prototype.closeCurrentTag = function () {
  39076. var _a, _b;
  39077. var name = this.tagname;
  39078. this.onopentagend();
  39079. /*
  39080. * Self-closing tags will be on the top of the stack
  39081. * (cheaper check than in onclosetag)
  39082. */
  39083. if (this.stack[this.stack.length - 1] === name) {
  39084. (_b = (_a = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a, name);
  39085. this.stack.pop();
  39086. }
  39087. };
  39088. Parser.prototype.onattribname = function (name) {
  39089. if (this.lowerCaseAttributeNames) {
  39090. name = name.toLowerCase();
  39091. }
  39092. this.attribname = name;
  39093. };
  39094. Parser.prototype.onattribdata = function (value) {
  39095. this.attribvalue += value;
  39096. };
  39097. Parser.prototype.onattribend = function (quote) {
  39098. var _a, _b;
  39099. (_b = (_a = this.cbs).onattribute) === null || _b === void 0 ? void 0 : _b.call(_a, this.attribname, this.attribvalue, quote);
  39100. if (this.attribs && !Object.prototype.hasOwnProperty.call(this.attribs, this.attribname)) {
  39101. this.attribs[this.attribname] = this.attribvalue;
  39102. }
  39103. this.attribname = "";
  39104. this.attribvalue = "";
  39105. };
  39106. Parser.prototype.getInstructionName = function (value) {
  39107. var idx = value.search(reNameEnd);
  39108. var name = idx < 0 ? value : value.substr(0, idx);
  39109. if (this.lowerCaseTagNames) {
  39110. name = name.toLowerCase();
  39111. }
  39112. return name;
  39113. };
  39114. Parser.prototype.ondeclaration = function (value) {
  39115. if (this.cbs.onprocessinginstruction) {
  39116. var name_1 = this.getInstructionName(value);
  39117. this.cbs.onprocessinginstruction("!" + name_1, "!" + value);
  39118. }
  39119. };
  39120. Parser.prototype.onprocessinginstruction = function (value) {
  39121. if (this.cbs.onprocessinginstruction) {
  39122. var name_2 = this.getInstructionName(value);
  39123. this.cbs.onprocessinginstruction("?" + name_2, "?" + value);
  39124. }
  39125. };
  39126. Parser.prototype.oncomment = function (value) {
  39127. var _a, _b, _c, _d;
  39128. this.updatePosition(4);
  39129. (_b = (_a = this.cbs).oncomment) === null || _b === void 0 ? void 0 : _b.call(_a, value);
  39130. (_d = (_c = this.cbs).oncommentend) === null || _d === void 0 ? void 0 : _d.call(_c);
  39131. };
  39132. Parser.prototype.oncdata = function (value) {
  39133. var _a, _b, _c, _d, _e, _f;
  39134. this.updatePosition(1);
  39135. if (this.options.xmlMode || this.options.recognizeCDATA) {
  39136. (_b = (_a = this.cbs).oncdatastart) === null || _b === void 0 ? void 0 : _b.call(_a);
  39137. (_d = (_c = this.cbs).ontext) === null || _d === void 0 ? void 0 : _d.call(_c, value);
  39138. (_f = (_e = this.cbs).oncdataend) === null || _f === void 0 ? void 0 : _f.call(_e);
  39139. } else {
  39140. this.oncomment("[CDATA[" + value + "]]");
  39141. }
  39142. };
  39143. Parser.prototype.onerror = function (err) {
  39144. var _a, _b;
  39145. (_b = (_a = this.cbs).onerror) === null || _b === void 0 ? void 0 : _b.call(_a, err);
  39146. };
  39147. Parser.prototype.onend = function () {
  39148. var _a, _b;
  39149. if (this.cbs.onclosetag) {
  39150. for (var i = this.stack.length; i > 0; this.cbs.onclosetag(this.stack[--i]));
  39151. }
  39152. (_b = (_a = this.cbs).onend) === null || _b === void 0 ? void 0 : _b.call(_a);
  39153. };
  39154. /**
  39155. * Resets the parser to a blank state, ready to parse a new HTML document
  39156. */
  39157. Parser.prototype.reset = function () {
  39158. var _a, _b, _c, _d;
  39159. (_b = (_a = this.cbs).onreset) === null || _b === void 0 ? void 0 : _b.call(_a);
  39160. this.tokenizer.reset();
  39161. this.tagname = "";
  39162. this.attribname = "";
  39163. this.attribs = null;
  39164. this.stack = [];
  39165. (_d = (_c = this.cbs).onparserinit) === null || _d === void 0 ? void 0 : _d.call(_c, this);
  39166. };
  39167. /**
  39168. * Resets the parser, then parses a complete document and
  39169. * pushes it to the handler.
  39170. *
  39171. * @param data Document to parse.
  39172. */
  39173. Parser.prototype.parseComplete = function (data) {
  39174. this.reset();
  39175. this.end(data);
  39176. };
  39177. /**
  39178. * Parses a chunk of data and calls the corresponding callbacks.
  39179. *
  39180. * @param chunk Chunk to parse.
  39181. */
  39182. Parser.prototype.write = function (chunk) {
  39183. this.tokenizer.write(chunk);
  39184. };
  39185. /**
  39186. * Parses the end of the buffer and clears the stack, calls onend.
  39187. *
  39188. * @param chunk Optional final chunk to parse.
  39189. */
  39190. Parser.prototype.end = function (chunk) {
  39191. this.tokenizer.end(chunk);
  39192. };
  39193. /**
  39194. * Pauses parsing. The parser won't emit events until `resume` is called.
  39195. */
  39196. Parser.prototype.pause = function () {
  39197. this.tokenizer.pause();
  39198. };
  39199. /**
  39200. * Resumes parsing after `pause` was called.
  39201. */
  39202. Parser.prototype.resume = function () {
  39203. this.tokenizer.resume();
  39204. };
  39205. /**
  39206. * Alias of `write`, for backwards compatibility.
  39207. *
  39208. * @param chunk Chunk to parse.
  39209. * @deprecated
  39210. */
  39211. Parser.prototype.parseChunk = function (chunk) {
  39212. this.write(chunk);
  39213. };
  39214. /**
  39215. * Alias of `end`, for backwards compatibility.
  39216. *
  39217. * @param chunk Optional final chunk to parse.
  39218. * @deprecated
  39219. */
  39220. Parser.prototype.done = function (chunk) {
  39221. this.end(chunk);
  39222. };
  39223. return Parser;
  39224. }();
  39225. exports.Parser = Parser;
  39226. /***/ }),
  39227. /***/ 6506:
  39228. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  39229. var __importDefault = this && this.__importDefault || function (mod) {
  39230. return mod && mod.__esModule ? mod : {
  39231. "default": mod
  39232. };
  39233. };
  39234. Object.defineProperty(exports, "__esModule", ({
  39235. value: true
  39236. }));
  39237. var decode_codepoint_1 = __importDefault(__webpack_require__(8271));
  39238. var entities_json_1 = __importDefault(__webpack_require__(9323));
  39239. var legacy_json_1 = __importDefault(__webpack_require__(9591));
  39240. var xml_json_1 = __importDefault(__webpack_require__(2586));
  39241. function whitespace(c) {
  39242. return c === " " || c === "\n" || c === "\t" || c === "\f" || c === "\r";
  39243. }
  39244. function isASCIIAlpha(c) {
  39245. return c >= "a" && c <= "z" || c >= "A" && c <= "Z";
  39246. }
  39247. function ifElseState(upper, SUCCESS, FAILURE) {
  39248. var lower = upper.toLowerCase();
  39249. if (upper === lower) {
  39250. return function (t, c) {
  39251. if (c === lower) {
  39252. t._state = SUCCESS;
  39253. } else {
  39254. t._state = FAILURE;
  39255. t._index--;
  39256. }
  39257. };
  39258. }
  39259. return function (t, c) {
  39260. if (c === lower || c === upper) {
  39261. t._state = SUCCESS;
  39262. } else {
  39263. t._state = FAILURE;
  39264. t._index--;
  39265. }
  39266. };
  39267. }
  39268. function consumeSpecialNameChar(upper, NEXT_STATE) {
  39269. var lower = upper.toLowerCase();
  39270. return function (t, c) {
  39271. if (c === lower || c === upper) {
  39272. t._state = NEXT_STATE;
  39273. } else {
  39274. t._state = 3 /* InTagName */;
  39275. t._index--; // Consume the token again
  39276. }
  39277. };
  39278. }
  39279. var stateBeforeCdata1 = ifElseState("C", 24 /* BeforeCdata2 */, 16 /* InDeclaration */);
  39280. var stateBeforeCdata2 = ifElseState("D", 25 /* BeforeCdata3 */, 16 /* InDeclaration */);
  39281. var stateBeforeCdata3 = ifElseState("A", 26 /* BeforeCdata4 */, 16 /* InDeclaration */);
  39282. var stateBeforeCdata4 = ifElseState("T", 27 /* BeforeCdata5 */, 16 /* InDeclaration */);
  39283. var stateBeforeCdata5 = ifElseState("A", 28 /* BeforeCdata6 */, 16 /* InDeclaration */);
  39284. var stateBeforeScript1 = consumeSpecialNameChar("R", 35 /* BeforeScript2 */);
  39285. var stateBeforeScript2 = consumeSpecialNameChar("I", 36 /* BeforeScript3 */);
  39286. var stateBeforeScript3 = consumeSpecialNameChar("P", 37 /* BeforeScript4 */);
  39287. var stateBeforeScript4 = consumeSpecialNameChar("T", 38 /* BeforeScript5 */);
  39288. var stateAfterScript1 = ifElseState("R", 40 /* AfterScript2 */, 1 /* Text */);
  39289. var stateAfterScript2 = ifElseState("I", 41 /* AfterScript3 */, 1 /* Text */);
  39290. var stateAfterScript3 = ifElseState("P", 42 /* AfterScript4 */, 1 /* Text */);
  39291. var stateAfterScript4 = ifElseState("T", 43 /* AfterScript5 */, 1 /* Text */);
  39292. var stateBeforeStyle1 = consumeSpecialNameChar("Y", 45 /* BeforeStyle2 */);
  39293. var stateBeforeStyle2 = consumeSpecialNameChar("L", 46 /* BeforeStyle3 */);
  39294. var stateBeforeStyle3 = consumeSpecialNameChar("E", 47 /* BeforeStyle4 */);
  39295. var stateAfterStyle1 = ifElseState("Y", 49 /* AfterStyle2 */, 1 /* Text */);
  39296. var stateAfterStyle2 = ifElseState("L", 50 /* AfterStyle3 */, 1 /* Text */);
  39297. var stateAfterStyle3 = ifElseState("E", 51 /* AfterStyle4 */, 1 /* Text */);
  39298. var stateBeforeSpecialT = consumeSpecialNameChar("I", 54 /* BeforeTitle1 */);
  39299. var stateBeforeTitle1 = consumeSpecialNameChar("T", 55 /* BeforeTitle2 */);
  39300. var stateBeforeTitle2 = consumeSpecialNameChar("L", 56 /* BeforeTitle3 */);
  39301. var stateBeforeTitle3 = consumeSpecialNameChar("E", 57 /* BeforeTitle4 */);
  39302. var stateAfterSpecialTEnd = ifElseState("I", 58 /* AfterTitle1 */, 1 /* Text */);
  39303. var stateAfterTitle1 = ifElseState("T", 59 /* AfterTitle2 */, 1 /* Text */);
  39304. var stateAfterTitle2 = ifElseState("L", 60 /* AfterTitle3 */, 1 /* Text */);
  39305. var stateAfterTitle3 = ifElseState("E", 61 /* AfterTitle4 */, 1 /* Text */);
  39306. var stateBeforeEntity = ifElseState("#", 63 /* BeforeNumericEntity */, 64 /* InNamedEntity */);
  39307. var stateBeforeNumericEntity = ifElseState("X", 66 /* InHexEntity */, 65 /* InNumericEntity */);
  39308. var Tokenizer = /** @class */function () {
  39309. function Tokenizer(options, cbs) {
  39310. var _a;
  39311. /** The current state the tokenizer is in. */
  39312. this._state = 1 /* Text */;
  39313. /** The read buffer. */
  39314. this.buffer = "";
  39315. /** The beginning of the section that is currently being read. */
  39316. this.sectionStart = 0;
  39317. /** The index within the buffer that we are currently looking at. */
  39318. this._index = 0;
  39319. /**
  39320. * Data that has already been processed will be removed from the buffer occasionally.
  39321. * `_bufferOffset` keeps track of how many characters have been removed, to make sure position information is accurate.
  39322. */
  39323. this.bufferOffset = 0;
  39324. /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
  39325. this.baseState = 1 /* Text */;
  39326. /** For special parsing behavior inside of script and style tags. */
  39327. this.special = 1 /* None */;
  39328. /** Indicates whether the tokenizer has been paused. */
  39329. this.running = true;
  39330. /** Indicates whether the tokenizer has finished running / `.end` has been called. */
  39331. this.ended = false;
  39332. this.cbs = cbs;
  39333. this.xmlMode = !!(options === null || options === void 0 ? void 0 : options.xmlMode);
  39334. this.decodeEntities = (_a = options === null || options === void 0 ? void 0 : options.decodeEntities) !== null && _a !== void 0 ? _a : true;
  39335. }
  39336. Tokenizer.prototype.reset = function () {
  39337. this._state = 1 /* Text */;
  39338. this.buffer = "";
  39339. this.sectionStart = 0;
  39340. this._index = 0;
  39341. this.bufferOffset = 0;
  39342. this.baseState = 1 /* Text */;
  39343. this.special = 1 /* None */;
  39344. this.running = true;
  39345. this.ended = false;
  39346. };
  39347. Tokenizer.prototype.write = function (chunk) {
  39348. if (this.ended) this.cbs.onerror(Error(".write() after done!"));
  39349. this.buffer += chunk;
  39350. this.parse();
  39351. };
  39352. Tokenizer.prototype.end = function (chunk) {
  39353. if (this.ended) this.cbs.onerror(Error(".end() after done!"));
  39354. if (chunk) this.write(chunk);
  39355. this.ended = true;
  39356. if (this.running) this.finish();
  39357. };
  39358. Tokenizer.prototype.pause = function () {
  39359. this.running = false;
  39360. };
  39361. Tokenizer.prototype.resume = function () {
  39362. this.running = true;
  39363. if (this._index < this.buffer.length) {
  39364. this.parse();
  39365. }
  39366. if (this.ended) {
  39367. this.finish();
  39368. }
  39369. };
  39370. /**
  39371. * The current index within all of the written data.
  39372. */
  39373. Tokenizer.prototype.getAbsoluteIndex = function () {
  39374. return this.bufferOffset + this._index;
  39375. };
  39376. Tokenizer.prototype.stateText = function (c) {
  39377. if (c === "<") {
  39378. if (this._index > this.sectionStart) {
  39379. this.cbs.ontext(this.getSection());
  39380. }
  39381. this._state = 2 /* BeforeTagName */;
  39382. this.sectionStart = this._index;
  39383. } else if (this.decodeEntities && c === "&" && (this.special === 1 /* None */ || this.special === 4 /* Title */)) {
  39384. if (this._index > this.sectionStart) {
  39385. this.cbs.ontext(this.getSection());
  39386. }
  39387. this.baseState = 1 /* Text */;
  39388. this._state = 62 /* BeforeEntity */;
  39389. this.sectionStart = this._index;
  39390. }
  39391. };
  39392. /**
  39393. * HTML only allows ASCII alpha characters (a-z and A-Z) at the beginning of a tag name.
  39394. *
  39395. * XML allows a lot more characters here (@see https://www.w3.org/TR/REC-xml/#NT-NameStartChar).
  39396. * We allow anything that wouldn't end the tag.
  39397. */
  39398. Tokenizer.prototype.isTagStartChar = function (c) {
  39399. return isASCIIAlpha(c) || this.xmlMode && !whitespace(c) && c !== "/" && c !== ">";
  39400. };
  39401. Tokenizer.prototype.stateBeforeTagName = function (c) {
  39402. if (c === "/") {
  39403. this._state = 5 /* BeforeClosingTagName */;
  39404. } else if (c === "<") {
  39405. this.cbs.ontext(this.getSection());
  39406. this.sectionStart = this._index;
  39407. } else if (c === ">" || this.special !== 1 /* None */ || whitespace(c)) {
  39408. this._state = 1 /* Text */;
  39409. } else if (c === "!") {
  39410. this._state = 15 /* BeforeDeclaration */;
  39411. this.sectionStart = this._index + 1;
  39412. } else if (c === "?") {
  39413. this._state = 17 /* InProcessingInstruction */;
  39414. this.sectionStart = this._index + 1;
  39415. } else if (!this.isTagStartChar(c)) {
  39416. this._state = 1 /* Text */;
  39417. } else {
  39418. this._state = !this.xmlMode && (c === "s" || c === "S") ? 32 /* BeforeSpecialS */ : !this.xmlMode && (c === "t" || c === "T") ? 52 /* BeforeSpecialT */ : 3 /* InTagName */;
  39419. this.sectionStart = this._index;
  39420. }
  39421. };
  39422. Tokenizer.prototype.stateInTagName = function (c) {
  39423. if (c === "/" || c === ">" || whitespace(c)) {
  39424. this.emitToken("onopentagname");
  39425. this._state = 8 /* BeforeAttributeName */;
  39426. this._index--;
  39427. }
  39428. };
  39429. Tokenizer.prototype.stateBeforeClosingTagName = function (c) {
  39430. if (whitespace(c)) {
  39431. // Ignore
  39432. } else if (c === ">") {
  39433. this._state = 1 /* Text */;
  39434. } else if (this.special !== 1 /* None */) {
  39435. if (this.special !== 4 /* Title */ && (c === "s" || c === "S")) {
  39436. this._state = 33 /* BeforeSpecialSEnd */;
  39437. } else if (this.special === 4 /* Title */ && (c === "t" || c === "T")) {
  39438. this._state = 53 /* BeforeSpecialTEnd */;
  39439. } else {
  39440. this._state = 1 /* Text */;
  39441. this._index--;
  39442. }
  39443. } else if (!this.isTagStartChar(c)) {
  39444. this._state = 20 /* InSpecialComment */;
  39445. this.sectionStart = this._index;
  39446. } else {
  39447. this._state = 6 /* InClosingTagName */;
  39448. this.sectionStart = this._index;
  39449. }
  39450. };
  39451. Tokenizer.prototype.stateInClosingTagName = function (c) {
  39452. if (c === ">" || whitespace(c)) {
  39453. this.emitToken("onclosetag");
  39454. this._state = 7 /* AfterClosingTagName */;
  39455. this._index--;
  39456. }
  39457. };
  39458. Tokenizer.prototype.stateAfterClosingTagName = function (c) {
  39459. // Skip everything until ">"
  39460. if (c === ">") {
  39461. this._state = 1 /* Text */;
  39462. this.sectionStart = this._index + 1;
  39463. }
  39464. };
  39465. Tokenizer.prototype.stateBeforeAttributeName = function (c) {
  39466. if (c === ">") {
  39467. this.cbs.onopentagend();
  39468. this._state = 1 /* Text */;
  39469. this.sectionStart = this._index + 1;
  39470. } else if (c === "/") {
  39471. this._state = 4 /* InSelfClosingTag */;
  39472. } else if (!whitespace(c)) {
  39473. this._state = 9 /* InAttributeName */;
  39474. this.sectionStart = this._index;
  39475. }
  39476. };
  39477. Tokenizer.prototype.stateInSelfClosingTag = function (c) {
  39478. if (c === ">") {
  39479. this.cbs.onselfclosingtag();
  39480. this._state = 1 /* Text */;
  39481. this.sectionStart = this._index + 1;
  39482. this.special = 1 /* None */; // Reset special state, in case of self-closing special tags
  39483. } else if (!whitespace(c)) {
  39484. this._state = 8 /* BeforeAttributeName */;
  39485. this._index--;
  39486. }
  39487. };
  39488. Tokenizer.prototype.stateInAttributeName = function (c) {
  39489. if (c === "=" || c === "/" || c === ">" || whitespace(c)) {
  39490. this.cbs.onattribname(this.getSection());
  39491. this.sectionStart = -1;
  39492. this._state = 10 /* AfterAttributeName */;
  39493. this._index--;
  39494. }
  39495. };
  39496. Tokenizer.prototype.stateAfterAttributeName = function (c) {
  39497. if (c === "=") {
  39498. this._state = 11 /* BeforeAttributeValue */;
  39499. } else if (c === "/" || c === ">") {
  39500. this.cbs.onattribend(undefined);
  39501. this._state = 8 /* BeforeAttributeName */;
  39502. this._index--;
  39503. } else if (!whitespace(c)) {
  39504. this.cbs.onattribend(undefined);
  39505. this._state = 9 /* InAttributeName */;
  39506. this.sectionStart = this._index;
  39507. }
  39508. };
  39509. Tokenizer.prototype.stateBeforeAttributeValue = function (c) {
  39510. if (c === '"') {
  39511. this._state = 12 /* InAttributeValueDq */;
  39512. this.sectionStart = this._index + 1;
  39513. } else if (c === "'") {
  39514. this._state = 13 /* InAttributeValueSq */;
  39515. this.sectionStart = this._index + 1;
  39516. } else if (!whitespace(c)) {
  39517. this._state = 14 /* InAttributeValueNq */;
  39518. this.sectionStart = this._index;
  39519. this._index--; // Reconsume token
  39520. }
  39521. };
  39522. Tokenizer.prototype.handleInAttributeValue = function (c, quote) {
  39523. if (c === quote) {
  39524. this.emitToken("onattribdata");
  39525. this.cbs.onattribend(quote);
  39526. this._state = 8 /* BeforeAttributeName */;
  39527. } else if (this.decodeEntities && c === "&") {
  39528. this.emitToken("onattribdata");
  39529. this.baseState = this._state;
  39530. this._state = 62 /* BeforeEntity */;
  39531. this.sectionStart = this._index;
  39532. }
  39533. };
  39534. Tokenizer.prototype.stateInAttributeValueDoubleQuotes = function (c) {
  39535. this.handleInAttributeValue(c, '"');
  39536. };
  39537. Tokenizer.prototype.stateInAttributeValueSingleQuotes = function (c) {
  39538. this.handleInAttributeValue(c, "'");
  39539. };
  39540. Tokenizer.prototype.stateInAttributeValueNoQuotes = function (c) {
  39541. if (whitespace(c) || c === ">") {
  39542. this.emitToken("onattribdata");
  39543. this.cbs.onattribend(null);
  39544. this._state = 8 /* BeforeAttributeName */;
  39545. this._index--;
  39546. } else if (this.decodeEntities && c === "&") {
  39547. this.emitToken("onattribdata");
  39548. this.baseState = this._state;
  39549. this._state = 62 /* BeforeEntity */;
  39550. this.sectionStart = this._index;
  39551. }
  39552. };
  39553. Tokenizer.prototype.stateBeforeDeclaration = function (c) {
  39554. this._state = c === "[" ? 23 /* BeforeCdata1 */ : c === "-" ? 18 /* BeforeComment */ : 16 /* InDeclaration */;
  39555. };
  39556. Tokenizer.prototype.stateInDeclaration = function (c) {
  39557. if (c === ">") {
  39558. this.cbs.ondeclaration(this.getSection());
  39559. this._state = 1 /* Text */;
  39560. this.sectionStart = this._index + 1;
  39561. }
  39562. };
  39563. Tokenizer.prototype.stateInProcessingInstruction = function (c) {
  39564. if (c === ">") {
  39565. this.cbs.onprocessinginstruction(this.getSection());
  39566. this._state = 1 /* Text */;
  39567. this.sectionStart = this._index + 1;
  39568. }
  39569. };
  39570. Tokenizer.prototype.stateBeforeComment = function (c) {
  39571. if (c === "-") {
  39572. this._state = 19 /* InComment */;
  39573. this.sectionStart = this._index + 1;
  39574. } else {
  39575. this._state = 16 /* InDeclaration */;
  39576. }
  39577. };
  39578. Tokenizer.prototype.stateInComment = function (c) {
  39579. if (c === "-") this._state = 21 /* AfterComment1 */;
  39580. };
  39581. Tokenizer.prototype.stateInSpecialComment = function (c) {
  39582. if (c === ">") {
  39583. this.cbs.oncomment(this.buffer.substring(this.sectionStart, this._index));
  39584. this._state = 1 /* Text */;
  39585. this.sectionStart = this._index + 1;
  39586. }
  39587. };
  39588. Tokenizer.prototype.stateAfterComment1 = function (c) {
  39589. if (c === "-") {
  39590. this._state = 22 /* AfterComment2 */;
  39591. } else {
  39592. this._state = 19 /* InComment */;
  39593. }
  39594. };
  39595. Tokenizer.prototype.stateAfterComment2 = function (c) {
  39596. if (c === ">") {
  39597. // Remove 2 trailing chars
  39598. this.cbs.oncomment(this.buffer.substring(this.sectionStart, this._index - 2));
  39599. this._state = 1 /* Text */;
  39600. this.sectionStart = this._index + 1;
  39601. } else if (c !== "-") {
  39602. this._state = 19 /* InComment */;
  39603. }
  39604. // Else: stay in AFTER_COMMENT_2 (`--->`)
  39605. };
  39606. Tokenizer.prototype.stateBeforeCdata6 = function (c) {
  39607. if (c === "[") {
  39608. this._state = 29 /* InCdata */;
  39609. this.sectionStart = this._index + 1;
  39610. } else {
  39611. this._state = 16 /* InDeclaration */;
  39612. this._index--;
  39613. }
  39614. };
  39615. Tokenizer.prototype.stateInCdata = function (c) {
  39616. if (c === "]") this._state = 30 /* AfterCdata1 */;
  39617. };
  39618. Tokenizer.prototype.stateAfterCdata1 = function (c) {
  39619. if (c === "]") this._state = 31 /* AfterCdata2 */;else this._state = 29 /* InCdata */;
  39620. };
  39621. Tokenizer.prototype.stateAfterCdata2 = function (c) {
  39622. if (c === ">") {
  39623. // Remove 2 trailing chars
  39624. this.cbs.oncdata(this.buffer.substring(this.sectionStart, this._index - 2));
  39625. this._state = 1 /* Text */;
  39626. this.sectionStart = this._index + 1;
  39627. } else if (c !== "]") {
  39628. this._state = 29 /* InCdata */;
  39629. }
  39630. // Else: stay in AFTER_CDATA_2 (`]]]>`)
  39631. };
  39632. Tokenizer.prototype.stateBeforeSpecialS = function (c) {
  39633. if (c === "c" || c === "C") {
  39634. this._state = 34 /* BeforeScript1 */;
  39635. } else if (c === "t" || c === "T") {
  39636. this._state = 44 /* BeforeStyle1 */;
  39637. } else {
  39638. this._state = 3 /* InTagName */;
  39639. this._index--; // Consume the token again
  39640. }
  39641. };
  39642. Tokenizer.prototype.stateBeforeSpecialSEnd = function (c) {
  39643. if (this.special === 2 /* Script */ && (c === "c" || c === "C")) {
  39644. this._state = 39 /* AfterScript1 */;
  39645. } else if (this.special === 3 /* Style */ && (c === "t" || c === "T")) {
  39646. this._state = 48 /* AfterStyle1 */;
  39647. } else this._state = 1 /* Text */;
  39648. };
  39649. Tokenizer.prototype.stateBeforeSpecialLast = function (c, special) {
  39650. if (c === "/" || c === ">" || whitespace(c)) {
  39651. this.special = special;
  39652. }
  39653. this._state = 3 /* InTagName */;
  39654. this._index--; // Consume the token again
  39655. };
  39656. Tokenizer.prototype.stateAfterSpecialLast = function (c, sectionStartOffset) {
  39657. if (c === ">" || whitespace(c)) {
  39658. this.special = 1 /* None */;
  39659. this._state = 6 /* InClosingTagName */;
  39660. this.sectionStart = this._index - sectionStartOffset;
  39661. this._index--; // Reconsume the token
  39662. } else this._state = 1 /* Text */;
  39663. };
  39664. // For entities terminated with a semicolon
  39665. Tokenizer.prototype.parseFixedEntity = function (map) {
  39666. if (map === void 0) {
  39667. map = this.xmlMode ? xml_json_1["default"] : entities_json_1["default"];
  39668. }
  39669. // Offset = 1
  39670. if (this.sectionStart + 1 < this._index) {
  39671. var entity = this.buffer.substring(this.sectionStart + 1, this._index);
  39672. if (Object.prototype.hasOwnProperty.call(map, entity)) {
  39673. this.emitPartial(map[entity]);
  39674. this.sectionStart = this._index + 1;
  39675. }
  39676. }
  39677. };
  39678. // Parses legacy entities (without trailing semicolon)
  39679. Tokenizer.prototype.parseLegacyEntity = function () {
  39680. var start = this.sectionStart + 1;
  39681. // The max length of legacy entities is 6
  39682. var limit = Math.min(this._index - start, 6);
  39683. while (limit >= 2) {
  39684. // The min length of legacy entities is 2
  39685. var entity = this.buffer.substr(start, limit);
  39686. if (Object.prototype.hasOwnProperty.call(legacy_json_1["default"], entity)) {
  39687. this.emitPartial(legacy_json_1["default"][entity]);
  39688. this.sectionStart += limit + 1;
  39689. return;
  39690. }
  39691. limit--;
  39692. }
  39693. };
  39694. Tokenizer.prototype.stateInNamedEntity = function (c) {
  39695. if (c === ";") {
  39696. this.parseFixedEntity();
  39697. // Retry as legacy entity if entity wasn't parsed
  39698. if (this.baseState === 1 /* Text */ && this.sectionStart + 1 < this._index && !this.xmlMode) {
  39699. this.parseLegacyEntity();
  39700. }
  39701. this._state = this.baseState;
  39702. } else if ((c < "0" || c > "9") && !isASCIIAlpha(c)) {
  39703. if (this.xmlMode || this.sectionStart + 1 === this._index) {
  39704. // Ignore
  39705. } else if (this.baseState !== 1 /* Text */) {
  39706. if (c !== "=") {
  39707. // Parse as legacy entity, without allowing additional characters.
  39708. this.parseFixedEntity(legacy_json_1["default"]);
  39709. }
  39710. } else {
  39711. this.parseLegacyEntity();
  39712. }
  39713. this._state = this.baseState;
  39714. this._index--;
  39715. }
  39716. };
  39717. Tokenizer.prototype.decodeNumericEntity = function (offset, base, strict) {
  39718. var sectionStart = this.sectionStart + offset;
  39719. if (sectionStart !== this._index) {
  39720. // Parse entity
  39721. var entity = this.buffer.substring(sectionStart, this._index);
  39722. var parsed = parseInt(entity, base);
  39723. this.emitPartial(decode_codepoint_1["default"](parsed));
  39724. this.sectionStart = strict ? this._index + 1 : this._index;
  39725. }
  39726. this._state = this.baseState;
  39727. };
  39728. Tokenizer.prototype.stateInNumericEntity = function (c) {
  39729. if (c === ";") {
  39730. this.decodeNumericEntity(2, 10, true);
  39731. } else if (c < "0" || c > "9") {
  39732. if (!this.xmlMode) {
  39733. this.decodeNumericEntity(2, 10, false);
  39734. } else {
  39735. this._state = this.baseState;
  39736. }
  39737. this._index--;
  39738. }
  39739. };
  39740. Tokenizer.prototype.stateInHexEntity = function (c) {
  39741. if (c === ";") {
  39742. this.decodeNumericEntity(3, 16, true);
  39743. } else if ((c < "a" || c > "f") && (c < "A" || c > "F") && (c < "0" || c > "9")) {
  39744. if (!this.xmlMode) {
  39745. this.decodeNumericEntity(3, 16, false);
  39746. } else {
  39747. this._state = this.baseState;
  39748. }
  39749. this._index--;
  39750. }
  39751. };
  39752. Tokenizer.prototype.cleanup = function () {
  39753. if (this.sectionStart < 0) {
  39754. this.buffer = "";
  39755. this.bufferOffset += this._index;
  39756. this._index = 0;
  39757. } else if (this.running) {
  39758. if (this._state === 1 /* Text */) {
  39759. if (this.sectionStart !== this._index) {
  39760. this.cbs.ontext(this.buffer.substr(this.sectionStart));
  39761. }
  39762. this.buffer = "";
  39763. this.bufferOffset += this._index;
  39764. this._index = 0;
  39765. } else if (this.sectionStart === this._index) {
  39766. // The section just started
  39767. this.buffer = "";
  39768. this.bufferOffset += this._index;
  39769. this._index = 0;
  39770. } else {
  39771. // Remove everything unnecessary
  39772. this.buffer = this.buffer.substr(this.sectionStart);
  39773. this._index -= this.sectionStart;
  39774. this.bufferOffset += this.sectionStart;
  39775. }
  39776. this.sectionStart = 0;
  39777. }
  39778. };
  39779. /**
  39780. * Iterates through the buffer, calling the function corresponding to the current state.
  39781. *
  39782. * States that are more likely to be hit are higher up, as a performance improvement.
  39783. */
  39784. Tokenizer.prototype.parse = function () {
  39785. while (this._index < this.buffer.length && this.running) {
  39786. var c = this.buffer.charAt(this._index);
  39787. if (this._state === 1 /* Text */) {
  39788. this.stateText(c);
  39789. } else if (this._state === 12 /* InAttributeValueDq */) {
  39790. this.stateInAttributeValueDoubleQuotes(c);
  39791. } else if (this._state === 9 /* InAttributeName */) {
  39792. this.stateInAttributeName(c);
  39793. } else if (this._state === 19 /* InComment */) {
  39794. this.stateInComment(c);
  39795. } else if (this._state === 20 /* InSpecialComment */) {
  39796. this.stateInSpecialComment(c);
  39797. } else if (this._state === 8 /* BeforeAttributeName */) {
  39798. this.stateBeforeAttributeName(c);
  39799. } else if (this._state === 3 /* InTagName */) {
  39800. this.stateInTagName(c);
  39801. } else if (this._state === 6 /* InClosingTagName */) {
  39802. this.stateInClosingTagName(c);
  39803. } else if (this._state === 2 /* BeforeTagName */) {
  39804. this.stateBeforeTagName(c);
  39805. } else if (this._state === 10 /* AfterAttributeName */) {
  39806. this.stateAfterAttributeName(c);
  39807. } else if (this._state === 13 /* InAttributeValueSq */) {
  39808. this.stateInAttributeValueSingleQuotes(c);
  39809. } else if (this._state === 11 /* BeforeAttributeValue */) {
  39810. this.stateBeforeAttributeValue(c);
  39811. } else if (this._state === 5 /* BeforeClosingTagName */) {
  39812. this.stateBeforeClosingTagName(c);
  39813. } else if (this._state === 7 /* AfterClosingTagName */) {
  39814. this.stateAfterClosingTagName(c);
  39815. } else if (this._state === 32 /* BeforeSpecialS */) {
  39816. this.stateBeforeSpecialS(c);
  39817. } else if (this._state === 21 /* AfterComment1 */) {
  39818. this.stateAfterComment1(c);
  39819. } else if (this._state === 14 /* InAttributeValueNq */) {
  39820. this.stateInAttributeValueNoQuotes(c);
  39821. } else if (this._state === 4 /* InSelfClosingTag */) {
  39822. this.stateInSelfClosingTag(c);
  39823. } else if (this._state === 16 /* InDeclaration */) {
  39824. this.stateInDeclaration(c);
  39825. } else if (this._state === 15 /* BeforeDeclaration */) {
  39826. this.stateBeforeDeclaration(c);
  39827. } else if (this._state === 22 /* AfterComment2 */) {
  39828. this.stateAfterComment2(c);
  39829. } else if (this._state === 18 /* BeforeComment */) {
  39830. this.stateBeforeComment(c);
  39831. } else if (this._state === 33 /* BeforeSpecialSEnd */) {
  39832. this.stateBeforeSpecialSEnd(c);
  39833. } else if (this._state === 53 /* BeforeSpecialTEnd */) {
  39834. stateAfterSpecialTEnd(this, c);
  39835. } else if (this._state === 39 /* AfterScript1 */) {
  39836. stateAfterScript1(this, c);
  39837. } else if (this._state === 40 /* AfterScript2 */) {
  39838. stateAfterScript2(this, c);
  39839. } else if (this._state === 41 /* AfterScript3 */) {
  39840. stateAfterScript3(this, c);
  39841. } else if (this._state === 34 /* BeforeScript1 */) {
  39842. stateBeforeScript1(this, c);
  39843. } else if (this._state === 35 /* BeforeScript2 */) {
  39844. stateBeforeScript2(this, c);
  39845. } else if (this._state === 36 /* BeforeScript3 */) {
  39846. stateBeforeScript3(this, c);
  39847. } else if (this._state === 37 /* BeforeScript4 */) {
  39848. stateBeforeScript4(this, c);
  39849. } else if (this._state === 38 /* BeforeScript5 */) {
  39850. this.stateBeforeSpecialLast(c, 2 /* Script */);
  39851. } else if (this._state === 42 /* AfterScript4 */) {
  39852. stateAfterScript4(this, c);
  39853. } else if (this._state === 43 /* AfterScript5 */) {
  39854. this.stateAfterSpecialLast(c, 6);
  39855. } else if (this._state === 44 /* BeforeStyle1 */) {
  39856. stateBeforeStyle1(this, c);
  39857. } else if (this._state === 29 /* InCdata */) {
  39858. this.stateInCdata(c);
  39859. } else if (this._state === 45 /* BeforeStyle2 */) {
  39860. stateBeforeStyle2(this, c);
  39861. } else if (this._state === 46 /* BeforeStyle3 */) {
  39862. stateBeforeStyle3(this, c);
  39863. } else if (this._state === 47 /* BeforeStyle4 */) {
  39864. this.stateBeforeSpecialLast(c, 3 /* Style */);
  39865. } else if (this._state === 48 /* AfterStyle1 */) {
  39866. stateAfterStyle1(this, c);
  39867. } else if (this._state === 49 /* AfterStyle2 */) {
  39868. stateAfterStyle2(this, c);
  39869. } else if (this._state === 50 /* AfterStyle3 */) {
  39870. stateAfterStyle3(this, c);
  39871. } else if (this._state === 51 /* AfterStyle4 */) {
  39872. this.stateAfterSpecialLast(c, 5);
  39873. } else if (this._state === 52 /* BeforeSpecialT */) {
  39874. stateBeforeSpecialT(this, c);
  39875. } else if (this._state === 54 /* BeforeTitle1 */) {
  39876. stateBeforeTitle1(this, c);
  39877. } else if (this._state === 55 /* BeforeTitle2 */) {
  39878. stateBeforeTitle2(this, c);
  39879. } else if (this._state === 56 /* BeforeTitle3 */) {
  39880. stateBeforeTitle3(this, c);
  39881. } else if (this._state === 57 /* BeforeTitle4 */) {
  39882. this.stateBeforeSpecialLast(c, 4 /* Title */);
  39883. } else if (this._state === 58 /* AfterTitle1 */) {
  39884. stateAfterTitle1(this, c);
  39885. } else if (this._state === 59 /* AfterTitle2 */) {
  39886. stateAfterTitle2(this, c);
  39887. } else if (this._state === 60 /* AfterTitle3 */) {
  39888. stateAfterTitle3(this, c);
  39889. } else if (this._state === 61 /* AfterTitle4 */) {
  39890. this.stateAfterSpecialLast(c, 5);
  39891. } else if (this._state === 17 /* InProcessingInstruction */) {
  39892. this.stateInProcessingInstruction(c);
  39893. } else if (this._state === 64 /* InNamedEntity */) {
  39894. this.stateInNamedEntity(c);
  39895. } else if (this._state === 23 /* BeforeCdata1 */) {
  39896. stateBeforeCdata1(this, c);
  39897. } else if (this._state === 62 /* BeforeEntity */) {
  39898. stateBeforeEntity(this, c);
  39899. } else if (this._state === 24 /* BeforeCdata2 */) {
  39900. stateBeforeCdata2(this, c);
  39901. } else if (this._state === 25 /* BeforeCdata3 */) {
  39902. stateBeforeCdata3(this, c);
  39903. } else if (this._state === 30 /* AfterCdata1 */) {
  39904. this.stateAfterCdata1(c);
  39905. } else if (this._state === 31 /* AfterCdata2 */) {
  39906. this.stateAfterCdata2(c);
  39907. } else if (this._state === 26 /* BeforeCdata4 */) {
  39908. stateBeforeCdata4(this, c);
  39909. } else if (this._state === 27 /* BeforeCdata5 */) {
  39910. stateBeforeCdata5(this, c);
  39911. } else if (this._state === 28 /* BeforeCdata6 */) {
  39912. this.stateBeforeCdata6(c);
  39913. } else if (this._state === 66 /* InHexEntity */) {
  39914. this.stateInHexEntity(c);
  39915. } else if (this._state === 65 /* InNumericEntity */) {
  39916. this.stateInNumericEntity(c);
  39917. // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
  39918. } else if (this._state === 63 /* BeforeNumericEntity */) {
  39919. stateBeforeNumericEntity(this, c);
  39920. } else {
  39921. this.cbs.onerror(Error("unknown _state"), this._state);
  39922. }
  39923. this._index++;
  39924. }
  39925. this.cleanup();
  39926. };
  39927. Tokenizer.prototype.finish = function () {
  39928. // If there is remaining data, emit it in a reasonable way
  39929. if (this.sectionStart < this._index) {
  39930. this.handleTrailingData();
  39931. }
  39932. this.cbs.onend();
  39933. };
  39934. Tokenizer.prototype.handleTrailingData = function () {
  39935. var data = this.buffer.substr(this.sectionStart);
  39936. if (this._state === 29 /* InCdata */ || this._state === 30 /* AfterCdata1 */ || this._state === 31 /* AfterCdata2 */) {
  39937. this.cbs.oncdata(data);
  39938. } else if (this._state === 19 /* InComment */ || this._state === 21 /* AfterComment1 */ || this._state === 22 /* AfterComment2 */) {
  39939. this.cbs.oncomment(data);
  39940. } else if (this._state === 64 /* InNamedEntity */ && !this.xmlMode) {
  39941. this.parseLegacyEntity();
  39942. if (this.sectionStart < this._index) {
  39943. this._state = this.baseState;
  39944. this.handleTrailingData();
  39945. }
  39946. } else if (this._state === 65 /* InNumericEntity */ && !this.xmlMode) {
  39947. this.decodeNumericEntity(2, 10, false);
  39948. if (this.sectionStart < this._index) {
  39949. this._state = this.baseState;
  39950. this.handleTrailingData();
  39951. }
  39952. } else if (this._state === 66 /* InHexEntity */ && !this.xmlMode) {
  39953. this.decodeNumericEntity(3, 16, false);
  39954. if (this.sectionStart < this._index) {
  39955. this._state = this.baseState;
  39956. this.handleTrailingData();
  39957. }
  39958. } else if (this._state !== 3 /* InTagName */ && this._state !== 8 /* BeforeAttributeName */ && this._state !== 11 /* BeforeAttributeValue */ && this._state !== 10 /* AfterAttributeName */ && this._state !== 9 /* InAttributeName */ && this._state !== 13 /* InAttributeValueSq */ && this._state !== 12 /* InAttributeValueDq */ && this._state !== 14 /* InAttributeValueNq */ && this._state !== 6 /* InClosingTagName */) {
  39959. this.cbs.ontext(data);
  39960. }
  39961. /*
  39962. * Else, ignore remaining data
  39963. * TODO add a way to remove current tag
  39964. */
  39965. };
  39966. Tokenizer.prototype.getSection = function () {
  39967. return this.buffer.substring(this.sectionStart, this._index);
  39968. };
  39969. Tokenizer.prototype.emitToken = function (name) {
  39970. this.cbs[name](this.getSection());
  39971. this.sectionStart = -1;
  39972. };
  39973. Tokenizer.prototype.emitPartial = function (value) {
  39974. if (this.baseState !== 1 /* Text */) {
  39975. this.cbs.onattribdata(value); // TODO implement the new event
  39976. } else {
  39977. this.cbs.ontext(value);
  39978. }
  39979. };
  39980. return Tokenizer;
  39981. }();
  39982. exports["default"] = Tokenizer;
  39983. /***/ }),
  39984. /***/ 6124:
  39985. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  39986. var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
  39987. if (k2 === undefined) k2 = k;
  39988. Object.defineProperty(o, k2, {
  39989. enumerable: true,
  39990. get: function get() {
  39991. return m[k];
  39992. }
  39993. });
  39994. } : function (o, m, k, k2) {
  39995. if (k2 === undefined) k2 = k;
  39996. o[k2] = m[k];
  39997. });
  39998. var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
  39999. Object.defineProperty(o, "default", {
  40000. enumerable: true,
  40001. value: v
  40002. });
  40003. } : function (o, v) {
  40004. o["default"] = v;
  40005. });
  40006. var __importStar = this && this.__importStar || function (mod) {
  40007. if (mod && mod.__esModule) return mod;
  40008. var result = {};
  40009. if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  40010. __setModuleDefault(result, mod);
  40011. return result;
  40012. };
  40013. var __exportStar = this && this.__exportStar || function (m, exports) {
  40014. for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
  40015. };
  40016. var __importDefault = this && this.__importDefault || function (mod) {
  40017. return mod && mod.__esModule ? mod : {
  40018. "default": mod
  40019. };
  40020. };
  40021. Object.defineProperty(exports, "__esModule", ({
  40022. value: true
  40023. }));
  40024. exports.RssHandler = exports.DefaultHandler = exports.DomUtils = exports.ElementType = exports.Tokenizer = exports.createDomStream = exports.parseDOM = exports.parseDocument = exports.DomHandler = exports.Parser = void 0;
  40025. var Parser_1 = __webpack_require__(8168);
  40026. Object.defineProperty(exports, "Parser", ({
  40027. enumerable: true,
  40028. get: function get() {
  40029. return Parser_1.Parser;
  40030. }
  40031. }));
  40032. var domhandler_1 = __webpack_require__(1363);
  40033. Object.defineProperty(exports, "DomHandler", ({
  40034. enumerable: true,
  40035. get: function get() {
  40036. return domhandler_1.DomHandler;
  40037. }
  40038. }));
  40039. Object.defineProperty(exports, "DefaultHandler", ({
  40040. enumerable: true,
  40041. get: function get() {
  40042. return domhandler_1.DomHandler;
  40043. }
  40044. }));
  40045. // Helper methods
  40046. /**
  40047. * Parses the data, returns the resulting document.
  40048. *
  40049. * @param data The data that should be parsed.
  40050. * @param options Optional options for the parser and DOM builder.
  40051. */
  40052. function parseDocument(data, options) {
  40053. var handler = new domhandler_1.DomHandler(undefined, options);
  40054. new Parser_1.Parser(handler, options).end(data);
  40055. return handler.root;
  40056. }
  40057. exports.parseDocument = parseDocument;
  40058. /**
  40059. * Parses data, returns an array of the root nodes.
  40060. *
  40061. * Note that the root nodes still have a `Document` node as their parent.
  40062. * Use `parseDocument` to get the `Document` node instead.
  40063. *
  40064. * @param data The data that should be parsed.
  40065. * @param options Optional options for the parser and DOM builder.
  40066. * @deprecated Use `parseDocument` instead.
  40067. */
  40068. function parseDOM(data, options) {
  40069. return parseDocument(data, options).children;
  40070. }
  40071. exports.parseDOM = parseDOM;
  40072. /**
  40073. * Creates a parser instance, with an attached DOM handler.
  40074. *
  40075. * @param cb A callback that will be called once parsing has been completed.
  40076. * @param options Optional options for the parser and DOM builder.
  40077. * @param elementCb An optional callback that will be called every time a tag has been completed inside of the DOM.
  40078. */
  40079. function createDomStream(cb, options, elementCb) {
  40080. var handler = new domhandler_1.DomHandler(cb, options, elementCb);
  40081. return new Parser_1.Parser(handler, options);
  40082. }
  40083. exports.createDomStream = createDomStream;
  40084. var Tokenizer_1 = __webpack_require__(6506);
  40085. Object.defineProperty(exports, "Tokenizer", ({
  40086. enumerable: true,
  40087. get: function get() {
  40088. return __importDefault(Tokenizer_1)["default"];
  40089. }
  40090. }));
  40091. var ElementType = __importStar(__webpack_require__(7304));
  40092. exports.ElementType = ElementType;
  40093. /*
  40094. * All of the following exports exist for backwards-compatibility.
  40095. * They should probably be removed eventually.
  40096. */
  40097. __exportStar(__webpack_require__(2369), exports);
  40098. exports.DomUtils = __importStar(__webpack_require__(5511));
  40099. var FeedHandler_1 = __webpack_require__(2369);
  40100. Object.defineProperty(exports, "RssHandler", ({
  40101. enumerable: true,
  40102. get: function get() {
  40103. return FeedHandler_1.FeedHandler;
  40104. }
  40105. }));
  40106. /***/ }),
  40107. /***/ 4281:
  40108. /***/ ((__unused_webpack_module, exports) => {
  40109. Object.defineProperty(exports, "__esModule", ({
  40110. value: true
  40111. }));
  40112. /*!
  40113. * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
  40114. *
  40115. * Copyright (c) 2014-2017, Jon Schlinkert.
  40116. * Released under the MIT License.
  40117. */
  40118. function isObject(o) {
  40119. return Object.prototype.toString.call(o) === '[object Object]';
  40120. }
  40121. function isPlainObject(o) {
  40122. var ctor, prot;
  40123. if (isObject(o) === false) return false;
  40124. // If has modified constructor
  40125. ctor = o.constructor;
  40126. if (ctor === undefined) return true;
  40127. // If has modified prototype
  40128. prot = ctor.prototype;
  40129. if (isObject(prot) === false) return false;
  40130. // If constructor does not have an Object-specific method
  40131. if (prot.hasOwnProperty('isPrototypeOf') === false) {
  40132. return false;
  40133. }
  40134. // Most likely a plain Object
  40135. return true;
  40136. }
  40137. exports.isPlainObject = isPlainObject;
  40138. /***/ }),
  40139. /***/ 2134:
  40140. /***/ (function(module, exports) {
  40141. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  40142. /**
  40143. * Srcset Parser
  40144. *
  40145. * By Alex Bell | MIT License
  40146. *
  40147. * JS Parser for the string value that appears in markup <img srcset="here">
  40148. *
  40149. * @returns Array [{url: _, d: _, w: _, h:_}, ...]
  40150. *
  40151. * Based super duper closely on the reference algorithm at:
  40152. * https://html.spec.whatwg.org/multipage/embedded-content.html#parse-a-srcset-attribute
  40153. *
  40154. * Most comments are copied in directly from the spec
  40155. * (except for comments in parens).
  40156. */
  40157. (function (root, factory) {
  40158. if (true) {
  40159. // AMD. Register as an anonymous module.
  40160. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  40161. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  40162. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  40163. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  40164. } else {}
  40165. })(this, function () {
  40166. // 1. Let input be the value passed to this algorithm.
  40167. return function (input) {
  40168. // UTILITY FUNCTIONS
  40169. // Manual is faster than RegEx
  40170. // http://bjorn.tipling.com/state-and-regular-expressions-in-javascript
  40171. // http://jsperf.com/whitespace-character/5
  40172. function isSpace(c) {
  40173. return c === " " ||
  40174. // space
  40175. c === "\t" ||
  40176. // horizontal tab
  40177. c === "\n" ||
  40178. // new line
  40179. c === "\f" ||
  40180. // form feed
  40181. c === "\r"; // carriage return
  40182. }
  40183. function collectCharacters(regEx) {
  40184. var chars,
  40185. match = regEx.exec(input.substring(pos));
  40186. if (match) {
  40187. chars = match[0];
  40188. pos += chars.length;
  40189. return chars;
  40190. }
  40191. }
  40192. var inputLength = input.length,
  40193. // (Don't use \s, to avoid matching non-breaking space)
  40194. regexLeadingSpaces = /^[ \t\n\r\u000c]+/,
  40195. regexLeadingCommasOrSpaces = /^[, \t\n\r\u000c]+/,
  40196. regexLeadingNotSpaces = /^[^ \t\n\r\u000c]+/,
  40197. regexTrailingCommas = /[,]+$/,
  40198. regexNonNegativeInteger = /^\d+$/,
  40199. // ( Positive or negative or unsigned integers or decimals, without or without exponents.
  40200. // Must include at least one digit.
  40201. // According to spec tests any decimal point must be followed by a digit.
  40202. // No leading plus sign is allowed.)
  40203. // https://html.spec.whatwg.org/multipage/infrastructure.html#valid-floating-point-number
  40204. regexFloatingPoint = /^-?(?:[0-9]+|[0-9]*\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/,
  40205. url,
  40206. descriptors,
  40207. currentDescriptor,
  40208. state,
  40209. c,
  40210. // 2. Let position be a pointer into input, initially pointing at the start
  40211. // of the string.
  40212. pos = 0,
  40213. // 3. Let candidates be an initially empty source set.
  40214. candidates = [];
  40215. // 4. Splitting loop: Collect a sequence of characters that are space
  40216. // characters or U+002C COMMA characters. If any U+002C COMMA characters
  40217. // were collected, that is a parse error.
  40218. while (true) {
  40219. collectCharacters(regexLeadingCommasOrSpaces);
  40220. // 5. If position is past the end of input, return candidates and abort these steps.
  40221. if (pos >= inputLength) {
  40222. return candidates; // (we're done, this is the sole return path)
  40223. }
  40224. // 6. Collect a sequence of characters that are not space characters,
  40225. // and let that be url.
  40226. url = collectCharacters(regexLeadingNotSpaces);
  40227. // 7. Let descriptors be a new empty list.
  40228. descriptors = [];
  40229. // 8. If url ends with a U+002C COMMA character (,), follow these substeps:
  40230. // (1). Remove all trailing U+002C COMMA characters from url. If this removed
  40231. // more than one character, that is a parse error.
  40232. if (url.slice(-1) === ",") {
  40233. url = url.replace(regexTrailingCommas, "");
  40234. // (Jump ahead to step 9 to skip tokenization and just push the candidate).
  40235. parseDescriptors();
  40236. // Otherwise, follow these substeps:
  40237. } else {
  40238. tokenize();
  40239. } // (close else of step 8)
  40240. // 16. Return to the step labeled splitting loop.
  40241. } // (Close of big while loop.)
  40242. /**
  40243. * Tokenizes descriptor properties prior to parsing
  40244. * Returns undefined.
  40245. */
  40246. function tokenize() {
  40247. // 8.1. Descriptor tokeniser: Skip whitespace
  40248. collectCharacters(regexLeadingSpaces);
  40249. // 8.2. Let current descriptor be the empty string.
  40250. currentDescriptor = "";
  40251. // 8.3. Let state be in descriptor.
  40252. state = "in descriptor";
  40253. while (true) {
  40254. // 8.4. Let c be the character at position.
  40255. c = input.charAt(pos);
  40256. // Do the following depending on the value of state.
  40257. // For the purpose of this step, "EOF" is a special character representing
  40258. // that position is past the end of input.
  40259. // In descriptor
  40260. if (state === "in descriptor") {
  40261. // Do the following, depending on the value of c:
  40262. // Space character
  40263. // If current descriptor is not empty, append current descriptor to
  40264. // descriptors and let current descriptor be the empty string.
  40265. // Set state to after descriptor.
  40266. if (isSpace(c)) {
  40267. if (currentDescriptor) {
  40268. descriptors.push(currentDescriptor);
  40269. currentDescriptor = "";
  40270. state = "after descriptor";
  40271. }
  40272. // U+002C COMMA (,)
  40273. // Advance position to the next character in input. If current descriptor
  40274. // is not empty, append current descriptor to descriptors. Jump to the step
  40275. // labeled descriptor parser.
  40276. } else if (c === ",") {
  40277. pos += 1;
  40278. if (currentDescriptor) {
  40279. descriptors.push(currentDescriptor);
  40280. }
  40281. parseDescriptors();
  40282. return;
  40283. // U+0028 LEFT PARENTHESIS (()
  40284. // Append c to current descriptor. Set state to in parens.
  40285. } else if (c === "(") {
  40286. currentDescriptor = currentDescriptor + c;
  40287. state = "in parens";
  40288. // EOF
  40289. // If current descriptor is not empty, append current descriptor to
  40290. // descriptors. Jump to the step labeled descriptor parser.
  40291. } else if (c === "") {
  40292. if (currentDescriptor) {
  40293. descriptors.push(currentDescriptor);
  40294. }
  40295. parseDescriptors();
  40296. return;
  40297. // Anything else
  40298. // Append c to current descriptor.
  40299. } else {
  40300. currentDescriptor = currentDescriptor + c;
  40301. }
  40302. // (end "in descriptor"
  40303. // In parens
  40304. } else if (state === "in parens") {
  40305. // U+0029 RIGHT PARENTHESIS ())
  40306. // Append c to current descriptor. Set state to in descriptor.
  40307. if (c === ")") {
  40308. currentDescriptor = currentDescriptor + c;
  40309. state = "in descriptor";
  40310. // EOF
  40311. // Append current descriptor to descriptors. Jump to the step labeled
  40312. // descriptor parser.
  40313. } else if (c === "") {
  40314. descriptors.push(currentDescriptor);
  40315. parseDescriptors();
  40316. return;
  40317. // Anything else
  40318. // Append c to current descriptor.
  40319. } else {
  40320. currentDescriptor = currentDescriptor + c;
  40321. }
  40322. // After descriptor
  40323. } else if (state === "after descriptor") {
  40324. // Do the following, depending on the value of c:
  40325. // Space character: Stay in this state.
  40326. if (isSpace(c)) {
  40327. // EOF: Jump to the step labeled descriptor parser.
  40328. } else if (c === "") {
  40329. parseDescriptors();
  40330. return;
  40331. // Anything else
  40332. // Set state to in descriptor. Set position to the previous character in input.
  40333. } else {
  40334. state = "in descriptor";
  40335. pos -= 1;
  40336. }
  40337. }
  40338. // Advance position to the next character in input.
  40339. pos += 1;
  40340. // Repeat this step.
  40341. } // (close while true loop)
  40342. }
  40343. /**
  40344. * Adds descriptor properties to a candidate, pushes to the candidates array
  40345. * @return undefined
  40346. */
  40347. // Declared outside of the while loop so that it's only created once.
  40348. function parseDescriptors() {
  40349. // 9. Descriptor parser: Let error be no.
  40350. var pError = false,
  40351. // 10. Let width be absent.
  40352. // 11. Let density be absent.
  40353. // 12. Let future-compat-h be absent. (We're implementing it now as h)
  40354. w,
  40355. d,
  40356. h,
  40357. i,
  40358. candidate = {},
  40359. desc,
  40360. lastChar,
  40361. value,
  40362. intVal,
  40363. floatVal;
  40364. // 13. For each descriptor in descriptors, run the appropriate set of steps
  40365. // from the following list:
  40366. for (i = 0; i < descriptors.length; i++) {
  40367. desc = descriptors[i];
  40368. lastChar = desc[desc.length - 1];
  40369. value = desc.substring(0, desc.length - 1);
  40370. intVal = parseInt(value, 10);
  40371. floatVal = parseFloat(value);
  40372. // If the descriptor consists of a valid non-negative integer followed by
  40373. // a U+0077 LATIN SMALL LETTER W character
  40374. if (regexNonNegativeInteger.test(value) && lastChar === "w") {
  40375. // If width and density are not both absent, then let error be yes.
  40376. if (w || d) {
  40377. pError = true;
  40378. }
  40379. // Apply the rules for parsing non-negative integers to the descriptor.
  40380. // If the result is zero, let error be yes.
  40381. // Otherwise, let width be the result.
  40382. if (intVal === 0) {
  40383. pError = true;
  40384. } else {
  40385. w = intVal;
  40386. }
  40387. // If the descriptor consists of a valid floating-point number followed by
  40388. // a U+0078 LATIN SMALL LETTER X character
  40389. } else if (regexFloatingPoint.test(value) && lastChar === "x") {
  40390. // If width, density and future-compat-h are not all absent, then let error
  40391. // be yes.
  40392. if (w || d || h) {
  40393. pError = true;
  40394. }
  40395. // Apply the rules for parsing floating-point number values to the descriptor.
  40396. // If the result is less than zero, let error be yes. Otherwise, let density
  40397. // be the result.
  40398. if (floatVal < 0) {
  40399. pError = true;
  40400. } else {
  40401. d = floatVal;
  40402. }
  40403. // If the descriptor consists of a valid non-negative integer followed by
  40404. // a U+0068 LATIN SMALL LETTER H character
  40405. } else if (regexNonNegativeInteger.test(value) && lastChar === "h") {
  40406. // If height and density are not both absent, then let error be yes.
  40407. if (h || d) {
  40408. pError = true;
  40409. }
  40410. // Apply the rules for parsing non-negative integers to the descriptor.
  40411. // If the result is zero, let error be yes. Otherwise, let future-compat-h
  40412. // be the result.
  40413. if (intVal === 0) {
  40414. pError = true;
  40415. } else {
  40416. h = intVal;
  40417. }
  40418. // Anything else, Let error be yes.
  40419. } else {
  40420. pError = true;
  40421. }
  40422. } // (close step 13 for loop)
  40423. // 15. If error is still no, then append a new image source to candidates whose
  40424. // URL is url, associated with a width width if not absent and a pixel
  40425. // density density if not absent. Otherwise, there is a parse error.
  40426. if (!pError) {
  40427. candidate.url = url;
  40428. if (w) {
  40429. candidate.w = w;
  40430. }
  40431. if (d) {
  40432. candidate.d = d;
  40433. }
  40434. if (h) {
  40435. candidate.h = h;
  40436. }
  40437. candidates.push(candidate);
  40438. } else if (console && console.log) {
  40439. console.log("Invalid srcset descriptor found in '" + input + "' at '" + desc + "'.");
  40440. }
  40441. } // (close parseDescriptors fn)
  40442. };
  40443. });
  40444. /***/ }),
  40445. /***/ 8799:
  40446. /***/ ((module) => {
  40447. var x = String;
  40448. var create = function create() {
  40449. return {
  40450. isColorSupported: false,
  40451. reset: x,
  40452. bold: x,
  40453. dim: x,
  40454. italic: x,
  40455. underline: x,
  40456. inverse: x,
  40457. hidden: x,
  40458. strikethrough: x,
  40459. black: x,
  40460. red: x,
  40461. green: x,
  40462. yellow: x,
  40463. blue: x,
  40464. magenta: x,
  40465. cyan: x,
  40466. white: x,
  40467. gray: x,
  40468. bgBlack: x,
  40469. bgRed: x,
  40470. bgGreen: x,
  40471. bgYellow: x,
  40472. bgBlue: x,
  40473. bgMagenta: x,
  40474. bgCyan: x,
  40475. bgWhite: x
  40476. };
  40477. };
  40478. module.exports = create();
  40479. module.exports.createColors = create;
  40480. /***/ }),
  40481. /***/ 8940:
  40482. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  40483. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  40484. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  40485. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
  40486. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  40487. function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
  40488. function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
  40489. function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
  40490. function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
  40491. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
  40492. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  40493. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
  40494. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
  40495. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  40496. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
  40497. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  40498. var Container = __webpack_require__(1204);
  40499. var AtRule = /*#__PURE__*/function (_Container) {
  40500. _inherits(AtRule, _Container);
  40501. var _super = _createSuper(AtRule);
  40502. function AtRule(defaults) {
  40503. var _this;
  40504. _classCallCheck(this, AtRule);
  40505. _this = _super.call(this, defaults);
  40506. _this.type = 'atrule';
  40507. return _this;
  40508. }
  40509. _createClass(AtRule, [{
  40510. key: "append",
  40511. value: function append() {
  40512. var _get2;
  40513. if (!this.proxyOf.nodes) this.nodes = [];
  40514. for (var _len = arguments.length, children = new Array(_len), _key = 0; _key < _len; _key++) {
  40515. children[_key] = arguments[_key];
  40516. }
  40517. return (_get2 = _get(_getPrototypeOf(AtRule.prototype), "append", this)).call.apply(_get2, [this].concat(children));
  40518. }
  40519. }, {
  40520. key: "prepend",
  40521. value: function prepend() {
  40522. var _get3;
  40523. if (!this.proxyOf.nodes) this.nodes = [];
  40524. for (var _len2 = arguments.length, children = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  40525. children[_key2] = arguments[_key2];
  40526. }
  40527. return (_get3 = _get(_getPrototypeOf(AtRule.prototype), "prepend", this)).call.apply(_get3, [this].concat(children));
  40528. }
  40529. }]);
  40530. return AtRule;
  40531. }(Container);
  40532. module.exports = AtRule;
  40533. AtRule["default"] = AtRule;
  40534. Container.registerAtRule(AtRule);
  40535. /***/ }),
  40536. /***/ 3102:
  40537. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  40538. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  40539. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
  40540. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  40541. function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
  40542. function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
  40543. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  40544. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
  40545. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  40546. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
  40547. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
  40548. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  40549. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
  40550. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  40551. var Node = __webpack_require__(4343);
  40552. var Comment = /*#__PURE__*/function (_Node) {
  40553. _inherits(Comment, _Node);
  40554. var _super = _createSuper(Comment);
  40555. function Comment(defaults) {
  40556. var _this;
  40557. _classCallCheck(this, Comment);
  40558. _this = _super.call(this, defaults);
  40559. _this.type = 'comment';
  40560. return _this;
  40561. }
  40562. return _createClass(Comment);
  40563. }(Node);
  40564. module.exports = Comment;
  40565. Comment["default"] = Comment;
  40566. /***/ }),
  40567. /***/ 1204:
  40568. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  40569. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  40570. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
  40571. function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  40572. function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
  40573. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
  40574. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  40575. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
  40576. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  40577. function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
  40578. function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
  40579. function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
  40580. function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
  40581. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
  40582. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  40583. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
  40584. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
  40585. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  40586. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
  40587. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  40588. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  40589. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  40590. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  40591. var _require = __webpack_require__(5506),
  40592. isClean = _require.isClean,
  40593. my = _require.my;
  40594. var Declaration = __webpack_require__(6417);
  40595. var Comment = __webpack_require__(3102);
  40596. var Node = __webpack_require__(4343);
  40597. var parse, Rule, AtRule, Root;
  40598. function cleanSource(nodes) {
  40599. return nodes.map(function (i) {
  40600. if (i.nodes) i.nodes = cleanSource(i.nodes);
  40601. delete i.source;
  40602. return i;
  40603. });
  40604. }
  40605. function markDirtyUp(node) {
  40606. node[isClean] = false;
  40607. if (node.proxyOf.nodes) {
  40608. var _iterator = _createForOfIteratorHelper(node.proxyOf.nodes),
  40609. _step;
  40610. try {
  40611. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  40612. var i = _step.value;
  40613. markDirtyUp(i);
  40614. }
  40615. } catch (err) {
  40616. _iterator.e(err);
  40617. } finally {
  40618. _iterator.f();
  40619. }
  40620. }
  40621. }
  40622. var Container = /*#__PURE__*/function (_Node) {
  40623. _inherits(Container, _Node);
  40624. var _super = _createSuper(Container);
  40625. function Container() {
  40626. _classCallCheck(this, Container);
  40627. return _super.apply(this, arguments);
  40628. }
  40629. _createClass(Container, [{
  40630. key: "push",
  40631. value: function push(child) {
  40632. child.parent = this;
  40633. this.proxyOf.nodes.push(child);
  40634. return this;
  40635. }
  40636. }, {
  40637. key: "each",
  40638. value: function each(callback) {
  40639. if (!this.proxyOf.nodes) return undefined;
  40640. var iterator = this.getIterator();
  40641. var index, result;
  40642. while (this.indexes[iterator] < this.proxyOf.nodes.length) {
  40643. index = this.indexes[iterator];
  40644. result = callback(this.proxyOf.nodes[index], index);
  40645. if (result === false) break;
  40646. this.indexes[iterator] += 1;
  40647. }
  40648. delete this.indexes[iterator];
  40649. return result;
  40650. }
  40651. }, {
  40652. key: "walk",
  40653. value: function walk(callback) {
  40654. return this.each(function (child, i) {
  40655. var result;
  40656. try {
  40657. result = callback(child, i);
  40658. } catch (e) {
  40659. throw child.addToError(e);
  40660. }
  40661. if (result !== false && child.walk) {
  40662. result = child.walk(callback);
  40663. }
  40664. return result;
  40665. });
  40666. }
  40667. }, {
  40668. key: "walkDecls",
  40669. value: function walkDecls(prop, callback) {
  40670. if (!callback) {
  40671. callback = prop;
  40672. return this.walk(function (child, i) {
  40673. if (child.type === 'decl') {
  40674. return callback(child, i);
  40675. }
  40676. });
  40677. }
  40678. if (prop instanceof RegExp) {
  40679. return this.walk(function (child, i) {
  40680. if (child.type === 'decl' && prop.test(child.prop)) {
  40681. return callback(child, i);
  40682. }
  40683. });
  40684. }
  40685. return this.walk(function (child, i) {
  40686. if (child.type === 'decl' && child.prop === prop) {
  40687. return callback(child, i);
  40688. }
  40689. });
  40690. }
  40691. }, {
  40692. key: "walkRules",
  40693. value: function walkRules(selector, callback) {
  40694. if (!callback) {
  40695. callback = selector;
  40696. return this.walk(function (child, i) {
  40697. if (child.type === 'rule') {
  40698. return callback(child, i);
  40699. }
  40700. });
  40701. }
  40702. if (selector instanceof RegExp) {
  40703. return this.walk(function (child, i) {
  40704. if (child.type === 'rule' && selector.test(child.selector)) {
  40705. return callback(child, i);
  40706. }
  40707. });
  40708. }
  40709. return this.walk(function (child, i) {
  40710. if (child.type === 'rule' && child.selector === selector) {
  40711. return callback(child, i);
  40712. }
  40713. });
  40714. }
  40715. }, {
  40716. key: "walkAtRules",
  40717. value: function walkAtRules(name, callback) {
  40718. if (!callback) {
  40719. callback = name;
  40720. return this.walk(function (child, i) {
  40721. if (child.type === 'atrule') {
  40722. return callback(child, i);
  40723. }
  40724. });
  40725. }
  40726. if (name instanceof RegExp) {
  40727. return this.walk(function (child, i) {
  40728. if (child.type === 'atrule' && name.test(child.name)) {
  40729. return callback(child, i);
  40730. }
  40731. });
  40732. }
  40733. return this.walk(function (child, i) {
  40734. if (child.type === 'atrule' && child.name === name) {
  40735. return callback(child, i);
  40736. }
  40737. });
  40738. }
  40739. }, {
  40740. key: "walkComments",
  40741. value: function walkComments(callback) {
  40742. return this.walk(function (child, i) {
  40743. if (child.type === 'comment') {
  40744. return callback(child, i);
  40745. }
  40746. });
  40747. }
  40748. }, {
  40749. key: "append",
  40750. value: function append() {
  40751. for (var _len = arguments.length, children = new Array(_len), _key = 0; _key < _len; _key++) {
  40752. children[_key] = arguments[_key];
  40753. }
  40754. for (var _i = 0, _children = children; _i < _children.length; _i++) {
  40755. var child = _children[_i];
  40756. var nodes = this.normalize(child, this.last);
  40757. var _iterator2 = _createForOfIteratorHelper(nodes),
  40758. _step2;
  40759. try {
  40760. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  40761. var node = _step2.value;
  40762. this.proxyOf.nodes.push(node);
  40763. }
  40764. } catch (err) {
  40765. _iterator2.e(err);
  40766. } finally {
  40767. _iterator2.f();
  40768. }
  40769. }
  40770. this.markDirty();
  40771. return this;
  40772. }
  40773. }, {
  40774. key: "prepend",
  40775. value: function prepend() {
  40776. for (var _len2 = arguments.length, children = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  40777. children[_key2] = arguments[_key2];
  40778. }
  40779. children = children.reverse();
  40780. var _iterator3 = _createForOfIteratorHelper(children),
  40781. _step3;
  40782. try {
  40783. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  40784. var child = _step3.value;
  40785. var nodes = this.normalize(child, this.first, 'prepend').reverse();
  40786. var _iterator4 = _createForOfIteratorHelper(nodes),
  40787. _step4;
  40788. try {
  40789. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  40790. var node = _step4.value;
  40791. this.proxyOf.nodes.unshift(node);
  40792. }
  40793. } catch (err) {
  40794. _iterator4.e(err);
  40795. } finally {
  40796. _iterator4.f();
  40797. }
  40798. for (var id in this.indexes) {
  40799. this.indexes[id] = this.indexes[id] + nodes.length;
  40800. }
  40801. }
  40802. } catch (err) {
  40803. _iterator3.e(err);
  40804. } finally {
  40805. _iterator3.f();
  40806. }
  40807. this.markDirty();
  40808. return this;
  40809. }
  40810. }, {
  40811. key: "cleanRaws",
  40812. value: function cleanRaws(keepBetween) {
  40813. _get(_getPrototypeOf(Container.prototype), "cleanRaws", this).call(this, keepBetween);
  40814. if (this.nodes) {
  40815. var _iterator5 = _createForOfIteratorHelper(this.nodes),
  40816. _step5;
  40817. try {
  40818. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  40819. var node = _step5.value;
  40820. node.cleanRaws(keepBetween);
  40821. }
  40822. } catch (err) {
  40823. _iterator5.e(err);
  40824. } finally {
  40825. _iterator5.f();
  40826. }
  40827. }
  40828. }
  40829. }, {
  40830. key: "insertBefore",
  40831. value: function insertBefore(exist, add) {
  40832. var existIndex = this.index(exist);
  40833. var type = existIndex === 0 ? 'prepend' : false;
  40834. var nodes = this.normalize(add, this.proxyOf.nodes[existIndex], type).reverse();
  40835. existIndex = this.index(exist);
  40836. var _iterator6 = _createForOfIteratorHelper(nodes),
  40837. _step6;
  40838. try {
  40839. for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
  40840. var node = _step6.value;
  40841. this.proxyOf.nodes.splice(existIndex, 0, node);
  40842. }
  40843. } catch (err) {
  40844. _iterator6.e(err);
  40845. } finally {
  40846. _iterator6.f();
  40847. }
  40848. var index;
  40849. for (var id in this.indexes) {
  40850. index = this.indexes[id];
  40851. if (existIndex <= index) {
  40852. this.indexes[id] = index + nodes.length;
  40853. }
  40854. }
  40855. this.markDirty();
  40856. return this;
  40857. }
  40858. }, {
  40859. key: "insertAfter",
  40860. value: function insertAfter(exist, add) {
  40861. var existIndex = this.index(exist);
  40862. var nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse();
  40863. existIndex = this.index(exist);
  40864. var _iterator7 = _createForOfIteratorHelper(nodes),
  40865. _step7;
  40866. try {
  40867. for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
  40868. var node = _step7.value;
  40869. this.proxyOf.nodes.splice(existIndex + 1, 0, node);
  40870. }
  40871. } catch (err) {
  40872. _iterator7.e(err);
  40873. } finally {
  40874. _iterator7.f();
  40875. }
  40876. var index;
  40877. for (var id in this.indexes) {
  40878. index = this.indexes[id];
  40879. if (existIndex < index) {
  40880. this.indexes[id] = index + nodes.length;
  40881. }
  40882. }
  40883. this.markDirty();
  40884. return this;
  40885. }
  40886. }, {
  40887. key: "removeChild",
  40888. value: function removeChild(child) {
  40889. child = this.index(child);
  40890. this.proxyOf.nodes[child].parent = undefined;
  40891. this.proxyOf.nodes.splice(child, 1);
  40892. var index;
  40893. for (var id in this.indexes) {
  40894. index = this.indexes[id];
  40895. if (index >= child) {
  40896. this.indexes[id] = index - 1;
  40897. }
  40898. }
  40899. this.markDirty();
  40900. return this;
  40901. }
  40902. }, {
  40903. key: "removeAll",
  40904. value: function removeAll() {
  40905. var _iterator8 = _createForOfIteratorHelper(this.proxyOf.nodes),
  40906. _step8;
  40907. try {
  40908. for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
  40909. var node = _step8.value;
  40910. node.parent = undefined;
  40911. }
  40912. } catch (err) {
  40913. _iterator8.e(err);
  40914. } finally {
  40915. _iterator8.f();
  40916. }
  40917. this.proxyOf.nodes = [];
  40918. this.markDirty();
  40919. return this;
  40920. }
  40921. }, {
  40922. key: "replaceValues",
  40923. value: function replaceValues(pattern, opts, callback) {
  40924. if (!callback) {
  40925. callback = opts;
  40926. opts = {};
  40927. }
  40928. this.walkDecls(function (decl) {
  40929. if (opts.props && !opts.props.includes(decl.prop)) return;
  40930. if (opts.fast && !decl.value.includes(opts.fast)) return;
  40931. decl.value = decl.value.replace(pattern, callback);
  40932. });
  40933. this.markDirty();
  40934. return this;
  40935. }
  40936. }, {
  40937. key: "every",
  40938. value: function every(condition) {
  40939. return this.nodes.every(condition);
  40940. }
  40941. }, {
  40942. key: "some",
  40943. value: function some(condition) {
  40944. return this.nodes.some(condition);
  40945. }
  40946. }, {
  40947. key: "index",
  40948. value: function index(child) {
  40949. if (typeof child === 'number') return child;
  40950. if (child.proxyOf) child = child.proxyOf;
  40951. return this.proxyOf.nodes.indexOf(child);
  40952. }
  40953. }, {
  40954. key: "first",
  40955. get: function get() {
  40956. if (!this.proxyOf.nodes) return undefined;
  40957. return this.proxyOf.nodes[0];
  40958. }
  40959. }, {
  40960. key: "last",
  40961. get: function get() {
  40962. if (!this.proxyOf.nodes) return undefined;
  40963. return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
  40964. }
  40965. }, {
  40966. key: "normalize",
  40967. value: function normalize(nodes, sample) {
  40968. var _this = this;
  40969. if (typeof nodes === 'string') {
  40970. nodes = cleanSource(parse(nodes).nodes);
  40971. } else if (Array.isArray(nodes)) {
  40972. nodes = nodes.slice(0);
  40973. var _iterator9 = _createForOfIteratorHelper(nodes),
  40974. _step9;
  40975. try {
  40976. for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
  40977. var i = _step9.value;
  40978. if (i.parent) i.parent.removeChild(i, 'ignore');
  40979. }
  40980. } catch (err) {
  40981. _iterator9.e(err);
  40982. } finally {
  40983. _iterator9.f();
  40984. }
  40985. } else if (nodes.type === 'root' && this.type !== 'document') {
  40986. nodes = nodes.nodes.slice(0);
  40987. var _iterator10 = _createForOfIteratorHelper(nodes),
  40988. _step10;
  40989. try {
  40990. for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
  40991. var _i2 = _step10.value;
  40992. if (_i2.parent) _i2.parent.removeChild(_i2, 'ignore');
  40993. }
  40994. } catch (err) {
  40995. _iterator10.e(err);
  40996. } finally {
  40997. _iterator10.f();
  40998. }
  40999. } else if (nodes.type) {
  41000. nodes = [nodes];
  41001. } else if (nodes.prop) {
  41002. if (typeof nodes.value === 'undefined') {
  41003. throw new Error('Value field is missed in node creation');
  41004. } else if (typeof nodes.value !== 'string') {
  41005. nodes.value = String(nodes.value);
  41006. }
  41007. nodes = [new Declaration(nodes)];
  41008. } else if (nodes.selector) {
  41009. nodes = [new Rule(nodes)];
  41010. } else if (nodes.name) {
  41011. nodes = [new AtRule(nodes)];
  41012. } else if (nodes.text) {
  41013. nodes = [new Comment(nodes)];
  41014. } else {
  41015. throw new Error('Unknown node type in node creation');
  41016. }
  41017. var processed = nodes.map(function (i) {
  41018. /* c8 ignore next */
  41019. if (!i[my]) Container.rebuild(i);
  41020. i = i.proxyOf;
  41021. if (i.parent) i.parent.removeChild(i);
  41022. if (i[isClean]) markDirtyUp(i);
  41023. if (typeof i.raws.before === 'undefined') {
  41024. if (sample && typeof sample.raws.before !== 'undefined') {
  41025. i.raws.before = sample.raws.before.replace(/\S/g, '');
  41026. }
  41027. }
  41028. i.parent = _this.proxyOf;
  41029. return i;
  41030. });
  41031. return processed;
  41032. }
  41033. }, {
  41034. key: "getProxyProcessor",
  41035. value: function getProxyProcessor() {
  41036. return {
  41037. set: function set(node, prop, value) {
  41038. if (node[prop] === value) return true;
  41039. node[prop] = value;
  41040. if (prop === 'name' || prop === 'params' || prop === 'selector') {
  41041. node.markDirty();
  41042. }
  41043. return true;
  41044. },
  41045. get: function get(node, prop) {
  41046. if (prop === 'proxyOf') {
  41047. return node;
  41048. } else if (!node[prop]) {
  41049. return node[prop];
  41050. } else if (prop === 'each' || typeof prop === 'string' && prop.startsWith('walk')) {
  41051. return function () {
  41052. for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  41053. args[_key3] = arguments[_key3];
  41054. }
  41055. return node[prop].apply(node, _toConsumableArray(args.map(function (i) {
  41056. if (typeof i === 'function') {
  41057. return function (child, index) {
  41058. return i(child.toProxy(), index);
  41059. };
  41060. } else {
  41061. return i;
  41062. }
  41063. })));
  41064. };
  41065. } else if (prop === 'every' || prop === 'some') {
  41066. return function (cb) {
  41067. return node[prop](function (child) {
  41068. for (var _len4 = arguments.length, other = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
  41069. other[_key4 - 1] = arguments[_key4];
  41070. }
  41071. return cb.apply(void 0, [child.toProxy()].concat(other));
  41072. });
  41073. };
  41074. } else if (prop === 'root') {
  41075. return function () {
  41076. return node.root().toProxy();
  41077. };
  41078. } else if (prop === 'nodes') {
  41079. return node.nodes.map(function (i) {
  41080. return i.toProxy();
  41081. });
  41082. } else if (prop === 'first' || prop === 'last') {
  41083. return node[prop].toProxy();
  41084. } else {
  41085. return node[prop];
  41086. }
  41087. }
  41088. };
  41089. }
  41090. }, {
  41091. key: "getIterator",
  41092. value: function getIterator() {
  41093. if (!this.lastEach) this.lastEach = 0;
  41094. if (!this.indexes) this.indexes = {};
  41095. this.lastEach += 1;
  41096. var iterator = this.lastEach;
  41097. this.indexes[iterator] = 0;
  41098. return iterator;
  41099. }
  41100. }]);
  41101. return Container;
  41102. }(Node);
  41103. Container.registerParse = function (dependant) {
  41104. parse = dependant;
  41105. };
  41106. Container.registerRule = function (dependant) {
  41107. Rule = dependant;
  41108. };
  41109. Container.registerAtRule = function (dependant) {
  41110. AtRule = dependant;
  41111. };
  41112. Container.registerRoot = function (dependant) {
  41113. Root = dependant;
  41114. };
  41115. module.exports = Container;
  41116. Container["default"] = Container;
  41117. /* c8 ignore start */
  41118. Container.rebuild = function (node) {
  41119. if (node.type === 'atrule') {
  41120. Object.setPrototypeOf(node, AtRule.prototype);
  41121. } else if (node.type === 'rule') {
  41122. Object.setPrototypeOf(node, Rule.prototype);
  41123. } else if (node.type === 'decl') {
  41124. Object.setPrototypeOf(node, Declaration.prototype);
  41125. } else if (node.type === 'comment') {
  41126. Object.setPrototypeOf(node, Comment.prototype);
  41127. } else if (node.type === 'root') {
  41128. Object.setPrototypeOf(node, Root.prototype);
  41129. }
  41130. node[my] = true;
  41131. if (node.nodes) {
  41132. node.nodes.forEach(function (child) {
  41133. Container.rebuild(child);
  41134. });
  41135. }
  41136. };
  41137. /* c8 ignore stop */
  41138. /***/ }),
  41139. /***/ 1667:
  41140. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  41141. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  41142. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  41143. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
  41144. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  41145. function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
  41146. function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
  41147. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
  41148. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
  41149. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
  41150. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  41151. function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
  41152. function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
  41153. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
  41154. function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
  41155. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  41156. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  41157. var pico = __webpack_require__(8799);
  41158. var terminalHighlight = __webpack_require__(2868);
  41159. var CssSyntaxError = /*#__PURE__*/function (_Error) {
  41160. _inherits(CssSyntaxError, _Error);
  41161. var _super = _createSuper(CssSyntaxError);
  41162. function CssSyntaxError(message, line, column, source, file, plugin) {
  41163. var _this;
  41164. _classCallCheck(this, CssSyntaxError);
  41165. _this = _super.call(this, message);
  41166. _this.name = 'CssSyntaxError';
  41167. _this.reason = message;
  41168. if (file) {
  41169. _this.file = file;
  41170. }
  41171. if (source) {
  41172. _this.source = source;
  41173. }
  41174. if (plugin) {
  41175. _this.plugin = plugin;
  41176. }
  41177. if (typeof line !== 'undefined' && typeof column !== 'undefined') {
  41178. if (typeof line === 'number') {
  41179. _this.line = line;
  41180. _this.column = column;
  41181. } else {
  41182. _this.line = line.line;
  41183. _this.column = line.column;
  41184. _this.endLine = column.line;
  41185. _this.endColumn = column.column;
  41186. }
  41187. }
  41188. _this.setMessage();
  41189. if (Error.captureStackTrace) {
  41190. Error.captureStackTrace(_assertThisInitialized(_this), CssSyntaxError);
  41191. }
  41192. return _this;
  41193. }
  41194. _createClass(CssSyntaxError, [{
  41195. key: "setMessage",
  41196. value: function setMessage() {
  41197. this.message = this.plugin ? this.plugin + ': ' : '';
  41198. this.message += this.file ? this.file : '<css input>';
  41199. if (typeof this.line !== 'undefined') {
  41200. this.message += ':' + this.line + ':' + this.column;
  41201. }
  41202. this.message += ': ' + this.reason;
  41203. }
  41204. }, {
  41205. key: "showSourceCode",
  41206. value: function showSourceCode(color) {
  41207. var _this2 = this;
  41208. if (!this.source) return '';
  41209. var css = this.source;
  41210. if (color == null) color = pico.isColorSupported;
  41211. if (terminalHighlight) {
  41212. if (color) css = terminalHighlight(css);
  41213. }
  41214. var lines = css.split(/\r?\n/);
  41215. var start = Math.max(this.line - 3, 0);
  41216. var end = Math.min(this.line + 2, lines.length);
  41217. var maxWidth = String(end).length;
  41218. var mark, aside;
  41219. if (color) {
  41220. var _pico$createColors = pico.createColors(true),
  41221. bold = _pico$createColors.bold,
  41222. red = _pico$createColors.red,
  41223. gray = _pico$createColors.gray;
  41224. mark = function mark(text) {
  41225. return bold(red(text));
  41226. };
  41227. aside = function aside(text) {
  41228. return gray(text);
  41229. };
  41230. } else {
  41231. mark = aside = function aside(str) {
  41232. return str;
  41233. };
  41234. }
  41235. return lines.slice(start, end).map(function (line, index) {
  41236. var number = start + 1 + index;
  41237. var gutter = ' ' + (' ' + number).slice(-maxWidth) + ' | ';
  41238. if (number === _this2.line) {
  41239. var spacing = aside(gutter.replace(/\d/g, ' ')) + line.slice(0, _this2.column - 1).replace(/[^\t]/g, ' ');
  41240. return mark('>') + aside(gutter) + line + '\n ' + spacing + mark('^');
  41241. }
  41242. return ' ' + aside(gutter) + line;
  41243. }).join('\n');
  41244. }
  41245. }, {
  41246. key: "toString",
  41247. value: function toString() {
  41248. var code = this.showSourceCode();
  41249. if (code) {
  41250. code = '\n\n' + code + '\n';
  41251. }
  41252. return this.name + ': ' + this.message + code;
  41253. }
  41254. }]);
  41255. return CssSyntaxError;
  41256. }( /*#__PURE__*/_wrapNativeSuper(Error));
  41257. module.exports = CssSyntaxError;
  41258. CssSyntaxError["default"] = CssSyntaxError;
  41259. /***/ }),
  41260. /***/ 6417:
  41261. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  41262. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  41263. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  41264. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  41265. function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  41266. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  41267. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
  41268. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  41269. function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
  41270. function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
  41271. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
  41272. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  41273. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
  41274. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
  41275. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  41276. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
  41277. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  41278. var Node = __webpack_require__(4343);
  41279. var Declaration = /*#__PURE__*/function (_Node) {
  41280. _inherits(Declaration, _Node);
  41281. var _super = _createSuper(Declaration);
  41282. function Declaration(defaults) {
  41283. var _this;
  41284. _classCallCheck(this, Declaration);
  41285. if (defaults && typeof defaults.value !== 'undefined' && typeof defaults.value !== 'string') {
  41286. defaults = _objectSpread(_objectSpread({}, defaults), {}, {
  41287. value: String(defaults.value)
  41288. });
  41289. }
  41290. _this = _super.call(this, defaults);
  41291. _this.type = 'decl';
  41292. return _this;
  41293. }
  41294. _createClass(Declaration, [{
  41295. key: "variable",
  41296. get: function get() {
  41297. return this.prop.startsWith('--') || this.prop[0] === '$';
  41298. }
  41299. }]);
  41300. return Declaration;
  41301. }(Node);
  41302. module.exports = Declaration;
  41303. Declaration["default"] = Declaration;
  41304. /***/ }),
  41305. /***/ 7083:
  41306. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  41307. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  41308. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  41309. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  41310. function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  41311. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  41312. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
  41313. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  41314. function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
  41315. function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
  41316. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
  41317. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  41318. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
  41319. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
  41320. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  41321. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
  41322. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  41323. var Container = __webpack_require__(1204);
  41324. var LazyResult, Processor;
  41325. var Document = /*#__PURE__*/function (_Container) {
  41326. _inherits(Document, _Container);
  41327. var _super = _createSuper(Document);
  41328. function Document(defaults) {
  41329. var _this;
  41330. _classCallCheck(this, Document);
  41331. // type needs to be passed to super, otherwise child roots won't be normalized correctly
  41332. _this = _super.call(this, _objectSpread({
  41333. type: 'document'
  41334. }, defaults));
  41335. if (!_this.nodes) {
  41336. _this.nodes = [];
  41337. }
  41338. return _this;
  41339. }
  41340. _createClass(Document, [{
  41341. key: "toResult",
  41342. value: function toResult() {
  41343. var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  41344. var lazy = new LazyResult(new Processor(), this, opts);
  41345. return lazy.stringify();
  41346. }
  41347. }]);
  41348. return Document;
  41349. }(Container);
  41350. Document.registerLazyResult = function (dependant) {
  41351. LazyResult = dependant;
  41352. };
  41353. Document.registerProcessor = function (dependant) {
  41354. Processor = dependant;
  41355. };
  41356. module.exports = Document;
  41357. Document["default"] = Document;
  41358. /***/ }),
  41359. /***/ 9295:
  41360. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  41361. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  41362. var _excluded = ["inputs"],
  41363. _excluded2 = ["inputId"];
  41364. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  41365. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  41366. function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  41367. function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
  41368. function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
  41369. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  41370. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  41371. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  41372. function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
  41373. function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
  41374. var Declaration = __webpack_require__(6417);
  41375. var PreviousMap = __webpack_require__(3353);
  41376. var Comment = __webpack_require__(3102);
  41377. var AtRule = __webpack_require__(8940);
  41378. var Input = __webpack_require__(2993);
  41379. var Root = __webpack_require__(7563);
  41380. var Rule = __webpack_require__(6621);
  41381. function fromJSON(json, inputs) {
  41382. if (Array.isArray(json)) return json.map(function (n) {
  41383. return fromJSON(n);
  41384. });
  41385. var ownInputs = json.inputs,
  41386. defaults = _objectWithoutProperties(json, _excluded);
  41387. if (ownInputs) {
  41388. inputs = [];
  41389. var _iterator = _createForOfIteratorHelper(ownInputs),
  41390. _step;
  41391. try {
  41392. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  41393. var input = _step.value;
  41394. var inputHydrated = _objectSpread(_objectSpread({}, input), {}, {
  41395. __proto__: Input.prototype
  41396. });
  41397. if (inputHydrated.map) {
  41398. inputHydrated.map = _objectSpread(_objectSpread({}, inputHydrated.map), {}, {
  41399. __proto__: PreviousMap.prototype
  41400. });
  41401. }
  41402. inputs.push(inputHydrated);
  41403. }
  41404. } catch (err) {
  41405. _iterator.e(err);
  41406. } finally {
  41407. _iterator.f();
  41408. }
  41409. }
  41410. if (defaults.nodes) {
  41411. defaults.nodes = json.nodes.map(function (n) {
  41412. return fromJSON(n, inputs);
  41413. });
  41414. }
  41415. if (defaults.source) {
  41416. var _defaults$source = defaults.source,
  41417. inputId = _defaults$source.inputId,
  41418. source = _objectWithoutProperties(_defaults$source, _excluded2);
  41419. defaults.source = source;
  41420. if (inputId != null) {
  41421. defaults.source.input = inputs[inputId];
  41422. }
  41423. }
  41424. if (defaults.type === 'root') {
  41425. return new Root(defaults);
  41426. } else if (defaults.type === 'decl') {
  41427. return new Declaration(defaults);
  41428. } else if (defaults.type === 'rule') {
  41429. return new Rule(defaults);
  41430. } else if (defaults.type === 'comment') {
  41431. return new Comment(defaults);
  41432. } else if (defaults.type === 'atrule') {
  41433. return new AtRule(defaults);
  41434. } else {
  41435. throw new Error('Unknown node type: ' + json.type);
  41436. }
  41437. }
  41438. module.exports = fromJSON;
  41439. fromJSON["default"] = fromJSON;
  41440. /***/ }),
  41441. /***/ 2993:
  41442. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  41443. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  41444. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  41445. function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  41446. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  41447. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  41448. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
  41449. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  41450. function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
  41451. function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
  41452. var _require = __webpack_require__(209),
  41453. SourceMapConsumer = _require.SourceMapConsumer,
  41454. SourceMapGenerator = _require.SourceMapGenerator;
  41455. var _require2 = __webpack_require__(7414),
  41456. fileURLToPath = _require2.fileURLToPath,
  41457. pathToFileURL = _require2.pathToFileURL;
  41458. var _require3 = __webpack_require__(9830),
  41459. resolve = _require3.resolve,
  41460. isAbsolute = _require3.isAbsolute;
  41461. var _require4 = __webpack_require__(2961),
  41462. nanoid = _require4.nanoid;
  41463. var terminalHighlight = __webpack_require__(2868);
  41464. var CssSyntaxError = __webpack_require__(1667);
  41465. var PreviousMap = __webpack_require__(3353);
  41466. var fromOffsetCache = Symbol('fromOffsetCache');
  41467. var sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
  41468. var pathAvailable = Boolean(resolve && isAbsolute);
  41469. var Input = /*#__PURE__*/function () {
  41470. function Input(css) {
  41471. var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  41472. _classCallCheck(this, Input);
  41473. if (css === null || typeof css === 'undefined' || _typeof(css) === 'object' && !css.toString) {
  41474. throw new Error("PostCSS received ".concat(css, " instead of CSS string"));
  41475. }
  41476. this.css = css.toString();
  41477. if (this.css[0] === "\uFEFF" || this.css[0] === "\uFFFE") {
  41478. this.hasBOM = true;
  41479. this.css = this.css.slice(1);
  41480. } else {
  41481. this.hasBOM = false;
  41482. }
  41483. if (opts.from) {
  41484. if (!pathAvailable || /^\w+:\/\//.test(opts.from) || isAbsolute(opts.from)) {
  41485. this.file = opts.from;
  41486. } else {
  41487. this.file = resolve(opts.from);
  41488. }
  41489. }
  41490. if (pathAvailable && sourceMapAvailable) {
  41491. var map = new PreviousMap(this.css, opts);
  41492. if (map.text) {
  41493. this.map = map;
  41494. var file = map.consumer().file;
  41495. if (!this.file && file) this.file = this.mapResolve(file);
  41496. }
  41497. }
  41498. if (!this.file) {
  41499. this.id = '<input css ' + nanoid(6) + '>';
  41500. }
  41501. if (this.map) this.map.file = this.from;
  41502. }
  41503. _createClass(Input, [{
  41504. key: "fromOffset",
  41505. value: function fromOffset(offset) {
  41506. var lastLine, lineToIndex;
  41507. if (!this[fromOffsetCache]) {
  41508. var lines = this.css.split('\n');
  41509. lineToIndex = new Array(lines.length);
  41510. var prevIndex = 0;
  41511. for (var i = 0, l = lines.length; i < l; i++) {
  41512. lineToIndex[i] = prevIndex;
  41513. prevIndex += lines[i].length + 1;
  41514. }
  41515. this[fromOffsetCache] = lineToIndex;
  41516. } else {
  41517. lineToIndex = this[fromOffsetCache];
  41518. }
  41519. lastLine = lineToIndex[lineToIndex.length - 1];
  41520. var min = 0;
  41521. if (offset >= lastLine) {
  41522. min = lineToIndex.length - 1;
  41523. } else {
  41524. var max = lineToIndex.length - 2;
  41525. var mid;
  41526. while (min < max) {
  41527. mid = min + (max - min >> 1);
  41528. if (offset < lineToIndex[mid]) {
  41529. max = mid - 1;
  41530. } else if (offset >= lineToIndex[mid + 1]) {
  41531. min = mid + 1;
  41532. } else {
  41533. min = mid;
  41534. break;
  41535. }
  41536. }
  41537. }
  41538. return {
  41539. line: min + 1,
  41540. col: offset - lineToIndex[min] + 1
  41541. };
  41542. }
  41543. }, {
  41544. key: "error",
  41545. value: function error(message, line, column) {
  41546. var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  41547. var result, endLine, endColumn;
  41548. if (line && _typeof(line) === 'object') {
  41549. var start = line;
  41550. var end = column;
  41551. if (typeof start.offset === 'number') {
  41552. var pos = this.fromOffset(start.offset);
  41553. line = pos.line;
  41554. column = pos.col;
  41555. } else {
  41556. line = start.line;
  41557. column = start.column;
  41558. }
  41559. if (typeof end.offset === 'number') {
  41560. var _pos = this.fromOffset(end.offset);
  41561. endLine = _pos.line;
  41562. endColumn = _pos.col;
  41563. } else {
  41564. endLine = end.line;
  41565. endColumn = end.column;
  41566. }
  41567. } else if (!column) {
  41568. var _pos2 = this.fromOffset(line);
  41569. line = _pos2.line;
  41570. column = _pos2.col;
  41571. }
  41572. var origin = this.origin(line, column, endLine, endColumn);
  41573. if (origin) {
  41574. result = new CssSyntaxError(message, origin.endLine === undefined ? origin.line : {
  41575. line: origin.line,
  41576. column: origin.column
  41577. }, origin.endLine === undefined ? origin.column : {
  41578. line: origin.endLine,
  41579. column: origin.endColumn
  41580. }, origin.source, origin.file, opts.plugin);
  41581. } else {
  41582. result = new CssSyntaxError(message, endLine === undefined ? line : {
  41583. line: line,
  41584. column: column
  41585. }, endLine === undefined ? column : {
  41586. line: endLine,
  41587. column: endColumn
  41588. }, this.css, this.file, opts.plugin);
  41589. }
  41590. result.input = {
  41591. line: line,
  41592. column: column,
  41593. endLine: endLine,
  41594. endColumn: endColumn,
  41595. source: this.css
  41596. };
  41597. if (this.file) {
  41598. if (pathToFileURL) {
  41599. result.input.url = pathToFileURL(this.file).toString();
  41600. }
  41601. result.input.file = this.file;
  41602. }
  41603. return result;
  41604. }
  41605. }, {
  41606. key: "origin",
  41607. value: function origin(line, column, endLine, endColumn) {
  41608. if (!this.map) return false;
  41609. var consumer = this.map.consumer();
  41610. var from = consumer.originalPositionFor({
  41611. line: line,
  41612. column: column
  41613. });
  41614. if (!from.source) return false;
  41615. var to;
  41616. if (typeof endLine === 'number') {
  41617. to = consumer.originalPositionFor({
  41618. line: endLine,
  41619. column: endColumn
  41620. });
  41621. }
  41622. var fromUrl;
  41623. if (isAbsolute(from.source)) {
  41624. fromUrl = pathToFileURL(from.source);
  41625. } else {
  41626. fromUrl = new URL(from.source, this.map.consumer().sourceRoot || pathToFileURL(this.map.mapFile));
  41627. }
  41628. var result = {
  41629. url: fromUrl.toString(),
  41630. line: from.line,
  41631. column: from.column,
  41632. endLine: to && to.line,
  41633. endColumn: to && to.column
  41634. };
  41635. if (fromUrl.protocol === 'file:') {
  41636. if (fileURLToPath) {
  41637. result.file = fileURLToPath(fromUrl);
  41638. } else {
  41639. /* c8 ignore next 2 */
  41640. throw new Error("file: protocol is not available in this PostCSS build");
  41641. }
  41642. }
  41643. var source = consumer.sourceContentFor(from.source);
  41644. if (source) result.source = source;
  41645. return result;
  41646. }
  41647. }, {
  41648. key: "mapResolve",
  41649. value: function mapResolve(file) {
  41650. if (/^\w+:\/\//.test(file)) {
  41651. return file;
  41652. }
  41653. return resolve(this.map.consumer().sourceRoot || this.map.root || '.', file);
  41654. }
  41655. }, {
  41656. key: "from",
  41657. get: function get() {
  41658. return this.file || this.id;
  41659. }
  41660. }, {
  41661. key: "toJSON",
  41662. value: function toJSON() {
  41663. var json = {};
  41664. for (var _i = 0, _arr = ['hasBOM', 'css', 'file', 'id']; _i < _arr.length; _i++) {
  41665. var name = _arr[_i];
  41666. if (this[name] != null) {
  41667. json[name] = this[name];
  41668. }
  41669. }
  41670. if (this.map) {
  41671. json.map = _objectSpread({}, this.map);
  41672. if (json.map.consumerCache) {
  41673. json.map.consumerCache = undefined;
  41674. }
  41675. }
  41676. return json;
  41677. }
  41678. }]);
  41679. return Input;
  41680. }();
  41681. module.exports = Input;
  41682. Input["default"] = Input;
  41683. if (terminalHighlight && terminalHighlight.registerInput) {
  41684. terminalHighlight.registerInput(Input);
  41685. }
  41686. /***/ }),
  41687. /***/ 6992:
  41688. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  41689. function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
  41690. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  41691. function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  41692. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  41693. function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  41694. function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
  41695. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  41696. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  41697. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  41698. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  41699. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  41700. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  41701. function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  41702. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  41703. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
  41704. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  41705. function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
  41706. function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
  41707. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  41708. var _require = __webpack_require__(5506),
  41709. isClean = _require.isClean,
  41710. my = _require.my;
  41711. var MapGenerator = __webpack_require__(8991);
  41712. var _stringify = __webpack_require__(6157);
  41713. var Container = __webpack_require__(1204);
  41714. var Document = __webpack_require__(7083);
  41715. var warnOnce = __webpack_require__(6574);
  41716. var Result = __webpack_require__(6865);
  41717. var parse = __webpack_require__(7057);
  41718. var Root = __webpack_require__(7563);
  41719. var TYPE_TO_CLASS_NAME = {
  41720. document: 'Document',
  41721. root: 'Root',
  41722. atrule: 'AtRule',
  41723. rule: 'Rule',
  41724. decl: 'Declaration',
  41725. comment: 'Comment'
  41726. };
  41727. var PLUGIN_PROPS = {
  41728. postcssPlugin: true,
  41729. prepare: true,
  41730. Once: true,
  41731. Document: true,
  41732. Root: true,
  41733. Declaration: true,
  41734. Rule: true,
  41735. AtRule: true,
  41736. Comment: true,
  41737. DeclarationExit: true,
  41738. RuleExit: true,
  41739. AtRuleExit: true,
  41740. CommentExit: true,
  41741. RootExit: true,
  41742. DocumentExit: true,
  41743. OnceExit: true
  41744. };
  41745. var NOT_VISITORS = {
  41746. postcssPlugin: true,
  41747. prepare: true,
  41748. Once: true
  41749. };
  41750. var CHILDREN = 0;
  41751. function isPromise(obj) {
  41752. return _typeof(obj) === 'object' && typeof obj.then === 'function';
  41753. }
  41754. function getEvents(node) {
  41755. var key = false;
  41756. var type = TYPE_TO_CLASS_NAME[node.type];
  41757. if (node.type === 'decl') {
  41758. key = node.prop.toLowerCase();
  41759. } else if (node.type === 'atrule') {
  41760. key = node.name.toLowerCase();
  41761. }
  41762. if (key && node.append) {
  41763. return [type, type + '-' + key, CHILDREN, type + 'Exit', type + 'Exit-' + key];
  41764. } else if (key) {
  41765. return [type, type + '-' + key, type + 'Exit', type + 'Exit-' + key];
  41766. } else if (node.append) {
  41767. return [type, CHILDREN, type + 'Exit'];
  41768. } else {
  41769. return [type, type + 'Exit'];
  41770. }
  41771. }
  41772. function toStack(node) {
  41773. var events;
  41774. if (node.type === 'document') {
  41775. events = ['Document', CHILDREN, 'DocumentExit'];
  41776. } else if (node.type === 'root') {
  41777. events = ['Root', CHILDREN, 'RootExit'];
  41778. } else {
  41779. events = getEvents(node);
  41780. }
  41781. return {
  41782. node: node,
  41783. events: events,
  41784. eventIndex: 0,
  41785. visitors: [],
  41786. visitorIndex: 0,
  41787. iterator: 0
  41788. };
  41789. }
  41790. function cleanMarks(node) {
  41791. node[isClean] = false;
  41792. if (node.nodes) node.nodes.forEach(function (i) {
  41793. return cleanMarks(i);
  41794. });
  41795. return node;
  41796. }
  41797. var postcss = {};
  41798. var LazyResult = /*#__PURE__*/function (_Symbol$toStringTag) {
  41799. function LazyResult(processor, css, opts) {
  41800. var _this = this;
  41801. _classCallCheck(this, LazyResult);
  41802. this.stringified = false;
  41803. this.processed = false;
  41804. var root;
  41805. if (_typeof(css) === 'object' && css !== null && (css.type === 'root' || css.type === 'document')) {
  41806. root = cleanMarks(css);
  41807. } else if (css instanceof LazyResult || css instanceof Result) {
  41808. root = cleanMarks(css.root);
  41809. if (css.map) {
  41810. if (typeof opts.map === 'undefined') opts.map = {};
  41811. if (!opts.map.inline) opts.map.inline = false;
  41812. opts.map.prev = css.map;
  41813. }
  41814. } else {
  41815. var parser = parse;
  41816. if (opts.syntax) parser = opts.syntax.parse;
  41817. if (opts.parser) parser = opts.parser;
  41818. if (parser.parse) parser = parser.parse;
  41819. try {
  41820. root = parser(css, opts);
  41821. } catch (error) {
  41822. this.processed = true;
  41823. this.error = error;
  41824. }
  41825. if (root && !root[my]) {
  41826. /* c8 ignore next 2 */
  41827. Container.rebuild(root);
  41828. }
  41829. }
  41830. this.result = new Result(processor, root, opts);
  41831. this.helpers = _objectSpread(_objectSpread({}, postcss), {}, {
  41832. result: this.result,
  41833. postcss: postcss
  41834. });
  41835. this.plugins = this.processor.plugins.map(function (plugin) {
  41836. if (_typeof(plugin) === 'object' && plugin.prepare) {
  41837. return _objectSpread(_objectSpread({}, plugin), plugin.prepare(_this.result));
  41838. } else {
  41839. return plugin;
  41840. }
  41841. });
  41842. }
  41843. _createClass(LazyResult, [{
  41844. key: _Symbol$toStringTag,
  41845. get: function get() {
  41846. return 'LazyResult';
  41847. }
  41848. }, {
  41849. key: "processor",
  41850. get: function get() {
  41851. return this.result.processor;
  41852. }
  41853. }, {
  41854. key: "opts",
  41855. get: function get() {
  41856. return this.result.opts;
  41857. }
  41858. }, {
  41859. key: "css",
  41860. get: function get() {
  41861. return this.stringify().css;
  41862. }
  41863. }, {
  41864. key: "content",
  41865. get: function get() {
  41866. return this.stringify().content;
  41867. }
  41868. }, {
  41869. key: "map",
  41870. get: function get() {
  41871. return this.stringify().map;
  41872. }
  41873. }, {
  41874. key: "root",
  41875. get: function get() {
  41876. return this.sync().root;
  41877. }
  41878. }, {
  41879. key: "messages",
  41880. get: function get() {
  41881. return this.sync().messages;
  41882. }
  41883. }, {
  41884. key: "warnings",
  41885. value: function warnings() {
  41886. return this.sync().warnings();
  41887. }
  41888. }, {
  41889. key: "toString",
  41890. value: function toString() {
  41891. return this.css;
  41892. }
  41893. }, {
  41894. key: "then",
  41895. value: function then(onFulfilled, onRejected) {
  41896. if (false) {}
  41897. return this.async().then(onFulfilled, onRejected);
  41898. }
  41899. }, {
  41900. key: "catch",
  41901. value: function _catch(onRejected) {
  41902. return this.async()["catch"](onRejected);
  41903. }
  41904. }, {
  41905. key: "finally",
  41906. value: function _finally(onFinally) {
  41907. return this.async().then(onFinally, onFinally);
  41908. }
  41909. }, {
  41910. key: "async",
  41911. value: function async() {
  41912. if (this.error) return Promise.reject(this.error);
  41913. if (this.processed) return Promise.resolve(this.result);
  41914. if (!this.processing) {
  41915. this.processing = this.runAsync();
  41916. }
  41917. return this.processing;
  41918. }
  41919. }, {
  41920. key: "sync",
  41921. value: function sync() {
  41922. if (this.error) throw this.error;
  41923. if (this.processed) return this.result;
  41924. this.processed = true;
  41925. if (this.processing) {
  41926. throw this.getAsyncError();
  41927. }
  41928. var _iterator = _createForOfIteratorHelper(this.plugins),
  41929. _step;
  41930. try {
  41931. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  41932. var plugin = _step.value;
  41933. var promise = this.runOnRoot(plugin);
  41934. if (isPromise(promise)) {
  41935. throw this.getAsyncError();
  41936. }
  41937. }
  41938. } catch (err) {
  41939. _iterator.e(err);
  41940. } finally {
  41941. _iterator.f();
  41942. }
  41943. this.prepareVisitors();
  41944. if (this.hasListener) {
  41945. var root = this.result.root;
  41946. while (!root[isClean]) {
  41947. root[isClean] = true;
  41948. this.walkSync(root);
  41949. }
  41950. if (this.listeners.OnceExit) {
  41951. if (root.type === 'document') {
  41952. var _iterator2 = _createForOfIteratorHelper(root.nodes),
  41953. _step2;
  41954. try {
  41955. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  41956. var subRoot = _step2.value;
  41957. this.visitSync(this.listeners.OnceExit, subRoot);
  41958. }
  41959. } catch (err) {
  41960. _iterator2.e(err);
  41961. } finally {
  41962. _iterator2.f();
  41963. }
  41964. } else {
  41965. this.visitSync(this.listeners.OnceExit, root);
  41966. }
  41967. }
  41968. }
  41969. return this.result;
  41970. }
  41971. }, {
  41972. key: "stringify",
  41973. value: function stringify() {
  41974. if (this.error) throw this.error;
  41975. if (this.stringified) return this.result;
  41976. this.stringified = true;
  41977. this.sync();
  41978. var opts = this.result.opts;
  41979. var str = _stringify;
  41980. if (opts.syntax) str = opts.syntax.stringify;
  41981. if (opts.stringifier) str = opts.stringifier;
  41982. if (str.stringify) str = str.stringify;
  41983. var map = new MapGenerator(str, this.result.root, this.result.opts);
  41984. var data = map.generate();
  41985. this.result.css = data[0];
  41986. this.result.map = data[1];
  41987. return this.result;
  41988. }
  41989. }, {
  41990. key: "walkSync",
  41991. value: function walkSync(node) {
  41992. var _this2 = this;
  41993. node[isClean] = true;
  41994. var events = getEvents(node);
  41995. var _iterator3 = _createForOfIteratorHelper(events),
  41996. _step3;
  41997. try {
  41998. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  41999. var event = _step3.value;
  42000. if (event === CHILDREN) {
  42001. if (node.nodes) {
  42002. node.each(function (child) {
  42003. if (!child[isClean]) _this2.walkSync(child);
  42004. });
  42005. }
  42006. } else {
  42007. var visitors = this.listeners[event];
  42008. if (visitors) {
  42009. if (this.visitSync(visitors, node.toProxy())) return;
  42010. }
  42011. }
  42012. }
  42013. } catch (err) {
  42014. _iterator3.e(err);
  42015. } finally {
  42016. _iterator3.f();
  42017. }
  42018. }
  42019. }, {
  42020. key: "visitSync",
  42021. value: function visitSync(visitors, node) {
  42022. var _iterator4 = _createForOfIteratorHelper(visitors),
  42023. _step4;
  42024. try {
  42025. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  42026. var _step4$value = _slicedToArray(_step4.value, 2),
  42027. plugin = _step4$value[0],
  42028. visitor = _step4$value[1];
  42029. this.result.lastPlugin = plugin;
  42030. var promise = void 0;
  42031. try {
  42032. promise = visitor(node, this.helpers);
  42033. } catch (e) {
  42034. throw this.handleError(e, node.proxyOf);
  42035. }
  42036. if (node.type !== 'root' && node.type !== 'document' && !node.parent) {
  42037. return true;
  42038. }
  42039. if (isPromise(promise)) {
  42040. throw this.getAsyncError();
  42041. }
  42042. }
  42043. } catch (err) {
  42044. _iterator4.e(err);
  42045. } finally {
  42046. _iterator4.f();
  42047. }
  42048. }
  42049. }, {
  42050. key: "runOnRoot",
  42051. value: function runOnRoot(plugin) {
  42052. var _this3 = this;
  42053. this.result.lastPlugin = plugin;
  42054. try {
  42055. if (_typeof(plugin) === 'object' && plugin.Once) {
  42056. if (this.result.root.type === 'document') {
  42057. var roots = this.result.root.nodes.map(function (root) {
  42058. return plugin.Once(root, _this3.helpers);
  42059. });
  42060. if (isPromise(roots[0])) {
  42061. return Promise.all(roots);
  42062. }
  42063. return roots;
  42064. }
  42065. return plugin.Once(this.result.root, this.helpers);
  42066. } else if (typeof plugin === 'function') {
  42067. return plugin(this.result.root, this.result);
  42068. }
  42069. } catch (error) {
  42070. throw this.handleError(error);
  42071. }
  42072. }
  42073. }, {
  42074. key: "getAsyncError",
  42075. value: function getAsyncError() {
  42076. throw new Error('Use process(css).then(cb) to work with async plugins');
  42077. }
  42078. }, {
  42079. key: "handleError",
  42080. value: function handleError(error, node) {
  42081. var plugin = this.result.lastPlugin;
  42082. try {
  42083. if (node) node.addToError(error);
  42084. this.error = error;
  42085. if (error.name === 'CssSyntaxError' && !error.plugin) {
  42086. error.plugin = plugin.postcssPlugin;
  42087. error.setMessage();
  42088. } else if (plugin.postcssVersion) {
  42089. if (false) { var b, a, runtimeVer, pluginVer, pluginName; }
  42090. }
  42091. } catch (err) {
  42092. /* c8 ignore next 3 */
  42093. // eslint-disable-next-line no-console
  42094. if (console && console.error) console.error(err);
  42095. }
  42096. return error;
  42097. }
  42098. }, {
  42099. key: "runAsync",
  42100. value: function () {
  42101. var _runAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
  42102. var _this4 = this;
  42103. var i, plugin, promise, root, stack, _promise, node, _iterator5, _step5, _loop;
  42104. return _regeneratorRuntime().wrap(function _callee$(_context2) {
  42105. while (1) switch (_context2.prev = _context2.next) {
  42106. case 0:
  42107. this.plugin = 0;
  42108. i = 0;
  42109. case 2:
  42110. if (!(i < this.plugins.length)) {
  42111. _context2.next = 17;
  42112. break;
  42113. }
  42114. plugin = this.plugins[i];
  42115. promise = this.runOnRoot(plugin);
  42116. if (!isPromise(promise)) {
  42117. _context2.next = 14;
  42118. break;
  42119. }
  42120. _context2.prev = 6;
  42121. _context2.next = 9;
  42122. return promise;
  42123. case 9:
  42124. _context2.next = 14;
  42125. break;
  42126. case 11:
  42127. _context2.prev = 11;
  42128. _context2.t0 = _context2["catch"](6);
  42129. throw this.handleError(_context2.t0);
  42130. case 14:
  42131. i++;
  42132. _context2.next = 2;
  42133. break;
  42134. case 17:
  42135. this.prepareVisitors();
  42136. if (!this.hasListener) {
  42137. _context2.next = 56;
  42138. break;
  42139. }
  42140. root = this.result.root;
  42141. case 20:
  42142. if (root[isClean]) {
  42143. _context2.next = 39;
  42144. break;
  42145. }
  42146. root[isClean] = true;
  42147. stack = [toStack(root)];
  42148. case 23:
  42149. if (!(stack.length > 0)) {
  42150. _context2.next = 37;
  42151. break;
  42152. }
  42153. _promise = this.visitTick(stack);
  42154. if (!isPromise(_promise)) {
  42155. _context2.next = 35;
  42156. break;
  42157. }
  42158. _context2.prev = 26;
  42159. _context2.next = 29;
  42160. return _promise;
  42161. case 29:
  42162. _context2.next = 35;
  42163. break;
  42164. case 31:
  42165. _context2.prev = 31;
  42166. _context2.t1 = _context2["catch"](26);
  42167. node = stack[stack.length - 1].node;
  42168. throw this.handleError(_context2.t1, node);
  42169. case 35:
  42170. _context2.next = 23;
  42171. break;
  42172. case 37:
  42173. _context2.next = 20;
  42174. break;
  42175. case 39:
  42176. if (!this.listeners.OnceExit) {
  42177. _context2.next = 56;
  42178. break;
  42179. }
  42180. _iterator5 = _createForOfIteratorHelper(this.listeners.OnceExit);
  42181. _context2.prev = 41;
  42182. _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
  42183. var _step5$value, plugin, visitor, roots;
  42184. return _regeneratorRuntime().wrap(function _loop$(_context) {
  42185. while (1) switch (_context.prev = _context.next) {
  42186. case 0:
  42187. _step5$value = _slicedToArray(_step5.value, 2), plugin = _step5$value[0], visitor = _step5$value[1];
  42188. _this4.result.lastPlugin = plugin;
  42189. _context.prev = 2;
  42190. if (!(root.type === 'document')) {
  42191. _context.next = 9;
  42192. break;
  42193. }
  42194. roots = root.nodes.map(function (subRoot) {
  42195. return visitor(subRoot, _this4.helpers);
  42196. });
  42197. _context.next = 7;
  42198. return Promise.all(roots);
  42199. case 7:
  42200. _context.next = 11;
  42201. break;
  42202. case 9:
  42203. _context.next = 11;
  42204. return visitor(root, _this4.helpers);
  42205. case 11:
  42206. _context.next = 16;
  42207. break;
  42208. case 13:
  42209. _context.prev = 13;
  42210. _context.t0 = _context["catch"](2);
  42211. throw _this4.handleError(_context.t0);
  42212. case 16:
  42213. case "end":
  42214. return _context.stop();
  42215. }
  42216. }, _loop, null, [[2, 13]]);
  42217. });
  42218. _iterator5.s();
  42219. case 44:
  42220. if ((_step5 = _iterator5.n()).done) {
  42221. _context2.next = 48;
  42222. break;
  42223. }
  42224. return _context2.delegateYield(_loop(), "t2", 46);
  42225. case 46:
  42226. _context2.next = 44;
  42227. break;
  42228. case 48:
  42229. _context2.next = 53;
  42230. break;
  42231. case 50:
  42232. _context2.prev = 50;
  42233. _context2.t3 = _context2["catch"](41);
  42234. _iterator5.e(_context2.t3);
  42235. case 53:
  42236. _context2.prev = 53;
  42237. _iterator5.f();
  42238. return _context2.finish(53);
  42239. case 56:
  42240. this.processed = true;
  42241. return _context2.abrupt("return", this.stringify());
  42242. case 58:
  42243. case "end":
  42244. return _context2.stop();
  42245. }
  42246. }, _callee, this, [[6, 11], [26, 31], [41, 50, 53, 56]]);
  42247. }));
  42248. function runAsync() {
  42249. return _runAsync.apply(this, arguments);
  42250. }
  42251. return runAsync;
  42252. }()
  42253. }, {
  42254. key: "prepareVisitors",
  42255. value: function prepareVisitors() {
  42256. var _this5 = this;
  42257. this.listeners = {};
  42258. var add = function add(plugin, type, cb) {
  42259. if (!_this5.listeners[type]) _this5.listeners[type] = [];
  42260. _this5.listeners[type].push([plugin, cb]);
  42261. };
  42262. var _iterator6 = _createForOfIteratorHelper(this.plugins),
  42263. _step6;
  42264. try {
  42265. for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
  42266. var plugin = _step6.value;
  42267. if (_typeof(plugin) === 'object') {
  42268. for (var event in plugin) {
  42269. if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) {
  42270. throw new Error("Unknown event ".concat(event, " in ").concat(plugin.postcssPlugin, ". ") + "Try to update PostCSS (".concat(this.processor.version, " now)."));
  42271. }
  42272. if (!NOT_VISITORS[event]) {
  42273. if (_typeof(plugin[event]) === 'object') {
  42274. for (var filter in plugin[event]) {
  42275. if (filter === '*') {
  42276. add(plugin, event, plugin[event][filter]);
  42277. } else {
  42278. add(plugin, event + '-' + filter.toLowerCase(), plugin[event][filter]);
  42279. }
  42280. }
  42281. } else if (typeof plugin[event] === 'function') {
  42282. add(plugin, event, plugin[event]);
  42283. }
  42284. }
  42285. }
  42286. }
  42287. }
  42288. } catch (err) {
  42289. _iterator6.e(err);
  42290. } finally {
  42291. _iterator6.f();
  42292. }
  42293. this.hasListener = Object.keys(this.listeners).length > 0;
  42294. }
  42295. }, {
  42296. key: "visitTick",
  42297. value: function visitTick(stack) {
  42298. var visit = stack[stack.length - 1];
  42299. var node = visit.node,
  42300. visitors = visit.visitors;
  42301. if (node.type !== 'root' && node.type !== 'document' && !node.parent) {
  42302. stack.pop();
  42303. return;
  42304. }
  42305. if (visitors.length > 0 && visit.visitorIndex < visitors.length) {
  42306. var _visitors$visit$visit = _slicedToArray(visitors[visit.visitorIndex], 2),
  42307. plugin = _visitors$visit$visit[0],
  42308. visitor = _visitors$visit$visit[1];
  42309. visit.visitorIndex += 1;
  42310. if (visit.visitorIndex === visitors.length) {
  42311. visit.visitors = [];
  42312. visit.visitorIndex = 0;
  42313. }
  42314. this.result.lastPlugin = plugin;
  42315. try {
  42316. return visitor(node.toProxy(), this.helpers);
  42317. } catch (e) {
  42318. throw this.handleError(e, node);
  42319. }
  42320. }
  42321. if (visit.iterator !== 0) {
  42322. var iterator = visit.iterator;
  42323. var child;
  42324. while (child = node.nodes[node.indexes[iterator]]) {
  42325. node.indexes[iterator] += 1;
  42326. if (!child[isClean]) {
  42327. child[isClean] = true;
  42328. stack.push(toStack(child));
  42329. return;
  42330. }
  42331. }
  42332. visit.iterator = 0;
  42333. delete node.indexes[iterator];
  42334. }
  42335. var events = visit.events;
  42336. while (visit.eventIndex < events.length) {
  42337. var event = events[visit.eventIndex];
  42338. visit.eventIndex += 1;
  42339. if (event === CHILDREN) {
  42340. if (node.nodes && node.nodes.length) {
  42341. node[isClean] = true;
  42342. visit.iterator = node.getIterator();
  42343. }
  42344. return;
  42345. } else if (this.listeners[event]) {
  42346. visit.visitors = this.listeners[event];
  42347. return;
  42348. }
  42349. }
  42350. stack.pop();
  42351. }
  42352. }]);
  42353. return LazyResult;
  42354. }(Symbol.toStringTag);
  42355. LazyResult.registerPostcss = function (dependant) {
  42356. postcss = dependant;
  42357. };
  42358. module.exports = LazyResult;
  42359. LazyResult["default"] = LazyResult;
  42360. Root.registerLazyResult(LazyResult);
  42361. Document.registerLazyResult(LazyResult);
  42362. /***/ }),
  42363. /***/ 6136:
  42364. /***/ ((module) => {
  42365. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  42366. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  42367. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  42368. var list = {
  42369. split: function split(string, separators, last) {
  42370. var array = [];
  42371. var current = '';
  42372. var split = false;
  42373. var func = 0;
  42374. var inQuote = false;
  42375. var prevQuote = '';
  42376. var escape = false;
  42377. var _iterator = _createForOfIteratorHelper(string),
  42378. _step;
  42379. try {
  42380. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  42381. var letter = _step.value;
  42382. if (escape) {
  42383. escape = false;
  42384. } else if (letter === '\\') {
  42385. escape = true;
  42386. } else if (inQuote) {
  42387. if (letter === prevQuote) {
  42388. inQuote = false;
  42389. }
  42390. } else if (letter === '"' || letter === "'") {
  42391. inQuote = true;
  42392. prevQuote = letter;
  42393. } else if (letter === '(') {
  42394. func += 1;
  42395. } else if (letter === ')') {
  42396. if (func > 0) func -= 1;
  42397. } else if (func === 0) {
  42398. if (separators.includes(letter)) split = true;
  42399. }
  42400. if (split) {
  42401. if (current !== '') array.push(current.trim());
  42402. current = '';
  42403. split = false;
  42404. } else {
  42405. current += letter;
  42406. }
  42407. }
  42408. } catch (err) {
  42409. _iterator.e(err);
  42410. } finally {
  42411. _iterator.f();
  42412. }
  42413. if (last || current !== '') array.push(current.trim());
  42414. return array;
  42415. },
  42416. space: function space(string) {
  42417. var spaces = [' ', '\n', '\t'];
  42418. return list.split(string, spaces);
  42419. },
  42420. comma: function comma(string) {
  42421. return list.split(string, [','], true);
  42422. }
  42423. };
  42424. module.exports = list;
  42425. list["default"] = list;
  42426. /***/ }),
  42427. /***/ 8991:
  42428. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  42429. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  42430. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  42431. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  42432. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  42433. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  42434. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
  42435. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  42436. function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
  42437. function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
  42438. var _require = __webpack_require__(209),
  42439. SourceMapConsumer = _require.SourceMapConsumer,
  42440. SourceMapGenerator = _require.SourceMapGenerator;
  42441. var _require2 = __webpack_require__(9830),
  42442. dirname = _require2.dirname,
  42443. resolve = _require2.resolve,
  42444. relative = _require2.relative,
  42445. sep = _require2.sep;
  42446. var _require3 = __webpack_require__(7414),
  42447. pathToFileURL = _require3.pathToFileURL;
  42448. var Input = __webpack_require__(2993);
  42449. var sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
  42450. var pathAvailable = Boolean(dirname && resolve && relative && sep);
  42451. var MapGenerator = /*#__PURE__*/function () {
  42452. function MapGenerator(stringify, root, opts, cssString) {
  42453. _classCallCheck(this, MapGenerator);
  42454. this.stringify = stringify;
  42455. this.mapOpts = opts.map || {};
  42456. this.root = root;
  42457. this.opts = opts;
  42458. this.css = cssString;
  42459. this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute;
  42460. }
  42461. _createClass(MapGenerator, [{
  42462. key: "isMap",
  42463. value: function isMap() {
  42464. if (typeof this.opts.map !== 'undefined') {
  42465. return !!this.opts.map;
  42466. }
  42467. return this.previous().length > 0;
  42468. }
  42469. }, {
  42470. key: "previous",
  42471. value: function previous() {
  42472. var _this = this;
  42473. if (!this.previousMaps) {
  42474. this.previousMaps = [];
  42475. if (this.root) {
  42476. this.root.walk(function (node) {
  42477. if (node.source && node.source.input.map) {
  42478. var map = node.source.input.map;
  42479. if (!_this.previousMaps.includes(map)) {
  42480. _this.previousMaps.push(map);
  42481. }
  42482. }
  42483. });
  42484. } else {
  42485. var input = new Input(this.css, this.opts);
  42486. if (input.map) this.previousMaps.push(input.map);
  42487. }
  42488. }
  42489. return this.previousMaps;
  42490. }
  42491. }, {
  42492. key: "isInline",
  42493. value: function isInline() {
  42494. if (typeof this.mapOpts.inline !== 'undefined') {
  42495. return this.mapOpts.inline;
  42496. }
  42497. var annotation = this.mapOpts.annotation;
  42498. if (typeof annotation !== 'undefined' && annotation !== true) {
  42499. return false;
  42500. }
  42501. if (this.previous().length) {
  42502. return this.previous().some(function (i) {
  42503. return i.inline;
  42504. });
  42505. }
  42506. return true;
  42507. }
  42508. }, {
  42509. key: "isSourcesContent",
  42510. value: function isSourcesContent() {
  42511. if (typeof this.mapOpts.sourcesContent !== 'undefined') {
  42512. return this.mapOpts.sourcesContent;
  42513. }
  42514. if (this.previous().length) {
  42515. return this.previous().some(function (i) {
  42516. return i.withContent();
  42517. });
  42518. }
  42519. return true;
  42520. }
  42521. }, {
  42522. key: "clearAnnotation",
  42523. value: function clearAnnotation() {
  42524. if (this.mapOpts.annotation === false) return;
  42525. if (this.root) {
  42526. var node;
  42527. for (var i = this.root.nodes.length - 1; i >= 0; i--) {
  42528. node = this.root.nodes[i];
  42529. if (node.type !== 'comment') continue;
  42530. if (node.text.indexOf('# sourceMappingURL=') === 0) {
  42531. this.root.removeChild(i);
  42532. }
  42533. }
  42534. } else if (this.css) {
  42535. this.css = this.css.replace(/(\n)?\/\*#[\S\s]*?\*\/$/gm, '');
  42536. }
  42537. }
  42538. }, {
  42539. key: "setSourcesContent",
  42540. value: function setSourcesContent() {
  42541. var _this2 = this;
  42542. var already = {};
  42543. if (this.root) {
  42544. this.root.walk(function (node) {
  42545. if (node.source) {
  42546. var from = node.source.input.from;
  42547. if (from && !already[from]) {
  42548. already[from] = true;
  42549. var fromUrl = _this2.usesFileUrls ? _this2.toFileUrl(from) : _this2.toUrl(_this2.path(from));
  42550. _this2.map.setSourceContent(fromUrl, node.source.input.css);
  42551. }
  42552. }
  42553. });
  42554. } else if (this.css) {
  42555. var from = this.opts.from ? this.toUrl(this.path(this.opts.from)) : '<no source>';
  42556. this.map.setSourceContent(from, this.css);
  42557. }
  42558. }
  42559. }, {
  42560. key: "applyPrevMaps",
  42561. value: function applyPrevMaps() {
  42562. var _iterator = _createForOfIteratorHelper(this.previous()),
  42563. _step;
  42564. try {
  42565. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  42566. var prev = _step.value;
  42567. var from = this.toUrl(this.path(prev.file));
  42568. var root = prev.root || dirname(prev.file);
  42569. var map = void 0;
  42570. if (this.mapOpts.sourcesContent === false) {
  42571. map = new SourceMapConsumer(prev.text);
  42572. if (map.sourcesContent) {
  42573. map.sourcesContent = map.sourcesContent.map(function () {
  42574. return null;
  42575. });
  42576. }
  42577. } else {
  42578. map = prev.consumer();
  42579. }
  42580. this.map.applySourceMap(map, from, this.toUrl(this.path(root)));
  42581. }
  42582. } catch (err) {
  42583. _iterator.e(err);
  42584. } finally {
  42585. _iterator.f();
  42586. }
  42587. }
  42588. }, {
  42589. key: "isAnnotation",
  42590. value: function isAnnotation() {
  42591. if (this.isInline()) {
  42592. return true;
  42593. }
  42594. if (typeof this.mapOpts.annotation !== 'undefined') {
  42595. return this.mapOpts.annotation;
  42596. }
  42597. if (this.previous().length) {
  42598. return this.previous().some(function (i) {
  42599. return i.annotation;
  42600. });
  42601. }
  42602. return true;
  42603. }
  42604. }, {
  42605. key: "toBase64",
  42606. value: function toBase64(str) {
  42607. if (Buffer) {
  42608. return Buffer.from(str).toString('base64');
  42609. } else {
  42610. return window.btoa(unescape(encodeURIComponent(str)));
  42611. }
  42612. }
  42613. }, {
  42614. key: "addAnnotation",
  42615. value: function addAnnotation() {
  42616. var content;
  42617. if (this.isInline()) {
  42618. content = 'data:application/json;base64,' + this.toBase64(this.map.toString());
  42619. } else if (typeof this.mapOpts.annotation === 'string') {
  42620. content = this.mapOpts.annotation;
  42621. } else if (typeof this.mapOpts.annotation === 'function') {
  42622. content = this.mapOpts.annotation(this.opts.to, this.root);
  42623. } else {
  42624. content = this.outputFile() + '.map';
  42625. }
  42626. var eol = '\n';
  42627. if (this.css.includes('\r\n')) eol = '\r\n';
  42628. this.css += eol + '/*# sourceMappingURL=' + content + ' */';
  42629. }
  42630. }, {
  42631. key: "outputFile",
  42632. value: function outputFile() {
  42633. if (this.opts.to) {
  42634. return this.path(this.opts.to);
  42635. } else if (this.opts.from) {
  42636. return this.path(this.opts.from);
  42637. } else {
  42638. return 'to.css';
  42639. }
  42640. }
  42641. }, {
  42642. key: "generateMap",
  42643. value: function generateMap() {
  42644. if (this.root) {
  42645. this.generateString();
  42646. } else if (this.previous().length === 1) {
  42647. var prev = this.previous()[0].consumer();
  42648. prev.file = this.outputFile();
  42649. this.map = SourceMapGenerator.fromSourceMap(prev);
  42650. } else {
  42651. this.map = new SourceMapGenerator({
  42652. file: this.outputFile()
  42653. });
  42654. this.map.addMapping({
  42655. source: this.opts.from ? this.toUrl(this.path(this.opts.from)) : '<no source>',
  42656. generated: {
  42657. line: 1,
  42658. column: 0
  42659. },
  42660. original: {
  42661. line: 1,
  42662. column: 0
  42663. }
  42664. });
  42665. }
  42666. if (this.isSourcesContent()) this.setSourcesContent();
  42667. if (this.root && this.previous().length > 0) this.applyPrevMaps();
  42668. if (this.isAnnotation()) this.addAnnotation();
  42669. if (this.isInline()) {
  42670. return [this.css];
  42671. } else {
  42672. return [this.css, this.map];
  42673. }
  42674. }
  42675. }, {
  42676. key: "path",
  42677. value: function path(file) {
  42678. if (file.indexOf('<') === 0) return file;
  42679. if (/^\w+:\/\//.test(file)) return file;
  42680. if (this.mapOpts.absolute) return file;
  42681. var from = this.opts.to ? dirname(this.opts.to) : '.';
  42682. if (typeof this.mapOpts.annotation === 'string') {
  42683. from = dirname(resolve(from, this.mapOpts.annotation));
  42684. }
  42685. file = relative(from, file);
  42686. return file;
  42687. }
  42688. }, {
  42689. key: "toUrl",
  42690. value: function toUrl(path) {
  42691. if (sep === '\\') {
  42692. path = path.replace(/\\/g, '/');
  42693. }
  42694. return encodeURI(path).replace(/[#?]/g, encodeURIComponent);
  42695. }
  42696. }, {
  42697. key: "toFileUrl",
  42698. value: function toFileUrl(path) {
  42699. if (pathToFileURL) {
  42700. return pathToFileURL(path).toString();
  42701. } else {
  42702. throw new Error('`map.absolute` option is not available in this PostCSS build');
  42703. }
  42704. }
  42705. }, {
  42706. key: "sourcePath",
  42707. value: function sourcePath(node) {
  42708. if (this.mapOpts.from) {
  42709. return this.toUrl(this.mapOpts.from);
  42710. } else if (this.usesFileUrls) {
  42711. return this.toFileUrl(node.source.input.from);
  42712. } else {
  42713. return this.toUrl(this.path(node.source.input.from));
  42714. }
  42715. }
  42716. }, {
  42717. key: "generateString",
  42718. value: function generateString() {
  42719. var _this3 = this;
  42720. this.css = '';
  42721. this.map = new SourceMapGenerator({
  42722. file: this.outputFile()
  42723. });
  42724. var line = 1;
  42725. var column = 1;
  42726. var noSource = '<no source>';
  42727. var mapping = {
  42728. source: '',
  42729. generated: {
  42730. line: 0,
  42731. column: 0
  42732. },
  42733. original: {
  42734. line: 0,
  42735. column: 0
  42736. }
  42737. };
  42738. var lines, last;
  42739. this.stringify(this.root, function (str, node, type) {
  42740. _this3.css += str;
  42741. if (node && type !== 'end') {
  42742. mapping.generated.line = line;
  42743. mapping.generated.column = column - 1;
  42744. if (node.source && node.source.start) {
  42745. mapping.source = _this3.sourcePath(node);
  42746. mapping.original.line = node.source.start.line;
  42747. mapping.original.column = node.source.start.column - 1;
  42748. _this3.map.addMapping(mapping);
  42749. } else {
  42750. mapping.source = noSource;
  42751. mapping.original.line = 1;
  42752. mapping.original.column = 0;
  42753. _this3.map.addMapping(mapping);
  42754. }
  42755. }
  42756. lines = str.match(/\n/g);
  42757. if (lines) {
  42758. line += lines.length;
  42759. last = str.lastIndexOf('\n');
  42760. column = str.length - last;
  42761. } else {
  42762. column += str.length;
  42763. }
  42764. if (node && type !== 'start') {
  42765. var p = node.parent || {
  42766. raws: {}
  42767. };
  42768. var childless = node.type === 'decl' || node.type === 'atrule' && !node.nodes;
  42769. if (!childless || node !== p.last || p.raws.semicolon) {
  42770. if (node.source && node.source.end) {
  42771. mapping.source = _this3.sourcePath(node);
  42772. mapping.original.line = node.source.end.line;
  42773. mapping.original.column = node.source.end.column - 1;
  42774. mapping.generated.line = line;
  42775. mapping.generated.column = column - 2;
  42776. _this3.map.addMapping(mapping);
  42777. } else {
  42778. mapping.source = noSource;
  42779. mapping.original.line = 1;
  42780. mapping.original.column = 0;
  42781. mapping.generated.line = line;
  42782. mapping.generated.column = column - 1;
  42783. _this3.map.addMapping(mapping);
  42784. }
  42785. }
  42786. }
  42787. });
  42788. }
  42789. }, {
  42790. key: "generate",
  42791. value: function generate() {
  42792. this.clearAnnotation();
  42793. if (pathAvailable && sourceMapAvailable && this.isMap()) {
  42794. return this.generateMap();
  42795. } else {
  42796. var result = '';
  42797. this.stringify(this.root, function (i) {
  42798. result += i;
  42799. });
  42800. return [result];
  42801. }
  42802. }
  42803. }]);
  42804. return MapGenerator;
  42805. }();
  42806. module.exports = MapGenerator;
  42807. /***/ }),
  42808. /***/ 7686:
  42809. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  42810. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  42811. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  42812. function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  42813. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  42814. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  42815. function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
  42816. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  42817. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  42818. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
  42819. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  42820. function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
  42821. function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
  42822. var MapGenerator = __webpack_require__(8991);
  42823. var stringify = __webpack_require__(6157);
  42824. var warnOnce = __webpack_require__(6574);
  42825. var parse = __webpack_require__(7057);
  42826. var Result = __webpack_require__(6865);
  42827. var NoWorkResult = /*#__PURE__*/function (_Symbol$toStringTag) {
  42828. function NoWorkResult(processor, css, opts) {
  42829. _classCallCheck(this, NoWorkResult);
  42830. css = css.toString();
  42831. this.stringified = false;
  42832. this._processor = processor;
  42833. this._css = css;
  42834. this._opts = opts;
  42835. this._map = undefined;
  42836. var root;
  42837. var str = stringify;
  42838. this.result = new Result(this._processor, root, this._opts);
  42839. this.result.css = css;
  42840. var self = this;
  42841. Object.defineProperty(this.result, 'root', {
  42842. get: function get() {
  42843. return self.root;
  42844. }
  42845. });
  42846. var map = new MapGenerator(str, root, this._opts, css);
  42847. if (map.isMap()) {
  42848. var _map$generate = map.generate(),
  42849. _map$generate2 = _slicedToArray(_map$generate, 2),
  42850. generatedCSS = _map$generate2[0],
  42851. generatedMap = _map$generate2[1];
  42852. if (generatedCSS) {
  42853. this.result.css = generatedCSS;
  42854. }
  42855. if (generatedMap) {
  42856. this.result.map = generatedMap;
  42857. }
  42858. }
  42859. }
  42860. _createClass(NoWorkResult, [{
  42861. key: _Symbol$toStringTag,
  42862. get: function get() {
  42863. return 'NoWorkResult';
  42864. }
  42865. }, {
  42866. key: "processor",
  42867. get: function get() {
  42868. return this.result.processor;
  42869. }
  42870. }, {
  42871. key: "opts",
  42872. get: function get() {
  42873. return this.result.opts;
  42874. }
  42875. }, {
  42876. key: "css",
  42877. get: function get() {
  42878. return this.result.css;
  42879. }
  42880. }, {
  42881. key: "content",
  42882. get: function get() {
  42883. return this.result.css;
  42884. }
  42885. }, {
  42886. key: "map",
  42887. get: function get() {
  42888. return this.result.map;
  42889. }
  42890. }, {
  42891. key: "root",
  42892. get: function get() {
  42893. if (this._root) {
  42894. return this._root;
  42895. }
  42896. var root;
  42897. var parser = parse;
  42898. try {
  42899. root = parser(this._css, this._opts);
  42900. } catch (error) {
  42901. this.error = error;
  42902. }
  42903. if (this.error) {
  42904. throw this.error;
  42905. } else {
  42906. this._root = root;
  42907. return root;
  42908. }
  42909. }
  42910. }, {
  42911. key: "messages",
  42912. get: function get() {
  42913. return [];
  42914. }
  42915. }, {
  42916. key: "warnings",
  42917. value: function warnings() {
  42918. return [];
  42919. }
  42920. }, {
  42921. key: "toString",
  42922. value: function toString() {
  42923. return this._css;
  42924. }
  42925. }, {
  42926. key: "then",
  42927. value: function then(onFulfilled, onRejected) {
  42928. if (false) {}
  42929. return this.async().then(onFulfilled, onRejected);
  42930. }
  42931. }, {
  42932. key: "catch",
  42933. value: function _catch(onRejected) {
  42934. return this.async()["catch"](onRejected);
  42935. }
  42936. }, {
  42937. key: "finally",
  42938. value: function _finally(onFinally) {
  42939. return this.async().then(onFinally, onFinally);
  42940. }
  42941. }, {
  42942. key: "async",
  42943. value: function async() {
  42944. if (this.error) return Promise.reject(this.error);
  42945. return Promise.resolve(this.result);
  42946. }
  42947. }, {
  42948. key: "sync",
  42949. value: function sync() {
  42950. if (this.error) throw this.error;
  42951. return this.result;
  42952. }
  42953. }]);
  42954. return NoWorkResult;
  42955. }(Symbol.toStringTag);
  42956. module.exports = NoWorkResult;
  42957. NoWorkResult["default"] = NoWorkResult;
  42958. /***/ }),
  42959. /***/ 4343:
  42960. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  42961. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
  42962. function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  42963. function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
  42964. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
  42965. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  42966. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  42967. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  42968. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  42969. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
  42970. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  42971. function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
  42972. function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
  42973. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  42974. var _require = __webpack_require__(5506),
  42975. isClean = _require.isClean,
  42976. my = _require.my;
  42977. var CssSyntaxError = __webpack_require__(1667);
  42978. var Stringifier = __webpack_require__(5701);
  42979. var stringify = __webpack_require__(6157);
  42980. function cloneNode(obj, parent) {
  42981. var cloned = new obj.constructor();
  42982. for (var i in obj) {
  42983. if (!Object.prototype.hasOwnProperty.call(obj, i)) {
  42984. /* c8 ignore next 2 */
  42985. continue;
  42986. }
  42987. if (i === 'proxyCache') continue;
  42988. var value = obj[i];
  42989. var type = _typeof(value);
  42990. if (i === 'parent' && type === 'object') {
  42991. if (parent) cloned[i] = parent;
  42992. } else if (i === 'source') {
  42993. cloned[i] = value;
  42994. } else if (Array.isArray(value)) {
  42995. cloned[i] = value.map(function (j) {
  42996. return cloneNode(j, cloned);
  42997. });
  42998. } else {
  42999. if (type === 'object' && value !== null) value = cloneNode(value);
  43000. cloned[i] = value;
  43001. }
  43002. }
  43003. return cloned;
  43004. }
  43005. var Node = /*#__PURE__*/function () {
  43006. function Node() {
  43007. var defaults = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  43008. _classCallCheck(this, Node);
  43009. this.raws = {};
  43010. this[isClean] = false;
  43011. this[my] = true;
  43012. for (var name in defaults) {
  43013. if (name === 'nodes') {
  43014. this.nodes = [];
  43015. var _iterator = _createForOfIteratorHelper(defaults[name]),
  43016. _step;
  43017. try {
  43018. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  43019. var node = _step.value;
  43020. if (typeof node.clone === 'function') {
  43021. this.append(node.clone());
  43022. } else {
  43023. this.append(node);
  43024. }
  43025. }
  43026. } catch (err) {
  43027. _iterator.e(err);
  43028. } finally {
  43029. _iterator.f();
  43030. }
  43031. } else {
  43032. this[name] = defaults[name];
  43033. }
  43034. }
  43035. }
  43036. _createClass(Node, [{
  43037. key: "error",
  43038. value: function error(message) {
  43039. var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  43040. if (this.source) {
  43041. var _this$rangeBy = this.rangeBy(opts),
  43042. start = _this$rangeBy.start,
  43043. end = _this$rangeBy.end;
  43044. return this.source.input.error(message, {
  43045. line: start.line,
  43046. column: start.column
  43047. }, {
  43048. line: end.line,
  43049. column: end.column
  43050. }, opts);
  43051. }
  43052. return new CssSyntaxError(message);
  43053. }
  43054. }, {
  43055. key: "warn",
  43056. value: function warn(result, text, opts) {
  43057. var data = {
  43058. node: this
  43059. };
  43060. for (var i in opts) data[i] = opts[i];
  43061. return result.warn(text, data);
  43062. }
  43063. }, {
  43064. key: "remove",
  43065. value: function remove() {
  43066. if (this.parent) {
  43067. this.parent.removeChild(this);
  43068. }
  43069. this.parent = undefined;
  43070. return this;
  43071. }
  43072. }, {
  43073. key: "toString",
  43074. value: function toString() {
  43075. var stringifier = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : stringify;
  43076. if (stringifier.stringify) stringifier = stringifier.stringify;
  43077. var result = '';
  43078. stringifier(this, function (i) {
  43079. result += i;
  43080. });
  43081. return result;
  43082. }
  43083. }, {
  43084. key: "assign",
  43085. value: function assign() {
  43086. var overrides = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  43087. for (var name in overrides) {
  43088. this[name] = overrides[name];
  43089. }
  43090. return this;
  43091. }
  43092. }, {
  43093. key: "clone",
  43094. value: function clone() {
  43095. var overrides = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  43096. var cloned = cloneNode(this);
  43097. for (var name in overrides) {
  43098. cloned[name] = overrides[name];
  43099. }
  43100. return cloned;
  43101. }
  43102. }, {
  43103. key: "cloneBefore",
  43104. value: function cloneBefore() {
  43105. var overrides = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  43106. var cloned = this.clone(overrides);
  43107. this.parent.insertBefore(this, cloned);
  43108. return cloned;
  43109. }
  43110. }, {
  43111. key: "cloneAfter",
  43112. value: function cloneAfter() {
  43113. var overrides = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  43114. var cloned = this.clone(overrides);
  43115. this.parent.insertAfter(this, cloned);
  43116. return cloned;
  43117. }
  43118. }, {
  43119. key: "replaceWith",
  43120. value: function replaceWith() {
  43121. if (this.parent) {
  43122. var bookmark = this;
  43123. var foundSelf = false;
  43124. for (var _len = arguments.length, nodes = new Array(_len), _key = 0; _key < _len; _key++) {
  43125. nodes[_key] = arguments[_key];
  43126. }
  43127. for (var _i = 0, _nodes = nodes; _i < _nodes.length; _i++) {
  43128. var node = _nodes[_i];
  43129. if (node === this) {
  43130. foundSelf = true;
  43131. } else if (foundSelf) {
  43132. this.parent.insertAfter(bookmark, node);
  43133. bookmark = node;
  43134. } else {
  43135. this.parent.insertBefore(bookmark, node);
  43136. }
  43137. }
  43138. if (!foundSelf) {
  43139. this.remove();
  43140. }
  43141. }
  43142. return this;
  43143. }
  43144. }, {
  43145. key: "next",
  43146. value: function next() {
  43147. if (!this.parent) return undefined;
  43148. var index = this.parent.index(this);
  43149. return this.parent.nodes[index + 1];
  43150. }
  43151. }, {
  43152. key: "prev",
  43153. value: function prev() {
  43154. if (!this.parent) return undefined;
  43155. var index = this.parent.index(this);
  43156. return this.parent.nodes[index - 1];
  43157. }
  43158. }, {
  43159. key: "before",
  43160. value: function before(add) {
  43161. this.parent.insertBefore(this, add);
  43162. return this;
  43163. }
  43164. }, {
  43165. key: "after",
  43166. value: function after(add) {
  43167. this.parent.insertAfter(this, add);
  43168. return this;
  43169. }
  43170. }, {
  43171. key: "root",
  43172. value: function root() {
  43173. var result = this;
  43174. while (result.parent && result.parent.type !== 'document') {
  43175. result = result.parent;
  43176. }
  43177. return result;
  43178. }
  43179. }, {
  43180. key: "raw",
  43181. value: function raw(prop, defaultType) {
  43182. var str = new Stringifier();
  43183. return str.raw(this, prop, defaultType);
  43184. }
  43185. }, {
  43186. key: "cleanRaws",
  43187. value: function cleanRaws(keepBetween) {
  43188. delete this.raws.before;
  43189. delete this.raws.after;
  43190. if (!keepBetween) delete this.raws.between;
  43191. }
  43192. }, {
  43193. key: "toJSON",
  43194. value: function toJSON(_, inputs) {
  43195. var fixed = {};
  43196. var emitInputs = inputs == null;
  43197. inputs = inputs || new Map();
  43198. var inputsNextIndex = 0;
  43199. for (var name in this) {
  43200. if (!Object.prototype.hasOwnProperty.call(this, name)) {
  43201. /* c8 ignore next 2 */
  43202. continue;
  43203. }
  43204. if (name === 'parent' || name === 'proxyCache') continue;
  43205. var value = this[name];
  43206. if (Array.isArray(value)) {
  43207. fixed[name] = value.map(function (i) {
  43208. if (_typeof(i) === 'object' && i.toJSON) {
  43209. return i.toJSON(null, inputs);
  43210. } else {
  43211. return i;
  43212. }
  43213. });
  43214. } else if (_typeof(value) === 'object' && value.toJSON) {
  43215. fixed[name] = value.toJSON(null, inputs);
  43216. } else if (name === 'source') {
  43217. var inputId = inputs.get(value.input);
  43218. if (inputId == null) {
  43219. inputId = inputsNextIndex;
  43220. inputs.set(value.input, inputsNextIndex);
  43221. inputsNextIndex++;
  43222. }
  43223. fixed[name] = {
  43224. inputId: inputId,
  43225. start: value.start,
  43226. end: value.end
  43227. };
  43228. } else {
  43229. fixed[name] = value;
  43230. }
  43231. }
  43232. if (emitInputs) {
  43233. fixed.inputs = _toConsumableArray(inputs.keys()).map(function (input) {
  43234. return input.toJSON();
  43235. });
  43236. }
  43237. return fixed;
  43238. }
  43239. }, {
  43240. key: "positionInside",
  43241. value: function positionInside(index) {
  43242. var string = this.toString();
  43243. var column = this.source.start.column;
  43244. var line = this.source.start.line;
  43245. for (var i = 0; i < index; i++) {
  43246. if (string[i] === '\n') {
  43247. column = 1;
  43248. line += 1;
  43249. } else {
  43250. column += 1;
  43251. }
  43252. }
  43253. return {
  43254. line: line,
  43255. column: column
  43256. };
  43257. }
  43258. }, {
  43259. key: "positionBy",
  43260. value: function positionBy(opts) {
  43261. var pos = this.source.start;
  43262. if (opts.index) {
  43263. pos = this.positionInside(opts.index);
  43264. } else if (opts.word) {
  43265. var index = this.toString().indexOf(opts.word);
  43266. if (index !== -1) pos = this.positionInside(index);
  43267. }
  43268. return pos;
  43269. }
  43270. }, {
  43271. key: "rangeBy",
  43272. value: function rangeBy(opts) {
  43273. var start = {
  43274. line: this.source.start.line,
  43275. column: this.source.start.column
  43276. };
  43277. var end = this.source.end ? {
  43278. line: this.source.end.line,
  43279. column: this.source.end.column + 1
  43280. } : {
  43281. line: start.line,
  43282. column: start.column + 1
  43283. };
  43284. if (opts.word) {
  43285. var index = this.toString().indexOf(opts.word);
  43286. if (index !== -1) {
  43287. start = this.positionInside(index);
  43288. end = this.positionInside(index + opts.word.length);
  43289. }
  43290. } else {
  43291. if (opts.start) {
  43292. start = {
  43293. line: opts.start.line,
  43294. column: opts.start.column
  43295. };
  43296. } else if (opts.index) {
  43297. start = this.positionInside(opts.index);
  43298. }
  43299. if (opts.end) {
  43300. end = {
  43301. line: opts.end.line,
  43302. column: opts.end.column
  43303. };
  43304. } else if (opts.endIndex) {
  43305. end = this.positionInside(opts.endIndex);
  43306. } else if (opts.index) {
  43307. end = this.positionInside(opts.index + 1);
  43308. }
  43309. }
  43310. if (end.line < start.line || end.line === start.line && end.column <= start.column) {
  43311. end = {
  43312. line: start.line,
  43313. column: start.column + 1
  43314. };
  43315. }
  43316. return {
  43317. start: start,
  43318. end: end
  43319. };
  43320. }
  43321. }, {
  43322. key: "getProxyProcessor",
  43323. value: function getProxyProcessor() {
  43324. return {
  43325. set: function set(node, prop, value) {
  43326. if (node[prop] === value) return true;
  43327. node[prop] = value;
  43328. if (prop === 'prop' || prop === 'value' || prop === 'name' || prop === 'params' || prop === 'important' || /* c8 ignore next */
  43329. prop === 'text') {
  43330. node.markDirty();
  43331. }
  43332. return true;
  43333. },
  43334. get: function get(node, prop) {
  43335. if (prop === 'proxyOf') {
  43336. return node;
  43337. } else if (prop === 'root') {
  43338. return function () {
  43339. return node.root().toProxy();
  43340. };
  43341. } else {
  43342. return node[prop];
  43343. }
  43344. }
  43345. };
  43346. }
  43347. }, {
  43348. key: "toProxy",
  43349. value: function toProxy() {
  43350. if (!this.proxyCache) {
  43351. this.proxyCache = new Proxy(this, this.getProxyProcessor());
  43352. }
  43353. return this.proxyCache;
  43354. }
  43355. }, {
  43356. key: "addToError",
  43357. value: function addToError(error) {
  43358. error.postcssNode = this;
  43359. if (error.stack && this.source && /\n\s{4}at /.test(error.stack)) {
  43360. var s = this.source;
  43361. error.stack = error.stack.replace(/\n\s{4}at /, "$&".concat(s.input.from, ":").concat(s.start.line, ":").concat(s.start.column, "$&"));
  43362. }
  43363. return error;
  43364. }
  43365. }, {
  43366. key: "markDirty",
  43367. value: function markDirty() {
  43368. if (this[isClean]) {
  43369. this[isClean] = false;
  43370. var next = this;
  43371. while (next = next.parent) {
  43372. next[isClean] = false;
  43373. }
  43374. }
  43375. }
  43376. }, {
  43377. key: "proxyOf",
  43378. get: function get() {
  43379. return this;
  43380. }
  43381. }]);
  43382. return Node;
  43383. }();
  43384. module.exports = Node;
  43385. Node["default"] = Node;
  43386. /***/ }),
  43387. /***/ 7057:
  43388. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  43389. var Container = __webpack_require__(1204);
  43390. var Parser = __webpack_require__(7116);
  43391. var Input = __webpack_require__(2993);
  43392. function parse(css, opts) {
  43393. var input = new Input(css, opts);
  43394. var parser = new Parser(input);
  43395. try {
  43396. parser.parse();
  43397. } catch (e) {
  43398. if (false) {}
  43399. throw e;
  43400. }
  43401. return parser.root;
  43402. }
  43403. module.exports = parse;
  43404. parse["default"] = parse;
  43405. Container.registerParse(parse);
  43406. /***/ }),
  43407. /***/ 7116:
  43408. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  43409. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  43410. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  43411. function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  43412. function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
  43413. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  43414. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  43415. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  43416. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  43417. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  43418. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
  43419. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  43420. function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
  43421. function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
  43422. var Declaration = __webpack_require__(6417);
  43423. var tokenizer = __webpack_require__(1157);
  43424. var Comment = __webpack_require__(3102);
  43425. var AtRule = __webpack_require__(8940);
  43426. var Root = __webpack_require__(7563);
  43427. var Rule = __webpack_require__(6621);
  43428. var SAFE_COMMENT_NEIGHBOR = {
  43429. empty: true,
  43430. space: true
  43431. };
  43432. function findLastWithPosition(tokens) {
  43433. for (var i = tokens.length - 1; i >= 0; i--) {
  43434. var token = tokens[i];
  43435. var pos = token[3] || token[2];
  43436. if (pos) return pos;
  43437. }
  43438. }
  43439. var Parser = /*#__PURE__*/function () {
  43440. function Parser(input) {
  43441. _classCallCheck(this, Parser);
  43442. this.input = input;
  43443. this.root = new Root();
  43444. this.current = this.root;
  43445. this.spaces = '';
  43446. this.semicolon = false;
  43447. this.customProperty = false;
  43448. this.createTokenizer();
  43449. this.root.source = {
  43450. input: input,
  43451. start: {
  43452. offset: 0,
  43453. line: 1,
  43454. column: 1
  43455. }
  43456. };
  43457. }
  43458. _createClass(Parser, [{
  43459. key: "createTokenizer",
  43460. value: function createTokenizer() {
  43461. this.tokenizer = tokenizer(this.input);
  43462. }
  43463. }, {
  43464. key: "parse",
  43465. value: function parse() {
  43466. var token;
  43467. while (!this.tokenizer.endOfFile()) {
  43468. token = this.tokenizer.nextToken();
  43469. switch (token[0]) {
  43470. case 'space':
  43471. this.spaces += token[1];
  43472. break;
  43473. case ';':
  43474. this.freeSemicolon(token);
  43475. break;
  43476. case '}':
  43477. this.end(token);
  43478. break;
  43479. case 'comment':
  43480. this.comment(token);
  43481. break;
  43482. case 'at-word':
  43483. this.atrule(token);
  43484. break;
  43485. case '{':
  43486. this.emptyRule(token);
  43487. break;
  43488. default:
  43489. this.other(token);
  43490. break;
  43491. }
  43492. }
  43493. this.endFile();
  43494. }
  43495. }, {
  43496. key: "comment",
  43497. value: function comment(token) {
  43498. var node = new Comment();
  43499. this.init(node, token[2]);
  43500. node.source.end = this.getPosition(token[3] || token[2]);
  43501. var text = token[1].slice(2, -2);
  43502. if (/^\s*$/.test(text)) {
  43503. node.text = '';
  43504. node.raws.left = text;
  43505. node.raws.right = '';
  43506. } else {
  43507. var match = text.match(/^(\s*)([^]*\S)(\s*)$/);
  43508. node.text = match[2];
  43509. node.raws.left = match[1];
  43510. node.raws.right = match[3];
  43511. }
  43512. }
  43513. }, {
  43514. key: "emptyRule",
  43515. value: function emptyRule(token) {
  43516. var node = new Rule();
  43517. this.init(node, token[2]);
  43518. node.selector = '';
  43519. node.raws.between = '';
  43520. this.current = node;
  43521. }
  43522. }, {
  43523. key: "other",
  43524. value: function other(start) {
  43525. var end = false;
  43526. var type = null;
  43527. var colon = false;
  43528. var bracket = null;
  43529. var brackets = [];
  43530. var customProperty = start[1].startsWith('--');
  43531. var tokens = [];
  43532. var token = start;
  43533. while (token) {
  43534. type = token[0];
  43535. tokens.push(token);
  43536. if (type === '(' || type === '[') {
  43537. if (!bracket) bracket = token;
  43538. brackets.push(type === '(' ? ')' : ']');
  43539. } else if (customProperty && colon && type === '{') {
  43540. if (!bracket) bracket = token;
  43541. brackets.push('}');
  43542. } else if (brackets.length === 0) {
  43543. if (type === ';') {
  43544. if (colon) {
  43545. this.decl(tokens, customProperty);
  43546. return;
  43547. } else {
  43548. break;
  43549. }
  43550. } else if (type === '{') {
  43551. this.rule(tokens);
  43552. return;
  43553. } else if (type === '}') {
  43554. this.tokenizer.back(tokens.pop());
  43555. end = true;
  43556. break;
  43557. } else if (type === ':') {
  43558. colon = true;
  43559. }
  43560. } else if (type === brackets[brackets.length - 1]) {
  43561. brackets.pop();
  43562. if (brackets.length === 0) bracket = null;
  43563. }
  43564. token = this.tokenizer.nextToken();
  43565. }
  43566. if (this.tokenizer.endOfFile()) end = true;
  43567. if (brackets.length > 0) this.unclosedBracket(bracket);
  43568. if (end && colon) {
  43569. if (!customProperty) {
  43570. while (tokens.length) {
  43571. token = tokens[tokens.length - 1][0];
  43572. if (token !== 'space' && token !== 'comment') break;
  43573. this.tokenizer.back(tokens.pop());
  43574. }
  43575. }
  43576. this.decl(tokens, customProperty);
  43577. } else {
  43578. this.unknownWord(tokens);
  43579. }
  43580. }
  43581. }, {
  43582. key: "rule",
  43583. value: function rule(tokens) {
  43584. tokens.pop();
  43585. var node = new Rule();
  43586. this.init(node, tokens[0][2]);
  43587. node.raws.between = this.spacesAndCommentsFromEnd(tokens);
  43588. this.raw(node, 'selector', tokens);
  43589. this.current = node;
  43590. }
  43591. }, {
  43592. key: "decl",
  43593. value: function decl(tokens, customProperty) {
  43594. var node = new Declaration();
  43595. this.init(node, tokens[0][2]);
  43596. var last = tokens[tokens.length - 1];
  43597. if (last[0] === ';') {
  43598. this.semicolon = true;
  43599. tokens.pop();
  43600. }
  43601. node.source.end = this.getPosition(last[3] || last[2] || findLastWithPosition(tokens));
  43602. while (tokens[0][0] !== 'word') {
  43603. if (tokens.length === 1) this.unknownWord(tokens);
  43604. node.raws.before += tokens.shift()[1];
  43605. }
  43606. node.source.start = this.getPosition(tokens[0][2]);
  43607. node.prop = '';
  43608. while (tokens.length) {
  43609. var type = tokens[0][0];
  43610. if (type === ':' || type === 'space' || type === 'comment') {
  43611. break;
  43612. }
  43613. node.prop += tokens.shift()[1];
  43614. }
  43615. node.raws.between = '';
  43616. var token;
  43617. while (tokens.length) {
  43618. token = tokens.shift();
  43619. if (token[0] === ':') {
  43620. node.raws.between += token[1];
  43621. break;
  43622. } else {
  43623. if (token[0] === 'word' && /\w/.test(token[1])) {
  43624. this.unknownWord([token]);
  43625. }
  43626. node.raws.between += token[1];
  43627. }
  43628. }
  43629. if (node.prop[0] === '_' || node.prop[0] === '*') {
  43630. node.raws.before += node.prop[0];
  43631. node.prop = node.prop.slice(1);
  43632. }
  43633. var firstSpaces = [];
  43634. var next;
  43635. while (tokens.length) {
  43636. next = tokens[0][0];
  43637. if (next !== 'space' && next !== 'comment') break;
  43638. firstSpaces.push(tokens.shift());
  43639. }
  43640. this.precheckMissedSemicolon(tokens);
  43641. for (var i = tokens.length - 1; i >= 0; i--) {
  43642. token = tokens[i];
  43643. if (token[1].toLowerCase() === '!important') {
  43644. node.important = true;
  43645. var string = this.stringFrom(tokens, i);
  43646. string = this.spacesFromEnd(tokens) + string;
  43647. if (string !== ' !important') node.raws.important = string;
  43648. break;
  43649. } else if (token[1].toLowerCase() === 'important') {
  43650. var cache = tokens.slice(0);
  43651. var str = '';
  43652. for (var j = i; j > 0; j--) {
  43653. var _type = cache[j][0];
  43654. if (str.trim().indexOf('!') === 0 && _type !== 'space') {
  43655. break;
  43656. }
  43657. str = cache.pop()[1] + str;
  43658. }
  43659. if (str.trim().indexOf('!') === 0) {
  43660. node.important = true;
  43661. node.raws.important = str;
  43662. tokens = cache;
  43663. }
  43664. }
  43665. if (token[0] !== 'space' && token[0] !== 'comment') {
  43666. break;
  43667. }
  43668. }
  43669. var hasWord = tokens.some(function (i) {
  43670. return i[0] !== 'space' && i[0] !== 'comment';
  43671. });
  43672. if (hasWord) {
  43673. node.raws.between += firstSpaces.map(function (i) {
  43674. return i[1];
  43675. }).join('');
  43676. firstSpaces = [];
  43677. }
  43678. this.raw(node, 'value', firstSpaces.concat(tokens), customProperty);
  43679. if (node.value.includes(':') && !customProperty) {
  43680. this.checkMissedSemicolon(tokens);
  43681. }
  43682. }
  43683. }, {
  43684. key: "atrule",
  43685. value: function atrule(token) {
  43686. var node = new AtRule();
  43687. node.name = token[1].slice(1);
  43688. if (node.name === '') {
  43689. this.unnamedAtrule(node, token);
  43690. }
  43691. this.init(node, token[2]);
  43692. var type;
  43693. var prev;
  43694. var shift;
  43695. var last = false;
  43696. var open = false;
  43697. var params = [];
  43698. var brackets = [];
  43699. while (!this.tokenizer.endOfFile()) {
  43700. token = this.tokenizer.nextToken();
  43701. type = token[0];
  43702. if (type === '(' || type === '[') {
  43703. brackets.push(type === '(' ? ')' : ']');
  43704. } else if (type === '{' && brackets.length > 0) {
  43705. brackets.push('}');
  43706. } else if (type === brackets[brackets.length - 1]) {
  43707. brackets.pop();
  43708. }
  43709. if (brackets.length === 0) {
  43710. if (type === ';') {
  43711. node.source.end = this.getPosition(token[2]);
  43712. this.semicolon = true;
  43713. break;
  43714. } else if (type === '{') {
  43715. open = true;
  43716. break;
  43717. } else if (type === '}') {
  43718. if (params.length > 0) {
  43719. shift = params.length - 1;
  43720. prev = params[shift];
  43721. while (prev && prev[0] === 'space') {
  43722. prev = params[--shift];
  43723. }
  43724. if (prev) {
  43725. node.source.end = this.getPosition(prev[3] || prev[2]);
  43726. }
  43727. }
  43728. this.end(token);
  43729. break;
  43730. } else {
  43731. params.push(token);
  43732. }
  43733. } else {
  43734. params.push(token);
  43735. }
  43736. if (this.tokenizer.endOfFile()) {
  43737. last = true;
  43738. break;
  43739. }
  43740. }
  43741. node.raws.between = this.spacesAndCommentsFromEnd(params);
  43742. if (params.length) {
  43743. node.raws.afterName = this.spacesAndCommentsFromStart(params);
  43744. this.raw(node, 'params', params);
  43745. if (last) {
  43746. token = params[params.length - 1];
  43747. node.source.end = this.getPosition(token[3] || token[2]);
  43748. this.spaces = node.raws.between;
  43749. node.raws.between = '';
  43750. }
  43751. } else {
  43752. node.raws.afterName = '';
  43753. node.params = '';
  43754. }
  43755. if (open) {
  43756. node.nodes = [];
  43757. this.current = node;
  43758. }
  43759. }
  43760. }, {
  43761. key: "end",
  43762. value: function end(token) {
  43763. if (this.current.nodes && this.current.nodes.length) {
  43764. this.current.raws.semicolon = this.semicolon;
  43765. }
  43766. this.semicolon = false;
  43767. this.current.raws.after = (this.current.raws.after || '') + this.spaces;
  43768. this.spaces = '';
  43769. if (this.current.parent) {
  43770. this.current.source.end = this.getPosition(token[2]);
  43771. this.current = this.current.parent;
  43772. } else {
  43773. this.unexpectedClose(token);
  43774. }
  43775. }
  43776. }, {
  43777. key: "endFile",
  43778. value: function endFile() {
  43779. if (this.current.parent) this.unclosedBlock();
  43780. if (this.current.nodes && this.current.nodes.length) {
  43781. this.current.raws.semicolon = this.semicolon;
  43782. }
  43783. this.current.raws.after = (this.current.raws.after || '') + this.spaces;
  43784. }
  43785. }, {
  43786. key: "freeSemicolon",
  43787. value: function freeSemicolon(token) {
  43788. this.spaces += token[1];
  43789. if (this.current.nodes) {
  43790. var prev = this.current.nodes[this.current.nodes.length - 1];
  43791. if (prev && prev.type === 'rule' && !prev.raws.ownSemicolon) {
  43792. prev.raws.ownSemicolon = this.spaces;
  43793. this.spaces = '';
  43794. }
  43795. }
  43796. }
  43797. // Helpers
  43798. }, {
  43799. key: "getPosition",
  43800. value: function getPosition(offset) {
  43801. var pos = this.input.fromOffset(offset);
  43802. return {
  43803. offset: offset,
  43804. line: pos.line,
  43805. column: pos.col
  43806. };
  43807. }
  43808. }, {
  43809. key: "init",
  43810. value: function init(node, offset) {
  43811. this.current.push(node);
  43812. node.source = {
  43813. start: this.getPosition(offset),
  43814. input: this.input
  43815. };
  43816. node.raws.before = this.spaces;
  43817. this.spaces = '';
  43818. if (node.type !== 'comment') this.semicolon = false;
  43819. }
  43820. }, {
  43821. key: "raw",
  43822. value: function raw(node, prop, tokens, customProperty) {
  43823. var token, type;
  43824. var length = tokens.length;
  43825. var value = '';
  43826. var clean = true;
  43827. var next, prev;
  43828. for (var i = 0; i < length; i += 1) {
  43829. token = tokens[i];
  43830. type = token[0];
  43831. if (type === 'space' && i === length - 1 && !customProperty) {
  43832. clean = false;
  43833. } else if (type === 'comment') {
  43834. prev = tokens[i - 1] ? tokens[i - 1][0] : 'empty';
  43835. next = tokens[i + 1] ? tokens[i + 1][0] : 'empty';
  43836. if (!SAFE_COMMENT_NEIGHBOR[prev] && !SAFE_COMMENT_NEIGHBOR[next]) {
  43837. if (value.slice(-1) === ',') {
  43838. clean = false;
  43839. } else {
  43840. value += token[1];
  43841. }
  43842. } else {
  43843. clean = false;
  43844. }
  43845. } else {
  43846. value += token[1];
  43847. }
  43848. }
  43849. if (!clean) {
  43850. var raw = tokens.reduce(function (all, i) {
  43851. return all + i[1];
  43852. }, '');
  43853. node.raws[prop] = {
  43854. value: value,
  43855. raw: raw
  43856. };
  43857. }
  43858. node[prop] = value;
  43859. }
  43860. }, {
  43861. key: "spacesAndCommentsFromEnd",
  43862. value: function spacesAndCommentsFromEnd(tokens) {
  43863. var lastTokenType;
  43864. var spaces = '';
  43865. while (tokens.length) {
  43866. lastTokenType = tokens[tokens.length - 1][0];
  43867. if (lastTokenType !== 'space' && lastTokenType !== 'comment') break;
  43868. spaces = tokens.pop()[1] + spaces;
  43869. }
  43870. return spaces;
  43871. }
  43872. }, {
  43873. key: "spacesAndCommentsFromStart",
  43874. value: function spacesAndCommentsFromStart(tokens) {
  43875. var next;
  43876. var spaces = '';
  43877. while (tokens.length) {
  43878. next = tokens[0][0];
  43879. if (next !== 'space' && next !== 'comment') break;
  43880. spaces += tokens.shift()[1];
  43881. }
  43882. return spaces;
  43883. }
  43884. }, {
  43885. key: "spacesFromEnd",
  43886. value: function spacesFromEnd(tokens) {
  43887. var lastTokenType;
  43888. var spaces = '';
  43889. while (tokens.length) {
  43890. lastTokenType = tokens[tokens.length - 1][0];
  43891. if (lastTokenType !== 'space') break;
  43892. spaces = tokens.pop()[1] + spaces;
  43893. }
  43894. return spaces;
  43895. }
  43896. }, {
  43897. key: "stringFrom",
  43898. value: function stringFrom(tokens, from) {
  43899. var result = '';
  43900. for (var i = from; i < tokens.length; i++) {
  43901. result += tokens[i][1];
  43902. }
  43903. tokens.splice(from, tokens.length - from);
  43904. return result;
  43905. }
  43906. }, {
  43907. key: "colon",
  43908. value: function colon(tokens) {
  43909. var brackets = 0;
  43910. var token, type, prev;
  43911. var _iterator = _createForOfIteratorHelper(tokens.entries()),
  43912. _step;
  43913. try {
  43914. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  43915. var _step$value = _slicedToArray(_step.value, 2),
  43916. i = _step$value[0],
  43917. element = _step$value[1];
  43918. token = element;
  43919. type = token[0];
  43920. if (type === '(') {
  43921. brackets += 1;
  43922. }
  43923. if (type === ')') {
  43924. brackets -= 1;
  43925. }
  43926. if (brackets === 0 && type === ':') {
  43927. if (!prev) {
  43928. this.doubleColon(token);
  43929. } else if (prev[0] === 'word' && prev[1] === 'progid') {
  43930. continue;
  43931. } else {
  43932. return i;
  43933. }
  43934. }
  43935. prev = token;
  43936. }
  43937. } catch (err) {
  43938. _iterator.e(err);
  43939. } finally {
  43940. _iterator.f();
  43941. }
  43942. return false;
  43943. }
  43944. // Errors
  43945. }, {
  43946. key: "unclosedBracket",
  43947. value: function unclosedBracket(bracket) {
  43948. throw this.input.error('Unclosed bracket', {
  43949. offset: bracket[2]
  43950. }, {
  43951. offset: bracket[2] + 1
  43952. });
  43953. }
  43954. }, {
  43955. key: "unknownWord",
  43956. value: function unknownWord(tokens) {
  43957. throw this.input.error('Unknown word', {
  43958. offset: tokens[0][2]
  43959. }, {
  43960. offset: tokens[0][2] + tokens[0][1].length
  43961. });
  43962. }
  43963. }, {
  43964. key: "unexpectedClose",
  43965. value: function unexpectedClose(token) {
  43966. throw this.input.error('Unexpected }', {
  43967. offset: token[2]
  43968. }, {
  43969. offset: token[2] + 1
  43970. });
  43971. }
  43972. }, {
  43973. key: "unclosedBlock",
  43974. value: function unclosedBlock() {
  43975. var pos = this.current.source.start;
  43976. throw this.input.error('Unclosed block', pos.line, pos.column);
  43977. }
  43978. }, {
  43979. key: "doubleColon",
  43980. value: function doubleColon(token) {
  43981. throw this.input.error('Double colon', {
  43982. offset: token[2]
  43983. }, {
  43984. offset: token[2] + token[1].length
  43985. });
  43986. }
  43987. }, {
  43988. key: "unnamedAtrule",
  43989. value: function unnamedAtrule(node, token) {
  43990. throw this.input.error('At-rule without name', {
  43991. offset: token[2]
  43992. }, {
  43993. offset: token[2] + token[1].length
  43994. });
  43995. }
  43996. }, {
  43997. key: "precheckMissedSemicolon",
  43998. value: function precheckMissedSemicolon( /* tokens */
  43999. ) {
  44000. // Hook for Safe Parser
  44001. }
  44002. }, {
  44003. key: "checkMissedSemicolon",
  44004. value: function checkMissedSemicolon(tokens) {
  44005. var colon = this.colon(tokens);
  44006. if (colon === false) return;
  44007. var founded = 0;
  44008. var token;
  44009. for (var j = colon - 1; j >= 0; j--) {
  44010. token = tokens[j];
  44011. if (token[0] !== 'space') {
  44012. founded += 1;
  44013. if (founded === 2) break;
  44014. }
  44015. }
  44016. // If the token is a word, e.g. `!important`, `red` or any other valid property's value.
  44017. // Then we need to return the colon after that word token. [3] is the "end" colon of that word.
  44018. // And because we need it after that one we do +1 to get the next one.
  44019. throw this.input.error('Missed semicolon', token[0] === 'word' ? token[3] + 1 : token[2]);
  44020. }
  44021. }]);
  44022. return Parser;
  44023. }();
  44024. module.exports = Parser;
  44025. /***/ }),
  44026. /***/ 7866:
  44027. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  44028. var CssSyntaxError = __webpack_require__(1667);
  44029. var Declaration = __webpack_require__(6417);
  44030. var LazyResult = __webpack_require__(6992);
  44031. var Container = __webpack_require__(1204);
  44032. var Processor = __webpack_require__(9429);
  44033. var stringify = __webpack_require__(6157);
  44034. var fromJSON = __webpack_require__(9295);
  44035. var Document = __webpack_require__(7083);
  44036. var Warning = __webpack_require__(1662);
  44037. var Comment = __webpack_require__(3102);
  44038. var AtRule = __webpack_require__(8940);
  44039. var Result = __webpack_require__(6865);
  44040. var Input = __webpack_require__(2993);
  44041. var parse = __webpack_require__(7057);
  44042. var list = __webpack_require__(6136);
  44043. var Rule = __webpack_require__(6621);
  44044. var Root = __webpack_require__(7563);
  44045. var Node = __webpack_require__(4343);
  44046. function postcss() {
  44047. for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {
  44048. plugins[_key] = arguments[_key];
  44049. }
  44050. if (plugins.length === 1 && Array.isArray(plugins[0])) {
  44051. plugins = plugins[0];
  44052. }
  44053. return new Processor(plugins);
  44054. }
  44055. postcss.plugin = function plugin(name, initializer) {
  44056. var warningPrinted = false;
  44057. function creator() {
  44058. // eslint-disable-next-line no-console
  44059. if (console && console.warn && !warningPrinted) {
  44060. warningPrinted = true;
  44061. // eslint-disable-next-line no-console
  44062. console.warn(name + ': postcss.plugin was deprecated. Migration guide:\n' + 'https://evilmartians.com/chronicles/postcss-8-plugin-migration');
  44063. if (process.env.LANG && process.env.LANG.startsWith('cn')) {
  44064. /* c8 ignore next 7 */
  44065. // eslint-disable-next-line no-console
  44066. console.warn(name + ': 里面 postcss.plugin 被弃用. 迁移指南:\n' + 'https://www.w3ctech.com/topic/2226');
  44067. }
  44068. }
  44069. var transformer = initializer.apply(void 0, arguments);
  44070. transformer.postcssPlugin = name;
  44071. transformer.postcssVersion = new Processor().version;
  44072. return transformer;
  44073. }
  44074. var cache;
  44075. Object.defineProperty(creator, 'postcss', {
  44076. get: function get() {
  44077. if (!cache) cache = creator();
  44078. return cache;
  44079. }
  44080. });
  44081. creator.process = function (css, processOpts, pluginOpts) {
  44082. return postcss([creator(pluginOpts)]).process(css, processOpts);
  44083. };
  44084. return creator;
  44085. };
  44086. postcss.stringify = stringify;
  44087. postcss.parse = parse;
  44088. postcss.fromJSON = fromJSON;
  44089. postcss.list = list;
  44090. postcss.comment = function (defaults) {
  44091. return new Comment(defaults);
  44092. };
  44093. postcss.atRule = function (defaults) {
  44094. return new AtRule(defaults);
  44095. };
  44096. postcss.decl = function (defaults) {
  44097. return new Declaration(defaults);
  44098. };
  44099. postcss.rule = function (defaults) {
  44100. return new Rule(defaults);
  44101. };
  44102. postcss.root = function (defaults) {
  44103. return new Root(defaults);
  44104. };
  44105. postcss.document = function (defaults) {
  44106. return new Document(defaults);
  44107. };
  44108. postcss.CssSyntaxError = CssSyntaxError;
  44109. postcss.Declaration = Declaration;
  44110. postcss.Container = Container;
  44111. postcss.Processor = Processor;
  44112. postcss.Document = Document;
  44113. postcss.Comment = Comment;
  44114. postcss.Warning = Warning;
  44115. postcss.AtRule = AtRule;
  44116. postcss.Result = Result;
  44117. postcss.Input = Input;
  44118. postcss.Rule = Rule;
  44119. postcss.Root = Root;
  44120. postcss.Node = Node;
  44121. LazyResult.registerPostcss(postcss);
  44122. module.exports = postcss;
  44123. postcss["default"] = postcss;
  44124. /***/ }),
  44125. /***/ 3353:
  44126. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  44127. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  44128. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  44129. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
  44130. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  44131. function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
  44132. function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
  44133. var _require = __webpack_require__(209),
  44134. SourceMapConsumer = _require.SourceMapConsumer,
  44135. SourceMapGenerator = _require.SourceMapGenerator;
  44136. var _require2 = __webpack_require__(4777),
  44137. existsSync = _require2.existsSync,
  44138. readFileSync = _require2.readFileSync;
  44139. var _require3 = __webpack_require__(9830),
  44140. dirname = _require3.dirname,
  44141. join = _require3.join;
  44142. function fromBase64(str) {
  44143. if (Buffer) {
  44144. return Buffer.from(str, 'base64').toString();
  44145. } else {
  44146. /* c8 ignore next 2 */
  44147. return window.atob(str);
  44148. }
  44149. }
  44150. var PreviousMap = /*#__PURE__*/function () {
  44151. function PreviousMap(css, opts) {
  44152. _classCallCheck(this, PreviousMap);
  44153. if (opts.map === false) return;
  44154. this.loadAnnotation(css);
  44155. this.inline = this.startWith(this.annotation, 'data:');
  44156. var prev = opts.map ? opts.map.prev : undefined;
  44157. var text = this.loadMap(opts.from, prev);
  44158. if (!this.mapFile && opts.from) {
  44159. this.mapFile = opts.from;
  44160. }
  44161. if (this.mapFile) this.root = dirname(this.mapFile);
  44162. if (text) this.text = text;
  44163. }
  44164. _createClass(PreviousMap, [{
  44165. key: "consumer",
  44166. value: function consumer() {
  44167. if (!this.consumerCache) {
  44168. this.consumerCache = new SourceMapConsumer(this.text);
  44169. }
  44170. return this.consumerCache;
  44171. }
  44172. }, {
  44173. key: "withContent",
  44174. value: function withContent() {
  44175. return !!(this.consumer().sourcesContent && this.consumer().sourcesContent.length > 0);
  44176. }
  44177. }, {
  44178. key: "startWith",
  44179. value: function startWith(string, start) {
  44180. if (!string) return false;
  44181. return string.substr(0, start.length) === start;
  44182. }
  44183. }, {
  44184. key: "getAnnotationURL",
  44185. value: function getAnnotationURL(sourceMapString) {
  44186. return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, '').trim();
  44187. }
  44188. }, {
  44189. key: "loadAnnotation",
  44190. value: function loadAnnotation(css) {
  44191. var comments = css.match(/\/\*\s*# sourceMappingURL=/gm);
  44192. if (!comments) return;
  44193. // sourceMappingURLs from comments, strings, etc.
  44194. var start = css.lastIndexOf(comments.pop());
  44195. var end = css.indexOf('*/', start);
  44196. if (start > -1 && end > -1) {
  44197. // Locate the last sourceMappingURL to avoid pickin
  44198. this.annotation = this.getAnnotationURL(css.substring(start, end));
  44199. }
  44200. }
  44201. }, {
  44202. key: "decodeInline",
  44203. value: function decodeInline(text) {
  44204. var baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/;
  44205. var baseUri = /^data:application\/json;base64,/;
  44206. var charsetUri = /^data:application\/json;charset=utf-?8,/;
  44207. var uri = /^data:application\/json,/;
  44208. if (charsetUri.test(text) || uri.test(text)) {
  44209. return decodeURIComponent(text.substr(RegExp.lastMatch.length));
  44210. }
  44211. if (baseCharsetUri.test(text) || baseUri.test(text)) {
  44212. return fromBase64(text.substr(RegExp.lastMatch.length));
  44213. }
  44214. var encoding = text.match(/data:application\/json;([^,]+),/)[1];
  44215. throw new Error('Unsupported source map encoding ' + encoding);
  44216. }
  44217. }, {
  44218. key: "loadFile",
  44219. value: function loadFile(path) {
  44220. this.root = dirname(path);
  44221. if (existsSync(path)) {
  44222. this.mapFile = path;
  44223. return readFileSync(path, 'utf-8').toString().trim();
  44224. }
  44225. }
  44226. }, {
  44227. key: "loadMap",
  44228. value: function loadMap(file, prev) {
  44229. if (prev === false) return false;
  44230. if (prev) {
  44231. if (typeof prev === 'string') {
  44232. return prev;
  44233. } else if (typeof prev === 'function') {
  44234. var prevPath = prev(file);
  44235. if (prevPath) {
  44236. var map = this.loadFile(prevPath);
  44237. if (!map) {
  44238. throw new Error('Unable to load previous source map: ' + prevPath.toString());
  44239. }
  44240. return map;
  44241. }
  44242. } else if (prev instanceof SourceMapConsumer) {
  44243. return SourceMapGenerator.fromSourceMap(prev).toString();
  44244. } else if (prev instanceof SourceMapGenerator) {
  44245. return prev.toString();
  44246. } else if (this.isMap(prev)) {
  44247. return JSON.stringify(prev);
  44248. } else {
  44249. throw new Error('Unsupported previous source map format: ' + prev.toString());
  44250. }
  44251. } else if (this.inline) {
  44252. return this.decodeInline(this.annotation);
  44253. } else if (this.annotation) {
  44254. var _map = this.annotation;
  44255. if (file) _map = join(dirname(file), _map);
  44256. return this.loadFile(_map);
  44257. }
  44258. }
  44259. }, {
  44260. key: "isMap",
  44261. value: function isMap(map) {
  44262. if (_typeof(map) !== 'object') return false;
  44263. return typeof map.mappings === 'string' || typeof map._mappings === 'string' || Array.isArray(map.sections);
  44264. }
  44265. }]);
  44266. return PreviousMap;
  44267. }();
  44268. module.exports = PreviousMap;
  44269. PreviousMap["default"] = PreviousMap;
  44270. /***/ }),
  44271. /***/ 9429:
  44272. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  44273. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  44274. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  44275. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  44276. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  44277. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  44278. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
  44279. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  44280. function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
  44281. function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
  44282. var NoWorkResult = __webpack_require__(7686);
  44283. var LazyResult = __webpack_require__(6992);
  44284. var Document = __webpack_require__(7083);
  44285. var Root = __webpack_require__(7563);
  44286. var Processor = /*#__PURE__*/function () {
  44287. function Processor() {
  44288. var plugins = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  44289. _classCallCheck(this, Processor);
  44290. this.version = '8.4.23';
  44291. this.plugins = this.normalize(plugins);
  44292. }
  44293. _createClass(Processor, [{
  44294. key: "use",
  44295. value: function use(plugin) {
  44296. this.plugins = this.plugins.concat(this.normalize([plugin]));
  44297. return this;
  44298. }
  44299. }, {
  44300. key: "process",
  44301. value: function process(css) {
  44302. var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  44303. if (this.plugins.length === 0 && typeof opts.parser === 'undefined' && typeof opts.stringifier === 'undefined' && typeof opts.syntax === 'undefined') {
  44304. return new NoWorkResult(this, css, opts);
  44305. } else {
  44306. return new LazyResult(this, css, opts);
  44307. }
  44308. }
  44309. }, {
  44310. key: "normalize",
  44311. value: function normalize(plugins) {
  44312. var normalized = [];
  44313. var _iterator = _createForOfIteratorHelper(plugins),
  44314. _step;
  44315. try {
  44316. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  44317. var i = _step.value;
  44318. if (i.postcss === true) {
  44319. i = i();
  44320. } else if (i.postcss) {
  44321. i = i.postcss;
  44322. }
  44323. if (_typeof(i) === 'object' && Array.isArray(i.plugins)) {
  44324. normalized = normalized.concat(i.plugins);
  44325. } else if (_typeof(i) === 'object' && i.postcssPlugin) {
  44326. normalized.push(i);
  44327. } else if (typeof i === 'function') {
  44328. normalized.push(i);
  44329. } else if (_typeof(i) === 'object' && (i.parse || i.stringify)) {
  44330. if (false) {}
  44331. } else {
  44332. throw new Error(i + ' is not a PostCSS plugin');
  44333. }
  44334. }
  44335. } catch (err) {
  44336. _iterator.e(err);
  44337. } finally {
  44338. _iterator.f();
  44339. }
  44340. return normalized;
  44341. }
  44342. }]);
  44343. return Processor;
  44344. }();
  44345. module.exports = Processor;
  44346. Processor["default"] = Processor;
  44347. Root.registerProcessor(Processor);
  44348. Document.registerProcessor(Processor);
  44349. /***/ }),
  44350. /***/ 6865:
  44351. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  44352. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  44353. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  44354. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
  44355. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  44356. function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
  44357. function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
  44358. var Warning = __webpack_require__(1662);
  44359. var Result = /*#__PURE__*/function () {
  44360. function Result(processor, root, opts) {
  44361. _classCallCheck(this, Result);
  44362. this.processor = processor;
  44363. this.messages = [];
  44364. this.root = root;
  44365. this.opts = opts;
  44366. this.css = undefined;
  44367. this.map = undefined;
  44368. }
  44369. _createClass(Result, [{
  44370. key: "toString",
  44371. value: function toString() {
  44372. return this.css;
  44373. }
  44374. }, {
  44375. key: "warn",
  44376. value: function warn(text) {
  44377. var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  44378. if (!opts.plugin) {
  44379. if (this.lastPlugin && this.lastPlugin.postcssPlugin) {
  44380. opts.plugin = this.lastPlugin.postcssPlugin;
  44381. }
  44382. }
  44383. var warning = new Warning(text, opts);
  44384. this.messages.push(warning);
  44385. return warning;
  44386. }
  44387. }, {
  44388. key: "warnings",
  44389. value: function warnings() {
  44390. return this.messages.filter(function (i) {
  44391. return i.type === 'warning';
  44392. });
  44393. }
  44394. }, {
  44395. key: "content",
  44396. get: function get() {
  44397. return this.css;
  44398. }
  44399. }]);
  44400. return Result;
  44401. }();
  44402. module.exports = Result;
  44403. Result["default"] = Result;
  44404. /***/ }),
  44405. /***/ 7563:
  44406. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  44407. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  44408. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  44409. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  44410. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  44411. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  44412. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
  44413. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  44414. function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
  44415. function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
  44416. function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
  44417. function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
  44418. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
  44419. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  44420. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
  44421. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
  44422. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  44423. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
  44424. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  44425. var Container = __webpack_require__(1204);
  44426. var LazyResult, Processor;
  44427. var Root = /*#__PURE__*/function (_Container) {
  44428. _inherits(Root, _Container);
  44429. var _super = _createSuper(Root);
  44430. function Root(defaults) {
  44431. var _this;
  44432. _classCallCheck(this, Root);
  44433. _this = _super.call(this, defaults);
  44434. _this.type = 'root';
  44435. if (!_this.nodes) _this.nodes = [];
  44436. return _this;
  44437. }
  44438. _createClass(Root, [{
  44439. key: "removeChild",
  44440. value: function removeChild(child, ignore) {
  44441. var index = this.index(child);
  44442. if (!ignore && index === 0 && this.nodes.length > 1) {
  44443. this.nodes[1].raws.before = this.nodes[index].raws.before;
  44444. }
  44445. return _get(_getPrototypeOf(Root.prototype), "removeChild", this).call(this, child);
  44446. }
  44447. }, {
  44448. key: "normalize",
  44449. value: function normalize(child, sample, type) {
  44450. var nodes = _get(_getPrototypeOf(Root.prototype), "normalize", this).call(this, child);
  44451. if (sample) {
  44452. if (type === 'prepend') {
  44453. if (this.nodes.length > 1) {
  44454. sample.raws.before = this.nodes[1].raws.before;
  44455. } else {
  44456. delete sample.raws.before;
  44457. }
  44458. } else if (this.first !== sample) {
  44459. var _iterator = _createForOfIteratorHelper(nodes),
  44460. _step;
  44461. try {
  44462. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  44463. var node = _step.value;
  44464. node.raws.before = sample.raws.before;
  44465. }
  44466. } catch (err) {
  44467. _iterator.e(err);
  44468. } finally {
  44469. _iterator.f();
  44470. }
  44471. }
  44472. }
  44473. return nodes;
  44474. }
  44475. }, {
  44476. key: "toResult",
  44477. value: function toResult() {
  44478. var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  44479. var lazy = new LazyResult(new Processor(), this, opts);
  44480. return lazy.stringify();
  44481. }
  44482. }]);
  44483. return Root;
  44484. }(Container);
  44485. Root.registerLazyResult = function (dependant) {
  44486. LazyResult = dependant;
  44487. };
  44488. Root.registerProcessor = function (dependant) {
  44489. Processor = dependant;
  44490. };
  44491. module.exports = Root;
  44492. Root["default"] = Root;
  44493. Container.registerRoot(Root);
  44494. /***/ }),
  44495. /***/ 6621:
  44496. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  44497. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  44498. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  44499. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
  44500. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  44501. function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
  44502. function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
  44503. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
  44504. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  44505. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
  44506. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
  44507. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  44508. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
  44509. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  44510. var Container = __webpack_require__(1204);
  44511. var list = __webpack_require__(6136);
  44512. var Rule = /*#__PURE__*/function (_Container) {
  44513. _inherits(Rule, _Container);
  44514. var _super = _createSuper(Rule);
  44515. function Rule(defaults) {
  44516. var _this;
  44517. _classCallCheck(this, Rule);
  44518. _this = _super.call(this, defaults);
  44519. _this.type = 'rule';
  44520. if (!_this.nodes) _this.nodes = [];
  44521. return _this;
  44522. }
  44523. _createClass(Rule, [{
  44524. key: "selectors",
  44525. get: function get() {
  44526. return list.comma(this.selector);
  44527. },
  44528. set: function set(values) {
  44529. var match = this.selector ? this.selector.match(/,\s*/) : null;
  44530. var sep = match ? match[0] : ',' + this.raw('between', 'beforeOpen');
  44531. this.selector = values.join(sep);
  44532. }
  44533. }]);
  44534. return Rule;
  44535. }(Container);
  44536. module.exports = Rule;
  44537. Rule["default"] = Rule;
  44538. Container.registerRule(Rule);
  44539. /***/ }),
  44540. /***/ 5701:
  44541. /***/ ((module) => {
  44542. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  44543. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  44544. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
  44545. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  44546. function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
  44547. function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
  44548. var DEFAULT_RAW = {
  44549. colon: ': ',
  44550. indent: ' ',
  44551. beforeDecl: '\n',
  44552. beforeRule: '\n',
  44553. beforeOpen: ' ',
  44554. beforeClose: '\n',
  44555. beforeComment: '\n',
  44556. after: '\n',
  44557. emptyBody: '',
  44558. commentLeft: ' ',
  44559. commentRight: ' ',
  44560. semicolon: false
  44561. };
  44562. function capitalize(str) {
  44563. return str[0].toUpperCase() + str.slice(1);
  44564. }
  44565. var Stringifier = /*#__PURE__*/function () {
  44566. function Stringifier(builder) {
  44567. _classCallCheck(this, Stringifier);
  44568. this.builder = builder;
  44569. }
  44570. _createClass(Stringifier, [{
  44571. key: "stringify",
  44572. value: function stringify(node, semicolon) {
  44573. /* c8 ignore start */
  44574. if (!this[node.type]) {
  44575. throw new Error('Unknown AST node type ' + node.type + '. ' + 'Maybe you need to change PostCSS stringifier.');
  44576. }
  44577. /* c8 ignore stop */
  44578. this[node.type](node, semicolon);
  44579. }
  44580. }, {
  44581. key: "document",
  44582. value: function document(node) {
  44583. this.body(node);
  44584. }
  44585. }, {
  44586. key: "root",
  44587. value: function root(node) {
  44588. this.body(node);
  44589. if (node.raws.after) this.builder(node.raws.after);
  44590. }
  44591. }, {
  44592. key: "comment",
  44593. value: function comment(node) {
  44594. var left = this.raw(node, 'left', 'commentLeft');
  44595. var right = this.raw(node, 'right', 'commentRight');
  44596. this.builder('/*' + left + node.text + right + '*/', node);
  44597. }
  44598. }, {
  44599. key: "decl",
  44600. value: function decl(node, semicolon) {
  44601. var between = this.raw(node, 'between', 'colon');
  44602. var string = node.prop + between + this.rawValue(node, 'value');
  44603. if (node.important) {
  44604. string += node.raws.important || ' !important';
  44605. }
  44606. if (semicolon) string += ';';
  44607. this.builder(string, node);
  44608. }
  44609. }, {
  44610. key: "rule",
  44611. value: function rule(node) {
  44612. this.block(node, this.rawValue(node, 'selector'));
  44613. if (node.raws.ownSemicolon) {
  44614. this.builder(node.raws.ownSemicolon, node, 'end');
  44615. }
  44616. }
  44617. }, {
  44618. key: "atrule",
  44619. value: function atrule(node, semicolon) {
  44620. var name = '@' + node.name;
  44621. var params = node.params ? this.rawValue(node, 'params') : '';
  44622. if (typeof node.raws.afterName !== 'undefined') {
  44623. name += node.raws.afterName;
  44624. } else if (params) {
  44625. name += ' ';
  44626. }
  44627. if (node.nodes) {
  44628. this.block(node, name + params);
  44629. } else {
  44630. var end = (node.raws.between || '') + (semicolon ? ';' : '');
  44631. this.builder(name + params + end, node);
  44632. }
  44633. }
  44634. }, {
  44635. key: "body",
  44636. value: function body(node) {
  44637. var last = node.nodes.length - 1;
  44638. while (last > 0) {
  44639. if (node.nodes[last].type !== 'comment') break;
  44640. last -= 1;
  44641. }
  44642. var semicolon = this.raw(node, 'semicolon');
  44643. for (var i = 0; i < node.nodes.length; i++) {
  44644. var child = node.nodes[i];
  44645. var before = this.raw(child, 'before');
  44646. if (before) this.builder(before);
  44647. this.stringify(child, last !== i || semicolon);
  44648. }
  44649. }
  44650. }, {
  44651. key: "block",
  44652. value: function block(node, start) {
  44653. var between = this.raw(node, 'between', 'beforeOpen');
  44654. this.builder(start + between + '{', node, 'start');
  44655. var after;
  44656. if (node.nodes && node.nodes.length) {
  44657. this.body(node);
  44658. after = this.raw(node, 'after');
  44659. } else {
  44660. after = this.raw(node, 'after', 'emptyBody');
  44661. }
  44662. if (after) this.builder(after);
  44663. this.builder('}', node, 'end');
  44664. }
  44665. }, {
  44666. key: "raw",
  44667. value: function raw(node, own, detect) {
  44668. var value;
  44669. if (!detect) detect = own;
  44670. // Already had
  44671. if (own) {
  44672. value = node.raws[own];
  44673. if (typeof value !== 'undefined') return value;
  44674. }
  44675. var parent = node.parent;
  44676. if (detect === 'before') {
  44677. // Hack for first rule in CSS
  44678. if (!parent || parent.type === 'root' && parent.first === node) {
  44679. return '';
  44680. }
  44681. // `root` nodes in `document` should use only their own raws
  44682. if (parent && parent.type === 'document') {
  44683. return '';
  44684. }
  44685. }
  44686. // Floating child without parent
  44687. if (!parent) return DEFAULT_RAW[detect];
  44688. // Detect style by other nodes
  44689. var root = node.root();
  44690. if (!root.rawCache) root.rawCache = {};
  44691. if (typeof root.rawCache[detect] !== 'undefined') {
  44692. return root.rawCache[detect];
  44693. }
  44694. if (detect === 'before' || detect === 'after') {
  44695. return this.beforeAfter(node, detect);
  44696. } else {
  44697. var method = 'raw' + capitalize(detect);
  44698. if (this[method]) {
  44699. value = this[method](root, node);
  44700. } else {
  44701. root.walk(function (i) {
  44702. value = i.raws[own];
  44703. if (typeof value !== 'undefined') return false;
  44704. });
  44705. }
  44706. }
  44707. if (typeof value === 'undefined') value = DEFAULT_RAW[detect];
  44708. root.rawCache[detect] = value;
  44709. return value;
  44710. }
  44711. }, {
  44712. key: "rawSemicolon",
  44713. value: function rawSemicolon(root) {
  44714. var value;
  44715. root.walk(function (i) {
  44716. if (i.nodes && i.nodes.length && i.last.type === 'decl') {
  44717. value = i.raws.semicolon;
  44718. if (typeof value !== 'undefined') return false;
  44719. }
  44720. });
  44721. return value;
  44722. }
  44723. }, {
  44724. key: "rawEmptyBody",
  44725. value: function rawEmptyBody(root) {
  44726. var value;
  44727. root.walk(function (i) {
  44728. if (i.nodes && i.nodes.length === 0) {
  44729. value = i.raws.after;
  44730. if (typeof value !== 'undefined') return false;
  44731. }
  44732. });
  44733. return value;
  44734. }
  44735. }, {
  44736. key: "rawIndent",
  44737. value: function rawIndent(root) {
  44738. if (root.raws.indent) return root.raws.indent;
  44739. var value;
  44740. root.walk(function (i) {
  44741. var p = i.parent;
  44742. if (p && p !== root && p.parent && p.parent === root) {
  44743. if (typeof i.raws.before !== 'undefined') {
  44744. var parts = i.raws.before.split('\n');
  44745. value = parts[parts.length - 1];
  44746. value = value.replace(/\S/g, '');
  44747. return false;
  44748. }
  44749. }
  44750. });
  44751. return value;
  44752. }
  44753. }, {
  44754. key: "rawBeforeComment",
  44755. value: function rawBeforeComment(root, node) {
  44756. var value;
  44757. root.walkComments(function (i) {
  44758. if (typeof i.raws.before !== 'undefined') {
  44759. value = i.raws.before;
  44760. if (value.includes('\n')) {
  44761. value = value.replace(/[^\n]+$/, '');
  44762. }
  44763. return false;
  44764. }
  44765. });
  44766. if (typeof value === 'undefined') {
  44767. value = this.raw(node, null, 'beforeDecl');
  44768. } else if (value) {
  44769. value = value.replace(/\S/g, '');
  44770. }
  44771. return value;
  44772. }
  44773. }, {
  44774. key: "rawBeforeDecl",
  44775. value: function rawBeforeDecl(root, node) {
  44776. var value;
  44777. root.walkDecls(function (i) {
  44778. if (typeof i.raws.before !== 'undefined') {
  44779. value = i.raws.before;
  44780. if (value.includes('\n')) {
  44781. value = value.replace(/[^\n]+$/, '');
  44782. }
  44783. return false;
  44784. }
  44785. });
  44786. if (typeof value === 'undefined') {
  44787. value = this.raw(node, null, 'beforeRule');
  44788. } else if (value) {
  44789. value = value.replace(/\S/g, '');
  44790. }
  44791. return value;
  44792. }
  44793. }, {
  44794. key: "rawBeforeRule",
  44795. value: function rawBeforeRule(root) {
  44796. var value;
  44797. root.walk(function (i) {
  44798. if (i.nodes && (i.parent !== root || root.first !== i)) {
  44799. if (typeof i.raws.before !== 'undefined') {
  44800. value = i.raws.before;
  44801. if (value.includes('\n')) {
  44802. value = value.replace(/[^\n]+$/, '');
  44803. }
  44804. return false;
  44805. }
  44806. }
  44807. });
  44808. if (value) value = value.replace(/\S/g, '');
  44809. return value;
  44810. }
  44811. }, {
  44812. key: "rawBeforeClose",
  44813. value: function rawBeforeClose(root) {
  44814. var value;
  44815. root.walk(function (i) {
  44816. if (i.nodes && i.nodes.length > 0) {
  44817. if (typeof i.raws.after !== 'undefined') {
  44818. value = i.raws.after;
  44819. if (value.includes('\n')) {
  44820. value = value.replace(/[^\n]+$/, '');
  44821. }
  44822. return false;
  44823. }
  44824. }
  44825. });
  44826. if (value) value = value.replace(/\S/g, '');
  44827. return value;
  44828. }
  44829. }, {
  44830. key: "rawBeforeOpen",
  44831. value: function rawBeforeOpen(root) {
  44832. var value;
  44833. root.walk(function (i) {
  44834. if (i.type !== 'decl') {
  44835. value = i.raws.between;
  44836. if (typeof value !== 'undefined') return false;
  44837. }
  44838. });
  44839. return value;
  44840. }
  44841. }, {
  44842. key: "rawColon",
  44843. value: function rawColon(root) {
  44844. var value;
  44845. root.walkDecls(function (i) {
  44846. if (typeof i.raws.between !== 'undefined') {
  44847. value = i.raws.between.replace(/[^\s:]/g, '');
  44848. return false;
  44849. }
  44850. });
  44851. return value;
  44852. }
  44853. }, {
  44854. key: "beforeAfter",
  44855. value: function beforeAfter(node, detect) {
  44856. var value;
  44857. if (node.type === 'decl') {
  44858. value = this.raw(node, null, 'beforeDecl');
  44859. } else if (node.type === 'comment') {
  44860. value = this.raw(node, null, 'beforeComment');
  44861. } else if (detect === 'before') {
  44862. value = this.raw(node, null, 'beforeRule');
  44863. } else {
  44864. value = this.raw(node, null, 'beforeClose');
  44865. }
  44866. var buf = node.parent;
  44867. var depth = 0;
  44868. while (buf && buf.type !== 'root') {
  44869. depth += 1;
  44870. buf = buf.parent;
  44871. }
  44872. if (value.includes('\n')) {
  44873. var indent = this.raw(node, null, 'indent');
  44874. if (indent.length) {
  44875. for (var step = 0; step < depth; step++) value += indent;
  44876. }
  44877. }
  44878. return value;
  44879. }
  44880. }, {
  44881. key: "rawValue",
  44882. value: function rawValue(node, prop) {
  44883. var value = node[prop];
  44884. var raw = node.raws[prop];
  44885. if (raw && raw.value === value) {
  44886. return raw.raw;
  44887. }
  44888. return value;
  44889. }
  44890. }]);
  44891. return Stringifier;
  44892. }();
  44893. module.exports = Stringifier;
  44894. Stringifier["default"] = Stringifier;
  44895. /***/ }),
  44896. /***/ 6157:
  44897. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  44898. var Stringifier = __webpack_require__(5701);
  44899. function stringify(node, builder) {
  44900. var str = new Stringifier(builder);
  44901. str.stringify(node);
  44902. }
  44903. module.exports = stringify;
  44904. stringify["default"] = stringify;
  44905. /***/ }),
  44906. /***/ 5506:
  44907. /***/ ((module) => {
  44908. module.exports.isClean = Symbol('isClean');
  44909. module.exports.my = Symbol('my');
  44910. /***/ }),
  44911. /***/ 1157:
  44912. /***/ ((module) => {
  44913. var SINGLE_QUOTE = "'".charCodeAt(0);
  44914. var DOUBLE_QUOTE = '"'.charCodeAt(0);
  44915. var BACKSLASH = '\\'.charCodeAt(0);
  44916. var SLASH = '/'.charCodeAt(0);
  44917. var NEWLINE = '\n'.charCodeAt(0);
  44918. var SPACE = ' '.charCodeAt(0);
  44919. var FEED = '\f'.charCodeAt(0);
  44920. var TAB = '\t'.charCodeAt(0);
  44921. var CR = '\r'.charCodeAt(0);
  44922. var OPEN_SQUARE = '['.charCodeAt(0);
  44923. var CLOSE_SQUARE = ']'.charCodeAt(0);
  44924. var OPEN_PARENTHESES = '('.charCodeAt(0);
  44925. var CLOSE_PARENTHESES = ')'.charCodeAt(0);
  44926. var OPEN_CURLY = '{'.charCodeAt(0);
  44927. var CLOSE_CURLY = '}'.charCodeAt(0);
  44928. var SEMICOLON = ';'.charCodeAt(0);
  44929. var ASTERISK = '*'.charCodeAt(0);
  44930. var COLON = ':'.charCodeAt(0);
  44931. var AT = '@'.charCodeAt(0);
  44932. var RE_AT_END = /[\t\n\f\r "#'()/;[\\\]{}]/g;
  44933. var RE_WORD_END = /[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g;
  44934. var RE_BAD_BRACKET = /.[\n"'(/\\]/;
  44935. var RE_HEX_ESCAPE = /[\da-f]/i;
  44936. module.exports = function tokenizer(input) {
  44937. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  44938. var css = input.css.valueOf();
  44939. var ignore = options.ignoreErrors;
  44940. var code, next, quote, content, escape;
  44941. var escaped, escapePos, prev, n, currentToken;
  44942. var length = css.length;
  44943. var pos = 0;
  44944. var buffer = [];
  44945. var returned = [];
  44946. function position() {
  44947. return pos;
  44948. }
  44949. function unclosed(what) {
  44950. throw input.error('Unclosed ' + what, pos);
  44951. }
  44952. function endOfFile() {
  44953. return returned.length === 0 && pos >= length;
  44954. }
  44955. function nextToken(opts) {
  44956. if (returned.length) return returned.pop();
  44957. if (pos >= length) return;
  44958. var ignoreUnclosed = opts ? opts.ignoreUnclosed : false;
  44959. code = css.charCodeAt(pos);
  44960. switch (code) {
  44961. case NEWLINE:
  44962. case SPACE:
  44963. case TAB:
  44964. case CR:
  44965. case FEED:
  44966. {
  44967. next = pos;
  44968. do {
  44969. next += 1;
  44970. code = css.charCodeAt(next);
  44971. } while (code === SPACE || code === NEWLINE || code === TAB || code === CR || code === FEED);
  44972. currentToken = ['space', css.slice(pos, next)];
  44973. pos = next - 1;
  44974. break;
  44975. }
  44976. case OPEN_SQUARE:
  44977. case CLOSE_SQUARE:
  44978. case OPEN_CURLY:
  44979. case CLOSE_CURLY:
  44980. case COLON:
  44981. case SEMICOLON:
  44982. case CLOSE_PARENTHESES:
  44983. {
  44984. var controlChar = String.fromCharCode(code);
  44985. currentToken = [controlChar, controlChar, pos];
  44986. break;
  44987. }
  44988. case OPEN_PARENTHESES:
  44989. {
  44990. prev = buffer.length ? buffer.pop()[1] : '';
  44991. n = css.charCodeAt(pos + 1);
  44992. if (prev === 'url' && n !== SINGLE_QUOTE && n !== DOUBLE_QUOTE && n !== SPACE && n !== NEWLINE && n !== TAB && n !== FEED && n !== CR) {
  44993. next = pos;
  44994. do {
  44995. escaped = false;
  44996. next = css.indexOf(')', next + 1);
  44997. if (next === -1) {
  44998. if (ignore || ignoreUnclosed) {
  44999. next = pos;
  45000. break;
  45001. } else {
  45002. unclosed('bracket');
  45003. }
  45004. }
  45005. escapePos = next;
  45006. while (css.charCodeAt(escapePos - 1) === BACKSLASH) {
  45007. escapePos -= 1;
  45008. escaped = !escaped;
  45009. }
  45010. } while (escaped);
  45011. currentToken = ['brackets', css.slice(pos, next + 1), pos, next];
  45012. pos = next;
  45013. } else {
  45014. next = css.indexOf(')', pos + 1);
  45015. content = css.slice(pos, next + 1);
  45016. if (next === -1 || RE_BAD_BRACKET.test(content)) {
  45017. currentToken = ['(', '(', pos];
  45018. } else {
  45019. currentToken = ['brackets', content, pos, next];
  45020. pos = next;
  45021. }
  45022. }
  45023. break;
  45024. }
  45025. case SINGLE_QUOTE:
  45026. case DOUBLE_QUOTE:
  45027. {
  45028. quote = code === SINGLE_QUOTE ? "'" : '"';
  45029. next = pos;
  45030. do {
  45031. escaped = false;
  45032. next = css.indexOf(quote, next + 1);
  45033. if (next === -1) {
  45034. if (ignore || ignoreUnclosed) {
  45035. next = pos + 1;
  45036. break;
  45037. } else {
  45038. unclosed('string');
  45039. }
  45040. }
  45041. escapePos = next;
  45042. while (css.charCodeAt(escapePos - 1) === BACKSLASH) {
  45043. escapePos -= 1;
  45044. escaped = !escaped;
  45045. }
  45046. } while (escaped);
  45047. currentToken = ['string', css.slice(pos, next + 1), pos, next];
  45048. pos = next;
  45049. break;
  45050. }
  45051. case AT:
  45052. {
  45053. RE_AT_END.lastIndex = pos + 1;
  45054. RE_AT_END.test(css);
  45055. if (RE_AT_END.lastIndex === 0) {
  45056. next = css.length - 1;
  45057. } else {
  45058. next = RE_AT_END.lastIndex - 2;
  45059. }
  45060. currentToken = ['at-word', css.slice(pos, next + 1), pos, next];
  45061. pos = next;
  45062. break;
  45063. }
  45064. case BACKSLASH:
  45065. {
  45066. next = pos;
  45067. escape = true;
  45068. while (css.charCodeAt(next + 1) === BACKSLASH) {
  45069. next += 1;
  45070. escape = !escape;
  45071. }
  45072. code = css.charCodeAt(next + 1);
  45073. if (escape && code !== SLASH && code !== SPACE && code !== NEWLINE && code !== TAB && code !== CR && code !== FEED) {
  45074. next += 1;
  45075. if (RE_HEX_ESCAPE.test(css.charAt(next))) {
  45076. while (RE_HEX_ESCAPE.test(css.charAt(next + 1))) {
  45077. next += 1;
  45078. }
  45079. if (css.charCodeAt(next + 1) === SPACE) {
  45080. next += 1;
  45081. }
  45082. }
  45083. }
  45084. currentToken = ['word', css.slice(pos, next + 1), pos, next];
  45085. pos = next;
  45086. break;
  45087. }
  45088. default:
  45089. {
  45090. if (code === SLASH && css.charCodeAt(pos + 1) === ASTERISK) {
  45091. next = css.indexOf('*/', pos + 2) + 1;
  45092. if (next === 0) {
  45093. if (ignore || ignoreUnclosed) {
  45094. next = css.length;
  45095. } else {
  45096. unclosed('comment');
  45097. }
  45098. }
  45099. currentToken = ['comment', css.slice(pos, next + 1), pos, next];
  45100. pos = next;
  45101. } else {
  45102. RE_WORD_END.lastIndex = pos + 1;
  45103. RE_WORD_END.test(css);
  45104. if (RE_WORD_END.lastIndex === 0) {
  45105. next = css.length - 1;
  45106. } else {
  45107. next = RE_WORD_END.lastIndex - 2;
  45108. }
  45109. currentToken = ['word', css.slice(pos, next + 1), pos, next];
  45110. buffer.push(currentToken);
  45111. pos = next;
  45112. }
  45113. break;
  45114. }
  45115. }
  45116. pos++;
  45117. return currentToken;
  45118. }
  45119. function back(token) {
  45120. returned.push(token);
  45121. }
  45122. return {
  45123. back: back,
  45124. nextToken: nextToken,
  45125. endOfFile: endOfFile,
  45126. position: position
  45127. };
  45128. };
  45129. /***/ }),
  45130. /***/ 6574:
  45131. /***/ ((module) => {
  45132. /* eslint-disable no-console */
  45133. var printed = {};
  45134. module.exports = function warnOnce(message) {
  45135. if (printed[message]) return;
  45136. printed[message] = true;
  45137. if (typeof console !== 'undefined' && console.warn) {
  45138. console.warn(message);
  45139. }
  45140. };
  45141. /***/ }),
  45142. /***/ 1662:
  45143. /***/ ((module) => {
  45144. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  45145. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  45146. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
  45147. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  45148. function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
  45149. function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
  45150. var Warning = /*#__PURE__*/function () {
  45151. function Warning(text) {
  45152. var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  45153. _classCallCheck(this, Warning);
  45154. this.type = 'warning';
  45155. this.text = text;
  45156. if (opts.node && opts.node.source) {
  45157. var range = opts.node.rangeBy(opts);
  45158. this.line = range.start.line;
  45159. this.column = range.start.column;
  45160. this.endLine = range.end.line;
  45161. this.endColumn = range.end.column;
  45162. }
  45163. for (var opt in opts) this[opt] = opts[opt];
  45164. }
  45165. _createClass(Warning, [{
  45166. key: "toString",
  45167. value: function toString() {
  45168. if (this.node) {
  45169. return this.node.error(this.text, {
  45170. plugin: this.plugin,
  45171. index: this.index,
  45172. word: this.word
  45173. }).message;
  45174. }
  45175. if (this.plugin) {
  45176. return this.plugin + ': ' + this.text;
  45177. }
  45178. return this.text;
  45179. }
  45180. }]);
  45181. return Warning;
  45182. }();
  45183. module.exports = Warning;
  45184. Warning["default"] = Warning;
  45185. /***/ }),
  45186. /***/ 6760:
  45187. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  45188. /* module decorator */ module = __webpack_require__.nmd(module);
  45189. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  45190. /**
  45191. * Copyright (c) 2014, Facebook, Inc.
  45192. * All rights reserved.
  45193. *
  45194. * This source code is licensed under the BSD-style license found in the
  45195. * https://raw.github.com/facebook/regenerator/master/LICENSE file. An
  45196. * additional grant of patent rights can be found in the PATENTS file in
  45197. * the same directory.
  45198. */
  45199. !function (global) {
  45200. "use strict";
  45201. var Op = Object.prototype;
  45202. var hasOwn = Op.hasOwnProperty;
  45203. var undefined; // More compressible than void 0.
  45204. var $Symbol = typeof Symbol === "function" ? Symbol : {};
  45205. var iteratorSymbol = $Symbol.iterator || "@@iterator";
  45206. var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  45207. var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  45208. var inModule = ( false ? 0 : _typeof(module)) === "object";
  45209. var runtime = global.regeneratorRuntime;
  45210. if (runtime) {
  45211. if (inModule) {
  45212. // If regeneratorRuntime is defined globally and we're in a module,
  45213. // make the exports object identical to regeneratorRuntime.
  45214. module.exports = runtime;
  45215. }
  45216. // Don't bother evaluating the rest of this file if the runtime was
  45217. // already defined globally.
  45218. return;
  45219. }
  45220. // Define the runtime globally (as expected by generated code) as either
  45221. // module.exports (if we're in a module) or a new, empty object.
  45222. runtime = global.regeneratorRuntime = inModule ? module.exports : {};
  45223. function wrap(innerFn, outerFn, self, tryLocsList) {
  45224. // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
  45225. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
  45226. var generator = Object.create(protoGenerator.prototype);
  45227. var context = new Context(tryLocsList || []);
  45228. // The ._invoke method unifies the implementations of the .next,
  45229. // .throw, and .return methods.
  45230. generator._invoke = makeInvokeMethod(innerFn, self, context);
  45231. return generator;
  45232. }
  45233. runtime.wrap = wrap;
  45234. // Try/catch helper to minimize deoptimizations. Returns a completion
  45235. // record like context.tryEntries[i].completion. This interface could
  45236. // have been (and was previously) designed to take a closure to be
  45237. // invoked without arguments, but in all the cases we care about we
  45238. // already have an existing method we want to call, so there's no need
  45239. // to create a new function object. We can even get away with assuming
  45240. // the method takes exactly one argument, since that happens to be true
  45241. // in every case, so we don't have to touch the arguments object. The
  45242. // only additional allocation required is the completion record, which
  45243. // has a stable shape and so hopefully should be cheap to allocate.
  45244. function tryCatch(fn, obj, arg) {
  45245. try {
  45246. return {
  45247. type: "normal",
  45248. arg: fn.call(obj, arg)
  45249. };
  45250. } catch (err) {
  45251. return {
  45252. type: "throw",
  45253. arg: err
  45254. };
  45255. }
  45256. }
  45257. var GenStateSuspendedStart = "suspendedStart";
  45258. var GenStateSuspendedYield = "suspendedYield";
  45259. var GenStateExecuting = "executing";
  45260. var GenStateCompleted = "completed";
  45261. // Returning this object from the innerFn has the same effect as
  45262. // breaking out of the dispatch switch statement.
  45263. var ContinueSentinel = {};
  45264. // Dummy constructor functions that we use as the .constructor and
  45265. // .constructor.prototype properties for functions that return Generator
  45266. // objects. For full spec compliance, you may wish to configure your
  45267. // minifier not to mangle the names of these two functions.
  45268. function Generator() {}
  45269. function GeneratorFunction() {}
  45270. function GeneratorFunctionPrototype() {}
  45271. // This is a polyfill for %IteratorPrototype% for environments that
  45272. // don't natively support it.
  45273. var IteratorPrototype = {};
  45274. IteratorPrototype[iteratorSymbol] = function () {
  45275. return this;
  45276. };
  45277. var getProto = Object.getPrototypeOf;
  45278. var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  45279. if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
  45280. // This environment has a native %IteratorPrototype%; use it instead
  45281. // of the polyfill.
  45282. IteratorPrototype = NativeIteratorPrototype;
  45283. }
  45284. var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
  45285. GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
  45286. GeneratorFunctionPrototype.constructor = GeneratorFunction;
  45287. GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction";
  45288. // Helper for defining the .next, .throw, and .return methods of the
  45289. // Iterator interface in terms of a single ._invoke method.
  45290. function defineIteratorMethods(prototype) {
  45291. ["next", "throw", "return"].forEach(function (method) {
  45292. prototype[method] = function (arg) {
  45293. return this._invoke(method, arg);
  45294. };
  45295. });
  45296. }
  45297. runtime.isGeneratorFunction = function (genFun) {
  45298. var ctor = typeof genFun === "function" && genFun.constructor;
  45299. return ctor ? ctor === GeneratorFunction ||
  45300. // For the native GeneratorFunction constructor, the best we can
  45301. // do is to check its .name property.
  45302. (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
  45303. };
  45304. runtime.mark = function (genFun) {
  45305. if (Object.setPrototypeOf) {
  45306. Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
  45307. } else {
  45308. genFun.__proto__ = GeneratorFunctionPrototype;
  45309. if (!(toStringTagSymbol in genFun)) {
  45310. genFun[toStringTagSymbol] = "GeneratorFunction";
  45311. }
  45312. }
  45313. genFun.prototype = Object.create(Gp);
  45314. return genFun;
  45315. };
  45316. // Within the body of any async function, `await x` is transformed to
  45317. // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
  45318. // `hasOwn.call(value, "__await")` to determine if the yielded value is
  45319. // meant to be awaited.
  45320. runtime.awrap = function (arg) {
  45321. return {
  45322. __await: arg
  45323. };
  45324. };
  45325. function AsyncIterator(generator) {
  45326. function invoke(method, arg, resolve, reject) {
  45327. var record = tryCatch(generator[method], generator, arg);
  45328. if (record.type === "throw") {
  45329. reject(record.arg);
  45330. } else {
  45331. var result = record.arg;
  45332. var value = result.value;
  45333. if (value && _typeof(value) === "object" && hasOwn.call(value, "__await")) {
  45334. return Promise.resolve(value.__await).then(function (value) {
  45335. invoke("next", value, resolve, reject);
  45336. }, function (err) {
  45337. invoke("throw", err, resolve, reject);
  45338. });
  45339. }
  45340. return Promise.resolve(value).then(function (unwrapped) {
  45341. // When a yielded Promise is resolved, its final value becomes
  45342. // the .value of the Promise<{value,done}> result for the
  45343. // current iteration. If the Promise is rejected, however, the
  45344. // result for this iteration will be rejected with the same
  45345. // reason. Note that rejections of yielded Promises are not
  45346. // thrown back into the generator function, as is the case
  45347. // when an awaited Promise is rejected. This difference in
  45348. // behavior between yield and await is important, because it
  45349. // allows the consumer to decide what to do with the yielded
  45350. // rejection (swallow it and continue, manually .throw it back
  45351. // into the generator, abandon iteration, whatever). With
  45352. // await, by contrast, there is no opportunity to examine the
  45353. // rejection reason outside the generator function, so the
  45354. // only option is to throw it from the await expression, and
  45355. // let the generator function handle the exception.
  45356. result.value = unwrapped;
  45357. resolve(result);
  45358. }, reject);
  45359. }
  45360. }
  45361. if (_typeof(global.process) === "object" && global.process.domain) {
  45362. invoke = global.process.domain.bind(invoke);
  45363. }
  45364. var previousPromise;
  45365. function enqueue(method, arg) {
  45366. function callInvokeWithMethodAndArg() {
  45367. return new Promise(function (resolve, reject) {
  45368. invoke(method, arg, resolve, reject);
  45369. });
  45370. }
  45371. return previousPromise =
  45372. // If enqueue has been called before, then we want to wait until
  45373. // all previous Promises have been resolved before calling invoke,
  45374. // so that results are always delivered in the correct order. If
  45375. // enqueue has not been called before, then it is important to
  45376. // call invoke immediately, without waiting on a callback to fire,
  45377. // so that the async generator function has the opportunity to do
  45378. // any necessary setup in a predictable way. This predictability
  45379. // is why the Promise constructor synchronously invokes its
  45380. // executor callback, and why async functions synchronously
  45381. // execute code before the first await. Since we implement simple
  45382. // async functions in terms of async generators, it is especially
  45383. // important to get this right, even though it requires care.
  45384. previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
  45385. // Avoid propagating failures to Promises returned by later
  45386. // invocations of the iterator.
  45387. callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
  45388. }
  45389. // Define the unified helper method that is used to implement .next,
  45390. // .throw, and .return (see defineIteratorMethods).
  45391. this._invoke = enqueue;
  45392. }
  45393. defineIteratorMethods(AsyncIterator.prototype);
  45394. AsyncIterator.prototype[asyncIteratorSymbol] = function () {
  45395. return this;
  45396. };
  45397. runtime.AsyncIterator = AsyncIterator;
  45398. // Note that simple async functions are implemented on top of
  45399. // AsyncIterator objects; they just return a Promise for the value of
  45400. // the final result produced by the iterator.
  45401. runtime.async = function (innerFn, outerFn, self, tryLocsList) {
  45402. var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList));
  45403. return runtime.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
  45404. : iter.next().then(function (result) {
  45405. return result.done ? result.value : iter.next();
  45406. });
  45407. };
  45408. function makeInvokeMethod(innerFn, self, context) {
  45409. var state = GenStateSuspendedStart;
  45410. return function invoke(method, arg) {
  45411. if (state === GenStateExecuting) {
  45412. throw new Error("Generator is already running");
  45413. }
  45414. if (state === GenStateCompleted) {
  45415. if (method === "throw") {
  45416. throw arg;
  45417. }
  45418. // Be forgiving, per 25.3.3.3.3 of the spec:
  45419. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
  45420. return doneResult();
  45421. }
  45422. context.method = method;
  45423. context.arg = arg;
  45424. while (true) {
  45425. var delegate = context.delegate;
  45426. if (delegate) {
  45427. var delegateResult = maybeInvokeDelegate(delegate, context);
  45428. if (delegateResult) {
  45429. if (delegateResult === ContinueSentinel) continue;
  45430. return delegateResult;
  45431. }
  45432. }
  45433. if (context.method === "next") {
  45434. // Setting context._sent for legacy support of Babel's
  45435. // function.sent implementation.
  45436. context.sent = context._sent = context.arg;
  45437. } else if (context.method === "throw") {
  45438. if (state === GenStateSuspendedStart) {
  45439. state = GenStateCompleted;
  45440. throw context.arg;
  45441. }
  45442. context.dispatchException(context.arg);
  45443. } else if (context.method === "return") {
  45444. context.abrupt("return", context.arg);
  45445. }
  45446. state = GenStateExecuting;
  45447. var record = tryCatch(innerFn, self, context);
  45448. if (record.type === "normal") {
  45449. // If an exception is thrown from innerFn, we leave state ===
  45450. // GenStateExecuting and loop back for another invocation.
  45451. state = context.done ? GenStateCompleted : GenStateSuspendedYield;
  45452. if (record.arg === ContinueSentinel) {
  45453. continue;
  45454. }
  45455. return {
  45456. value: record.arg,
  45457. done: context.done
  45458. };
  45459. } else if (record.type === "throw") {
  45460. state = GenStateCompleted;
  45461. // Dispatch the exception by looping back around to the
  45462. // context.dispatchException(context.arg) call above.
  45463. context.method = "throw";
  45464. context.arg = record.arg;
  45465. }
  45466. }
  45467. };
  45468. }
  45469. // Call delegate.iterator[context.method](context.arg) and handle the
  45470. // result, either by returning a { value, done } result from the
  45471. // delegate iterator, or by modifying context.method and context.arg,
  45472. // setting context.delegate to null, and returning the ContinueSentinel.
  45473. function maybeInvokeDelegate(delegate, context) {
  45474. var method = delegate.iterator[context.method];
  45475. if (method === undefined) {
  45476. // A .throw or .return when the delegate iterator has no .throw
  45477. // method always terminates the yield* loop.
  45478. context.delegate = null;
  45479. if (context.method === "throw") {
  45480. if (delegate.iterator["return"]) {
  45481. // If the delegate iterator has a return method, give it a
  45482. // chance to clean up.
  45483. context.method = "return";
  45484. context.arg = undefined;
  45485. maybeInvokeDelegate(delegate, context);
  45486. if (context.method === "throw") {
  45487. // If maybeInvokeDelegate(context) changed context.method from
  45488. // "return" to "throw", let that override the TypeError below.
  45489. return ContinueSentinel;
  45490. }
  45491. }
  45492. context.method = "throw";
  45493. context.arg = new TypeError("The iterator does not provide a 'throw' method");
  45494. }
  45495. return ContinueSentinel;
  45496. }
  45497. var record = tryCatch(method, delegate.iterator, context.arg);
  45498. if (record.type === "throw") {
  45499. context.method = "throw";
  45500. context.arg = record.arg;
  45501. context.delegate = null;
  45502. return ContinueSentinel;
  45503. }
  45504. var info = record.arg;
  45505. if (!info) {
  45506. context.method = "throw";
  45507. context.arg = new TypeError("iterator result is not an object");
  45508. context.delegate = null;
  45509. return ContinueSentinel;
  45510. }
  45511. if (info.done) {
  45512. // Assign the result of the finished delegate to the temporary
  45513. // variable specified by delegate.resultName (see delegateYield).
  45514. context[delegate.resultName] = info.value;
  45515. // Resume execution at the desired location (see delegateYield).
  45516. context.next = delegate.nextLoc;
  45517. // If context.method was "throw" but the delegate handled the
  45518. // exception, let the outer generator proceed normally. If
  45519. // context.method was "next", forget context.arg since it has been
  45520. // "consumed" by the delegate iterator. If context.method was
  45521. // "return", allow the original .return call to continue in the
  45522. // outer generator.
  45523. if (context.method !== "return") {
  45524. context.method = "next";
  45525. context.arg = undefined;
  45526. }
  45527. } else {
  45528. // Re-yield the result returned by the delegate method.
  45529. return info;
  45530. }
  45531. // The delegate iterator is finished, so forget it and continue with
  45532. // the outer generator.
  45533. context.delegate = null;
  45534. return ContinueSentinel;
  45535. }
  45536. // Define Generator.prototype.{next,throw,return} in terms of the
  45537. // unified ._invoke helper method.
  45538. defineIteratorMethods(Gp);
  45539. Gp[toStringTagSymbol] = "Generator";
  45540. // A Generator should always return itself as the iterator object when the
  45541. // @@iterator function is called on it. Some browsers' implementations of the
  45542. // iterator prototype chain incorrectly implement this, causing the Generator
  45543. // object to not be returned from this call. This ensures that doesn't happen.
  45544. // See https://github.com/facebook/regenerator/issues/274 for more details.
  45545. Gp[iteratorSymbol] = function () {
  45546. return this;
  45547. };
  45548. Gp.toString = function () {
  45549. return "[object Generator]";
  45550. };
  45551. function pushTryEntry(locs) {
  45552. var entry = {
  45553. tryLoc: locs[0]
  45554. };
  45555. if (1 in locs) {
  45556. entry.catchLoc = locs[1];
  45557. }
  45558. if (2 in locs) {
  45559. entry.finallyLoc = locs[2];
  45560. entry.afterLoc = locs[3];
  45561. }
  45562. this.tryEntries.push(entry);
  45563. }
  45564. function resetTryEntry(entry) {
  45565. var record = entry.completion || {};
  45566. record.type = "normal";
  45567. delete record.arg;
  45568. entry.completion = record;
  45569. }
  45570. function Context(tryLocsList) {
  45571. // The root entry object (effectively a try statement without a catch
  45572. // or a finally block) gives us a place to store values thrown from
  45573. // locations where there is no enclosing try statement.
  45574. this.tryEntries = [{
  45575. tryLoc: "root"
  45576. }];
  45577. tryLocsList.forEach(pushTryEntry, this);
  45578. this.reset(true);
  45579. }
  45580. runtime.keys = function (object) {
  45581. var keys = [];
  45582. for (var key in object) {
  45583. keys.push(key);
  45584. }
  45585. keys.reverse();
  45586. // Rather than returning an object with a next method, we keep
  45587. // things simple and return the next function itself.
  45588. return function next() {
  45589. while (keys.length) {
  45590. var key = keys.pop();
  45591. if (key in object) {
  45592. next.value = key;
  45593. next.done = false;
  45594. return next;
  45595. }
  45596. }
  45597. // To avoid creating an additional object, we just hang the .value
  45598. // and .done properties off the next function object itself. This
  45599. // also ensures that the minifier will not anonymize the function.
  45600. next.done = true;
  45601. return next;
  45602. };
  45603. };
  45604. function values(iterable) {
  45605. if (iterable) {
  45606. var iteratorMethod = iterable[iteratorSymbol];
  45607. if (iteratorMethod) {
  45608. return iteratorMethod.call(iterable);
  45609. }
  45610. if (typeof iterable.next === "function") {
  45611. return iterable;
  45612. }
  45613. if (!isNaN(iterable.length)) {
  45614. var i = -1,
  45615. next = function next() {
  45616. while (++i < iterable.length) {
  45617. if (hasOwn.call(iterable, i)) {
  45618. next.value = iterable[i];
  45619. next.done = false;
  45620. return next;
  45621. }
  45622. }
  45623. next.value = undefined;
  45624. next.done = true;
  45625. return next;
  45626. };
  45627. return next.next = next;
  45628. }
  45629. }
  45630. // Return an iterator with no values.
  45631. return {
  45632. next: doneResult
  45633. };
  45634. }
  45635. runtime.values = values;
  45636. function doneResult() {
  45637. return {
  45638. value: undefined,
  45639. done: true
  45640. };
  45641. }
  45642. Context.prototype = {
  45643. constructor: Context,
  45644. reset: function reset(skipTempReset) {
  45645. this.prev = 0;
  45646. this.next = 0;
  45647. // Resetting context._sent for legacy support of Babel's
  45648. // function.sent implementation.
  45649. this.sent = this._sent = undefined;
  45650. this.done = false;
  45651. this.delegate = null;
  45652. this.method = "next";
  45653. this.arg = undefined;
  45654. this.tryEntries.forEach(resetTryEntry);
  45655. if (!skipTempReset) {
  45656. for (var name in this) {
  45657. // Not sure about the optimal order of these conditions:
  45658. if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
  45659. this[name] = undefined;
  45660. }
  45661. }
  45662. }
  45663. },
  45664. stop: function stop() {
  45665. this.done = true;
  45666. var rootEntry = this.tryEntries[0];
  45667. var rootRecord = rootEntry.completion;
  45668. if (rootRecord.type === "throw") {
  45669. throw rootRecord.arg;
  45670. }
  45671. return this.rval;
  45672. },
  45673. dispatchException: function dispatchException(exception) {
  45674. if (this.done) {
  45675. throw exception;
  45676. }
  45677. var context = this;
  45678. function handle(loc, caught) {
  45679. record.type = "throw";
  45680. record.arg = exception;
  45681. context.next = loc;
  45682. if (caught) {
  45683. // If the dispatched exception was caught by a catch block,
  45684. // then let that catch block handle the exception normally.
  45685. context.method = "next";
  45686. context.arg = undefined;
  45687. }
  45688. return !!caught;
  45689. }
  45690. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  45691. var entry = this.tryEntries[i];
  45692. var record = entry.completion;
  45693. if (entry.tryLoc === "root") {
  45694. // Exception thrown outside of any try block that could handle
  45695. // it, so set the completion value of the entire function to
  45696. // throw the exception.
  45697. return handle("end");
  45698. }
  45699. if (entry.tryLoc <= this.prev) {
  45700. var hasCatch = hasOwn.call(entry, "catchLoc");
  45701. var hasFinally = hasOwn.call(entry, "finallyLoc");
  45702. if (hasCatch && hasFinally) {
  45703. if (this.prev < entry.catchLoc) {
  45704. return handle(entry.catchLoc, true);
  45705. } else if (this.prev < entry.finallyLoc) {
  45706. return handle(entry.finallyLoc);
  45707. }
  45708. } else if (hasCatch) {
  45709. if (this.prev < entry.catchLoc) {
  45710. return handle(entry.catchLoc, true);
  45711. }
  45712. } else if (hasFinally) {
  45713. if (this.prev < entry.finallyLoc) {
  45714. return handle(entry.finallyLoc);
  45715. }
  45716. } else {
  45717. throw new Error("try statement without catch or finally");
  45718. }
  45719. }
  45720. }
  45721. },
  45722. abrupt: function abrupt(type, arg) {
  45723. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  45724. var entry = this.tryEntries[i];
  45725. if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
  45726. var finallyEntry = entry;
  45727. break;
  45728. }
  45729. }
  45730. if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
  45731. // Ignore the finally entry if control is not jumping to a
  45732. // location outside the try/catch block.
  45733. finallyEntry = null;
  45734. }
  45735. var record = finallyEntry ? finallyEntry.completion : {};
  45736. record.type = type;
  45737. record.arg = arg;
  45738. if (finallyEntry) {
  45739. this.method = "next";
  45740. this.next = finallyEntry.finallyLoc;
  45741. return ContinueSentinel;
  45742. }
  45743. return this.complete(record);
  45744. },
  45745. complete: function complete(record, afterLoc) {
  45746. if (record.type === "throw") {
  45747. throw record.arg;
  45748. }
  45749. if (record.type === "break" || record.type === "continue") {
  45750. this.next = record.arg;
  45751. } else if (record.type === "return") {
  45752. this.rval = this.arg = record.arg;
  45753. this.method = "return";
  45754. this.next = "end";
  45755. } else if (record.type === "normal" && afterLoc) {
  45756. this.next = afterLoc;
  45757. }
  45758. return ContinueSentinel;
  45759. },
  45760. finish: function finish(finallyLoc) {
  45761. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  45762. var entry = this.tryEntries[i];
  45763. if (entry.finallyLoc === finallyLoc) {
  45764. this.complete(entry.completion, entry.afterLoc);
  45765. resetTryEntry(entry);
  45766. return ContinueSentinel;
  45767. }
  45768. }
  45769. },
  45770. "catch": function _catch(tryLoc) {
  45771. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  45772. var entry = this.tryEntries[i];
  45773. if (entry.tryLoc === tryLoc) {
  45774. var record = entry.completion;
  45775. if (record.type === "throw") {
  45776. var thrown = record.arg;
  45777. resetTryEntry(entry);
  45778. }
  45779. return thrown;
  45780. }
  45781. }
  45782. // The context.catch method must only be called with a location
  45783. // argument that corresponds to a known catch block.
  45784. throw new Error("illegal catch attempt");
  45785. },
  45786. delegateYield: function delegateYield(iterable, resultName, nextLoc) {
  45787. this.delegate = {
  45788. iterator: values(iterable),
  45789. resultName: resultName,
  45790. nextLoc: nextLoc
  45791. };
  45792. if (this.method === "next") {
  45793. // Deliberately forget the last sent value so that we don't
  45794. // accidentally pass it on to the delegate.
  45795. this.arg = undefined;
  45796. }
  45797. return ContinueSentinel;
  45798. }
  45799. };
  45800. }(
  45801. // Among the various tricks for obtaining a reference to the global
  45802. // object, this seems to be the most reliable technique that does not
  45803. // use indirect eval (which violates Content Security Policy).
  45804. (typeof __webpack_require__.g === "undefined" ? "undefined" : _typeof(__webpack_require__.g)) === "object" ? __webpack_require__.g : (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" ? window : (typeof self === "undefined" ? "undefined" : _typeof(self)) === "object" ? self : this);
  45805. /***/ }),
  45806. /***/ 6482:
  45807. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  45808. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  45809. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  45810. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  45811. var htmlparser = __webpack_require__(6124);
  45812. var escapeStringRegexp = __webpack_require__(432);
  45813. var _require = __webpack_require__(4281),
  45814. isPlainObject = _require.isPlainObject;
  45815. var deepmerge = __webpack_require__(4036);
  45816. var parseSrcset = __webpack_require__(2134);
  45817. var _require2 = __webpack_require__(7866),
  45818. postcssParse = _require2.parse;
  45819. // Tags that can conceivably represent stand-alone media.
  45820. var mediaTags = ['img', 'audio', 'video', 'picture', 'svg', 'object', 'map', 'iframe', 'embed'];
  45821. // Tags that are inherently vulnerable to being used in XSS attacks.
  45822. var vulnerableTags = ['script', 'style'];
  45823. function each(obj, cb) {
  45824. if (obj) {
  45825. Object.keys(obj).forEach(function (key) {
  45826. cb(obj[key], key);
  45827. });
  45828. }
  45829. }
  45830. // Avoid false positives with .__proto__, .hasOwnProperty, etc.
  45831. function has(obj, key) {
  45832. return {}.hasOwnProperty.call(obj, key);
  45833. }
  45834. // Returns those elements of `a` for which `cb(a)` returns truthy
  45835. function filter(a, cb) {
  45836. var n = [];
  45837. each(a, function (v) {
  45838. if (cb(v)) {
  45839. n.push(v);
  45840. }
  45841. });
  45842. return n;
  45843. }
  45844. function isEmptyObject(obj) {
  45845. for (var key in obj) {
  45846. if (has(obj, key)) {
  45847. return false;
  45848. }
  45849. }
  45850. return true;
  45851. }
  45852. function stringifySrcset(parsedSrcset) {
  45853. return parsedSrcset.map(function (part) {
  45854. if (!part.url) {
  45855. throw new Error('URL missing');
  45856. }
  45857. return part.url + (part.w ? " ".concat(part.w, "w") : '') + (part.h ? " ".concat(part.h, "h") : '') + (part.d ? " ".concat(part.d, "x") : '');
  45858. }).join(', ');
  45859. }
  45860. module.exports = sanitizeHtml;
  45861. // A valid attribute name.
  45862. // We use a tolerant definition based on the set of strings defined by
  45863. // html.spec.whatwg.org/multipage/parsing.html#before-attribute-name-state
  45864. // and html.spec.whatwg.org/multipage/parsing.html#attribute-name-state .
  45865. // The characters accepted are ones which can be appended to the attribute
  45866. // name buffer without triggering a parse error:
  45867. // * unexpected-equals-sign-before-attribute-name
  45868. // * unexpected-null-character
  45869. // * unexpected-character-in-attribute-name
  45870. // We exclude the empty string because it's impossible to get to the after
  45871. // attribute name state with an empty attribute name buffer.
  45872. var VALID_HTML_ATTRIBUTE_NAME = /^[^\0\t\n\f\r /<=>]+$/;
  45873. // Ignore the _recursing flag; it's there for recursive
  45874. // invocation as a guard against this exploit:
  45875. // https://github.com/fb55/htmlparser2/issues/105
  45876. function sanitizeHtml(html, options, _recursing) {
  45877. if (html == null) {
  45878. return '';
  45879. }
  45880. var result = '';
  45881. // Used for hot swapping the result variable with an empty string in order to "capture" the text written to it.
  45882. var tempResult = '';
  45883. function Frame(tag, attribs) {
  45884. var that = this;
  45885. this.tag = tag;
  45886. this.attribs = attribs || {};
  45887. this.tagPosition = result.length;
  45888. this.text = ''; // Node inner text
  45889. this.mediaChildren = [];
  45890. this.updateParentNodeText = function () {
  45891. if (stack.length) {
  45892. var parentFrame = stack[stack.length - 1];
  45893. parentFrame.text += that.text;
  45894. }
  45895. };
  45896. this.updateParentNodeMediaChildren = function () {
  45897. if (stack.length && mediaTags.includes(this.tag)) {
  45898. var parentFrame = stack[stack.length - 1];
  45899. parentFrame.mediaChildren.push(this.tag);
  45900. }
  45901. };
  45902. }
  45903. options = Object.assign({}, sanitizeHtml.defaults, options);
  45904. options.parser = Object.assign({}, htmlParserDefaults, options.parser);
  45905. // vulnerableTags
  45906. vulnerableTags.forEach(function (tag) {
  45907. if (options.allowedTags !== false && (options.allowedTags || []).indexOf(tag) > -1 && !options.allowVulnerableTags) {
  45908. console.warn("\n\n\u26A0\uFE0F Your `allowedTags` option includes, `".concat(tag, "`, which is inherently\nvulnerable to XSS attacks. Please remove it from `allowedTags`.\nOr, to disable this warning, add the `allowVulnerableTags` option\nand ensure you are accounting for this risk.\n\n"));
  45909. }
  45910. });
  45911. // Tags that contain something other than HTML, or where discarding
  45912. // the text when the tag is disallowed makes sense for other reasons.
  45913. // If we are not allowing these tags, we should drop their content too.
  45914. // For other tags you would drop the tag but keep its content.
  45915. var nonTextTagsArray = options.nonTextTags || ['script', 'style', 'textarea', 'option'];
  45916. var allowedAttributesMap;
  45917. var allowedAttributesGlobMap;
  45918. if (options.allowedAttributes) {
  45919. allowedAttributesMap = {};
  45920. allowedAttributesGlobMap = {};
  45921. each(options.allowedAttributes, function (attributes, tag) {
  45922. allowedAttributesMap[tag] = [];
  45923. var globRegex = [];
  45924. attributes.forEach(function (obj) {
  45925. if (typeof obj === 'string' && obj.indexOf('*') >= 0) {
  45926. globRegex.push(escapeStringRegexp(obj).replace(/\\\*/g, '.*'));
  45927. } else {
  45928. allowedAttributesMap[tag].push(obj);
  45929. }
  45930. });
  45931. if (globRegex.length) {
  45932. allowedAttributesGlobMap[tag] = new RegExp('^(' + globRegex.join('|') + ')$');
  45933. }
  45934. });
  45935. }
  45936. var allowedClassesMap = {};
  45937. var allowedClassesGlobMap = {};
  45938. var allowedClassesRegexMap = {};
  45939. each(options.allowedClasses, function (classes, tag) {
  45940. // Implicitly allows the class attribute
  45941. if (allowedAttributesMap) {
  45942. if (!has(allowedAttributesMap, tag)) {
  45943. allowedAttributesMap[tag] = [];
  45944. }
  45945. allowedAttributesMap[tag].push('class');
  45946. }
  45947. allowedClassesMap[tag] = [];
  45948. allowedClassesRegexMap[tag] = [];
  45949. var globRegex = [];
  45950. classes.forEach(function (obj) {
  45951. if (typeof obj === 'string' && obj.indexOf('*') >= 0) {
  45952. globRegex.push(escapeStringRegexp(obj).replace(/\\\*/g, '.*'));
  45953. } else if (obj instanceof RegExp) {
  45954. allowedClassesRegexMap[tag].push(obj);
  45955. } else {
  45956. allowedClassesMap[tag].push(obj);
  45957. }
  45958. });
  45959. if (globRegex.length) {
  45960. allowedClassesGlobMap[tag] = new RegExp('^(' + globRegex.join('|') + ')$');
  45961. }
  45962. });
  45963. var transformTagsMap = {};
  45964. var transformTagsAll;
  45965. each(options.transformTags, function (transform, tag) {
  45966. var transFun;
  45967. if (typeof transform === 'function') {
  45968. transFun = transform;
  45969. } else if (typeof transform === 'string') {
  45970. transFun = sanitizeHtml.simpleTransform(transform);
  45971. }
  45972. if (tag === '*') {
  45973. transformTagsAll = transFun;
  45974. } else {
  45975. transformTagsMap[tag] = transFun;
  45976. }
  45977. });
  45978. var depth;
  45979. var stack;
  45980. var skipMap;
  45981. var transformMap;
  45982. var skipText;
  45983. var skipTextDepth;
  45984. var addedText = false;
  45985. initializeState();
  45986. var parser = new htmlparser.Parser({
  45987. onopentag: function onopentag(name, attribs) {
  45988. // If `enforceHtmlBoundary` is `true` and this has found the opening
  45989. // `html` tag, reset the state.
  45990. if (options.enforceHtmlBoundary && name === 'html') {
  45991. initializeState();
  45992. }
  45993. if (skipText) {
  45994. skipTextDepth++;
  45995. return;
  45996. }
  45997. var frame = new Frame(name, attribs);
  45998. stack.push(frame);
  45999. var skip = false;
  46000. var hasText = !!frame.text;
  46001. var transformedTag;
  46002. if (has(transformTagsMap, name)) {
  46003. transformedTag = transformTagsMap[name](name, attribs);
  46004. frame.attribs = attribs = transformedTag.attribs;
  46005. if (transformedTag.text !== undefined) {
  46006. frame.innerText = transformedTag.text;
  46007. }
  46008. if (name !== transformedTag.tagName) {
  46009. frame.name = name = transformedTag.tagName;
  46010. transformMap[depth] = transformedTag.tagName;
  46011. }
  46012. }
  46013. if (transformTagsAll) {
  46014. transformedTag = transformTagsAll(name, attribs);
  46015. frame.attribs = attribs = transformedTag.attribs;
  46016. if (name !== transformedTag.tagName) {
  46017. frame.name = name = transformedTag.tagName;
  46018. transformMap[depth] = transformedTag.tagName;
  46019. }
  46020. }
  46021. if (options.allowedTags !== false && (options.allowedTags || []).indexOf(name) === -1 || options.disallowedTagsMode === 'recursiveEscape' && !isEmptyObject(skipMap) || options.nestingLimit != null && depth >= options.nestingLimit) {
  46022. skip = true;
  46023. skipMap[depth] = true;
  46024. if (options.disallowedTagsMode === 'discard') {
  46025. if (nonTextTagsArray.indexOf(name) !== -1) {
  46026. skipText = true;
  46027. skipTextDepth = 1;
  46028. }
  46029. }
  46030. skipMap[depth] = true;
  46031. }
  46032. depth++;
  46033. if (skip) {
  46034. if (options.disallowedTagsMode === 'discard') {
  46035. // We want the contents but not this tag
  46036. return;
  46037. }
  46038. tempResult = result;
  46039. result = '';
  46040. }
  46041. result += '<' + name;
  46042. if (name === 'script') {
  46043. if (options.allowedScriptHostnames || options.allowedScriptDomains) {
  46044. frame.innerText = '';
  46045. }
  46046. }
  46047. if (!allowedAttributesMap || has(allowedAttributesMap, name) || allowedAttributesMap['*']) {
  46048. each(attribs, function (value, a) {
  46049. if (!VALID_HTML_ATTRIBUTE_NAME.test(a)) {
  46050. // This prevents part of an attribute name in the output from being
  46051. // interpreted as the end of an attribute, or end of a tag.
  46052. delete frame.attribs[a];
  46053. return;
  46054. }
  46055. // check allowedAttributesMap for the element and attribute and modify the value
  46056. // as necessary if there are specific values defined.
  46057. var passedAllowedAttributesMapCheck = false;
  46058. if (!allowedAttributesMap || has(allowedAttributesMap, name) && allowedAttributesMap[name].indexOf(a) !== -1 || allowedAttributesMap['*'] && allowedAttributesMap['*'].indexOf(a) !== -1 || has(allowedAttributesGlobMap, name) && allowedAttributesGlobMap[name].test(a) || allowedAttributesGlobMap['*'] && allowedAttributesGlobMap['*'].test(a)) {
  46059. passedAllowedAttributesMapCheck = true;
  46060. } else if (allowedAttributesMap && allowedAttributesMap[name]) {
  46061. var _iterator = _createForOfIteratorHelper(allowedAttributesMap[name]),
  46062. _step;
  46063. try {
  46064. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  46065. var o = _step.value;
  46066. if (isPlainObject(o) && o.name && o.name === a) {
  46067. passedAllowedAttributesMapCheck = true;
  46068. var newValue = '';
  46069. if (o.multiple === true) {
  46070. // verify the values that are allowed
  46071. var splitStrArray = value.split(' ');
  46072. var _iterator2 = _createForOfIteratorHelper(splitStrArray),
  46073. _step2;
  46074. try {
  46075. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  46076. var s = _step2.value;
  46077. if (o.values.indexOf(s) !== -1) {
  46078. if (newValue === '') {
  46079. newValue = s;
  46080. } else {
  46081. newValue += ' ' + s;
  46082. }
  46083. }
  46084. }
  46085. } catch (err) {
  46086. _iterator2.e(err);
  46087. } finally {
  46088. _iterator2.f();
  46089. }
  46090. } else if (o.values.indexOf(value) >= 0) {
  46091. // verified an allowed value matches the entire attribute value
  46092. newValue = value;
  46093. }
  46094. value = newValue;
  46095. }
  46096. }
  46097. } catch (err) {
  46098. _iterator.e(err);
  46099. } finally {
  46100. _iterator.f();
  46101. }
  46102. }
  46103. if (passedAllowedAttributesMapCheck) {
  46104. if (options.allowedSchemesAppliedToAttributes.indexOf(a) !== -1) {
  46105. if (naughtyHref(name, value)) {
  46106. delete frame.attribs[a];
  46107. return;
  46108. }
  46109. }
  46110. if (name === 'script' && a === 'src') {
  46111. var allowed = true;
  46112. try {
  46113. var parsed = parseUrl(value);
  46114. if (options.allowedScriptHostnames || options.allowedScriptDomains) {
  46115. var allowedHostname = (options.allowedScriptHostnames || []).find(function (hostname) {
  46116. return hostname === parsed.url.hostname;
  46117. });
  46118. var allowedDomain = (options.allowedScriptDomains || []).find(function (domain) {
  46119. return parsed.url.hostname === domain || parsed.url.hostname.endsWith(".".concat(domain));
  46120. });
  46121. allowed = allowedHostname || allowedDomain;
  46122. }
  46123. } catch (e) {
  46124. allowed = false;
  46125. }
  46126. if (!allowed) {
  46127. delete frame.attribs[a];
  46128. return;
  46129. }
  46130. }
  46131. if (name === 'iframe' && a === 'src') {
  46132. var _allowed = true;
  46133. try {
  46134. var _parsed = parseUrl(value);
  46135. if (_parsed.isRelativeUrl) {
  46136. // default value of allowIframeRelativeUrls is true
  46137. // unless allowedIframeHostnames or allowedIframeDomains specified
  46138. _allowed = has(options, 'allowIframeRelativeUrls') ? options.allowIframeRelativeUrls : !options.allowedIframeHostnames && !options.allowedIframeDomains;
  46139. } else if (options.allowedIframeHostnames || options.allowedIframeDomains) {
  46140. var _allowedHostname = (options.allowedIframeHostnames || []).find(function (hostname) {
  46141. return hostname === _parsed.url.hostname;
  46142. });
  46143. var _allowedDomain = (options.allowedIframeDomains || []).find(function (domain) {
  46144. return _parsed.url.hostname === domain || _parsed.url.hostname.endsWith(".".concat(domain));
  46145. });
  46146. _allowed = _allowedHostname || _allowedDomain;
  46147. }
  46148. } catch (e) {
  46149. // Unparseable iframe src
  46150. _allowed = false;
  46151. }
  46152. if (!_allowed) {
  46153. delete frame.attribs[a];
  46154. return;
  46155. }
  46156. }
  46157. if (a === 'srcset') {
  46158. try {
  46159. var _parsed2 = parseSrcset(value);
  46160. _parsed2.forEach(function (value) {
  46161. if (naughtyHref('srcset', value.url)) {
  46162. value.evil = true;
  46163. }
  46164. });
  46165. _parsed2 = filter(_parsed2, function (v) {
  46166. return !v.evil;
  46167. });
  46168. if (!_parsed2.length) {
  46169. delete frame.attribs[a];
  46170. return;
  46171. } else {
  46172. value = stringifySrcset(filter(_parsed2, function (v) {
  46173. return !v.evil;
  46174. }));
  46175. frame.attribs[a] = value;
  46176. }
  46177. } catch (e) {
  46178. // Unparseable srcset
  46179. delete frame.attribs[a];
  46180. return;
  46181. }
  46182. }
  46183. if (a === 'class') {
  46184. var allowedSpecificClasses = allowedClassesMap[name];
  46185. var allowedWildcardClasses = allowedClassesMap['*'];
  46186. var allowedSpecificClassesGlob = allowedClassesGlobMap[name];
  46187. var allowedSpecificClassesRegex = allowedClassesRegexMap[name];
  46188. var allowedWildcardClassesGlob = allowedClassesGlobMap['*'];
  46189. var allowedClassesGlobs = [allowedSpecificClassesGlob, allowedWildcardClassesGlob].concat(allowedSpecificClassesRegex).filter(function (t) {
  46190. return t;
  46191. });
  46192. if (allowedSpecificClasses && allowedWildcardClasses) {
  46193. value = filterClasses(value, deepmerge(allowedSpecificClasses, allowedWildcardClasses), allowedClassesGlobs);
  46194. } else {
  46195. value = filterClasses(value, allowedSpecificClasses || allowedWildcardClasses, allowedClassesGlobs);
  46196. }
  46197. if (!value.length) {
  46198. delete frame.attribs[a];
  46199. return;
  46200. }
  46201. }
  46202. if (a === 'style') {
  46203. try {
  46204. var abstractSyntaxTree = postcssParse(name + ' {' + value + '}');
  46205. var filteredAST = filterCss(abstractSyntaxTree, options.allowedStyles);
  46206. value = stringifyStyleAttributes(filteredAST);
  46207. if (value.length === 0) {
  46208. delete frame.attribs[a];
  46209. return;
  46210. }
  46211. } catch (e) {
  46212. delete frame.attribs[a];
  46213. return;
  46214. }
  46215. }
  46216. result += ' ' + a;
  46217. if (value && value.length) {
  46218. result += '="' + escapeHtml(value, true) + '"';
  46219. }
  46220. } else {
  46221. delete frame.attribs[a];
  46222. }
  46223. });
  46224. }
  46225. if (options.selfClosing.indexOf(name) !== -1) {
  46226. result += ' />';
  46227. } else {
  46228. result += '>';
  46229. if (frame.innerText && !hasText && !options.textFilter) {
  46230. result += escapeHtml(frame.innerText);
  46231. addedText = true;
  46232. }
  46233. }
  46234. if (skip) {
  46235. result = tempResult + escapeHtml(result);
  46236. tempResult = '';
  46237. }
  46238. },
  46239. ontext: function ontext(text) {
  46240. if (skipText) {
  46241. return;
  46242. }
  46243. var lastFrame = stack[stack.length - 1];
  46244. var tag;
  46245. if (lastFrame) {
  46246. tag = lastFrame.tag;
  46247. // If inner text was set by transform function then let's use it
  46248. text = lastFrame.innerText !== undefined ? lastFrame.innerText : text;
  46249. }
  46250. if (options.disallowedTagsMode === 'discard' && (tag === 'script' || tag === 'style')) {
  46251. // htmlparser2 gives us these as-is. Escaping them ruins the content. Allowing
  46252. // script tags is, by definition, game over for XSS protection, so if that's
  46253. // your concern, don't allow them. The same is essentially true for style tags
  46254. // which have their own collection of XSS vectors.
  46255. result += text;
  46256. } else {
  46257. var escaped = escapeHtml(text, false);
  46258. if (options.textFilter && !addedText) {
  46259. result += options.textFilter(escaped, tag);
  46260. } else if (!addedText) {
  46261. result += escaped;
  46262. }
  46263. }
  46264. if (stack.length) {
  46265. var frame = stack[stack.length - 1];
  46266. frame.text += text;
  46267. }
  46268. },
  46269. onclosetag: function onclosetag(name) {
  46270. if (skipText) {
  46271. skipTextDepth--;
  46272. if (!skipTextDepth) {
  46273. skipText = false;
  46274. } else {
  46275. return;
  46276. }
  46277. }
  46278. var frame = stack.pop();
  46279. if (!frame) {
  46280. // Do not crash on bad markup
  46281. return;
  46282. }
  46283. if (frame.tag !== name) {
  46284. // Another case of bad markup.
  46285. // Push to stack, so that it will be used in future closing tags.
  46286. stack.push(frame);
  46287. return;
  46288. }
  46289. skipText = options.enforceHtmlBoundary ? name === 'html' : false;
  46290. depth--;
  46291. var skip = skipMap[depth];
  46292. if (skip) {
  46293. delete skipMap[depth];
  46294. if (options.disallowedTagsMode === 'discard') {
  46295. frame.updateParentNodeText();
  46296. return;
  46297. }
  46298. tempResult = result;
  46299. result = '';
  46300. }
  46301. if (transformMap[depth]) {
  46302. name = transformMap[depth];
  46303. delete transformMap[depth];
  46304. }
  46305. if (options.exclusiveFilter && options.exclusiveFilter(frame)) {
  46306. result = result.substr(0, frame.tagPosition);
  46307. return;
  46308. }
  46309. frame.updateParentNodeMediaChildren();
  46310. frame.updateParentNodeText();
  46311. if (options.selfClosing.indexOf(name) !== -1) {
  46312. // Already output />
  46313. if (skip) {
  46314. result = tempResult;
  46315. tempResult = '';
  46316. }
  46317. return;
  46318. }
  46319. result += '</' + name + '>';
  46320. if (skip) {
  46321. result = tempResult + escapeHtml(result);
  46322. tempResult = '';
  46323. }
  46324. addedText = false;
  46325. }
  46326. }, options.parser);
  46327. parser.write(html);
  46328. parser.end();
  46329. return result;
  46330. function initializeState() {
  46331. result = '';
  46332. depth = 0;
  46333. stack = [];
  46334. skipMap = {};
  46335. transformMap = {};
  46336. skipText = false;
  46337. skipTextDepth = 0;
  46338. }
  46339. function escapeHtml(s, quote) {
  46340. if (typeof s !== 'string') {
  46341. s = s + '';
  46342. }
  46343. if (options.parser.decodeEntities) {
  46344. s = s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
  46345. if (quote) {
  46346. s = s.replace(/"/g, '&quot;');
  46347. }
  46348. }
  46349. // TODO: this is inadequate because it will pass `&0;`. This approach
  46350. // will not work, each & must be considered with regard to whether it
  46351. // is followed by a 100% syntactically valid entity or not, and escaped
  46352. // if it is not. If this bothers you, don't set parser.decodeEntities
  46353. // to false. (The default is true.)
  46354. s = s.replace(/&(?![a-zA-Z0-9#]{1,20};)/g, '&amp;') // Match ampersands not part of existing HTML entity
  46355. .replace(/</g, '&lt;').replace(/>/g, '&gt;');
  46356. if (quote) {
  46357. s = s.replace(/"/g, '&quot;');
  46358. }
  46359. return s;
  46360. }
  46361. function naughtyHref(name, href) {
  46362. // Browsers ignore character codes of 32 (space) and below in a surprising
  46363. // number of situations. Start reading here:
  46364. // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet#Embedded_tab
  46365. // eslint-disable-next-line no-control-regex
  46366. href = href.replace(/[\x00-\x20]+/g, '');
  46367. // Clobber any comments in URLs, which the browser might
  46368. // interpret inside an XML data island, allowing
  46369. // a javascript: URL to be snuck through
  46370. while (true) {
  46371. var firstIndex = href.indexOf('<!--');
  46372. if (firstIndex === -1) {
  46373. break;
  46374. }
  46375. var lastIndex = href.indexOf('-->', firstIndex + 4);
  46376. if (lastIndex === -1) {
  46377. break;
  46378. }
  46379. href = href.substring(0, firstIndex) + href.substring(lastIndex + 3);
  46380. }
  46381. // Case insensitive so we don't get faked out by JAVASCRIPT #1
  46382. // Allow more characters after the first so we don't get faked
  46383. // out by certain schemes browsers accept
  46384. var matches = href.match(/^([a-zA-Z][a-zA-Z0-9.\-+]*):/);
  46385. if (!matches) {
  46386. // Protocol-relative URL starting with any combination of '/' and '\'
  46387. if (href.match(/^[/\\]{2}/)) {
  46388. return !options.allowProtocolRelative;
  46389. }
  46390. // No scheme
  46391. return false;
  46392. }
  46393. var scheme = matches[1].toLowerCase();
  46394. if (has(options.allowedSchemesByTag, name)) {
  46395. return options.allowedSchemesByTag[name].indexOf(scheme) === -1;
  46396. }
  46397. return !options.allowedSchemes || options.allowedSchemes.indexOf(scheme) === -1;
  46398. }
  46399. function parseUrl(value) {
  46400. value = value.replace(/^(\w+:)?\s*[\\/]\s*[\\/]/, '$1//');
  46401. if (value.startsWith('relative:')) {
  46402. // An attempt to exploit our workaround for base URLs being
  46403. // mandatory for relative URL validation in the WHATWG
  46404. // URL parser, reject it
  46405. throw new Error('relative: exploit attempt');
  46406. }
  46407. // naughtyHref is in charge of whether protocol relative URLs
  46408. // are cool. Here we are concerned just with allowed hostnames and
  46409. // whether to allow relative URLs.
  46410. //
  46411. // Build a placeholder "base URL" against which any reasonable
  46412. // relative URL may be parsed successfully
  46413. var base = 'relative://relative-site';
  46414. for (var i = 0; i < 100; i++) {
  46415. base += "/".concat(i);
  46416. }
  46417. var parsed = new URL(value, base);
  46418. var isRelativeUrl = parsed && parsed.hostname === 'relative-site' && parsed.protocol === 'relative:';
  46419. return {
  46420. isRelativeUrl: isRelativeUrl,
  46421. url: parsed
  46422. };
  46423. }
  46424. /**
  46425. * Filters user input css properties by allowlisted regex attributes.
  46426. * Modifies the abstractSyntaxTree object.
  46427. *
  46428. * @param {object} abstractSyntaxTree - Object representation of CSS attributes.
  46429. * @property {array[Declaration]} abstractSyntaxTree.nodes[0] - Each object cointains prop and value key, i.e { prop: 'color', value: 'red' }.
  46430. * @param {object} allowedStyles - Keys are properties (i.e color), value is list of permitted regex rules (i.e /green/i).
  46431. * @return {object} - The modified tree.
  46432. */
  46433. function filterCss(abstractSyntaxTree, allowedStyles) {
  46434. if (!allowedStyles) {
  46435. return abstractSyntaxTree;
  46436. }
  46437. var astRules = abstractSyntaxTree.nodes[0];
  46438. var selectedRule;
  46439. // Merge global and tag-specific styles into new AST.
  46440. if (allowedStyles[astRules.selector] && allowedStyles['*']) {
  46441. selectedRule = deepmerge(allowedStyles[astRules.selector], allowedStyles['*']);
  46442. } else {
  46443. selectedRule = allowedStyles[astRules.selector] || allowedStyles['*'];
  46444. }
  46445. if (selectedRule) {
  46446. abstractSyntaxTree.nodes[0].nodes = astRules.nodes.reduce(filterDeclarations(selectedRule), []);
  46447. }
  46448. return abstractSyntaxTree;
  46449. }
  46450. /**
  46451. * Extracts the style attributes from an AbstractSyntaxTree and formats those
  46452. * values in the inline style attribute format.
  46453. *
  46454. * @param {AbstractSyntaxTree} filteredAST
  46455. * @return {string} - Example: "color:yellow;text-align:center !important;font-family:helvetica;"
  46456. */
  46457. function stringifyStyleAttributes(filteredAST) {
  46458. return filteredAST.nodes[0].nodes.reduce(function (extractedAttributes, attrObject) {
  46459. extractedAttributes.push("".concat(attrObject.prop, ":").concat(attrObject.value).concat(attrObject.important ? ' !important' : ''));
  46460. return extractedAttributes;
  46461. }, []).join(';');
  46462. }
  46463. /**
  46464. * Filters the existing attributes for the given property. Discards any attributes
  46465. * which don't match the allowlist.
  46466. *
  46467. * @param {object} selectedRule - Example: { color: red, font-family: helvetica }
  46468. * @param {array} allowedDeclarationsList - List of declarations which pass the allowlist.
  46469. * @param {object} attributeObject - Object representing the current css property.
  46470. * @property {string} attributeObject.type - Typically 'declaration'.
  46471. * @property {string} attributeObject.prop - The CSS property, i.e 'color'.
  46472. * @property {string} attributeObject.value - The corresponding value to the css property, i.e 'red'.
  46473. * @return {function} - When used in Array.reduce, will return an array of Declaration objects
  46474. */
  46475. function filterDeclarations(selectedRule) {
  46476. return function (allowedDeclarationsList, attributeObject) {
  46477. // If this property is allowlisted...
  46478. if (has(selectedRule, attributeObject.prop)) {
  46479. var matchesRegex = selectedRule[attributeObject.prop].some(function (regularExpression) {
  46480. return regularExpression.test(attributeObject.value);
  46481. });
  46482. if (matchesRegex) {
  46483. allowedDeclarationsList.push(attributeObject);
  46484. }
  46485. }
  46486. return allowedDeclarationsList;
  46487. };
  46488. }
  46489. function filterClasses(classes, allowed, allowedGlobs) {
  46490. if (!allowed) {
  46491. // The class attribute is allowed without filtering on this tag
  46492. return classes;
  46493. }
  46494. classes = classes.split(/\s+/);
  46495. return classes.filter(function (clss) {
  46496. return allowed.indexOf(clss) !== -1 || allowedGlobs.some(function (glob) {
  46497. return glob.test(clss);
  46498. });
  46499. }).join(' ');
  46500. }
  46501. }
  46502. // Defaults are accessible to you so that you can use them as a starting point
  46503. // programmatically if you wish
  46504. var htmlParserDefaults = {
  46505. decodeEntities: true
  46506. };
  46507. sanitizeHtml.defaults = {
  46508. allowedTags: [
  46509. // Sections derived from MDN element categories and limited to the more
  46510. // benign categories.
  46511. // https://developer.mozilla.org/en-US/docs/Web/HTML/Element
  46512. // Content sectioning
  46513. 'address', 'article', 'aside', 'footer', 'header', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hgroup', 'main', 'nav', 'section',
  46514. // Text content
  46515. 'blockquote', 'dd', 'div', 'dl', 'dt', 'figcaption', 'figure', 'hr', 'li', 'main', 'ol', 'p', 'pre', 'ul',
  46516. // Inline text semantics
  46517. 'a', 'abbr', 'b', 'bdi', 'bdo', 'br', 'cite', 'code', 'data', 'dfn', 'em', 'i', 'kbd', 'mark', 'q', 'rb', 'rp', 'rt', 'rtc', 'ruby', 's', 'samp', 'small', 'span', 'strong', 'sub', 'sup', 'time', 'u', 'var', 'wbr',
  46518. // Table content
  46519. 'caption', 'col', 'colgroup', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr'],
  46520. disallowedTagsMode: 'discard',
  46521. allowedAttributes: {
  46522. a: ['href', 'name', 'target'],
  46523. // We don't currently allow img itself by default, but
  46524. // these attributes would make sense if we did.
  46525. img: ['src', 'srcset', 'alt', 'title', 'width', 'height', 'loading']
  46526. },
  46527. // Lots of these won't come up by default because we don't allow them
  46528. selfClosing: ['img', 'br', 'hr', 'area', 'base', 'basefont', 'input', 'link', 'meta'],
  46529. // URL schemes we permit
  46530. allowedSchemes: ['http', 'https', 'ftp', 'mailto', 'tel'],
  46531. allowedSchemesByTag: {},
  46532. allowedSchemesAppliedToAttributes: ['href', 'src', 'cite'],
  46533. allowProtocolRelative: true,
  46534. enforceHtmlBoundary: false
  46535. };
  46536. sanitizeHtml.simpleTransform = function (newTagName, newAttribs, merge) {
  46537. merge = merge === undefined ? true : merge;
  46538. newAttribs = newAttribs || {};
  46539. return function (tagName, attribs) {
  46540. var attrib;
  46541. if (merge) {
  46542. for (attrib in newAttribs) {
  46543. attribs[attrib] = newAttribs[attrib];
  46544. }
  46545. } else {
  46546. attribs = newAttribs;
  46547. }
  46548. return {
  46549. tagName: newTagName,
  46550. attribs: attribs
  46551. };
  46552. };
  46553. };
  46554. /***/ }),
  46555. /***/ 432:
  46556. /***/ ((module) => {
  46557. module.exports = function (string) {
  46558. if (typeof string !== 'string') {
  46559. throw new TypeError('Expected a string');
  46560. }
  46561. // Escape characters with special meaning either inside or outside character sets.
  46562. // Use a simple backslash escape when it’s always valid, and a \unnnn escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
  46563. return string.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d');
  46564. };
  46565. /***/ }),
  46566. /***/ 2868:
  46567. /***/ (() => {
  46568. /* (ignored) */
  46569. /***/ }),
  46570. /***/ 4777:
  46571. /***/ (() => {
  46572. /* (ignored) */
  46573. /***/ }),
  46574. /***/ 9830:
  46575. /***/ (() => {
  46576. /* (ignored) */
  46577. /***/ }),
  46578. /***/ 209:
  46579. /***/ (() => {
  46580. /* (ignored) */
  46581. /***/ }),
  46582. /***/ 7414:
  46583. /***/ (() => {
  46584. /* (ignored) */
  46585. /***/ }),
  46586. /***/ 2961:
  46587. /***/ ((module) => {
  46588. let urlAlphabet =
  46589. 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
  46590. let customAlphabet = (alphabet, defaultSize = 21) => {
  46591. return (size = defaultSize) => {
  46592. let id = ''
  46593. let i = size
  46594. while (i--) {
  46595. id += alphabet[(Math.random() * alphabet.length) | 0]
  46596. }
  46597. return id
  46598. }
  46599. }
  46600. let nanoid = (size = 21) => {
  46601. let id = ''
  46602. let i = size
  46603. while (i--) {
  46604. id += urlAlphabet[(Math.random() * 64) | 0]
  46605. }
  46606. return id
  46607. }
  46608. module.exports = { nanoid, customAlphabet }
  46609. /***/ }),
  46610. /***/ 3600:
  46611. /***/ ((module) => {
  46612. module.exports = JSON.parse('{"0":65533,"128":8364,"130":8218,"131":402,"132":8222,"133":8230,"134":8224,"135":8225,"136":710,"137":8240,"138":352,"139":8249,"140":338,"142":381,"145":8216,"146":8217,"147":8220,"148":8221,"149":8226,"150":8211,"151":8212,"152":732,"153":8482,"154":353,"155":8250,"156":339,"158":382,"159":376}');
  46613. /***/ }),
  46614. /***/ 9323:
  46615. /***/ ((module) => {
  46616. module.exports = JSON.parse('{"Aacute":"Á","aacute":"á","Abreve":"Ă","abreve":"ă","ac":"∾","acd":"∿","acE":"∾̳","Acirc":"Â","acirc":"â","acute":"´","Acy":"А","acy":"а","AElig":"Æ","aelig":"æ","af":"⁡","Afr":"𝔄","afr":"𝔞","Agrave":"À","agrave":"à","alefsym":"ℵ","aleph":"ℵ","Alpha":"Α","alpha":"α","Amacr":"Ā","amacr":"ā","amalg":"⨿","amp":"&","AMP":"&","andand":"⩕","And":"⩓","and":"∧","andd":"⩜","andslope":"⩘","andv":"⩚","ang":"∠","ange":"⦤","angle":"∠","angmsdaa":"⦨","angmsdab":"⦩","angmsdac":"⦪","angmsdad":"⦫","angmsdae":"⦬","angmsdaf":"⦭","angmsdag":"⦮","angmsdah":"⦯","angmsd":"∡","angrt":"∟","angrtvb":"⊾","angrtvbd":"⦝","angsph":"∢","angst":"Å","angzarr":"⍼","Aogon":"Ą","aogon":"ą","Aopf":"𝔸","aopf":"𝕒","apacir":"⩯","ap":"≈","apE":"⩰","ape":"≊","apid":"≋","apos":"\'","ApplyFunction":"⁡","approx":"≈","approxeq":"≊","Aring":"Å","aring":"å","Ascr":"𝒜","ascr":"𝒶","Assign":"≔","ast":"*","asymp":"≈","asympeq":"≍","Atilde":"Ã","atilde":"ã","Auml":"Ä","auml":"ä","awconint":"∳","awint":"⨑","backcong":"≌","backepsilon":"϶","backprime":"‵","backsim":"∽","backsimeq":"⋍","Backslash":"∖","Barv":"⫧","barvee":"⊽","barwed":"⌅","Barwed":"⌆","barwedge":"⌅","bbrk":"⎵","bbrktbrk":"⎶","bcong":"≌","Bcy":"Б","bcy":"б","bdquo":"„","becaus":"∵","because":"∵","Because":"∵","bemptyv":"⦰","bepsi":"϶","bernou":"ℬ","Bernoullis":"ℬ","Beta":"Β","beta":"β","beth":"ℶ","between":"≬","Bfr":"𝔅","bfr":"𝔟","bigcap":"⋂","bigcirc":"◯","bigcup":"⋃","bigodot":"⨀","bigoplus":"⨁","bigotimes":"⨂","bigsqcup":"⨆","bigstar":"★","bigtriangledown":"▽","bigtriangleup":"△","biguplus":"⨄","bigvee":"⋁","bigwedge":"⋀","bkarow":"⤍","blacklozenge":"⧫","blacksquare":"▪","blacktriangle":"▴","blacktriangledown":"▾","blacktriangleleft":"◂","blacktriangleright":"▸","blank":"␣","blk12":"▒","blk14":"░","blk34":"▓","block":"█","bne":"=⃥","bnequiv":"≡⃥","bNot":"⫭","bnot":"⌐","Bopf":"𝔹","bopf":"𝕓","bot":"⊥","bottom":"⊥","bowtie":"⋈","boxbox":"⧉","boxdl":"┐","boxdL":"╕","boxDl":"╖","boxDL":"╗","boxdr":"┌","boxdR":"╒","boxDr":"╓","boxDR":"╔","boxh":"─","boxH":"═","boxhd":"┬","boxHd":"╤","boxhD":"╥","boxHD":"╦","boxhu":"┴","boxHu":"╧","boxhU":"╨","boxHU":"╩","boxminus":"⊟","boxplus":"⊞","boxtimes":"⊠","boxul":"┘","boxuL":"╛","boxUl":"╜","boxUL":"╝","boxur":"└","boxuR":"╘","boxUr":"╙","boxUR":"╚","boxv":"│","boxV":"║","boxvh":"┼","boxvH":"╪","boxVh":"╫","boxVH":"╬","boxvl":"┤","boxvL":"╡","boxVl":"╢","boxVL":"╣","boxvr":"├","boxvR":"╞","boxVr":"╟","boxVR":"╠","bprime":"‵","breve":"˘","Breve":"˘","brvbar":"¦","bscr":"𝒷","Bscr":"ℬ","bsemi":"⁏","bsim":"∽","bsime":"⋍","bsolb":"⧅","bsol":"\\\\","bsolhsub":"⟈","bull":"•","bullet":"•","bump":"≎","bumpE":"⪮","bumpe":"≏","Bumpeq":"≎","bumpeq":"≏","Cacute":"Ć","cacute":"ć","capand":"⩄","capbrcup":"⩉","capcap":"⩋","cap":"∩","Cap":"⋒","capcup":"⩇","capdot":"⩀","CapitalDifferentialD":"ⅅ","caps":"∩︀","caret":"⁁","caron":"ˇ","Cayleys":"ℭ","ccaps":"⩍","Ccaron":"Č","ccaron":"č","Ccedil":"Ç","ccedil":"ç","Ccirc":"Ĉ","ccirc":"ĉ","Cconint":"∰","ccups":"⩌","ccupssm":"⩐","Cdot":"Ċ","cdot":"ċ","cedil":"¸","Cedilla":"¸","cemptyv":"⦲","cent":"¢","centerdot":"·","CenterDot":"·","cfr":"𝔠","Cfr":"ℭ","CHcy":"Ч","chcy":"ч","check":"✓","checkmark":"✓","Chi":"Χ","chi":"χ","circ":"ˆ","circeq":"≗","circlearrowleft":"↺","circlearrowright":"↻","circledast":"⊛","circledcirc":"⊚","circleddash":"⊝","CircleDot":"⊙","circledR":"®","circledS":"Ⓢ","CircleMinus":"⊖","CirclePlus":"⊕","CircleTimes":"⊗","cir":"○","cirE":"⧃","cire":"≗","cirfnint":"⨐","cirmid":"⫯","cirscir":"⧂","ClockwiseContourIntegral":"∲","CloseCurlyDoubleQuote":"”","CloseCurlyQuote":"’","clubs":"♣","clubsuit":"♣","colon":":","Colon":"∷","Colone":"⩴","colone":"≔","coloneq":"≔","comma":",","commat":"@","comp":"∁","compfn":"∘","complement":"∁","complexes":"ℂ","cong":"≅","congdot":"⩭","Congruent":"≡","conint":"∮","Conint":"∯","ContourIntegral":"∮","copf":"𝕔","Copf":"ℂ","coprod":"∐","Coproduct":"∐","copy":"©","COPY":"©","copysr":"℗","CounterClockwiseContourIntegral":"∳","crarr":"↵","cross":"✗","Cross":"⨯","Cscr":"𝒞","cscr":"𝒸","csub":"⫏","csube":"⫑","csup":"⫐","csupe":"⫒","ctdot":"⋯","cudarrl":"⤸","cudarrr":"⤵","cuepr":"⋞","cuesc":"⋟","cularr":"↶","cularrp":"⤽","cupbrcap":"⩈","cupcap":"⩆","CupCap":"≍","cup":"∪","Cup":"⋓","cupcup":"⩊","cupdot":"⊍","cupor":"⩅","cups":"∪︀","curarr":"↷","curarrm":"⤼","curlyeqprec":"⋞","curlyeqsucc":"⋟","curlyvee":"⋎","curlywedge":"⋏","curren":"¤","curvearrowleft":"↶","curvearrowright":"↷","cuvee":"⋎","cuwed":"⋏","cwconint":"∲","cwint":"∱","cylcty":"⌭","dagger":"†","Dagger":"‡","daleth":"ℸ","darr":"↓","Darr":"↡","dArr":"⇓","dash":"‐","Dashv":"⫤","dashv":"⊣","dbkarow":"⤏","dblac":"˝","Dcaron":"Ď","dcaron":"ď","Dcy":"Д","dcy":"д","ddagger":"‡","ddarr":"⇊","DD":"ⅅ","dd":"ⅆ","DDotrahd":"⤑","ddotseq":"⩷","deg":"°","Del":"∇","Delta":"Δ","delta":"δ","demptyv":"⦱","dfisht":"⥿","Dfr":"𝔇","dfr":"𝔡","dHar":"⥥","dharl":"⇃","dharr":"⇂","DiacriticalAcute":"´","DiacriticalDot":"˙","DiacriticalDoubleAcute":"˝","DiacriticalGrave":"`","DiacriticalTilde":"˜","diam":"⋄","diamond":"⋄","Diamond":"⋄","diamondsuit":"♦","diams":"♦","die":"¨","DifferentialD":"ⅆ","digamma":"ϝ","disin":"⋲","div":"÷","divide":"÷","divideontimes":"⋇","divonx":"⋇","DJcy":"Ђ","djcy":"ђ","dlcorn":"⌞","dlcrop":"⌍","dollar":"$","Dopf":"𝔻","dopf":"𝕕","Dot":"¨","dot":"˙","DotDot":"⃜","doteq":"≐","doteqdot":"≑","DotEqual":"≐","dotminus":"∸","dotplus":"∔","dotsquare":"⊡","doublebarwedge":"⌆","DoubleContourIntegral":"∯","DoubleDot":"¨","DoubleDownArrow":"⇓","DoubleLeftArrow":"⇐","DoubleLeftRightArrow":"⇔","DoubleLeftTee":"⫤","DoubleLongLeftArrow":"⟸","DoubleLongLeftRightArrow":"⟺","DoubleLongRightArrow":"⟹","DoubleRightArrow":"⇒","DoubleRightTee":"⊨","DoubleUpArrow":"⇑","DoubleUpDownArrow":"⇕","DoubleVerticalBar":"∥","DownArrowBar":"⤓","downarrow":"↓","DownArrow":"↓","Downarrow":"⇓","DownArrowUpArrow":"⇵","DownBreve":"̑","downdownarrows":"⇊","downharpoonleft":"⇃","downharpoonright":"⇂","DownLeftRightVector":"⥐","DownLeftTeeVector":"⥞","DownLeftVectorBar":"⥖","DownLeftVector":"↽","DownRightTeeVector":"⥟","DownRightVectorBar":"⥗","DownRightVector":"⇁","DownTeeArrow":"↧","DownTee":"⊤","drbkarow":"⤐","drcorn":"⌟","drcrop":"⌌","Dscr":"𝒟","dscr":"𝒹","DScy":"Ѕ","dscy":"ѕ","dsol":"⧶","Dstrok":"Đ","dstrok":"đ","dtdot":"⋱","dtri":"▿","dtrif":"▾","duarr":"⇵","duhar":"⥯","dwangle":"⦦","DZcy":"Џ","dzcy":"џ","dzigrarr":"⟿","Eacute":"É","eacute":"é","easter":"⩮","Ecaron":"Ě","ecaron":"ě","Ecirc":"Ê","ecirc":"ê","ecir":"≖","ecolon":"≕","Ecy":"Э","ecy":"э","eDDot":"⩷","Edot":"Ė","edot":"ė","eDot":"≑","ee":"ⅇ","efDot":"≒","Efr":"𝔈","efr":"𝔢","eg":"⪚","Egrave":"È","egrave":"è","egs":"⪖","egsdot":"⪘","el":"⪙","Element":"∈","elinters":"⏧","ell":"ℓ","els":"⪕","elsdot":"⪗","Emacr":"Ē","emacr":"ē","empty":"∅","emptyset":"∅","EmptySmallSquare":"◻","emptyv":"∅","EmptyVerySmallSquare":"▫","emsp13":" ","emsp14":" ","emsp":" ","ENG":"Ŋ","eng":"ŋ","ensp":" ","Eogon":"Ę","eogon":"ę","Eopf":"𝔼","eopf":"𝕖","epar":"⋕","eparsl":"⧣","eplus":"⩱","epsi":"ε","Epsilon":"Ε","epsilon":"ε","epsiv":"ϵ","eqcirc":"≖","eqcolon":"≕","eqsim":"≂","eqslantgtr":"⪖","eqslantless":"⪕","Equal":"⩵","equals":"=","EqualTilde":"≂","equest":"≟","Equilibrium":"⇌","equiv":"≡","equivDD":"⩸","eqvparsl":"⧥","erarr":"⥱","erDot":"≓","escr":"ℯ","Escr":"ℰ","esdot":"≐","Esim":"⩳","esim":"≂","Eta":"Η","eta":"η","ETH":"Ð","eth":"ð","Euml":"Ë","euml":"ë","euro":"€","excl":"!","exist":"∃","Exists":"∃","expectation":"ℰ","exponentiale":"ⅇ","ExponentialE":"ⅇ","fallingdotseq":"≒","Fcy":"Ф","fcy":"ф","female":"♀","ffilig":"ffi","fflig":"ff","ffllig":"ffl","Ffr":"𝔉","ffr":"𝔣","filig":"fi","FilledSmallSquare":"◼","FilledVerySmallSquare":"▪","fjlig":"fj","flat":"♭","fllig":"fl","fltns":"▱","fnof":"ƒ","Fopf":"𝔽","fopf":"𝕗","forall":"∀","ForAll":"∀","fork":"⋔","forkv":"⫙","Fouriertrf":"ℱ","fpartint":"⨍","frac12":"½","frac13":"⅓","frac14":"¼","frac15":"⅕","frac16":"⅙","frac18":"⅛","frac23":"⅔","frac25":"⅖","frac34":"¾","frac35":"⅗","frac38":"⅜","frac45":"⅘","frac56":"⅚","frac58":"⅝","frac78":"⅞","frasl":"⁄","frown":"⌢","fscr":"𝒻","Fscr":"ℱ","gacute":"ǵ","Gamma":"Γ","gamma":"γ","Gammad":"Ϝ","gammad":"ϝ","gap":"⪆","Gbreve":"Ğ","gbreve":"ğ","Gcedil":"Ģ","Gcirc":"Ĝ","gcirc":"ĝ","Gcy":"Г","gcy":"г","Gdot":"Ġ","gdot":"ġ","ge":"≥","gE":"≧","gEl":"⪌","gel":"⋛","geq":"≥","geqq":"≧","geqslant":"⩾","gescc":"⪩","ges":"⩾","gesdot":"⪀","gesdoto":"⪂","gesdotol":"⪄","gesl":"⋛︀","gesles":"⪔","Gfr":"𝔊","gfr":"𝔤","gg":"≫","Gg":"⋙","ggg":"⋙","gimel":"ℷ","GJcy":"Ѓ","gjcy":"ѓ","gla":"⪥","gl":"≷","glE":"⪒","glj":"⪤","gnap":"⪊","gnapprox":"⪊","gne":"⪈","gnE":"≩","gneq":"⪈","gneqq":"≩","gnsim":"⋧","Gopf":"𝔾","gopf":"𝕘","grave":"`","GreaterEqual":"≥","GreaterEqualLess":"⋛","GreaterFullEqual":"≧","GreaterGreater":"⪢","GreaterLess":"≷","GreaterSlantEqual":"⩾","GreaterTilde":"≳","Gscr":"𝒢","gscr":"ℊ","gsim":"≳","gsime":"⪎","gsiml":"⪐","gtcc":"⪧","gtcir":"⩺","gt":">","GT":">","Gt":"≫","gtdot":"⋗","gtlPar":"⦕","gtquest":"⩼","gtrapprox":"⪆","gtrarr":"⥸","gtrdot":"⋗","gtreqless":"⋛","gtreqqless":"⪌","gtrless":"≷","gtrsim":"≳","gvertneqq":"≩︀","gvnE":"≩︀","Hacek":"ˇ","hairsp":" ","half":"½","hamilt":"ℋ","HARDcy":"Ъ","hardcy":"ъ","harrcir":"⥈","harr":"↔","hArr":"⇔","harrw":"↭","Hat":"^","hbar":"ℏ","Hcirc":"Ĥ","hcirc":"ĥ","hearts":"♥","heartsuit":"♥","hellip":"…","hercon":"⊹","hfr":"𝔥","Hfr":"ℌ","HilbertSpace":"ℋ","hksearow":"⤥","hkswarow":"⤦","hoarr":"⇿","homtht":"∻","hookleftarrow":"↩","hookrightarrow":"↪","hopf":"𝕙","Hopf":"ℍ","horbar":"―","HorizontalLine":"─","hscr":"𝒽","Hscr":"ℋ","hslash":"ℏ","Hstrok":"Ħ","hstrok":"ħ","HumpDownHump":"≎","HumpEqual":"≏","hybull":"⁃","hyphen":"‐","Iacute":"Í","iacute":"í","ic":"⁣","Icirc":"Î","icirc":"î","Icy":"И","icy":"и","Idot":"İ","IEcy":"Е","iecy":"е","iexcl":"¡","iff":"⇔","ifr":"𝔦","Ifr":"ℑ","Igrave":"Ì","igrave":"ì","ii":"ⅈ","iiiint":"⨌","iiint":"∭","iinfin":"⧜","iiota":"℩","IJlig":"IJ","ijlig":"ij","Imacr":"Ī","imacr":"ī","image":"ℑ","ImaginaryI":"ⅈ","imagline":"ℐ","imagpart":"ℑ","imath":"ı","Im":"ℑ","imof":"⊷","imped":"Ƶ","Implies":"⇒","incare":"℅","in":"∈","infin":"∞","infintie":"⧝","inodot":"ı","intcal":"⊺","int":"∫","Int":"∬","integers":"ℤ","Integral":"∫","intercal":"⊺","Intersection":"⋂","intlarhk":"⨗","intprod":"⨼","InvisibleComma":"⁣","InvisibleTimes":"⁢","IOcy":"Ё","iocy":"ё","Iogon":"Į","iogon":"į","Iopf":"𝕀","iopf":"𝕚","Iota":"Ι","iota":"ι","iprod":"⨼","iquest":"¿","iscr":"𝒾","Iscr":"ℐ","isin":"∈","isindot":"⋵","isinE":"⋹","isins":"⋴","isinsv":"⋳","isinv":"∈","it":"⁢","Itilde":"Ĩ","itilde":"ĩ","Iukcy":"І","iukcy":"і","Iuml":"Ï","iuml":"ï","Jcirc":"Ĵ","jcirc":"ĵ","Jcy":"Й","jcy":"й","Jfr":"𝔍","jfr":"𝔧","jmath":"ȷ","Jopf":"𝕁","jopf":"𝕛","Jscr":"𝒥","jscr":"𝒿","Jsercy":"Ј","jsercy":"ј","Jukcy":"Є","jukcy":"є","Kappa":"Κ","kappa":"κ","kappav":"ϰ","Kcedil":"Ķ","kcedil":"ķ","Kcy":"К","kcy":"к","Kfr":"𝔎","kfr":"𝔨","kgreen":"ĸ","KHcy":"Х","khcy":"х","KJcy":"Ќ","kjcy":"ќ","Kopf":"𝕂","kopf":"𝕜","Kscr":"𝒦","kscr":"𝓀","lAarr":"⇚","Lacute":"Ĺ","lacute":"ĺ","laemptyv":"⦴","lagran":"ℒ","Lambda":"Λ","lambda":"λ","lang":"⟨","Lang":"⟪","langd":"⦑","langle":"⟨","lap":"⪅","Laplacetrf":"ℒ","laquo":"«","larrb":"⇤","larrbfs":"⤟","larr":"←","Larr":"↞","lArr":"⇐","larrfs":"⤝","larrhk":"↩","larrlp":"↫","larrpl":"⤹","larrsim":"⥳","larrtl":"↢","latail":"⤙","lAtail":"⤛","lat":"⪫","late":"⪭","lates":"⪭︀","lbarr":"⤌","lBarr":"⤎","lbbrk":"❲","lbrace":"{","lbrack":"[","lbrke":"⦋","lbrksld":"⦏","lbrkslu":"⦍","Lcaron":"Ľ","lcaron":"ľ","Lcedil":"Ļ","lcedil":"ļ","lceil":"⌈","lcub":"{","Lcy":"Л","lcy":"л","ldca":"⤶","ldquo":"“","ldquor":"„","ldrdhar":"⥧","ldrushar":"⥋","ldsh":"↲","le":"≤","lE":"≦","LeftAngleBracket":"⟨","LeftArrowBar":"⇤","leftarrow":"←","LeftArrow":"←","Leftarrow":"⇐","LeftArrowRightArrow":"⇆","leftarrowtail":"↢","LeftCeiling":"⌈","LeftDoubleBracket":"⟦","LeftDownTeeVector":"⥡","LeftDownVectorBar":"⥙","LeftDownVector":"⇃","LeftFloor":"⌊","leftharpoondown":"↽","leftharpoonup":"↼","leftleftarrows":"⇇","leftrightarrow":"↔","LeftRightArrow":"↔","Leftrightarrow":"⇔","leftrightarrows":"⇆","leftrightharpoons":"⇋","leftrightsquigarrow":"↭","LeftRightVector":"⥎","LeftTeeArrow":"↤","LeftTee":"⊣","LeftTeeVector":"⥚","leftthreetimes":"⋋","LeftTriangleBar":"⧏","LeftTriangle":"⊲","LeftTriangleEqual":"⊴","LeftUpDownVector":"⥑","LeftUpTeeVector":"⥠","LeftUpVectorBar":"⥘","LeftUpVector":"↿","LeftVectorBar":"⥒","LeftVector":"↼","lEg":"⪋","leg":"⋚","leq":"≤","leqq":"≦","leqslant":"⩽","lescc":"⪨","les":"⩽","lesdot":"⩿","lesdoto":"⪁","lesdotor":"⪃","lesg":"⋚︀","lesges":"⪓","lessapprox":"⪅","lessdot":"⋖","lesseqgtr":"⋚","lesseqqgtr":"⪋","LessEqualGreater":"⋚","LessFullEqual":"≦","LessGreater":"≶","lessgtr":"≶","LessLess":"⪡","lesssim":"≲","LessSlantEqual":"⩽","LessTilde":"≲","lfisht":"⥼","lfloor":"⌊","Lfr":"𝔏","lfr":"𝔩","lg":"≶","lgE":"⪑","lHar":"⥢","lhard":"↽","lharu":"↼","lharul":"⥪","lhblk":"▄","LJcy":"Љ","ljcy":"љ","llarr":"⇇","ll":"≪","Ll":"⋘","llcorner":"⌞","Lleftarrow":"⇚","llhard":"⥫","lltri":"◺","Lmidot":"Ŀ","lmidot":"ŀ","lmoustache":"⎰","lmoust":"⎰","lnap":"⪉","lnapprox":"⪉","lne":"⪇","lnE":"≨","lneq":"⪇","lneqq":"≨","lnsim":"⋦","loang":"⟬","loarr":"⇽","lobrk":"⟦","longleftarrow":"⟵","LongLeftArrow":"⟵","Longleftarrow":"⟸","longleftrightarrow":"⟷","LongLeftRightArrow":"⟷","Longleftrightarrow":"⟺","longmapsto":"⟼","longrightarrow":"⟶","LongRightArrow":"⟶","Longrightarrow":"⟹","looparrowleft":"↫","looparrowright":"↬","lopar":"⦅","Lopf":"𝕃","lopf":"𝕝","loplus":"⨭","lotimes":"⨴","lowast":"∗","lowbar":"_","LowerLeftArrow":"↙","LowerRightArrow":"↘","loz":"◊","lozenge":"◊","lozf":"⧫","lpar":"(","lparlt":"⦓","lrarr":"⇆","lrcorner":"⌟","lrhar":"⇋","lrhard":"⥭","lrm":"‎","lrtri":"⊿","lsaquo":"‹","lscr":"𝓁","Lscr":"ℒ","lsh":"↰","Lsh":"↰","lsim":"≲","lsime":"⪍","lsimg":"⪏","lsqb":"[","lsquo":"‘","lsquor":"‚","Lstrok":"Ł","lstrok":"ł","ltcc":"⪦","ltcir":"⩹","lt":"<","LT":"<","Lt":"≪","ltdot":"⋖","lthree":"⋋","ltimes":"⋉","ltlarr":"⥶","ltquest":"⩻","ltri":"◃","ltrie":"⊴","ltrif":"◂","ltrPar":"⦖","lurdshar":"⥊","luruhar":"⥦","lvertneqq":"≨︀","lvnE":"≨︀","macr":"¯","male":"♂","malt":"✠","maltese":"✠","Map":"⤅","map":"↦","mapsto":"↦","mapstodown":"↧","mapstoleft":"↤","mapstoup":"↥","marker":"▮","mcomma":"⨩","Mcy":"М","mcy":"м","mdash":"—","mDDot":"∺","measuredangle":"∡","MediumSpace":" ","Mellintrf":"ℳ","Mfr":"𝔐","mfr":"𝔪","mho":"℧","micro":"µ","midast":"*","midcir":"⫰","mid":"∣","middot":"·","minusb":"⊟","minus":"−","minusd":"∸","minusdu":"⨪","MinusPlus":"∓","mlcp":"⫛","mldr":"…","mnplus":"∓","models":"⊧","Mopf":"𝕄","mopf":"𝕞","mp":"∓","mscr":"𝓂","Mscr":"ℳ","mstpos":"∾","Mu":"Μ","mu":"μ","multimap":"⊸","mumap":"⊸","nabla":"∇","Nacute":"Ń","nacute":"ń","nang":"∠⃒","nap":"≉","napE":"⩰̸","napid":"≋̸","napos":"ʼn","napprox":"≉","natural":"♮","naturals":"ℕ","natur":"♮","nbsp":" ","nbump":"≎̸","nbumpe":"≏̸","ncap":"⩃","Ncaron":"Ň","ncaron":"ň","Ncedil":"Ņ","ncedil":"ņ","ncong":"≇","ncongdot":"⩭̸","ncup":"⩂","Ncy":"Н","ncy":"н","ndash":"–","nearhk":"⤤","nearr":"↗","neArr":"⇗","nearrow":"↗","ne":"≠","nedot":"≐̸","NegativeMediumSpace":"​","NegativeThickSpace":"​","NegativeThinSpace":"​","NegativeVeryThinSpace":"​","nequiv":"≢","nesear":"⤨","nesim":"≂̸","NestedGreaterGreater":"≫","NestedLessLess":"≪","NewLine":"\\n","nexist":"∄","nexists":"∄","Nfr":"𝔑","nfr":"𝔫","ngE":"≧̸","nge":"≱","ngeq":"≱","ngeqq":"≧̸","ngeqslant":"⩾̸","nges":"⩾̸","nGg":"⋙̸","ngsim":"≵","nGt":"≫⃒","ngt":"≯","ngtr":"≯","nGtv":"≫̸","nharr":"↮","nhArr":"⇎","nhpar":"⫲","ni":"∋","nis":"⋼","nisd":"⋺","niv":"∋","NJcy":"Њ","njcy":"њ","nlarr":"↚","nlArr":"⇍","nldr":"‥","nlE":"≦̸","nle":"≰","nleftarrow":"↚","nLeftarrow":"⇍","nleftrightarrow":"↮","nLeftrightarrow":"⇎","nleq":"≰","nleqq":"≦̸","nleqslant":"⩽̸","nles":"⩽̸","nless":"≮","nLl":"⋘̸","nlsim":"≴","nLt":"≪⃒","nlt":"≮","nltri":"⋪","nltrie":"⋬","nLtv":"≪̸","nmid":"∤","NoBreak":"⁠","NonBreakingSpace":" ","nopf":"𝕟","Nopf":"ℕ","Not":"⫬","not":"¬","NotCongruent":"≢","NotCupCap":"≭","NotDoubleVerticalBar":"∦","NotElement":"∉","NotEqual":"≠","NotEqualTilde":"≂̸","NotExists":"∄","NotGreater":"≯","NotGreaterEqual":"≱","NotGreaterFullEqual":"≧̸","NotGreaterGreater":"≫̸","NotGreaterLess":"≹","NotGreaterSlantEqual":"⩾̸","NotGreaterTilde":"≵","NotHumpDownHump":"≎̸","NotHumpEqual":"≏̸","notin":"∉","notindot":"⋵̸","notinE":"⋹̸","notinva":"∉","notinvb":"⋷","notinvc":"⋶","NotLeftTriangleBar":"⧏̸","NotLeftTriangle":"⋪","NotLeftTriangleEqual":"⋬","NotLess":"≮","NotLessEqual":"≰","NotLessGreater":"≸","NotLessLess":"≪̸","NotLessSlantEqual":"⩽̸","NotLessTilde":"≴","NotNestedGreaterGreater":"⪢̸","NotNestedLessLess":"⪡̸","notni":"∌","notniva":"∌","notnivb":"⋾","notnivc":"⋽","NotPrecedes":"⊀","NotPrecedesEqual":"⪯̸","NotPrecedesSlantEqual":"⋠","NotReverseElement":"∌","NotRightTriangleBar":"⧐̸","NotRightTriangle":"⋫","NotRightTriangleEqual":"⋭","NotSquareSubset":"⊏̸","NotSquareSubsetEqual":"⋢","NotSquareSuperset":"⊐̸","NotSquareSupersetEqual":"⋣","NotSubset":"⊂⃒","NotSubsetEqual":"⊈","NotSucceeds":"⊁","NotSucceedsEqual":"⪰̸","NotSucceedsSlantEqual":"⋡","NotSucceedsTilde":"≿̸","NotSuperset":"⊃⃒","NotSupersetEqual":"⊉","NotTilde":"≁","NotTildeEqual":"≄","NotTildeFullEqual":"≇","NotTildeTilde":"≉","NotVerticalBar":"∤","nparallel":"∦","npar":"∦","nparsl":"⫽⃥","npart":"∂̸","npolint":"⨔","npr":"⊀","nprcue":"⋠","nprec":"⊀","npreceq":"⪯̸","npre":"⪯̸","nrarrc":"⤳̸","nrarr":"↛","nrArr":"⇏","nrarrw":"↝̸","nrightarrow":"↛","nRightarrow":"⇏","nrtri":"⋫","nrtrie":"⋭","nsc":"⊁","nsccue":"⋡","nsce":"⪰̸","Nscr":"𝒩","nscr":"𝓃","nshortmid":"∤","nshortparallel":"∦","nsim":"≁","nsime":"≄","nsimeq":"≄","nsmid":"∤","nspar":"∦","nsqsube":"⋢","nsqsupe":"⋣","nsub":"⊄","nsubE":"⫅̸","nsube":"⊈","nsubset":"⊂⃒","nsubseteq":"⊈","nsubseteqq":"⫅̸","nsucc":"⊁","nsucceq":"⪰̸","nsup":"⊅","nsupE":"⫆̸","nsupe":"⊉","nsupset":"⊃⃒","nsupseteq":"⊉","nsupseteqq":"⫆̸","ntgl":"≹","Ntilde":"Ñ","ntilde":"ñ","ntlg":"≸","ntriangleleft":"⋪","ntrianglelefteq":"⋬","ntriangleright":"⋫","ntrianglerighteq":"⋭","Nu":"Ν","nu":"ν","num":"#","numero":"№","numsp":" ","nvap":"≍⃒","nvdash":"⊬","nvDash":"⊭","nVdash":"⊮","nVDash":"⊯","nvge":"≥⃒","nvgt":">⃒","nvHarr":"⤄","nvinfin":"⧞","nvlArr":"⤂","nvle":"≤⃒","nvlt":"<⃒","nvltrie":"⊴⃒","nvrArr":"⤃","nvrtrie":"⊵⃒","nvsim":"∼⃒","nwarhk":"⤣","nwarr":"↖","nwArr":"⇖","nwarrow":"↖","nwnear":"⤧","Oacute":"Ó","oacute":"ó","oast":"⊛","Ocirc":"Ô","ocirc":"ô","ocir":"⊚","Ocy":"О","ocy":"о","odash":"⊝","Odblac":"Ő","odblac":"ő","odiv":"⨸","odot":"⊙","odsold":"⦼","OElig":"Œ","oelig":"œ","ofcir":"⦿","Ofr":"𝔒","ofr":"𝔬","ogon":"˛","Ograve":"Ò","ograve":"ò","ogt":"⧁","ohbar":"⦵","ohm":"Ω","oint":"∮","olarr":"↺","olcir":"⦾","olcross":"⦻","oline":"‾","olt":"⧀","Omacr":"Ō","omacr":"ō","Omega":"Ω","omega":"ω","Omicron":"Ο","omicron":"ο","omid":"⦶","ominus":"⊖","Oopf":"𝕆","oopf":"𝕠","opar":"⦷","OpenCurlyDoubleQuote":"“","OpenCurlyQuote":"‘","operp":"⦹","oplus":"⊕","orarr":"↻","Or":"⩔","or":"∨","ord":"⩝","order":"ℴ","orderof":"ℴ","ordf":"ª","ordm":"º","origof":"⊶","oror":"⩖","orslope":"⩗","orv":"⩛","oS":"Ⓢ","Oscr":"𝒪","oscr":"ℴ","Oslash":"Ø","oslash":"ø","osol":"⊘","Otilde":"Õ","otilde":"õ","otimesas":"⨶","Otimes":"⨷","otimes":"⊗","Ouml":"Ö","ouml":"ö","ovbar":"⌽","OverBar":"‾","OverBrace":"⏞","OverBracket":"⎴","OverParenthesis":"⏜","para":"¶","parallel":"∥","par":"∥","parsim":"⫳","parsl":"⫽","part":"∂","PartialD":"∂","Pcy":"П","pcy":"п","percnt":"%","period":".","permil":"‰","perp":"⊥","pertenk":"‱","Pfr":"𝔓","pfr":"𝔭","Phi":"Φ","phi":"φ","phiv":"ϕ","phmmat":"ℳ","phone":"☎","Pi":"Π","pi":"π","pitchfork":"⋔","piv":"ϖ","planck":"ℏ","planckh":"ℎ","plankv":"ℏ","plusacir":"⨣","plusb":"⊞","pluscir":"⨢","plus":"+","plusdo":"∔","plusdu":"⨥","pluse":"⩲","PlusMinus":"±","plusmn":"±","plussim":"⨦","plustwo":"⨧","pm":"±","Poincareplane":"ℌ","pointint":"⨕","popf":"𝕡","Popf":"ℙ","pound":"£","prap":"⪷","Pr":"⪻","pr":"≺","prcue":"≼","precapprox":"⪷","prec":"≺","preccurlyeq":"≼","Precedes":"≺","PrecedesEqual":"⪯","PrecedesSlantEqual":"≼","PrecedesTilde":"≾","preceq":"⪯","precnapprox":"⪹","precneqq":"⪵","precnsim":"⋨","pre":"⪯","prE":"⪳","precsim":"≾","prime":"′","Prime":"″","primes":"ℙ","prnap":"⪹","prnE":"⪵","prnsim":"⋨","prod":"∏","Product":"∏","profalar":"⌮","profline":"⌒","profsurf":"⌓","prop":"∝","Proportional":"∝","Proportion":"∷","propto":"∝","prsim":"≾","prurel":"⊰","Pscr":"𝒫","pscr":"𝓅","Psi":"Ψ","psi":"ψ","puncsp":" ","Qfr":"𝔔","qfr":"𝔮","qint":"⨌","qopf":"𝕢","Qopf":"ℚ","qprime":"⁗","Qscr":"𝒬","qscr":"𝓆","quaternions":"ℍ","quatint":"⨖","quest":"?","questeq":"≟","quot":"\\"","QUOT":"\\"","rAarr":"⇛","race":"∽̱","Racute":"Ŕ","racute":"ŕ","radic":"√","raemptyv":"⦳","rang":"⟩","Rang":"⟫","rangd":"⦒","range":"⦥","rangle":"⟩","raquo":"»","rarrap":"⥵","rarrb":"⇥","rarrbfs":"⤠","rarrc":"⤳","rarr":"→","Rarr":"↠","rArr":"⇒","rarrfs":"⤞","rarrhk":"↪","rarrlp":"↬","rarrpl":"⥅","rarrsim":"⥴","Rarrtl":"⤖","rarrtl":"↣","rarrw":"↝","ratail":"⤚","rAtail":"⤜","ratio":"∶","rationals":"ℚ","rbarr":"⤍","rBarr":"⤏","RBarr":"⤐","rbbrk":"❳","rbrace":"}","rbrack":"]","rbrke":"⦌","rbrksld":"⦎","rbrkslu":"⦐","Rcaron":"Ř","rcaron":"ř","Rcedil":"Ŗ","rcedil":"ŗ","rceil":"⌉","rcub":"}","Rcy":"Р","rcy":"р","rdca":"⤷","rdldhar":"⥩","rdquo":"”","rdquor":"”","rdsh":"↳","real":"ℜ","realine":"ℛ","realpart":"ℜ","reals":"ℝ","Re":"ℜ","rect":"▭","reg":"®","REG":"®","ReverseElement":"∋","ReverseEquilibrium":"⇋","ReverseUpEquilibrium":"⥯","rfisht":"⥽","rfloor":"⌋","rfr":"𝔯","Rfr":"ℜ","rHar":"⥤","rhard":"⇁","rharu":"⇀","rharul":"⥬","Rho":"Ρ","rho":"ρ","rhov":"ϱ","RightAngleBracket":"⟩","RightArrowBar":"⇥","rightarrow":"→","RightArrow":"→","Rightarrow":"⇒","RightArrowLeftArrow":"⇄","rightarrowtail":"↣","RightCeiling":"⌉","RightDoubleBracket":"⟧","RightDownTeeVector":"⥝","RightDownVectorBar":"⥕","RightDownVector":"⇂","RightFloor":"⌋","rightharpoondown":"⇁","rightharpoonup":"⇀","rightleftarrows":"⇄","rightleftharpoons":"⇌","rightrightarrows":"⇉","rightsquigarrow":"↝","RightTeeArrow":"↦","RightTee":"⊢","RightTeeVector":"⥛","rightthreetimes":"⋌","RightTriangleBar":"⧐","RightTriangle":"⊳","RightTriangleEqual":"⊵","RightUpDownVector":"⥏","RightUpTeeVector":"⥜","RightUpVectorBar":"⥔","RightUpVector":"↾","RightVectorBar":"⥓","RightVector":"⇀","ring":"˚","risingdotseq":"≓","rlarr":"⇄","rlhar":"⇌","rlm":"‏","rmoustache":"⎱","rmoust":"⎱","rnmid":"⫮","roang":"⟭","roarr":"⇾","robrk":"⟧","ropar":"⦆","ropf":"𝕣","Ropf":"ℝ","roplus":"⨮","rotimes":"⨵","RoundImplies":"⥰","rpar":")","rpargt":"⦔","rppolint":"⨒","rrarr":"⇉","Rrightarrow":"⇛","rsaquo":"›","rscr":"𝓇","Rscr":"ℛ","rsh":"↱","Rsh":"↱","rsqb":"]","rsquo":"’","rsquor":"’","rthree":"⋌","rtimes":"⋊","rtri":"▹","rtrie":"⊵","rtrif":"▸","rtriltri":"⧎","RuleDelayed":"⧴","ruluhar":"⥨","rx":"℞","Sacute":"Ś","sacute":"ś","sbquo":"‚","scap":"⪸","Scaron":"Š","scaron":"š","Sc":"⪼","sc":"≻","sccue":"≽","sce":"⪰","scE":"⪴","Scedil":"Ş","scedil":"ş","Scirc":"Ŝ","scirc":"ŝ","scnap":"⪺","scnE":"⪶","scnsim":"⋩","scpolint":"⨓","scsim":"≿","Scy":"С","scy":"с","sdotb":"⊡","sdot":"⋅","sdote":"⩦","searhk":"⤥","searr":"↘","seArr":"⇘","searrow":"↘","sect":"§","semi":";","seswar":"⤩","setminus":"∖","setmn":"∖","sext":"✶","Sfr":"𝔖","sfr":"𝔰","sfrown":"⌢","sharp":"♯","SHCHcy":"Щ","shchcy":"щ","SHcy":"Ш","shcy":"ш","ShortDownArrow":"↓","ShortLeftArrow":"←","shortmid":"∣","shortparallel":"∥","ShortRightArrow":"→","ShortUpArrow":"↑","shy":"­","Sigma":"Σ","sigma":"σ","sigmaf":"ς","sigmav":"ς","sim":"∼","simdot":"⩪","sime":"≃","simeq":"≃","simg":"⪞","simgE":"⪠","siml":"⪝","simlE":"⪟","simne":"≆","simplus":"⨤","simrarr":"⥲","slarr":"←","SmallCircle":"∘","smallsetminus":"∖","smashp":"⨳","smeparsl":"⧤","smid":"∣","smile":"⌣","smt":"⪪","smte":"⪬","smtes":"⪬︀","SOFTcy":"Ь","softcy":"ь","solbar":"⌿","solb":"⧄","sol":"/","Sopf":"𝕊","sopf":"𝕤","spades":"♠","spadesuit":"♠","spar":"∥","sqcap":"⊓","sqcaps":"⊓︀","sqcup":"⊔","sqcups":"⊔︀","Sqrt":"√","sqsub":"⊏","sqsube":"⊑","sqsubset":"⊏","sqsubseteq":"⊑","sqsup":"⊐","sqsupe":"⊒","sqsupset":"⊐","sqsupseteq":"⊒","square":"□","Square":"□","SquareIntersection":"⊓","SquareSubset":"⊏","SquareSubsetEqual":"⊑","SquareSuperset":"⊐","SquareSupersetEqual":"⊒","SquareUnion":"⊔","squarf":"▪","squ":"□","squf":"▪","srarr":"→","Sscr":"𝒮","sscr":"𝓈","ssetmn":"∖","ssmile":"⌣","sstarf":"⋆","Star":"⋆","star":"☆","starf":"★","straightepsilon":"ϵ","straightphi":"ϕ","strns":"¯","sub":"⊂","Sub":"⋐","subdot":"⪽","subE":"⫅","sube":"⊆","subedot":"⫃","submult":"⫁","subnE":"⫋","subne":"⊊","subplus":"⪿","subrarr":"⥹","subset":"⊂","Subset":"⋐","subseteq":"⊆","subseteqq":"⫅","SubsetEqual":"⊆","subsetneq":"⊊","subsetneqq":"⫋","subsim":"⫇","subsub":"⫕","subsup":"⫓","succapprox":"⪸","succ":"≻","succcurlyeq":"≽","Succeeds":"≻","SucceedsEqual":"⪰","SucceedsSlantEqual":"≽","SucceedsTilde":"≿","succeq":"⪰","succnapprox":"⪺","succneqq":"⪶","succnsim":"⋩","succsim":"≿","SuchThat":"∋","sum":"∑","Sum":"∑","sung":"♪","sup1":"¹","sup2":"²","sup3":"³","sup":"⊃","Sup":"⋑","supdot":"⪾","supdsub":"⫘","supE":"⫆","supe":"⊇","supedot":"⫄","Superset":"⊃","SupersetEqual":"⊇","suphsol":"⟉","suphsub":"⫗","suplarr":"⥻","supmult":"⫂","supnE":"⫌","supne":"⊋","supplus":"⫀","supset":"⊃","Supset":"⋑","supseteq":"⊇","supseteqq":"⫆","supsetneq":"⊋","supsetneqq":"⫌","supsim":"⫈","supsub":"⫔","supsup":"⫖","swarhk":"⤦","swarr":"↙","swArr":"⇙","swarrow":"↙","swnwar":"⤪","szlig":"ß","Tab":"\\t","target":"⌖","Tau":"Τ","tau":"τ","tbrk":"⎴","Tcaron":"Ť","tcaron":"ť","Tcedil":"Ţ","tcedil":"ţ","Tcy":"Т","tcy":"т","tdot":"⃛","telrec":"⌕","Tfr":"𝔗","tfr":"𝔱","there4":"∴","therefore":"∴","Therefore":"∴","Theta":"Θ","theta":"θ","thetasym":"ϑ","thetav":"ϑ","thickapprox":"≈","thicksim":"∼","ThickSpace":"  ","ThinSpace":" ","thinsp":" ","thkap":"≈","thksim":"∼","THORN":"Þ","thorn":"þ","tilde":"˜","Tilde":"∼","TildeEqual":"≃","TildeFullEqual":"≅","TildeTilde":"≈","timesbar":"⨱","timesb":"⊠","times":"×","timesd":"⨰","tint":"∭","toea":"⤨","topbot":"⌶","topcir":"⫱","top":"⊤","Topf":"𝕋","topf":"𝕥","topfork":"⫚","tosa":"⤩","tprime":"‴","trade":"™","TRADE":"™","triangle":"▵","triangledown":"▿","triangleleft":"◃","trianglelefteq":"⊴","triangleq":"≜","triangleright":"▹","trianglerighteq":"⊵","tridot":"◬","trie":"≜","triminus":"⨺","TripleDot":"⃛","triplus":"⨹","trisb":"⧍","tritime":"⨻","trpezium":"⏢","Tscr":"𝒯","tscr":"𝓉","TScy":"Ц","tscy":"ц","TSHcy":"Ћ","tshcy":"ћ","Tstrok":"Ŧ","tstrok":"ŧ","twixt":"≬","twoheadleftarrow":"↞","twoheadrightarrow":"↠","Uacute":"Ú","uacute":"ú","uarr":"↑","Uarr":"↟","uArr":"⇑","Uarrocir":"⥉","Ubrcy":"Ў","ubrcy":"ў","Ubreve":"Ŭ","ubreve":"ŭ","Ucirc":"Û","ucirc":"û","Ucy":"У","ucy":"у","udarr":"⇅","Udblac":"Ű","udblac":"ű","udhar":"⥮","ufisht":"⥾","Ufr":"𝔘","ufr":"𝔲","Ugrave":"Ù","ugrave":"ù","uHar":"⥣","uharl":"↿","uharr":"↾","uhblk":"▀","ulcorn":"⌜","ulcorner":"⌜","ulcrop":"⌏","ultri":"◸","Umacr":"Ū","umacr":"ū","uml":"¨","UnderBar":"_","UnderBrace":"⏟","UnderBracket":"⎵","UnderParenthesis":"⏝","Union":"⋃","UnionPlus":"⊎","Uogon":"Ų","uogon":"ų","Uopf":"𝕌","uopf":"𝕦","UpArrowBar":"⤒","uparrow":"↑","UpArrow":"↑","Uparrow":"⇑","UpArrowDownArrow":"⇅","updownarrow":"↕","UpDownArrow":"↕","Updownarrow":"⇕","UpEquilibrium":"⥮","upharpoonleft":"↿","upharpoonright":"↾","uplus":"⊎","UpperLeftArrow":"↖","UpperRightArrow":"↗","upsi":"υ","Upsi":"ϒ","upsih":"ϒ","Upsilon":"Υ","upsilon":"υ","UpTeeArrow":"↥","UpTee":"⊥","upuparrows":"⇈","urcorn":"⌝","urcorner":"⌝","urcrop":"⌎","Uring":"Ů","uring":"ů","urtri":"◹","Uscr":"𝒰","uscr":"𝓊","utdot":"⋰","Utilde":"Ũ","utilde":"ũ","utri":"▵","utrif":"▴","uuarr":"⇈","Uuml":"Ü","uuml":"ü","uwangle":"⦧","vangrt":"⦜","varepsilon":"ϵ","varkappa":"ϰ","varnothing":"∅","varphi":"ϕ","varpi":"ϖ","varpropto":"∝","varr":"↕","vArr":"⇕","varrho":"ϱ","varsigma":"ς","varsubsetneq":"⊊︀","varsubsetneqq":"⫋︀","varsupsetneq":"⊋︀","varsupsetneqq":"⫌︀","vartheta":"ϑ","vartriangleleft":"⊲","vartriangleright":"⊳","vBar":"⫨","Vbar":"⫫","vBarv":"⫩","Vcy":"В","vcy":"в","vdash":"⊢","vDash":"⊨","Vdash":"⊩","VDash":"⊫","Vdashl":"⫦","veebar":"⊻","vee":"∨","Vee":"⋁","veeeq":"≚","vellip":"⋮","verbar":"|","Verbar":"‖","vert":"|","Vert":"‖","VerticalBar":"∣","VerticalLine":"|","VerticalSeparator":"❘","VerticalTilde":"≀","VeryThinSpace":" ","Vfr":"𝔙","vfr":"𝔳","vltri":"⊲","vnsub":"⊂⃒","vnsup":"⊃⃒","Vopf":"𝕍","vopf":"𝕧","vprop":"∝","vrtri":"⊳","Vscr":"𝒱","vscr":"𝓋","vsubnE":"⫋︀","vsubne":"⊊︀","vsupnE":"⫌︀","vsupne":"⊋︀","Vvdash":"⊪","vzigzag":"⦚","Wcirc":"Ŵ","wcirc":"ŵ","wedbar":"⩟","wedge":"∧","Wedge":"⋀","wedgeq":"≙","weierp":"℘","Wfr":"𝔚","wfr":"𝔴","Wopf":"𝕎","wopf":"𝕨","wp":"℘","wr":"≀","wreath":"≀","Wscr":"𝒲","wscr":"𝓌","xcap":"⋂","xcirc":"◯","xcup":"⋃","xdtri":"▽","Xfr":"𝔛","xfr":"𝔵","xharr":"⟷","xhArr":"⟺","Xi":"Ξ","xi":"ξ","xlarr":"⟵","xlArr":"⟸","xmap":"⟼","xnis":"⋻","xodot":"⨀","Xopf":"𝕏","xopf":"𝕩","xoplus":"⨁","xotime":"⨂","xrarr":"⟶","xrArr":"⟹","Xscr":"𝒳","xscr":"𝓍","xsqcup":"⨆","xuplus":"⨄","xutri":"△","xvee":"⋁","xwedge":"⋀","Yacute":"Ý","yacute":"ý","YAcy":"Я","yacy":"я","Ycirc":"Ŷ","ycirc":"ŷ","Ycy":"Ы","ycy":"ы","yen":"¥","Yfr":"𝔜","yfr":"𝔶","YIcy":"Ї","yicy":"ї","Yopf":"𝕐","yopf":"𝕪","Yscr":"𝒴","yscr":"𝓎","YUcy":"Ю","yucy":"ю","yuml":"ÿ","Yuml":"Ÿ","Zacute":"Ź","zacute":"ź","Zcaron":"Ž","zcaron":"ž","Zcy":"З","zcy":"з","Zdot":"Ż","zdot":"ż","zeetrf":"ℨ","ZeroWidthSpace":"​","Zeta":"Ζ","zeta":"ζ","zfr":"𝔷","Zfr":"ℨ","ZHcy":"Ж","zhcy":"ж","zigrarr":"⇝","zopf":"𝕫","Zopf":"ℤ","Zscr":"𝒵","zscr":"𝓏","zwj":"‍","zwnj":"‌"}');
  46617. /***/ }),
  46618. /***/ 9591:
  46619. /***/ ((module) => {
  46620. module.exports = JSON.parse('{"Aacute":"Á","aacute":"á","Acirc":"Â","acirc":"â","acute":"´","AElig":"Æ","aelig":"æ","Agrave":"À","agrave":"à","amp":"&","AMP":"&","Aring":"Å","aring":"å","Atilde":"Ã","atilde":"ã","Auml":"Ä","auml":"ä","brvbar":"¦","Ccedil":"Ç","ccedil":"ç","cedil":"¸","cent":"¢","copy":"©","COPY":"©","curren":"¤","deg":"°","divide":"÷","Eacute":"É","eacute":"é","Ecirc":"Ê","ecirc":"ê","Egrave":"È","egrave":"è","ETH":"Ð","eth":"ð","Euml":"Ë","euml":"ë","frac12":"½","frac14":"¼","frac34":"¾","gt":">","GT":">","Iacute":"Í","iacute":"í","Icirc":"Î","icirc":"î","iexcl":"¡","Igrave":"Ì","igrave":"ì","iquest":"¿","Iuml":"Ï","iuml":"ï","laquo":"«","lt":"<","LT":"<","macr":"¯","micro":"µ","middot":"·","nbsp":" ","not":"¬","Ntilde":"Ñ","ntilde":"ñ","Oacute":"Ó","oacute":"ó","Ocirc":"Ô","ocirc":"ô","Ograve":"Ò","ograve":"ò","ordf":"ª","ordm":"º","Oslash":"Ø","oslash":"ø","Otilde":"Õ","otilde":"õ","Ouml":"Ö","ouml":"ö","para":"¶","plusmn":"±","pound":"£","quot":"\\"","QUOT":"\\"","raquo":"»","reg":"®","REG":"®","sect":"§","shy":"­","sup1":"¹","sup2":"²","sup3":"³","szlig":"ß","THORN":"Þ","thorn":"þ","times":"×","Uacute":"Ú","uacute":"ú","Ucirc":"Û","ucirc":"û","Ugrave":"Ù","ugrave":"ù","uml":"¨","Uuml":"Ü","uuml":"ü","Yacute":"Ý","yacute":"ý","yen":"¥","yuml":"ÿ"}');
  46621. /***/ }),
  46622. /***/ 2586:
  46623. /***/ ((module) => {
  46624. module.exports = JSON.parse('{"amp":"&","apos":"\'","gt":">","lt":"<","quot":"\\""}');
  46625. /***/ })
  46626. /******/ });
  46627. /************************************************************************/
  46628. /******/ // The module cache
  46629. /******/ var __webpack_module_cache__ = {};
  46630. /******/
  46631. /******/ // The require function
  46632. /******/ function __webpack_require__(moduleId) {
  46633. /******/ // Check if module is in cache
  46634. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  46635. /******/ if (cachedModule !== undefined) {
  46636. /******/ return cachedModule.exports;
  46637. /******/ }
  46638. /******/ // Create a new module (and put it into the cache)
  46639. /******/ var module = __webpack_module_cache__[moduleId] = {
  46640. /******/ id: moduleId,
  46641. /******/ loaded: false,
  46642. /******/ exports: {}
  46643. /******/ };
  46644. /******/
  46645. /******/ // Execute the module function
  46646. /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  46647. /******/
  46648. /******/ // Flag the module as loaded
  46649. /******/ module.loaded = true;
  46650. /******/
  46651. /******/ // Return the exports of the module
  46652. /******/ return module.exports;
  46653. /******/ }
  46654. /******/
  46655. /************************************************************************/
  46656. /******/ /* webpack/runtime/compat get default export */
  46657. /******/ (() => {
  46658. /******/ // getDefaultExport function for compatibility with non-harmony modules
  46659. /******/ __webpack_require__.n = (module) => {
  46660. /******/ var getter = module && module.__esModule ?
  46661. /******/ () => (module['default']) :
  46662. /******/ () => (module);
  46663. /******/ __webpack_require__.d(getter, { a: getter });
  46664. /******/ return getter;
  46665. /******/ };
  46666. /******/ })();
  46667. /******/
  46668. /******/ /* webpack/runtime/define property getters */
  46669. /******/ (() => {
  46670. /******/ // define getter functions for harmony exports
  46671. /******/ __webpack_require__.d = (exports, definition) => {
  46672. /******/ for(var key in definition) {
  46673. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  46674. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  46675. /******/ }
  46676. /******/ }
  46677. /******/ };
  46678. /******/ })();
  46679. /******/
  46680. /******/ /* webpack/runtime/global */
  46681. /******/ (() => {
  46682. /******/ __webpack_require__.g = (function() {
  46683. /******/ if (typeof globalThis === 'object') return globalThis;
  46684. /******/ try {
  46685. /******/ return this || new Function('return this')();
  46686. /******/ } catch (e) {
  46687. /******/ if (typeof window === 'object') return window;
  46688. /******/ }
  46689. /******/ })();
  46690. /******/ })();
  46691. /******/
  46692. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  46693. /******/ (() => {
  46694. /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  46695. /******/ })();
  46696. /******/
  46697. /******/ /* webpack/runtime/make namespace object */
  46698. /******/ (() => {
  46699. /******/ // define __esModule on exports
  46700. /******/ __webpack_require__.r = (exports) => {
  46701. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  46702. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  46703. /******/ }
  46704. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  46705. /******/ };
  46706. /******/ })();
  46707. /******/
  46708. /******/ /* webpack/runtime/node module decorator */
  46709. /******/ (() => {
  46710. /******/ __webpack_require__.nmd = (module) => {
  46711. /******/ module.paths = [];
  46712. /******/ if (!module.children) module.children = [];
  46713. /******/ return module;
  46714. /******/ };
  46715. /******/ })();
  46716. /******/
  46717. /************************************************************************/
  46718. var __webpack_exports__ = {};
  46719. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  46720. (() => {
  46721. "use strict";
  46722. __webpack_require__(2234);
  46723. __webpack_require__(6760);
  46724. __webpack_require__(8299);
  46725. if (__webpack_require__.g._babelPolyfill) {
  46726. throw new Error("only one instance of babel-polyfill is allowed");
  46727. }
  46728. __webpack_require__.g._babelPolyfill = true;
  46729. var DEFINE_PROPERTY = "defineProperty";
  46730. function define(O, key, value) {
  46731. O[key] || Object[DEFINE_PROPERTY](O, key, {
  46732. writable: true,
  46733. configurable: true,
  46734. value: value
  46735. });
  46736. }
  46737. define(String.prototype, "padLeft", "".padStart);
  46738. define(String.prototype, "padRight", "".padEnd);
  46739. "pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach(function (key) {
  46740. [][key] && define(Array, key, Function.call.bind([][key]));
  46741. });
  46742. })();
  46743. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  46744. (() => {
  46745. "use strict";
  46746. __webpack_require__.r(__webpack_exports__);
  46747. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  46748. /* harmony export */ "Sanitizer": () => (/* binding */ Sanitizer),
  46749. /* harmony export */ "defaultSanitizer": () => (/* binding */ defaultSanitizer)
  46750. /* harmony export */ });
  46751. /* harmony import */ var sanitize_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6482);
  46752. /* harmony import */ var sanitize_html__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(sanitize_html__WEBPACK_IMPORTED_MODULE_0__);
  46753. var _templateObject, _templateObject2, _templateObject3, _templateObject4;
  46754. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
  46755. function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  46756. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  46757. function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
  46758. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
  46759. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
  46760. function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
  46761. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  46762. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  46763. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
  46764. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  46765. function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
  46766. function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
  46767. // Copyright (c) Jupyter Development Team.
  46768. // Distributed under the terms of the Modified BSD License.
  46769. // sanitize-html uses the url package, so we depend on a standalone version of
  46770. // it which acts as a polyfill for browsers.
  46771. /**
  46772. * Helper class that contains regular expressions for inline CSS style validation.
  46773. *
  46774. * Which properties (and values) to allow is largely based on the Google Caja project:
  46775. * https://github.com/google/caja
  46776. *
  46777. * The regular expressions are largly based on the syntax definition found at
  46778. * https://developer.mozilla.org/en-US/docs/Web/CSS.
  46779. */
  46780. var CssProp = /*#__PURE__*/function () {
  46781. function CssProp() {
  46782. _classCallCheck(this, CssProp);
  46783. }
  46784. _createClass(CssProp, null, [{
  46785. key: "reg",
  46786. value: function reg(r) {
  46787. return new RegExp('^' + r + '$', 'i');
  46788. }
  46789. }]);
  46790. return CssProp;
  46791. }();
  46792. /*
  46793. * Numeric base expressions used to help build more complex regular expressions
  46794. */
  46795. CssProp.N = {
  46796. integer: "[+-]?[0-9]+",
  46797. integer_pos: "[+]?[0-9]+",
  46798. integer_zero_ff: "([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",
  46799. number: "[+-]?([0-9]*[.])?[0-9]+(e-?[0-9]*)?",
  46800. number_pos: "[+]?([0-9]*[.])?[0-9]+(e-?[0-9]*)?",
  46801. number_zero_hundred: "[+]?(([0-9]|[1-9][0-9])([.][0-9]+)?|100)",
  46802. number_zero_one: "[+]?(1([.][0]+)?|0?([.][0-9]+)?)"
  46803. };
  46804. /*
  46805. * Base expressions of common CSS syntax elements
  46806. */
  46807. CssProp.B = {
  46808. angle: "(".concat(CssProp.N.number, "(deg|rad|grad|turn)|0)"),
  46809. frequency: "".concat(CssProp.N.number, "(Hz|kHz)"),
  46810. ident: String.raw(_templateObject || (_templateObject = _taggedTemplateLiteral(["-?([_a-z]|[\xA0-\xFF]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])([_a-z0-9-]|[\xA0-\xFF]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])*"], ["-?([_a-z]|[\\xA0-\\xFF]|\\\\[0-9a-f]{1,6}(\\r\\n|[ \\t\\r\\n\\f])?|\\\\[^\\r\\n\\f0-9a-f])([_a-z0-9-]|[\\xA0-\\xFF]|\\\\[0-9a-f]{1,6}(\\r\\n|[ \\t\\r\\n\\f])?|\\\\[^\\r\\n\\f0-9a-f])*"]))),
  46811. len_or_perc: "(0|".concat(CssProp.N.number, "(px|em|rem|ex|in|cm|mm|pt|pc|%))"),
  46812. length: "(".concat(CssProp.N.number, "(px|em|rem|ex|in|cm|mm|pt|pc)|0)"),
  46813. length_pos: "(".concat(CssProp.N.number_pos, "(px|em|rem|ex|in|cm|mm|pt|pc)|0)"),
  46814. percentage: "".concat(CssProp.N.number, "%"),
  46815. percentage_pos: "".concat(CssProp.N.number_pos, "%"),
  46816. percentage_zero_hundred: "".concat(CssProp.N.number_zero_hundred, "%"),
  46817. string: String.raw(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["(\"([^\n\r\f\\\"]|\\\n|\r\n|\r|\f|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])*\")|('([^\n\r\f\\']|\\\n|\r\n|\r|\f|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])*')"], ["(\\\"([^\\n\\r\\f\\\\\"]|\\\\\\n|\\r\\n|\\r|\\f|\\\\[0-9a-f]{1,6}(\\r\\n|[ \\t\\r\\n\\f])?|\\\\[^\\r\\n\\f0-9a-f])*\\\")|(\\'([^\\n\\r\\f\\\\']|\\\\\\n|\\r\\n|\\r|\\f|\\\\[0-9a-f]{1,6}(\\r\\n|[ \\t\\r\\n\\f])?|\\\\[^\\r\\n\\f0-9a-f])*\\')"]))),
  46818. time: "".concat(CssProp.N.number, "(s|ms)"),
  46819. url: "url\\(.*?\\)",
  46820. z_index: "[+-]?[0-9]{1,7}"
  46821. };
  46822. /*
  46823. * Atomic (i.e. not dependant on other regular expressions) sub RegEx segments
  46824. */
  46825. CssProp.A = {
  46826. absolute_size: "xx-small|x-small|small|medium|large|x-large|xx-large",
  46827. attachment: "scroll|fixed|local",
  46828. bg_origin: "border-box|padding-box|content-box",
  46829. border_style: "none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset",
  46830. box: "border-box|padding-box|content-box",
  46831. display_inside: "auto|block|table|flex|grid",
  46832. display_outside: "block-level|inline-level|none|table-row-group|table-header-group|table-footer-group|table-row|table-cell|table-column-group|table-column|table-caption",
  46833. ending_shape: "circle|ellipse",
  46834. generic_family: "serif|sans-serif|cursive|fantasy|monospace",
  46835. generic_voice: "male|female|child",
  46836. relative_size: "smaller|larger",
  46837. repeat_style: "repeat-x|repeat-y|((?:repeat|space|round|no-repeat)(?:\\s*(?:repeat|space|round|no-repeat))?)",
  46838. side_or_corner: "(left|right)?\\s*(top|bottom)?",
  46839. single_animation_direction: "normal|reverse|alternate|alternate-reverse",
  46840. single_animation_fill_mode: "none|forwards|backwards|both",
  46841. single_animation_play_state: "running|paused"
  46842. };
  46843. /*
  46844. * Color definition sub expressions
  46845. */
  46846. CssProp._COLOR = {
  46847. hex: "\\#(0x)?[0-9a-f]+",
  46848. name: "aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|transparent|violet|wheat|white|whitesmoke|yellow|yellowgreen",
  46849. rgb: String.raw(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["rgb(s*(d{1,3})s*,s*(d{1,3})s*,s*(d{1,3})s*)"], ["rgb\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*\\)"]))),
  46850. rgba: String.raw(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["rgba(s*(d{1,3})s*,s*(d{1,3})s*,s*(d{1,3})s*,s*(", "|", "|", ")s*)"], ["rgba\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(", "|", "|", ")\\s*\\)"])), CssProp.N.integer_zero_ff, CssProp.N.number_zero_one, CssProp.B.percentage_zero_hundred)
  46851. };
  46852. /*
  46853. * Compound (i.e. dependant on other (sub) regular expressions) sub RegEx segments
  46854. */
  46855. CssProp._C = {
  46856. alpha: "".concat(CssProp.N.integer_zero_ff, "|").concat(CssProp.N.number_zero_one, "|").concat(CssProp.B.percentage_zero_hundred),
  46857. alphavalue: CssProp.N.number_zero_one,
  46858. bg_position: "((".concat(CssProp.B.len_or_perc, "|left|center|right|top|bottom)\\s*){1,4}"),
  46859. bg_size: "(".concat(CssProp.B.length_pos, "|").concat(CssProp.B.percentage, "|auto){1,2}|cover|contain"),
  46860. border_width: "thin|medium|thick|".concat(CssProp.B.length),
  46861. bottom: "".concat(CssProp.B.length, "|auto"),
  46862. color: "".concat(CssProp._COLOR.hex, "|").concat(CssProp._COLOR.rgb, "|").concat(CssProp._COLOR.rgba, "|").concat(CssProp._COLOR.name),
  46863. color_stop_length: "(".concat(CssProp.B.len_or_perc, "\\s*){1,2}"),
  46864. linear_color_hint: "".concat(CssProp.B.len_or_perc),
  46865. family_name: "".concat(CssProp.B.string, "|(").concat(CssProp.B.ident, "\\s*)+"),
  46866. image_decl: CssProp.B.url,
  46867. left: "".concat(CssProp.B.length, "|auto"),
  46868. loose_quotable_words: "(".concat(CssProp.B.ident, ")+"),
  46869. margin_width: "".concat(CssProp.B.len_or_perc, "|auto"),
  46870. padding_width: "".concat(CssProp.B.length_pos, "|").concat(CssProp.B.percentage_pos),
  46871. page_url: CssProp.B.url,
  46872. position: "((".concat(CssProp.B.len_or_perc, "|left|center|right|top|bottom)\\s*){1,4}"),
  46873. right: "".concat(CssProp.B.length, "|auto"),
  46874. shadow: '',
  46875. size: "closest-side|farthest-side|closest-corner|farthest-corner|".concat(CssProp.B.length, "|(").concat(CssProp.B.len_or_perc, ")\\s+(").concat(CssProp.B.len_or_perc, ")"),
  46876. top: "".concat(CssProp.B.length, "|auto")
  46877. };
  46878. CssProp._C1 = {
  46879. image_list: "image\\(\\s*(".concat(CssProp.B.url, ")*\\s*(").concat(CssProp.B.url, "|").concat(CssProp._C.color, ")\\s*\\)"),
  46880. linear_color_stop: "(".concat(CssProp._C.color, ")(\\s*").concat(CssProp._C.color_stop_length, ")?"),
  46881. shadow: "((".concat(CssProp._C.color, ")\\s+((").concat(CssProp.B.length, ")\\s*){2,4}(s+inset)?)|((inset\\s+)?((").concat(CssProp.B.length, ")\\s*){2,4}\\s*(").concat(CssProp._C.color, ")?)")
  46882. };
  46883. CssProp._C2 = {
  46884. color_stop_list: "((".concat(CssProp._C1.linear_color_stop, ")(\\s*(").concat(CssProp._C.linear_color_hint, "))?\\s*,\\s*)+(").concat(CssProp._C1.linear_color_stop, ")"),
  46885. shape: "rect\\(\\s*(".concat(CssProp._C.top, ")\\s*,\\s*(").concat(CssProp._C.right, ")\\s*,\\s*(").concat(CssProp._C.bottom, ")\\s*,\\s*(").concat(CssProp._C.left, ")\\s*\\)")
  46886. };
  46887. CssProp._C3 = {
  46888. linear_gradient: "linear-gradient\\((((".concat(CssProp.B.angle, ")|to\\s+(").concat(CssProp.A.side_or_corner, "))\\s*,\\s*)?\\s*(").concat(CssProp._C2.color_stop_list, ")\\s*\\)"),
  46889. radial_gradient: "radial-gradient\\(((((".concat(CssProp.A.ending_shape, ")|(").concat(CssProp._C.size, "))\\s*)*\\s*(at\\s+").concat(CssProp._C.position, ")?\\s*,\\s*)?\\s*(").concat(CssProp._C2.color_stop_list, ")\\s*\\)")
  46890. };
  46891. CssProp._C4 = {
  46892. image: "".concat(CssProp.B.url, "|").concat(CssProp._C3.linear_gradient, "|").concat(CssProp._C3.radial_gradient, "|").concat(CssProp._C1.image_list),
  46893. bg_image: "(".concat(CssProp.B.url, "|").concat(CssProp._C3.linear_gradient, "|").concat(CssProp._C3.radial_gradient, "|").concat(CssProp._C1.image_list, ")|none")
  46894. };
  46895. CssProp.C = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, CssProp._C), CssProp._C1), CssProp._C2), CssProp._C3), CssProp._C4);
  46896. /*
  46897. * Property value regular expressions not dependant on other sub expressions
  46898. */
  46899. CssProp.AP = {
  46900. border_collapse: "collapse|separate",
  46901. box: "normal|none|contents",
  46902. box_sizing: "content-box|padding-box|border-box",
  46903. caption_side: "top|bottom",
  46904. clear: "none|left|right|both",
  46905. direction: "ltr|rtl",
  46906. empty_cells: "show|hide",
  46907. "float": "left|right|none",
  46908. font_stretch: "normal|wider|narrower|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded",
  46909. font_style: "normal|italic|oblique",
  46910. font_variant: "normal|small-caps",
  46911. font_weight: "normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900",
  46912. list_style_position: "inside|outside",
  46913. list_style_type: "disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman|lower-greek|lower-latin|upper-latin|armenian|georgian|lower-alpha|upper-alpha|none",
  46914. overflow: "visible|hidden|scroll|auto",
  46915. overflow_wrap: "normal|break-word",
  46916. overflow_x: "visible|hidden|scroll|auto|no-display|no-content",
  46917. page_break_after: "auto|always|avoid|left|right",
  46918. page_break_before: "auto|always|avoid|left|right",
  46919. page_break_inside: "avoid|auto",
  46920. position: "static|relative|absolute",
  46921. resize: "none|both|horizontal|vertical",
  46922. speak: "normal|none|spell-out",
  46923. speak_header: "once|always",
  46924. speak_numeral: "digits|continuous",
  46925. speak_punctuation: "code|none",
  46926. table_layout: "auto|fixed",
  46927. text_align: "left|right|center|justify",
  46928. text_decoration: "none|((underline|overline|line-through|blink)\\s*)+",
  46929. text_transform: "capitalize|uppercase|lowercase|none",
  46930. text_wrap: "normal|unrestricted|none|suppress",
  46931. unicode_bidi: "normal|embed|bidi-override",
  46932. visibility: "visible|hidden|collapse",
  46933. white_space: "normal|pre|nowrap|pre-wrap|pre-line",
  46934. word_break: "normal|keep-all|break-all"
  46935. };
  46936. /*
  46937. * Compound propertiy value regular expressions (i.e. dependant on other sub expressions)
  46938. */
  46939. CssProp._CP = {
  46940. background_attachment: "".concat(CssProp.A.attachment, "(,\\s*").concat(CssProp.A.attachment, ")*"),
  46941. background_color: CssProp.C.color,
  46942. background_origin: "".concat(CssProp.A.box, "(,\\s*").concat(CssProp.A.box, ")*"),
  46943. background_repeat: "".concat(CssProp.A.repeat_style, "(,\\s*").concat(CssProp.A.repeat_style, ")*"),
  46944. border: "((".concat(CssProp.C.border_width, "|").concat(CssProp.A.border_style, "|").concat(CssProp.C.color, ")\\s*){1,3}"),
  46945. border_radius: "((".concat(CssProp.B.len_or_perc, ")\\s*){1,4}(\\/\\s*((").concat(CssProp.B.len_or_perc, ")\\s*){1,4})?"),
  46946. border_spacing: "".concat(CssProp.B.length, "\\s*(").concat(CssProp.B.length, ")?"),
  46947. border_top_color: CssProp.C.color,
  46948. border_top_style: CssProp.A.border_style,
  46949. border_width: "((".concat(CssProp.C.border_width, ")\\s*){1,4}"),
  46950. color: CssProp.C.color,
  46951. cursor: "(".concat(CssProp.B.url, "(\\s*,\\s*)?)*(auto|crosshair|default|pointer|move|e-resize|ne-resize|nw-resize|n-resize|se-resize|sw-resize|s-resize|w-resize|text|wait|help|progress|all-scroll|col-resize|hand|no-drop|not-allowed|row-resize|vertical-text)"),
  46952. display: "inline|block|list-item|run-in|inline-list-item|inline-block|table|inline-table|table-cell|table-caption|flex|inline-flex|grid|inline-grid|".concat(CssProp.A.display_inside, "|").concat(CssProp.A.display_outside, "|inherit|inline-box|inline-stack"),
  46953. display_outside: CssProp.A.display_outside,
  46954. elevation: "".concat(CssProp.B.angle, "|below|level|above|higher|lower"),
  46955. font_family: "(".concat(CssProp.C.family_name, "|").concat(CssProp.A.generic_family, ")(,\\s*(").concat(CssProp.C.family_name, "|").concat(CssProp.A.generic_family, "))*"),
  46956. height: "".concat(CssProp.B.length, "|").concat(CssProp.B.percentage, "|auto"),
  46957. letter_spacing: "normal|".concat(CssProp.B.length),
  46958. list_style_image: "".concat(CssProp.C.image, "|none"),
  46959. margin_right: CssProp.C.margin_width,
  46960. max_height: "".concat(CssProp.B.length_pos, "|").concat(CssProp.B.percentage_pos, "|none|auto"),
  46961. min_height: "".concat(CssProp.B.length_pos, "|").concat(CssProp.B.percentage_pos, "|auto"),
  46962. opacity: CssProp.C.alphavalue,
  46963. outline_color: "".concat(CssProp.C.color, "|invert"),
  46964. outline_width: CssProp.C.border_width,
  46965. padding: "((".concat(CssProp.C.padding_width, ")\\s*){1,4}"),
  46966. padding_top: CssProp.C.padding_width,
  46967. pitch_range: CssProp.N.number,
  46968. right: "".concat(CssProp.B.length, "|").concat(CssProp.B.percentage, "|auto"),
  46969. stress: CssProp.N.number,
  46970. text_indent: "".concat(CssProp.B.length, "|").concat(CssProp.B.percentage),
  46971. text_shadow: "none|".concat(CssProp.C.shadow, "(,\\s*(").concat(CssProp.C.shadow, "))*"),
  46972. volume: "".concat(CssProp.N.number_pos, "|").concat(CssProp.B.percentage_pos, "|silent|x-soft|soft|medium|loud|x-loud"),
  46973. word_wrap: CssProp.AP.overflow_wrap,
  46974. zoom: "normal|".concat(CssProp.N.number_pos, "|").concat(CssProp.B.percentage_pos),
  46975. backface_visibility: CssProp.AP.visibility,
  46976. background_clip: "".concat(CssProp.A.box, "(,\\s*(").concat(CssProp.A.box, "))*"),
  46977. background_position: "".concat(CssProp.C.bg_position, "(,\\s*(").concat(CssProp.C.bg_position, "))*"),
  46978. border_bottom_color: CssProp.C.color,
  46979. border_bottom_style: CssProp.A.border_style,
  46980. border_color: "((".concat(CssProp.C.color, ")\\s*){1,4}"),
  46981. border_left_color: CssProp.C.color,
  46982. border_right_color: CssProp.C.color,
  46983. border_style: "((".concat(CssProp.A.border_style, ")\\s*){1,4}"),
  46984. border_top_left_radius: "(".concat(CssProp.B.length, "|").concat(CssProp.B.percentage, ")(\\s*(").concat(CssProp.B.length, "|").concat(CssProp.B.percentage, "))?"),
  46985. border_top_width: CssProp.C.border_width,
  46986. box_shadow: "none|".concat(CssProp.C.shadow, "(,\\s*(").concat(CssProp.C.shadow, "))*"),
  46987. clip: "".concat(CssProp.C.shape, "|auto"),
  46988. display_inside: CssProp.A.display_inside,
  46989. font_size: "".concat(CssProp.A.absolute_size, "|").concat(CssProp.A.relative_size, "|").concat(CssProp.B.length_pos, "|").concat(CssProp.B.percentage_pos),
  46990. line_height: "normal|".concat(CssProp.N.number_pos, "|").concat(CssProp.B.length_pos, "|").concat(CssProp.B.percentage_pos),
  46991. margin_left: CssProp.C.margin_width,
  46992. max_width: "".concat(CssProp.B.length_pos, "|").concat(CssProp.B.percentage_pos, "|none|auto"),
  46993. outline_style: CssProp.A.border_style,
  46994. padding_bottom: CssProp.C.padding_width,
  46995. padding_right: CssProp.C.padding_width,
  46996. perspective: "none|".concat(CssProp.B.length),
  46997. richness: CssProp.N.number,
  46998. text_overflow: "((clip|ellipsis|".concat(CssProp.B.string, ")\\s*){1,2}"),
  46999. top: "".concat(CssProp.B.length, "|").concat(CssProp.B.percentage, "|auto"),
  47000. width: "".concat(CssProp.B.length_pos, "|").concat(CssProp.B.percentage_pos, "|auto"),
  47001. z_index: "auto|".concat(CssProp.B.z_index),
  47002. // Simplified background
  47003. background: "(((".concat(CssProp.C.bg_position, "\\s*(\\/\\s*").concat(CssProp.C.bg_size, ")?)|(").concat(CssProp.A.repeat_style, ")|(").concat(CssProp.A.attachment, ")|(").concat(CssProp.A.bg_origin, ")|(").concat(CssProp.C.bg_image, ")|(").concat(CssProp.C.color, "))\\s*)+"),
  47004. background_size: "".concat(CssProp.C.bg_size, "(,\\s*").concat(CssProp.C.bg_size, ")*"),
  47005. border_bottom_left_radius: "(".concat(CssProp.B.length, "|").concat(CssProp.B.percentage, ")(\\s*(").concat(CssProp.B.length, "|").concat(CssProp.B.percentage, "))?"),
  47006. border_bottom_width: CssProp.C.border_width,
  47007. border_left_style: CssProp.A.border_style,
  47008. border_right_style: CssProp.A.border_style,
  47009. border_top: "((".concat(CssProp.C.border_width, "|").concat(CssProp.A.border_style, "|").concat(CssProp.C.color, ")\\s*){1,3}"),
  47010. bottom: "".concat(CssProp.B.len_or_perc, "|auto"),
  47011. list_style: "((".concat(CssProp.AP.list_style_type, "|").concat(CssProp.AP.list_style_position, "|").concat(CssProp.C.image, "|none})\\s*){1,3}"),
  47012. margin_top: CssProp.C.margin_width,
  47013. outline: "((".concat(CssProp.C.color, "|invert|").concat(CssProp.A.border_style, "|").concat(CssProp.C.border_width, ")\\s*){1,3}"),
  47014. overflow_y: CssProp.AP.overflow_x,
  47015. pitch: "".concat(CssProp.B.frequency, "|x-low|low|medium|high|x-high"),
  47016. vertical_align: "baseline|sub|super|top|text-top|middle|bottom|text-bottom|".concat(CssProp.B.len_or_perc),
  47017. word_spacing: "normal|".concat(CssProp.B.length),
  47018. background_image: "".concat(CssProp.C.bg_image, "(,\\s*").concat(CssProp.C.bg_image, ")*"),
  47019. border_bottom_right_radius: "(".concat(CssProp.B.length, "|").concat(CssProp.B.percentage, ")(\\s*(").concat(CssProp.B.length, "|").concat(CssProp.B.percentage, "))?"),
  47020. border_left_width: CssProp.C.border_width,
  47021. border_right_width: CssProp.C.border_width,
  47022. left: "".concat(CssProp.B.len_or_perc, "|auto"),
  47023. margin_bottom: CssProp.C.margin_width,
  47024. pause_after: "".concat(CssProp.B.time, "|").concat(CssProp.B.percentage),
  47025. speech_rate: "".concat(CssProp.N.number, "|x-slow|slow|medium|fast|x-fast|faster|slower"),
  47026. transition_duration: "".concat(CssProp.B.time, "(,\\s*").concat(CssProp.B.time, ")*"),
  47027. border_bottom: "((".concat(CssProp.C.border_width, "|").concat(CssProp.A.border_style, "|").concat(CssProp.C.color, ")\\s*){1,3}"),
  47028. border_right: "((".concat(CssProp.C.border_width, "|").concat(CssProp.A.border_style, "|").concat(CssProp.C.color, ")\\s*){1,3}"),
  47029. margin: "((".concat(CssProp.C.margin_width, ")\\s*){1,4}"),
  47030. padding_left: CssProp.C.padding_width,
  47031. border_left: "((".concat(CssProp.C.border_width, "|").concat(CssProp.A.border_style, "|").concat(CssProp.C.color, ")\\s*){1,3}"),
  47032. quotes: "(".concat(CssProp.B.string, "\\s*").concat(CssProp.B.string, ")+|none"),
  47033. border_top_right_radius: "(".concat(CssProp.B.length, "|").concat(CssProp.B.percentage, ")(\\s*(").concat(CssProp.B.length, "|").concat(CssProp.B.percentage, "))?"),
  47034. min_width: "".concat(CssProp.B.length_pos, "|").concat(CssProp.B.percentage_pos, "|auto")
  47035. };
  47036. CssProp._CP1 = {
  47037. font: "(((((".concat(CssProp.AP.font_style, "|").concat(CssProp.AP.font_variant, "|").concat(CssProp.AP.font_weight, ")\\s*){1,3})?\\s*(").concat(CssProp._CP.font_size, ")\\s*(\\/\\s*(").concat(CssProp._CP.line_height, "))?\\s+(").concat(CssProp._CP.font_family, "))|caption|icon|menu|message-box|small-caption|status-bar)")
  47038. };
  47039. CssProp.CP = Object.assign(Object.assign({}, CssProp._CP), CssProp._CP1);
  47040. // CSS Property value validation regular expressions for use with sanitize-html
  47041. CssProp.BORDER_COLLAPSE = CssProp.reg(CssProp.AP.border_collapse);
  47042. CssProp.BOX = CssProp.reg(CssProp.AP.box);
  47043. CssProp.BOX_SIZING = CssProp.reg(CssProp.AP.box_sizing);
  47044. CssProp.CAPTION_SIDE = CssProp.reg(CssProp.AP.caption_side);
  47045. CssProp.CLEAR = CssProp.reg(CssProp.AP.clear);
  47046. CssProp.DIRECTION = CssProp.reg(CssProp.AP.direction);
  47047. CssProp.EMPTY_CELLS = CssProp.reg(CssProp.AP.empty_cells);
  47048. CssProp.FLOAT = CssProp.reg(CssProp.AP["float"]);
  47049. CssProp.FONT_STRETCH = CssProp.reg(CssProp.AP.font_stretch);
  47050. CssProp.FONT_STYLE = CssProp.reg(CssProp.AP.font_style);
  47051. CssProp.FONT_VARIANT = CssProp.reg(CssProp.AP.font_variant);
  47052. CssProp.FONT_WEIGHT = CssProp.reg(CssProp.AP.font_weight);
  47053. CssProp.LIST_STYLE_POSITION = CssProp.reg(CssProp.AP.list_style_position);
  47054. CssProp.LIST_STYLE_TYPE = CssProp.reg(CssProp.AP.list_style_type);
  47055. CssProp.OVERFLOW = CssProp.reg(CssProp.AP.overflow);
  47056. CssProp.OVERFLOW_WRAP = CssProp.reg(CssProp.AP.overflow_wrap);
  47057. CssProp.OVERFLOW_X = CssProp.reg(CssProp.AP.overflow_x);
  47058. CssProp.PAGE_BREAK_AFTER = CssProp.reg(CssProp.AP.page_break_after);
  47059. CssProp.PAGE_BREAK_BEFORE = CssProp.reg(CssProp.AP.page_break_before);
  47060. CssProp.PAGE_BREAK_INSIDE = CssProp.reg(CssProp.AP.page_break_inside);
  47061. CssProp.POSITION = CssProp.reg(CssProp.AP.position);
  47062. CssProp.RESIZE = CssProp.reg(CssProp.AP.resize);
  47063. CssProp.SPEAK = CssProp.reg(CssProp.AP.speak);
  47064. CssProp.SPEAK_HEADER = CssProp.reg(CssProp.AP.speak_header);
  47065. CssProp.SPEAK_NUMERAL = CssProp.reg(CssProp.AP.speak_numeral);
  47066. CssProp.SPEAK_PUNCTUATION = CssProp.reg(CssProp.AP.speak_punctuation);
  47067. CssProp.TABLE_LAYOUT = CssProp.reg(CssProp.AP.table_layout);
  47068. CssProp.TEXT_ALIGN = CssProp.reg(CssProp.AP.text_align);
  47069. CssProp.TEXT_DECORATION = CssProp.reg(CssProp.AP.text_decoration);
  47070. CssProp.TEXT_TRANSFORM = CssProp.reg(CssProp.AP.text_transform);
  47071. CssProp.TEXT_WRAP = CssProp.reg(CssProp.AP.text_wrap);
  47072. CssProp.UNICODE_BIDI = CssProp.reg(CssProp.AP.unicode_bidi);
  47073. CssProp.VISIBILITY = CssProp.reg(CssProp.AP.visibility);
  47074. CssProp.WHITE_SPACE = CssProp.reg(CssProp.AP.white_space);
  47075. CssProp.WORD_BREAK = CssProp.reg(CssProp.AP.word_break);
  47076. CssProp.BACKGROUND_ATTACHMENT = CssProp.reg(CssProp.CP.background_attachment);
  47077. CssProp.BACKGROUND_COLOR = CssProp.reg(CssProp.CP.background_color);
  47078. CssProp.BACKGROUND_ORIGIN = CssProp.reg(CssProp.CP.background_origin);
  47079. CssProp.BACKGROUND_REPEAT = CssProp.reg(CssProp.CP.background_repeat);
  47080. CssProp.BORDER = CssProp.reg(CssProp.CP.border);
  47081. CssProp.BORDER_RADIUS = CssProp.reg(CssProp.CP.border_radius);
  47082. CssProp.BORDER_SPACING = CssProp.reg(CssProp.CP.border_spacing);
  47083. CssProp.BORDER_TOP_COLOR = CssProp.reg(CssProp.CP.border_top_color);
  47084. CssProp.BORDER_TOP_STYLE = CssProp.reg(CssProp.CP.border_top_style);
  47085. CssProp.BORDER_WIDTH = CssProp.reg(CssProp.CP.border_width);
  47086. CssProp.COLOR = CssProp.reg(CssProp.CP.color);
  47087. CssProp.CURSOR = CssProp.reg(CssProp.CP.cursor);
  47088. CssProp.DISPLAY = CssProp.reg(CssProp.CP.display);
  47089. CssProp.DISPLAY_OUTSIDE = CssProp.reg(CssProp.CP.display_outside);
  47090. CssProp.ELEVATION = CssProp.reg(CssProp.CP.elevation);
  47091. CssProp.FONT_FAMILY = CssProp.reg(CssProp.CP.font_family);
  47092. CssProp.HEIGHT = CssProp.reg(CssProp.CP.height);
  47093. CssProp.LETTER_SPACING = CssProp.reg(CssProp.CP.letter_spacing);
  47094. CssProp.LIST_STYLE_IMAGE = CssProp.reg(CssProp.CP.list_style_image);
  47095. CssProp.MARGIN_RIGHT = CssProp.reg(CssProp.CP.margin_right);
  47096. CssProp.MAX_HEIGHT = CssProp.reg(CssProp.CP.max_height);
  47097. CssProp.MIN_HEIGHT = CssProp.reg(CssProp.CP.min_height);
  47098. CssProp.OPACITY = CssProp.reg(CssProp.CP.opacity);
  47099. CssProp.OUTLINE_COLOR = CssProp.reg(CssProp.CP.outline_color);
  47100. CssProp.OUTLINE_WIDTH = CssProp.reg(CssProp.CP.outline_width);
  47101. CssProp.PADDING = CssProp.reg(CssProp.CP.padding);
  47102. CssProp.PADDING_TOP = CssProp.reg(CssProp.CP.padding_top);
  47103. CssProp.PITCH_RANGE = CssProp.reg(CssProp.CP.pitch_range);
  47104. CssProp.RIGHT = CssProp.reg(CssProp.CP.right);
  47105. CssProp.STRESS = CssProp.reg(CssProp.CP.stress);
  47106. CssProp.TEXT_INDENT = CssProp.reg(CssProp.CP.text_indent);
  47107. CssProp.TEXT_SHADOW = CssProp.reg(CssProp.CP.text_shadow);
  47108. CssProp.VOLUME = CssProp.reg(CssProp.CP.volume);
  47109. CssProp.WORD_WRAP = CssProp.reg(CssProp.CP.word_wrap);
  47110. CssProp.ZOOM = CssProp.reg(CssProp.CP.zoom);
  47111. CssProp.BACKFACE_VISIBILITY = CssProp.reg(CssProp.CP.backface_visibility);
  47112. CssProp.BACKGROUND_CLIP = CssProp.reg(CssProp.CP.background_clip);
  47113. CssProp.BACKGROUND_POSITION = CssProp.reg(CssProp.CP.background_position);
  47114. CssProp.BORDER_BOTTOM_COLOR = CssProp.reg(CssProp.CP.border_bottom_color);
  47115. CssProp.BORDER_BOTTOM_STYLE = CssProp.reg(CssProp.CP.border_bottom_style);
  47116. CssProp.BORDER_COLOR = CssProp.reg(CssProp.CP.border_color);
  47117. CssProp.BORDER_LEFT_COLOR = CssProp.reg(CssProp.CP.border_left_color);
  47118. CssProp.BORDER_RIGHT_COLOR = CssProp.reg(CssProp.CP.border_right_color);
  47119. CssProp.BORDER_STYLE = CssProp.reg(CssProp.CP.border_style);
  47120. CssProp.BORDER_TOP_LEFT_RADIUS = CssProp.reg(CssProp.CP.border_top_left_radius);
  47121. CssProp.BORDER_TOP_WIDTH = CssProp.reg(CssProp.CP.border_top_width);
  47122. CssProp.BOX_SHADOW = CssProp.reg(CssProp.CP.box_shadow);
  47123. CssProp.CLIP = CssProp.reg(CssProp.CP.clip);
  47124. CssProp.DISPLAY_INSIDE = CssProp.reg(CssProp.CP.display_inside);
  47125. CssProp.FONT_SIZE = CssProp.reg(CssProp.CP.font_size);
  47126. CssProp.LINE_HEIGHT = CssProp.reg(CssProp.CP.line_height);
  47127. CssProp.MARGIN_LEFT = CssProp.reg(CssProp.CP.margin_left);
  47128. CssProp.MAX_WIDTH = CssProp.reg(CssProp.CP.max_width);
  47129. CssProp.OUTLINE_STYLE = CssProp.reg(CssProp.CP.outline_style);
  47130. CssProp.PADDING_BOTTOM = CssProp.reg(CssProp.CP.padding_bottom);
  47131. CssProp.PADDING_RIGHT = CssProp.reg(CssProp.CP.padding_right);
  47132. CssProp.PERSPECTIVE = CssProp.reg(CssProp.CP.perspective);
  47133. CssProp.RICHNESS = CssProp.reg(CssProp.CP.richness);
  47134. CssProp.TEXT_OVERFLOW = CssProp.reg(CssProp.CP.text_overflow);
  47135. CssProp.TOP = CssProp.reg(CssProp.CP.top);
  47136. CssProp.WIDTH = CssProp.reg(CssProp.CP.width);
  47137. CssProp.Z_INDEX = CssProp.reg(CssProp.CP.z_index);
  47138. CssProp.BACKGROUND = CssProp.reg(CssProp.CP.background);
  47139. CssProp.BACKGROUND_SIZE = CssProp.reg(CssProp.CP.background_size);
  47140. CssProp.BORDER_BOTTOM_LEFT_RADIUS = CssProp.reg(CssProp.CP.border_bottom_left_radius);
  47141. CssProp.BORDER_BOTTOM_WIDTH = CssProp.reg(CssProp.CP.border_bottom_width);
  47142. CssProp.BORDER_LEFT_STYLE = CssProp.reg(CssProp.CP.border_left_style);
  47143. CssProp.BORDER_RIGHT_STYLE = CssProp.reg(CssProp.CP.border_right_style);
  47144. CssProp.BORDER_TOP = CssProp.reg(CssProp.CP.border_top);
  47145. CssProp.BOTTOM = CssProp.reg(CssProp.CP.bottom);
  47146. CssProp.LIST_STYLE = CssProp.reg(CssProp.CP.list_style);
  47147. CssProp.MARGIN_TOP = CssProp.reg(CssProp.CP.margin_top);
  47148. CssProp.OUTLINE = CssProp.reg(CssProp.CP.outline);
  47149. CssProp.OVERFLOW_Y = CssProp.reg(CssProp.CP.overflow_y);
  47150. CssProp.PITCH = CssProp.reg(CssProp.CP.pitch);
  47151. CssProp.VERTICAL_ALIGN = CssProp.reg(CssProp.CP.vertical_align);
  47152. CssProp.WORD_SPACING = CssProp.reg(CssProp.CP.word_spacing);
  47153. CssProp.BACKGROUND_IMAGE = CssProp.reg(CssProp.CP.background_image);
  47154. CssProp.BORDER_BOTTOM_RIGHT_RADIUS = CssProp.reg(CssProp.CP.border_bottom_right_radius);
  47155. CssProp.BORDER_LEFT_WIDTH = CssProp.reg(CssProp.CP.border_left_width);
  47156. CssProp.BORDER_RIGHT_WIDTH = CssProp.reg(CssProp.CP.border_right_width);
  47157. CssProp.LEFT = CssProp.reg(CssProp.CP.left);
  47158. CssProp.MARGIN_BOTTOM = CssProp.reg(CssProp.CP.margin_bottom);
  47159. CssProp.PAUSE_AFTER = CssProp.reg(CssProp.CP.pause_after);
  47160. CssProp.SPEECH_RATE = CssProp.reg(CssProp.CP.speech_rate);
  47161. CssProp.TRANSITION_DURATION = CssProp.reg(CssProp.CP.transition_duration);
  47162. CssProp.BORDER_BOTTOM = CssProp.reg(CssProp.CP.border_bottom);
  47163. CssProp.BORDER_RIGHT = CssProp.reg(CssProp.CP.border_right);
  47164. CssProp.MARGIN = CssProp.reg(CssProp.CP.margin);
  47165. CssProp.PADDING_LEFT = CssProp.reg(CssProp.CP.padding_left);
  47166. CssProp.BORDER_LEFT = CssProp.reg(CssProp.CP.border_left);
  47167. CssProp.FONT = CssProp.reg(CssProp.CP.font);
  47168. CssProp.QUOTES = CssProp.reg(CssProp.CP.quotes);
  47169. CssProp.BORDER_TOP_RIGHT_RADIUS = CssProp.reg(CssProp.CP.border_top_right_radius);
  47170. CssProp.MIN_WIDTH = CssProp.reg(CssProp.CP.min_width);
  47171. /**
  47172. * A class to sanitize HTML strings.
  47173. */
  47174. var Sanitizer = /*#__PURE__*/function () {
  47175. function Sanitizer() {
  47176. _classCallCheck(this, Sanitizer);
  47177. this._options = {
  47178. // HTML tags that are allowed to be used. Tags were extracted from Google Caja
  47179. allowedTags: ['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blockquote', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'colspan', 'command', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dir', 'div', 'dl', 'dt', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr', 'i',
  47180. // 'iframe' is allowed by Google Caja, but disallowed by default by sanitize-html
  47181. // , 'iframe'
  47182. 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'map', 'mark', 'menu', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'pre', 'progress', 'q', 'rowspan', 's', 'samp', 'section', 'select', 'small', 'source', 'span', 'strike', 'strong', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr'],
  47183. // Attributes that HTML tags are allowed to have, extracted from Google Caja.
  47184. // See https://github.com/jupyterlab/jupyterlab/issues/1812#issuecomment-285848435
  47185. allowedAttributes: {
  47186. '*': ['class', 'dir', 'draggable', 'hidden', 'id', 'inert', 'itemprop', 'itemref', 'itemscope', 'lang', 'spellcheck', 'style', 'title', 'translate'],
  47187. // 'rel' and 'target' were *not* allowed by Google Caja
  47188. a: ['accesskey', 'coords', 'href', 'hreflang', 'name', 'rel', 'shape', 'tabindex', 'target', 'type'],
  47189. area: ['accesskey', 'alt', 'coords', 'href', 'nohref', 'shape', 'tabindex'],
  47190. // 'autoplay' was *not* allowed by Google Caja
  47191. audio: ['autoplay', 'controls', 'loop', 'mediagroup', 'muted', 'preload', 'src'],
  47192. bdo: ['dir'],
  47193. blockquote: ['cite'],
  47194. br: ['clear'],
  47195. button: ['accesskey', 'data-commandlinker-args', 'data-commandlinker-command', 'disabled', 'name', 'tabindex', 'type', 'value'],
  47196. canvas: ['height', 'width'],
  47197. caption: ['align'],
  47198. col: ['align', 'char', 'charoff', 'span', 'valign', 'width'],
  47199. colgroup: ['align', 'char', 'charoff', 'span', 'valign', 'width'],
  47200. command: ['checked', 'command', 'disabled', 'icon', 'label', 'radiogroup', 'type'],
  47201. data: ['value'],
  47202. del: ['cite', 'datetime'],
  47203. details: ['open'],
  47204. dir: ['compact'],
  47205. div: ['align'],
  47206. dl: ['compact'],
  47207. fieldset: ['disabled'],
  47208. font: ['color', 'face', 'size'],
  47209. form: ['accept', 'autocomplete', 'enctype', 'method', 'name', 'novalidate'],
  47210. h1: ['align'],
  47211. h2: ['align'],
  47212. h3: ['align'],
  47213. h4: ['align'],
  47214. h5: ['align'],
  47215. h6: ['align'],
  47216. hr: ['align', 'noshade', 'size', 'width'],
  47217. iframe: ['align', 'frameborder', 'height', 'marginheight', 'marginwidth', 'width'],
  47218. img: ['align', 'alt', 'border', 'height', 'hspace', 'ismap', 'name', 'src', 'usemap', 'vspace', 'width'],
  47219. input: ['accept', 'accesskey', 'align', 'alt', 'autocomplete', 'checked', 'disabled', 'inputmode', 'ismap', 'list', 'max', 'maxlength', 'min', 'multiple', 'name', 'placeholder', 'readonly', 'required', 'size', 'src', 'step', 'tabindex', 'type', 'usemap', 'value'],
  47220. ins: ['cite', 'datetime'],
  47221. label: ['accesskey', 'for'],
  47222. legend: ['accesskey', 'align'],
  47223. li: ['type', 'value'],
  47224. map: ['name'],
  47225. menu: ['compact', 'label', 'type'],
  47226. meter: ['high', 'low', 'max', 'min', 'value'],
  47227. ol: ['compact', 'reversed', 'start', 'type'],
  47228. optgroup: ['disabled', 'label'],
  47229. option: ['disabled', 'label', 'selected', 'value'],
  47230. output: ['for', 'name'],
  47231. p: ['align'],
  47232. pre: ['width'],
  47233. progress: ['max', 'min', 'value'],
  47234. q: ['cite'],
  47235. select: ['autocomplete', 'disabled', 'multiple', 'name', 'required', 'size', 'tabindex'],
  47236. source: ['type'],
  47237. table: ['align', 'bgcolor', 'border', 'cellpadding', 'cellspacing', 'frame', 'rules', 'summary', 'width'],
  47238. tbody: ['align', 'char', 'charoff', 'valign'],
  47239. td: ['abbr', 'align', 'axis', 'bgcolor', 'char', 'charoff', 'colspan', 'headers', 'height', 'nowrap', 'rowspan', 'scope', 'valign', 'width'],
  47240. textarea: ['accesskey', 'autocomplete', 'cols', 'disabled', 'inputmode', 'name', 'placeholder', 'readonly', 'required', 'rows', 'tabindex', 'wrap'],
  47241. tfoot: ['align', 'char', 'charoff', 'valign'],
  47242. th: ['abbr', 'align', 'axis', 'bgcolor', 'char', 'charoff', 'colspan', 'headers', 'height', 'nowrap', 'rowspan', 'scope', 'valign', 'width'],
  47243. thead: ['align', 'char', 'charoff', 'valign'],
  47244. tr: ['align', 'bgcolor', 'char', 'charoff', 'valign'],
  47245. track: ['default', 'kind', 'label', 'srclang'],
  47246. ul: ['compact', 'type'],
  47247. video: ['autoplay', 'controls', 'height', 'loop', 'mediagroup', 'muted', 'poster', 'preload', 'src', 'width']
  47248. },
  47249. // Inline CSS styles that HTML tags may have (and their allowed values)
  47250. allowedStyles: {
  47251. // To simplify the data, all styles are allowed on all tags that allow the style attribute
  47252. '*': {
  47253. 'backface-visibility': [CssProp.BACKFACE_VISIBILITY],
  47254. background: [CssProp.BACKGROUND],
  47255. 'background-attachment': [CssProp.BACKGROUND_ATTACHMENT],
  47256. 'background-clip': [CssProp.BACKGROUND_CLIP],
  47257. 'background-color': [CssProp.BACKGROUND_COLOR],
  47258. 'background-image': [CssProp.BACKGROUND_IMAGE],
  47259. 'background-origin': [CssProp.BACKGROUND_ORIGIN],
  47260. 'background-position': [CssProp.BACKGROUND_POSITION],
  47261. 'background-repeat': [CssProp.BACKGROUND_REPEAT],
  47262. 'background-size': [CssProp.BACKGROUND_SIZE],
  47263. border: [CssProp.BORDER],
  47264. 'border-bottom': [CssProp.BORDER_BOTTOM],
  47265. 'border-bottom-color': [CssProp.BORDER_BOTTOM_COLOR],
  47266. 'border-bottom-left-radius': [CssProp.BORDER_BOTTOM_LEFT_RADIUS],
  47267. 'border-bottom-right-radius': [CssProp.BORDER_BOTTOM_RIGHT_RADIUS],
  47268. 'border-bottom-style': [CssProp.BORDER_BOTTOM_STYLE],
  47269. 'border-bottom-width': [CssProp.BORDER_BOTTOM_WIDTH],
  47270. 'border-collapse': [CssProp.BORDER_COLLAPSE],
  47271. 'border-color': [CssProp.BORDER_COLOR],
  47272. 'border-left': [CssProp.BORDER_LEFT],
  47273. 'border-left-color': [CssProp.BORDER_LEFT_COLOR],
  47274. 'border-left-style': [CssProp.BORDER_LEFT_STYLE],
  47275. 'border-left-width': [CssProp.BORDER_LEFT_WIDTH],
  47276. 'border-radius': [CssProp.BORDER_RADIUS],
  47277. 'border-right': [CssProp.BORDER_RIGHT],
  47278. 'border-right-color': [CssProp.BORDER_RIGHT_COLOR],
  47279. 'border-right-style': [CssProp.BORDER_RIGHT_STYLE],
  47280. 'border-right-width': [CssProp.BORDER_RIGHT_WIDTH],
  47281. 'border-spacing': [CssProp.BORDER_SPACING],
  47282. 'border-style': [CssProp.BORDER_STYLE],
  47283. 'border-top': [CssProp.BORDER_TOP],
  47284. 'border-top-color': [CssProp.BORDER_TOP_COLOR],
  47285. 'border-top-left-radius': [CssProp.BORDER_TOP_LEFT_RADIUS],
  47286. 'border-top-right-radius': [CssProp.BORDER_TOP_RIGHT_RADIUS],
  47287. 'border-top-style': [CssProp.BORDER_TOP_STYLE],
  47288. 'border-top-width': [CssProp.BORDER_TOP_WIDTH],
  47289. 'border-width': [CssProp.BORDER_WIDTH],
  47290. bottom: [CssProp.BOTTOM],
  47291. box: [CssProp.BOX],
  47292. 'box-shadow': [CssProp.BOX_SHADOW],
  47293. 'box-sizing': [CssProp.BOX_SIZING],
  47294. 'caption-side': [CssProp.CAPTION_SIDE],
  47295. clear: [CssProp.CLEAR],
  47296. clip: [CssProp.CLIP],
  47297. color: [CssProp.COLOR],
  47298. cursor: [CssProp.CURSOR],
  47299. direction: [CssProp.DIRECTION],
  47300. display: [CssProp.DISPLAY],
  47301. 'display-inside': [CssProp.DISPLAY_INSIDE],
  47302. 'display-outside': [CssProp.DISPLAY_OUTSIDE],
  47303. elevation: [CssProp.ELEVATION],
  47304. 'empty-cells': [CssProp.EMPTY_CELLS],
  47305. "float": [CssProp.FLOAT],
  47306. font: [CssProp.FONT],
  47307. 'font-family': [CssProp.FONT_FAMILY],
  47308. 'font-size': [CssProp.FONT_SIZE],
  47309. 'font-stretch': [CssProp.FONT_STRETCH],
  47310. 'font-style': [CssProp.FONT_STYLE],
  47311. 'font-variant': [CssProp.FONT_VARIANT],
  47312. 'font-weight': [CssProp.FONT_WEIGHT],
  47313. height: [CssProp.HEIGHT],
  47314. left: [CssProp.LEFT],
  47315. 'letter-spacing': [CssProp.LETTER_SPACING],
  47316. 'line-height': [CssProp.LINE_HEIGHT],
  47317. 'list-style': [CssProp.LIST_STYLE],
  47318. 'list-style-image': [CssProp.LIST_STYLE_IMAGE],
  47319. 'list-style-position': [CssProp.LIST_STYLE_POSITION],
  47320. 'list-style-type': [CssProp.LIST_STYLE_TYPE],
  47321. margin: [CssProp.MARGIN],
  47322. 'margin-bottom': [CssProp.MARGIN_BOTTOM],
  47323. 'margin-left': [CssProp.MARGIN_LEFT],
  47324. 'margin-right': [CssProp.MARGIN_RIGHT],
  47325. 'margin-top': [CssProp.MARGIN_TOP],
  47326. 'max-height': [CssProp.MAX_HEIGHT],
  47327. 'max-width': [CssProp.MAX_WIDTH],
  47328. 'min-height': [CssProp.MIN_HEIGHT],
  47329. 'min-width': [CssProp.MIN_WIDTH],
  47330. opacity: [CssProp.OPACITY],
  47331. outline: [CssProp.OUTLINE],
  47332. 'outline-color': [CssProp.OUTLINE_COLOR],
  47333. 'outline-style': [CssProp.OUTLINE_STYLE],
  47334. 'outline-width': [CssProp.OUTLINE_WIDTH],
  47335. overflow: [CssProp.OVERFLOW],
  47336. 'overflow-wrap': [CssProp.OVERFLOW_WRAP],
  47337. 'overflow-x': [CssProp.OVERFLOW_X],
  47338. 'overflow-y': [CssProp.OVERFLOW_Y],
  47339. padding: [CssProp.PADDING],
  47340. 'padding-bottom': [CssProp.PADDING_BOTTOM],
  47341. 'padding-left': [CssProp.PADDING_LEFT],
  47342. 'padding-right': [CssProp.PADDING_RIGHT],
  47343. 'padding-top': [CssProp.PADDING_TOP],
  47344. 'page-break-after': [CssProp.PAGE_BREAK_AFTER],
  47345. 'page-break-before': [CssProp.PAGE_BREAK_BEFORE],
  47346. 'page-break-inside': [CssProp.PAGE_BREAK_INSIDE],
  47347. 'pause-after': [CssProp.PAUSE_AFTER],
  47348. perspective: [CssProp.PERSPECTIVE],
  47349. pitch: [CssProp.PITCH],
  47350. 'pitch-range': [CssProp.PITCH_RANGE],
  47351. position: [CssProp.POSITION],
  47352. quotes: [CssProp.QUOTES],
  47353. resize: [CssProp.RESIZE],
  47354. richness: [CssProp.RICHNESS],
  47355. right: [CssProp.RIGHT],
  47356. speak: [CssProp.SPEAK],
  47357. 'speak-header': [CssProp.SPEAK_HEADER],
  47358. 'speak-numeral': [CssProp.SPEAK_NUMERAL],
  47359. 'speak-punctuation': [CssProp.SPEAK_PUNCTUATION],
  47360. 'speech-rate': [CssProp.SPEECH_RATE],
  47361. stress: [CssProp.STRESS],
  47362. 'table-layout': [CssProp.TABLE_LAYOUT],
  47363. 'text-align': [CssProp.TEXT_ALIGN],
  47364. 'text-decoration': [CssProp.TEXT_DECORATION],
  47365. 'text-indent': [CssProp.TEXT_INDENT],
  47366. 'text-overflow': [CssProp.TEXT_OVERFLOW],
  47367. 'text-shadow': [CssProp.TEXT_SHADOW],
  47368. 'text-transform': [CssProp.TEXT_TRANSFORM],
  47369. 'text-wrap': [CssProp.TEXT_WRAP],
  47370. top: [CssProp.TOP],
  47371. 'unicode-bidi': [CssProp.UNICODE_BIDI],
  47372. 'vertical-align': [CssProp.VERTICAL_ALIGN],
  47373. visibility: [CssProp.VISIBILITY],
  47374. volume: [CssProp.VOLUME],
  47375. 'white-space': [CssProp.WHITE_SPACE],
  47376. width: [CssProp.WIDTH],
  47377. 'word-break': [CssProp.WORD_BREAK],
  47378. 'word-spacing': [CssProp.WORD_SPACING],
  47379. 'word-wrap': [CssProp.WORD_WRAP],
  47380. 'z-index': [CssProp.Z_INDEX],
  47381. zoom: [CssProp.ZOOM]
  47382. }
  47383. },
  47384. transformTags: {
  47385. // Set the "rel" attribute for <a> tags to "nofollow".
  47386. a: sanitize_html__WEBPACK_IMPORTED_MODULE_0___default().simpleTransform('a', {
  47387. rel: 'nofollow'
  47388. }),
  47389. // Set the "disabled" attribute for <input> tags.
  47390. input: sanitize_html__WEBPACK_IMPORTED_MODULE_0___default().simpleTransform('input', {
  47391. disabled: 'disabled'
  47392. })
  47393. },
  47394. allowedSchemes: _toConsumableArray((sanitize_html__WEBPACK_IMPORTED_MODULE_0___default().defaults.allowedSchemes)),
  47395. allowedSchemesByTag: {
  47396. // Allow 'attachment:' img src (used for markdown cell attachments).
  47397. img: sanitize_html__WEBPACK_IMPORTED_MODULE_0___default().defaults.allowedSchemes.concat(['attachment'])
  47398. },
  47399. // Override of the default option, so we can skip 'src' attribute validation.
  47400. // 'src' Attributes are validated to be URIs, which does not allow for embedded (image) data.
  47401. // Since embedded data is no longer deemed to be a threat, validation can be skipped.
  47402. // See https://github.com/jupyterlab/jupyterlab/issues/5183
  47403. allowedSchemesAppliedToAttributes: ['href', 'cite']
  47404. };
  47405. }
  47406. /**
  47407. * Sanitize an HTML string.
  47408. *
  47409. * @param dirty - The dirty text.
  47410. *
  47411. * @param options - The optional sanitization options.
  47412. *
  47413. * @returns The sanitized string.
  47414. */
  47415. _createClass(Sanitizer, [{
  47416. key: "sanitize",
  47417. value: function sanitize(dirty, options) {
  47418. return sanitize_html__WEBPACK_IMPORTED_MODULE_0___default()(dirty, Object.assign(Object.assign({}, this._options), options || {}));
  47419. }
  47420. /**
  47421. * Set the allowed schemes
  47422. *
  47423. * @param scheme Allowed schemes
  47424. */
  47425. }, {
  47426. key: "setAllowedSchemes",
  47427. value: function setAllowedSchemes(scheme) {
  47428. // Force copy of `scheme`
  47429. this._options.allowedSchemes = _toConsumableArray(scheme);
  47430. }
  47431. }]);
  47432. return Sanitizer;
  47433. }();
  47434. /**
  47435. * The default instance of an `ISanitizer` meant for use by user code.
  47436. *
  47437. * @deprecated It will be removed in JupyterLab v4. You should request the `ISanitizer` in
  47438. * your plugin instead.
  47439. */
  47440. var defaultSanitizer = new Sanitizer();
  47441. })();
  47442. /******/ return __webpack_exports__;
  47443. /******/ })()
  47444. ;
  47445. });;
  47446. // Copyright (c) Jupyter Development Team.
  47447. // Distributed under the terms of the Modified BSD License.
  47448. define('base/js/security',[
  47449. 'jquery',
  47450. 'components/sanitizer/index',
  47451. ], function($, sanitizer) {
  47452. "use strict";
  47453. var noop = function (x) { return x; };
  47454. var defaultSanitizer = sanitizer.defaultSanitizer;
  47455. var sanitize_html = function (html, allow_css) {
  47456. /**
  47457. * sanitize HTML
  47458. * if allow_css is true (default: false), CSS is sanitized as well.
  47459. * otherwise, CSS elements and attributes are simply removed.
  47460. */
  47461. const options = {};
  47462. if (!allow_css) {
  47463. options.allowedStyles = {};
  47464. }
  47465. return defaultSanitizer.sanitize(html, options);
  47466. };
  47467. var sanitize_html_and_parse = function (html, allow_css) {
  47468. /**
  47469. * Sanitize HTML and parse it safely using jQuery.
  47470. *
  47471. * This disable's jQuery's html 'prefilter', which can make invalid
  47472. * HTML valid after the sanitizer has checked it.
  47473. *
  47474. * Returns an array of DOM nodes.
  47475. */
  47476. var sanitized_html = sanitize_html(html, allow_css);
  47477. var prev_htmlPrefilter = $.htmlPrefilter;
  47478. $.htmlPrefilter = function(html) {return html;}; // Don't modify HTML
  47479. try {
  47480. return $.parseHTML(sanitized_html);
  47481. } finally {
  47482. $.htmlPrefilter = prev_htmlPrefilter; // Set it back again
  47483. }
  47484. };
  47485. var security = {
  47486. sanitize_html_and_parse: sanitize_html_and_parse,
  47487. sanitize_html: sanitize_html
  47488. };
  47489. return security;
  47490. });
  47491. /**
  47492. * marked - a markdown parser
  47493. * Copyright (c) 2011-2022, Christopher Jeffrey. (MIT Licensed)
  47494. * https://github.com/markedjs/marked
  47495. */
  47496. /**
  47497. * DO NOT EDIT THIS FILE
  47498. * The code in this file is generated from files in ./src/
  47499. */
  47500. (function (global, factory) {
  47501. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
  47502. typeof define === 'function' && define.amd ? define('components/marked/lib/marked',['exports'], factory) :
  47503. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.marked = {}));
  47504. })(this, (function (exports) { 'use strict';
  47505. function _defineProperties(target, props) {
  47506. for (var i = 0; i < props.length; i++) {
  47507. var descriptor = props[i];
  47508. descriptor.enumerable = descriptor.enumerable || false;
  47509. descriptor.configurable = true;
  47510. if ("value" in descriptor) descriptor.writable = true;
  47511. Object.defineProperty(target, descriptor.key, descriptor);
  47512. }
  47513. }
  47514. function _createClass(Constructor, protoProps, staticProps) {
  47515. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  47516. if (staticProps) _defineProperties(Constructor, staticProps);
  47517. Object.defineProperty(Constructor, "prototype", {
  47518. writable: false
  47519. });
  47520. return Constructor;
  47521. }
  47522. function _unsupportedIterableToArray(o, minLen) {
  47523. if (!o) return;
  47524. if (typeof o === "string") return _arrayLikeToArray(o, minLen);
  47525. var n = Object.prototype.toString.call(o).slice(8, -1);
  47526. if (n === "Object" && o.constructor) n = o.constructor.name;
  47527. if (n === "Map" || n === "Set") return Array.from(o);
  47528. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
  47529. }
  47530. function _arrayLikeToArray(arr, len) {
  47531. if (len == null || len > arr.length) len = arr.length;
  47532. for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
  47533. return arr2;
  47534. }
  47535. function _createForOfIteratorHelperLoose(o, allowArrayLike) {
  47536. var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
  47537. if (it) return (it = it.call(o)).next.bind(it);
  47538. if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
  47539. if (it) o = it;
  47540. var i = 0;
  47541. return function () {
  47542. if (i >= o.length) return {
  47543. done: true
  47544. };
  47545. return {
  47546. done: false,
  47547. value: o[i++]
  47548. };
  47549. };
  47550. }
  47551. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  47552. }
  47553. function getDefaults() {
  47554. return {
  47555. baseUrl: null,
  47556. breaks: false,
  47557. extensions: null,
  47558. gfm: true,
  47559. headerIds: true,
  47560. headerPrefix: '',
  47561. highlight: null,
  47562. langPrefix: 'language-',
  47563. mangle: true,
  47564. pedantic: false,
  47565. renderer: null,
  47566. sanitize: false,
  47567. sanitizer: null,
  47568. silent: false,
  47569. smartLists: false,
  47570. smartypants: false,
  47571. tokenizer: null,
  47572. walkTokens: null,
  47573. xhtml: false
  47574. };
  47575. }
  47576. exports.defaults = getDefaults();
  47577. function changeDefaults(newDefaults) {
  47578. exports.defaults = newDefaults;
  47579. }
  47580. /**
  47581. * Helpers
  47582. */
  47583. var escapeTest = /[&<>"']/;
  47584. var escapeReplace = /[&<>"']/g;
  47585. var escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/;
  47586. var escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g;
  47587. var escapeReplacements = {
  47588. '&': '&amp;',
  47589. '<': '&lt;',
  47590. '>': '&gt;',
  47591. '"': '&quot;',
  47592. "'": '&#39;'
  47593. };
  47594. var getEscapeReplacement = function getEscapeReplacement(ch) {
  47595. return escapeReplacements[ch];
  47596. };
  47597. function escape(html, encode) {
  47598. if (encode) {
  47599. if (escapeTest.test(html)) {
  47600. return html.replace(escapeReplace, getEscapeReplacement);
  47601. }
  47602. } else {
  47603. if (escapeTestNoEncode.test(html)) {
  47604. return html.replace(escapeReplaceNoEncode, getEscapeReplacement);
  47605. }
  47606. }
  47607. return html;
  47608. }
  47609. var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
  47610. /**
  47611. * @param {string} html
  47612. */
  47613. function unescape(html) {
  47614. // explicitly match decimal, hex, and named HTML entities
  47615. return html.replace(unescapeTest, function (_, n) {
  47616. n = n.toLowerCase();
  47617. if (n === 'colon') return ':';
  47618. if (n.charAt(0) === '#') {
  47619. return n.charAt(1) === 'x' ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1));
  47620. }
  47621. return '';
  47622. });
  47623. }
  47624. var caret = /(^|[^\[])\^/g;
  47625. /**
  47626. * @param {string | RegExp} regex
  47627. * @param {string} opt
  47628. */
  47629. function edit(regex, opt) {
  47630. regex = typeof regex === 'string' ? regex : regex.source;
  47631. opt = opt || '';
  47632. var obj = {
  47633. replace: function replace(name, val) {
  47634. val = val.source || val;
  47635. val = val.replace(caret, '$1');
  47636. regex = regex.replace(name, val);
  47637. return obj;
  47638. },
  47639. getRegex: function getRegex() {
  47640. return new RegExp(regex, opt);
  47641. }
  47642. };
  47643. return obj;
  47644. }
  47645. var nonWordAndColonTest = /[^\w:]/g;
  47646. var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
  47647. /**
  47648. * @param {boolean} sanitize
  47649. * @param {string} base
  47650. * @param {string} href
  47651. */
  47652. function cleanUrl(sanitize, base, href) {
  47653. if (sanitize) {
  47654. var prot;
  47655. try {
  47656. prot = decodeURIComponent(unescape(href)).replace(nonWordAndColonTest, '').toLowerCase();
  47657. } catch (e) {
  47658. return null;
  47659. }
  47660. if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
  47661. return null;
  47662. }
  47663. }
  47664. if (base && !originIndependentUrl.test(href)) {
  47665. href = resolveUrl(base, href);
  47666. }
  47667. try {
  47668. href = encodeURI(href).replace(/%25/g, '%');
  47669. } catch (e) {
  47670. return null;
  47671. }
  47672. return href;
  47673. }
  47674. var baseUrls = {};
  47675. var justDomain = /^[^:]+:\/*[^/]*$/;
  47676. var protocol = /^([^:]+:)[\s\S]*$/;
  47677. var domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
  47678. /**
  47679. * @param {string} base
  47680. * @param {string} href
  47681. */
  47682. function resolveUrl(base, href) {
  47683. if (!baseUrls[' ' + base]) {
  47684. // we can ignore everything in base after the last slash of its path component,
  47685. // but we might need to add _that_
  47686. // https://tools.ietf.org/html/rfc3986#section-3
  47687. if (justDomain.test(base)) {
  47688. baseUrls[' ' + base] = base + '/';
  47689. } else {
  47690. baseUrls[' ' + base] = rtrim(base, '/', true);
  47691. }
  47692. }
  47693. base = baseUrls[' ' + base];
  47694. var relativeBase = base.indexOf(':') === -1;
  47695. if (href.substring(0, 2) === '//') {
  47696. if (relativeBase) {
  47697. return href;
  47698. }
  47699. return base.replace(protocol, '$1') + href;
  47700. } else if (href.charAt(0) === '/') {
  47701. if (relativeBase) {
  47702. return href;
  47703. }
  47704. return base.replace(domain, '$1') + href;
  47705. } else {
  47706. return base + href;
  47707. }
  47708. }
  47709. var noopTest = {
  47710. exec: function noopTest() {}
  47711. };
  47712. function merge(obj) {
  47713. var i = 1,
  47714. target,
  47715. key;
  47716. for (; i < arguments.length; i++) {
  47717. target = arguments[i];
  47718. for (key in target) {
  47719. if (Object.prototype.hasOwnProperty.call(target, key)) {
  47720. obj[key] = target[key];
  47721. }
  47722. }
  47723. }
  47724. return obj;
  47725. }
  47726. function splitCells(tableRow, count) {
  47727. // ensure that every cell-delimiting pipe has a space
  47728. // before it to distinguish it from an escaped pipe
  47729. var row = tableRow.replace(/\|/g, function (match, offset, str) {
  47730. var escaped = false,
  47731. curr = offset;
  47732. while (--curr >= 0 && str[curr] === '\\') {
  47733. escaped = !escaped;
  47734. }
  47735. if (escaped) {
  47736. // odd number of slashes means | is escaped
  47737. // so we leave it alone
  47738. return '|';
  47739. } else {
  47740. // add space before unescaped |
  47741. return ' |';
  47742. }
  47743. }),
  47744. cells = row.split(/ \|/);
  47745. var i = 0; // First/last cell in a row cannot be empty if it has no leading/trailing pipe
  47746. if (!cells[0].trim()) {
  47747. cells.shift();
  47748. }
  47749. if (cells.length > 0 && !cells[cells.length - 1].trim()) {
  47750. cells.pop();
  47751. }
  47752. if (cells.length > count) {
  47753. cells.splice(count);
  47754. } else {
  47755. while (cells.length < count) {
  47756. cells.push('');
  47757. }
  47758. }
  47759. for (; i < cells.length; i++) {
  47760. // leading or trailing whitespace is ignored per the gfm spec
  47761. cells[i] = cells[i].trim().replace(/\\\|/g, '|');
  47762. }
  47763. return cells;
  47764. }
  47765. /**
  47766. * Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
  47767. * /c*$/ is vulnerable to REDOS.
  47768. *
  47769. * @param {string} str
  47770. * @param {string} c
  47771. * @param {boolean} invert Remove suffix of non-c chars instead. Default falsey.
  47772. */
  47773. function rtrim(str, c, invert) {
  47774. var l = str.length;
  47775. if (l === 0) {
  47776. return '';
  47777. } // Length of suffix matching the invert condition.
  47778. var suffLen = 0; // Step left until we fail to match the invert condition.
  47779. while (suffLen < l) {
  47780. var currChar = str.charAt(l - suffLen - 1);
  47781. if (currChar === c && !invert) {
  47782. suffLen++;
  47783. } else if (currChar !== c && invert) {
  47784. suffLen++;
  47785. } else {
  47786. break;
  47787. }
  47788. }
  47789. return str.slice(0, l - suffLen);
  47790. }
  47791. function findClosingBracket(str, b) {
  47792. if (str.indexOf(b[1]) === -1) {
  47793. return -1;
  47794. }
  47795. var l = str.length;
  47796. var level = 0,
  47797. i = 0;
  47798. for (; i < l; i++) {
  47799. if (str[i] === '\\') {
  47800. i++;
  47801. } else if (str[i] === b[0]) {
  47802. level++;
  47803. } else if (str[i] === b[1]) {
  47804. level--;
  47805. if (level < 0) {
  47806. return i;
  47807. }
  47808. }
  47809. }
  47810. return -1;
  47811. }
  47812. function checkSanitizeDeprecation(opt) {
  47813. if (opt && opt.sanitize && !opt.silent) {
  47814. console.warn('marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options');
  47815. }
  47816. } // copied from https://stackoverflow.com/a/5450113/806777
  47817. /**
  47818. * @param {string} pattern
  47819. * @param {number} count
  47820. */
  47821. function repeatString(pattern, count) {
  47822. if (count < 1) {
  47823. return '';
  47824. }
  47825. var result = '';
  47826. while (count > 1) {
  47827. if (count & 1) {
  47828. result += pattern;
  47829. }
  47830. count >>= 1;
  47831. pattern += pattern;
  47832. }
  47833. return result + pattern;
  47834. }
  47835. function outputLink(cap, link, raw, lexer) {
  47836. var href = link.href;
  47837. var title = link.title ? escape(link.title) : null;
  47838. var text = cap[1].replace(/\\([\[\]])/g, '$1');
  47839. if (cap[0].charAt(0) !== '!') {
  47840. lexer.state.inLink = true;
  47841. var token = {
  47842. type: 'link',
  47843. raw: raw,
  47844. href: href,
  47845. title: title,
  47846. text: text,
  47847. tokens: lexer.inlineTokens(text, [])
  47848. };
  47849. lexer.state.inLink = false;
  47850. return token;
  47851. }
  47852. return {
  47853. type: 'image',
  47854. raw: raw,
  47855. href: href,
  47856. title: title,
  47857. text: escape(text)
  47858. };
  47859. }
  47860. function indentCodeCompensation(raw, text) {
  47861. var matchIndentToCode = raw.match(/^(\s+)(?:```)/);
  47862. if (matchIndentToCode === null) {
  47863. return text;
  47864. }
  47865. var indentToCode = matchIndentToCode[1];
  47866. return text.split('\n').map(function (node) {
  47867. var matchIndentInNode = node.match(/^\s+/);
  47868. if (matchIndentInNode === null) {
  47869. return node;
  47870. }
  47871. var indentInNode = matchIndentInNode[0];
  47872. if (indentInNode.length >= indentToCode.length) {
  47873. return node.slice(indentToCode.length);
  47874. }
  47875. return node;
  47876. }).join('\n');
  47877. }
  47878. /**
  47879. * Tokenizer
  47880. */
  47881. var Tokenizer = /*#__PURE__*/function () {
  47882. function Tokenizer(options) {
  47883. this.options = options || exports.defaults;
  47884. }
  47885. var _proto = Tokenizer.prototype;
  47886. _proto.space = function space(src) {
  47887. var cap = this.rules.block.newline.exec(src);
  47888. if (cap && cap[0].length > 0) {
  47889. return {
  47890. type: 'space',
  47891. raw: cap[0]
  47892. };
  47893. }
  47894. };
  47895. _proto.code = function code(src) {
  47896. var cap = this.rules.block.code.exec(src);
  47897. if (cap) {
  47898. var text = cap[0].replace(/^ {1,4}/gm, '');
  47899. return {
  47900. type: 'code',
  47901. raw: cap[0],
  47902. codeBlockStyle: 'indented',
  47903. text: !this.options.pedantic ? rtrim(text, '\n') : text
  47904. };
  47905. }
  47906. };
  47907. _proto.fences = function fences(src) {
  47908. var cap = this.rules.block.fences.exec(src);
  47909. if (cap) {
  47910. var raw = cap[0];
  47911. var text = indentCodeCompensation(raw, cap[3] || '');
  47912. return {
  47913. type: 'code',
  47914. raw: raw,
  47915. lang: cap[2] ? cap[2].trim() : cap[2],
  47916. text: text
  47917. };
  47918. }
  47919. };
  47920. _proto.heading = function heading(src) {
  47921. var cap = this.rules.block.heading.exec(src);
  47922. if (cap) {
  47923. var text = cap[2].trim(); // remove trailing #s
  47924. if (/#$/.test(text)) {
  47925. var trimmed = rtrim(text, '#');
  47926. if (this.options.pedantic) {
  47927. text = trimmed.trim();
  47928. } else if (!trimmed || / $/.test(trimmed)) {
  47929. // CommonMark requires space before trailing #s
  47930. text = trimmed.trim();
  47931. }
  47932. }
  47933. var token = {
  47934. type: 'heading',
  47935. raw: cap[0],
  47936. depth: cap[1].length,
  47937. text: text,
  47938. tokens: []
  47939. };
  47940. this.lexer.inline(token.text, token.tokens);
  47941. return token;
  47942. }
  47943. };
  47944. _proto.hr = function hr(src) {
  47945. var cap = this.rules.block.hr.exec(src);
  47946. if (cap) {
  47947. return {
  47948. type: 'hr',
  47949. raw: cap[0]
  47950. };
  47951. }
  47952. };
  47953. _proto.blockquote = function blockquote(src) {
  47954. var cap = this.rules.block.blockquote.exec(src);
  47955. if (cap) {
  47956. var text = cap[0].replace(/^ *>[ \t]?/gm, '');
  47957. return {
  47958. type: 'blockquote',
  47959. raw: cap[0],
  47960. tokens: this.lexer.blockTokens(text, []),
  47961. text: text
  47962. };
  47963. }
  47964. };
  47965. _proto.list = function list(src) {
  47966. var cap = this.rules.block.list.exec(src);
  47967. if (cap) {
  47968. var raw, istask, ischecked, indent, i, blankLine, endsWithBlankLine, line, nextLine, rawLine, itemContents, endEarly;
  47969. var bull = cap[1].trim();
  47970. var isordered = bull.length > 1;
  47971. var list = {
  47972. type: 'list',
  47973. raw: '',
  47974. ordered: isordered,
  47975. start: isordered ? +bull.slice(0, -1) : '',
  47976. loose: false,
  47977. items: []
  47978. };
  47979. bull = isordered ? "\\d{1,9}\\" + bull.slice(-1) : "\\" + bull;
  47980. if (this.options.pedantic) {
  47981. bull = isordered ? bull : '[*+-]';
  47982. } // Get next list item
  47983. var itemRegex = new RegExp("^( {0,3}" + bull + ")((?:[\t ][^\\n]*)?(?:\\n|$))"); // Check if current bullet point can start a new List Item
  47984. while (src) {
  47985. endEarly = false;
  47986. if (!(cap = itemRegex.exec(src))) {
  47987. break;
  47988. }
  47989. if (this.rules.block.hr.test(src)) {
  47990. // End list if bullet was actually HR (possibly move into itemRegex?)
  47991. break;
  47992. }
  47993. raw = cap[0];
  47994. src = src.substring(raw.length);
  47995. line = cap[2].split('\n', 1)[0];
  47996. nextLine = src.split('\n', 1)[0];
  47997. if (this.options.pedantic) {
  47998. indent = 2;
  47999. itemContents = line.trimLeft();
  48000. } else {
  48001. indent = cap[2].search(/[^ ]/); // Find first non-space char
  48002. indent = indent > 4 ? 1 : indent; // Treat indented code blocks (> 4 spaces) as having only 1 indent
  48003. itemContents = line.slice(indent);
  48004. indent += cap[1].length;
  48005. }
  48006. blankLine = false;
  48007. if (!line && /^ *$/.test(nextLine)) {
  48008. // Items begin with at most one blank line
  48009. raw += nextLine + '\n';
  48010. src = src.substring(nextLine.length + 1);
  48011. endEarly = true;
  48012. }
  48013. if (!endEarly) {
  48014. var nextBulletRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}(?:[*+-]|\\d{1,9}[.)])((?: [^\\n]*)?(?:\\n|$))");
  48015. var hrRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)");
  48016. var fencesBeginRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}(?:```|~~~)");
  48017. var headingBeginRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}#"); // Check if following lines should be included in List Item
  48018. while (src) {
  48019. rawLine = src.split('\n', 1)[0];
  48020. line = rawLine; // Re-align to follow commonmark nesting rules
  48021. if (this.options.pedantic) {
  48022. line = line.replace(/^ {1,4}(?=( {4})*[^ ])/g, ' ');
  48023. } // End list item if found code fences
  48024. if (fencesBeginRegex.test(line)) {
  48025. break;
  48026. } // End list item if found start of new heading
  48027. if (headingBeginRegex.test(line)) {
  48028. break;
  48029. } // End list item if found start of new bullet
  48030. if (nextBulletRegex.test(line)) {
  48031. break;
  48032. } // Horizontal rule found
  48033. if (hrRegex.test(src)) {
  48034. break;
  48035. }
  48036. if (line.search(/[^ ]/) >= indent || !line.trim()) {
  48037. // Dedent if possible
  48038. itemContents += '\n' + line.slice(indent);
  48039. } else if (!blankLine) {
  48040. // Until blank line, item doesn't need indentation
  48041. itemContents += '\n' + line;
  48042. } else {
  48043. // Otherwise, improper indentation ends this item
  48044. break;
  48045. }
  48046. if (!blankLine && !line.trim()) {
  48047. // Check if current line is blank
  48048. blankLine = true;
  48049. }
  48050. raw += rawLine + '\n';
  48051. src = src.substring(rawLine.length + 1);
  48052. }
  48053. }
  48054. if (!list.loose) {
  48055. // If the previous item ended with a blank line, the list is loose
  48056. if (endsWithBlankLine) {
  48057. list.loose = true;
  48058. } else if (/\n *\n *$/.test(raw)) {
  48059. endsWithBlankLine = true;
  48060. }
  48061. } // Check for task list items
  48062. if (this.options.gfm) {
  48063. istask = /^\[[ xX]\] /.exec(itemContents);
  48064. if (istask) {
  48065. ischecked = istask[0] !== '[ ] ';
  48066. itemContents = itemContents.replace(/^\[[ xX]\] +/, '');
  48067. }
  48068. }
  48069. list.items.push({
  48070. type: 'list_item',
  48071. raw: raw,
  48072. task: !!istask,
  48073. checked: ischecked,
  48074. loose: false,
  48075. text: itemContents
  48076. });
  48077. list.raw += raw;
  48078. } // Do not consume newlines at end of final item. Alternatively, make itemRegex *start* with any newlines to simplify/speed up endsWithBlankLine logic
  48079. list.items[list.items.length - 1].raw = raw.trimRight();
  48080. list.items[list.items.length - 1].text = itemContents.trimRight();
  48081. list.raw = list.raw.trimRight();
  48082. var l = list.items.length; // Item child tokens handled here at end because we needed to have the final item to trim it first
  48083. for (i = 0; i < l; i++) {
  48084. this.lexer.state.top = false;
  48085. list.items[i].tokens = this.lexer.blockTokens(list.items[i].text, []);
  48086. var spacers = list.items[i].tokens.filter(function (t) {
  48087. return t.type === 'space';
  48088. });
  48089. var hasMultipleLineBreaks = spacers.every(function (t) {
  48090. var chars = t.raw.split('');
  48091. var lineBreaks = 0;
  48092. for (var _iterator = _createForOfIteratorHelperLoose(chars), _step; !(_step = _iterator()).done;) {
  48093. var _char = _step.value;
  48094. if (_char === '\n') {
  48095. lineBreaks += 1;
  48096. }
  48097. if (lineBreaks > 1) {
  48098. return true;
  48099. }
  48100. }
  48101. return false;
  48102. });
  48103. if (!list.loose && spacers.length && hasMultipleLineBreaks) {
  48104. // Having a single line break doesn't mean a list is loose. A single line break is terminating the last list item
  48105. list.loose = true;
  48106. list.items[i].loose = true;
  48107. }
  48108. }
  48109. return list;
  48110. }
  48111. };
  48112. _proto.html = function html(src) {
  48113. var cap = this.rules.block.html.exec(src);
  48114. if (cap) {
  48115. var token = {
  48116. type: 'html',
  48117. raw: cap[0],
  48118. pre: !this.options.sanitizer && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'),
  48119. text: cap[0]
  48120. };
  48121. if (this.options.sanitize) {
  48122. token.type = 'paragraph';
  48123. token.text = this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]);
  48124. token.tokens = [];
  48125. this.lexer.inline(token.text, token.tokens);
  48126. }
  48127. return token;
  48128. }
  48129. };
  48130. _proto.def = function def(src) {
  48131. var cap = this.rules.block.def.exec(src);
  48132. if (cap) {
  48133. if (cap[3]) cap[3] = cap[3].substring(1, cap[3].length - 1);
  48134. var tag = cap[1].toLowerCase().replace(/\s+/g, ' ');
  48135. return {
  48136. type: 'def',
  48137. tag: tag,
  48138. raw: cap[0],
  48139. href: cap[2],
  48140. title: cap[3]
  48141. };
  48142. }
  48143. };
  48144. _proto.table = function table(src) {
  48145. var cap = this.rules.block.table.exec(src);
  48146. if (cap) {
  48147. var item = {
  48148. type: 'table',
  48149. header: splitCells(cap[1]).map(function (c) {
  48150. return {
  48151. text: c
  48152. };
  48153. }),
  48154. align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
  48155. rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, '').split('\n') : []
  48156. };
  48157. if (item.header.length === item.align.length) {
  48158. item.raw = cap[0];
  48159. var l = item.align.length;
  48160. var i, j, k, row;
  48161. for (i = 0; i < l; i++) {
  48162. if (/^ *-+: *$/.test(item.align[i])) {
  48163. item.align[i] = 'right';
  48164. } else if (/^ *:-+: *$/.test(item.align[i])) {
  48165. item.align[i] = 'center';
  48166. } else if (/^ *:-+ *$/.test(item.align[i])) {
  48167. item.align[i] = 'left';
  48168. } else {
  48169. item.align[i] = null;
  48170. }
  48171. }
  48172. l = item.rows.length;
  48173. for (i = 0; i < l; i++) {
  48174. item.rows[i] = splitCells(item.rows[i], item.header.length).map(function (c) {
  48175. return {
  48176. text: c
  48177. };
  48178. });
  48179. } // parse child tokens inside headers and cells
  48180. // header child tokens
  48181. l = item.header.length;
  48182. for (j = 0; j < l; j++) {
  48183. item.header[j].tokens = [];
  48184. this.lexer.inline(item.header[j].text, item.header[j].tokens);
  48185. } // cell child tokens
  48186. l = item.rows.length;
  48187. for (j = 0; j < l; j++) {
  48188. row = item.rows[j];
  48189. for (k = 0; k < row.length; k++) {
  48190. row[k].tokens = [];
  48191. this.lexer.inline(row[k].text, row[k].tokens);
  48192. }
  48193. }
  48194. return item;
  48195. }
  48196. }
  48197. };
  48198. _proto.lheading = function lheading(src) {
  48199. var cap = this.rules.block.lheading.exec(src);
  48200. if (cap) {
  48201. var token = {
  48202. type: 'heading',
  48203. raw: cap[0],
  48204. depth: cap[2].charAt(0) === '=' ? 1 : 2,
  48205. text: cap[1],
  48206. tokens: []
  48207. };
  48208. this.lexer.inline(token.text, token.tokens);
  48209. return token;
  48210. }
  48211. };
  48212. _proto.paragraph = function paragraph(src) {
  48213. var cap = this.rules.block.paragraph.exec(src);
  48214. if (cap) {
  48215. var token = {
  48216. type: 'paragraph',
  48217. raw: cap[0],
  48218. text: cap[1].charAt(cap[1].length - 1) === '\n' ? cap[1].slice(0, -1) : cap[1],
  48219. tokens: []
  48220. };
  48221. this.lexer.inline(token.text, token.tokens);
  48222. return token;
  48223. }
  48224. };
  48225. _proto.text = function text(src) {
  48226. var cap = this.rules.block.text.exec(src);
  48227. if (cap) {
  48228. var token = {
  48229. type: 'text',
  48230. raw: cap[0],
  48231. text: cap[0],
  48232. tokens: []
  48233. };
  48234. this.lexer.inline(token.text, token.tokens);
  48235. return token;
  48236. }
  48237. };
  48238. _proto.escape = function escape$1(src) {
  48239. var cap = this.rules.inline.escape.exec(src);
  48240. if (cap) {
  48241. return {
  48242. type: 'escape',
  48243. raw: cap[0],
  48244. text: escape(cap[1])
  48245. };
  48246. }
  48247. };
  48248. _proto.tag = function tag(src) {
  48249. var cap = this.rules.inline.tag.exec(src);
  48250. if (cap) {
  48251. if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
  48252. this.lexer.state.inLink = true;
  48253. } else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
  48254. this.lexer.state.inLink = false;
  48255. }
  48256. if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
  48257. this.lexer.state.inRawBlock = true;
  48258. } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
  48259. this.lexer.state.inRawBlock = false;
  48260. }
  48261. return {
  48262. type: this.options.sanitize ? 'text' : 'html',
  48263. raw: cap[0],
  48264. inLink: this.lexer.state.inLink,
  48265. inRawBlock: this.lexer.state.inRawBlock,
  48266. text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]) : cap[0]
  48267. };
  48268. }
  48269. };
  48270. _proto.link = function link(src) {
  48271. var cap = this.rules.inline.link.exec(src);
  48272. if (cap) {
  48273. var trimmedUrl = cap[2].trim();
  48274. if (!this.options.pedantic && /^</.test(trimmedUrl)) {
  48275. // commonmark requires matching angle brackets
  48276. if (!/>$/.test(trimmedUrl)) {
  48277. return;
  48278. } // ending angle bracket cannot be escaped
  48279. var rtrimSlash = rtrim(trimmedUrl.slice(0, -1), '\\');
  48280. if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
  48281. return;
  48282. }
  48283. } else {
  48284. // find closing parenthesis
  48285. var lastParenIndex = findClosingBracket(cap[2], '()');
  48286. if (lastParenIndex > -1) {
  48287. var start = cap[0].indexOf('!') === 0 ? 5 : 4;
  48288. var linkLen = start + cap[1].length + lastParenIndex;
  48289. cap[2] = cap[2].substring(0, lastParenIndex);
  48290. cap[0] = cap[0].substring(0, linkLen).trim();
  48291. cap[3] = '';
  48292. }
  48293. }
  48294. var href = cap[2];
  48295. var title = '';
  48296. if (this.options.pedantic) {
  48297. // split pedantic href and title
  48298. var link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
  48299. if (link) {
  48300. href = link[1];
  48301. title = link[3];
  48302. }
  48303. } else {
  48304. title = cap[3] ? cap[3].slice(1, -1) : '';
  48305. }
  48306. href = href.trim();
  48307. if (/^</.test(href)) {
  48308. if (this.options.pedantic && !/>$/.test(trimmedUrl)) {
  48309. // pedantic allows starting angle bracket without ending angle bracket
  48310. href = href.slice(1);
  48311. } else {
  48312. href = href.slice(1, -1);
  48313. }
  48314. }
  48315. return outputLink(cap, {
  48316. href: href ? href.replace(this.rules.inline._escapes, '$1') : href,
  48317. title: title ? title.replace(this.rules.inline._escapes, '$1') : title
  48318. }, cap[0], this.lexer);
  48319. }
  48320. };
  48321. _proto.reflink = function reflink(src, links) {
  48322. var cap;
  48323. if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
  48324. var link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
  48325. link = links[link.toLowerCase()];
  48326. if (!link || !link.href) {
  48327. var text = cap[0].charAt(0);
  48328. return {
  48329. type: 'text',
  48330. raw: text,
  48331. text: text
  48332. };
  48333. }
  48334. return outputLink(cap, link, cap[0], this.lexer);
  48335. }
  48336. };
  48337. _proto.emStrong = function emStrong(src, maskedSrc, prevChar) {
  48338. if (prevChar === void 0) {
  48339. prevChar = '';
  48340. }
  48341. var match = this.rules.inline.emStrong.lDelim.exec(src);
  48342. if (!match) return; // _ can't be between two alphanumerics. \p{L}\p{N} includes non-english alphabet/numbers as well
  48343. if (match[3] && prevChar.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDF70-\uDF81\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/)) return;
  48344. var nextChar = match[1] || match[2] || '';
  48345. if (!nextChar || nextChar && (prevChar === '' || this.rules.inline.punctuation.exec(prevChar))) {
  48346. var lLength = match[0].length - 1;
  48347. var rDelim,
  48348. rLength,
  48349. delimTotal = lLength,
  48350. midDelimTotal = 0;
  48351. var endReg = match[0][0] === '*' ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
  48352. endReg.lastIndex = 0; // Clip maskedSrc to same section of string as src (move to lexer?)
  48353. maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
  48354. while ((match = endReg.exec(maskedSrc)) != null) {
  48355. rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
  48356. if (!rDelim) continue; // skip single * in __abc*abc__
  48357. rLength = rDelim.length;
  48358. if (match[3] || match[4]) {
  48359. // found another Left Delim
  48360. delimTotal += rLength;
  48361. continue;
  48362. } else if (match[5] || match[6]) {
  48363. // either Left or Right Delim
  48364. if (lLength % 3 && !((lLength + rLength) % 3)) {
  48365. midDelimTotal += rLength;
  48366. continue; // CommonMark Emphasis Rules 9-10
  48367. }
  48368. }
  48369. delimTotal -= rLength;
  48370. if (delimTotal > 0) continue; // Haven't found enough closing delimiters
  48371. // Remove extra characters. *a*** -> *a*
  48372. rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal); // Create `em` if smallest delimiter has odd char count. *a***
  48373. if (Math.min(lLength, rLength) % 2) {
  48374. var _text = src.slice(1, lLength + match.index + rLength);
  48375. return {
  48376. type: 'em',
  48377. raw: src.slice(0, lLength + match.index + rLength + 1),
  48378. text: _text,
  48379. tokens: this.lexer.inlineTokens(_text, [])
  48380. };
  48381. } // Create 'strong' if smallest delimiter has even char count. **a***
  48382. var text = src.slice(2, lLength + match.index + rLength - 1);
  48383. return {
  48384. type: 'strong',
  48385. raw: src.slice(0, lLength + match.index + rLength + 1),
  48386. text: text,
  48387. tokens: this.lexer.inlineTokens(text, [])
  48388. };
  48389. }
  48390. }
  48391. };
  48392. _proto.codespan = function codespan(src) {
  48393. var cap = this.rules.inline.code.exec(src);
  48394. if (cap) {
  48395. var text = cap[2].replace(/\n/g, ' ');
  48396. var hasNonSpaceChars = /[^ ]/.test(text);
  48397. var hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text);
  48398. if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
  48399. text = text.substring(1, text.length - 1);
  48400. }
  48401. text = escape(text, true);
  48402. return {
  48403. type: 'codespan',
  48404. raw: cap[0],
  48405. text: text
  48406. };
  48407. }
  48408. };
  48409. _proto.br = function br(src) {
  48410. var cap = this.rules.inline.br.exec(src);
  48411. if (cap) {
  48412. return {
  48413. type: 'br',
  48414. raw: cap[0]
  48415. };
  48416. }
  48417. };
  48418. _proto.del = function del(src) {
  48419. var cap = this.rules.inline.del.exec(src);
  48420. if (cap) {
  48421. return {
  48422. type: 'del',
  48423. raw: cap[0],
  48424. text: cap[2],
  48425. tokens: this.lexer.inlineTokens(cap[2], [])
  48426. };
  48427. }
  48428. };
  48429. _proto.autolink = function autolink(src, mangle) {
  48430. var cap = this.rules.inline.autolink.exec(src);
  48431. if (cap) {
  48432. var text, href;
  48433. if (cap[2] === '@') {
  48434. text = escape(this.options.mangle ? mangle(cap[1]) : cap[1]);
  48435. href = 'mailto:' + text;
  48436. } else {
  48437. text = escape(cap[1]);
  48438. href = text;
  48439. }
  48440. return {
  48441. type: 'link',
  48442. raw: cap[0],
  48443. text: text,
  48444. href: href,
  48445. tokens: [{
  48446. type: 'text',
  48447. raw: text,
  48448. text: text
  48449. }]
  48450. };
  48451. }
  48452. };
  48453. _proto.url = function url(src, mangle) {
  48454. var cap;
  48455. if (cap = this.rules.inline.url.exec(src)) {
  48456. var text, href;
  48457. if (cap[2] === '@') {
  48458. text = escape(this.options.mangle ? mangle(cap[0]) : cap[0]);
  48459. href = 'mailto:' + text;
  48460. } else {
  48461. // do extended autolink path validation
  48462. var prevCapZero;
  48463. do {
  48464. prevCapZero = cap[0];
  48465. cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
  48466. } while (prevCapZero !== cap[0]);
  48467. text = escape(cap[0]);
  48468. if (cap[1] === 'www.') {
  48469. href = 'http://' + text;
  48470. } else {
  48471. href = text;
  48472. }
  48473. }
  48474. return {
  48475. type: 'link',
  48476. raw: cap[0],
  48477. text: text,
  48478. href: href,
  48479. tokens: [{
  48480. type: 'text',
  48481. raw: text,
  48482. text: text
  48483. }]
  48484. };
  48485. }
  48486. };
  48487. _proto.inlineText = function inlineText(src, smartypants) {
  48488. var cap = this.rules.inline.text.exec(src);
  48489. if (cap) {
  48490. var text;
  48491. if (this.lexer.state.inRawBlock) {
  48492. text = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]) : cap[0];
  48493. } else {
  48494. text = escape(this.options.smartypants ? smartypants(cap[0]) : cap[0]);
  48495. }
  48496. return {
  48497. type: 'text',
  48498. raw: cap[0],
  48499. text: text
  48500. };
  48501. }
  48502. };
  48503. return Tokenizer;
  48504. }();
  48505. /**
  48506. * Block-Level Grammar
  48507. */
  48508. var block = {
  48509. newline: /^(?: *(?:\n|$))+/,
  48510. code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
  48511. fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
  48512. hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
  48513. heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
  48514. blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
  48515. list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,
  48516. html: '^ {0,3}(?:' // optional indentation
  48517. + '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
  48518. + '|comment[^\\n]*(\\n+|$)' // (2)
  48519. + '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)' // (3)
  48520. + '|<![A-Z][\\s\\S]*?(?:>\\n*|$)' // (4)
  48521. + '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)' // (5)
  48522. + '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (6)
  48523. + '|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) open tag
  48524. + '|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) closing tag
  48525. + ')',
  48526. def: /^ {0,3}\[(label)\]: *(?:\n *)?<?([^\s>]+)>?(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
  48527. table: noopTest,
  48528. lheading: /^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,
  48529. // regex template, placeholders will be replaced according to different paragraph
  48530. // interruption rules of commonmark and the original markdown spec:
  48531. _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
  48532. text: /^[^\n]+/
  48533. };
  48534. block._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
  48535. block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
  48536. block.def = edit(block.def).replace('label', block._label).replace('title', block._title).getRegex();
  48537. block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
  48538. block.listItemStart = edit(/^( *)(bull) */).replace('bull', block.bullet).getRegex();
  48539. block.list = edit(block.list).replace(/bull/g, block.bullet).replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))').replace('def', '\\n+(?=' + block.def.source + ')').getRegex();
  48540. block._tag = 'address|article|aside|base|basefont|blockquote|body|caption' + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption' + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe' + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option' + '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr' + '|track|ul';
  48541. block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
  48542. block.html = edit(block.html, 'i').replace('comment', block._comment).replace('tag', block._tag).replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
  48543. block.paragraph = edit(block._paragraph).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
  48544. .replace('|table', '').replace('blockquote', ' {0,3}>').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
  48545. .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
  48546. .getRegex();
  48547. block.blockquote = edit(block.blockquote).replace('paragraph', block.paragraph).getRegex();
  48548. /**
  48549. * Normal Block Grammar
  48550. */
  48551. block.normal = merge({}, block);
  48552. /**
  48553. * GFM Block Grammar
  48554. */
  48555. block.gfm = merge({}, block.normal, {
  48556. table: '^ *([^\\n ].*\\|.*)\\n' // Header
  48557. + ' {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?' // Align
  48558. + '(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
  48559. });
  48560. block.gfm.table = edit(block.gfm.table).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('blockquote', ' {0,3}>').replace('code', ' {4}[^\\n]').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
  48561. .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // tables can be interrupted by type (6) html blocks
  48562. .getRegex();
  48563. block.gfm.paragraph = edit(block._paragraph).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
  48564. .replace('table', block.gfm.table) // interrupt paragraphs with table
  48565. .replace('blockquote', ' {0,3}>').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
  48566. .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
  48567. .getRegex();
  48568. /**
  48569. * Pedantic grammar (original John Gruber's loose markdown specification)
  48570. */
  48571. block.pedantic = merge({}, block.normal, {
  48572. html: edit('^ *(?:comment *(?:\\n|\\s*$)' + '|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)' // closed tag
  48573. + '|<tag(?:"[^"]*"|\'[^\']*\'|\\s[^\'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))').replace('comment', block._comment).replace(/tag/g, '(?!(?:' + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub' + '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)' + '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b').getRegex(),
  48574. def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
  48575. heading: /^(#{1,6})(.*)(?:\n+|$)/,
  48576. fences: noopTest,
  48577. // fences not supported
  48578. paragraph: edit(block.normal._paragraph).replace('hr', block.hr).replace('heading', ' *#{1,6} *[^\n]').replace('lheading', block.lheading).replace('blockquote', ' {0,3}>').replace('|fences', '').replace('|list', '').replace('|html', '').getRegex()
  48579. });
  48580. /**
  48581. * Inline-Level Grammar
  48582. */
  48583. var inline = {
  48584. escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
  48585. autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
  48586. url: noopTest,
  48587. tag: '^comment' + '|^</[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
  48588. + '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
  48589. + '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. <?php ?>
  48590. + '|^<![a-zA-Z]+\\s[\\s\\S]*?>' // declaration, e.g. <!DOCTYPE html>
  48591. + '|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>',
  48592. // CDATA section
  48593. link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
  48594. reflink: /^!?\[(label)\]\[(ref)\]/,
  48595. nolink: /^!?\[(ref)\](?:\[\])?/,
  48596. reflinkSearch: 'reflink|nolink(?!\\()',
  48597. emStrong: {
  48598. lDelim: /^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,
  48599. // (1) and (2) can only be a Right Delimiter. (3) and (4) can only be Left. (5) and (6) can be either Left or Right.
  48600. // () Skip orphan inside strong () Consume to delim (1) #*** (2) a***#, a*** (3) #***a, ***a (4) ***# (5) #***# (6) a***a
  48601. rDelimAst: /^[^_*]*?\_\_[^_*]*?\*[^_*]*?(?=\_\_)|[^*]+(?=[^*])|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,
  48602. rDelimUnd: /^[^_*]*?\*\*[^_*]*?\_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/ // ^- Not allowed for _
  48603. },
  48604. code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
  48605. br: /^( {2,}|\\)\n(?!\s*$)/,
  48606. del: noopTest,
  48607. text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
  48608. punctuation: /^([\spunctuation])/
  48609. }; // list of punctuation marks from CommonMark spec
  48610. // without * and _ to handle the different emphasis markers * and _
  48611. inline._punctuation = '!"#$%&\'()+\\-.,/:;<=>?@\\[\\]`^{|}~';
  48612. inline.punctuation = edit(inline.punctuation).replace(/punctuation/g, inline._punctuation).getRegex(); // sequences em should skip over [title](link), `code`, <html>
  48613. inline.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
  48614. inline.escapedEmSt = /\\\*|\\_/g;
  48615. inline._comment = edit(block._comment).replace('(?:-->|$)', '-->').getRegex();
  48616. inline.emStrong.lDelim = edit(inline.emStrong.lDelim).replace(/punct/g, inline._punctuation).getRegex();
  48617. inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, 'g').replace(/punct/g, inline._punctuation).getRegex();
  48618. inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, 'g').replace(/punct/g, inline._punctuation).getRegex();
  48619. inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
  48620. inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
  48621. inline._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;
  48622. inline.autolink = edit(inline.autolink).replace('scheme', inline._scheme).replace('email', inline._email).getRegex();
  48623. inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
  48624. inline.tag = edit(inline.tag).replace('comment', inline._comment).replace('attribute', inline._attribute).getRegex();
  48625. inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
  48626. inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
  48627. inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
  48628. inline.link = edit(inline.link).replace('label', inline._label).replace('href', inline._href).replace('title', inline._title).getRegex();
  48629. inline.reflink = edit(inline.reflink).replace('label', inline._label).replace('ref', block._label).getRegex();
  48630. inline.nolink = edit(inline.nolink).replace('ref', block._label).getRegex();
  48631. inline.reflinkSearch = edit(inline.reflinkSearch, 'g').replace('reflink', inline.reflink).replace('nolink', inline.nolink).getRegex();
  48632. /**
  48633. * Normal Inline Grammar
  48634. */
  48635. inline.normal = merge({}, inline);
  48636. /**
  48637. * Pedantic Inline Grammar
  48638. */
  48639. inline.pedantic = merge({}, inline.normal, {
  48640. strong: {
  48641. start: /^__|\*\*/,
  48642. middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
  48643. endAst: /\*\*(?!\*)/g,
  48644. endUnd: /__(?!_)/g
  48645. },
  48646. em: {
  48647. start: /^_|\*/,
  48648. middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
  48649. endAst: /\*(?!\*)/g,
  48650. endUnd: /_(?!_)/g
  48651. },
  48652. link: edit(/^!?\[(label)\]\((.*?)\)/).replace('label', inline._label).getRegex(),
  48653. reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace('label', inline._label).getRegex()
  48654. });
  48655. /**
  48656. * GFM Inline Grammar
  48657. */
  48658. inline.gfm = merge({}, inline.normal, {
  48659. escape: edit(inline.escape).replace('])', '~|])').getRegex(),
  48660. _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
  48661. url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
  48662. _backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
  48663. del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
  48664. text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
  48665. });
  48666. inline.gfm.url = edit(inline.gfm.url, 'i').replace('email', inline.gfm._extended_email).getRegex();
  48667. /**
  48668. * GFM + Line Breaks Inline Grammar
  48669. */
  48670. inline.breaks = merge({}, inline.gfm, {
  48671. br: edit(inline.br).replace('{2,}', '*').getRegex(),
  48672. text: edit(inline.gfm.text).replace('\\b_', '\\b_| {2,}\\n').replace(/\{2,\}/g, '*').getRegex()
  48673. });
  48674. /**
  48675. * smartypants text replacement
  48676. * @param {string} text
  48677. */
  48678. function smartypants(text) {
  48679. return text // em-dashes
  48680. .replace(/---/g, "\u2014") // en-dashes
  48681. .replace(/--/g, "\u2013") // opening singles
  48682. .replace(/(^|[-\u2014/(\[{"\s])'/g, "$1\u2018") // closing singles & apostrophes
  48683. .replace(/'/g, "\u2019") // opening doubles
  48684. .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1\u201C") // closing doubles
  48685. .replace(/"/g, "\u201D") // ellipses
  48686. .replace(/\.{3}/g, "\u2026");
  48687. }
  48688. /**
  48689. * mangle email addresses
  48690. * @param {string} text
  48691. */
  48692. function mangle(text) {
  48693. var out = '',
  48694. i,
  48695. ch;
  48696. var l = text.length;
  48697. for (i = 0; i < l; i++) {
  48698. ch = text.charCodeAt(i);
  48699. if (Math.random() > 0.5) {
  48700. ch = 'x' + ch.toString(16);
  48701. }
  48702. out += '&#' + ch + ';';
  48703. }
  48704. return out;
  48705. }
  48706. /**
  48707. * Block Lexer
  48708. */
  48709. var Lexer = /*#__PURE__*/function () {
  48710. function Lexer(options) {
  48711. this.tokens = [];
  48712. this.tokens.links = Object.create(null);
  48713. this.options = options || exports.defaults;
  48714. this.options.tokenizer = this.options.tokenizer || new Tokenizer();
  48715. this.tokenizer = this.options.tokenizer;
  48716. this.tokenizer.options = this.options;
  48717. this.tokenizer.lexer = this;
  48718. this.inlineQueue = [];
  48719. this.state = {
  48720. inLink: false,
  48721. inRawBlock: false,
  48722. top: true
  48723. };
  48724. var rules = {
  48725. block: block.normal,
  48726. inline: inline.normal
  48727. };
  48728. if (this.options.pedantic) {
  48729. rules.block = block.pedantic;
  48730. rules.inline = inline.pedantic;
  48731. } else if (this.options.gfm) {
  48732. rules.block = block.gfm;
  48733. if (this.options.breaks) {
  48734. rules.inline = inline.breaks;
  48735. } else {
  48736. rules.inline = inline.gfm;
  48737. }
  48738. }
  48739. this.tokenizer.rules = rules;
  48740. }
  48741. /**
  48742. * Expose Rules
  48743. */
  48744. /**
  48745. * Static Lex Method
  48746. */
  48747. Lexer.lex = function lex(src, options) {
  48748. var lexer = new Lexer(options);
  48749. return lexer.lex(src);
  48750. }
  48751. /**
  48752. * Static Lex Inline Method
  48753. */
  48754. ;
  48755. Lexer.lexInline = function lexInline(src, options) {
  48756. var lexer = new Lexer(options);
  48757. return lexer.inlineTokens(src);
  48758. }
  48759. /**
  48760. * Preprocessing
  48761. */
  48762. ;
  48763. var _proto = Lexer.prototype;
  48764. _proto.lex = function lex(src) {
  48765. src = src.replace(/\r\n|\r/g, '\n');
  48766. this.blockTokens(src, this.tokens);
  48767. var next;
  48768. while (next = this.inlineQueue.shift()) {
  48769. this.inlineTokens(next.src, next.tokens);
  48770. }
  48771. return this.tokens;
  48772. }
  48773. /**
  48774. * Lexing
  48775. */
  48776. ;
  48777. _proto.blockTokens = function blockTokens(src, tokens) {
  48778. var _this = this;
  48779. if (tokens === void 0) {
  48780. tokens = [];
  48781. }
  48782. if (this.options.pedantic) {
  48783. src = src.replace(/\t/g, ' ').replace(/^ +$/gm, '');
  48784. } else {
  48785. src = src.replace(/^( *)(\t+)/gm, function (_, leading, tabs) {
  48786. return leading + ' '.repeat(tabs.length);
  48787. });
  48788. }
  48789. var token, lastToken, cutSrc, lastParagraphClipped;
  48790. while (src) {
  48791. if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some(function (extTokenizer) {
  48792. if (token = extTokenizer.call({
  48793. lexer: _this
  48794. }, src, tokens)) {
  48795. src = src.substring(token.raw.length);
  48796. tokens.push(token);
  48797. return true;
  48798. }
  48799. return false;
  48800. })) {
  48801. continue;
  48802. } // newline
  48803. if (token = this.tokenizer.space(src)) {
  48804. src = src.substring(token.raw.length);
  48805. if (token.raw.length === 1 && tokens.length > 0) {
  48806. // if there's a single \n as a spacer, it's terminating the last line,
  48807. // so move it there so that we don't get unecessary paragraph tags
  48808. tokens[tokens.length - 1].raw += '\n';
  48809. } else {
  48810. tokens.push(token);
  48811. }
  48812. continue;
  48813. } // code
  48814. if (token = this.tokenizer.code(src)) {
  48815. src = src.substring(token.raw.length);
  48816. lastToken = tokens[tokens.length - 1]; // An indented code block cannot interrupt a paragraph.
  48817. if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
  48818. lastToken.raw += '\n' + token.raw;
  48819. lastToken.text += '\n' + token.text;
  48820. this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
  48821. } else {
  48822. tokens.push(token);
  48823. }
  48824. continue;
  48825. } // fences
  48826. if (token = this.tokenizer.fences(src)) {
  48827. src = src.substring(token.raw.length);
  48828. tokens.push(token);
  48829. continue;
  48830. } // heading
  48831. if (token = this.tokenizer.heading(src)) {
  48832. src = src.substring(token.raw.length);
  48833. tokens.push(token);
  48834. continue;
  48835. } // hr
  48836. if (token = this.tokenizer.hr(src)) {
  48837. src = src.substring(token.raw.length);
  48838. tokens.push(token);
  48839. continue;
  48840. } // blockquote
  48841. if (token = this.tokenizer.blockquote(src)) {
  48842. src = src.substring(token.raw.length);
  48843. tokens.push(token);
  48844. continue;
  48845. } // list
  48846. if (token = this.tokenizer.list(src)) {
  48847. src = src.substring(token.raw.length);
  48848. tokens.push(token);
  48849. continue;
  48850. } // html
  48851. if (token = this.tokenizer.html(src)) {
  48852. src = src.substring(token.raw.length);
  48853. tokens.push(token);
  48854. continue;
  48855. } // def
  48856. if (token = this.tokenizer.def(src)) {
  48857. src = src.substring(token.raw.length);
  48858. lastToken = tokens[tokens.length - 1];
  48859. if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
  48860. lastToken.raw += '\n' + token.raw;
  48861. lastToken.text += '\n' + token.raw;
  48862. this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
  48863. } else if (!this.tokens.links[token.tag]) {
  48864. this.tokens.links[token.tag] = {
  48865. href: token.href,
  48866. title: token.title
  48867. };
  48868. }
  48869. continue;
  48870. } // table (gfm)
  48871. if (token = this.tokenizer.table(src)) {
  48872. src = src.substring(token.raw.length);
  48873. tokens.push(token);
  48874. continue;
  48875. } // lheading
  48876. if (token = this.tokenizer.lheading(src)) {
  48877. src = src.substring(token.raw.length);
  48878. tokens.push(token);
  48879. continue;
  48880. } // top-level paragraph
  48881. // prevent paragraph consuming extensions by clipping 'src' to extension start
  48882. cutSrc = src;
  48883. if (this.options.extensions && this.options.extensions.startBlock) {
  48884. (function () {
  48885. var startIndex = Infinity;
  48886. var tempSrc = src.slice(1);
  48887. var tempStart = void 0;
  48888. _this.options.extensions.startBlock.forEach(function (getStartIndex) {
  48889. tempStart = getStartIndex.call({
  48890. lexer: this
  48891. }, tempSrc);
  48892. if (typeof tempStart === 'number' && tempStart >= 0) {
  48893. startIndex = Math.min(startIndex, tempStart);
  48894. }
  48895. });
  48896. if (startIndex < Infinity && startIndex >= 0) {
  48897. cutSrc = src.substring(0, startIndex + 1);
  48898. }
  48899. })();
  48900. }
  48901. if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
  48902. lastToken = tokens[tokens.length - 1];
  48903. if (lastParagraphClipped && lastToken.type === 'paragraph') {
  48904. lastToken.raw += '\n' + token.raw;
  48905. lastToken.text += '\n' + token.text;
  48906. this.inlineQueue.pop();
  48907. this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
  48908. } else {
  48909. tokens.push(token);
  48910. }
  48911. lastParagraphClipped = cutSrc.length !== src.length;
  48912. src = src.substring(token.raw.length);
  48913. continue;
  48914. } // text
  48915. if (token = this.tokenizer.text(src)) {
  48916. src = src.substring(token.raw.length);
  48917. lastToken = tokens[tokens.length - 1];
  48918. if (lastToken && lastToken.type === 'text') {
  48919. lastToken.raw += '\n' + token.raw;
  48920. lastToken.text += '\n' + token.text;
  48921. this.inlineQueue.pop();
  48922. this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
  48923. } else {
  48924. tokens.push(token);
  48925. }
  48926. continue;
  48927. }
  48928. if (src) {
  48929. var errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
  48930. if (this.options.silent) {
  48931. console.error(errMsg);
  48932. break;
  48933. } else {
  48934. throw new Error(errMsg);
  48935. }
  48936. }
  48937. }
  48938. this.state.top = true;
  48939. return tokens;
  48940. };
  48941. _proto.inline = function inline(src, tokens) {
  48942. if (tokens === void 0) {
  48943. tokens = [];
  48944. }
  48945. this.inlineQueue.push({
  48946. src: src,
  48947. tokens: tokens
  48948. });
  48949. return tokens;
  48950. }
  48951. /**
  48952. * Lexing/Compiling
  48953. */
  48954. ;
  48955. _proto.inlineTokens = function inlineTokens(src, tokens) {
  48956. var _this2 = this;
  48957. if (tokens === void 0) {
  48958. tokens = [];
  48959. }
  48960. var token, lastToken, cutSrc; // String with links masked to avoid interference with em and strong
  48961. var maskedSrc = src;
  48962. var match;
  48963. var keepPrevChar, prevChar; // Mask out reflinks
  48964. if (this.tokens.links) {
  48965. var links = Object.keys(this.tokens.links);
  48966. if (links.length > 0) {
  48967. while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
  48968. if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) {
  48969. maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString('a', match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
  48970. }
  48971. }
  48972. }
  48973. } // Mask out other blocks
  48974. while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
  48975. maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString('a', match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
  48976. } // Mask out escaped em & strong delimiters
  48977. while ((match = this.tokenizer.rules.inline.escapedEmSt.exec(maskedSrc)) != null) {
  48978. maskedSrc = maskedSrc.slice(0, match.index) + '++' + maskedSrc.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);
  48979. }
  48980. while (src) {
  48981. if (!keepPrevChar) {
  48982. prevChar = '';
  48983. }
  48984. keepPrevChar = false; // extensions
  48985. if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some(function (extTokenizer) {
  48986. if (token = extTokenizer.call({
  48987. lexer: _this2
  48988. }, src, tokens)) {
  48989. src = src.substring(token.raw.length);
  48990. tokens.push(token);
  48991. return true;
  48992. }
  48993. return false;
  48994. })) {
  48995. continue;
  48996. } // escape
  48997. if (token = this.tokenizer.escape(src)) {
  48998. src = src.substring(token.raw.length);
  48999. tokens.push(token);
  49000. continue;
  49001. } // tag
  49002. if (token = this.tokenizer.tag(src)) {
  49003. src = src.substring(token.raw.length);
  49004. lastToken = tokens[tokens.length - 1];
  49005. if (lastToken && token.type === 'text' && lastToken.type === 'text') {
  49006. lastToken.raw += token.raw;
  49007. lastToken.text += token.text;
  49008. } else {
  49009. tokens.push(token);
  49010. }
  49011. continue;
  49012. } // link
  49013. if (token = this.tokenizer.link(src)) {
  49014. src = src.substring(token.raw.length);
  49015. tokens.push(token);
  49016. continue;
  49017. } // reflink, nolink
  49018. if (token = this.tokenizer.reflink(src, this.tokens.links)) {
  49019. src = src.substring(token.raw.length);
  49020. lastToken = tokens[tokens.length - 1];
  49021. if (lastToken && token.type === 'text' && lastToken.type === 'text') {
  49022. lastToken.raw += token.raw;
  49023. lastToken.text += token.text;
  49024. } else {
  49025. tokens.push(token);
  49026. }
  49027. continue;
  49028. } // em & strong
  49029. if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
  49030. src = src.substring(token.raw.length);
  49031. tokens.push(token);
  49032. continue;
  49033. } // code
  49034. if (token = this.tokenizer.codespan(src)) {
  49035. src = src.substring(token.raw.length);
  49036. tokens.push(token);
  49037. continue;
  49038. } // br
  49039. if (token = this.tokenizer.br(src)) {
  49040. src = src.substring(token.raw.length);
  49041. tokens.push(token);
  49042. continue;
  49043. } // del (gfm)
  49044. if (token = this.tokenizer.del(src)) {
  49045. src = src.substring(token.raw.length);
  49046. tokens.push(token);
  49047. continue;
  49048. } // autolink
  49049. if (token = this.tokenizer.autolink(src, mangle)) {
  49050. src = src.substring(token.raw.length);
  49051. tokens.push(token);
  49052. continue;
  49053. } // url (gfm)
  49054. if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) {
  49055. src = src.substring(token.raw.length);
  49056. tokens.push(token);
  49057. continue;
  49058. } // text
  49059. // prevent inlineText consuming extensions by clipping 'src' to extension start
  49060. cutSrc = src;
  49061. if (this.options.extensions && this.options.extensions.startInline) {
  49062. (function () {
  49063. var startIndex = Infinity;
  49064. var tempSrc = src.slice(1);
  49065. var tempStart = void 0;
  49066. _this2.options.extensions.startInline.forEach(function (getStartIndex) {
  49067. tempStart = getStartIndex.call({
  49068. lexer: this
  49069. }, tempSrc);
  49070. if (typeof tempStart === 'number' && tempStart >= 0) {
  49071. startIndex = Math.min(startIndex, tempStart);
  49072. }
  49073. });
  49074. if (startIndex < Infinity && startIndex >= 0) {
  49075. cutSrc = src.substring(0, startIndex + 1);
  49076. }
  49077. })();
  49078. }
  49079. if (token = this.tokenizer.inlineText(cutSrc, smartypants)) {
  49080. src = src.substring(token.raw.length);
  49081. if (token.raw.slice(-1) !== '_') {
  49082. // Track prevChar before string of ____ started
  49083. prevChar = token.raw.slice(-1);
  49084. }
  49085. keepPrevChar = true;
  49086. lastToken = tokens[tokens.length - 1];
  49087. if (lastToken && lastToken.type === 'text') {
  49088. lastToken.raw += token.raw;
  49089. lastToken.text += token.text;
  49090. } else {
  49091. tokens.push(token);
  49092. }
  49093. continue;
  49094. }
  49095. if (src) {
  49096. var errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
  49097. if (this.options.silent) {
  49098. console.error(errMsg);
  49099. break;
  49100. } else {
  49101. throw new Error(errMsg);
  49102. }
  49103. }
  49104. }
  49105. return tokens;
  49106. };
  49107. _createClass(Lexer, null, [{
  49108. key: "rules",
  49109. get: function get() {
  49110. return {
  49111. block: block,
  49112. inline: inline
  49113. };
  49114. }
  49115. }]);
  49116. return Lexer;
  49117. }();
  49118. /**
  49119. * Renderer
  49120. */
  49121. var Renderer = /*#__PURE__*/function () {
  49122. function Renderer(options) {
  49123. this.options = options || exports.defaults;
  49124. }
  49125. var _proto = Renderer.prototype;
  49126. _proto.code = function code(_code, infostring, escaped) {
  49127. var lang = (infostring || '').match(/\S*/)[0];
  49128. if (this.options.highlight) {
  49129. var out = this.options.highlight(_code, lang);
  49130. if (out != null && out !== _code) {
  49131. escaped = true;
  49132. _code = out;
  49133. }
  49134. }
  49135. _code = _code.replace(/\n$/, '') + '\n';
  49136. if (!lang) {
  49137. return '<pre><code>' + (escaped ? _code : escape(_code, true)) + '</code></pre>\n';
  49138. }
  49139. return '<pre><code class="' + this.options.langPrefix + escape(lang, true) + '">' + (escaped ? _code : escape(_code, true)) + '</code></pre>\n';
  49140. }
  49141. /**
  49142. * @param {string} quote
  49143. */
  49144. ;
  49145. _proto.blockquote = function blockquote(quote) {
  49146. return "<blockquote>\n" + quote + "</blockquote>\n";
  49147. };
  49148. _proto.html = function html(_html) {
  49149. return _html;
  49150. }
  49151. /**
  49152. * @param {string} text
  49153. * @param {string} level
  49154. * @param {string} raw
  49155. * @param {any} slugger
  49156. */
  49157. ;
  49158. _proto.heading = function heading(text, level, raw, slugger) {
  49159. if (this.options.headerIds) {
  49160. var id = this.options.headerPrefix + slugger.slug(raw);
  49161. return "<h" + level + " id=\"" + id + "\">" + text + "</h" + level + ">\n";
  49162. } // ignore IDs
  49163. return "<h" + level + ">" + text + "</h" + level + ">\n";
  49164. };
  49165. _proto.hr = function hr() {
  49166. return this.options.xhtml ? '<hr/>\n' : '<hr>\n';
  49167. };
  49168. _proto.list = function list(body, ordered, start) {
  49169. var type = ordered ? 'ol' : 'ul',
  49170. startatt = ordered && start !== 1 ? ' start="' + start + '"' : '';
  49171. return '<' + type + startatt + '>\n' + body + '</' + type + '>\n';
  49172. }
  49173. /**
  49174. * @param {string} text
  49175. */
  49176. ;
  49177. _proto.listitem = function listitem(text) {
  49178. return "<li>" + text + "</li>\n";
  49179. };
  49180. _proto.checkbox = function checkbox(checked) {
  49181. return '<input ' + (checked ? 'checked="" ' : '') + 'disabled="" type="checkbox"' + (this.options.xhtml ? ' /' : '') + '> ';
  49182. }
  49183. /**
  49184. * @param {string} text
  49185. */
  49186. ;
  49187. _proto.paragraph = function paragraph(text) {
  49188. return "<p>" + text + "</p>\n";
  49189. }
  49190. /**
  49191. * @param {string} header
  49192. * @param {string} body
  49193. */
  49194. ;
  49195. _proto.table = function table(header, body) {
  49196. if (body) body = "<tbody>" + body + "</tbody>";
  49197. return '<table>\n' + '<thead>\n' + header + '</thead>\n' + body + '</table>\n';
  49198. }
  49199. /**
  49200. * @param {string} content
  49201. */
  49202. ;
  49203. _proto.tablerow = function tablerow(content) {
  49204. return "<tr>\n" + content + "</tr>\n";
  49205. };
  49206. _proto.tablecell = function tablecell(content, flags) {
  49207. var type = flags.header ? 'th' : 'td';
  49208. var tag = flags.align ? "<" + type + " align=\"" + flags.align + "\">" : "<" + type + ">";
  49209. return tag + content + ("</" + type + ">\n");
  49210. }
  49211. /**
  49212. * span level renderer
  49213. * @param {string} text
  49214. */
  49215. ;
  49216. _proto.strong = function strong(text) {
  49217. return "<strong>" + text + "</strong>";
  49218. }
  49219. /**
  49220. * @param {string} text
  49221. */
  49222. ;
  49223. _proto.em = function em(text) {
  49224. return "<em>" + text + "</em>";
  49225. }
  49226. /**
  49227. * @param {string} text
  49228. */
  49229. ;
  49230. _proto.codespan = function codespan(text) {
  49231. return "<code>" + text + "</code>";
  49232. };
  49233. _proto.br = function br() {
  49234. return this.options.xhtml ? '<br/>' : '<br>';
  49235. }
  49236. /**
  49237. * @param {string} text
  49238. */
  49239. ;
  49240. _proto.del = function del(text) {
  49241. return "<del>" + text + "</del>";
  49242. }
  49243. /**
  49244. * @param {string} href
  49245. * @param {string} title
  49246. * @param {string} text
  49247. */
  49248. ;
  49249. _proto.link = function link(href, title, text) {
  49250. href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
  49251. if (href === null) {
  49252. return text;
  49253. }
  49254. var out = '<a href="' + escape(href) + '"';
  49255. if (title) {
  49256. out += ' title="' + title + '"';
  49257. }
  49258. out += '>' + text + '</a>';
  49259. return out;
  49260. }
  49261. /**
  49262. * @param {string} href
  49263. * @param {string} title
  49264. * @param {string} text
  49265. */
  49266. ;
  49267. _proto.image = function image(href, title, text) {
  49268. href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
  49269. if (href === null) {
  49270. return text;
  49271. }
  49272. var out = "<img src=\"" + href + "\" alt=\"" + text + "\"";
  49273. if (title) {
  49274. out += " title=\"" + title + "\"";
  49275. }
  49276. out += this.options.xhtml ? '/>' : '>';
  49277. return out;
  49278. };
  49279. _proto.text = function text(_text) {
  49280. return _text;
  49281. };
  49282. return Renderer;
  49283. }();
  49284. /**
  49285. * TextRenderer
  49286. * returns only the textual part of the token
  49287. */
  49288. var TextRenderer = /*#__PURE__*/function () {
  49289. function TextRenderer() {}
  49290. var _proto = TextRenderer.prototype;
  49291. // no need for block level renderers
  49292. _proto.strong = function strong(text) {
  49293. return text;
  49294. };
  49295. _proto.em = function em(text) {
  49296. return text;
  49297. };
  49298. _proto.codespan = function codespan(text) {
  49299. return text;
  49300. };
  49301. _proto.del = function del(text) {
  49302. return text;
  49303. };
  49304. _proto.html = function html(text) {
  49305. return text;
  49306. };
  49307. _proto.text = function text(_text) {
  49308. return _text;
  49309. };
  49310. _proto.link = function link(href, title, text) {
  49311. return '' + text;
  49312. };
  49313. _proto.image = function image(href, title, text) {
  49314. return '' + text;
  49315. };
  49316. _proto.br = function br() {
  49317. return '';
  49318. };
  49319. return TextRenderer;
  49320. }();
  49321. /**
  49322. * Slugger generates header id
  49323. */
  49324. var Slugger = /*#__PURE__*/function () {
  49325. function Slugger() {
  49326. this.seen = {};
  49327. }
  49328. /**
  49329. * @param {string} value
  49330. */
  49331. var _proto = Slugger.prototype;
  49332. _proto.serialize = function serialize(value) {
  49333. return value.toLowerCase().trim() // remove html tags
  49334. .replace(/<[!\/a-z].*?>/ig, '') // remove unwanted chars
  49335. .replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '').replace(/\s/g, '-');
  49336. }
  49337. /**
  49338. * Finds the next safe (unique) slug to use
  49339. * @param {string} originalSlug
  49340. * @param {boolean} isDryRun
  49341. */
  49342. ;
  49343. _proto.getNextSafeSlug = function getNextSafeSlug(originalSlug, isDryRun) {
  49344. var slug = originalSlug;
  49345. var occurenceAccumulator = 0;
  49346. if (this.seen.hasOwnProperty(slug)) {
  49347. occurenceAccumulator = this.seen[originalSlug];
  49348. do {
  49349. occurenceAccumulator++;
  49350. slug = originalSlug + '-' + occurenceAccumulator;
  49351. } while (this.seen.hasOwnProperty(slug));
  49352. }
  49353. if (!isDryRun) {
  49354. this.seen[originalSlug] = occurenceAccumulator;
  49355. this.seen[slug] = 0;
  49356. }
  49357. return slug;
  49358. }
  49359. /**
  49360. * Convert string to unique id
  49361. * @param {object} [options]
  49362. * @param {boolean} [options.dryrun] Generates the next unique slug without
  49363. * updating the internal accumulator.
  49364. */
  49365. ;
  49366. _proto.slug = function slug(value, options) {
  49367. if (options === void 0) {
  49368. options = {};
  49369. }
  49370. var slug = this.serialize(value);
  49371. return this.getNextSafeSlug(slug, options.dryrun);
  49372. };
  49373. return Slugger;
  49374. }();
  49375. /**
  49376. * Parsing & Compiling
  49377. */
  49378. var Parser = /*#__PURE__*/function () {
  49379. function Parser(options) {
  49380. this.options = options || exports.defaults;
  49381. this.options.renderer = this.options.renderer || new Renderer();
  49382. this.renderer = this.options.renderer;
  49383. this.renderer.options = this.options;
  49384. this.textRenderer = new TextRenderer();
  49385. this.slugger = new Slugger();
  49386. }
  49387. /**
  49388. * Static Parse Method
  49389. */
  49390. Parser.parse = function parse(tokens, options) {
  49391. var parser = new Parser(options);
  49392. return parser.parse(tokens);
  49393. }
  49394. /**
  49395. * Static Parse Inline Method
  49396. */
  49397. ;
  49398. Parser.parseInline = function parseInline(tokens, options) {
  49399. var parser = new Parser(options);
  49400. return parser.parseInline(tokens);
  49401. }
  49402. /**
  49403. * Parse Loop
  49404. */
  49405. ;
  49406. var _proto = Parser.prototype;
  49407. _proto.parse = function parse(tokens, top) {
  49408. if (top === void 0) {
  49409. top = true;
  49410. }
  49411. var out = '',
  49412. i,
  49413. j,
  49414. k,
  49415. l2,
  49416. l3,
  49417. row,
  49418. cell,
  49419. header,
  49420. body,
  49421. token,
  49422. ordered,
  49423. start,
  49424. loose,
  49425. itemBody,
  49426. item,
  49427. checked,
  49428. task,
  49429. checkbox,
  49430. ret;
  49431. var l = tokens.length;
  49432. for (i = 0; i < l; i++) {
  49433. token = tokens[i]; // Run any renderer extensions
  49434. if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
  49435. ret = this.options.extensions.renderers[token.type].call({
  49436. parser: this
  49437. }, token);
  49438. if (ret !== false || !['space', 'hr', 'heading', 'code', 'table', 'blockquote', 'list', 'html', 'paragraph', 'text'].includes(token.type)) {
  49439. out += ret || '';
  49440. continue;
  49441. }
  49442. }
  49443. switch (token.type) {
  49444. case 'space':
  49445. {
  49446. continue;
  49447. }
  49448. case 'hr':
  49449. {
  49450. out += this.renderer.hr();
  49451. continue;
  49452. }
  49453. case 'heading':
  49454. {
  49455. out += this.renderer.heading(this.parseInline(token.tokens), token.depth, unescape(this.parseInline(token.tokens, this.textRenderer)), this.slugger);
  49456. continue;
  49457. }
  49458. case 'code':
  49459. {
  49460. out += this.renderer.code(token.text, token.lang, token.escaped);
  49461. continue;
  49462. }
  49463. case 'table':
  49464. {
  49465. header = ''; // header
  49466. cell = '';
  49467. l2 = token.header.length;
  49468. for (j = 0; j < l2; j++) {
  49469. cell += this.renderer.tablecell(this.parseInline(token.header[j].tokens), {
  49470. header: true,
  49471. align: token.align[j]
  49472. });
  49473. }
  49474. header += this.renderer.tablerow(cell);
  49475. body = '';
  49476. l2 = token.rows.length;
  49477. for (j = 0; j < l2; j++) {
  49478. row = token.rows[j];
  49479. cell = '';
  49480. l3 = row.length;
  49481. for (k = 0; k < l3; k++) {
  49482. cell += this.renderer.tablecell(this.parseInline(row[k].tokens), {
  49483. header: false,
  49484. align: token.align[k]
  49485. });
  49486. }
  49487. body += this.renderer.tablerow(cell);
  49488. }
  49489. out += this.renderer.table(header, body);
  49490. continue;
  49491. }
  49492. case 'blockquote':
  49493. {
  49494. body = this.parse(token.tokens);
  49495. out += this.renderer.blockquote(body);
  49496. continue;
  49497. }
  49498. case 'list':
  49499. {
  49500. ordered = token.ordered;
  49501. start = token.start;
  49502. loose = token.loose;
  49503. l2 = token.items.length;
  49504. body = '';
  49505. for (j = 0; j < l2; j++) {
  49506. item = token.items[j];
  49507. checked = item.checked;
  49508. task = item.task;
  49509. itemBody = '';
  49510. if (item.task) {
  49511. checkbox = this.renderer.checkbox(checked);
  49512. if (loose) {
  49513. if (item.tokens.length > 0 && item.tokens[0].type === 'paragraph') {
  49514. item.tokens[0].text = checkbox + ' ' + item.tokens[0].text;
  49515. if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') {
  49516. item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text;
  49517. }
  49518. } else {
  49519. item.tokens.unshift({
  49520. type: 'text',
  49521. text: checkbox
  49522. });
  49523. }
  49524. } else {
  49525. itemBody += checkbox;
  49526. }
  49527. }
  49528. itemBody += this.parse(item.tokens, loose);
  49529. body += this.renderer.listitem(itemBody, task, checked);
  49530. }
  49531. out += this.renderer.list(body, ordered, start);
  49532. continue;
  49533. }
  49534. case 'html':
  49535. {
  49536. // TODO parse inline content if parameter markdown=1
  49537. out += this.renderer.html(token.text);
  49538. continue;
  49539. }
  49540. case 'paragraph':
  49541. {
  49542. out += this.renderer.paragraph(this.parseInline(token.tokens));
  49543. continue;
  49544. }
  49545. case 'text':
  49546. {
  49547. body = token.tokens ? this.parseInline(token.tokens) : token.text;
  49548. while (i + 1 < l && tokens[i + 1].type === 'text') {
  49549. token = tokens[++i];
  49550. body += '\n' + (token.tokens ? this.parseInline(token.tokens) : token.text);
  49551. }
  49552. out += top ? this.renderer.paragraph(body) : body;
  49553. continue;
  49554. }
  49555. default:
  49556. {
  49557. var errMsg = 'Token with "' + token.type + '" type was not found.';
  49558. if (this.options.silent) {
  49559. console.error(errMsg);
  49560. return;
  49561. } else {
  49562. throw new Error(errMsg);
  49563. }
  49564. }
  49565. }
  49566. }
  49567. return out;
  49568. }
  49569. /**
  49570. * Parse Inline Tokens
  49571. */
  49572. ;
  49573. _proto.parseInline = function parseInline(tokens, renderer) {
  49574. renderer = renderer || this.renderer;
  49575. var out = '',
  49576. i,
  49577. token,
  49578. ret;
  49579. var l = tokens.length;
  49580. for (i = 0; i < l; i++) {
  49581. token = tokens[i]; // Run any renderer extensions
  49582. if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
  49583. ret = this.options.extensions.renderers[token.type].call({
  49584. parser: this
  49585. }, token);
  49586. if (ret !== false || !['escape', 'html', 'link', 'image', 'strong', 'em', 'codespan', 'br', 'del', 'text'].includes(token.type)) {
  49587. out += ret || '';
  49588. continue;
  49589. }
  49590. }
  49591. switch (token.type) {
  49592. case 'escape':
  49593. {
  49594. out += renderer.text(token.text);
  49595. break;
  49596. }
  49597. case 'html':
  49598. {
  49599. out += renderer.html(token.text);
  49600. break;
  49601. }
  49602. case 'link':
  49603. {
  49604. out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer));
  49605. break;
  49606. }
  49607. case 'image':
  49608. {
  49609. out += renderer.image(token.href, token.title, token.text);
  49610. break;
  49611. }
  49612. case 'strong':
  49613. {
  49614. out += renderer.strong(this.parseInline(token.tokens, renderer));
  49615. break;
  49616. }
  49617. case 'em':
  49618. {
  49619. out += renderer.em(this.parseInline(token.tokens, renderer));
  49620. break;
  49621. }
  49622. case 'codespan':
  49623. {
  49624. out += renderer.codespan(token.text);
  49625. break;
  49626. }
  49627. case 'br':
  49628. {
  49629. out += renderer.br();
  49630. break;
  49631. }
  49632. case 'del':
  49633. {
  49634. out += renderer.del(this.parseInline(token.tokens, renderer));
  49635. break;
  49636. }
  49637. case 'text':
  49638. {
  49639. out += renderer.text(token.text);
  49640. break;
  49641. }
  49642. default:
  49643. {
  49644. var errMsg = 'Token with "' + token.type + '" type was not found.';
  49645. if (this.options.silent) {
  49646. console.error(errMsg);
  49647. return;
  49648. } else {
  49649. throw new Error(errMsg);
  49650. }
  49651. }
  49652. }
  49653. }
  49654. return out;
  49655. };
  49656. return Parser;
  49657. }();
  49658. /**
  49659. * Marked
  49660. */
  49661. function marked(src, opt, callback) {
  49662. // throw error in case of non string input
  49663. if (typeof src === 'undefined' || src === null) {
  49664. throw new Error('marked(): input parameter is undefined or null');
  49665. }
  49666. if (typeof src !== 'string') {
  49667. throw new Error('marked(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected');
  49668. }
  49669. if (typeof opt === 'function') {
  49670. callback = opt;
  49671. opt = null;
  49672. }
  49673. opt = merge({}, marked.defaults, opt || {});
  49674. checkSanitizeDeprecation(opt);
  49675. if (callback) {
  49676. var highlight = opt.highlight;
  49677. var tokens;
  49678. try {
  49679. tokens = Lexer.lex(src, opt);
  49680. } catch (e) {
  49681. return callback(e);
  49682. }
  49683. var done = function done(err) {
  49684. var out;
  49685. if (!err) {
  49686. try {
  49687. if (opt.walkTokens) {
  49688. marked.walkTokens(tokens, opt.walkTokens);
  49689. }
  49690. out = Parser.parse(tokens, opt);
  49691. } catch (e) {
  49692. err = e;
  49693. }
  49694. }
  49695. opt.highlight = highlight;
  49696. return err ? callback(err) : callback(null, out);
  49697. };
  49698. if (!highlight || highlight.length < 3) {
  49699. return done();
  49700. }
  49701. delete opt.highlight;
  49702. if (!tokens.length) return done();
  49703. var pending = 0;
  49704. marked.walkTokens(tokens, function (token) {
  49705. if (token.type === 'code') {
  49706. pending++;
  49707. setTimeout(function () {
  49708. highlight(token.text, token.lang, function (err, code) {
  49709. if (err) {
  49710. return done(err);
  49711. }
  49712. if (code != null && code !== token.text) {
  49713. token.text = code;
  49714. token.escaped = true;
  49715. }
  49716. pending--;
  49717. if (pending === 0) {
  49718. done();
  49719. }
  49720. });
  49721. }, 0);
  49722. }
  49723. });
  49724. if (pending === 0) {
  49725. done();
  49726. }
  49727. return;
  49728. }
  49729. try {
  49730. var _tokens = Lexer.lex(src, opt);
  49731. if (opt.walkTokens) {
  49732. marked.walkTokens(_tokens, opt.walkTokens);
  49733. }
  49734. return Parser.parse(_tokens, opt);
  49735. } catch (e) {
  49736. e.message += '\nPlease report this to https://github.com/markedjs/marked.';
  49737. if (opt.silent) {
  49738. return '<p>An error occurred:</p><pre>' + escape(e.message + '', true) + '</pre>';
  49739. }
  49740. throw e;
  49741. }
  49742. }
  49743. /**
  49744. * Options
  49745. */
  49746. marked.options = marked.setOptions = function (opt) {
  49747. merge(marked.defaults, opt);
  49748. changeDefaults(marked.defaults);
  49749. return marked;
  49750. };
  49751. marked.getDefaults = getDefaults;
  49752. marked.defaults = exports.defaults;
  49753. /**
  49754. * Use Extension
  49755. */
  49756. marked.use = function () {
  49757. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  49758. args[_key] = arguments[_key];
  49759. }
  49760. var opts = merge.apply(void 0, [{}].concat(args));
  49761. var extensions = marked.defaults.extensions || {
  49762. renderers: {},
  49763. childTokens: {}
  49764. };
  49765. var hasExtensions;
  49766. args.forEach(function (pack) {
  49767. // ==-- Parse "addon" extensions --== //
  49768. if (pack.extensions) {
  49769. hasExtensions = true;
  49770. pack.extensions.forEach(function (ext) {
  49771. if (!ext.name) {
  49772. throw new Error('extension name required');
  49773. }
  49774. if (ext.renderer) {
  49775. // Renderer extensions
  49776. var prevRenderer = extensions.renderers ? extensions.renderers[ext.name] : null;
  49777. if (prevRenderer) {
  49778. // Replace extension with func to run new extension but fall back if false
  49779. extensions.renderers[ext.name] = function () {
  49780. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  49781. args[_key2] = arguments[_key2];
  49782. }
  49783. var ret = ext.renderer.apply(this, args);
  49784. if (ret === false) {
  49785. ret = prevRenderer.apply(this, args);
  49786. }
  49787. return ret;
  49788. };
  49789. } else {
  49790. extensions.renderers[ext.name] = ext.renderer;
  49791. }
  49792. }
  49793. if (ext.tokenizer) {
  49794. // Tokenizer Extensions
  49795. if (!ext.level || ext.level !== 'block' && ext.level !== 'inline') {
  49796. throw new Error("extension level must be 'block' or 'inline'");
  49797. }
  49798. if (extensions[ext.level]) {
  49799. extensions[ext.level].unshift(ext.tokenizer);
  49800. } else {
  49801. extensions[ext.level] = [ext.tokenizer];
  49802. }
  49803. if (ext.start) {
  49804. // Function to check for start of token
  49805. if (ext.level === 'block') {
  49806. if (extensions.startBlock) {
  49807. extensions.startBlock.push(ext.start);
  49808. } else {
  49809. extensions.startBlock = [ext.start];
  49810. }
  49811. } else if (ext.level === 'inline') {
  49812. if (extensions.startInline) {
  49813. extensions.startInline.push(ext.start);
  49814. } else {
  49815. extensions.startInline = [ext.start];
  49816. }
  49817. }
  49818. }
  49819. }
  49820. if (ext.childTokens) {
  49821. // Child tokens to be visited by walkTokens
  49822. extensions.childTokens[ext.name] = ext.childTokens;
  49823. }
  49824. });
  49825. } // ==-- Parse "overwrite" extensions --== //
  49826. if (pack.renderer) {
  49827. (function () {
  49828. var renderer = marked.defaults.renderer || new Renderer();
  49829. var _loop = function _loop(prop) {
  49830. var prevRenderer = renderer[prop]; // Replace renderer with func to run extension, but fall back if false
  49831. renderer[prop] = function () {
  49832. for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  49833. args[_key3] = arguments[_key3];
  49834. }
  49835. var ret = pack.renderer[prop].apply(renderer, args);
  49836. if (ret === false) {
  49837. ret = prevRenderer.apply(renderer, args);
  49838. }
  49839. return ret;
  49840. };
  49841. };
  49842. for (var prop in pack.renderer) {
  49843. _loop(prop);
  49844. }
  49845. opts.renderer = renderer;
  49846. })();
  49847. }
  49848. if (pack.tokenizer) {
  49849. (function () {
  49850. var tokenizer = marked.defaults.tokenizer || new Tokenizer();
  49851. var _loop2 = function _loop2(prop) {
  49852. var prevTokenizer = tokenizer[prop]; // Replace tokenizer with func to run extension, but fall back if false
  49853. tokenizer[prop] = function () {
  49854. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  49855. args[_key4] = arguments[_key4];
  49856. }
  49857. var ret = pack.tokenizer[prop].apply(tokenizer, args);
  49858. if (ret === false) {
  49859. ret = prevTokenizer.apply(tokenizer, args);
  49860. }
  49861. return ret;
  49862. };
  49863. };
  49864. for (var prop in pack.tokenizer) {
  49865. _loop2(prop);
  49866. }
  49867. opts.tokenizer = tokenizer;
  49868. })();
  49869. } // ==-- Parse WalkTokens extensions --== //
  49870. if (pack.walkTokens) {
  49871. var _walkTokens = marked.defaults.walkTokens;
  49872. opts.walkTokens = function (token) {
  49873. pack.walkTokens.call(this, token);
  49874. if (_walkTokens) {
  49875. _walkTokens.call(this, token);
  49876. }
  49877. };
  49878. }
  49879. if (hasExtensions) {
  49880. opts.extensions = extensions;
  49881. }
  49882. marked.setOptions(opts);
  49883. });
  49884. };
  49885. /**
  49886. * Run callback for every token
  49887. */
  49888. marked.walkTokens = function (tokens, callback) {
  49889. var _loop3 = function _loop3() {
  49890. var token = _step.value;
  49891. callback.call(marked, token);
  49892. switch (token.type) {
  49893. case 'table':
  49894. {
  49895. for (var _iterator2 = _createForOfIteratorHelperLoose(token.header), _step2; !(_step2 = _iterator2()).done;) {
  49896. var cell = _step2.value;
  49897. marked.walkTokens(cell.tokens, callback);
  49898. }
  49899. for (var _iterator3 = _createForOfIteratorHelperLoose(token.rows), _step3; !(_step3 = _iterator3()).done;) {
  49900. var row = _step3.value;
  49901. for (var _iterator4 = _createForOfIteratorHelperLoose(row), _step4; !(_step4 = _iterator4()).done;) {
  49902. var _cell = _step4.value;
  49903. marked.walkTokens(_cell.tokens, callback);
  49904. }
  49905. }
  49906. break;
  49907. }
  49908. case 'list':
  49909. {
  49910. marked.walkTokens(token.items, callback);
  49911. break;
  49912. }
  49913. default:
  49914. {
  49915. if (marked.defaults.extensions && marked.defaults.extensions.childTokens && marked.defaults.extensions.childTokens[token.type]) {
  49916. // Walk any extensions
  49917. marked.defaults.extensions.childTokens[token.type].forEach(function (childTokens) {
  49918. marked.walkTokens(token[childTokens], callback);
  49919. });
  49920. } else if (token.tokens) {
  49921. marked.walkTokens(token.tokens, callback);
  49922. }
  49923. }
  49924. }
  49925. };
  49926. for (var _iterator = _createForOfIteratorHelperLoose(tokens), _step; !(_step = _iterator()).done;) {
  49927. _loop3();
  49928. }
  49929. };
  49930. /**
  49931. * Parse Inline
  49932. * @param {string} src
  49933. */
  49934. marked.parseInline = function (src, opt) {
  49935. // throw error in case of non string input
  49936. if (typeof src === 'undefined' || src === null) {
  49937. throw new Error('marked.parseInline(): input parameter is undefined or null');
  49938. }
  49939. if (typeof src !== 'string') {
  49940. throw new Error('marked.parseInline(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected');
  49941. }
  49942. opt = merge({}, marked.defaults, opt || {});
  49943. checkSanitizeDeprecation(opt);
  49944. try {
  49945. var tokens = Lexer.lexInline(src, opt);
  49946. if (opt.walkTokens) {
  49947. marked.walkTokens(tokens, opt.walkTokens);
  49948. }
  49949. return Parser.parseInline(tokens, opt);
  49950. } catch (e) {
  49951. e.message += '\nPlease report this to https://github.com/markedjs/marked.';
  49952. if (opt.silent) {
  49953. return '<p>An error occurred:</p><pre>' + escape(e.message + '', true) + '</pre>';
  49954. }
  49955. throw e;
  49956. }
  49957. };
  49958. /**
  49959. * Expose
  49960. */
  49961. marked.Parser = Parser;
  49962. marked.parser = Parser.parse;
  49963. marked.Renderer = Renderer;
  49964. marked.TextRenderer = TextRenderer;
  49965. marked.Lexer = Lexer;
  49966. marked.lexer = Lexer.lex;
  49967. marked.Tokenizer = Tokenizer;
  49968. marked.Slugger = Slugger;
  49969. marked.parse = marked;
  49970. var options = marked.options;
  49971. var setOptions = marked.setOptions;
  49972. var use = marked.use;
  49973. var walkTokens = marked.walkTokens;
  49974. var parseInline = marked.parseInline;
  49975. var parse = marked;
  49976. var parser = Parser.parse;
  49977. var lexer = Lexer.lex;
  49978. exports.Lexer = Lexer;
  49979. exports.Parser = Parser;
  49980. exports.Renderer = Renderer;
  49981. exports.Slugger = Slugger;
  49982. exports.TextRenderer = TextRenderer;
  49983. exports.Tokenizer = Tokenizer;
  49984. exports.getDefaults = getDefaults;
  49985. exports.lexer = lexer;
  49986. exports.marked = marked;
  49987. exports.options = options;
  49988. exports.parse = parse;
  49989. exports.parseInline = parseInline;
  49990. exports.parser = parser;
  49991. exports.setOptions = setOptions;
  49992. exports.use = use;
  49993. exports.walkTokens = walkTokens;
  49994. Object.defineProperty(exports, '__esModule', { value: true });
  49995. }));
  49996. // Copyright (c) Jupyter Development Team.
  49997. // Distributed under the terms of the Modified BSD License.
  49998. define('base/js/markdown',[
  49999. 'jquery',
  50000. 'base/js/utils',
  50001. 'base/js/mathjaxutils',
  50002. 'base/js/security',
  50003. 'components/marked/lib/marked',
  50004. 'codemirror/lib/codemirror',
  50005. ], function($, utils, mathjaxutils, security, marked, CodeMirror){
  50006. "use strict";
  50007. marked.setOptions({
  50008. gfm : true,
  50009. tables: true,
  50010. langPrefix: "cm-s-ipython language-",
  50011. highlight: function(code, lang, callback) {
  50012. if (!lang) {
  50013. // no language, no highlight
  50014. if (callback) {
  50015. callback(null, code);
  50016. return;
  50017. } else {
  50018. return code;
  50019. }
  50020. }
  50021. utils.requireCodeMirrorMode(lang, function (spec) {
  50022. var el = document.createElement("div");
  50023. var mode = CodeMirror.getMode({}, spec);
  50024. if (!mode) {
  50025. console.log("No CodeMirror mode: " + lang);
  50026. callback(null, code);
  50027. return;
  50028. }
  50029. try {
  50030. CodeMirror.runMode(code, spec, el);
  50031. callback(null, el.innerHTML);
  50032. } catch (err) {
  50033. console.log("Failed to highlight " + lang + " code", err);
  50034. callback(err, code);
  50035. }
  50036. }, function (err) {
  50037. console.log("No CodeMirror mode: " + lang);
  50038. console.log("Require CodeMirror mode error: " + err);
  50039. callback(null, code);
  50040. });
  50041. }
  50042. });
  50043. var mathjax_init_done = false;
  50044. function ensure_mathjax_init() {
  50045. if(!mathjax_init_done) {
  50046. mathjax_init_done = true;
  50047. mathjaxutils.init();
  50048. }
  50049. }
  50050. function render(markdown, options, callback) {
  50051. /**
  50052. * Find a readme in the current directory. Look for files with
  50053. * a name like 'readme.md' (case insensitive) or similar and
  50054. * mimetype 'text/markdown'.
  50055. *
  50056. * @param markdown: the markdown text to parse
  50057. * @param options
  50058. * Object with parameters:
  50059. * with_math: the markdown can contain mathematics
  50060. * clean_tables: prevent default inline styles for table cells
  50061. * sanitize: remove dangerous html (like <script>)
  50062. * @param callback
  50063. * A function with two arguments (err, html)
  50064. * err: null or the error if there was one
  50065. * html: the rendered html string, or if {sanitize: true} was used
  50066. * a sanitized jQuery object
  50067. */
  50068. options = $.extend({
  50069. // Apply mathjax transformation
  50070. with_math: false,
  50071. // Prevent marked from returning inline styles for table cells
  50072. clean_tables: false,
  50073. // Apply sanitation, this will return a jQuery object.
  50074. sanitize: false,
  50075. }, options);
  50076. var renderer = new marked.Renderer();
  50077. if(options.clean_tables) {
  50078. renderer.tablecell = function (content, flags) {
  50079. var type = flags.header ? 'th' : 'td';
  50080. var style = flags.align == null ? '': ' style="text-align: ' + flags.align + '"';
  50081. var start_tag = '<' + type + style + '>';
  50082. var end_tag = '</' + type + '>\n';
  50083. return start_tag + content + end_tag;
  50084. };
  50085. }
  50086. var text = markdown;
  50087. var math = null;
  50088. if(options.with_math) {
  50089. ensure_mathjax_init();
  50090. var text_and_math = mathjaxutils.remove_math(markdown);
  50091. text = text_and_math[0];
  50092. math = text_and_math[1];
  50093. }
  50094. marked.marked(text, { renderer: renderer }, function (err, html) {
  50095. if(!err) {
  50096. if(options.with_math) {
  50097. html = mathjaxutils.replace_math(html, math);
  50098. }
  50099. if(options.sanitize) {
  50100. html = $(security.sanitize_html_and_parse(html, true));
  50101. }
  50102. }
  50103. callback(err, html);
  50104. });
  50105. }
  50106. return {'render': render};
  50107. });
  50108. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  50109. // Distributed under an MIT license: https://codemirror.net/LICENSE
  50110. (function(mod) {
  50111. if (typeof exports == "object" && typeof module == "object") // CommonJS
  50112. mod(require("../../lib/codemirror"));
  50113. else if (typeof define == "function" && define.amd) // AMD
  50114. define('codemirror/addon/edit/matchbrackets',["../../lib/codemirror"], mod);
  50115. else // Plain browser env
  50116. mod(CodeMirror);
  50117. })(function(CodeMirror) {
  50118. var ie_lt8 = /MSIE \d/.test(navigator.userAgent) &&
  50119. (document.documentMode == null || document.documentMode < 8);
  50120. var Pos = CodeMirror.Pos;
  50121. var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<", "<": ">>", ">": "<<"};
  50122. function bracketRegex(config) {
  50123. return config && config.bracketRegex || /[(){}[\]]/
  50124. }
  50125. function findMatchingBracket(cm, where, config) {
  50126. var line = cm.getLineHandle(where.line), pos = where.ch - 1;
  50127. var afterCursor = config && config.afterCursor
  50128. if (afterCursor == null)
  50129. afterCursor = /(^| )cm-fat-cursor($| )/.test(cm.getWrapperElement().className)
  50130. var re = bracketRegex(config)
  50131. // A cursor is defined as between two characters, but in in vim command mode
  50132. // (i.e. not insert mode), the cursor is visually represented as a
  50133. // highlighted box on top of the 2nd character. Otherwise, we allow matches
  50134. // from before or after the cursor.
  50135. var match = (!afterCursor && pos >= 0 && re.test(line.text.charAt(pos)) && matching[line.text.charAt(pos)]) ||
  50136. re.test(line.text.charAt(pos + 1)) && matching[line.text.charAt(++pos)];
  50137. if (!match) return null;
  50138. var dir = match.charAt(1) == ">" ? 1 : -1;
  50139. if (config && config.strict && (dir > 0) != (pos == where.ch)) return null;
  50140. var style = cm.getTokenTypeAt(Pos(where.line, pos + 1));
  50141. var found = scanForBracket(cm, Pos(where.line, pos + (dir > 0 ? 1 : 0)), dir, style || null, config);
  50142. if (found == null) return null;
  50143. return {from: Pos(where.line, pos), to: found && found.pos,
  50144. match: found && found.ch == match.charAt(0), forward: dir > 0};
  50145. }
  50146. // bracketRegex is used to specify which type of bracket to scan
  50147. // should be a regexp, e.g. /[[\]]/
  50148. //
  50149. // Note: If "where" is on an open bracket, then this bracket is ignored.
  50150. //
  50151. // Returns false when no bracket was found, null when it reached
  50152. // maxScanLines and gave up
  50153. function scanForBracket(cm, where, dir, style, config) {
  50154. var maxScanLen = (config && config.maxScanLineLength) || 10000;
  50155. var maxScanLines = (config && config.maxScanLines) || 1000;
  50156. var stack = [];
  50157. var re = bracketRegex(config)
  50158. var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1)
  50159. : Math.max(cm.firstLine() - 1, where.line - maxScanLines);
  50160. for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) {
  50161. var line = cm.getLine(lineNo);
  50162. if (!line) continue;
  50163. var pos = dir > 0 ? 0 : line.length - 1, end = dir > 0 ? line.length : -1;
  50164. if (line.length > maxScanLen) continue;
  50165. if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0);
  50166. for (; pos != end; pos += dir) {
  50167. var ch = line.charAt(pos);
  50168. if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) {
  50169. var match = matching[ch];
  50170. if (match && (match.charAt(1) == ">") == (dir > 0)) stack.push(ch);
  50171. else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch};
  50172. else stack.pop();
  50173. }
  50174. }
  50175. }
  50176. return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null;
  50177. }
  50178. function matchBrackets(cm, autoclear, config) {
  50179. // Disable brace matching in long lines, since it'll cause hugely slow updates
  50180. var maxHighlightLen = cm.state.matchBrackets.maxHighlightLineLength || 1000;
  50181. var marks = [], ranges = cm.listSelections();
  50182. for (var i = 0; i < ranges.length; i++) {
  50183. var match = ranges[i].empty() && findMatchingBracket(cm, ranges[i].head, config);
  50184. if (match && cm.getLine(match.from.line).length <= maxHighlightLen) {
  50185. var style = match.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
  50186. marks.push(cm.markText(match.from, Pos(match.from.line, match.from.ch + 1), {className: style}));
  50187. if (match.to && cm.getLine(match.to.line).length <= maxHighlightLen)
  50188. marks.push(cm.markText(match.to, Pos(match.to.line, match.to.ch + 1), {className: style}));
  50189. }
  50190. }
  50191. if (marks.length) {
  50192. // Kludge to work around the IE bug from issue #1193, where text
  50193. // input stops going to the textare whever this fires.
  50194. if (ie_lt8 && cm.state.focused) cm.focus();
  50195. var clear = function() {
  50196. cm.operation(function() {
  50197. for (var i = 0; i < marks.length; i++) marks[i].clear();
  50198. });
  50199. };
  50200. if (autoclear) setTimeout(clear, 800);
  50201. else return clear;
  50202. }
  50203. }
  50204. function doMatchBrackets(cm) {
  50205. cm.operation(function() {
  50206. if (cm.state.matchBrackets.currentlyHighlighted) {
  50207. cm.state.matchBrackets.currentlyHighlighted();
  50208. cm.state.matchBrackets.currentlyHighlighted = null;
  50209. }
  50210. cm.state.matchBrackets.currentlyHighlighted = matchBrackets(cm, false, cm.state.matchBrackets);
  50211. });
  50212. }
  50213. CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) {
  50214. function clear(cm) {
  50215. if (cm.state.matchBrackets && cm.state.matchBrackets.currentlyHighlighted) {
  50216. cm.state.matchBrackets.currentlyHighlighted();
  50217. cm.state.matchBrackets.currentlyHighlighted = null;
  50218. }
  50219. }
  50220. if (old && old != CodeMirror.Init) {
  50221. cm.off("cursorActivity", doMatchBrackets);
  50222. cm.off("focus", doMatchBrackets)
  50223. cm.off("blur", clear)
  50224. clear(cm);
  50225. }
  50226. if (val) {
  50227. cm.state.matchBrackets = typeof val == "object" ? val : {};
  50228. cm.on("cursorActivity", doMatchBrackets);
  50229. cm.on("focus", doMatchBrackets)
  50230. cm.on("blur", clear)
  50231. }
  50232. });
  50233. CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, true);});
  50234. CodeMirror.defineExtension("findMatchingBracket", function(pos, config, oldConfig){
  50235. // Backwards-compatibility kludge
  50236. if (oldConfig || typeof config == "boolean") {
  50237. if (!oldConfig) {
  50238. config = config ? {strict: true} : null
  50239. } else {
  50240. oldConfig.strict = config
  50241. config = oldConfig
  50242. }
  50243. }
  50244. return findMatchingBracket(this, pos, config)
  50245. });
  50246. CodeMirror.defineExtension("scanForBracket", function(pos, dir, style, config){
  50247. return scanForBracket(this, pos, dir, style, config);
  50248. });
  50249. });
  50250. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  50251. // Distributed under an MIT license: https://codemirror.net/LICENSE
  50252. (function(mod) {
  50253. if (typeof exports == "object" && typeof module == "object") // CommonJS
  50254. mod(require("../../lib/codemirror"));
  50255. else if (typeof define == "function" && define.amd) // AMD
  50256. define('codemirror/addon/edit/closebrackets',["../../lib/codemirror"], mod);
  50257. else // Plain browser env
  50258. mod(CodeMirror);
  50259. })(function(CodeMirror) {
  50260. var defaults = {
  50261. pairs: "()[]{}''\"\"",
  50262. closeBefore: ")]}'\":;>",
  50263. triples: "",
  50264. explode: "[]{}"
  50265. };
  50266. var Pos = CodeMirror.Pos;
  50267. CodeMirror.defineOption("autoCloseBrackets", false, function(cm, val, old) {
  50268. if (old && old != CodeMirror.Init) {
  50269. cm.removeKeyMap(keyMap);
  50270. cm.state.closeBrackets = null;
  50271. }
  50272. if (val) {
  50273. ensureBound(getOption(val, "pairs"))
  50274. cm.state.closeBrackets = val;
  50275. cm.addKeyMap(keyMap);
  50276. }
  50277. });
  50278. function getOption(conf, name) {
  50279. if (name == "pairs" && typeof conf == "string") return conf;
  50280. if (typeof conf == "object" && conf[name] != null) return conf[name];
  50281. return defaults[name];
  50282. }
  50283. var keyMap = {Backspace: handleBackspace, Enter: handleEnter};
  50284. function ensureBound(chars) {
  50285. for (var i = 0; i < chars.length; i++) {
  50286. var ch = chars.charAt(i), key = "'" + ch + "'"
  50287. if (!keyMap[key]) keyMap[key] = handler(ch)
  50288. }
  50289. }
  50290. ensureBound(defaults.pairs + "`")
  50291. function handler(ch) {
  50292. return function(cm) { return handleChar(cm, ch); };
  50293. }
  50294. function getConfig(cm) {
  50295. var deflt = cm.state.closeBrackets;
  50296. if (!deflt || deflt.override) return deflt;
  50297. var mode = cm.getModeAt(cm.getCursor());
  50298. return mode.closeBrackets || deflt;
  50299. }
  50300. function handleBackspace(cm) {
  50301. var conf = getConfig(cm);
  50302. if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass;
  50303. var pairs = getOption(conf, "pairs");
  50304. var ranges = cm.listSelections();
  50305. for (var i = 0; i < ranges.length; i++) {
  50306. if (!ranges[i].empty()) return CodeMirror.Pass;
  50307. var around = charsAround(cm, ranges[i].head);
  50308. if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass;
  50309. }
  50310. for (var i = ranges.length - 1; i >= 0; i--) {
  50311. var cur = ranges[i].head;
  50312. cm.replaceRange("", Pos(cur.line, cur.ch - 1), Pos(cur.line, cur.ch + 1), "+delete");
  50313. }
  50314. }
  50315. function handleEnter(cm) {
  50316. var conf = getConfig(cm);
  50317. var explode = conf && getOption(conf, "explode");
  50318. if (!explode || cm.getOption("disableInput")) return CodeMirror.Pass;
  50319. var ranges = cm.listSelections();
  50320. for (var i = 0; i < ranges.length; i++) {
  50321. if (!ranges[i].empty()) return CodeMirror.Pass;
  50322. var around = charsAround(cm, ranges[i].head);
  50323. if (!around || explode.indexOf(around) % 2 != 0) return CodeMirror.Pass;
  50324. }
  50325. cm.operation(function() {
  50326. var linesep = cm.lineSeparator() || "\n";
  50327. cm.replaceSelection(linesep + linesep, null);
  50328. cm.execCommand("goCharLeft");
  50329. ranges = cm.listSelections();
  50330. for (var i = 0; i < ranges.length; i++) {
  50331. var line = ranges[i].head.line;
  50332. cm.indentLine(line, null, true);
  50333. cm.indentLine(line + 1, null, true);
  50334. }
  50335. });
  50336. }
  50337. function contractSelection(sel) {
  50338. var inverted = CodeMirror.cmpPos(sel.anchor, sel.head) > 0;
  50339. return {anchor: new Pos(sel.anchor.line, sel.anchor.ch + (inverted ? -1 : 1)),
  50340. head: new Pos(sel.head.line, sel.head.ch + (inverted ? 1 : -1))};
  50341. }
  50342. function handleChar(cm, ch) {
  50343. var conf = getConfig(cm);
  50344. if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass;
  50345. var pairs = getOption(conf, "pairs");
  50346. var pos = pairs.indexOf(ch);
  50347. if (pos == -1) return CodeMirror.Pass;
  50348. var closeBefore = getOption(conf,"closeBefore");
  50349. var triples = getOption(conf, "triples");
  50350. var identical = pairs.charAt(pos + 1) == ch;
  50351. var ranges = cm.listSelections();
  50352. var opening = pos % 2 == 0;
  50353. var type;
  50354. for (var i = 0; i < ranges.length; i++) {
  50355. var range = ranges[i], cur = range.head, curType;
  50356. var next = cm.getRange(cur, Pos(cur.line, cur.ch + 1));
  50357. if (opening && !range.empty()) {
  50358. curType = "surround";
  50359. } else if ((identical || !opening) && next == ch) {
  50360. if (identical && stringStartsAfter(cm, cur))
  50361. curType = "both";
  50362. else if (triples.indexOf(ch) >= 0 && cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == ch + ch + ch)
  50363. curType = "skipThree";
  50364. else
  50365. curType = "skip";
  50366. } else if (identical && cur.ch > 1 && triples.indexOf(ch) >= 0 &&
  50367. cm.getRange(Pos(cur.line, cur.ch - 2), cur) == ch + ch) {
  50368. if (cur.ch > 2 && /\bstring/.test(cm.getTokenTypeAt(Pos(cur.line, cur.ch - 2)))) return CodeMirror.Pass;
  50369. curType = "addFour";
  50370. } else if (identical) {
  50371. var prev = cur.ch == 0 ? " " : cm.getRange(Pos(cur.line, cur.ch - 1), cur)
  50372. if (!CodeMirror.isWordChar(next) && prev != ch && !CodeMirror.isWordChar(prev)) curType = "both";
  50373. else return CodeMirror.Pass;
  50374. } else if (opening && (next.length === 0 || /\s/.test(next) || closeBefore.indexOf(next) > -1)) {
  50375. curType = "both";
  50376. } else {
  50377. return CodeMirror.Pass;
  50378. }
  50379. if (!type) type = curType;
  50380. else if (type != curType) return CodeMirror.Pass;
  50381. }
  50382. var left = pos % 2 ? pairs.charAt(pos - 1) : ch;
  50383. var right = pos % 2 ? ch : pairs.charAt(pos + 1);
  50384. cm.operation(function() {
  50385. if (type == "skip") {
  50386. cm.execCommand("goCharRight");
  50387. } else if (type == "skipThree") {
  50388. for (var i = 0; i < 3; i++)
  50389. cm.execCommand("goCharRight");
  50390. } else if (type == "surround") {
  50391. var sels = cm.getSelections();
  50392. for (var i = 0; i < sels.length; i++)
  50393. sels[i] = left + sels[i] + right;
  50394. cm.replaceSelections(sels, "around");
  50395. sels = cm.listSelections().slice();
  50396. for (var i = 0; i < sels.length; i++)
  50397. sels[i] = contractSelection(sels[i]);
  50398. cm.setSelections(sels);
  50399. } else if (type == "both") {
  50400. cm.replaceSelection(left + right, null);
  50401. cm.triggerElectric(left + right);
  50402. cm.execCommand("goCharLeft");
  50403. } else if (type == "addFour") {
  50404. cm.replaceSelection(left + left + left + left, "before");
  50405. cm.execCommand("goCharRight");
  50406. }
  50407. });
  50408. }
  50409. function charsAround(cm, pos) {
  50410. var str = cm.getRange(Pos(pos.line, pos.ch - 1),
  50411. Pos(pos.line, pos.ch + 1));
  50412. return str.length == 2 ? str : null;
  50413. }
  50414. function stringStartsAfter(cm, pos) {
  50415. var token = cm.getTokenAt(Pos(pos.line, pos.ch + 1))
  50416. return /\bstring/.test(token.type) && token.start == pos.ch &&
  50417. (pos.ch == 0 || !/\bstring/.test(cm.getTokenTypeAt(pos)))
  50418. }
  50419. });
  50420. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  50421. // Distributed under an MIT license: https://codemirror.net/LICENSE
  50422. (function(mod) {
  50423. if (typeof exports == "object" && typeof module == "object") // CommonJS
  50424. mod(require("../../lib/codemirror"));
  50425. else if (typeof define == "function" && define.amd) // AMD
  50426. define('codemirror/addon/comment/comment',["../../lib/codemirror"], mod);
  50427. else // Plain browser env
  50428. mod(CodeMirror);
  50429. })(function(CodeMirror) {
  50430. "use strict";
  50431. var noOptions = {};
  50432. var nonWS = /[^\s\u00a0]/;
  50433. var Pos = CodeMirror.Pos, cmp = CodeMirror.cmpPos;
  50434. function firstNonWS(str) {
  50435. var found = str.search(nonWS);
  50436. return found == -1 ? 0 : found;
  50437. }
  50438. CodeMirror.commands.toggleComment = function(cm) {
  50439. cm.toggleComment();
  50440. };
  50441. CodeMirror.defineExtension("toggleComment", function(options) {
  50442. if (!options) options = noOptions;
  50443. var cm = this;
  50444. var minLine = Infinity, ranges = this.listSelections(), mode = null;
  50445. for (var i = ranges.length - 1; i >= 0; i--) {
  50446. var from = ranges[i].from(), to = ranges[i].to();
  50447. if (from.line >= minLine) continue;
  50448. if (to.line >= minLine) to = Pos(minLine, 0);
  50449. minLine = from.line;
  50450. if (mode == null) {
  50451. if (cm.uncomment(from, to, options)) mode = "un";
  50452. else { cm.lineComment(from, to, options); mode = "line"; }
  50453. } else if (mode == "un") {
  50454. cm.uncomment(from, to, options);
  50455. } else {
  50456. cm.lineComment(from, to, options);
  50457. }
  50458. }
  50459. });
  50460. // Rough heuristic to try and detect lines that are part of multi-line string
  50461. function probablyInsideString(cm, pos, line) {
  50462. return /\bstring\b/.test(cm.getTokenTypeAt(Pos(pos.line, 0))) && !/^[\'\"\`]/.test(line)
  50463. }
  50464. function getMode(cm, pos) {
  50465. var mode = cm.getMode()
  50466. return mode.useInnerComments === false || !mode.innerMode ? mode : cm.getModeAt(pos)
  50467. }
  50468. CodeMirror.defineExtension("lineComment", function(from, to, options) {
  50469. if (!options) options = noOptions;
  50470. var self = this, mode = getMode(self, from);
  50471. var firstLine = self.getLine(from.line);
  50472. if (firstLine == null || probablyInsideString(self, from, firstLine)) return;
  50473. var commentString = options.lineComment || mode.lineComment;
  50474. if (!commentString) {
  50475. if (options.blockCommentStart || mode.blockCommentStart) {
  50476. options.fullLines = true;
  50477. self.blockComment(from, to, options);
  50478. }
  50479. return;
  50480. }
  50481. var end = Math.min(to.ch != 0 || to.line == from.line ? to.line + 1 : to.line, self.lastLine() + 1);
  50482. var pad = options.padding == null ? " " : options.padding;
  50483. var blankLines = options.commentBlankLines || from.line == to.line;
  50484. self.operation(function() {
  50485. if (options.indent) {
  50486. var baseString = null;
  50487. for (var i = from.line; i < end; ++i) {
  50488. var line = self.getLine(i);
  50489. var whitespace = line.slice(0, firstNonWS(line));
  50490. if (baseString == null || baseString.length > whitespace.length) {
  50491. baseString = whitespace;
  50492. }
  50493. }
  50494. for (var i = from.line; i < end; ++i) {
  50495. var line = self.getLine(i), cut = baseString.length;
  50496. if (!blankLines && !nonWS.test(line)) continue;
  50497. if (line.slice(0, cut) != baseString) cut = firstNonWS(line);
  50498. self.replaceRange(baseString + commentString + pad, Pos(i, 0), Pos(i, cut));
  50499. }
  50500. } else {
  50501. for (var i = from.line; i < end; ++i) {
  50502. if (blankLines || nonWS.test(self.getLine(i)))
  50503. self.replaceRange(commentString + pad, Pos(i, 0));
  50504. }
  50505. }
  50506. });
  50507. });
  50508. CodeMirror.defineExtension("blockComment", function(from, to, options) {
  50509. if (!options) options = noOptions;
  50510. var self = this, mode = getMode(self, from);
  50511. var startString = options.blockCommentStart || mode.blockCommentStart;
  50512. var endString = options.blockCommentEnd || mode.blockCommentEnd;
  50513. if (!startString || !endString) {
  50514. if ((options.lineComment || mode.lineComment) && options.fullLines != false)
  50515. self.lineComment(from, to, options);
  50516. return;
  50517. }
  50518. if (/\bcomment\b/.test(self.getTokenTypeAt(Pos(from.line, 0)))) return
  50519. var end = Math.min(to.line, self.lastLine());
  50520. if (end != from.line && to.ch == 0 && nonWS.test(self.getLine(end))) --end;
  50521. var pad = options.padding == null ? " " : options.padding;
  50522. if (from.line > end) return;
  50523. self.operation(function() {
  50524. if (options.fullLines != false) {
  50525. var lastLineHasText = nonWS.test(self.getLine(end));
  50526. self.replaceRange(pad + endString, Pos(end));
  50527. self.replaceRange(startString + pad, Pos(from.line, 0));
  50528. var lead = options.blockCommentLead || mode.blockCommentLead;
  50529. if (lead != null) for (var i = from.line + 1; i <= end; ++i)
  50530. if (i != end || lastLineHasText)
  50531. self.replaceRange(lead + pad, Pos(i, 0));
  50532. } else {
  50533. var atCursor = cmp(self.getCursor("to"), to) == 0, empty = !self.somethingSelected()
  50534. self.replaceRange(endString, to);
  50535. if (atCursor) self.setSelection(empty ? to : self.getCursor("from"), to)
  50536. self.replaceRange(startString, from);
  50537. }
  50538. });
  50539. });
  50540. CodeMirror.defineExtension("uncomment", function(from, to, options) {
  50541. if (!options) options = noOptions;
  50542. var self = this, mode = getMode(self, from);
  50543. var end = Math.min(to.ch != 0 || to.line == from.line ? to.line : to.line - 1, self.lastLine()), start = Math.min(from.line, end);
  50544. // Try finding line comments
  50545. var lineString = options.lineComment || mode.lineComment, lines = [];
  50546. var pad = options.padding == null ? " " : options.padding, didSomething;
  50547. lineComment: {
  50548. if (!lineString) break lineComment;
  50549. for (var i = start; i <= end; ++i) {
  50550. var line = self.getLine(i);
  50551. var found = line.indexOf(lineString);
  50552. if (found > -1 && !/comment/.test(self.getTokenTypeAt(Pos(i, found + 1)))) found = -1;
  50553. if (found == -1 && nonWS.test(line)) break lineComment;
  50554. if (found > -1 && nonWS.test(line.slice(0, found))) break lineComment;
  50555. lines.push(line);
  50556. }
  50557. self.operation(function() {
  50558. for (var i = start; i <= end; ++i) {
  50559. var line = lines[i - start];
  50560. var pos = line.indexOf(lineString), endPos = pos + lineString.length;
  50561. if (pos < 0) continue;
  50562. if (line.slice(endPos, endPos + pad.length) == pad) endPos += pad.length;
  50563. didSomething = true;
  50564. self.replaceRange("", Pos(i, pos), Pos(i, endPos));
  50565. }
  50566. });
  50567. if (didSomething) return true;
  50568. }
  50569. // Try block comments
  50570. var startString = options.blockCommentStart || mode.blockCommentStart;
  50571. var endString = options.blockCommentEnd || mode.blockCommentEnd;
  50572. if (!startString || !endString) return false;
  50573. var lead = options.blockCommentLead || mode.blockCommentLead;
  50574. var startLine = self.getLine(start), open = startLine.indexOf(startString)
  50575. if (open == -1) return false
  50576. var endLine = end == start ? startLine : self.getLine(end)
  50577. var close = endLine.indexOf(endString, end == start ? open + startString.length : 0);
  50578. var insideStart = Pos(start, open + 1), insideEnd = Pos(end, close + 1)
  50579. if (close == -1 ||
  50580. !/comment/.test(self.getTokenTypeAt(insideStart)) ||
  50581. !/comment/.test(self.getTokenTypeAt(insideEnd)) ||
  50582. self.getRange(insideStart, insideEnd, "\n").indexOf(endString) > -1)
  50583. return false;
  50584. // Avoid killing block comments completely outside the selection.
  50585. // Positions of the last startString before the start of the selection, and the first endString after it.
  50586. var lastStart = startLine.lastIndexOf(startString, from.ch);
  50587. var firstEnd = lastStart == -1 ? -1 : startLine.slice(0, from.ch).indexOf(endString, lastStart + startString.length);
  50588. if (lastStart != -1 && firstEnd != -1 && firstEnd + endString.length != from.ch) return false;
  50589. // Positions of the first endString after the end of the selection, and the last startString before it.
  50590. firstEnd = endLine.indexOf(endString, to.ch);
  50591. var almostLastStart = endLine.slice(to.ch).lastIndexOf(startString, firstEnd - to.ch);
  50592. lastStart = (firstEnd == -1 || almostLastStart == -1) ? -1 : to.ch + almostLastStart;
  50593. if (firstEnd != -1 && lastStart != -1 && lastStart != to.ch) return false;
  50594. self.operation(function() {
  50595. self.replaceRange("", Pos(end, close - (pad && endLine.slice(close - pad.length, close) == pad ? pad.length : 0)),
  50596. Pos(end, close + endString.length));
  50597. var openEnd = open + startString.length;
  50598. if (pad && startLine.slice(openEnd, openEnd + pad.length) == pad) openEnd += pad.length;
  50599. self.replaceRange("", Pos(start, open), Pos(start, openEnd));
  50600. if (lead) for (var i = start + 1; i <= end; ++i) {
  50601. var line = self.getLine(i), found = line.indexOf(lead);
  50602. if (found == -1 || nonWS.test(line.slice(0, found))) continue;
  50603. var foundEnd = found + lead.length;
  50604. if (pad && line.slice(foundEnd, foundEnd + pad.length) == pad) foundEnd += pad.length;
  50605. self.replaceRange("", Pos(i, found), Pos(i, foundEnd));
  50606. }
  50607. });
  50608. return true;
  50609. });
  50610. });
  50611. // Copyright (c) Jupyter Development Team.
  50612. // Distributed under the terms of the Modified BSD License.
  50613. define('services/config',[
  50614. 'base/js/utils',
  50615. ],
  50616. function(utils) {
  50617. "use strict";
  50618. var ConfigSection = function(section_name, options) {
  50619. this.section_name = section_name;
  50620. this.nbclassic_path = options.nbclassic_path;
  50621. this.base_url = options.base_url;
  50622. this.data = {};
  50623. var that = this;
  50624. /* .loaded is a promise, fulfilled the first time the config is loaded
  50625. * from the server. Code can do:
  50626. * conf.loaded.then(function() { ... using conf.data ... });
  50627. */
  50628. this._one_load_finished = false;
  50629. this.loaded = new Promise(function(resolve, reject) {
  50630. that._finish_firstload = resolve;
  50631. });
  50632. };
  50633. ConfigSection.prototype.api_url = function() {
  50634. return utils.url_path_join(this.base_url, 'api/config',
  50635. utils.encode_uri_components(this.section_name));
  50636. };
  50637. ConfigSection.prototype._load_done = function() {
  50638. if (!this._one_load_finished) {
  50639. this._one_load_finished = true;
  50640. this._finish_firstload();
  50641. }
  50642. };
  50643. ConfigSection.prototype.load = function() {
  50644. var that = this;
  50645. return utils.promising_ajax(this.api_url(), {
  50646. cache: false,
  50647. type: "GET",
  50648. dataType: "json",
  50649. }).then(function(data) {
  50650. that.data = data;
  50651. that._load_done();
  50652. return data;
  50653. });
  50654. };
  50655. /**
  50656. * Modify the config values stored. Update the local data immediately,
  50657. * send the change to the server, and use the updated data from the server
  50658. * when the reply comes.
  50659. */
  50660. ConfigSection.prototype.update = function(newdata) {
  50661. $.extend(true, this.data, newdata); // true -> recursive update
  50662. var that = this;
  50663. return utils.promising_ajax(this.api_url(), {
  50664. processData: false,
  50665. type : "PATCH",
  50666. data: JSON.stringify(newdata),
  50667. dataType : "json",
  50668. contentType: 'application/json',
  50669. }).then(function(data) {
  50670. that.data = data;
  50671. that._load_done();
  50672. return data;
  50673. });
  50674. };
  50675. var ConfigWithDefaults = function(section, defaults, classname) {
  50676. this.section = section;
  50677. this.defaults = defaults;
  50678. this.classname = classname;
  50679. };
  50680. ConfigWithDefaults.prototype._class_data = function() {
  50681. if (this.classname) {
  50682. return this.section.data[this.classname] || {};
  50683. } else {
  50684. return this.section.data;
  50685. }
  50686. };
  50687. /**
  50688. * Wait for config to have loaded, then get a value or the default.
  50689. * Returns a promise.
  50690. */
  50691. ConfigWithDefaults.prototype.get = function(key) {
  50692. var that = this;
  50693. return this.section.loaded.then(function() {
  50694. return that.get_sync(key);
  50695. });
  50696. };
  50697. /**
  50698. * Return a config value. If config is not yet loaded, return the default
  50699. * instead of waiting for it to load.
  50700. */
  50701. ConfigWithDefaults.prototype.get_sync = function(key) {
  50702. var data = this._class_data();
  50703. if (key === undefined) {
  50704. // no key specified, return full config data
  50705. return $.extend(true, {}, this.defaults, data);
  50706. }
  50707. var value = data[key];
  50708. if (value !== undefined) {
  50709. if (typeof value == 'object') {
  50710. // merge with defaults if it's an object
  50711. return $.extend(true, {}, this.defaults[key], value);
  50712. } else {
  50713. return value;
  50714. }
  50715. }
  50716. return this.defaults[key];
  50717. };
  50718. /**
  50719. * Set a config value. Send the update to the server, and change our
  50720. * local copy of the data immediately.
  50721. * Returns a promise which is fulfilled when the server replies to the
  50722. * change.
  50723. */
  50724. ConfigWithDefaults.prototype.set = function(key, value) {
  50725. var d = {};
  50726. d[key] = value;
  50727. if (this.classname) {
  50728. var d2 = {};
  50729. d2[this.classname] = d;
  50730. return this.section.update(d2);
  50731. } else {
  50732. return this.section.update(d);
  50733. }
  50734. };
  50735. return {ConfigSection: ConfigSection,
  50736. ConfigWithDefaults: ConfigWithDefaults,
  50737. };
  50738. });
  50739. // Distributed under the terms of the Modified BSD License.
  50740. /**
  50741. *
  50742. *
  50743. * @module cell
  50744. * @namespace cell
  50745. * @class Cell
  50746. */
  50747. define('notebook/js/cell',[
  50748. 'jquery',
  50749. 'base/js/utils',
  50750. 'base/js/i18n',
  50751. 'codemirror/lib/codemirror',
  50752. 'codemirror/addon/edit/matchbrackets',
  50753. 'codemirror/addon/edit/closebrackets',
  50754. 'codemirror/addon/comment/comment',
  50755. 'services/config',
  50756. ], function($, utils, i18n, CodeMirror, cm_match, cm_closeb, cm_comment, configmod) {
  50757. "use strict";
  50758. function is_single_cursor(dict1, dict2) {
  50759. return ((dict1.line == dict2.line) && (dict1.ch == dict2.ch));
  50760. };
  50761. var overlayHack = CodeMirror.scrollbarModel.native.prototype.overlayHack;
  50762. CodeMirror.scrollbarModel.native.prototype.overlayHack = function () {
  50763. overlayHack.apply(this, arguments);
  50764. // Reverse `min-height: 18px` scrollbar hack on OS X
  50765. // which causes a dead area, making it impossible to click on the last line
  50766. // when there is horizontal scrolling to do and the "show scrollbar only when scrolling" behavior
  50767. // is enabled.
  50768. // This, in turn, has the undesirable behavior of never showing the horizontal scrollbar,
  50769. // even when it should, which is less problematic, at least.
  50770. if (/Mac/.test(navigator.platform)) {
  50771. this.horiz.style.minHeight = "";
  50772. }
  50773. };
  50774. var Cell = function (options) {
  50775. /* Constructor
  50776. *
  50777. * The Base `Cell` class from which to inherit.
  50778. * @constructor
  50779. * @param:
  50780. * options: dictionary
  50781. * Dictionary of keyword arguments.
  50782. * events: $(Events) instance
  50783. * config: dictionary
  50784. * keyboard_manager: KeyboardManager instance
  50785. */
  50786. options = options || {};
  50787. this.keyboard_manager = options.keyboard_manager;
  50788. this.events = options.events;
  50789. var config = options.config;
  50790. // superclass default overwrite our default
  50791. this.selected = false;
  50792. this.anchor = false;
  50793. this.rendered = false;
  50794. this.mode = 'command';
  50795. // Metadata property
  50796. var that = this;
  50797. this._metadata = {};
  50798. Object.defineProperty(this, 'metadata', {
  50799. get: function() { return that._metadata; },
  50800. set: function(value) {
  50801. that._metadata = value;
  50802. if (that.celltoolbar) {
  50803. that.celltoolbar.rebuild();
  50804. }
  50805. }
  50806. });
  50807. // backward compat.
  50808. Object.defineProperty(this, 'cm_config', {
  50809. get: function() {
  50810. console.warn(i18n.msg._("Warning: accessing Cell.cm_config directly is deprecated."));
  50811. return that._options.cm_config;
  50812. },
  50813. });
  50814. // load this from metadata later ?
  50815. this.user_highlight = 'auto';
  50816. // merge my class-specific config data with general cell-level config
  50817. var class_config_data = {};
  50818. if (this.class_config) {
  50819. class_config_data = this.class_config.get_sync();
  50820. }
  50821. var cell_config = new configmod.ConfigWithDefaults(options.config,
  50822. Cell.options_default, 'Cell');
  50823. var cell_config_data = cell_config.get_sync();
  50824. // this._options is a merge of SomeCell and Cell config data:
  50825. this._options = utils.mergeopt({}, cell_config_data, class_config_data);
  50826. this.placeholder = this._options.placeholder || '';
  50827. this.cell_id = utils.uuid();
  50828. // For JS VM engines optimization, attributes should be all set (even
  50829. // to null) in the constructor, and if possible, if different subclass
  50830. // have new attributes with same name, they should be created in the
  50831. // same order. Easiest is to create and set to null in parent class.
  50832. this.element = null;
  50833. this.cell_type = this.cell_type || null;
  50834. this.code_mirror = null;
  50835. // The nbformat only specifies attachments for textcell, but to avoid
  50836. // data loss when switching between cell types in the UI, all cells
  50837. // have an attachments property here. It is only saved to disk
  50838. // for textcell though (in toJSON)
  50839. this.attachments = {};
  50840. this.create_element();
  50841. if (this.element !== null) {
  50842. this.element.data("cell", this);
  50843. this.bind_events();
  50844. this.init_classes();
  50845. }
  50846. };
  50847. Cell.options_default = {
  50848. cm_config : {
  50849. indentUnit : 4,
  50850. readOnly: false,
  50851. theme: "default",
  50852. extraKeys: {
  50853. "Cmd-Right": "goLineRight",
  50854. "End": "goLineRight",
  50855. "Cmd-Left": "goLineLeft",
  50856. "Tab": "indentMore",
  50857. "Shift-Tab" : "indentLess",
  50858. "Cmd-/" : "toggleComment",
  50859. "Ctrl-/" : "toggleComment",
  50860. }
  50861. }
  50862. };
  50863. // FIXME: Workaround CM Bug #332 (Safari segfault on drag)
  50864. // by disabling drag/drop altogether on Safari
  50865. // https://github.com/codemirror/CodeMirror/issues/332
  50866. if (utils.browser[0] == "Safari") {
  50867. Cell.options_default.cm_config.dragDrop = false;
  50868. }
  50869. /**
  50870. * Empty. Subclasses must implement create_element.
  50871. * This should contain all the code to create the DOM element in notebook
  50872. * and will be called by Base Class constructor.
  50873. * @method create_element
  50874. */
  50875. Cell.prototype.create_element = function () {
  50876. };
  50877. Cell.prototype.init_classes = function () {
  50878. /**
  50879. * Call after this.element exists to initialize the css classes
  50880. * related to selected, rendered and mode.
  50881. */
  50882. if (this.selected) {
  50883. this.element.addClass('selected');
  50884. } else {
  50885. this.element.addClass('unselected');
  50886. }
  50887. if (this.rendered) {
  50888. this.element.addClass('rendered');
  50889. } else {
  50890. this.element.addClass('unrendered');
  50891. }
  50892. };
  50893. /**
  50894. * trigger on focus and on click to bubble up to the notebook and
  50895. * potentially extend the selection if shift-click, contract the selection
  50896. * if just codemirror focus (so edit mode).
  50897. * We **might** be able to move that to notebook `handle_edit_mode`.
  50898. */
  50899. Cell.prototype._on_click = function (event) {
  50900. if (!this.selected) {
  50901. this.events.trigger('select.Cell', {'cell':this, 'extendSelection':event.shiftKey});
  50902. } else {
  50903. // I'm already part of the selection; contract selection to just me
  50904. this.events.trigger('select.Cell', {'cell': this});
  50905. }
  50906. };
  50907. /**
  50908. * Subclasses can implement override bind_events.
  50909. * Be careful to call the parent method when overwriting as it fires event.
  50910. * this will be triggered after create_element in constructor.
  50911. * @method bind_events
  50912. */
  50913. Cell.prototype.bind_events = function () {
  50914. var that = this;
  50915. // We trigger events so that Cell doesn't have to depend on Notebook.
  50916. that.element.click(function (event) {
  50917. that._on_click(event);
  50918. });
  50919. if (this.code_mirror) {
  50920. this.code_mirror.on("change", function(cm, change) {
  50921. that.events.trigger("change.Cell", {cell: that, change: change});
  50922. that.events.trigger("set_dirty.Notebook", {value: true});
  50923. });
  50924. }
  50925. if (this.code_mirror) {
  50926. this.code_mirror.on('focus', function(cm, change) {
  50927. if (!that.selected) {
  50928. that.events.trigger('select.Cell', {'cell':that});
  50929. }
  50930. that.events.trigger('edit_mode.Cell', {cell: that});
  50931. });
  50932. }
  50933. if (this.code_mirror) {
  50934. this.code_mirror.on('blur', function(cm, change) {
  50935. that.events.trigger('command_mode.Cell', {cell: that});
  50936. });
  50937. }
  50938. this.element.dblclick(function () {
  50939. if (that.selected === false) {
  50940. this.events.trigger('select.Cell', {'cell':that});
  50941. }
  50942. });
  50943. };
  50944. /**
  50945. * This method gets called in CodeMirror's onKeyDown/onKeyPress
  50946. * handlers and is used to provide custom key handling.
  50947. *
  50948. * To have custom handling, subclasses should override this method, but still call it
  50949. * in order to process the Edit mode keyboard shortcuts.
  50950. *
  50951. * @method handle_codemirror_keyevent
  50952. * @param {CodeMirror} editor - The codemirror instance bound to the cell
  50953. * @param {event} event - key press event which either should or should not be handled by CodeMirror
  50954. * @return {Boolean} `true` if CodeMirror should ignore the event, `false` Otherwise
  50955. */
  50956. Cell.prototype.handle_codemirror_keyevent = function (editor, event) {
  50957. var shortcuts = this.keyboard_manager.edit_shortcuts;
  50958. var cur = editor.getCursor();
  50959. if((cur.line !== 0 || cur.ch !==0) && event.keyCode === 38){
  50960. event._ipkmIgnore = true;
  50961. }
  50962. var nLastLine = editor.lastLine();
  50963. if ((event.keyCode === 40) &&
  50964. ((cur.line !== nLastLine) ||
  50965. (cur.ch !== editor.getLineHandle(nLastLine).text.length))
  50966. ) {
  50967. event._ipkmIgnore = true;
  50968. }
  50969. // if this is an edit_shortcuts shortcut, the global keyboard/shortcut
  50970. // manager will handle it
  50971. if (shortcuts.handles(event)) {
  50972. return true;
  50973. }
  50974. return false;
  50975. };
  50976. /**
  50977. * Triger typesetting of math by mathjax on current cell element
  50978. * @method typeset
  50979. */
  50980. Cell.prototype.typeset = function () {
  50981. utils.typeset(this.element);
  50982. };
  50983. /**
  50984. * handle cell level logic when a cell is selected
  50985. * @method select
  50986. * @return is the action being taken
  50987. */
  50988. Cell.prototype.select = function (moveanchor) {
  50989. // if anchor is true, set the move the anchor
  50990. moveanchor = (moveanchor === undefined)? true:moveanchor;
  50991. if(moveanchor){
  50992. this.anchor=true;
  50993. }
  50994. if (!this.selected) {
  50995. this.element.addClass('selected');
  50996. this.element.removeClass('unselected');
  50997. this.selected = true;
  50998. // disable 'insert image' menu item (specific cell types will enable
  50999. // it in their override select())
  51000. this.notebook.set_insert_image_enabled(false);
  51001. return true;
  51002. } else {
  51003. return false;
  51004. }
  51005. };
  51006. /**
  51007. * handle cell level logic when the cell is unselected
  51008. * @method unselect
  51009. * @return is the action being taken
  51010. */
  51011. Cell.prototype.unselect = function (moveanchor) {
  51012. // if anchor is true, remove also the anchor
  51013. moveanchor = (moveanchor === undefined)? true:moveanchor;
  51014. if (moveanchor){
  51015. this.anchor = false;
  51016. }
  51017. if (this.selected) {
  51018. this.element.addClass('unselected');
  51019. this.element.removeClass('selected');
  51020. this.selected = false;
  51021. return true;
  51022. } else {
  51023. return false;
  51024. }
  51025. };
  51026. /**
  51027. * should be overwritten by subclass
  51028. * @method execute
  51029. */
  51030. Cell.prototype.execute = function () {
  51031. return;
  51032. };
  51033. /**
  51034. * handle cell level logic when a cell is rendered
  51035. * @method render
  51036. * @return is the action being taken
  51037. */
  51038. Cell.prototype.render = function () {
  51039. if (!this.rendered) {
  51040. this.element.addClass('rendered');
  51041. this.element.removeClass('unrendered');
  51042. this.rendered = true;
  51043. return true;
  51044. } else {
  51045. return false;
  51046. }
  51047. };
  51048. /**
  51049. * handle cell level logic when a cell is unrendered
  51050. * @method unrender
  51051. * @return is the action being taken
  51052. */
  51053. Cell.prototype.unrender = function () {
  51054. if (this.rendered) {
  51055. this.element.addClass('unrendered');
  51056. this.element.removeClass('rendered');
  51057. this.rendered = false;
  51058. return true;
  51059. } else {
  51060. return false;
  51061. }
  51062. };
  51063. /**
  51064. * Delegates keyboard shortcut handling to either Jupyter keyboard
  51065. * manager when in command mode, or CodeMirror when in edit mode
  51066. *
  51067. * @method handle_keyevent
  51068. * @param {CodeMirror} editor - The codemirror instance bound to the cell
  51069. * @param {event} - key event to be handled
  51070. * @return {Boolean} `true` if CodeMirror should ignore the event, `false` Otherwise
  51071. */
  51072. Cell.prototype.handle_keyevent = function (editor, event) {
  51073. if (this.mode === 'command') {
  51074. return true;
  51075. } else if (this.mode === 'edit') {
  51076. return this.handle_codemirror_keyevent(editor, event);
  51077. }
  51078. };
  51079. /**
  51080. * @method at_top
  51081. * @return {Boolean}
  51082. */
  51083. Cell.prototype.at_top = function () {
  51084. var cm = this.code_mirror;
  51085. var cursor = cm.getCursor();
  51086. if (cursor.line === 0 && cursor.ch === 0) {
  51087. return true;
  51088. }
  51089. return false;
  51090. };
  51091. /**
  51092. * @method at_bottom
  51093. * @return {Boolean}
  51094. * */
  51095. Cell.prototype.at_bottom = function () {
  51096. var cm = this.code_mirror;
  51097. var cursor = cm.getCursor();
  51098. if (cursor.line === (cm.lineCount()-1) && cursor.ch === cm.getLine(cursor.line).length) {
  51099. return true;
  51100. }
  51101. return false;
  51102. };
  51103. /**
  51104. * enter the command mode for the cell
  51105. * @method command_mode
  51106. * @return is the action being taken
  51107. */
  51108. Cell.prototype.command_mode = function () {
  51109. if (this.mode !== 'command') {
  51110. this.mode = 'command';
  51111. return true;
  51112. } else {
  51113. return false;
  51114. }
  51115. };
  51116. /**
  51117. * enter the edit mode for the cell
  51118. * @method command_mode
  51119. * @return is the action being taken
  51120. */
  51121. Cell.prototype.edit_mode = function () {
  51122. if (this.mode !== 'edit') {
  51123. this.mode = 'edit';
  51124. return true;
  51125. } else {
  51126. return false;
  51127. }
  51128. };
  51129. Cell.prototype.ensure_focused = function() {
  51130. if(this.element !== document.activeElement && !this.code_mirror.hasFocus()){
  51131. this.focus_cell();
  51132. }
  51133. };
  51134. /**
  51135. * Focus the cell in the DOM sense
  51136. * @method focus_cell
  51137. */
  51138. Cell.prototype.focus_cell = function () {
  51139. this.element.focus();
  51140. this._on_click({});
  51141. };
  51142. /**
  51143. * Focus the editor area so a user can type
  51144. *
  51145. * NOTE: If codemirror is focused via a mouse click event, you don't want to
  51146. * call this because it will cause a page jump.
  51147. * @method focus_editor
  51148. */
  51149. Cell.prototype.focus_editor = function () {
  51150. this.refresh();
  51151. this.code_mirror.focus();
  51152. };
  51153. /**
  51154. * Refresh codemirror instance
  51155. * @method refresh
  51156. */
  51157. Cell.prototype.refresh = function () {
  51158. if (this.code_mirror) {
  51159. this.code_mirror.refresh();
  51160. }
  51161. };
  51162. /**
  51163. * should be overwritten by subclass
  51164. * @method get_text
  51165. */
  51166. Cell.prototype.get_text = function () {
  51167. };
  51168. /**
  51169. * should be overwritten by subclass
  51170. * @method set_text
  51171. * @param {string} text
  51172. */
  51173. Cell.prototype.set_text = function (text) {
  51174. };
  51175. /**
  51176. * should be overwritten by subclass
  51177. * serialise cell to json.
  51178. * @method toJSON
  51179. **/
  51180. Cell.prototype.toJSON = function () {
  51181. var data = {};
  51182. // deepcopy the metadata so copied cells don't share the same object
  51183. data.metadata = JSON.parse(JSON.stringify(this.metadata));
  51184. if (this.id !== undefined) {
  51185. data.id = this.id;
  51186. }
  51187. if (data.metadata.deletable) {
  51188. delete data.metadata.deletable;
  51189. }
  51190. if (data.metadata.editable) {
  51191. delete data.metadata.editable;
  51192. }
  51193. if (data.metadata.collapsed === false) {
  51194. delete data.metadata.collapsed;
  51195. }
  51196. data.cell_type = this.cell_type;
  51197. return data;
  51198. };
  51199. /**
  51200. * should be overwritten by subclass
  51201. * @method fromJSON
  51202. **/
  51203. Cell.prototype.fromJSON = function (data) {
  51204. if (data.metadata !== undefined) {
  51205. this.metadata = data.metadata;
  51206. }
  51207. if (data.id !== undefined) {
  51208. this.id = data.id;
  51209. }
  51210. };
  51211. /**
  51212. * can the cell be split into two cells (false if not deletable)
  51213. *
  51214. * @method is_splittable
  51215. **/
  51216. Cell.prototype.is_splittable = function () {
  51217. return this.is_deletable();
  51218. };
  51219. /**
  51220. * can the cell be merged with other cells (false if not deletable)
  51221. * @method is_mergeable
  51222. **/
  51223. Cell.prototype.is_mergeable = function () {
  51224. return this.is_deletable();
  51225. };
  51226. /**
  51227. * is the cell edtitable? only false (readonly) if
  51228. * metadata.editable is explicitly false -- everything else
  51229. * counts as true
  51230. *
  51231. * @method is_editable
  51232. **/
  51233. Cell.prototype.is_editable = function () {
  51234. if (this.metadata.editable === false) {
  51235. return false;
  51236. }
  51237. return true;
  51238. };
  51239. /**
  51240. * is the cell deletable? only false (undeletable) if
  51241. * metadata.deletable is explicitly false or if the cell is not
  51242. * editable -- everything else counts as true
  51243. *
  51244. * @method is_deletable
  51245. **/
  51246. Cell.prototype.is_deletable = function () {
  51247. if (this.metadata.deletable === false || !this.is_editable()) {
  51248. return false;
  51249. }
  51250. return true;
  51251. };
  51252. /**
  51253. * @return {String} - the text before the cursor
  51254. * @method get_pre_cursor
  51255. **/
  51256. Cell.prototype.get_pre_cursor = function () {
  51257. var cursor = this.code_mirror.getCursor();
  51258. var text = this.code_mirror.getRange({line:0, ch:0}, cursor);
  51259. text = text.replace(/^\n+/, '').replace(/\n+$/, '');
  51260. return text;
  51261. };
  51262. /**
  51263. * @return {String} - the text after the cursor
  51264. * @method get_post_cursor
  51265. **/
  51266. Cell.prototype.get_post_cursor = function () {
  51267. var cursor = this.code_mirror.getCursor();
  51268. var last_line_num = this.code_mirror.lineCount()-1;
  51269. var last_line_len = this.code_mirror.getLine(last_line_num).length;
  51270. var end = {line:last_line_num, ch:last_line_len};
  51271. var text = this.code_mirror.getRange(cursor, end);
  51272. text = text.replace(/^\n+/, '').replace(/\n+$/, '');
  51273. return text;
  51274. };
  51275. /**
  51276. * @return {Array} - the text between cursors and within selections (multicursor/sorted)
  51277. * @method get_split_text
  51278. **/
  51279. Cell.prototype.get_split_text = function () {
  51280. var start = {line:0, ch:0};
  51281. var last_line_num = this.code_mirror.lineCount()-1;
  51282. var last_line_len = this.code_mirror.getLine(last_line_num).length;
  51283. var end = {line:last_line_num, ch:last_line_len};
  51284. var flag_empty_cell = is_single_cursor(start, end);
  51285. var flag_first_position = false;
  51286. var flag_last_position = false;
  51287. var flag_all_select = false;
  51288. var ranges = this.code_mirror.listSelections();
  51289. var cursors = [start];
  51290. for (var i = 0; i < ranges.length; i++) {
  51291. // append both to handle selections
  51292. // ranges[i].head.sticky is null if ctrl-a select
  51293. if ((ranges[i].head.sticky == 'before') || (ranges[i].head.sticky === null )) {
  51294. cursors.push(ranges[i].anchor);
  51295. cursors.push(ranges[i].head);
  51296. if (is_single_cursor(ranges[i].anchor, start) &&
  51297. is_single_cursor(ranges[i].head, end)) {
  51298. flag_all_select = true;
  51299. }
  51300. } else {
  51301. cursors.push(ranges[i].head);
  51302. cursors.push(ranges[i].anchor);
  51303. if (is_single_cursor(ranges[i].head, start) &&
  51304. is_single_cursor(ranges[i].anchor, end)) {
  51305. flag_all_select = true;
  51306. }
  51307. }
  51308. // single cursor at beginning or end of cell
  51309. if (is_single_cursor(ranges[i].head, ranges[i].anchor)) {
  51310. if (is_single_cursor(ranges[i].head, start)) flag_first_position = true;
  51311. if (is_single_cursor(ranges[i].head, end)) flag_last_position = true;
  51312. }
  51313. }
  51314. cursors.push(end);
  51315. // Cursors is now sorted, but likely has duplicates due to anchor and head being the same for cursors
  51316. var locations = [cursors[0]];
  51317. for (var i = 1; i < cursors.length; i++) {
  51318. var last = locations[locations.length-1];
  51319. var current = cursors[i];
  51320. if ((last.line != current.line) || (last.ch != current.ch)) {
  51321. locations.push(cursors[i]);
  51322. }
  51323. }
  51324. // Split text
  51325. var text_list = [];
  51326. // Split single cursors at first position
  51327. if (flag_empty_cell || flag_first_position) text_list.push('');
  51328. for (var i = 1; i < locations.length; i++) {
  51329. var text = this.code_mirror.getRange(locations[i-1], locations[i]);
  51330. text = text.replace(/^\n+/, '').replace(/\n+$/, ''); // removes newlines at beginning and end
  51331. text_list.push(text);
  51332. }
  51333. // Split single cursors at last position
  51334. if (flag_last_position) text_list.push('');
  51335. // Duplicate cell if full cell is selected
  51336. if ((text_list.length == 1) && flag_all_select && !flag_empty_cell) {
  51337. text_list = text_list.concat(text_list);
  51338. }
  51339. return text_list;
  51340. };
  51341. /**
  51342. * Show/Hide CodeMirror LineNumber
  51343. * @method show_line_numbers
  51344. *
  51345. * @param value {Bool} show (true), or hide (false) the line number in CodeMirror
  51346. **/
  51347. Cell.prototype.show_line_numbers = function (value) {
  51348. this.code_mirror.setOption('lineNumbers', value);
  51349. this.code_mirror.refresh();
  51350. };
  51351. /**
  51352. * Toggle CodeMirror LineNumber
  51353. * @method toggle_line_numbers
  51354. **/
  51355. Cell.prototype.toggle_line_numbers = function () {
  51356. var val = this.code_mirror.getOption('lineNumbers');
  51357. this.show_line_numbers(!val);
  51358. };
  51359. /**
  51360. * Force codemirror highlight mode
  51361. * @method force_highlight
  51362. * @param {object} - CodeMirror mode
  51363. **/
  51364. Cell.prototype.force_highlight = function(mode) {
  51365. this.user_highlight = mode;
  51366. this.auto_highlight();
  51367. };
  51368. /**
  51369. * Trigger autodetection of highlight scheme for current cell
  51370. * @method auto_highlight
  51371. */
  51372. Cell.prototype.auto_highlight = function () {
  51373. this._auto_highlight(this.class_config.get_sync('highlight_modes'));
  51374. };
  51375. /**
  51376. * Try to autodetect cell highlight mode, or use selected mode
  51377. * @methods _auto_highlight
  51378. * @private
  51379. * @param {String|object|undefined} - CodeMirror mode | 'auto'
  51380. **/
  51381. Cell.prototype._auto_highlight = function (modes) {
  51382. /**
  51383. *Here we handle manually selected modes
  51384. */
  51385. var that = this;
  51386. var mode;
  51387. if( this.user_highlight !== undefined && this.user_highlight != 'auto' )
  51388. {
  51389. mode = this.user_highlight;
  51390. CodeMirror.autoLoadMode(this.code_mirror, mode);
  51391. this.code_mirror.setOption('mode', mode);
  51392. return;
  51393. }
  51394. var current_mode = this.code_mirror.getOption('mode', mode);
  51395. var first_line = this.code_mirror.getLine(0);
  51396. // loop on every pairs
  51397. for(mode in modes) {
  51398. var regs = modes[mode].reg;
  51399. // only one key every time but regexp can't be keys...
  51400. for(var i=0; i<regs.length; i++) {
  51401. // here we handle non magic_modes.
  51402. // TODO :
  51403. // On 3.0 and below, these things were regex.
  51404. // But now should be string for json-able config.
  51405. // We should get rid of assuming they might be already
  51406. // in a later version of Jupyter.
  51407. var re = regs[i];
  51408. if(typeof(re) === 'string'){
  51409. re = new RegExp(re);
  51410. }
  51411. if(first_line.match(re) !== null) {
  51412. if(current_mode == mode){
  51413. return;
  51414. }
  51415. if (mode.search('magic_') !== 0) {
  51416. utils.requireCodeMirrorMode(mode, function (spec) {
  51417. that.code_mirror.setOption('mode', spec);
  51418. });
  51419. return;
  51420. }
  51421. var magic_mode = mode;
  51422. mode = magic_mode.substr(6);
  51423. if(current_mode == magic_mode){
  51424. return;
  51425. }
  51426. utils.requireCodeMirrorMode(mode, function (spec) {
  51427. // Add an overlay mode to recognize the first line as "magic" instead
  51428. // of the mode used for the rest of the cell.
  51429. CodeMirror.defineMode(magic_mode, function(config) {
  51430. var magicOverlay = {
  51431. startState: function() {
  51432. return {firstMatched : false, inMagicLine: false};
  51433. },
  51434. token: function(stream, state) {
  51435. if(!state.firstMatched) {
  51436. state.firstMatched = true;
  51437. if (stream.match("%%", false)) {
  51438. state.inMagicLine = true;
  51439. }
  51440. }
  51441. if (state.inMagicLine) {
  51442. stream.eat(function any(ch) { return true; });
  51443. if (stream.eol()) {
  51444. state.inMagicLine = false;
  51445. }
  51446. return "magic";
  51447. }
  51448. stream.skipToEnd();
  51449. return null;
  51450. }
  51451. };
  51452. return CodeMirror.overlayMode(CodeMirror.getMode(config, spec), magicOverlay);
  51453. });
  51454. that.code_mirror.setOption('mode', magic_mode);
  51455. });
  51456. return;
  51457. }
  51458. }
  51459. }
  51460. // fallback on default
  51461. var default_mode;
  51462. try {
  51463. default_mode = this._options.cm_config.mode;
  51464. } catch(e) {
  51465. default_mode = 'text/plain';
  51466. }
  51467. if( current_mode === default_mode){
  51468. return;
  51469. }
  51470. this.code_mirror.setOption('mode', default_mode);
  51471. };
  51472. var UnrecognizedCell = function (options) {
  51473. /** Constructor for unrecognized cells */
  51474. Cell.apply(this, arguments);
  51475. this.cell_type = 'unrecognized';
  51476. this.celltoolbar = null;
  51477. this.data = {};
  51478. Object.seal(this);
  51479. };
  51480. UnrecognizedCell.prototype = Object.create(Cell.prototype);
  51481. // cannot merge or split unrecognized cells
  51482. UnrecognizedCell.prototype.is_mergeable = function () {
  51483. return false;
  51484. };
  51485. UnrecognizedCell.prototype.is_splittable = function () {
  51486. return false;
  51487. };
  51488. UnrecognizedCell.prototype.toJSON = function () {
  51489. /**
  51490. * deepcopy the metadata so copied cells don't share the same object
  51491. */
  51492. return JSON.parse(JSON.stringify(this.data));
  51493. };
  51494. UnrecognizedCell.prototype.fromJSON = function (data) {
  51495. this.data = data;
  51496. if (data.metadata !== undefined) {
  51497. this.metadata = data.metadata;
  51498. } else {
  51499. data.metadata = this.metadata;
  51500. }
  51501. this.element.find('.inner_cell').find("a").text(i18n.msg.sprintf(i18n.msg._("Unrecognized cell type: %s"), data.cell_type));
  51502. };
  51503. UnrecognizedCell.prototype.create_element = function () {
  51504. Cell.prototype.create_element.apply(this, arguments);
  51505. var cell = this.element = $("<div>").addClass('cell unrecognized_cell');
  51506. cell.attr('tabindex','2');
  51507. var prompt = $('<div/>').addClass('prompt input_prompt');
  51508. cell.append(prompt);
  51509. var inner_cell = $('<div/>').addClass('inner_cell');
  51510. inner_cell.append(
  51511. $("<a>")
  51512. .attr("href", "#")
  51513. .text(i18n.msg._("Unrecognized cell type"))
  51514. );
  51515. cell.append(inner_cell);
  51516. this.element = cell;
  51517. };
  51518. UnrecognizedCell.prototype.bind_events = function () {
  51519. Cell.prototype.bind_events.apply(this, arguments);
  51520. var cell = this;
  51521. this.element.find('.inner_cell').find("a").click(function () {
  51522. cell.events.trigger('unrecognized_cell.Cell', {cell: cell});
  51523. });
  51524. };
  51525. return {
  51526. Cell: Cell,
  51527. UnrecognizedCell: UnrecognizedCell
  51528. };
  51529. });
  51530. // Copyright (c) Jupyter Development Team.
  51531. // Distributed under the terms of the Modified BSD License.
  51532. // Give us an object to bind all events to. This object should be created
  51533. // before all other objects so it exists when others register event handlers.
  51534. // To register an event handler:
  51535. //
  51536. // requirejs(['base/js/events'], function (events) {
  51537. // events.on("event.Namespace", function () { do_stuff(); });
  51538. // });
  51539. define('base/js/events',['jquery', 'base/js/namespace'], function($, Jupyter) {
  51540. "use strict";
  51541. // Events singleton
  51542. if (!window._Events) {
  51543. window._Events = function () {};
  51544. window._events = new window._Events();
  51545. }
  51546. // Backwards compatibility.
  51547. Jupyter.Events = window._Events;
  51548. Jupyter.events = window._events;
  51549. var events = $([window._events]);
  51550. // catch and log errors in triggered events
  51551. events._original_trigger = events.trigger;
  51552. events.trigger = function (name, data) {
  51553. try {
  51554. this._original_trigger.apply(this, arguments);
  51555. } catch (e) {
  51556. console.error("Exception in event handler for " + name, e, arguments);
  51557. }
  51558. }
  51559. return events;
  51560. });
  51561. // Copyright (c) Jupyter Development Team.
  51562. // Distributed under the terms of the Modified BSD License.
  51563. define('notebook/js/celltoolbar',[
  51564. 'jquery',
  51565. 'base/js/namespace',
  51566. 'base/js/events',
  51567. 'base/js/i18n'
  51568. ], function($, IPython, events, i18n) {
  51569. "use strict";
  51570. var CellToolbar = function (options) {
  51571. /**
  51572. * Constructor
  51573. *
  51574. * Parameters:
  51575. * options: dictionary
  51576. * Dictionary of keyword arguments.
  51577. * events: $(Events) instance
  51578. * cell: Cell instance
  51579. * notebook: Notebook instance
  51580. *
  51581. * TODO: This leaks, when cell are deleted
  51582. * There is still a reference to each celltoolbars.
  51583. */
  51584. CellToolbar._instances.push(this);
  51585. this.notebook = options.notebook;
  51586. this.cell = options.cell;
  51587. this.create_element();
  51588. this.rebuild();
  51589. return this;
  51590. };
  51591. CellToolbar.prototype.create_element = function () {
  51592. this.inner_element = $('<div/>').addClass('celltoolbar');
  51593. this.element = $('<div/>').addClass('ctb_hideshow')
  51594. .append(this.inner_element);
  51595. };
  51596. // The default css style for the outer celltoolbar div
  51597. // (ctb_hideshow) is display: none.
  51598. // To show the cell toolbar, *both* of the following conditions must be met:
  51599. // - A parent container has class `ctb_global_show`
  51600. // - The celltoolbar has the class `ctb_show`
  51601. // This allows global show/hide, as well as per-cell show/hide.
  51602. CellToolbar.global_hide = function () {
  51603. $('body').removeClass('ctb_global_show');
  51604. };
  51605. CellToolbar.global_show = function () {
  51606. $('body').addClass('ctb_global_show');
  51607. };
  51608. CellToolbar.prototype.hide = function () {
  51609. this.element.removeClass('ctb_show');
  51610. };
  51611. CellToolbar.prototype.show = function () {
  51612. this.element.addClass('ctb_show');
  51613. };
  51614. /**
  51615. * Class variable that should contain a dict of all available callback
  51616. * we need to think of wether or not we allow nested namespace
  51617. * @property _callback_dict
  51618. * @private
  51619. * @static
  51620. * @type Dict
  51621. */
  51622. CellToolbar._callback_dict = {};
  51623. /**
  51624. * Class variable that should contain the reverse order list of the button
  51625. * to add to the toolbar of each cell
  51626. * @property _ui_controls_list
  51627. * @private
  51628. * @static
  51629. * @type List
  51630. */
  51631. CellToolbar._ui_controls_list = [];
  51632. /**
  51633. * Class variable that should contain the CellToolbar instances for each
  51634. * cell of the notebook
  51635. *
  51636. * @private
  51637. * @property _instances
  51638. * @static
  51639. * @type List
  51640. */
  51641. CellToolbar._instances = [];
  51642. /**
  51643. * keep a list of all the available presets for the toolbar
  51644. * @private
  51645. * @property _presets
  51646. * @static
  51647. * @type Dict
  51648. */
  51649. CellToolbar._presets = {};
  51650. // this is by design not a prototype.
  51651. /**
  51652. * Register a callback to create an UI element in a cell toolbar.
  51653. * @method register_callback
  51654. * @param name {String} name to use to refer to the callback. It is advised to use a prefix with the name
  51655. * for easier sorting and avoid collision
  51656. * @param callback {function(div, cell)} callback that will be called to generate the ui element
  51657. * @param [cell_types] {List_of_String|undefined} optional list of cell types. If present the UI element
  51658. * will be added only to cells of types in the list.
  51659. *
  51660. *
  51661. * The callback will receive the following element :
  51662. *
  51663. * * a div in which to add element.
  51664. * * the cell it is responsible from
  51665. *
  51666. * @example
  51667. *
  51668. * Example that create callback for a button that toggle between `true` and `false` label,
  51669. * with the metadata under the key 'foo' to reflect the status of the button.
  51670. *
  51671. * // first param reference to a DOM div
  51672. * // second param reference to the cell.
  51673. * var toggle = function(div, cell) {
  51674. * var button_container = $(div)
  51675. *
  51676. * // let's create a button that show the current value of the metadata
  51677. * var button = $('<div/>').button({label:String(cell.metadata.foo)});
  51678. *
  51679. * // On click, change the metadata value and update the button label
  51680. * button.click(function(){
  51681. * var v = cell.metadata.foo;
  51682. * cell.metadata.foo = !v;
  51683. * button.button("option", "label", String(!v));
  51684. * })
  51685. *
  51686. * // add the button to the DOM div.
  51687. * button_container.append(button);
  51688. * }
  51689. *
  51690. * // now we register the callback under the name `foo` to give the
  51691. * // user the ability to use it later
  51692. * CellToolbar.register_callback('foo', toggle);
  51693. */
  51694. CellToolbar.register_callback = function(name, callback, cell_types) {
  51695. // Overwrite if it already exists.
  51696. CellToolbar._callback_dict[name] = cell_types ? {callback: callback, cell_types: cell_types} : callback;
  51697. };
  51698. /**
  51699. * Register a preset of UI element in a cell toolbar.
  51700. * Not supported Yet.
  51701. * @method register_preset
  51702. * @param name {String} name to use to refer to the preset. It is advised to use a prefix with the name
  51703. * for easier sorting and avoid collision
  51704. * @param preset_list {List_of_String} reverse order of the button in the toolbar. Each String of the list
  51705. * should correspond to a name of a registered callback.
  51706. *
  51707. * @private
  51708. * @example
  51709. *
  51710. * CellToolbar.register_callback('foo.c1', function(div, cell){...});
  51711. * CellToolbar.register_callback('foo.c2', function(div, cell){...});
  51712. * CellToolbar.register_callback('foo.c3', function(div, cell){...});
  51713. * CellToolbar.register_callback('foo.c4', function(div, cell){...});
  51714. * CellToolbar.register_callback('foo.c5', function(div, cell){...});
  51715. *
  51716. * CellToolbar.register_preset('foo.foo_preset1', ['foo.c1', 'foo.c2', 'foo.c5'])
  51717. * CellToolbar.register_preset('foo.foo_preset2', ['foo.c4', 'foo.c5'])
  51718. */
  51719. CellToolbar.register_preset = function(name, preset_list, notebook) {
  51720. CellToolbar._presets[name] = preset_list;
  51721. events.trigger('preset_added.CellToolbar', {name: name});
  51722. // When "register_callback" is called by a custom extension, it may be executed after notebook is loaded.
  51723. // In that case, activate the preset if needed.
  51724. if (notebook && notebook.metadata && notebook.metadata.celltoolbar === name){
  51725. CellToolbar.activate_preset(name);
  51726. }
  51727. };
  51728. /**
  51729. * unregister the selected preset,
  51730. *
  51731. * return true if preset successfully unregistered
  51732. * false otherwise
  51733. *
  51734. **/
  51735. CellToolbar.unregister_preset = function(name){
  51736. if(CellToolbar._presets[name]){
  51737. delete CellToolbar._presets[name];
  51738. events.trigger('unregistered_preset.CellToolbar', {name: name});
  51739. return true
  51740. }
  51741. return false
  51742. }
  51743. /**
  51744. * List the names of the presets that are currently registered.
  51745. *
  51746. * @method list_presets
  51747. * @static
  51748. */
  51749. CellToolbar.list_presets = function() {
  51750. var keys = [];
  51751. for (var k in CellToolbar._presets) {
  51752. keys.push(k);
  51753. }
  51754. return keys;
  51755. };
  51756. /**
  51757. * Activate an UI preset from `register_preset`
  51758. *
  51759. * This does not update the selection UI.
  51760. *
  51761. * @method activate_preset
  51762. * @param preset_name {String} string corresponding to the preset name
  51763. *
  51764. * @static
  51765. * @private
  51766. * @example
  51767. *
  51768. * CellToolbar.activate_preset('foo.foo_preset1');
  51769. */
  51770. CellToolbar.activate_preset = function(preset_name){
  51771. var preset = CellToolbar._presets[preset_name];
  51772. if(preset !== undefined){
  51773. CellToolbar._ui_controls_list = preset;
  51774. CellToolbar.rebuild_all();
  51775. }
  51776. events.trigger('preset_activated.CellToolbar', {name: preset_name});
  51777. };
  51778. /**
  51779. * This should be called on the class and not on a instance as it will trigger
  51780. * rebuild of all the instances.
  51781. * @method rebuild_all
  51782. * @static
  51783. *
  51784. */
  51785. CellToolbar.rebuild_all = function(){
  51786. for(var i=0; i < CellToolbar._instances.length; i++){
  51787. CellToolbar._instances[i].rebuild();
  51788. }
  51789. };
  51790. /**
  51791. * Rebuild all the button on the toolbar to update its state.
  51792. * @method rebuild
  51793. */
  51794. CellToolbar.prototype.rebuild = function(){
  51795. /**
  51796. * strip everything from the div
  51797. * which is probably inner_element
  51798. * or this.element.
  51799. */
  51800. this.inner_element.empty();
  51801. this.ui_controls_list = [];
  51802. var callbacks = CellToolbar._callback_dict;
  51803. var preset = CellToolbar._ui_controls_list;
  51804. // Yes we iterate on the class variable, not the instance one.
  51805. for (var i=0; i < preset.length; i++) {
  51806. var key = preset[i];
  51807. var callback = callbacks[key];
  51808. if (!callback) continue;
  51809. if (typeof callback === 'object') {
  51810. if (callback.cell_types.indexOf(this.cell.cell_type) === -1) continue;
  51811. callback = callback.callback;
  51812. }
  51813. var local_div = $('<div/>').addClass('button_container');
  51814. try {
  51815. callback(local_div, this.cell, this);
  51816. this.ui_controls_list.push(key);
  51817. } catch (e) {
  51818. console.log(i18n.msg.sprintf(i18n.msg._("Error in cell toolbar callback %s"), key), e);
  51819. continue;
  51820. }
  51821. // only append if callback succeeded.
  51822. this.inner_element.append(local_div);
  51823. }
  51824. // If there are no controls or the cell is a rendered TextCell hide the toolbar.
  51825. if (!this.ui_controls_list.length) {
  51826. this.hide();
  51827. } else {
  51828. this.show();
  51829. }
  51830. };
  51831. CellToolbar.utils = {};
  51832. /**
  51833. * A utility function to generate bindings between a checkbox and cell/metadata
  51834. * @method utils.checkbox_ui_generator
  51835. * @static
  51836. *
  51837. * @param name {string} Label in front of the checkbox
  51838. * @param setter {function( cell, newValue )}
  51839. * A setter method to set the newValue
  51840. * @param getter {function( cell )}
  51841. * A getter methods which return the current value.
  51842. *
  51843. * @return callback {function( div, cell )} Callback to be passed to `register_callback`
  51844. *
  51845. * @example
  51846. *
  51847. * An exmple that bind the subkey `slideshow.isSectionStart` to a checkbox with a `New Slide` label
  51848. *
  51849. * var newSlide = CellToolbar.utils.checkbox_ui_generator('New Slide',
  51850. * // setter
  51851. * function(cell, value){
  51852. * // we check that the slideshow namespace exist and create it if needed
  51853. * if (cell.metadata.slideshow == undefined){cell.metadata.slideshow = {}}
  51854. * // set the value
  51855. * cell.metadata.slideshow.isSectionStart = value
  51856. * },
  51857. * // getter
  51858. * function(cell){ var ns = cell.metadata.slideshow;
  51859. * // if the slideshow namespace does not exist return `undefined`
  51860. * // (will be interpreted as `false` by checkbox) otherwise
  51861. * // return the value
  51862. * return (ns == undefined)? undefined: ns.isSectionStart
  51863. * }
  51864. * );
  51865. *
  51866. * CellToolbar.register_callback('newSlide', newSlide);
  51867. *
  51868. */
  51869. CellToolbar.utils.checkbox_ui_generator = function(name, setter, getter){
  51870. return function(div, cell, celltoolbar) {
  51871. var button_container = $(div);
  51872. var chkb = $('<input/>').attr('type', 'checkbox');
  51873. var lbl = $('<label/>').append($('<span/>').text(name));
  51874. chkb.attr("checked", getter(cell));
  51875. chkb.click(function(){
  51876. var v = getter(cell);
  51877. setter(cell, !v);
  51878. chkb.attr("checked", !v);
  51879. });
  51880. button_container.append($('<span/>').append(lbl).append(chkb));
  51881. };
  51882. };
  51883. /**
  51884. * A utility function to generate bindings between a input field and cell/metadata
  51885. * @method utils.input_ui_generator
  51886. * @static
  51887. *
  51888. * @param name {string} Label in front of the input field
  51889. * @param setter {function( cell, newValue )}
  51890. * A setter method to set the newValue
  51891. * @param getter {function( cell )}
  51892. * A getter methods which return the current value.
  51893. *
  51894. * @return callback {function( div, cell )} Callback to be passed to `register_callback`
  51895. *
  51896. */
  51897. CellToolbar.utils.input_ui_generator = function(name, setter, getter){
  51898. return function(div, cell, celltoolbar) {
  51899. var button_container = $(div);
  51900. var text = $('<input/>').attr('type', 'text');
  51901. var lbl = $('<label/>').append($('<span/>').text(name));
  51902. text.attr("value", getter(cell));
  51903. text.keyup(function(){
  51904. setter(cell, text.val());
  51905. });
  51906. button_container.append($('<span/>').append(lbl).append(text));
  51907. IPython.keyboard_manager.register_events(text);
  51908. };
  51909. };
  51910. /**
  51911. * A utility function to generate bindings between a dropdown list cell
  51912. * @method utils.select_ui_generator
  51913. * @static
  51914. *
  51915. * @param list_list {list_of_sublist} List of sublist of metadata value and name in the dropdown list.
  51916. * sublist should contain 2 element each, first a string that would be displayed in the dropdown list,
  51917. * and second the corresponding value to be passed to setter/return by getter. the corresponding value
  51918. * should not be "undefined" or behavior can be unexpected.
  51919. * @param setter {function( cell, newValue )}
  51920. * A setter method to set the newValue
  51921. * @param getter {function( cell )}
  51922. * A getter methods which return the current value of the metadata.
  51923. * @param [label=""] {String} optional label for the dropdown menu
  51924. *
  51925. * @return callback {function( div, cell )} Callback to be passed to `register_callback`
  51926. *
  51927. * @example
  51928. *
  51929. * var select_type = CellToolbar.utils.select_ui_generator([
  51930. * ["<None>" , "None" ],
  51931. * ["Header Slide" , "header_slide" ],
  51932. * ["Slide" , "slide" ],
  51933. * ["Fragment" , "fragment" ],
  51934. * ["Skip" , "skip" ],
  51935. * ],
  51936. * // setter
  51937. * function(cell, value){
  51938. * // we check that the slideshow namespace exist and create it if needed
  51939. * if (cell.metadata.slideshow == undefined){cell.metadata.slideshow = {}}
  51940. * // set the value
  51941. * cell.metadata.slideshow.slide_type = value
  51942. * },
  51943. * // getter
  51944. * function(cell){ var ns = cell.metadata.slideshow;
  51945. * // if the slideshow namespace does not exist return `undefined`
  51946. * // (will be interpreted as `false` by checkbox) otherwise
  51947. * // return the value
  51948. * return (ns == undefined)? undefined: ns.slide_type
  51949. * }
  51950. * CellToolbar.register_callback('slideshow.select', select_type);
  51951. *
  51952. */
  51953. CellToolbar.utils.select_ui_generator = function(list_list, setter, getter, label) {
  51954. label = label || "";
  51955. return function(div, cell, celltoolbar) {
  51956. var button_container = $(div);
  51957. var lbl = $("<label/>").append($('<span/>').text(label));
  51958. var select = $('<select/>');
  51959. if(!cell.is_editable()){
  51960. select.attr("disabled","disabled")
  51961. }
  51962. for(var i=0; i < list_list.length; i++){
  51963. var opt = $('<option/>')
  51964. .attr('value', list_list[i][1])
  51965. .text(list_list[i][0]);
  51966. select.append(opt);
  51967. }
  51968. select.val(getter(cell));
  51969. select.change(function(){
  51970. setter(cell, select.val());
  51971. });
  51972. button_container.append($('<span/>').append(lbl).append(select));
  51973. };
  51974. };
  51975. // Backwards compatibility.
  51976. IPython.CellToolbar = CellToolbar;
  51977. return {'CellToolbar': CellToolbar};
  51978. });
  51979. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  51980. // Distributed under an MIT license: https://codemirror.net/LICENSE
  51981. (function(mod) {
  51982. if (typeof exports == "object" && typeof module == "object") // CommonJS
  51983. mod(require("../../lib/codemirror"));
  51984. else if (typeof define == "function" && define.amd) // AMD
  51985. define('codemirror/mode/xml/xml',["../../lib/codemirror"], mod);
  51986. else // Plain browser env
  51987. mod(CodeMirror);
  51988. })(function(CodeMirror) {
  51989. "use strict";
  51990. var htmlConfig = {
  51991. autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,
  51992. 'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,
  51993. 'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true,
  51994. 'track': true, 'wbr': true, 'menuitem': true},
  51995. implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true,
  51996. 'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true,
  51997. 'th': true, 'tr': true},
  51998. contextGrabbers: {
  51999. 'dd': {'dd': true, 'dt': true},
  52000. 'dt': {'dd': true, 'dt': true},
  52001. 'li': {'li': true},
  52002. 'option': {'option': true, 'optgroup': true},
  52003. 'optgroup': {'optgroup': true},
  52004. 'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true,
  52005. 'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true,
  52006. 'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true,
  52007. 'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true,
  52008. 'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true},
  52009. 'rp': {'rp': true, 'rt': true},
  52010. 'rt': {'rp': true, 'rt': true},
  52011. 'tbody': {'tbody': true, 'tfoot': true},
  52012. 'td': {'td': true, 'th': true},
  52013. 'tfoot': {'tbody': true},
  52014. 'th': {'td': true, 'th': true},
  52015. 'thead': {'tbody': true, 'tfoot': true},
  52016. 'tr': {'tr': true}
  52017. },
  52018. doNotIndent: {"pre": true},
  52019. allowUnquoted: true,
  52020. allowMissing: true,
  52021. caseFold: true
  52022. }
  52023. var xmlConfig = {
  52024. autoSelfClosers: {},
  52025. implicitlyClosed: {},
  52026. contextGrabbers: {},
  52027. doNotIndent: {},
  52028. allowUnquoted: false,
  52029. allowMissing: false,
  52030. allowMissingTagName: false,
  52031. caseFold: false
  52032. }
  52033. CodeMirror.defineMode("xml", function(editorConf, config_) {
  52034. var indentUnit = editorConf.indentUnit
  52035. var config = {}
  52036. var defaults = config_.htmlMode ? htmlConfig : xmlConfig
  52037. for (var prop in defaults) config[prop] = defaults[prop]
  52038. for (var prop in config_) config[prop] = config_[prop]
  52039. // Return variables for tokenizers
  52040. var type, setStyle;
  52041. function inText(stream, state) {
  52042. function chain(parser) {
  52043. state.tokenize = parser;
  52044. return parser(stream, state);
  52045. }
  52046. var ch = stream.next();
  52047. if (ch == "<") {
  52048. if (stream.eat("!")) {
  52049. if (stream.eat("[")) {
  52050. if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>"));
  52051. else return null;
  52052. } else if (stream.match("--")) {
  52053. return chain(inBlock("comment", "-->"));
  52054. } else if (stream.match("DOCTYPE", true, true)) {
  52055. stream.eatWhile(/[\w\._\-]/);
  52056. return chain(doctype(1));
  52057. } else {
  52058. return null;
  52059. }
  52060. } else if (stream.eat("?")) {
  52061. stream.eatWhile(/[\w\._\-]/);
  52062. state.tokenize = inBlock("meta", "?>");
  52063. return "meta";
  52064. } else {
  52065. type = stream.eat("/") ? "closeTag" : "openTag";
  52066. state.tokenize = inTag;
  52067. return "tag bracket";
  52068. }
  52069. } else if (ch == "&") {
  52070. var ok;
  52071. if (stream.eat("#")) {
  52072. if (stream.eat("x")) {
  52073. ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";");
  52074. } else {
  52075. ok = stream.eatWhile(/[\d]/) && stream.eat(";");
  52076. }
  52077. } else {
  52078. ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";");
  52079. }
  52080. return ok ? "atom" : "error";
  52081. } else {
  52082. stream.eatWhile(/[^&<]/);
  52083. return null;
  52084. }
  52085. }
  52086. inText.isInText = true;
  52087. function inTag(stream, state) {
  52088. var ch = stream.next();
  52089. if (ch == ">" || (ch == "/" && stream.eat(">"))) {
  52090. state.tokenize = inText;
  52091. type = ch == ">" ? "endTag" : "selfcloseTag";
  52092. return "tag bracket";
  52093. } else if (ch == "=") {
  52094. type = "equals";
  52095. return null;
  52096. } else if (ch == "<") {
  52097. state.tokenize = inText;
  52098. state.state = baseState;
  52099. state.tagName = state.tagStart = null;
  52100. var next = state.tokenize(stream, state);
  52101. return next ? next + " tag error" : "tag error";
  52102. } else if (/[\'\"]/.test(ch)) {
  52103. state.tokenize = inAttribute(ch);
  52104. state.stringStartCol = stream.column();
  52105. return state.tokenize(stream, state);
  52106. } else {
  52107. stream.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/);
  52108. return "word";
  52109. }
  52110. }
  52111. function inAttribute(quote) {
  52112. var closure = function(stream, state) {
  52113. while (!stream.eol()) {
  52114. if (stream.next() == quote) {
  52115. state.tokenize = inTag;
  52116. break;
  52117. }
  52118. }
  52119. return "string";
  52120. };
  52121. closure.isInAttribute = true;
  52122. return closure;
  52123. }
  52124. function inBlock(style, terminator) {
  52125. return function(stream, state) {
  52126. while (!stream.eol()) {
  52127. if (stream.match(terminator)) {
  52128. state.tokenize = inText;
  52129. break;
  52130. }
  52131. stream.next();
  52132. }
  52133. return style;
  52134. }
  52135. }
  52136. function doctype(depth) {
  52137. return function(stream, state) {
  52138. var ch;
  52139. while ((ch = stream.next()) != null) {
  52140. if (ch == "<") {
  52141. state.tokenize = doctype(depth + 1);
  52142. return state.tokenize(stream, state);
  52143. } else if (ch == ">") {
  52144. if (depth == 1) {
  52145. state.tokenize = inText;
  52146. break;
  52147. } else {
  52148. state.tokenize = doctype(depth - 1);
  52149. return state.tokenize(stream, state);
  52150. }
  52151. }
  52152. }
  52153. return "meta";
  52154. };
  52155. }
  52156. function Context(state, tagName, startOfLine) {
  52157. this.prev = state.context;
  52158. this.tagName = tagName;
  52159. this.indent = state.indented;
  52160. this.startOfLine = startOfLine;
  52161. if (config.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent))
  52162. this.noIndent = true;
  52163. }
  52164. function popContext(state) {
  52165. if (state.context) state.context = state.context.prev;
  52166. }
  52167. function maybePopContext(state, nextTagName) {
  52168. var parentTagName;
  52169. while (true) {
  52170. if (!state.context) {
  52171. return;
  52172. }
  52173. parentTagName = state.context.tagName;
  52174. if (!config.contextGrabbers.hasOwnProperty(parentTagName) ||
  52175. !config.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {
  52176. return;
  52177. }
  52178. popContext(state);
  52179. }
  52180. }
  52181. function baseState(type, stream, state) {
  52182. if (type == "openTag") {
  52183. state.tagStart = stream.column();
  52184. return tagNameState;
  52185. } else if (type == "closeTag") {
  52186. return closeTagNameState;
  52187. } else {
  52188. return baseState;
  52189. }
  52190. }
  52191. function tagNameState(type, stream, state) {
  52192. if (type == "word") {
  52193. state.tagName = stream.current();
  52194. setStyle = "tag";
  52195. return attrState;
  52196. } else if (config.allowMissingTagName && type == "endTag") {
  52197. setStyle = "tag bracket";
  52198. return attrState(type, stream, state);
  52199. } else {
  52200. setStyle = "error";
  52201. return tagNameState;
  52202. }
  52203. }
  52204. function closeTagNameState(type, stream, state) {
  52205. if (type == "word") {
  52206. var tagName = stream.current();
  52207. if (state.context && state.context.tagName != tagName &&
  52208. config.implicitlyClosed.hasOwnProperty(state.context.tagName))
  52209. popContext(state);
  52210. if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) {
  52211. setStyle = "tag";
  52212. return closeState;
  52213. } else {
  52214. setStyle = "tag error";
  52215. return closeStateErr;
  52216. }
  52217. } else if (config.allowMissingTagName && type == "endTag") {
  52218. setStyle = "tag bracket";
  52219. return closeState(type, stream, state);
  52220. } else {
  52221. setStyle = "error";
  52222. return closeStateErr;
  52223. }
  52224. }
  52225. function closeState(type, _stream, state) {
  52226. if (type != "endTag") {
  52227. setStyle = "error";
  52228. return closeState;
  52229. }
  52230. popContext(state);
  52231. return baseState;
  52232. }
  52233. function closeStateErr(type, stream, state) {
  52234. setStyle = "error";
  52235. return closeState(type, stream, state);
  52236. }
  52237. function attrState(type, _stream, state) {
  52238. if (type == "word") {
  52239. setStyle = "attribute";
  52240. return attrEqState;
  52241. } else if (type == "endTag" || type == "selfcloseTag") {
  52242. var tagName = state.tagName, tagStart = state.tagStart;
  52243. state.tagName = state.tagStart = null;
  52244. if (type == "selfcloseTag" ||
  52245. config.autoSelfClosers.hasOwnProperty(tagName)) {
  52246. maybePopContext(state, tagName);
  52247. } else {
  52248. maybePopContext(state, tagName);
  52249. state.context = new Context(state, tagName, tagStart == state.indented);
  52250. }
  52251. return baseState;
  52252. }
  52253. setStyle = "error";
  52254. return attrState;
  52255. }
  52256. function attrEqState(type, stream, state) {
  52257. if (type == "equals") return attrValueState;
  52258. if (!config.allowMissing) setStyle = "error";
  52259. return attrState(type, stream, state);
  52260. }
  52261. function attrValueState(type, stream, state) {
  52262. if (type == "string") return attrContinuedState;
  52263. if (type == "word" && config.allowUnquoted) {setStyle = "string"; return attrState;}
  52264. setStyle = "error";
  52265. return attrState(type, stream, state);
  52266. }
  52267. function attrContinuedState(type, stream, state) {
  52268. if (type == "string") return attrContinuedState;
  52269. return attrState(type, stream, state);
  52270. }
  52271. return {
  52272. startState: function(baseIndent) {
  52273. var state = {tokenize: inText,
  52274. state: baseState,
  52275. indented: baseIndent || 0,
  52276. tagName: null, tagStart: null,
  52277. context: null}
  52278. if (baseIndent != null) state.baseIndent = baseIndent
  52279. return state
  52280. },
  52281. token: function(stream, state) {
  52282. if (!state.tagName && stream.sol())
  52283. state.indented = stream.indentation();
  52284. if (stream.eatSpace()) return null;
  52285. type = null;
  52286. var style = state.tokenize(stream, state);
  52287. if ((style || type) && style != "comment") {
  52288. setStyle = null;
  52289. state.state = state.state(type || style, stream, state);
  52290. if (setStyle)
  52291. style = setStyle == "error" ? style + " error" : setStyle;
  52292. }
  52293. return style;
  52294. },
  52295. indent: function(state, textAfter, fullLine) {
  52296. var context = state.context;
  52297. // Indent multi-line strings (e.g. css).
  52298. if (state.tokenize.isInAttribute) {
  52299. if (state.tagStart == state.indented)
  52300. return state.stringStartCol + 1;
  52301. else
  52302. return state.indented + indentUnit;
  52303. }
  52304. if (context && context.noIndent) return CodeMirror.Pass;
  52305. if (state.tokenize != inTag && state.tokenize != inText)
  52306. return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
  52307. // Indent the starts of attribute names.
  52308. if (state.tagName) {
  52309. if (config.multilineTagIndentPastTag !== false)
  52310. return state.tagStart + state.tagName.length + 2;
  52311. else
  52312. return state.tagStart + indentUnit * (config.multilineTagIndentFactor || 1);
  52313. }
  52314. if (config.alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
  52315. var tagAfter = textAfter && /^<(\/)?([\w_:\.-]*)/.exec(textAfter);
  52316. if (tagAfter && tagAfter[1]) { // Closing tag spotted
  52317. while (context) {
  52318. if (context.tagName == tagAfter[2]) {
  52319. context = context.prev;
  52320. break;
  52321. } else if (config.implicitlyClosed.hasOwnProperty(context.tagName)) {
  52322. context = context.prev;
  52323. } else {
  52324. break;
  52325. }
  52326. }
  52327. } else if (tagAfter) { // Opening tag spotted
  52328. while (context) {
  52329. var grabbers = config.contextGrabbers[context.tagName];
  52330. if (grabbers && grabbers.hasOwnProperty(tagAfter[2]))
  52331. context = context.prev;
  52332. else
  52333. break;
  52334. }
  52335. }
  52336. while (context && context.prev && !context.startOfLine)
  52337. context = context.prev;
  52338. if (context) return context.indent + indentUnit;
  52339. else return state.baseIndent || 0;
  52340. },
  52341. electricInput: /<\/[\s\w:]+>$/,
  52342. blockCommentStart: "<!--",
  52343. blockCommentEnd: "-->",
  52344. configuration: config.htmlMode ? "html" : "xml",
  52345. helperType: config.htmlMode ? "html" : "xml",
  52346. skipAttribute: function(state) {
  52347. if (state.state == attrValueState)
  52348. state.state = attrState
  52349. },
  52350. xmlCurrentTag: function(state) {
  52351. return state.tagName ? {name: state.tagName, close: state.type == "closeTag"} : null
  52352. },
  52353. xmlCurrentContext: function(state) {
  52354. var context = []
  52355. for (var cx = state.context; cx; cx = cx.prev)
  52356. if (cx.tagName) context.push(cx.tagName)
  52357. return context.reverse()
  52358. }
  52359. };
  52360. });
  52361. CodeMirror.defineMIME("text/xml", "xml");
  52362. CodeMirror.defineMIME("application/xml", "xml");
  52363. if (!CodeMirror.mimeModes.hasOwnProperty("text/html"))
  52364. CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});
  52365. });
  52366. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  52367. // Distributed under an MIT license: https://codemirror.net/LICENSE
  52368. (function(mod) {
  52369. if (typeof exports == "object" && typeof module == "object") // CommonJS
  52370. mod(require("../../lib/codemirror"), require("../xml/xml"), require("../meta"));
  52371. else if (typeof define == "function" && define.amd) // AMD
  52372. define('codemirror/mode/markdown/markdown',["../../lib/codemirror", "../xml/xml", "../meta"], mod);
  52373. else // Plain browser env
  52374. mod(CodeMirror);
  52375. })(function(CodeMirror) {
  52376. "use strict";
  52377. CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
  52378. var htmlMode = CodeMirror.getMode(cmCfg, "text/html");
  52379. var htmlModeMissing = htmlMode.name == "null"
  52380. function getMode(name) {
  52381. if (CodeMirror.findModeByName) {
  52382. var found = CodeMirror.findModeByName(name);
  52383. if (found) name = found.mime || found.mimes[0];
  52384. }
  52385. var mode = CodeMirror.getMode(cmCfg, name);
  52386. return mode.name == "null" ? null : mode;
  52387. }
  52388. // Should characters that affect highlighting be highlighted separate?
  52389. // Does not include characters that will be output (such as `1.` and `-` for lists)
  52390. if (modeCfg.highlightFormatting === undefined)
  52391. modeCfg.highlightFormatting = false;
  52392. // Maximum number of nested blockquotes. Set to 0 for infinite nesting.
  52393. // Excess `>` will emit `error` token.
  52394. if (modeCfg.maxBlockquoteDepth === undefined)
  52395. modeCfg.maxBlockquoteDepth = 0;
  52396. // Turn on task lists? ("- [ ] " and "- [x] ")
  52397. if (modeCfg.taskLists === undefined) modeCfg.taskLists = false;
  52398. // Turn on strikethrough syntax
  52399. if (modeCfg.strikethrough === undefined)
  52400. modeCfg.strikethrough = false;
  52401. if (modeCfg.emoji === undefined)
  52402. modeCfg.emoji = false;
  52403. if (modeCfg.fencedCodeBlockHighlighting === undefined)
  52404. modeCfg.fencedCodeBlockHighlighting = true;
  52405. if (modeCfg.fencedCodeBlockDefaultMode === undefined)
  52406. modeCfg.fencedCodeBlockDefaultMode = 'text/plain';
  52407. if (modeCfg.xml === undefined)
  52408. modeCfg.xml = true;
  52409. // Allow token types to be overridden by user-provided token types.
  52410. if (modeCfg.tokenTypeOverrides === undefined)
  52411. modeCfg.tokenTypeOverrides = {};
  52412. var tokenTypes = {
  52413. header: "header",
  52414. code: "comment",
  52415. quote: "quote",
  52416. list1: "variable-2",
  52417. list2: "variable-3",
  52418. list3: "keyword",
  52419. hr: "hr",
  52420. image: "image",
  52421. imageAltText: "image-alt-text",
  52422. imageMarker: "image-marker",
  52423. formatting: "formatting",
  52424. linkInline: "link",
  52425. linkEmail: "link",
  52426. linkText: "link",
  52427. linkHref: "string",
  52428. em: "em",
  52429. strong: "strong",
  52430. strikethrough: "strikethrough",
  52431. emoji: "builtin"
  52432. };
  52433. for (var tokenType in tokenTypes) {
  52434. if (tokenTypes.hasOwnProperty(tokenType) && modeCfg.tokenTypeOverrides[tokenType]) {
  52435. tokenTypes[tokenType] = modeCfg.tokenTypeOverrides[tokenType];
  52436. }
  52437. }
  52438. var hrRE = /^([*\-_])(?:\s*\1){2,}\s*$/
  52439. , listRE = /^(?:[*\-+]|^[0-9]+([.)]))\s+/
  52440. , taskListRE = /^\[(x| )\](?=\s)/i // Must follow listRE
  52441. , atxHeaderRE = modeCfg.allowAtxHeaderWithoutSpace ? /^(#+)/ : /^(#+)(?: |$)/
  52442. , setextHeaderRE = /^ {0,3}(?:\={1,}|-{2,})\s*$/
  52443. , textRE = /^[^#!\[\]*_\\<>` "'(~:]+/
  52444. , fencedCodeRE = /^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/
  52445. , linkDefRE = /^\s*\[[^\]]+?\]:.*$/ // naive link-definition
  52446. , punctuation = /[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/
  52447. , expandedTab = " " // CommonMark specifies tab as 4 spaces
  52448. function switchInline(stream, state, f) {
  52449. state.f = state.inline = f;
  52450. return f(stream, state);
  52451. }
  52452. function switchBlock(stream, state, f) {
  52453. state.f = state.block = f;
  52454. return f(stream, state);
  52455. }
  52456. function lineIsEmpty(line) {
  52457. return !line || !/\S/.test(line.string)
  52458. }
  52459. // Blocks
  52460. function blankLine(state) {
  52461. // Reset linkTitle state
  52462. state.linkTitle = false;
  52463. state.linkHref = false;
  52464. state.linkText = false;
  52465. // Reset EM state
  52466. state.em = false;
  52467. // Reset STRONG state
  52468. state.strong = false;
  52469. // Reset strikethrough state
  52470. state.strikethrough = false;
  52471. // Reset state.quote
  52472. state.quote = 0;
  52473. // Reset state.indentedCode
  52474. state.indentedCode = false;
  52475. if (state.f == htmlBlock) {
  52476. var exit = htmlModeMissing
  52477. if (!exit) {
  52478. var inner = CodeMirror.innerMode(htmlMode, state.htmlState)
  52479. exit = inner.mode.name == "xml" && inner.state.tagStart === null &&
  52480. (!inner.state.context && inner.state.tokenize.isInText)
  52481. }
  52482. if (exit) {
  52483. state.f = inlineNormal;
  52484. state.block = blockNormal;
  52485. state.htmlState = null;
  52486. }
  52487. }
  52488. // Reset state.trailingSpace
  52489. state.trailingSpace = 0;
  52490. state.trailingSpaceNewLine = false;
  52491. // Mark this line as blank
  52492. state.prevLine = state.thisLine
  52493. state.thisLine = {stream: null}
  52494. return null;
  52495. }
  52496. function blockNormal(stream, state) {
  52497. var firstTokenOnLine = stream.column() === state.indentation;
  52498. var prevLineLineIsEmpty = lineIsEmpty(state.prevLine.stream);
  52499. var prevLineIsIndentedCode = state.indentedCode;
  52500. var prevLineIsHr = state.prevLine.hr;
  52501. var prevLineIsList = state.list !== false;
  52502. var maxNonCodeIndentation = (state.listStack[state.listStack.length - 1] || 0) + 3;
  52503. state.indentedCode = false;
  52504. var lineIndentation = state.indentation;
  52505. // compute once per line (on first token)
  52506. if (state.indentationDiff === null) {
  52507. state.indentationDiff = state.indentation;
  52508. if (prevLineIsList) {
  52509. state.list = null;
  52510. // While this list item's marker's indentation is less than the deepest
  52511. // list item's content's indentation,pop the deepest list item
  52512. // indentation off the stack, and update block indentation state
  52513. while (lineIndentation < state.listStack[state.listStack.length - 1]) {
  52514. state.listStack.pop();
  52515. if (state.listStack.length) {
  52516. state.indentation = state.listStack[state.listStack.length - 1];
  52517. // less than the first list's indent -> the line is no longer a list
  52518. } else {
  52519. state.list = false;
  52520. }
  52521. }
  52522. if (state.list !== false) {
  52523. state.indentationDiff = lineIndentation - state.listStack[state.listStack.length - 1]
  52524. }
  52525. }
  52526. }
  52527. // not comprehensive (currently only for setext detection purposes)
  52528. var allowsInlineContinuation = (
  52529. !prevLineLineIsEmpty && !prevLineIsHr && !state.prevLine.header &&
  52530. (!prevLineIsList || !prevLineIsIndentedCode) &&
  52531. !state.prevLine.fencedCodeEnd
  52532. );
  52533. var isHr = (state.list === false || prevLineIsHr || prevLineLineIsEmpty) &&
  52534. state.indentation <= maxNonCodeIndentation && stream.match(hrRE);
  52535. var match = null;
  52536. if (state.indentationDiff >= 4 && (prevLineIsIndentedCode || state.prevLine.fencedCodeEnd ||
  52537. state.prevLine.header || prevLineLineIsEmpty)) {
  52538. stream.skipToEnd();
  52539. state.indentedCode = true;
  52540. return tokenTypes.code;
  52541. } else if (stream.eatSpace()) {
  52542. return null;
  52543. } else if (firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(atxHeaderRE)) && match[1].length <= 6) {
  52544. state.quote = 0;
  52545. state.header = match[1].length;
  52546. state.thisLine.header = true;
  52547. if (modeCfg.highlightFormatting) state.formatting = "header";
  52548. state.f = state.inline;
  52549. return getType(state);
  52550. } else if (state.indentation <= maxNonCodeIndentation && stream.eat('>')) {
  52551. state.quote = firstTokenOnLine ? 1 : state.quote + 1;
  52552. if (modeCfg.highlightFormatting) state.formatting = "quote";
  52553. stream.eatSpace();
  52554. return getType(state);
  52555. } else if (!isHr && !state.setext && firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(listRE))) {
  52556. var listType = match[1] ? "ol" : "ul";
  52557. state.indentation = lineIndentation + stream.current().length;
  52558. state.list = true;
  52559. state.quote = 0;
  52560. // Add this list item's content's indentation to the stack
  52561. state.listStack.push(state.indentation);
  52562. // Reset inline styles which shouldn't propagate aross list items
  52563. state.em = false;
  52564. state.strong = false;
  52565. state.code = false;
  52566. state.strikethrough = false;
  52567. if (modeCfg.taskLists && stream.match(taskListRE, false)) {
  52568. state.taskList = true;
  52569. }
  52570. state.f = state.inline;
  52571. if (modeCfg.highlightFormatting) state.formatting = ["list", "list-" + listType];
  52572. return getType(state);
  52573. } else if (firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(fencedCodeRE, true))) {
  52574. state.quote = 0;
  52575. state.fencedEndRE = new RegExp(match[1] + "+ *$");
  52576. // try switching mode
  52577. state.localMode = modeCfg.fencedCodeBlockHighlighting && getMode(match[2] || modeCfg.fencedCodeBlockDefaultMode );
  52578. if (state.localMode) state.localState = CodeMirror.startState(state.localMode);
  52579. state.f = state.block = local;
  52580. if (modeCfg.highlightFormatting) state.formatting = "code-block";
  52581. state.code = -1
  52582. return getType(state);
  52583. // SETEXT has lowest block-scope precedence after HR, so check it after
  52584. // the others (code, blockquote, list...)
  52585. } else if (
  52586. // if setext set, indicates line after ---/===
  52587. state.setext || (
  52588. // line before ---/===
  52589. (!allowsInlineContinuation || !prevLineIsList) && !state.quote && state.list === false &&
  52590. !state.code && !isHr && !linkDefRE.test(stream.string) &&
  52591. (match = stream.lookAhead(1)) && (match = match.match(setextHeaderRE))
  52592. )
  52593. ) {
  52594. if ( !state.setext ) {
  52595. state.header = match[0].charAt(0) == '=' ? 1 : 2;
  52596. state.setext = state.header;
  52597. } else {
  52598. state.header = state.setext;
  52599. // has no effect on type so we can reset it now
  52600. state.setext = 0;
  52601. stream.skipToEnd();
  52602. if (modeCfg.highlightFormatting) state.formatting = "header";
  52603. }
  52604. state.thisLine.header = true;
  52605. state.f = state.inline;
  52606. return getType(state);
  52607. } else if (isHr) {
  52608. stream.skipToEnd();
  52609. state.hr = true;
  52610. state.thisLine.hr = true;
  52611. return tokenTypes.hr;
  52612. } else if (stream.peek() === '[') {
  52613. return switchInline(stream, state, footnoteLink);
  52614. }
  52615. return switchInline(stream, state, state.inline);
  52616. }
  52617. function htmlBlock(stream, state) {
  52618. var style = htmlMode.token(stream, state.htmlState);
  52619. if (!htmlModeMissing) {
  52620. var inner = CodeMirror.innerMode(htmlMode, state.htmlState)
  52621. if ((inner.mode.name == "xml" && inner.state.tagStart === null &&
  52622. (!inner.state.context && inner.state.tokenize.isInText)) ||
  52623. (state.md_inside && stream.current().indexOf(">") > -1)) {
  52624. state.f = inlineNormal;
  52625. state.block = blockNormal;
  52626. state.htmlState = null;
  52627. }
  52628. }
  52629. return style;
  52630. }
  52631. function local(stream, state) {
  52632. var currListInd = state.listStack[state.listStack.length - 1] || 0;
  52633. var hasExitedList = state.indentation < currListInd;
  52634. var maxFencedEndInd = currListInd + 3;
  52635. if (state.fencedEndRE && state.indentation <= maxFencedEndInd && (hasExitedList || stream.match(state.fencedEndRE))) {
  52636. if (modeCfg.highlightFormatting) state.formatting = "code-block";
  52637. var returnType;
  52638. if (!hasExitedList) returnType = getType(state)
  52639. state.localMode = state.localState = null;
  52640. state.block = blockNormal;
  52641. state.f = inlineNormal;
  52642. state.fencedEndRE = null;
  52643. state.code = 0
  52644. state.thisLine.fencedCodeEnd = true;
  52645. if (hasExitedList) return switchBlock(stream, state, state.block);
  52646. return returnType;
  52647. } else if (state.localMode) {
  52648. return state.localMode.token(stream, state.localState);
  52649. } else {
  52650. stream.skipToEnd();
  52651. return tokenTypes.code;
  52652. }
  52653. }
  52654. // Inline
  52655. function getType(state) {
  52656. var styles = [];
  52657. if (state.formatting) {
  52658. styles.push(tokenTypes.formatting);
  52659. if (typeof state.formatting === "string") state.formatting = [state.formatting];
  52660. for (var i = 0; i < state.formatting.length; i++) {
  52661. styles.push(tokenTypes.formatting + "-" + state.formatting[i]);
  52662. if (state.formatting[i] === "header") {
  52663. styles.push(tokenTypes.formatting + "-" + state.formatting[i] + "-" + state.header);
  52664. }
  52665. // Add `formatting-quote` and `formatting-quote-#` for blockquotes
  52666. // Add `error` instead if the maximum blockquote nesting depth is passed
  52667. if (state.formatting[i] === "quote") {
  52668. if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
  52669. styles.push(tokenTypes.formatting + "-" + state.formatting[i] + "-" + state.quote);
  52670. } else {
  52671. styles.push("error");
  52672. }
  52673. }
  52674. }
  52675. }
  52676. if (state.taskOpen) {
  52677. styles.push("meta");
  52678. return styles.length ? styles.join(' ') : null;
  52679. }
  52680. if (state.taskClosed) {
  52681. styles.push("property");
  52682. return styles.length ? styles.join(' ') : null;
  52683. }
  52684. if (state.linkHref) {
  52685. styles.push(tokenTypes.linkHref, "url");
  52686. } else { // Only apply inline styles to non-url text
  52687. if (state.strong) { styles.push(tokenTypes.strong); }
  52688. if (state.em) { styles.push(tokenTypes.em); }
  52689. if (state.strikethrough) { styles.push(tokenTypes.strikethrough); }
  52690. if (state.emoji) { styles.push(tokenTypes.emoji); }
  52691. if (state.linkText) { styles.push(tokenTypes.linkText); }
  52692. if (state.code) { styles.push(tokenTypes.code); }
  52693. if (state.image) { styles.push(tokenTypes.image); }
  52694. if (state.imageAltText) { styles.push(tokenTypes.imageAltText, "link"); }
  52695. if (state.imageMarker) { styles.push(tokenTypes.imageMarker); }
  52696. }
  52697. if (state.header) { styles.push(tokenTypes.header, tokenTypes.header + "-" + state.header); }
  52698. if (state.quote) {
  52699. styles.push(tokenTypes.quote);
  52700. // Add `quote-#` where the maximum for `#` is modeCfg.maxBlockquoteDepth
  52701. if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
  52702. styles.push(tokenTypes.quote + "-" + state.quote);
  52703. } else {
  52704. styles.push(tokenTypes.quote + "-" + modeCfg.maxBlockquoteDepth);
  52705. }
  52706. }
  52707. if (state.list !== false) {
  52708. var listMod = (state.listStack.length - 1) % 3;
  52709. if (!listMod) {
  52710. styles.push(tokenTypes.list1);
  52711. } else if (listMod === 1) {
  52712. styles.push(tokenTypes.list2);
  52713. } else {
  52714. styles.push(tokenTypes.list3);
  52715. }
  52716. }
  52717. if (state.trailingSpaceNewLine) {
  52718. styles.push("trailing-space-new-line");
  52719. } else if (state.trailingSpace) {
  52720. styles.push("trailing-space-" + (state.trailingSpace % 2 ? "a" : "b"));
  52721. }
  52722. return styles.length ? styles.join(' ') : null;
  52723. }
  52724. function handleText(stream, state) {
  52725. if (stream.match(textRE, true)) {
  52726. return getType(state);
  52727. }
  52728. return undefined;
  52729. }
  52730. function inlineNormal(stream, state) {
  52731. var style = state.text(stream, state);
  52732. if (typeof style !== 'undefined')
  52733. return style;
  52734. if (state.list) { // List marker (*, +, -, 1., etc)
  52735. state.list = null;
  52736. return getType(state);
  52737. }
  52738. if (state.taskList) {
  52739. var taskOpen = stream.match(taskListRE, true)[1] === " ";
  52740. if (taskOpen) state.taskOpen = true;
  52741. else state.taskClosed = true;
  52742. if (modeCfg.highlightFormatting) state.formatting = "task";
  52743. state.taskList = false;
  52744. return getType(state);
  52745. }
  52746. state.taskOpen = false;
  52747. state.taskClosed = false;
  52748. if (state.header && stream.match(/^#+$/, true)) {
  52749. if (modeCfg.highlightFormatting) state.formatting = "header";
  52750. return getType(state);
  52751. }
  52752. var ch = stream.next();
  52753. // Matches link titles present on next line
  52754. if (state.linkTitle) {
  52755. state.linkTitle = false;
  52756. var matchCh = ch;
  52757. if (ch === '(') {
  52758. matchCh = ')';
  52759. }
  52760. matchCh = (matchCh+'').replace(/([.?*+^\[\]\\(){}|-])/g, "\\$1");
  52761. var regex = '^\\s*(?:[^' + matchCh + '\\\\]+|\\\\\\\\|\\\\.)' + matchCh;
  52762. if (stream.match(new RegExp(regex), true)) {
  52763. return tokenTypes.linkHref;
  52764. }
  52765. }
  52766. // If this block is changed, it may need to be updated in GFM mode
  52767. if (ch === '`') {
  52768. var previousFormatting = state.formatting;
  52769. if (modeCfg.highlightFormatting) state.formatting = "code";
  52770. stream.eatWhile('`');
  52771. var count = stream.current().length
  52772. if (state.code == 0 && (!state.quote || count == 1)) {
  52773. state.code = count
  52774. return getType(state)
  52775. } else if (count == state.code) { // Must be exact
  52776. var t = getType(state)
  52777. state.code = 0
  52778. return t
  52779. } else {
  52780. state.formatting = previousFormatting
  52781. return getType(state)
  52782. }
  52783. } else if (state.code) {
  52784. return getType(state);
  52785. }
  52786. if (ch === '\\') {
  52787. stream.next();
  52788. if (modeCfg.highlightFormatting) {
  52789. var type = getType(state);
  52790. var formattingEscape = tokenTypes.formatting + "-escape";
  52791. return type ? type + " " + formattingEscape : formattingEscape;
  52792. }
  52793. }
  52794. if (ch === '!' && stream.match(/\[[^\]]*\] ?(?:\(|\[)/, false)) {
  52795. state.imageMarker = true;
  52796. state.image = true;
  52797. if (modeCfg.highlightFormatting) state.formatting = "image";
  52798. return getType(state);
  52799. }
  52800. if (ch === '[' && state.imageMarker && stream.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/, false)) {
  52801. state.imageMarker = false;
  52802. state.imageAltText = true
  52803. if (modeCfg.highlightFormatting) state.formatting = "image";
  52804. return getType(state);
  52805. }
  52806. if (ch === ']' && state.imageAltText) {
  52807. if (modeCfg.highlightFormatting) state.formatting = "image";
  52808. var type = getType(state);
  52809. state.imageAltText = false;
  52810. state.image = false;
  52811. state.inline = state.f = linkHref;
  52812. return type;
  52813. }
  52814. if (ch === '[' && !state.image) {
  52815. if (state.linkText && stream.match(/^.*?\]/)) return getType(state)
  52816. state.linkText = true;
  52817. if (modeCfg.highlightFormatting) state.formatting = "link";
  52818. return getType(state);
  52819. }
  52820. if (ch === ']' && state.linkText) {
  52821. if (modeCfg.highlightFormatting) state.formatting = "link";
  52822. var type = getType(state);
  52823. state.linkText = false;
  52824. state.inline = state.f = stream.match(/\(.*?\)| ?\[.*?\]/, false) ? linkHref : inlineNormal
  52825. return type;
  52826. }
  52827. if (ch === '<' && stream.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/, false)) {
  52828. state.f = state.inline = linkInline;
  52829. if (modeCfg.highlightFormatting) state.formatting = "link";
  52830. var type = getType(state);
  52831. if (type){
  52832. type += " ";
  52833. } else {
  52834. type = "";
  52835. }
  52836. return type + tokenTypes.linkInline;
  52837. }
  52838. if (ch === '<' && stream.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/, false)) {
  52839. state.f = state.inline = linkInline;
  52840. if (modeCfg.highlightFormatting) state.formatting = "link";
  52841. var type = getType(state);
  52842. if (type){
  52843. type += " ";
  52844. } else {
  52845. type = "";
  52846. }
  52847. return type + tokenTypes.linkEmail;
  52848. }
  52849. if (modeCfg.xml && ch === '<' && stream.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i, false)) {
  52850. var end = stream.string.indexOf(">", stream.pos);
  52851. if (end != -1) {
  52852. var atts = stream.string.substring(stream.start, end);
  52853. if (/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(atts)) state.md_inside = true;
  52854. }
  52855. stream.backUp(1);
  52856. state.htmlState = CodeMirror.startState(htmlMode);
  52857. return switchBlock(stream, state, htmlBlock);
  52858. }
  52859. if (modeCfg.xml && ch === '<' && stream.match(/^\/\w*?>/)) {
  52860. state.md_inside = false;
  52861. return "tag";
  52862. } else if (ch === "*" || ch === "_") {
  52863. var len = 1, before = stream.pos == 1 ? " " : stream.string.charAt(stream.pos - 2)
  52864. while (len < 3 && stream.eat(ch)) len++
  52865. var after = stream.peek() || " "
  52866. // See http://spec.commonmark.org/0.27/#emphasis-and-strong-emphasis
  52867. var leftFlanking = !/\s/.test(after) && (!punctuation.test(after) || /\s/.test(before) || punctuation.test(before))
  52868. var rightFlanking = !/\s/.test(before) && (!punctuation.test(before) || /\s/.test(after) || punctuation.test(after))
  52869. var setEm = null, setStrong = null
  52870. if (len % 2) { // Em
  52871. if (!state.em && leftFlanking && (ch === "*" || !rightFlanking || punctuation.test(before)))
  52872. setEm = true
  52873. else if (state.em == ch && rightFlanking && (ch === "*" || !leftFlanking || punctuation.test(after)))
  52874. setEm = false
  52875. }
  52876. if (len > 1) { // Strong
  52877. if (!state.strong && leftFlanking && (ch === "*" || !rightFlanking || punctuation.test(before)))
  52878. setStrong = true
  52879. else if (state.strong == ch && rightFlanking && (ch === "*" || !leftFlanking || punctuation.test(after)))
  52880. setStrong = false
  52881. }
  52882. if (setStrong != null || setEm != null) {
  52883. if (modeCfg.highlightFormatting) state.formatting = setEm == null ? "strong" : setStrong == null ? "em" : "strong em"
  52884. if (setEm === true) state.em = ch
  52885. if (setStrong === true) state.strong = ch
  52886. var t = getType(state)
  52887. if (setEm === false) state.em = false
  52888. if (setStrong === false) state.strong = false
  52889. return t
  52890. }
  52891. } else if (ch === ' ') {
  52892. if (stream.eat('*') || stream.eat('_')) { // Probably surrounded by spaces
  52893. if (stream.peek() === ' ') { // Surrounded by spaces, ignore
  52894. return getType(state);
  52895. } else { // Not surrounded by spaces, back up pointer
  52896. stream.backUp(1);
  52897. }
  52898. }
  52899. }
  52900. if (modeCfg.strikethrough) {
  52901. if (ch === '~' && stream.eatWhile(ch)) {
  52902. if (state.strikethrough) {// Remove strikethrough
  52903. if (modeCfg.highlightFormatting) state.formatting = "strikethrough";
  52904. var t = getType(state);
  52905. state.strikethrough = false;
  52906. return t;
  52907. } else if (stream.match(/^[^\s]/, false)) {// Add strikethrough
  52908. state.strikethrough = true;
  52909. if (modeCfg.highlightFormatting) state.formatting = "strikethrough";
  52910. return getType(state);
  52911. }
  52912. } else if (ch === ' ') {
  52913. if (stream.match(/^~~/, true)) { // Probably surrounded by space
  52914. if (stream.peek() === ' ') { // Surrounded by spaces, ignore
  52915. return getType(state);
  52916. } else { // Not surrounded by spaces, back up pointer
  52917. stream.backUp(2);
  52918. }
  52919. }
  52920. }
  52921. }
  52922. if (modeCfg.emoji && ch === ":" && stream.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)) {
  52923. state.emoji = true;
  52924. if (modeCfg.highlightFormatting) state.formatting = "emoji";
  52925. var retType = getType(state);
  52926. state.emoji = false;
  52927. return retType;
  52928. }
  52929. if (ch === ' ') {
  52930. if (stream.match(/^ +$/, false)) {
  52931. state.trailingSpace++;
  52932. } else if (state.trailingSpace) {
  52933. state.trailingSpaceNewLine = true;
  52934. }
  52935. }
  52936. return getType(state);
  52937. }
  52938. function linkInline(stream, state) {
  52939. var ch = stream.next();
  52940. if (ch === ">") {
  52941. state.f = state.inline = inlineNormal;
  52942. if (modeCfg.highlightFormatting) state.formatting = "link";
  52943. var type = getType(state);
  52944. if (type){
  52945. type += " ";
  52946. } else {
  52947. type = "";
  52948. }
  52949. return type + tokenTypes.linkInline;
  52950. }
  52951. stream.match(/^[^>]+/, true);
  52952. return tokenTypes.linkInline;
  52953. }
  52954. function linkHref(stream, state) {
  52955. // Check if space, and return NULL if so (to avoid marking the space)
  52956. if(stream.eatSpace()){
  52957. return null;
  52958. }
  52959. var ch = stream.next();
  52960. if (ch === '(' || ch === '[') {
  52961. state.f = state.inline = getLinkHrefInside(ch === "(" ? ")" : "]");
  52962. if (modeCfg.highlightFormatting) state.formatting = "link-string";
  52963. state.linkHref = true;
  52964. return getType(state);
  52965. }
  52966. return 'error';
  52967. }
  52968. var linkRE = {
  52969. ")": /^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,
  52970. "]": /^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/
  52971. }
  52972. function getLinkHrefInside(endChar) {
  52973. return function(stream, state) {
  52974. var ch = stream.next();
  52975. if (ch === endChar) {
  52976. state.f = state.inline = inlineNormal;
  52977. if (modeCfg.highlightFormatting) state.formatting = "link-string";
  52978. var returnState = getType(state);
  52979. state.linkHref = false;
  52980. return returnState;
  52981. }
  52982. stream.match(linkRE[endChar])
  52983. state.linkHref = true;
  52984. return getType(state);
  52985. };
  52986. }
  52987. function footnoteLink(stream, state) {
  52988. if (stream.match(/^([^\]\\]|\\.)*\]:/, false)) {
  52989. state.f = footnoteLinkInside;
  52990. stream.next(); // Consume [
  52991. if (modeCfg.highlightFormatting) state.formatting = "link";
  52992. state.linkText = true;
  52993. return getType(state);
  52994. }
  52995. return switchInline(stream, state, inlineNormal);
  52996. }
  52997. function footnoteLinkInside(stream, state) {
  52998. if (stream.match(/^\]:/, true)) {
  52999. state.f = state.inline = footnoteUrl;
  53000. if (modeCfg.highlightFormatting) state.formatting = "link";
  53001. var returnType = getType(state);
  53002. state.linkText = false;
  53003. return returnType;
  53004. }
  53005. stream.match(/^([^\]\\]|\\.)+/, true);
  53006. return tokenTypes.linkText;
  53007. }
  53008. function footnoteUrl(stream, state) {
  53009. // Check if space, and return NULL if so (to avoid marking the space)
  53010. if(stream.eatSpace()){
  53011. return null;
  53012. }
  53013. // Match URL
  53014. stream.match(/^[^\s]+/, true);
  53015. // Check for link title
  53016. if (stream.peek() === undefined) { // End of line, set flag to check next line
  53017. state.linkTitle = true;
  53018. } else { // More content on line, check if link title
  53019. stream.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/, true);
  53020. }
  53021. state.f = state.inline = inlineNormal;
  53022. return tokenTypes.linkHref + " url";
  53023. }
  53024. var mode = {
  53025. startState: function() {
  53026. return {
  53027. f: blockNormal,
  53028. prevLine: {stream: null},
  53029. thisLine: {stream: null},
  53030. block: blockNormal,
  53031. htmlState: null,
  53032. indentation: 0,
  53033. inline: inlineNormal,
  53034. text: handleText,
  53035. formatting: false,
  53036. linkText: false,
  53037. linkHref: false,
  53038. linkTitle: false,
  53039. code: 0,
  53040. em: false,
  53041. strong: false,
  53042. header: 0,
  53043. setext: 0,
  53044. hr: false,
  53045. taskList: false,
  53046. list: false,
  53047. listStack: [],
  53048. quote: 0,
  53049. trailingSpace: 0,
  53050. trailingSpaceNewLine: false,
  53051. strikethrough: false,
  53052. emoji: false,
  53053. fencedEndRE: null
  53054. };
  53055. },
  53056. copyState: function(s) {
  53057. return {
  53058. f: s.f,
  53059. prevLine: s.prevLine,
  53060. thisLine: s.thisLine,
  53061. block: s.block,
  53062. htmlState: s.htmlState && CodeMirror.copyState(htmlMode, s.htmlState),
  53063. indentation: s.indentation,
  53064. localMode: s.localMode,
  53065. localState: s.localMode ? CodeMirror.copyState(s.localMode, s.localState) : null,
  53066. inline: s.inline,
  53067. text: s.text,
  53068. formatting: false,
  53069. linkText: s.linkText,
  53070. linkTitle: s.linkTitle,
  53071. linkHref: s.linkHref,
  53072. code: s.code,
  53073. em: s.em,
  53074. strong: s.strong,
  53075. strikethrough: s.strikethrough,
  53076. emoji: s.emoji,
  53077. header: s.header,
  53078. setext: s.setext,
  53079. hr: s.hr,
  53080. taskList: s.taskList,
  53081. list: s.list,
  53082. listStack: s.listStack.slice(0),
  53083. quote: s.quote,
  53084. indentedCode: s.indentedCode,
  53085. trailingSpace: s.trailingSpace,
  53086. trailingSpaceNewLine: s.trailingSpaceNewLine,
  53087. md_inside: s.md_inside,
  53088. fencedEndRE: s.fencedEndRE
  53089. };
  53090. },
  53091. token: function(stream, state) {
  53092. // Reset state.formatting
  53093. state.formatting = false;
  53094. if (stream != state.thisLine.stream) {
  53095. state.header = 0;
  53096. state.hr = false;
  53097. if (stream.match(/^\s*$/, true)) {
  53098. blankLine(state);
  53099. return null;
  53100. }
  53101. state.prevLine = state.thisLine
  53102. state.thisLine = {stream: stream}
  53103. // Reset state.taskList
  53104. state.taskList = false;
  53105. // Reset state.trailingSpace
  53106. state.trailingSpace = 0;
  53107. state.trailingSpaceNewLine = false;
  53108. if (!state.localState) {
  53109. state.f = state.block;
  53110. if (state.f != htmlBlock) {
  53111. var indentation = stream.match(/^\s*/, true)[0].replace(/\t/g, expandedTab).length;
  53112. state.indentation = indentation;
  53113. state.indentationDiff = null;
  53114. if (indentation > 0) return null;
  53115. }
  53116. }
  53117. }
  53118. return state.f(stream, state);
  53119. },
  53120. innerMode: function(state) {
  53121. if (state.block == htmlBlock) return {state: state.htmlState, mode: htmlMode};
  53122. if (state.localState) return {state: state.localState, mode: state.localMode};
  53123. return {state: state, mode: mode};
  53124. },
  53125. indent: function(state, textAfter, line) {
  53126. if (state.block == htmlBlock && htmlMode.indent) return htmlMode.indent(state.htmlState, textAfter, line)
  53127. if (state.localState && state.localMode.indent) return state.localMode.indent(state.localState, textAfter, line)
  53128. return CodeMirror.Pass
  53129. },
  53130. blankLine: blankLine,
  53131. getType: getType,
  53132. blockCommentStart: "<!--",
  53133. blockCommentEnd: "-->",
  53134. closeBrackets: "()[]{}''\"\"``",
  53135. fold: "markdown"
  53136. };
  53137. return mode;
  53138. }, "xml");
  53139. CodeMirror.defineMIME("text/markdown", "markdown");
  53140. CodeMirror.defineMIME("text/x-markdown", "markdown");
  53141. });
  53142. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  53143. // Distributed under an MIT license: https://codemirror.net/LICENSE
  53144. // Utility function that allows modes to be combined. The mode given
  53145. // as the base argument takes care of most of the normal mode
  53146. // functionality, but a second (typically simple) mode is used, which
  53147. // can override the style of text. Both modes get to parse all of the
  53148. // text, but when both assign a non-null style to a piece of code, the
  53149. // overlay wins, unless the combine argument was true and not overridden,
  53150. // or state.overlay.combineTokens was true, in which case the styles are
  53151. // combined.
  53152. (function(mod) {
  53153. if (typeof exports == "object" && typeof module == "object") // CommonJS
  53154. mod(require("../../lib/codemirror"));
  53155. else if (typeof define == "function" && define.amd) // AMD
  53156. define('codemirror/addon/mode/overlay',["../../lib/codemirror"], mod);
  53157. else // Plain browser env
  53158. mod(CodeMirror);
  53159. })(function(CodeMirror) {
  53160. "use strict";
  53161. CodeMirror.overlayMode = function(base, overlay, combine) {
  53162. return {
  53163. startState: function() {
  53164. return {
  53165. base: CodeMirror.startState(base),
  53166. overlay: CodeMirror.startState(overlay),
  53167. basePos: 0, baseCur: null,
  53168. overlayPos: 0, overlayCur: null,
  53169. streamSeen: null
  53170. };
  53171. },
  53172. copyState: function(state) {
  53173. return {
  53174. base: CodeMirror.copyState(base, state.base),
  53175. overlay: CodeMirror.copyState(overlay, state.overlay),
  53176. basePos: state.basePos, baseCur: null,
  53177. overlayPos: state.overlayPos, overlayCur: null
  53178. };
  53179. },
  53180. token: function(stream, state) {
  53181. if (stream != state.streamSeen ||
  53182. Math.min(state.basePos, state.overlayPos) < stream.start) {
  53183. state.streamSeen = stream;
  53184. state.basePos = state.overlayPos = stream.start;
  53185. }
  53186. if (stream.start == state.basePos) {
  53187. state.baseCur = base.token(stream, state.base);
  53188. state.basePos = stream.pos;
  53189. }
  53190. if (stream.start == state.overlayPos) {
  53191. stream.pos = stream.start;
  53192. state.overlayCur = overlay.token(stream, state.overlay);
  53193. state.overlayPos = stream.pos;
  53194. }
  53195. stream.pos = Math.min(state.basePos, state.overlayPos);
  53196. // state.overlay.combineTokens always takes precedence over combine,
  53197. // unless set to null
  53198. if (state.overlayCur == null) return state.baseCur;
  53199. else if (state.baseCur != null &&
  53200. state.overlay.combineTokens ||
  53201. combine && state.overlay.combineTokens == null)
  53202. return state.baseCur + " " + state.overlayCur;
  53203. else return state.overlayCur;
  53204. },
  53205. indent: base.indent && function(state, textAfter, line) {
  53206. return base.indent(state.base, textAfter, line);
  53207. },
  53208. electricChars: base.electricChars,
  53209. innerMode: function(state) { return {state: state.base, mode: base}; },
  53210. blankLine: function(state) {
  53211. var baseToken, overlayToken;
  53212. if (base.blankLine) baseToken = base.blankLine(state.base);
  53213. if (overlay.blankLine) overlayToken = overlay.blankLine(state.overlay);
  53214. return overlayToken == null ?
  53215. baseToken :
  53216. (combine && baseToken != null ? baseToken + " " + overlayToken : overlayToken);
  53217. }
  53218. };
  53219. };
  53220. });
  53221. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  53222. // Distributed under an MIT license: https://codemirror.net/LICENSE
  53223. (function(mod) {
  53224. if (typeof exports == "object" && typeof module == "object") // CommonJS
  53225. mod(require("../../lib/codemirror"), require("../markdown/markdown"), require("../../addon/mode/overlay"));
  53226. else if (typeof define == "function" && define.amd) // AMD
  53227. define('codemirror/mode/gfm/gfm',["../../lib/codemirror", "../markdown/markdown", "../../addon/mode/overlay"], mod);
  53228. else // Plain browser env
  53229. mod(CodeMirror);
  53230. })(function(CodeMirror) {
  53231. "use strict";
  53232. var urlRE = /^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i
  53233. CodeMirror.defineMode("gfm", function(config, modeConfig) {
  53234. var codeDepth = 0;
  53235. function blankLine(state) {
  53236. state.code = false;
  53237. return null;
  53238. }
  53239. var gfmOverlay = {
  53240. startState: function() {
  53241. return {
  53242. code: false,
  53243. codeBlock: false,
  53244. ateSpace: false
  53245. };
  53246. },
  53247. copyState: function(s) {
  53248. return {
  53249. code: s.code,
  53250. codeBlock: s.codeBlock,
  53251. ateSpace: s.ateSpace
  53252. };
  53253. },
  53254. token: function(stream, state) {
  53255. state.combineTokens = null;
  53256. // Hack to prevent formatting override inside code blocks (block and inline)
  53257. if (state.codeBlock) {
  53258. if (stream.match(/^```+/)) {
  53259. state.codeBlock = false;
  53260. return null;
  53261. }
  53262. stream.skipToEnd();
  53263. return null;
  53264. }
  53265. if (stream.sol()) {
  53266. state.code = false;
  53267. }
  53268. if (stream.sol() && stream.match(/^```+/)) {
  53269. stream.skipToEnd();
  53270. state.codeBlock = true;
  53271. return null;
  53272. }
  53273. // If this block is changed, it may need to be updated in Markdown mode
  53274. if (stream.peek() === '`') {
  53275. stream.next();
  53276. var before = stream.pos;
  53277. stream.eatWhile('`');
  53278. var difference = 1 + stream.pos - before;
  53279. if (!state.code) {
  53280. codeDepth = difference;
  53281. state.code = true;
  53282. } else {
  53283. if (difference === codeDepth) { // Must be exact
  53284. state.code = false;
  53285. }
  53286. }
  53287. return null;
  53288. } else if (state.code) {
  53289. stream.next();
  53290. return null;
  53291. }
  53292. // Check if space. If so, links can be formatted later on
  53293. if (stream.eatSpace()) {
  53294. state.ateSpace = true;
  53295. return null;
  53296. }
  53297. if (stream.sol() || state.ateSpace) {
  53298. state.ateSpace = false;
  53299. if (modeConfig.gitHubSpice !== false) {
  53300. if(stream.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?=.{0,6}\d)(?:[a-f0-9]{7,40}\b)/)) {
  53301. // User/Project@SHA
  53302. // User@SHA
  53303. // SHA
  53304. state.combineTokens = true;
  53305. return "link";
  53306. } else if (stream.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/)) {
  53307. // User/Project#Num
  53308. // User#Num
  53309. // #Num
  53310. state.combineTokens = true;
  53311. return "link";
  53312. }
  53313. }
  53314. }
  53315. if (stream.match(urlRE) &&
  53316. stream.string.slice(stream.start - 2, stream.start) != "](" &&
  53317. (stream.start == 0 || /\W/.test(stream.string.charAt(stream.start - 1)))) {
  53318. // URLs
  53319. // Taken from http://daringfireball.net/2010/07/improved_regex_for_matching_urls
  53320. // And then (issue #1160) simplified to make it not crash the Chrome Regexp engine
  53321. // And then limited url schemes to the CommonMark list, so foo:bar isn't matched as a URL
  53322. state.combineTokens = true;
  53323. return "link";
  53324. }
  53325. stream.next();
  53326. return null;
  53327. },
  53328. blankLine: blankLine
  53329. };
  53330. var markdownConfig = {
  53331. taskLists: true,
  53332. strikethrough: true,
  53333. emoji: true
  53334. };
  53335. for (var attr in modeConfig) {
  53336. markdownConfig[attr] = modeConfig[attr];
  53337. }
  53338. markdownConfig.name = "markdown";
  53339. return CodeMirror.overlayMode(CodeMirror.getMode(config, markdownConfig), gfmOverlay);
  53340. }, "markdown");
  53341. CodeMirror.defineMIME("text/x-gfm", "gfm");
  53342. });
  53343. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  53344. // Distributed under an MIT license: https://codemirror.net/LICENSE
  53345. (function(mod) {
  53346. if (typeof exports == "object" && typeof module == "object") // CommonJS
  53347. mod(require("../../lib/codemirror"));
  53348. else if (typeof define == "function" && define.amd) // AMD
  53349. define('codemirror/addon/mode/multiplex',["../../lib/codemirror"], mod);
  53350. else // Plain browser env
  53351. mod(CodeMirror);
  53352. })(function(CodeMirror) {
  53353. "use strict";
  53354. CodeMirror.multiplexingMode = function(outer /*, others */) {
  53355. // Others should be {open, close, mode [, delimStyle] [, innerStyle]} objects
  53356. var others = Array.prototype.slice.call(arguments, 1);
  53357. function indexOf(string, pattern, from, returnEnd) {
  53358. if (typeof pattern == "string") {
  53359. var found = string.indexOf(pattern, from);
  53360. return returnEnd && found > -1 ? found + pattern.length : found;
  53361. }
  53362. var m = pattern.exec(from ? string.slice(from) : string);
  53363. return m ? m.index + from + (returnEnd ? m[0].length : 0) : -1;
  53364. }
  53365. return {
  53366. startState: function() {
  53367. return {
  53368. outer: CodeMirror.startState(outer),
  53369. innerActive: null,
  53370. inner: null
  53371. };
  53372. },
  53373. copyState: function(state) {
  53374. return {
  53375. outer: CodeMirror.copyState(outer, state.outer),
  53376. innerActive: state.innerActive,
  53377. inner: state.innerActive && CodeMirror.copyState(state.innerActive.mode, state.inner)
  53378. };
  53379. },
  53380. token: function(stream, state) {
  53381. if (!state.innerActive) {
  53382. var cutOff = Infinity, oldContent = stream.string;
  53383. for (var i = 0; i < others.length; ++i) {
  53384. var other = others[i];
  53385. var found = indexOf(oldContent, other.open, stream.pos);
  53386. if (found == stream.pos) {
  53387. if (!other.parseDelimiters) stream.match(other.open);
  53388. state.innerActive = other;
  53389. // Get the outer indent, making sure to handle CodeMirror.Pass
  53390. var outerIndent = 0;
  53391. if (outer.indent) {
  53392. var possibleOuterIndent = outer.indent(state.outer, "", "");
  53393. if (possibleOuterIndent !== CodeMirror.Pass) outerIndent = possibleOuterIndent;
  53394. }
  53395. state.inner = CodeMirror.startState(other.mode, outerIndent);
  53396. return other.delimStyle && (other.delimStyle + " " + other.delimStyle + "-open");
  53397. } else if (found != -1 && found < cutOff) {
  53398. cutOff = found;
  53399. }
  53400. }
  53401. if (cutOff != Infinity) stream.string = oldContent.slice(0, cutOff);
  53402. var outerToken = outer.token(stream, state.outer);
  53403. if (cutOff != Infinity) stream.string = oldContent;
  53404. return outerToken;
  53405. } else {
  53406. var curInner = state.innerActive, oldContent = stream.string;
  53407. if (!curInner.close && stream.sol()) {
  53408. state.innerActive = state.inner = null;
  53409. return this.token(stream, state);
  53410. }
  53411. var found = curInner.close ? indexOf(oldContent, curInner.close, stream.pos, curInner.parseDelimiters) : -1;
  53412. if (found == stream.pos && !curInner.parseDelimiters) {
  53413. stream.match(curInner.close);
  53414. state.innerActive = state.inner = null;
  53415. return curInner.delimStyle && (curInner.delimStyle + " " + curInner.delimStyle + "-close");
  53416. }
  53417. if (found > -1) stream.string = oldContent.slice(0, found);
  53418. var innerToken = curInner.mode.token(stream, state.inner);
  53419. if (found > -1) stream.string = oldContent;
  53420. if (found == stream.pos && curInner.parseDelimiters)
  53421. state.innerActive = state.inner = null;
  53422. if (curInner.innerStyle) {
  53423. if (innerToken) innerToken = innerToken + " " + curInner.innerStyle;
  53424. else innerToken = curInner.innerStyle;
  53425. }
  53426. return innerToken;
  53427. }
  53428. },
  53429. indent: function(state, textAfter, line) {
  53430. var mode = state.innerActive ? state.innerActive.mode : outer;
  53431. if (!mode.indent) return CodeMirror.Pass;
  53432. return mode.indent(state.innerActive ? state.inner : state.outer, textAfter, line);
  53433. },
  53434. blankLine: function(state) {
  53435. var mode = state.innerActive ? state.innerActive.mode : outer;
  53436. if (mode.blankLine) {
  53437. mode.blankLine(state.innerActive ? state.inner : state.outer);
  53438. }
  53439. if (!state.innerActive) {
  53440. for (var i = 0; i < others.length; ++i) {
  53441. var other = others[i];
  53442. if (other.open === "\n") {
  53443. state.innerActive = other;
  53444. state.inner = CodeMirror.startState(other.mode, mode.indent ? mode.indent(state.outer, "", "") : 0);
  53445. }
  53446. }
  53447. } else if (state.innerActive.close === "\n") {
  53448. state.innerActive = state.inner = null;
  53449. }
  53450. },
  53451. electricChars: outer.electricChars,
  53452. innerMode: function(state) {
  53453. return state.inner ? {state: state.inner, mode: state.innerActive.mode} : {state: state.outer, mode: outer};
  53454. }
  53455. };
  53456. };
  53457. });
  53458. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  53459. // Distributed under an MIT license: https://codemirror.net/LICENSE
  53460. (function(mod) {
  53461. if (typeof exports == "object" && typeof module == "object") // CommonJS
  53462. mod(require("../../lib/codemirror"));
  53463. else if (typeof define == "function" && define.amd) // AMD
  53464. define('codemirror/mode/python/python',["../../lib/codemirror"], mod);
  53465. else // Plain browser env
  53466. mod(CodeMirror);
  53467. })(function(CodeMirror) {
  53468. "use strict";
  53469. function wordRegexp(words) {
  53470. return new RegExp("^((" + words.join(")|(") + "))\\b");
  53471. }
  53472. var wordOperators = wordRegexp(["and", "or", "not", "is"]);
  53473. var commonKeywords = ["as", "assert", "break", "class", "continue",
  53474. "def", "del", "elif", "else", "except", "finally",
  53475. "for", "from", "global", "if", "import",
  53476. "lambda", "pass", "raise", "return",
  53477. "try", "while", "with", "yield", "in"];
  53478. var commonBuiltins = ["abs", "all", "any", "bin", "bool", "bytearray", "callable", "chr",
  53479. "classmethod", "compile", "complex", "delattr", "dict", "dir", "divmod",
  53480. "enumerate", "eval", "filter", "float", "format", "frozenset",
  53481. "getattr", "globals", "hasattr", "hash", "help", "hex", "id",
  53482. "input", "int", "isinstance", "issubclass", "iter", "len",
  53483. "list", "locals", "map", "max", "memoryview", "min", "next",
  53484. "object", "oct", "open", "ord", "pow", "property", "range",
  53485. "repr", "reversed", "round", "set", "setattr", "slice",
  53486. "sorted", "staticmethod", "str", "sum", "super", "tuple",
  53487. "type", "vars", "zip", "__import__", "NotImplemented",
  53488. "Ellipsis", "__debug__"];
  53489. CodeMirror.registerHelper("hintWords", "python", commonKeywords.concat(commonBuiltins));
  53490. function top(state) {
  53491. return state.scopes[state.scopes.length - 1];
  53492. }
  53493. CodeMirror.defineMode("python", function(conf, parserConf) {
  53494. var ERRORCLASS = "error";
  53495. var delimiters = parserConf.delimiters || parserConf.singleDelimiters || /^[\(\)\[\]\{\}@,:`=;\.\\]/;
  53496. // (Backwards-compatibility with old, cumbersome config system)
  53497. var operators = [parserConf.singleOperators, parserConf.doubleOperators, parserConf.doubleDelimiters, parserConf.tripleDelimiters,
  53498. parserConf.operators || /^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@]|\.\.\.)/]
  53499. for (var i = 0; i < operators.length; i++) if (!operators[i]) operators.splice(i--, 1)
  53500. var hangingIndent = parserConf.hangingIndent || conf.indentUnit;
  53501. var myKeywords = commonKeywords, myBuiltins = commonBuiltins;
  53502. if (parserConf.extra_keywords != undefined)
  53503. myKeywords = myKeywords.concat(parserConf.extra_keywords);
  53504. if (parserConf.extra_builtins != undefined)
  53505. myBuiltins = myBuiltins.concat(parserConf.extra_builtins);
  53506. var py3 = !(parserConf.version && Number(parserConf.version) < 3)
  53507. if (py3) {
  53508. // since http://legacy.python.org/dev/peps/pep-0465/ @ is also an operator
  53509. var identifiers = parserConf.identifiers|| /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;
  53510. myKeywords = myKeywords.concat(["nonlocal", "False", "True", "None", "async", "await"]);
  53511. myBuiltins = myBuiltins.concat(["ascii", "bytes", "exec", "print"]);
  53512. var stringPrefixes = new RegExp("^(([rbuf]|(br)|(fr))?('{3}|\"{3}|['\"]))", "i");
  53513. } else {
  53514. var identifiers = parserConf.identifiers|| /^[_A-Za-z][_A-Za-z0-9]*/;
  53515. myKeywords = myKeywords.concat(["exec", "print"]);
  53516. myBuiltins = myBuiltins.concat(["apply", "basestring", "buffer", "cmp", "coerce", "execfile",
  53517. "file", "intern", "long", "raw_input", "reduce", "reload",
  53518. "unichr", "unicode", "xrange", "False", "True", "None"]);
  53519. var stringPrefixes = new RegExp("^(([rubf]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i");
  53520. }
  53521. var keywords = wordRegexp(myKeywords);
  53522. var builtins = wordRegexp(myBuiltins);
  53523. // tokenizers
  53524. function tokenBase(stream, state) {
  53525. var sol = stream.sol() && state.lastToken != "\\"
  53526. if (sol) state.indent = stream.indentation()
  53527. // Handle scope changes
  53528. if (sol && top(state).type == "py") {
  53529. var scopeOffset = top(state).offset;
  53530. if (stream.eatSpace()) {
  53531. var lineOffset = stream.indentation();
  53532. if (lineOffset > scopeOffset)
  53533. pushPyScope(state);
  53534. else if (lineOffset < scopeOffset && dedent(stream, state) && stream.peek() != "#")
  53535. state.errorToken = true;
  53536. return null;
  53537. } else {
  53538. var style = tokenBaseInner(stream, state);
  53539. if (scopeOffset > 0 && dedent(stream, state))
  53540. style += " " + ERRORCLASS;
  53541. return style;
  53542. }
  53543. }
  53544. return tokenBaseInner(stream, state);
  53545. }
  53546. function tokenBaseInner(stream, state, inFormat) {
  53547. if (stream.eatSpace()) return null;
  53548. // Handle Comments
  53549. if (!inFormat && stream.match(/^#.*/)) return "comment";
  53550. // Handle Number Literals
  53551. if (stream.match(/^[0-9\.]/, false)) {
  53552. var floatLiteral = false;
  53553. // Floats
  53554. if (stream.match(/^[\d_]*\.\d+(e[\+\-]?\d+)?/i)) { floatLiteral = true; }
  53555. if (stream.match(/^[\d_]+\.\d*/)) { floatLiteral = true; }
  53556. if (stream.match(/^\.\d+/)) { floatLiteral = true; }
  53557. if (floatLiteral) {
  53558. // Float literals may be "imaginary"
  53559. stream.eat(/J/i);
  53560. return "number";
  53561. }
  53562. // Integers
  53563. var intLiteral = false;
  53564. // Hex
  53565. if (stream.match(/^0x[0-9a-f_]+/i)) intLiteral = true;
  53566. // Binary
  53567. if (stream.match(/^0b[01_]+/i)) intLiteral = true;
  53568. // Octal
  53569. if (stream.match(/^0o[0-7_]+/i)) intLiteral = true;
  53570. // Decimal
  53571. if (stream.match(/^[1-9][\d_]*(e[\+\-]?[\d_]+)?/)) {
  53572. // Decimal literals may be "imaginary"
  53573. stream.eat(/J/i);
  53574. // TODO - Can you have imaginary longs?
  53575. intLiteral = true;
  53576. }
  53577. // Zero by itself with no other piece of number.
  53578. if (stream.match(/^0(?![\dx])/i)) intLiteral = true;
  53579. if (intLiteral) {
  53580. // Integer literals may be "long"
  53581. stream.eat(/L/i);
  53582. return "number";
  53583. }
  53584. }
  53585. // Handle Strings
  53586. if (stream.match(stringPrefixes)) {
  53587. var isFmtString = stream.current().toLowerCase().indexOf('f') !== -1;
  53588. if (!isFmtString) {
  53589. state.tokenize = tokenStringFactory(stream.current(), state.tokenize);
  53590. return state.tokenize(stream, state);
  53591. } else {
  53592. state.tokenize = formatStringFactory(stream.current(), state.tokenize);
  53593. return state.tokenize(stream, state);
  53594. }
  53595. }
  53596. for (var i = 0; i < operators.length; i++)
  53597. if (stream.match(operators[i])) return "operator"
  53598. if (stream.match(delimiters)) return "punctuation";
  53599. if (state.lastToken == "." && stream.match(identifiers))
  53600. return "property";
  53601. if (stream.match(keywords) || stream.match(wordOperators))
  53602. return "keyword";
  53603. if (stream.match(builtins))
  53604. return "builtin";
  53605. if (stream.match(/^(self|cls)\b/))
  53606. return "variable-2";
  53607. if (stream.match(identifiers)) {
  53608. if (state.lastToken == "def" || state.lastToken == "class")
  53609. return "def";
  53610. return "variable";
  53611. }
  53612. // Handle non-detected items
  53613. stream.next();
  53614. return inFormat ? null :ERRORCLASS;
  53615. }
  53616. function formatStringFactory(delimiter, tokenOuter) {
  53617. while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
  53618. delimiter = delimiter.substr(1);
  53619. var singleline = delimiter.length == 1;
  53620. var OUTCLASS = "string";
  53621. function tokenNestedExpr(depth) {
  53622. return function(stream, state) {
  53623. var inner = tokenBaseInner(stream, state, true)
  53624. if (inner == "punctuation") {
  53625. if (stream.current() == "{") {
  53626. state.tokenize = tokenNestedExpr(depth + 1)
  53627. } else if (stream.current() == "}") {
  53628. if (depth > 1) state.tokenize = tokenNestedExpr(depth - 1)
  53629. else state.tokenize = tokenString
  53630. }
  53631. }
  53632. return inner
  53633. }
  53634. }
  53635. function tokenString(stream, state) {
  53636. while (!stream.eol()) {
  53637. stream.eatWhile(/[^'"\{\}\\]/);
  53638. if (stream.eat("\\")) {
  53639. stream.next();
  53640. if (singleline && stream.eol())
  53641. return OUTCLASS;
  53642. } else if (stream.match(delimiter)) {
  53643. state.tokenize = tokenOuter;
  53644. return OUTCLASS;
  53645. } else if (stream.match('{{')) {
  53646. // ignore {{ in f-str
  53647. return OUTCLASS;
  53648. } else if (stream.match('{', false)) {
  53649. // switch to nested mode
  53650. state.tokenize = tokenNestedExpr(0)
  53651. if (stream.current()) return OUTCLASS;
  53652. else return state.tokenize(stream, state)
  53653. } else if (stream.match('}}')) {
  53654. return OUTCLASS;
  53655. } else if (stream.match('}')) {
  53656. // single } in f-string is an error
  53657. return ERRORCLASS;
  53658. } else {
  53659. stream.eat(/['"]/);
  53660. }
  53661. }
  53662. if (singleline) {
  53663. if (parserConf.singleLineStringErrors)
  53664. return ERRORCLASS;
  53665. else
  53666. state.tokenize = tokenOuter;
  53667. }
  53668. return OUTCLASS;
  53669. }
  53670. tokenString.isString = true;
  53671. return tokenString;
  53672. }
  53673. function tokenStringFactory(delimiter, tokenOuter) {
  53674. while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
  53675. delimiter = delimiter.substr(1);
  53676. var singleline = delimiter.length == 1;
  53677. var OUTCLASS = "string";
  53678. function tokenString(stream, state) {
  53679. while (!stream.eol()) {
  53680. stream.eatWhile(/[^'"\\]/);
  53681. if (stream.eat("\\")) {
  53682. stream.next();
  53683. if (singleline && stream.eol())
  53684. return OUTCLASS;
  53685. } else if (stream.match(delimiter)) {
  53686. state.tokenize = tokenOuter;
  53687. return OUTCLASS;
  53688. } else {
  53689. stream.eat(/['"]/);
  53690. }
  53691. }
  53692. if (singleline) {
  53693. if (parserConf.singleLineStringErrors)
  53694. return ERRORCLASS;
  53695. else
  53696. state.tokenize = tokenOuter;
  53697. }
  53698. return OUTCLASS;
  53699. }
  53700. tokenString.isString = true;
  53701. return tokenString;
  53702. }
  53703. function pushPyScope(state) {
  53704. while (top(state).type != "py") state.scopes.pop()
  53705. state.scopes.push({offset: top(state).offset + conf.indentUnit,
  53706. type: "py",
  53707. align: null})
  53708. }
  53709. function pushBracketScope(stream, state, type) {
  53710. var align = stream.match(/^([\s\[\{\(]|#.*)*$/, false) ? null : stream.column() + 1
  53711. state.scopes.push({offset: state.indent + hangingIndent,
  53712. type: type,
  53713. align: align})
  53714. }
  53715. function dedent(stream, state) {
  53716. var indented = stream.indentation();
  53717. while (state.scopes.length > 1 && top(state).offset > indented) {
  53718. if (top(state).type != "py") return true;
  53719. state.scopes.pop();
  53720. }
  53721. return top(state).offset != indented;
  53722. }
  53723. function tokenLexer(stream, state) {
  53724. if (stream.sol()) state.beginningOfLine = true;
  53725. var style = state.tokenize(stream, state);
  53726. var current = stream.current();
  53727. // Handle decorators
  53728. if (state.beginningOfLine && current == "@")
  53729. return stream.match(identifiers, false) ? "meta" : py3 ? "operator" : ERRORCLASS;
  53730. if (/\S/.test(current)) state.beginningOfLine = false;
  53731. if ((style == "variable" || style == "builtin")
  53732. && state.lastToken == "meta")
  53733. style = "meta";
  53734. // Handle scope changes.
  53735. if (current == "pass" || current == "return")
  53736. state.dedent += 1;
  53737. if (current == "lambda") state.lambda = true;
  53738. if (current == ":" && !state.lambda && top(state).type == "py")
  53739. pushPyScope(state);
  53740. if (current.length == 1 && !/string|comment/.test(style)) {
  53741. var delimiter_index = "[({".indexOf(current);
  53742. if (delimiter_index != -1)
  53743. pushBracketScope(stream, state, "])}".slice(delimiter_index, delimiter_index+1));
  53744. delimiter_index = "])}".indexOf(current);
  53745. if (delimiter_index != -1) {
  53746. if (top(state).type == current) state.indent = state.scopes.pop().offset - hangingIndent
  53747. else return ERRORCLASS;
  53748. }
  53749. }
  53750. if (state.dedent > 0 && stream.eol() && top(state).type == "py") {
  53751. if (state.scopes.length > 1) state.scopes.pop();
  53752. state.dedent -= 1;
  53753. }
  53754. return style;
  53755. }
  53756. var external = {
  53757. startState: function(basecolumn) {
  53758. return {
  53759. tokenize: tokenBase,
  53760. scopes: [{offset: basecolumn || 0, type: "py", align: null}],
  53761. indent: basecolumn || 0,
  53762. lastToken: null,
  53763. lambda: false,
  53764. dedent: 0
  53765. };
  53766. },
  53767. token: function(stream, state) {
  53768. var addErr = state.errorToken;
  53769. if (addErr) state.errorToken = false;
  53770. var style = tokenLexer(stream, state);
  53771. if (style && style != "comment")
  53772. state.lastToken = (style == "keyword" || style == "punctuation") ? stream.current() : style;
  53773. if (style == "punctuation") style = null;
  53774. if (stream.eol() && state.lambda)
  53775. state.lambda = false;
  53776. return addErr ? style + " " + ERRORCLASS : style;
  53777. },
  53778. indent: function(state, textAfter) {
  53779. if (state.tokenize != tokenBase)
  53780. return state.tokenize.isString ? CodeMirror.Pass : 0;
  53781. var scope = top(state), closing = scope.type == textAfter.charAt(0)
  53782. if (scope.align != null)
  53783. return scope.align - (closing ? 1 : 0)
  53784. else
  53785. return scope.offset - (closing ? hangingIndent : 0)
  53786. },
  53787. electricInput: /^\s*[\}\]\)]$/,
  53788. closeBrackets: {triples: "'\""},
  53789. lineComment: "#",
  53790. fold: "indent"
  53791. };
  53792. return external;
  53793. });
  53794. CodeMirror.defineMIME("text/x-python", "python");
  53795. var words = function(str) { return str.split(" "); };
  53796. CodeMirror.defineMIME("text/x-cython", {
  53797. name: "python",
  53798. extra_keywords: words("by cdef cimport cpdef ctypedef enum except "+
  53799. "extern gil include nogil property public "+
  53800. "readonly struct union DEF IF ELIF ELSE")
  53801. });
  53802. });
  53803. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  53804. // Distributed under an MIT license: https://codemirror.net/LICENSE
  53805. /*
  53806. * Author: Constantin Jucovschi (c.jucovschi@jacobs-university.de)
  53807. * Licence: MIT
  53808. */
  53809. (function(mod) {
  53810. if (typeof exports == "object" && typeof module == "object") // CommonJS
  53811. mod(require("../../lib/codemirror"));
  53812. else if (typeof define == "function" && define.amd) // AMD
  53813. define('codemirror/mode/stex/stex',["../../lib/codemirror"], mod);
  53814. else // Plain browser env
  53815. mod(CodeMirror);
  53816. })(function(CodeMirror) {
  53817. "use strict";
  53818. CodeMirror.defineMode("stex", function(_config, parserConfig) {
  53819. "use strict";
  53820. function pushCommand(state, command) {
  53821. state.cmdState.push(command);
  53822. }
  53823. function peekCommand(state) {
  53824. if (state.cmdState.length > 0) {
  53825. return state.cmdState[state.cmdState.length - 1];
  53826. } else {
  53827. return null;
  53828. }
  53829. }
  53830. function popCommand(state) {
  53831. var plug = state.cmdState.pop();
  53832. if (plug) {
  53833. plug.closeBracket();
  53834. }
  53835. }
  53836. // returns the non-default plugin closest to the end of the list
  53837. function getMostPowerful(state) {
  53838. var context = state.cmdState;
  53839. for (var i = context.length - 1; i >= 0; i--) {
  53840. var plug = context[i];
  53841. if (plug.name == "DEFAULT") {
  53842. continue;
  53843. }
  53844. return plug;
  53845. }
  53846. return { styleIdentifier: function() { return null; } };
  53847. }
  53848. function addPluginPattern(pluginName, cmdStyle, styles) {
  53849. return function () {
  53850. this.name = pluginName;
  53851. this.bracketNo = 0;
  53852. this.style = cmdStyle;
  53853. this.styles = styles;
  53854. this.argument = null; // \begin and \end have arguments that follow. These are stored in the plugin
  53855. this.styleIdentifier = function() {
  53856. return this.styles[this.bracketNo - 1] || null;
  53857. };
  53858. this.openBracket = function() {
  53859. this.bracketNo++;
  53860. return "bracket";
  53861. };
  53862. this.closeBracket = function() {};
  53863. };
  53864. }
  53865. var plugins = {};
  53866. plugins["importmodule"] = addPluginPattern("importmodule", "tag", ["string", "builtin"]);
  53867. plugins["documentclass"] = addPluginPattern("documentclass", "tag", ["", "atom"]);
  53868. plugins["usepackage"] = addPluginPattern("usepackage", "tag", ["atom"]);
  53869. plugins["begin"] = addPluginPattern("begin", "tag", ["atom"]);
  53870. plugins["end"] = addPluginPattern("end", "tag", ["atom"]);
  53871. plugins["label" ] = addPluginPattern("label" , "tag", ["atom"]);
  53872. plugins["ref" ] = addPluginPattern("ref" , "tag", ["atom"]);
  53873. plugins["eqref" ] = addPluginPattern("eqref" , "tag", ["atom"]);
  53874. plugins["cite" ] = addPluginPattern("cite" , "tag", ["atom"]);
  53875. plugins["bibitem" ] = addPluginPattern("bibitem" , "tag", ["atom"]);
  53876. plugins["Bibitem" ] = addPluginPattern("Bibitem" , "tag", ["atom"]);
  53877. plugins["RBibitem" ] = addPluginPattern("RBibitem" , "tag", ["atom"]);
  53878. plugins["DEFAULT"] = function () {
  53879. this.name = "DEFAULT";
  53880. this.style = "tag";
  53881. this.styleIdentifier = this.openBracket = this.closeBracket = function() {};
  53882. };
  53883. function setState(state, f) {
  53884. state.f = f;
  53885. }
  53886. // called when in a normal (no environment) context
  53887. function normal(source, state) {
  53888. var plug;
  53889. // Do we look like '\command' ? If so, attempt to apply the plugin 'command'
  53890. if (source.match(/^\\[a-zA-Z@]+/)) {
  53891. var cmdName = source.current().slice(1);
  53892. plug = plugins.hasOwnProperty(cmdName) ? plugins[cmdName] : plugins["DEFAULT"];
  53893. plug = new plug();
  53894. pushCommand(state, plug);
  53895. setState(state, beginParams);
  53896. return plug.style;
  53897. }
  53898. // escape characters
  53899. if (source.match(/^\\[$&%#{}_]/)) {
  53900. return "tag";
  53901. }
  53902. // white space control characters
  53903. if (source.match(/^\\[,;!\/\\]/)) {
  53904. return "tag";
  53905. }
  53906. // find if we're starting various math modes
  53907. if (source.match("\\[")) {
  53908. setState(state, function(source, state){ return inMathMode(source, state, "\\]"); });
  53909. return "keyword";
  53910. }
  53911. if (source.match("\\(")) {
  53912. setState(state, function(source, state){ return inMathMode(source, state, "\\)"); });
  53913. return "keyword";
  53914. }
  53915. if (source.match("$$")) {
  53916. setState(state, function(source, state){ return inMathMode(source, state, "$$"); });
  53917. return "keyword";
  53918. }
  53919. if (source.match("$")) {
  53920. setState(state, function(source, state){ return inMathMode(source, state, "$"); });
  53921. return "keyword";
  53922. }
  53923. var ch = source.next();
  53924. if (ch == "%") {
  53925. source.skipToEnd();
  53926. return "comment";
  53927. } else if (ch == '}' || ch == ']') {
  53928. plug = peekCommand(state);
  53929. if (plug) {
  53930. plug.closeBracket(ch);
  53931. setState(state, beginParams);
  53932. } else {
  53933. return "error";
  53934. }
  53935. return "bracket";
  53936. } else if (ch == '{' || ch == '[') {
  53937. plug = plugins["DEFAULT"];
  53938. plug = new plug();
  53939. pushCommand(state, plug);
  53940. return "bracket";
  53941. } else if (/\d/.test(ch)) {
  53942. source.eatWhile(/[\w.%]/);
  53943. return "atom";
  53944. } else {
  53945. source.eatWhile(/[\w\-_]/);
  53946. plug = getMostPowerful(state);
  53947. if (plug.name == 'begin') {
  53948. plug.argument = source.current();
  53949. }
  53950. return plug.styleIdentifier();
  53951. }
  53952. }
  53953. function inMathMode(source, state, endModeSeq) {
  53954. if (source.eatSpace()) {
  53955. return null;
  53956. }
  53957. if (endModeSeq && source.match(endModeSeq)) {
  53958. setState(state, normal);
  53959. return "keyword";
  53960. }
  53961. if (source.match(/^\\[a-zA-Z@]+/)) {
  53962. return "tag";
  53963. }
  53964. if (source.match(/^[a-zA-Z]+/)) {
  53965. return "variable-2";
  53966. }
  53967. // escape characters
  53968. if (source.match(/^\\[$&%#{}_]/)) {
  53969. return "tag";
  53970. }
  53971. // white space control characters
  53972. if (source.match(/^\\[,;!\/]/)) {
  53973. return "tag";
  53974. }
  53975. // special math-mode characters
  53976. if (source.match(/^[\^_&]/)) {
  53977. return "tag";
  53978. }
  53979. // non-special characters
  53980. if (source.match(/^[+\-<>|=,\/@!*:;'"`~#?]/)) {
  53981. return null;
  53982. }
  53983. if (source.match(/^(\d+\.\d*|\d*\.\d+|\d+)/)) {
  53984. return "number";
  53985. }
  53986. var ch = source.next();
  53987. if (ch == "{" || ch == "}" || ch == "[" || ch == "]" || ch == "(" || ch == ")") {
  53988. return "bracket";
  53989. }
  53990. if (ch == "%") {
  53991. source.skipToEnd();
  53992. return "comment";
  53993. }
  53994. return "error";
  53995. }
  53996. function beginParams(source, state) {
  53997. var ch = source.peek(), lastPlug;
  53998. if (ch == '{' || ch == '[') {
  53999. lastPlug = peekCommand(state);
  54000. lastPlug.openBracket(ch);
  54001. source.eat(ch);
  54002. setState(state, normal);
  54003. return "bracket";
  54004. }
  54005. if (/[ \t\r]/.test(ch)) {
  54006. source.eat(ch);
  54007. return null;
  54008. }
  54009. setState(state, normal);
  54010. popCommand(state);
  54011. return normal(source, state);
  54012. }
  54013. return {
  54014. startState: function() {
  54015. var f = parserConfig.inMathMode ? function(source, state){ return inMathMode(source, state); } : normal;
  54016. return {
  54017. cmdState: [],
  54018. f: f
  54019. };
  54020. },
  54021. copyState: function(s) {
  54022. return {
  54023. cmdState: s.cmdState.slice(),
  54024. f: s.f
  54025. };
  54026. },
  54027. token: function(stream, state) {
  54028. return state.f(stream, state);
  54029. },
  54030. blankLine: function(state) {
  54031. state.f = normal;
  54032. state.cmdState.length = 0;
  54033. },
  54034. lineComment: "%"
  54035. };
  54036. });
  54037. CodeMirror.defineMIME("text/x-stex", "stex");
  54038. CodeMirror.defineMIME("text/x-latex", "stex");
  54039. });
  54040. // IPython GFM (GitHub Flavored Markdown) mode is just a slightly altered GFM
  54041. // Mode with support for latex.
  54042. //
  54043. // Latex support was supported by Codemirror GFM as of
  54044. // https://github.com/codemirror/CodeMirror/pull/567
  54045. // But was later removed in
  54046. // https://github.com/codemirror/CodeMirror/commit/d9c9f1b1ffe984aee41307f3e927f80d1f23590c
  54047. (function(mod) {
  54048. if (typeof exports == "object" && typeof module == "object"){ // CommonJS
  54049. mod(requirejs("codemirror/lib/codemirror")
  54050. ,requirejs("codemirror/addon/mode/multiplex")
  54051. ,requirejs("codemirror/mode/gfm/gfm")
  54052. ,requirejs("codemirror/mode/stex/stex")
  54053. );
  54054. } else if (typeof define == "function" && define.amd){ // AMD
  54055. define('notebook/js/codemirror-ipythongfm',["codemirror/lib/codemirror"
  54056. ,"codemirror/addon/mode/multiplex"
  54057. ,"codemirror/mode/python/python"
  54058. ,"codemirror/mode/stex/stex"
  54059. ], mod);
  54060. } else {// Plain browser env
  54061. mod(CodeMirror);
  54062. }
  54063. })( function(CodeMirror){
  54064. "use strict";
  54065. CodeMirror.defineMode("ipythongfm", function(config, parserConfig) {
  54066. var gfm_mode = CodeMirror.getMode(config, "gfm");
  54067. var tex_mode = CodeMirror.getMode(config, "stex");
  54068. return CodeMirror.multiplexingMode(
  54069. gfm_mode,
  54070. // By defining the $$ delimiter before the $ delimiter we don't run
  54071. // into the problem that $$ is interpreted as two consecutive $.
  54072. {
  54073. open: "$$", close: "$$",
  54074. mode: tex_mode,
  54075. delimStyle: "delimit"
  54076. },
  54077. {
  54078. open: "$", close: "$",
  54079. mode: tex_mode,
  54080. delimStyle: "delimit"
  54081. },
  54082. {
  54083. open: "\\(", close: "\\)",
  54084. mode: tex_mode,
  54085. delimStyle: "delimit"
  54086. },
  54087. {
  54088. open: "\\[", close: "\\]",
  54089. mode: tex_mode,
  54090. delimStyle: "delimit"
  54091. }
  54092. // .. more multiplexed styles can follow here
  54093. );
  54094. }, 'gfm');
  54095. CodeMirror.defineMIME("text/x-ipythongfm", "ipythongfm");
  54096. })
  54097. ;
  54098. // Copyright (c) Jupyter Development Team.
  54099. // Distributed under the terms of the Modified BSD License.
  54100. define('bidi/numericshaping',[],
  54101. function(bidi) {
  54102. "use strict";
  54103. var regex = /([0-9])|([\u0660-\u0669])|([\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5-\u06E6\u06EE-\u06EF\u06FA-\u06FF\u0750-\u077F\u08A0-\u08E3\u200F\u202B\u202E\u2067\uFB50-\uFD3D\uFD40-\uFDCF\uFDF0-\uFDFC\uFDFE-\uFDFF\uFE70-\uFEFE]+)|([^0-9\u0660-\u0669\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5-\u06E6\u06EE-\u06EF\u06FA-\u06FF\u0750-\u077F\u08A0-\u08E3\u200F\u202B\u202E\u2067\uFB50-\uFD3D\uFD40-\uFDCF\uFDF0-\uFDFC\uFDFE-\uFDFF\uFE70-\uFEFE\u0600-\u0607\u0609-\u060A\u060C\u060E-\u061A\u064B-\u066C\u0670\u06D6-\u06E4\u06E7-\u06ED\u06F0-\u06F9\u08E4-\u08FF\uFD3E-\uFD3F\uFDD0-\uFDEF\uFDFD\uFEFF\u0000-\u0040\u005B-\u0060\u007B-\u007F\u0080-\u00A9\u00AB-\u00B4\u00B6-\u00B9\u00BB-\u00BF\u00D7\u00F7\u02B9-\u02BA\u02C2-\u02CF\u02D2-\u02DF\u02E5-\u02ED\u02EF-\u02FF\u2070\u2074-\u207E\u2080-\u208E\u2100-\u2101\u2103-\u2106\u2108-\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A-\u213B\u2140-\u2144\u214A-\u214D\u2150-\u215F\u2189\uA720-\uA721\uA788\uFF01-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFE0-\uFFE6\uFFE8-\uFFEE]+)/g;
  54104. var shape = function(text, shaperType) {
  54105. text = text.toString();
  54106. if (!text) {
  54107. return text;
  54108. }
  54109. switch (shaperType) {
  54110. case "defaultNumeral":
  54111. return _shapeEuropean(text);
  54112. case "national":
  54113. return _shapeArabic(text);
  54114. default:
  54115. return text;
  54116. }
  54117. };
  54118. var _shapeEuropean = function(text) {
  54119. return text.replace(/[\u0660-\u0669]/g, function(c) {
  54120. return c.charCodeAt(0) - 1632;
  54121. });
  54122. };
  54123. var _shapeArabic = function(text) {
  54124. return text.replace(/[0-9]/g, function(c) {
  54125. return String.fromCharCode(parseInt(c) + 1632);
  54126. });
  54127. };
  54128. var numericshaping = {
  54129. shapeNumerals : shape
  54130. };
  54131. return numericshaping;
  54132. });
  54133. // Copyright (c) Jupyter Development Team.
  54134. // Distributed under the terms of the Modified BSD License.
  54135. define('bidi/bidi',['bidi/numericshaping'], function(numericshaping) {
  54136. 'use strict';
  54137. var shaperType = '';
  54138. var _uiLang = function() {
  54139. return navigator.language.toLowerCase();
  54140. };
  54141. var _loadLocale = function() {
  54142. if (_isMirroringEnabled()) {
  54143. document.body.dir = 'rtl';
  54144. }
  54145. requirejs(['moment'], function (moment) {
  54146. console.log('Loaded moment locale', moment.locale(_uiLang()));
  54147. });
  54148. shaperType = _uiLang().split('-')[0] == 'ar' ? 'national' : 'defaultNumeral';
  54149. };
  54150. var _isMirroringEnabled = function() {
  54151. return new RegExp('^(ar|ara|arc|ae|ave|egy|he|heb|nqo|pal|phn|sam|syc|syr|fa|per|fas|ckb|ur|urd)').test(_uiLang());
  54152. };
  54153. /**
  54154. * @param value : the string to apply the bidi-support on it.
  54155. * @param flag :indicates the type of bidi-support (Numeric-shaping ,Base-text-dir ).
  54156. */
  54157. var _applyBidi = function(value /*, flag*/) {
  54158. value = numericshaping.shapeNumerals(value, shaperType);
  54159. return value;
  54160. };
  54161. var bidi = {
  54162. applyBidi: _applyBidi,
  54163. isMirroringEnabled: _isMirroringEnabled,
  54164. loadLocale: _loadLocale,
  54165. };
  54166. return bidi;
  54167. });
  54168. // Copyright (c) Jupyter Development Team.
  54169. // Distributed under the terms of the Modified BSD License.
  54170. define('notebook/js/textcell',[
  54171. 'jquery',
  54172. 'base/js/utils',
  54173. 'base/js/i18n',
  54174. 'notebook/js/cell',
  54175. 'base/js/markdown',
  54176. 'services/config',
  54177. 'notebook/js/celltoolbar',
  54178. 'codemirror/lib/codemirror',
  54179. 'codemirror/mode/gfm/gfm',
  54180. 'notebook/js/codemirror-ipythongfm',
  54181. 'bidi/bidi'
  54182. ], function(
  54183. $,
  54184. utils,
  54185. i18n,
  54186. cell,
  54187. markdown,
  54188. configmod,
  54189. celltoolbar,
  54190. CodeMirror,
  54191. gfm,
  54192. ipgfm,
  54193. bidi
  54194. ) {
  54195. "use strict";
  54196. function encodeURIandParens(uri){return encodeURI(uri).replace('(','%28').replace(')','%29')}
  54197. /**
  54198. * Given a file name and a list of existing file names, returns a new file name
  54199. * that is not in the existing list. If the file name already exists, a new one with
  54200. * an incremented index is returned instead.
  54201. *
  54202. * Example:
  54203. * addIndexToFileName('attachment.png',
  54204. * ['attachment.png', 'attachment-3.png']) returns 'attachment-4.png'
  54205. *
  54206. * @param {string} fileName - original file name
  54207. * @param {string} fileNames - other file names
  54208. * @return {string} the original file name or one with a postfix
  54209. * index (before the extension, if one exists)
  54210. */
  54211. function addIndexToFileName(fileName, fileNames) {
  54212. if (fileNames === undefined) {
  54213. return fileName;
  54214. }
  54215. var lastDot = fileName.lastIndexOf('.');
  54216. var pre = fileName.substr(0, lastDot);
  54217. var optionalExt = fileName.substr(lastDot);
  54218. var indexMatch = '-(\\d+)';
  54219. // Make the index match optional so we can match both 'fileName.png' and 'fileName-2.png'
  54220. // The ?: makes it a non-capturing group.
  54221. var optionalIndexMatch = '(?:' + indexMatch + ')?';
  54222. var regex = new RegExp(pre + optionalIndexMatch + optionalExt);
  54223. var highestIndex = 0;
  54224. for (var existingFileName in fileNames) {
  54225. var match = existingFileName.match(regex);
  54226. var index = match[1];
  54227. if (index === undefined) {
  54228. index = 1;
  54229. }
  54230. else {
  54231. index = parseInt(index);
  54232. }
  54233. if (index > highestIndex) {
  54234. highestIndex = index;
  54235. }
  54236. }
  54237. if (highestIndex > 0) {
  54238. return pre + "-" + (highestIndex + 1) + optionalExt;
  54239. }
  54240. else {
  54241. return fileName;
  54242. }
  54243. };
  54244. var Cell = cell.Cell;
  54245. var TextCell = function (options) {
  54246. /**
  54247. * Constructor
  54248. *
  54249. * Construct a new TextCell, codemirror mode is by default 'htmlmixed',
  54250. * and cell type is 'text' cell start as not redered.
  54251. *
  54252. * Parameters:
  54253. * options: dictionary
  54254. * Dictionary of keyword arguments.
  54255. * events: $(Events) instance
  54256. * config: dictionary
  54257. * keyboard_manager: KeyboardManager instance
  54258. * notebook: Notebook instance
  54259. */
  54260. options = options || {};
  54261. // in all TextCell/Cell subclasses
  54262. // do not assign most of members here, just pass it down
  54263. // in the options dict potentially overwriting what you wish.
  54264. // they will be assigned in the base class.
  54265. this.notebook = options.notebook;
  54266. this.events = options.events;
  54267. this.config = options.config;
  54268. // we cannot put this as a class key as it has handle to "this".
  54269. Cell.apply(this, [{
  54270. config: options.config,
  54271. keyboard_manager: options.keyboard_manager,
  54272. events: this.events}]);
  54273. this.cell_type = this.cell_type || 'text';
  54274. this.rendered = false;
  54275. };
  54276. TextCell.prototype = Object.create(Cell.prototype);
  54277. TextCell.options_default = {
  54278. cm_config : {
  54279. mode: 'htmlmixed',
  54280. lineWrapping : true,
  54281. }
  54282. };
  54283. /**
  54284. * Create the DOM element of the TextCell
  54285. * @method create_element
  54286. * @private
  54287. */
  54288. TextCell.prototype.create_element = function () {
  54289. Cell.prototype.create_element.apply(this, arguments);
  54290. var that = this;
  54291. var cell = $("<div>").addClass('cell text_cell');
  54292. cell.attr('tabindex','2');
  54293. var prompt = $('<div/>').addClass('prompt input_prompt');
  54294. cell.append(prompt);
  54295. var inner_cell = $('<div/>').addClass('inner_cell');
  54296. this.celltoolbar = new celltoolbar.CellToolbar({
  54297. cell: this,
  54298. notebook: this.notebook});
  54299. inner_cell.append(this.celltoolbar.element);
  54300. var input_area = $('<div/>').addClass('input_area').attr("aria-label", i18n.msg._("Edit Markup Text here"));
  54301. this.code_mirror = new CodeMirror(input_area.get(0), this._options.cm_config);
  54302. // In case of bugs that put the keyboard manager into an inconsistent state,
  54303. // ensure KM is enabled when CodeMirror is focused:
  54304. this.code_mirror.on('focus', function () {
  54305. if (that.keyboard_manager) {
  54306. that.keyboard_manager.enable();
  54307. }
  54308. that.code_mirror.setOption('readOnly', !that.is_editable());
  54309. });
  54310. this.code_mirror.on('keydown', $.proxy(this.handle_keyevent,this))
  54311. // The tabindex=-1 makes this div focusable.
  54312. var render_area = $('<div/>').addClass('text_cell_render rendered_html')
  54313. .attr('tabindex','-1');
  54314. inner_cell.append(input_area).append(render_area);
  54315. cell.append(inner_cell);
  54316. this.element = cell;
  54317. this.inner_cell = inner_cell;
  54318. };
  54319. // Cell level actions
  54320. TextCell.prototype.add_attachment = function (key, mime_type, b64_data) {
  54321. /**
  54322. * Add a new attachment to this cell
  54323. */
  54324. this.attachments[key] = {};
  54325. this.attachments[key][mime_type] = b64_data;
  54326. };
  54327. TextCell.prototype.select = function () {
  54328. var cont = Cell.prototype.select.apply(this, arguments);
  54329. if (cont) {
  54330. if (this.mode === 'edit') {
  54331. this.code_mirror.refresh();
  54332. }
  54333. }
  54334. return cont;
  54335. };
  54336. TextCell.prototype.unrender = function () {
  54337. var cont = Cell.prototype.unrender.apply(this);
  54338. if (cont) {
  54339. var text_cell = this.element;
  54340. if (this.get_text() === this.placeholder) {
  54341. this.set_text('');
  54342. }
  54343. this.refresh();
  54344. }
  54345. return cont;
  54346. };
  54347. TextCell.prototype.execute = function () {
  54348. this.render();
  54349. };
  54350. /**
  54351. * setter: {{#crossLink "TextCell/set_text"}}{{/crossLink}}
  54352. * @method get_text
  54353. * @return {string} CodeMirror current text value
  54354. */
  54355. TextCell.prototype.get_text = function() {
  54356. return this.code_mirror.getValue();
  54357. };
  54358. /**
  54359. * @param {string} text - Codemiror text value
  54360. * @see TextCell#get_text
  54361. * @method set_text
  54362. * */
  54363. TextCell.prototype.set_text = function(text) {
  54364. this.code_mirror.setValue(text);
  54365. this.unrender();
  54366. this.code_mirror.refresh();
  54367. };
  54368. /**
  54369. * setter :{{#crossLink "TextCell/set_rendered"}}{{/crossLink}}
  54370. * @method get_rendered
  54371. * */
  54372. TextCell.prototype.get_rendered = function() {
  54373. return this.element.find('div.text_cell_render').html();
  54374. };
  54375. /**
  54376. * @method set_rendered
  54377. */
  54378. TextCell.prototype.set_rendered = function(text) {
  54379. this.element.find('div.text_cell_render').html(text);
  54380. };
  54381. /**
  54382. * Create Text cell from JSON
  54383. * @param {json} data - JSON serialized text-cell
  54384. * @method fromJSON
  54385. */
  54386. TextCell.prototype.fromJSON = function (data) {
  54387. Cell.prototype.fromJSON.apply(this, arguments);
  54388. if (data.cell_type === this.cell_type) {
  54389. if (data.attachments !== undefined) {
  54390. this.attachments = data.attachments;
  54391. }
  54392. if (data.source !== undefined) {
  54393. this.set_text(data.source);
  54394. // make this value the starting point, so that we can only undo
  54395. // to this state, instead of a blank cell
  54396. this.code_mirror.clearHistory();
  54397. // TODO: This HTML needs to be treated as potentially dangerous
  54398. // user input and should be handled before set_rendered.
  54399. this.set_rendered(data.rendered || '');
  54400. this.rendered = false;
  54401. this.render();
  54402. }
  54403. }
  54404. };
  54405. /** Generate JSON from cell
  54406. * @param {bool} gc_attachments - If true, will remove unused attachments
  54407. * from the returned JSON
  54408. * @return {object} cell data serialised to json
  54409. */
  54410. TextCell.prototype.toJSON = function (gc_attachments) {
  54411. if (gc_attachments === undefined) {
  54412. gc_attachments = false;
  54413. }
  54414. var data = Cell.prototype.toJSON.apply(this);
  54415. data.source = this.get_text();
  54416. if (data.source == this.placeholder) {
  54417. data.source = "";
  54418. }
  54419. // We deepcopy the attachments so copied cells don't share the same
  54420. // objects
  54421. if (Object.keys(this.attachments).length > 0) {
  54422. if (gc_attachments) {
  54423. // Garbage collect unused attachments : The general idea is to
  54424. // render the text, and find used attachments like when we
  54425. // substitute them in render()
  54426. var that = this;
  54427. data.attachments = {};
  54428. // To find attachments, rendering to HTML is easier than
  54429. // searching in the markdown source for the multiple ways you
  54430. // can reference an image in markdown (using []() or a
  54431. // HTML <img>)
  54432. var text = this.get_text();
  54433. markdown.render(text, {
  54434. sanitize: true,
  54435. }, function (err, html) {
  54436. html.find('img[src^="attachment:"]').each(function (i, h) {
  54437. h = $(h);
  54438. var key = h.attr('src').replace(/^attachment:/, '');
  54439. if (that.attachments.hasOwnProperty(key)) {
  54440. data.attachments[key] = JSON.parse(JSON.stringify(
  54441. that.attachments[key]));
  54442. }
  54443. // This is to avoid having the browser do a GET request
  54444. // on the invalid attachment: URL
  54445. h.attr('src', '');
  54446. });
  54447. });
  54448. if (data.attachments.length === 0) {
  54449. // omit attachments dict if no attachments
  54450. delete data.attachments;
  54451. }
  54452. } else {
  54453. data.attachments = JSON.parse(JSON.stringify(this.attachments));
  54454. }
  54455. }
  54456. return data;
  54457. };
  54458. var MarkdownCell = function (options) {
  54459. /**
  54460. * Constructor
  54461. *
  54462. * Parameters:
  54463. * options: dictionary
  54464. * Dictionary of keyword arguments.
  54465. * events: $(Events) instance
  54466. * config: ConfigSection instance
  54467. * keyboard_manager: KeyboardManager instance
  54468. * notebook: Notebook instance
  54469. */
  54470. options = options || {};
  54471. var config_default = utils.mergeopt(TextCell, MarkdownCell.options_default);
  54472. this.class_config = new configmod.ConfigWithDefaults(options.config,
  54473. config_default, 'MarkdownCell');
  54474. TextCell.apply(this, [$.extend({}, options, {config: options.config})]);
  54475. this.cell_type = 'markdown';
  54476. // Used to keep track of drag events
  54477. this.drag_counter = 0;
  54478. };
  54479. MarkdownCell.options_default = {
  54480. cm_config: {
  54481. mode: 'ipythongfm',
  54482. },
  54483. placeholder: "Type *Markdown* and LaTeX: $\\alpha^2$"
  54484. };
  54485. MarkdownCell.prototype = Object.create(TextCell.prototype);
  54486. MarkdownCell.prototype.set_heading_level = function (level) {
  54487. /**
  54488. * make a markdown cell a heading
  54489. */
  54490. level = level || 1;
  54491. var source = this.get_text();
  54492. source = source.replace(/^(#*)\s?/,
  54493. new Array(level + 1).join('#') + ' ');
  54494. this.set_text(source);
  54495. this.refresh();
  54496. if (this.rendered) {
  54497. this.render();
  54498. }
  54499. };
  54500. MarkdownCell.prototype.select = function () {
  54501. var cont = TextCell.prototype.select.apply(this, arguments);
  54502. if (cont) {
  54503. this.notebook.set_insert_image_enabled(!this.rendered);
  54504. }
  54505. };
  54506. MarkdownCell.prototype.unrender = function () {
  54507. var cont = TextCell.prototype.unrender.apply(this);
  54508. this.notebook.set_insert_image_enabled(true);
  54509. };
  54510. MarkdownCell.prototype.insert_inline_image_from_blob = function(blob) {
  54511. /**
  54512. * Insert markup for an inline image at the current cursor position.
  54513. * This works as follow :
  54514. * - We insert the base64-encoded blob data into the cell attachments
  54515. * dictionary, keyed by the filename.
  54516. * - We insert an img tag with a 'attachment:key' src that refers to
  54517. * the attachments entry.
  54518. *
  54519. * Parameters:
  54520. * file: Blob
  54521. * The JS Blob object (e.g. from the DataTransferItem)
  54522. */
  54523. var that = this;
  54524. var pos = this.code_mirror.getCursor();
  54525. var reader = new FileReader();
  54526. // We can get either a named file (drag'n'drop) or a blob (copy/paste)
  54527. // We generate names for blobs
  54528. var key;
  54529. if (blob.name !== undefined) {
  54530. key = encodeURIandParens(blob.name);
  54531. // Add an index to the filename if we already have one with the same name
  54532. key = addIndexToFileName(key, that.attachments);
  54533. } else {
  54534. key = '_auto_' + Object.keys(that.attachments).length;
  54535. }
  54536. reader.onloadend = function() {
  54537. var d = utils.parse_b64_data_uri(reader.result);
  54538. var blobData = d[1]
  54539. if (blob.type != d[0]) {
  54540. // TODO(julienr): Not sure what we should do in this case
  54541. console.log('File type (' + blob.type + ') != data-uri ' +
  54542. 'type (' + d[0] + ')');
  54543. }
  54544. // If we have the same attachment already under another key, we change the key to that.
  54545. // This ensures we don't create two attachments if pasting the same image twice.
  54546. for (var savedKey in that.attachments) {
  54547. var attachment = that.attachments[savedKey];
  54548. if (attachment === undefined) continue;
  54549. var savedBlob = attachment[blob.type];
  54550. if (savedBlob === blobData) {
  54551. key = savedKey;
  54552. }
  54553. }
  54554. that.add_attachment(key, blob.type, blobData);
  54555. var img_md = '![' + key + '](attachment:' + key + ')';
  54556. that.code_mirror.replaceRange(img_md, pos);
  54557. }
  54558. reader.readAsDataURL(blob);
  54559. };
  54560. /**
  54561. * @method render
  54562. */
  54563. MarkdownCell.prototype.render = function () {
  54564. // We clear the dropzone here just in case the dragenter/leave
  54565. // logic of bind_events wasn't 100% successful.
  54566. this.drag_counter = 0;
  54567. this.inner_cell.removeClass('dropzone');
  54568. var cont = TextCell.prototype.render.apply(this);
  54569. if (cont) {
  54570. var that = this;
  54571. var text = this.get_text();
  54572. var math = null;
  54573. if (text === "") { text = this.placeholder; }
  54574. markdown.render(text, {
  54575. with_math: true,
  54576. clean_tables: true,
  54577. sanitize: true,
  54578. }, function (err, html) {
  54579. // add anchors to headings
  54580. html.find(":header").addBack(":header").each(function (i, h) {
  54581. h = $(h);
  54582. var hash = h.text().replace(/ /g, '-');
  54583. h.attr('id', hash);
  54584. h.append(
  54585. $('<a/>')
  54586. .addClass('anchor-link')
  54587. .attr('href', '#' + hash)
  54588. .text('¶')
  54589. .on('click',function(){
  54590. setTimeout(function(){that.unrender(); that.render()}, 100)
  54591. })
  54592. );
  54593. });
  54594. // links in markdown cells should open in new tabs
  54595. html.find("a[href]").not('[href^="#"]').attr("target", "_blank");
  54596. // replace attachment:<key> by the corresponding entry
  54597. // in the cell's attachments
  54598. html.find('img[src^="attachment:"]').each(function (i, h) {
  54599. h = $(h);
  54600. var key = h.attr('src').replace(/^attachment:/, '');
  54601. if (that.attachments.hasOwnProperty(key)) {
  54602. var att = that.attachments[key];
  54603. var mime = Object.keys(att)[0];
  54604. h.attr('src', 'data:' + mime + ';base64,' + att[mime]);
  54605. } else {
  54606. h.attr('src', '');
  54607. }
  54608. });
  54609. that.set_rendered(html);
  54610. that.typeset();
  54611. that.events.trigger("rendered.MarkdownCell", {cell: that});
  54612. });
  54613. }
  54614. return cont;
  54615. };
  54616. /** @method bind_events **/
  54617. MarkdownCell.prototype.bind_events = function () {
  54618. TextCell.prototype.bind_events.apply(this);
  54619. var that = this;
  54620. this.element.dblclick(function () {
  54621. var cont = that.unrender();
  54622. if (cont) {
  54623. that.focus_editor();
  54624. }
  54625. });
  54626. var attachment_regex = /^image\/.*$/;
  54627. // Event handlers to allow users to insert image using either
  54628. // drag'n'drop or copy/paste
  54629. var div = that.code_mirror.getWrapperElement();
  54630. $(div).on('paste', function(evt) {
  54631. var data = evt.originalEvent.clipboardData;
  54632. var items = data.items;
  54633. if (items !== undefined) {
  54634. for (var i = 0; i < items.length; ++i) {
  54635. var item = items[i];
  54636. if (item.kind == 'file' && attachment_regex.test(item.type)) {
  54637. // TODO(julienr): This does not stop code_mirror from pasting
  54638. // the filename.
  54639. evt.stopPropagation();
  54640. evt.preventDefault();
  54641. that.insert_inline_image_from_blob(item.getAsFile());
  54642. }
  54643. }
  54644. }
  54645. });
  54646. // Allow drag event if the dragged file can be used as an attachment
  54647. // If we use this.code_mirror.on to register a "dragover" handler, we
  54648. // get an empty dataTransfer
  54649. this.code_mirror.on("dragover", function(cm, evt) {
  54650. if (utils.dnd_contain_file(evt)) {
  54651. evt.preventDefault();
  54652. }
  54653. });
  54654. // We want to display a visual indicator that the drop is possible.
  54655. // The dragleave event is fired when we hover a child element (which
  54656. // is often immediately after we got the dragenter), so we keep track
  54657. // of the number of dragenter/dragleave we got, as discussed here :
  54658. // https://stackoverflow.com/q/7110353/116067
  54659. // This doesn't seem to be 100% reliable, so we clear the dropzone
  54660. // class when the cell is rendered as well
  54661. this.code_mirror.on("dragenter", function(cm, evt) {
  54662. if (utils.dnd_contain_file(evt)) {
  54663. that.drag_counter++;
  54664. that.inner_cell.addClass('dropzone');
  54665. }
  54666. evt.preventDefault();
  54667. evt.stopPropagation();
  54668. });
  54669. this.code_mirror.on("dragleave", function(cm, evt) {
  54670. that.drag_counter--;
  54671. if (that.drag_counter <= 0) {
  54672. that.inner_cell.removeClass('dropzone');
  54673. }
  54674. evt.preventDefault();
  54675. evt.stopPropagation();
  54676. });
  54677. this.code_mirror.on("drop", function(cm, evt) {
  54678. that.drag_counter = 0;
  54679. that.inner_cell.removeClass('dropzone');
  54680. var files = evt.dataTransfer.files;
  54681. for (var i = 0; i < files.length; ++i) {
  54682. var file = files[i];
  54683. if (attachment_regex.test(file.type)) {
  54684. // Prevent the default code_mirror 'drop' event handler
  54685. // (which inserts the file content) if this is a
  54686. // recognized media file
  54687. evt.stopPropagation();
  54688. evt.preventDefault();
  54689. that.insert_inline_image_from_blob(file);
  54690. }
  54691. }
  54692. });
  54693. };
  54694. var RawCell = function (options) {
  54695. /**
  54696. * Constructor
  54697. *
  54698. * Parameters:
  54699. * options: dictionary
  54700. * Dictionary of keyword arguments.
  54701. * events: $(Events) instance
  54702. * config: ConfigSection instance
  54703. * keyboard_manager: KeyboardManager instance
  54704. * notebook: Notebook instance
  54705. */
  54706. options = options || {};
  54707. var config_default = utils.mergeopt(TextCell, RawCell.options_default);
  54708. this.class_config = new configmod.ConfigWithDefaults(options.config,
  54709. config_default, 'RawCell');
  54710. TextCell.apply(this, [$.extend({}, options, {config: options.config})]);
  54711. this.cell_type = 'raw';
  54712. };
  54713. RawCell.options_default = {
  54714. highlight_modes : {
  54715. 'diff' :{'reg':[/^diff/]}
  54716. },
  54717. placeholder : i18n.msg._("Write raw LaTeX or other formats here, for use with nbconvert. " +
  54718. "It will not be rendered in the notebook. " +
  54719. "When passing through nbconvert, a Raw Cell's content is added to the output unmodified."),
  54720. };
  54721. RawCell.prototype = Object.create(TextCell.prototype);
  54722. /** @method bind_events **/
  54723. RawCell.prototype.bind_events = function () {
  54724. TextCell.prototype.bind_events.apply(this);
  54725. var that = this;
  54726. this.element.focusout(function() {
  54727. that.auto_highlight();
  54728. that.render();
  54729. });
  54730. this.code_mirror.on('focus', function() { that.unrender(); });
  54731. };
  54732. /** @method render **/
  54733. RawCell.prototype.render = function () {
  54734. var cont = TextCell.prototype.render.apply(this);
  54735. if (cont){
  54736. var text = this.get_text();
  54737. if (text === "") { text = this.placeholder; }
  54738. this.set_text(text);
  54739. this.element.removeClass('rendered');
  54740. this.auto_highlight();
  54741. }
  54742. return cont;
  54743. };
  54744. var textcell = {
  54745. TextCell: TextCell,
  54746. MarkdownCell: MarkdownCell,
  54747. RawCell: RawCell
  54748. };
  54749. return textcell;
  54750. });
  54751. // Copyright (c) Jupyter Development Team.
  54752. // Distributed under the terms of the Modified BSD License.
  54753. /**
  54754. *
  54755. *
  54756. * @module keyboard
  54757. * @namespace keyboard
  54758. * @class ShortcutManager
  54759. */
  54760. define('base/js/keyboard',[
  54761. 'jquery',
  54762. 'base/js/utils',
  54763. 'underscore',
  54764. ], function($, utils, _) {
  54765. "use strict";
  54766. /**
  54767. * Setup global keycodes and inverse keycodes.
  54768. *
  54769. * See http://unixpapa.com/js/key.html for a complete description. The short of
  54770. * it is that there are different keycode sets. Firefox uses the "Mozilla keycodes"
  54771. * and Webkit/IE use the "IE keycodes". These keycode sets are mostly the same
  54772. * but have minor differences.
  54773. **/
  54774. // These apply to Firefox, (Webkit and IE)
  54775. // This does work **only** on US keyboard.
  54776. var _keycodes = {
  54777. 'a': 65, 'b': 66, 'c': 67, 'd': 68, 'e': 69, 'f': 70, 'g': 71, 'h': 72, 'i': 73,
  54778. 'j': 74, 'k': 75, 'l': 76, 'm': 77, 'n': 78, 'o': 79, 'p': 80, 'q': 81, 'r': 82,
  54779. 's': 83, 't': 84, 'u': 85, 'v': 86, 'w': 87, 'x': 88, 'y': 89, 'z': 90,
  54780. '1 !': 49, '2 @': 50, '3 #': 51, '4 $': 52, '5 %': 53, '6 ^': 54,
  54781. '7 &': 55, '8 *': 56, '9 (': 57, '0 )': 48,
  54782. '[ {': 219, '] }': 221, '` ~': 192, ', <': 188, '. >': 190, '/ ?': 191,
  54783. '\\ |': 220, '\' "': 222,
  54784. 'numpad0': 96, 'numpad1': 97, 'numpad2': 98, 'numpad3': 99, 'numpad4': 100,
  54785. 'numpad5': 101, 'numpad6': 102, 'numpad7': 103, 'numpad8': 104, 'numpad9': 105,
  54786. 'multiply': 106, 'add': 107, 'subtract': 109, 'decimal': 110, 'divide': 111,
  54787. 'f1': 112, 'f2': 113, 'f3': 114, 'f4': 115, 'f5': 116, 'f6': 117, 'f7': 118,
  54788. 'f8': 119, 'f9': 120, 'f10': 121, 'f11': 122, 'f12': 123, 'f13': 124, 'f14': 125, 'f15': 126,
  54789. 'backspace': 8, 'tab': 9, 'enter': 13, 'shift': 16, 'ctrl': 17, 'alt': 18,
  54790. 'meta': 91, 'capslock': 20, 'esc': 27, 'space': 32, 'pageup': 33, 'pagedown': 34,
  54791. 'end': 35, 'home': 36, 'left': 37, 'up': 38, 'right': 39, 'down': 40,
  54792. 'insert': 45, 'delete': 46, 'numlock': 144,
  54793. };
  54794. // These apply to Firefox and Opera
  54795. var _mozilla_keycodes = {
  54796. '; :': 59, '= +': 61, '- _': 173, 'meta': 224, 'minus':173
  54797. };
  54798. // This apply to Webkit and IE
  54799. var _ie_keycodes = {
  54800. '; :': 186, '= +': 187, '- _': 189, 'minus':189
  54801. };
  54802. var browser = utils.browser[0];
  54803. var platform = utils.platform;
  54804. if (browser === 'Firefox' || browser === 'Opera' || browser === 'Netscape') {
  54805. $.extend(_keycodes, _mozilla_keycodes);
  54806. } else if (browser === 'Safari' || browser === 'Chrome' || browser === 'MSIE') {
  54807. $.extend(_keycodes, _ie_keycodes);
  54808. }
  54809. var keycodes = {};
  54810. var inv_keycodes = {};
  54811. for (var name in _keycodes) {
  54812. var names = name.split(' ');
  54813. if (names.length === 1) {
  54814. var n = names[0];
  54815. keycodes[n] = _keycodes[n];
  54816. inv_keycodes[_keycodes[n]] = n;
  54817. } else {
  54818. var primary = names[0];
  54819. var secondary = names[1];
  54820. keycodes[primary] = _keycodes[name];
  54821. keycodes[secondary] = _keycodes[name];
  54822. inv_keycodes[_keycodes[name]] = primary;
  54823. }
  54824. }
  54825. var normalize_key = function (key) {
  54826. return inv_keycodes[keycodes[key]];
  54827. };
  54828. var normalize_shortcut = function (shortcut) {
  54829. /**
  54830. * @function _normalize_shortcut
  54831. * @private
  54832. * return a dict containing the normalized shortcut and the number of time it should be pressed:
  54833. *
  54834. * Put a shortcut into normalized form:
  54835. * 1. Make lowercase
  54836. * 2. Replace cmd by meta
  54837. * 3. Sort '-' separated modifiers into the order alt-ctrl-meta-shift
  54838. * 4. Normalize keys
  54839. **/
  54840. if (platform === 'MacOS') {
  54841. shortcut = shortcut.toLowerCase().replace('cmdtrl-', 'cmd-');
  54842. } else {
  54843. shortcut = shortcut.toLowerCase().replace('cmdtrl-', 'ctrl-');
  54844. }
  54845. shortcut = shortcut.toLowerCase().replace('cmd', 'meta');
  54846. shortcut = shortcut.replace(/-$/, 'minus'); // catch shortcuts using '-' key
  54847. shortcut = shortcut.replace(/,$/, 'comma'); // catch shortcuts using '-' key
  54848. if(shortcut.indexOf(',') !== -1){
  54849. var sht = shortcut.split(',');
  54850. sht = _.map(sht, normalize_shortcut);
  54851. return shortcut;
  54852. }
  54853. shortcut = shortcut.replace(/comma/g, ','); // catch shortcuts using '-' key
  54854. var values = shortcut.split("-");
  54855. if (values.length === 1) {
  54856. return normalize_key(values[0]);
  54857. } else {
  54858. var modifiers = values.slice(0,-1);
  54859. var key = normalize_key(values[values.length-1]);
  54860. modifiers.sort();
  54861. return modifiers.join('-') + '-' + key;
  54862. }
  54863. };
  54864. var shortcut_to_event = function (shortcut, type) {
  54865. /**
  54866. * Convert a shortcut (shift-r) to a jQuery Event object
  54867. **/
  54868. type = type || 'keydown';
  54869. shortcut = normalize_shortcut(shortcut);
  54870. shortcut = shortcut.replace(/-$/, 'minus'); // catch shortcuts using '-' key
  54871. var values = shortcut.split("-");
  54872. var modifiers = values.slice(0,-1);
  54873. var key = values[values.length-1];
  54874. var opts = {which: keycodes[key]};
  54875. if (modifiers.indexOf('alt') !== -1) {opts.altKey = true;}
  54876. if (modifiers.indexOf('ctrl') !== -1) {opts.ctrlKey = true;}
  54877. if (modifiers.indexOf('meta') !== -1) {opts.metaKey = true;}
  54878. if (modifiers.indexOf('shift') !== -1) {opts.shiftKey = true;}
  54879. return $.Event(type, opts);
  54880. };
  54881. var only_modifier_event = function(event){
  54882. /**
  54883. * Return `true` if the event only contains modifiers keys.
  54884. * false otherwise
  54885. **/
  54886. var key = inv_keycodes[event.which];
  54887. return ((event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) &&
  54888. (key === 'alt'|| key === 'ctrl'|| key === 'meta'|| key === 'shift'));
  54889. };
  54890. var event_to_shortcut = function (event) {
  54891. /**
  54892. * Convert a jQuery Event object to a normalized shortcut string (shift-r)
  54893. **/
  54894. var shortcut = '';
  54895. var key = inv_keycodes[event.which];
  54896. if (event.altKey && key !== 'alt') {shortcut += 'alt-';}
  54897. if (event.ctrlKey && key !== 'ctrl') {shortcut += 'ctrl-';}
  54898. if (event.metaKey && key !== 'meta') {shortcut += 'meta-';}
  54899. if (event.shiftKey && key !== 'shift') {shortcut += 'shift-';}
  54900. shortcut += key;
  54901. return shortcut;
  54902. };
  54903. // Shortcut manager class
  54904. var ShortcutManager = function (delay, events, actions, env, config, mode) {
  54905. /**
  54906. * A class to deal with keyboard event and shortcut
  54907. *
  54908. * @class ShortcutManager
  54909. * @constructor
  54910. *
  54911. * :config: configobjet on which to call `update(....)` to persist the config.
  54912. * :mode: mode of this shortcut manager where to persist config.
  54913. */
  54914. mode = mode || 'command';
  54915. this._shortcuts = {};
  54916. this._defaults_bindings = [];
  54917. this.delay = delay || 800; // delay in milliseconds
  54918. this.events = events;
  54919. this.actions = actions;
  54920. this.actions.extend_env(env);
  54921. this._queue = [];
  54922. this._cleartimeout = null;
  54923. this._config = config;
  54924. this._mode = mode;
  54925. Object.seal(this);
  54926. };
  54927. ShortcutManager.prototype.clearsoon = function(){
  54928. /**
  54929. * Clear the pending shortcut soon, and cancel previous clearing
  54930. * that might be registered.
  54931. **/
  54932. var that = this;
  54933. clearTimeout(this._cleartimeout);
  54934. this._cleartimeout = setTimeout(function(){that.clearqueue();}, this.delay);
  54935. };
  54936. ShortcutManager.prototype.clearqueue = function(){
  54937. /**
  54938. * clear the pending shortcut sequence now.
  54939. **/
  54940. this._queue = [];
  54941. clearTimeout(this._cleartimeout);
  54942. };
  54943. var flatten_shorttree = function(tree){
  54944. /**
  54945. * Flatten a tree of shortcut sequences.
  54946. * use full to iterate over all the key/values of available shortcuts.
  54947. **/
  54948. var dct = {};
  54949. _.forEach(tree, function(value, key) {
  54950. if(typeof(value) === 'string'){
  54951. dct[key] = value;
  54952. } else {
  54953. var ftree=flatten_shorttree(value);
  54954. _.forEach(ftree, function(v2, subkey) {
  54955. dct[key+','+subkey] = ftree[subkey];
  54956. });
  54957. }
  54958. });
  54959. return dct;
  54960. };
  54961. ShortcutManager.prototype.get_action_shortcuts = function(name){
  54962. var ftree = flatten_shorttree(this._shortcuts);
  54963. var res = [];
  54964. _.forEach(ftree, function(value, key) {
  54965. if(value === name){
  54966. res.push(key);
  54967. }
  54968. });
  54969. return res;
  54970. };
  54971. ShortcutManager.prototype.get_action_shortcut = function(name){
  54972. var matches = this.get_action_shortcuts(name);
  54973. if (matches.length > 0) {
  54974. return matches[0];
  54975. }
  54976. return undefined;
  54977. };
  54978. ShortcutManager.prototype.help = function () {
  54979. var that = this;
  54980. var help = [];
  54981. var ftree = flatten_shorttree(this._shortcuts);
  54982. _.forEach(ftree, function(value, key) {
  54983. var action = that.actions.get(value);
  54984. var help_string = action.help||'== no help ==';
  54985. var help_index = action.help_index;
  54986. if (help_string) {
  54987. var shortstring = (action.shortstring||key);
  54988. help.push({
  54989. shortcut: shortstring,
  54990. help: help_string,
  54991. help_index: help_index}
  54992. );
  54993. }
  54994. });
  54995. help.sort(function (a, b) {
  54996. if (a.help_index === b.help_index) {
  54997. if (a.shortcut === b.shortcut) {
  54998. return 0;
  54999. }
  55000. if (a.shortcut > b.shortcut) {
  55001. return 1;
  55002. }
  55003. return -1;
  55004. }
  55005. if (a.help_index === undefined || a.help_index > b.help_index){
  55006. return 1;
  55007. }
  55008. return -1;
  55009. });
  55010. return help;
  55011. };
  55012. ShortcutManager.prototype.clear_shortcuts = function () {
  55013. this._shortcuts = {};
  55014. };
  55015. ShortcutManager.prototype.get_shortcut = function (shortcut){
  55016. /**
  55017. * return a node of the shortcut tree which an action name (string) if leaf,
  55018. * and an object with `object.subtree===true`
  55019. **/
  55020. if(typeof(shortcut) === 'string'){
  55021. shortcut = shortcut.split(',');
  55022. }
  55023. return this._get_leaf(shortcut, this._shortcuts);
  55024. };
  55025. ShortcutManager.prototype._get_leaf = function(shortcut_array, tree){
  55026. /**
  55027. * @private
  55028. * find a leaf/node in a subtree of the keyboard shortcut
  55029. *
  55030. **/
  55031. if(shortcut_array.length === 1){
  55032. return tree[shortcut_array[0]];
  55033. } else if( typeof(tree[shortcut_array[0]]) !== 'string'){
  55034. return this._get_leaf(shortcut_array.slice(1), tree[shortcut_array[0]]);
  55035. }
  55036. return null;
  55037. };
  55038. ShortcutManager.prototype.set_shortcut = function( shortcut, action_name){
  55039. if( typeof(action_name) !== 'string'){throw new Error('action is not a string', action_name);}
  55040. if( typeof(shortcut) === 'string'){
  55041. shortcut = shortcut.split(',');
  55042. }
  55043. return this._set_leaf(shortcut, action_name, this._shortcuts);
  55044. };
  55045. ShortcutManager.prototype._is_leaf = function(shortcut_array, tree){
  55046. if(shortcut_array.length === 1){
  55047. return(typeof(tree[shortcut_array[0]]) === 'string');
  55048. } else {
  55049. var subtree = tree[shortcut_array[0]];
  55050. return this._is_leaf(shortcut_array.slice(1), subtree );
  55051. }
  55052. };
  55053. ShortcutManager.prototype._remove_leaf = function(shortcut_array, tree, allow_node){
  55054. if(shortcut_array.length === 1){
  55055. var current_node = tree[shortcut_array[0]];
  55056. if(typeof(current_node) === 'string'){
  55057. delete tree[shortcut_array[0]];
  55058. } else {
  55059. throw new Error('try to delete non-leaf');
  55060. }
  55061. } else {
  55062. this._remove_leaf(shortcut_array.slice(1), tree[shortcut_array[0]], allow_node);
  55063. if(_.keys(tree[shortcut_array[0]]).length === 0){
  55064. delete tree[shortcut_array[0]];
  55065. }
  55066. }
  55067. };
  55068. ShortcutManager.prototype.is_available_shortcut = function(shortcut){
  55069. var shortcut_array = shortcut.split(',');
  55070. return this._is_available_shortcut(shortcut_array, this._shortcuts);
  55071. };
  55072. ShortcutManager.prototype._is_available_shortcut = function(shortcut_array, tree){
  55073. var current_node = tree[shortcut_array[0]];
  55074. if(!shortcut_array[0]){
  55075. return false;
  55076. }
  55077. if(current_node === undefined){
  55078. return true;
  55079. } else {
  55080. if (typeof(current_node) === 'string'){
  55081. return false;
  55082. } else { // assume is a sub-shortcut tree
  55083. return this._is_available_shortcut(shortcut_array.slice(1), current_node);
  55084. }
  55085. }
  55086. };
  55087. ShortcutManager.prototype._set_leaf = function(shortcut_array, action_name, tree){
  55088. var current_node = tree[shortcut_array[0]];
  55089. if(shortcut_array.length === 1){
  55090. if(current_node !== undefined && typeof(current_node) !== 'string'){
  55091. console.warn('[warning], you are overriting a long shortcut with a shorter one');
  55092. }
  55093. tree[shortcut_array[0]] = action_name;
  55094. return true;
  55095. } else {
  55096. if(typeof(current_node) === 'string'){
  55097. console.warn('you are trying to set a shortcut that will be shadowed'+
  55098. 'by a more specific one. Aborting for :', action_name, 'the following '+
  55099. 'will take precedence', current_node);
  55100. return false;
  55101. } else {
  55102. tree[shortcut_array[0]] = tree[shortcut_array[0]]||{};
  55103. }
  55104. this._set_leaf(shortcut_array.slice(1), action_name, tree[shortcut_array[0]]);
  55105. return true;
  55106. }
  55107. };
  55108. ShortcutManager.prototype._persist_shortcut = function(shortcut, data) {
  55109. /**
  55110. * add a shortcut to this manager and persist it to the config file.
  55111. **/
  55112. shortcut = shortcut.toLowerCase();
  55113. this.add_shortcut(shortcut, data);
  55114. var patch = {keys:{}};
  55115. patch.keys[this._mode] = {bind:{}};
  55116. patch.keys[this._mode].bind[shortcut] = data;
  55117. this._config.update(patch);
  55118. };
  55119. ShortcutManager.prototype._persist_remove_shortcut = function(shortcut){
  55120. /**
  55121. * Remove a shortcut from this manager and persist its removal.
  55122. */
  55123. shortcut = shortcut.toLowerCase();
  55124. this.remove_shortcut(shortcut);
  55125. var patch = {keys: {}};
  55126. patch.keys[this._mode] = {bind:{}};
  55127. patch.keys[this._mode].bind[shortcut] = null;
  55128. this._config.update(patch);
  55129. // if the shortcut we unbind is a default one, we add it to the list of
  55130. // things to unbind at startup
  55131. if( this._defaults_bindings.indexOf(shortcut) !== -1 ){
  55132. var cnf = (this._config.data.keys || {})[this._mode];
  55133. var unbind_array = cnf.unbind || [];
  55134. // unless it's already there (like if we have remapped a default
  55135. // shortcut to another command): unbind it)
  55136. if(unbind_array.indexOf(shortcut) === -1){
  55137. var _parray = unbind_array.concat(shortcut);
  55138. var unbind_patch = {keys:{}};
  55139. unbind_patch.keys[this._mode] = {unbind:_parray};
  55140. console.warn('up:', unbind_patch);
  55141. this._config.update(unbind_patch);
  55142. }
  55143. }
  55144. };
  55145. ShortcutManager.prototype.add_shortcut = function (shortcut, data, suppress_help_update) {
  55146. /**
  55147. * Add an action to be handled by shortcut manager.
  55148. *
  55149. * - `shortcut` should be a `Shortcut Sequence` of the for `Ctrl-Alt-C,Meta-X`...
  55150. * - `data` could be an `action name`, an `action` or a `function`.
  55151. * if a `function` is passed it will be converted to an anonymous `action`.
  55152. *
  55153. **/
  55154. var action_name = this.actions.get_name(data);
  55155. if (! action_name){
  55156. if (typeof data === 'string') {
  55157. // If we have an action name, allow it to be bound anyway.
  55158. console.log("Unknown action '" + data + "' for shortcut " + shortcut
  55159. + "; it may be defined by an extension which is not yet loaded.");
  55160. action_name = data;
  55161. } else {
  55162. throw new Error('does not know how to deal with : ' + data);
  55163. }
  55164. }
  55165. var _shortcut = normalize_shortcut(shortcut);
  55166. this.set_shortcut(_shortcut, action_name);
  55167. if (!suppress_help_update) {
  55168. // update the keyboard shortcuts notebook help
  55169. this.events.trigger('rebuild.QuickHelp');
  55170. }
  55171. };
  55172. ShortcutManager.prototype.add_shortcuts = function (data) {
  55173. /**
  55174. * Convenient methods to call `add_shortcut(key, value)` on several items
  55175. *
  55176. * data : Dict of the form {key:value, ...}
  55177. **/
  55178. var that = this;
  55179. _.forEach(data, function(value, key) {
  55180. that.add_shortcut(key, value, true);
  55181. });
  55182. // update the keyboard shortcuts notebook help
  55183. this.events.trigger('rebuild.QuickHelp');
  55184. };
  55185. ShortcutManager.prototype._add_default_shortcuts = function (data) {
  55186. /**
  55187. * same as add_shortcuts, but register them as "default" that if persistently unbound, with
  55188. * persist_remove_shortcut, need to be on the "unbind" list.
  55189. **/
  55190. this._defaults_bindings = this._defaults_bindings.concat(Object.keys(data));
  55191. this.add_shortcuts(data);
  55192. };
  55193. ShortcutManager.prototype.remove_shortcut = function (shortcut, suppress_help_update) {
  55194. /**
  55195. * Remove the binding of shortcut `shortcut` with its action.
  55196. * throw an error if trying to remove a non-exiting shortcut
  55197. **/
  55198. if(!shortcut){
  55199. console.warn('trying to remove empty shortcut');
  55200. return;
  55201. }
  55202. shortcut = normalize_shortcut(shortcut);
  55203. if( typeof(shortcut) === 'string'){
  55204. shortcut = shortcut.split(',');
  55205. }
  55206. /*
  55207. * The shortcut error should be explicit here, because it will be
  55208. * seen by users.
  55209. */
  55210. try {
  55211. this._remove_leaf(shortcut, this._shortcuts);
  55212. if (!suppress_help_update) {
  55213. // update the keyboard shortcuts notebook help
  55214. this.events.trigger('rebuild.QuickHelp');
  55215. }
  55216. } catch (ex) {
  55217. throw new Error('trying to remove a non-existent shortcut', shortcut, typeof shortcut);
  55218. }
  55219. };
  55220. ShortcutManager.prototype.call_handler = function (event) {
  55221. /**
  55222. * Call the corresponding shortcut handler for a keyboard event
  55223. * @method call_handler
  55224. * @return {Boolean} `true|false`, `false` if no handler was found, otherwise the value return by the handler.
  55225. * @param event {event}
  55226. *
  55227. * given an event, call the corresponding shortcut.
  55228. * return false is event wan handled, true otherwise
  55229. * in any case returning false stop event propagation
  55230. **/
  55231. this.clearsoon();
  55232. if(only_modifier_event(event)){
  55233. return true;
  55234. }
  55235. var shortcut = event_to_shortcut(event);
  55236. this._queue.push(shortcut);
  55237. var action_name = this.get_shortcut(this._queue);
  55238. if (typeof(action_name) === 'undefined'|| action_name === null){
  55239. this.clearqueue();
  55240. return true;
  55241. }
  55242. if (this.actions.exists(action_name)) {
  55243. event.preventDefault();
  55244. this.clearqueue();
  55245. return this.actions.call(action_name, event);
  55246. }
  55247. return false;
  55248. };
  55249. ShortcutManager.prototype.handles = function (event) {
  55250. var shortcut = event_to_shortcut(event);
  55251. var action_name = this.get_shortcut(this._queue.concat(shortcut));
  55252. return (typeof(action_name) !== 'undefined');
  55253. };
  55254. return {
  55255. keycodes : keycodes,
  55256. inv_keycodes : inv_keycodes,
  55257. ShortcutManager : ShortcutManager,
  55258. normalize_key : normalize_key,
  55259. normalize_shortcut : normalize_shortcut,
  55260. shortcut_to_event : shortcut_to_event,
  55261. event_to_shortcut : event_to_shortcut,
  55262. };
  55263. });
  55264. // Copyright (c) Jupyter Development Team.
  55265. // Distributed under the terms of the Modified BSD License.
  55266. define('notebook/js/outputarea',[
  55267. 'jquery',
  55268. 'base/js/utils',
  55269. 'base/js/i18n',
  55270. 'base/js/security',
  55271. 'base/js/keyboard',
  55272. 'base/js/markdown',
  55273. 'services/config',
  55274. ], function($, utils, i18n, security, keyboard, markdown, configmod) {
  55275. "use strict";
  55276. /**
  55277. * @class OutputArea
  55278. *
  55279. * @constructor
  55280. */
  55281. var OutputArea = function (options) {
  55282. this.config = options.config;
  55283. this.selector = options.selector;
  55284. this.events = options.events;
  55285. this.keyboard_manager = options.keyboard_manager;
  55286. this.wrapper = $(options.selector);
  55287. this.outputs = [];
  55288. this.collapsed = false;
  55289. this.scrolled = false;
  55290. this.scroll_state = 'auto';
  55291. this.trusted = true;
  55292. this.clear_queued = null;
  55293. if (options.prompt_area === undefined) {
  55294. this.prompt_area = true;
  55295. } else {
  55296. this.prompt_area = options.prompt_area;
  55297. }
  55298. this._display_id_targets = {};
  55299. this.create_elements();
  55300. this.style();
  55301. this.bind_events();
  55302. this.class_config = new configmod.ConfigWithDefaults(this.config,
  55303. OutputArea.config_defaults, 'OutputArea');
  55304. this.handle_appended = utils.throttle(this.handle_appended.bind(this));
  55305. };
  55306. OutputArea.config_defaults = {
  55307. stream_chunk_size: 8192, // chunk size for stream output
  55308. };
  55309. /**
  55310. * Class prototypes
  55311. **/
  55312. OutputArea.prototype.create_elements = function () {
  55313. var element = this.element = $("<div/>");
  55314. // wrap element in safe trigger,
  55315. // so that errors (e.g. in widget extensions) are logged instead of
  55316. // breaking everything.
  55317. this.element._original_trigger = this.element.trigger;
  55318. this.element.trigger = function (name, data) {
  55319. try {
  55320. this._original_trigger.apply(this, arguments);
  55321. } catch (e) {
  55322. console.error("Exception in event handler for " + name, e, arguments);
  55323. }
  55324. }
  55325. this.collapse_button = $("<div/>");
  55326. this.prompt_overlay = $("<div/>");
  55327. this.wrapper.append(this.prompt_overlay);
  55328. this.wrapper.append(this.element);
  55329. this.wrapper.append(this.collapse_button);
  55330. };
  55331. OutputArea.prototype.style = function () {
  55332. this.collapse_button.hide();
  55333. if (!this.prompt_area) {
  55334. this.prompt_overlay.hide();
  55335. }
  55336. this.wrapper.addClass('output_wrapper');
  55337. this.element.addClass('output');
  55338. this.collapse_button.addClass("btn btn-default output_collapsed");
  55339. this.collapse_button.attr('title', i18n.msg._('click to expand output'));
  55340. this.collapse_button.text('. . .');
  55341. this.prompt_overlay.addClass('out_prompt_overlay prompt');
  55342. this.prompt_overlay.attr('title', i18n.msg._('click to expand output; double click to hide output'));
  55343. this.expand();
  55344. };
  55345. /**
  55346. * Should the OutputArea scroll?
  55347. * Returns whether the height (in lines) exceeds the current threshold.
  55348. * Threshold will be OutputArea.minimum_scroll_threshold if scroll_state=true (manually requested)
  55349. * or OutputArea.auto_scroll_threshold if scroll_state='auto'.
  55350. * This will always return false if scroll_state=false (scroll disabled).
  55351. *
  55352. */
  55353. OutputArea.prototype._should_scroll = function () {
  55354. var threshold;
  55355. if (this.scroll_state === false) {
  55356. return false;
  55357. } else if (this.scroll_state === true) {
  55358. threshold = OutputArea.minimum_scroll_threshold;
  55359. } else {
  55360. threshold = OutputArea.auto_scroll_threshold;
  55361. }
  55362. if (threshold <=0) {
  55363. return false;
  55364. }
  55365. // line-height from https://stackoverflow.com/questions/1185151
  55366. var fontSize = this.element.css('font-size') || '14px';
  55367. var lineHeight = Math.floor((parseFloat(fontSize.replace('px','')) || 14) * 1.3);
  55368. return (this.element.height() > threshold * lineHeight);
  55369. };
  55370. OutputArea.prototype.bind_events = function () {
  55371. var that = this;
  55372. this.prompt_overlay.dblclick(function () { that.toggle_output(); });
  55373. this.prompt_overlay.click(function () { that.toggle_scroll(); });
  55374. this.element.on('resizeOutput', function () {
  55375. // maybe scroll output,
  55376. // if it's grown large enough and hasn't already been scrolled.
  55377. if (!that.scrolled && that._should_scroll()) {
  55378. that.scroll_area();
  55379. }
  55380. });
  55381. this.collapse_button.click(function () {
  55382. that.expand();
  55383. });
  55384. };
  55385. OutputArea.prototype.collapse = function () {
  55386. if (!this.collapsed) {
  55387. this.element.hide();
  55388. this.prompt_overlay.hide();
  55389. if (this.element.html()){
  55390. this.collapse_button.show();
  55391. }
  55392. this.collapsed = true;
  55393. // collapsing output clears scroll state
  55394. this.scroll_state = 'auto';
  55395. }
  55396. };
  55397. OutputArea.prototype.expand = function () {
  55398. if (this.collapsed) {
  55399. this.collapse_button.hide();
  55400. this.element.show();
  55401. if (this.prompt_area) {
  55402. this.prompt_overlay.show();
  55403. }
  55404. this.collapsed = false;
  55405. this.scroll_if_long();
  55406. }
  55407. };
  55408. OutputArea.prototype.toggle_output = function () {
  55409. if (this.collapsed) {
  55410. this.expand();
  55411. } else {
  55412. this.collapse();
  55413. }
  55414. };
  55415. OutputArea.prototype.scroll_area = function () {
  55416. this.element.addClass('output_scroll');
  55417. this.prompt_overlay.attr('title', i18n.msg._('click to unscroll output; double click to hide'));
  55418. this.scrolled = true;
  55419. };
  55420. OutputArea.prototype.unscroll_area = function () {
  55421. this.element.removeClass('output_scroll');
  55422. this.prompt_overlay.attr('title', i18n.msg._('click to scroll output; double click to hide'));
  55423. this.scrolled = false;
  55424. };
  55425. /**
  55426. * Scroll OutputArea if height exceeds a threshold.
  55427. *
  55428. * Threshold is OutputArea.minimum_scroll_threshold if scroll_state = true,
  55429. * OutputArea.auto_scroll_threshold if scroll_state='auto'.
  55430. *
  55431. **/
  55432. OutputArea.prototype.scroll_if_long = function () {
  55433. var should_scroll = this._should_scroll();
  55434. if (!this.scrolled && should_scroll) {
  55435. // only allow scrolling long-enough output
  55436. this.scroll_area();
  55437. } else if (this.scrolled && !should_scroll) {
  55438. // scrolled and shouldn't be
  55439. this.unscroll_area();
  55440. }
  55441. };
  55442. OutputArea.prototype.toggle_scroll = function () {
  55443. if (this.scroll_state == 'auto') {
  55444. this.scroll_state = !this.scrolled;
  55445. } else {
  55446. this.scroll_state = !this.scroll_state;
  55447. }
  55448. if (this.scrolled) {
  55449. this.unscroll_area();
  55450. } else {
  55451. // only allow scrolling long-enough output
  55452. this.scroll_if_long();
  55453. }
  55454. };
  55455. // typeset with MathJax if MathJax is available
  55456. OutputArea.prototype.typeset = function () {
  55457. utils.typeset(this.element);
  55458. };
  55459. OutputArea.prototype.handle_output = function (msg) {
  55460. var json = {};
  55461. var msg_type = json.output_type = msg.header.msg_type;
  55462. var content = msg.content;
  55463. switch(msg_type) {
  55464. case "stream" :
  55465. json.text = content.text;
  55466. json.name = content.name;
  55467. break;
  55468. case "execute_result":
  55469. json.execution_count = content.execution_count;
  55470. case "update_display_data":
  55471. case "display_data":
  55472. json.transient = content.transient;
  55473. json.data = content.data;
  55474. json.metadata = content.metadata;
  55475. break;
  55476. case "error":
  55477. json.ename = content.ename;
  55478. json.evalue = content.evalue;
  55479. json.traceback = content.traceback;
  55480. break;
  55481. default:
  55482. console.error("unhandled output message", msg);
  55483. return;
  55484. }
  55485. this.append_output(json);
  55486. };
  55487. // Declare mime type as constants
  55488. var MIME_JAVASCRIPT = 'application/javascript';
  55489. var MIME_HTML = 'text/html';
  55490. var MIME_MARKDOWN = 'text/markdown';
  55491. var MIME_LATEX = 'text/latex';
  55492. var MIME_SVG = 'image/svg+xml';
  55493. var MIME_PNG = 'image/png';
  55494. var MIME_JPEG = 'image/jpeg';
  55495. var MIME_GIF = 'image/gif';
  55496. var MIME_PDF = 'application/pdf';
  55497. var MIME_TEXT = 'text/plain';
  55498. OutputArea.output_types = [
  55499. MIME_JAVASCRIPT,
  55500. MIME_HTML,
  55501. MIME_MARKDOWN,
  55502. MIME_LATEX,
  55503. MIME_SVG,
  55504. MIME_PNG,
  55505. MIME_JPEG,
  55506. MIME_GIF,
  55507. MIME_PDF,
  55508. MIME_TEXT,
  55509. ];
  55510. OutputArea.prototype.validate_mimebundle = function (bundle) {
  55511. /** scrub invalid outputs */
  55512. if (typeof bundle.data !== 'object') {
  55513. console.warn("mimebundle missing data", bundle);
  55514. bundle.data = {};
  55515. }
  55516. if (typeof bundle.metadata !== 'object') {
  55517. console.warn("mimebundle missing metadata", bundle);
  55518. bundle.metadata = {};
  55519. }
  55520. var data = bundle.data;
  55521. $.map(OutputArea.output_types, function(key){
  55522. if ((key.indexOf('application/') === -1 || key.indexOf('json') === -1) &&
  55523. data[key] !== undefined &&
  55524. typeof data[key] !== 'string'
  55525. ) {
  55526. console.log("Invalid type for " + key, data[key]);
  55527. delete data[key];
  55528. }
  55529. });
  55530. return bundle;
  55531. };
  55532. OutputArea.prototype.append_output = function (json) {
  55533. this.expand();
  55534. if (this.clear_queued) {
  55535. this.clear_output(false);
  55536. this._needs_height_reset = true;
  55537. }
  55538. var record_output = true;
  55539. switch(json.output_type) {
  55540. case 'update_display_data':
  55541. record_output = false;
  55542. json = this.validate_mimebundle(json);
  55543. this.update_display_data(json);
  55544. return;
  55545. case 'execute_result':
  55546. json = this.validate_mimebundle(json);
  55547. this.append_execute_result(json);
  55548. break;
  55549. case 'stream':
  55550. // append_stream might have merged the output with earlier stream output
  55551. record_output = this.append_stream(json);
  55552. break;
  55553. case 'error':
  55554. this.append_error(json);
  55555. break;
  55556. case 'display_data':
  55557. // append handled below
  55558. json = this.validate_mimebundle(json);
  55559. break;
  55560. default:
  55561. console.log("unrecognized output type: " + json.output_type);
  55562. this.append_unrecognized(json);
  55563. }
  55564. if (json.output_type === 'display_data') {
  55565. var that = this;
  55566. this.append_display_data(json, this.handle_appended);
  55567. } else {
  55568. this.handle_appended();
  55569. }
  55570. if (record_output) {
  55571. this.outputs.push(json);
  55572. }
  55573. this.events.trigger('output_added.OutputArea', {
  55574. output: json,
  55575. output_area: this,
  55576. });
  55577. };
  55578. OutputArea.prototype.handle_appended = function () {
  55579. if (this._needs_height_reset) {
  55580. this.element.height('');
  55581. this._needs_height_reset = false;
  55582. }
  55583. this.element.trigger('resizeOutput', {output_area: this});
  55584. };
  55585. OutputArea.prototype.create_output_area = function () {
  55586. var oa = $("<div/>").addClass("output_area");
  55587. if (this.prompt_area) {
  55588. oa.append($('<div/>').addClass('run_this_cell'));
  55589. oa.append($('<div/>').addClass('prompt'));
  55590. }
  55591. return oa;
  55592. };
  55593. function _get_metadata_key(metadata, key, mime) {
  55594. var mime_md = metadata[mime];
  55595. // mime-specific higher priority
  55596. if (mime_md && mime_md[key] !== undefined) {
  55597. return mime_md[key];
  55598. }
  55599. // fallback on global
  55600. return metadata[key];
  55601. }
  55602. OutputArea.prototype.create_output_subarea = function(md, classes, mime) {
  55603. var subarea = $('<div/>').addClass('output_subarea').addClass(classes);
  55604. // Unforce RTL
  55605. subarea.attr("dir","auto");
  55606. if (_get_metadata_key(md, 'isolated', mime)) {
  55607. // Create an iframe to isolate the subarea from the rest of the
  55608. // document
  55609. var iframe = $('<iframe/>').addClass('box-flex1');
  55610. iframe.css({'height':1, 'width':'100%', 'display':'block'});
  55611. iframe.attr('frameborder', 0);
  55612. iframe.attr('scrolling', 'auto');
  55613. // Once the iframe is loaded, the subarea is dynamically inserted
  55614. iframe.on('load', function() {
  55615. // Workaround needed by Firefox, to properly render svg inside
  55616. // iframes, see https://stackoverflow.com/questions/10177190/
  55617. // svg-dynamically-added-to-iframe-does-not-render-correctly
  55618. this.contentDocument.open();
  55619. // Insert the subarea into the iframe
  55620. // We must directly write the html. When using Jquery's append
  55621. // method, javascript is evaluated in the parent document and
  55622. // not in the iframe document. At this point, subarea doesn't
  55623. // contain any user content.
  55624. this.contentDocument.write(subarea.html());
  55625. this.contentDocument.close();
  55626. var body = this.contentDocument.body;
  55627. // Adjust the iframe height automatically
  55628. iframe.height(body.scrollHeight + 'px');
  55629. });
  55630. // Elements should be appended to the inner subarea and not to the
  55631. // iframe
  55632. iframe.append = function(that) {
  55633. subarea.append(that);
  55634. };
  55635. return iframe;
  55636. } else {
  55637. return subarea;
  55638. }
  55639. };
  55640. OutputArea.prototype._append_javascript_error = function (err, element) {
  55641. /**
  55642. * display a message when a javascript error occurs in display output
  55643. */
  55644. var msg = i18n.msg._("Javascript error adding output!");
  55645. if ( element === undefined ) return;
  55646. element
  55647. .append($('<div/>').text(msg).addClass('js-error'))
  55648. .append($('<div/>').text(err.toString()).addClass('js-error'))
  55649. .append($('<div/>').text(i18n.msg._('See your browser Javascript console for more details.')).addClass('js-error'));
  55650. };
  55651. OutputArea.prototype._safe_append = function (toinsert, toreplace) {
  55652. /**
  55653. * safely append an item to the document
  55654. * this is an object created by user code,
  55655. * and may have errors, which should not be raised
  55656. * under any circumstances.
  55657. */
  55658. try {
  55659. if (toreplace) {
  55660. toreplace.replaceWith(toinsert);
  55661. } else {
  55662. this.element.append(toinsert);
  55663. }
  55664. } catch(err) {
  55665. console.error(err);
  55666. // Create an actual output_area and output_subarea, which creates
  55667. // the prompt area and the proper indentation.
  55668. toinsert = this.create_output_area();
  55669. var subarea = $('<div/>').addClass('output_subarea');
  55670. // Unforce RTL
  55671. subarea.attr("dir","auto");
  55672. toinsert.append(subarea);
  55673. this._append_javascript_error(err, subarea);
  55674. this.element.append(toinsert);
  55675. }
  55676. // Notify others of changes.
  55677. this.element.trigger('changed', {output_area: this});
  55678. };
  55679. OutputArea.output_prompt_classical = function(prompt_value) {
  55680. return $('<bdi>').text(i18n.msg.sprintf(i18n.msg._('Out[%s]:'),prompt_value));
  55681. };
  55682. OutputArea.output_prompt_function = OutputArea.output_prompt_classical;
  55683. OutputArea.prototype.append_execute_result = function (json) {
  55684. var n = json.execution_count || ' ';
  55685. var toinsert = this.create_output_area();
  55686. this._record_display_id(json, toinsert);
  55687. if (this.prompt_area) {
  55688. toinsert.find('div.prompt')
  55689. .addClass('output_prompt')
  55690. .empty()
  55691. .append(OutputArea.output_prompt_function(n));
  55692. }
  55693. var inserted = this.append_mime_type(json, toinsert);
  55694. if (inserted) {
  55695. inserted.addClass('output_result');
  55696. }
  55697. this._safe_append(toinsert);
  55698. // If we just output latex, typeset it.
  55699. if ((json.data[MIME_LATEX] !== undefined) ||
  55700. (json.data[MIME_HTML] !== undefined) ||
  55701. (json.data[MIME_MARKDOWN] !== undefined)) {
  55702. this.typeset();
  55703. }
  55704. };
  55705. OutputArea.prototype.append_error = function (json) {
  55706. var ename = json.ename;
  55707. var evalue = json.evalue;
  55708. var tb = json.traceback;
  55709. var s = '';
  55710. if (tb !== undefined && tb.length > 0) {
  55711. var len = tb.length;
  55712. for (var i=0; i<len; i++) {
  55713. s = s + tb[i] + '\n';
  55714. }
  55715. s = s + '\n';
  55716. } else if (ename !== undefined && ename.length > 0 && evalue !== undefined && evalue.length > 0) {
  55717. // If traceback is empty, and we have ename and evalue entries, concatenate the two to display
  55718. s = ename + ': ' + evalue;
  55719. }
  55720. if (s.length > 0) {
  55721. var toinsert = this.create_output_area();
  55722. var append_text = OutputArea.append_map[MIME_TEXT];
  55723. if (append_text) {
  55724. append_text.apply(this, [s, {}, toinsert]).addClass('output_error');
  55725. }
  55726. this._safe_append(toinsert);
  55727. }
  55728. };
  55729. OutputArea.prototype.append_stream = function (json) {
  55730. var text = json.text;
  55731. if (typeof text !== 'string') {
  55732. console.error("Stream output is invalid (missing text)", json);
  55733. return false;
  55734. }
  55735. var subclass = "output_"+json.name;
  55736. if (this.outputs.length > 0){
  55737. // have at least one output to consider
  55738. var last = this.outputs[this.outputs.length-1];
  55739. if (last.output_type == 'stream' && json.name == last.name){
  55740. if (last.text.length > this.class_config.get_sync('stream_chunk_size')) {
  55741. // don't keep extending long blocks
  55742. var last_newline_idx = last.text.lastIndexOf('\n');
  55743. // if the last stream output doesn't end on a newline,
  55744. // split on last newline and take the tail with the new output
  55745. if (last_newline_idx !== -1 && last_newline_idx !== last.text.length - 1) {
  55746. // truncate last.text to its last newline,
  55747. // and take the tail with the new output.
  55748. var tail = last.text.slice(last_newline_idx + 1);
  55749. last.text = last.text.slice(0, last_newline_idx + 1);
  55750. // we changed last's content, so we have to re-render it
  55751. text = json.text = tail + json.text;
  55752. var pre = this.element.find('div.'+subclass).last().find('pre');
  55753. var html = utils.fixConsole(last.text);
  55754. html = utils.autoLinkUrls(html);
  55755. pre.html(html);
  55756. }
  55757. } else {
  55758. // latest output was in the same stream,
  55759. // so append to it instead of making a new output.
  55760. // escape ANSI & HTML specials:
  55761. last.text = utils.fixOverwrittenChars(last.text + json.text);
  55762. var pre = this.element.find('div.'+subclass).last().find('pre');
  55763. var html = utils.fixConsole(last.text);
  55764. html = utils.autoLinkUrls(html);
  55765. // The only user content injected with this HTML call is
  55766. // escaped by the fixConsole() method.
  55767. pre.html(html);
  55768. // return false signals that we merged this output with the previous one,
  55769. // and the new output shouldn't be recorded.
  55770. return false;
  55771. }
  55772. }
  55773. }
  55774. if (!text.replace("\r", "")) {
  55775. // text is nothing (empty string, \r, etc.)
  55776. // so don't append any elements, which might add undesirable space
  55777. // return true to indicate the output should be recorded.
  55778. return true;
  55779. }
  55780. // If we got here, attach a new div
  55781. var toinsert = this.create_output_area();
  55782. var append_text = OutputArea.append_map[MIME_TEXT];
  55783. if (append_text) {
  55784. append_text.apply(this, [text, {}, toinsert]).addClass("output_stream " + subclass);
  55785. }
  55786. this._safe_append(toinsert);
  55787. return true;
  55788. };
  55789. OutputArea.prototype.append_unrecognized = function (json) {
  55790. var that = this;
  55791. var toinsert = this.create_output_area();
  55792. var subarea = $('<div/>').addClass('output_subarea output_unrecognized');
  55793. // Unforce RTL
  55794. subarea.attr("dir","auto");
  55795. toinsert.append(subarea);
  55796. subarea.append(
  55797. $("<a>")
  55798. .attr("href", "#")
  55799. .text(i18n.msg.sprintf(i18n.msg._("Unrecognized output: %s"),json.output_type))
  55800. .click(function () {
  55801. that.events.trigger('unrecognized_output.OutputArea', {output: json});
  55802. })
  55803. );
  55804. this._safe_append(toinsert);
  55805. };
  55806. OutputArea.prototype.update_display_data = function (json, handle_inserted) {
  55807. var oa = this;
  55808. var targets;
  55809. var display_id = (json.transient || {}).display_id;
  55810. if (!display_id) {
  55811. console.warn("Handling update_display with no display_id", json);
  55812. return;
  55813. }
  55814. targets = this._display_id_targets[display_id];
  55815. if (!targets) {
  55816. console.warn("No targets for display_id", display_id, json);
  55817. return;
  55818. }
  55819. // we've seen it before, update output data
  55820. targets.map(function (target) {
  55821. oa.outputs[target.index].data = json.data;
  55822. oa.outputs[target.index].metadata = json.metadata;
  55823. var toinsert = oa.create_output_area();
  55824. if (oa.append_mime_type(json, toinsert, handle_inserted)) {
  55825. oa._safe_append(toinsert, target.element);
  55826. }
  55827. target.element = toinsert;
  55828. });
  55829. // If we just output something that could contain latex, typeset it.
  55830. if ((json.data[MIME_LATEX] !== undefined) ||
  55831. (json.data[MIME_HTML] !== undefined) ||
  55832. (json.data[MIME_MARKDOWN] !== undefined)) {
  55833. this.typeset();
  55834. }
  55835. this.events.trigger('output_updated.OutputArea', {
  55836. output: json,
  55837. output_area: this,
  55838. });
  55839. };
  55840. OutputArea.prototype._record_display_id = function (json, element) {
  55841. // record display_id of a display_data / execute_result
  55842. var display_id = (json.transient || {}).display_id;
  55843. if (!display_id) return;
  55844. // it has a display_id;
  55845. var targets = this._display_id_targets[display_id];
  55846. if (!targets) {
  55847. targets = this._display_id_targets[display_id] = [];
  55848. }
  55849. targets.push({
  55850. index: this.outputs.length,
  55851. element: element,
  55852. });
  55853. };
  55854. OutputArea.prototype.append_display_data = function (json, handle_inserted) {
  55855. var toinsert = this.create_output_area();
  55856. this._record_display_id(json, toinsert);
  55857. if (this.append_mime_type(json, toinsert, handle_inserted)) {
  55858. this._safe_append(toinsert);
  55859. // If we just output latex, typeset it.
  55860. if ((json.data[MIME_LATEX] !== undefined) ||
  55861. (json.data[MIME_HTML] !== undefined) ||
  55862. (json.data[MIME_MARKDOWN] !== undefined)) {
  55863. this.typeset();
  55864. }
  55865. }
  55866. };
  55867. OutputArea.safe_outputs = {};
  55868. OutputArea.safe_outputs[MIME_TEXT] = true;
  55869. OutputArea.safe_outputs[MIME_LATEX] = true;
  55870. OutputArea.safe_outputs[MIME_PNG] = true;
  55871. OutputArea.safe_outputs[MIME_JPEG] = true;
  55872. OutputArea.safe_outputs[MIME_GIF] = true;
  55873. OutputArea.prototype.append_mime_type = function (json, element, handle_inserted) {
  55874. for (var i=0; i < OutputArea.display_order.length; i++) {
  55875. var type = OutputArea.display_order[i];
  55876. var append = OutputArea.append_map[type];
  55877. if ((json.data[type] !== undefined) && append) {
  55878. var md = json.metadata || {};
  55879. var value = json.data[type];
  55880. var toinsert;
  55881. try {
  55882. if (!this.trusted && !OutputArea.safe_outputs[type]) {
  55883. // not trusted, sanitize HTML
  55884. if (type===MIME_HTML || type==='text/svg') {
  55885. var parsed = $(security.sanitize_html_and_parse(value));
  55886. toinsert = append.apply(this, [parsed, md, element, handle_inserted]);
  55887. } else {
  55888. // don't display if we don't know how to sanitize it
  55889. console.log("Ignoring untrusted " + type + " output.");
  55890. continue;
  55891. }
  55892. } else {
  55893. toinsert = append.apply(this, [value, md, element, handle_inserted]);
  55894. }
  55895. } catch (e) {
  55896. console.error('Failed to render mimetype "' + type + '" with: ', e);
  55897. continue;
  55898. }
  55899. // Since only the png and jpeg mime types call the inserted
  55900. // callback, if the mime type is something other we must call the
  55901. // inserted callback only when the element is actually inserted
  55902. // into the DOM. Use a timeout of 0 to do this.
  55903. if ([MIME_PNG, MIME_JPEG, MIME_GIF].indexOf(type) < 0 && handle_inserted !== undefined) {
  55904. setTimeout(handle_inserted, 0);
  55905. }
  55906. this.events.trigger('output_appended.OutputArea', [type, value, md, toinsert]);
  55907. return toinsert;
  55908. }
  55909. }
  55910. return null;
  55911. };
  55912. var append_html = function (html, md, element) {
  55913. var type = MIME_HTML;
  55914. var toinsert = this.create_output_subarea(md, "output_html rendered_html", type);
  55915. this.keyboard_manager.register_events(toinsert);
  55916. toinsert.append(html);
  55917. dblclick_to_reset_size(toinsert.find('img'));
  55918. element.append(toinsert);
  55919. return toinsert;
  55920. };
  55921. var append_markdown = function(text, md, element) {
  55922. var type = MIME_MARKDOWN;
  55923. var toinsert = this.create_output_subarea(md, "output_markdown rendered_html", type);
  55924. markdown.render(text, {
  55925. with_math: true,
  55926. clean_tables: true
  55927. }, function (err, html) {
  55928. toinsert.append(html);
  55929. });
  55930. dblclick_to_reset_size(toinsert.find('img'));
  55931. element.append(toinsert);
  55932. return toinsert;
  55933. };
  55934. var append_javascript = function (js, md, element) {
  55935. /**
  55936. * We just eval the JS code, element appears in the local scope.
  55937. */
  55938. var type = MIME_JAVASCRIPT;
  55939. var toinsert = this.create_output_subarea(md, "output_javascript rendered_html", type);
  55940. this.keyboard_manager.register_events(toinsert);
  55941. element.append(toinsert);
  55942. // Fix for ipython/issues/5293, make sure `element` is the area which
  55943. // output can be inserted into at the time of JS execution.
  55944. element = toinsert;
  55945. try {
  55946. eval(js);
  55947. } catch(err) {
  55948. console.log(err);
  55949. this._append_javascript_error(err, toinsert);
  55950. }
  55951. return toinsert;
  55952. };
  55953. var append_text = function (data, md, element) {
  55954. var type = MIME_TEXT;
  55955. var toinsert = this.create_output_subarea(md, "output_text", type);
  55956. data = utils.fixOverwrittenChars(data);
  55957. // escape ANSI & HTML specials in plaintext:
  55958. data = utils.fixConsole(data);
  55959. data = utils.autoLinkUrls(data);
  55960. // The only user content injected with this HTML call is
  55961. // escaped by the fixConsole() method.
  55962. toinsert.append($("<pre/>").html(data));
  55963. element.append(toinsert);
  55964. return toinsert;
  55965. };
  55966. var append_svg = function (svg_html, md, element) {
  55967. var type = MIME_SVG;
  55968. var toinsert = this.create_output_subarea(md, "output_svg", type);
  55969. // Get the svg element from within the HTML.
  55970. // One svg is supposed, but could embed other nested svgs
  55971. var svg = $($('<div \>').html(svg_html).find('svg')[0]);
  55972. var svg_area = $('<div />');
  55973. var width = svg.attr('width');
  55974. var height = svg.attr('height');
  55975. svg
  55976. .width('100%')
  55977. .height('100%');
  55978. svg_area
  55979. .width(width)
  55980. .height(height);
  55981. svg_area.append(svg);
  55982. toinsert.append(svg_area);
  55983. element.append(toinsert);
  55984. return toinsert;
  55985. };
  55986. function dblclick_to_reset_size (img) {
  55987. /**
  55988. * Double-click on an image toggles confinement to notebook width
  55989. *
  55990. * img: jQuery element
  55991. */
  55992. img.dblclick(function () {
  55993. // dblclick toggles *raw* size, disabling max-width confinement.
  55994. if (img.hasClass('unconfined')) {
  55995. img.removeClass('unconfined');
  55996. } else {
  55997. img.addClass('unconfined');
  55998. }
  55999. });
  56000. }
  56001. var set_width_height = function (img, md, mime) {
  56002. /**
  56003. * set width and height of an img element from metadata
  56004. */
  56005. var height = _get_metadata_key(md, 'height', mime);
  56006. if (height !== undefined) img.attr('height', height);
  56007. var width = _get_metadata_key(md, 'width', mime);
  56008. if (width !== undefined) img.attr('width', width);
  56009. if (_get_metadata_key(md, 'unconfined', mime)) {
  56010. img.addClass('unconfined');
  56011. }
  56012. };
  56013. OutputArea.prototype._append_img = function (src_type, md, element, handle_inserted, MIME, type_string) {
  56014. var type = MIME;
  56015. var toinsert = this.create_output_subarea(md, 'output_' + type_string, type);
  56016. var img = $("<img/>");
  56017. if (handle_inserted !== undefined) {
  56018. img.on('load', function(){
  56019. handle_inserted(img);
  56020. });
  56021. }
  56022. img[0].src = 'data:image/' + type_string + ';base64,'+ src_type;
  56023. set_width_height(img, md, type);
  56024. dblclick_to_reset_size(img);
  56025. toinsert.append(img);
  56026. element.append(toinsert);
  56027. return toinsert;
  56028. };
  56029. var append_png = function (png, md, element, handle_inserted) {
  56030. return this._append_img(png, md, element, handle_inserted, MIME_PNG, 'png');
  56031. };
  56032. var append_jpeg = function (jpeg, md, element, handle_inserted) {
  56033. return this._append_img(jpeg, md, element, handle_inserted, MIME_JPEG, 'jpeg');
  56034. };
  56035. var append_gif = function (gif, md, element, handle_inserted) {
  56036. return this._append_img(gif, md, element, handle_inserted, MIME_GIF, 'gif');
  56037. };
  56038. var append_pdf = function (pdf, md, element) {
  56039. var type = MIME_PDF;
  56040. var toinsert = this.create_output_subarea(md, "output_pdf", type);
  56041. var a = $('<a/>').attr('href', 'data:application/pdf;base64,'+pdf);
  56042. a.attr('target', '_blank');
  56043. a.text('View PDF');
  56044. toinsert.append(a);
  56045. element.append(toinsert);
  56046. return toinsert;
  56047. };
  56048. var append_latex = function (latex, md, element) {
  56049. /**
  56050. * This method cannot do the typesetting because the latex first has to
  56051. * be on the page.
  56052. */
  56053. var type = MIME_LATEX;
  56054. var toinsert = this.create_output_subarea(md, "output_latex", type);
  56055. toinsert.text(latex);
  56056. element.append(toinsert);
  56057. return toinsert;
  56058. };
  56059. OutputArea.prototype.append_raw_input = function (msg) {
  56060. var that = this;
  56061. this.expand();
  56062. var content = msg.content;
  56063. var area = this.create_output_area();
  56064. // disable any other raw_inputs, if they are left around
  56065. $("div.output_subarea.raw_input_container").remove();
  56066. var input_type = content.password ? 'password' : 'text';
  56067. area.append(
  56068. $("<div/>")
  56069. .addClass("box-flex1 output_subarea raw_input_container")
  56070. .append(
  56071. $("<pre/>")
  56072. .addClass("raw_input_prompt")
  56073. .html(utils.fixConsole(content.prompt))
  56074. .append(
  56075. $("<input/>")
  56076. .addClass("raw_input")
  56077. .attr('type', input_type)
  56078. .attr("size", 47)
  56079. .keydown(function (event, ui) {
  56080. // make sure we submit on enter,
  56081. // and don't re-execute the *cell* on shift-enter
  56082. if (event.which === keyboard.keycodes.enter) {
  56083. that._submit_raw_input();
  56084. return false;
  56085. }
  56086. })
  56087. )
  56088. )
  56089. .attr("dir","auto")
  56090. );
  56091. this.element.append(area);
  56092. var raw_input = area.find('input.raw_input');
  56093. // Register events that enable/disable the keyboard manager while raw
  56094. // input is focused.
  56095. this.keyboard_manager.register_events(raw_input);
  56096. // Note, the following line used to read raw_input.focus().focus().
  56097. // This seemed to be needed otherwise only the cell would be focused.
  56098. // But with the modal UI, this seems to work fine with one call to focus().
  56099. raw_input.focus();
  56100. };
  56101. OutputArea.prototype._submit_raw_input = function (evt) {
  56102. var container = this.element.find("div.raw_input_container");
  56103. var theprompt = container.find("pre.raw_input_prompt");
  56104. var theinput = container.find("input.raw_input");
  56105. var value = theinput.val();
  56106. var echo = value;
  56107. // don't echo if it's a password
  56108. if (theinput.attr('type') == 'password') {
  56109. echo = '········';
  56110. }
  56111. var content = {
  56112. output_type : 'stream',
  56113. name : 'stdout',
  56114. text : theprompt.text() + echo + '\n'
  56115. };
  56116. // remove form container
  56117. container.parent().remove();
  56118. // replace with plaintext version in stdout
  56119. this.append_output(content);
  56120. this.events.trigger('send_input_reply.Kernel', value);
  56121. };
  56122. OutputArea.prototype.handle_clear_output = function (msg) {
  56123. /**
  56124. * msg spec v4 had stdout, stderr, display keys
  56125. * v4.1 replaced these with just wait
  56126. * The default behavior is the same (stdout=stderr=display=True, wait=False),
  56127. * so v4 messages will still be properly handled,
  56128. * except for the rarely used clearing less than all output.
  56129. */
  56130. this.clear_output(msg.content.wait || false);
  56131. };
  56132. OutputArea.prototype.clear_output = function(wait, ignore_clear_queue) {
  56133. if (wait) {
  56134. // If a clear is queued, clear before adding another to the queue.
  56135. if (this.clear_queued) {
  56136. this.clear_output(false);
  56137. }
  56138. this.clear_queued = true;
  56139. } else {
  56140. // Fix the output div's height if the clear_output is waiting for
  56141. // new output (it is being used in an animation).
  56142. if (!ignore_clear_queue && this.clear_queued) {
  56143. // this.element.height() rounds the height, so we get the exact value
  56144. var height = this.element[0].getBoundingClientRect().height;
  56145. this.element.height(height);
  56146. this.clear_queued = false;
  56147. }
  56148. // Clear all
  56149. // Remove load event handlers from img tags because we don't want
  56150. // them to fire if the image is never added to the page.
  56151. this.element.find('img').off('load');
  56152. this.element.trigger('clearing', {output_area: this});
  56153. this.element.html("");
  56154. // Notify others of changes.
  56155. this.element.trigger('changed', {output_area: this});
  56156. this.element.trigger('cleared', {output_area: this});
  56157. this.outputs = [];
  56158. this._display_id_targets = {};
  56159. this.trusted = true;
  56160. this.unscroll_area();
  56161. this.expand();
  56162. return;
  56163. }
  56164. };
  56165. // JSON serialization
  56166. OutputArea.prototype.fromJSON = function (outputs, metadata) {
  56167. var len = outputs.length;
  56168. metadata = metadata || {};
  56169. for (var i=0; i<len; i++) {
  56170. this.append_output(outputs[i]);
  56171. }
  56172. if (metadata.collapsed !== undefined) {
  56173. if (metadata.collapsed) {
  56174. this.collapse();
  56175. } else {
  56176. this.expand();
  56177. }
  56178. }
  56179. if (metadata.scrolled !== undefined) {
  56180. this.scroll_state = metadata.scrolled;
  56181. if (metadata.scrolled) {
  56182. this.scroll_if_long();
  56183. } else {
  56184. this.unscroll_area();
  56185. }
  56186. }
  56187. };
  56188. /**
  56189. * Return for-saving version of outputs.
  56190. * Excludes transient values.
  56191. */
  56192. OutputArea.prototype.toJSON = function () {
  56193. return this.outputs.map(function (out) {
  56194. var out2 = {};
  56195. Object.keys(out).map(function (key) {
  56196. if (key != 'transient') {
  56197. out2[key] = out[key];
  56198. }
  56199. });
  56200. return out2;
  56201. });
  56202. };
  56203. /**
  56204. * Class properties
  56205. **/
  56206. /**
  56207. * Threshold to trigger autoscroll when the OutputArea is resized,
  56208. * typically when new outputs are added.
  56209. *
  56210. * Behavior is undefined if autoscroll is lower than minimum_scroll_threshold,
  56211. * unless it is < 0, in which case autoscroll will never be triggered
  56212. *
  56213. * @property auto_scroll_threshold
  56214. * @type Number
  56215. * @default 100
  56216. *
  56217. **/
  56218. OutputArea.auto_scroll_threshold = 100;
  56219. /**
  56220. * Lower limit (in lines) for OutputArea to be made scrollable. OutputAreas
  56221. * shorter than this are never scrolled.
  56222. *
  56223. * @property minimum_scroll_threshold
  56224. * @type Number
  56225. * @default 20
  56226. *
  56227. **/
  56228. OutputArea.minimum_scroll_threshold = 20;
  56229. OutputArea.display_order = [
  56230. MIME_JAVASCRIPT,
  56231. MIME_HTML,
  56232. MIME_MARKDOWN,
  56233. MIME_LATEX,
  56234. MIME_SVG,
  56235. MIME_PNG,
  56236. MIME_JPEG,
  56237. MIME_GIF,
  56238. MIME_PDF,
  56239. MIME_TEXT
  56240. ];
  56241. OutputArea.append_map = {};
  56242. OutputArea.append_map[MIME_TEXT] = append_text;
  56243. OutputArea.append_map[MIME_HTML] = append_html;
  56244. OutputArea.append_map[MIME_MARKDOWN] = append_markdown;
  56245. OutputArea.append_map[MIME_SVG] = append_svg;
  56246. OutputArea.append_map[MIME_PNG] = append_png;
  56247. OutputArea.append_map[MIME_JPEG] = append_jpeg;
  56248. OutputArea.append_map[MIME_GIF] = append_gif;
  56249. OutputArea.append_map[MIME_LATEX] = append_latex;
  56250. OutputArea.append_map[MIME_JAVASCRIPT] = append_javascript;
  56251. OutputArea.append_map[MIME_PDF] = append_pdf;
  56252. OutputArea.prototype.mime_types = function () {
  56253. return OutputArea.display_order;
  56254. };
  56255. OutputArea.prototype.register_mime_type = function (mimetype, append, options) {
  56256. if (mimetype && typeof(append) === 'function') {
  56257. OutputArea.output_types.push(mimetype);
  56258. if (options.safe) OutputArea.safe_outputs[mimetype] = true;
  56259. OutputArea.display_order.splice(options.index || 0, 0, mimetype);
  56260. OutputArea.append_map[mimetype] = append;
  56261. }
  56262. };
  56263. return {'OutputArea': OutputArea};
  56264. });
  56265. // Copyright (c) Jupyter Development Team.
  56266. // Distributed under the terms of the Modified BSD License.
  56267. // highly adapted for codemiror jshint
  56268. define('notebook/js/contexthint',['codemirror/lib/codemirror'], function(CodeMirror) {
  56269. "use strict";
  56270. var forEach = function(arr, f) {
  56271. for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
  56272. };
  56273. var arrayContains = function(arr, item) {
  56274. if (!Array.prototype.indexOf) {
  56275. var i = arr.length;
  56276. while (i--) {
  56277. if (arr[i] === item) {
  56278. return true;
  56279. }
  56280. }
  56281. return false;
  56282. }
  56283. return arr.indexOf(item) != -1;
  56284. };
  56285. CodeMirror.contextHint = function (editor) {
  56286. // Find the token at the cursor
  56287. var cur = editor.getCursor(),
  56288. token = editor.getTokenAt(cur),
  56289. tprop = token;
  56290. // If it's not a 'word-style' token, ignore the token.
  56291. // If it is a property, find out what it is a property of.
  56292. var list = [];
  56293. var clist = getCompletions(token, editor);
  56294. for (var i = 0; i < clist.length; i++) {
  56295. list.push({
  56296. str: clist[i],
  56297. type: "context",
  56298. from: {
  56299. line: cur.line,
  56300. ch: token.start
  56301. },
  56302. to: {
  56303. line: cur.line,
  56304. ch: token.end
  56305. }
  56306. });
  56307. }
  56308. return list;
  56309. };
  56310. // find all 'words' of current cell
  56311. var getAllTokens = function (editor) {
  56312. var found = [];
  56313. // add to found if not already in it
  56314. function maybeAdd(str) {
  56315. if (!arrayContains(found, str)) found.push(str);
  56316. }
  56317. // loop through all token on all lines
  56318. var lineCount = editor.lineCount();
  56319. // loop on line
  56320. for (var l = 0; l < lineCount; l++) {
  56321. var line = editor.getLine(l);
  56322. //loop on char
  56323. for (var c = 1; c < line.length; c++) {
  56324. var tk = editor.getTokenAt({
  56325. line: l,
  56326. ch: c
  56327. });
  56328. // if token has a class, it has geat chances of beeing
  56329. // of interest. Add it to the list of possible completions.
  56330. // we could skip token of ClassName 'comment'
  56331. // or 'number' and 'operator'
  56332. if (tk.className !== null) {
  56333. maybeAdd(tk.string);
  56334. }
  56335. // jump to char after end of current token
  56336. c = tk.end;
  56337. }
  56338. }
  56339. return found;
  56340. };
  56341. var getCompletions = function(token, editor) {
  56342. var candidates = getAllTokens(editor);
  56343. // filter all token that have a common start (but nox exactly) the length of the current token
  56344. var lambda = function (x) {
  56345. return (x.indexOf(token.string) === 0 && x != token.string);
  56346. };
  56347. var filterd = candidates.filter(lambda);
  56348. return filterd;
  56349. };
  56350. return {'contextHint': CodeMirror.contextHint};
  56351. });
  56352. // Copyright (c) Jupyter Development Team.
  56353. // Distributed under the terms of the Modified BSD License.
  56354. define('notebook/js/completer',[
  56355. 'jquery',
  56356. 'base/js/utils',
  56357. 'base/js/keyboard',
  56358. 'notebook/js/contexthint',
  56359. 'codemirror/lib/codemirror',
  56360. ], function($, utils, keyboard, CodeMirror) {
  56361. "use strict";
  56362. // easier key mapping
  56363. var keycodes = keyboard.keycodes;
  56364. var prepend_n_prc = function(str, n) {
  56365. for( var i =0 ; i< n ; i++){
  56366. str = '%'+str ;
  56367. }
  56368. return str;
  56369. };
  56370. var _existing_completion = function(item, completion_array){
  56371. for( var i=0; i < completion_array.length; i++) {
  56372. if (completion_array[i].trim().substr(-item.length) == item) {
  56373. return true;
  56374. }
  56375. }
  56376. return false;
  56377. };
  56378. // what is the common start of all completions
  56379. function shared_start(B, drop_prct) {
  56380. if (B.length == 1) {
  56381. return B[0];
  56382. }
  56383. var A = [];
  56384. var common;
  56385. var min_lead_prct = 10;
  56386. for (var i = 0; i < B.length; i++) {
  56387. var str = B[i].str;
  56388. var localmin = 0;
  56389. if(drop_prct === true){
  56390. while ( str.substr(0, 1) == '%') {
  56391. localmin = localmin+1;
  56392. str = str.substring(1);
  56393. }
  56394. }
  56395. min_lead_prct = Math.min(min_lead_prct, localmin);
  56396. A.push(str);
  56397. }
  56398. if (A.length > 1) {
  56399. var tem1, tem2, s;
  56400. A = A.slice(0).sort();
  56401. tem1 = A[0];
  56402. s = tem1.length;
  56403. tem2 = A.pop();
  56404. while (s && tem2.indexOf(tem1) == -1) {
  56405. tem1 = tem1.substring(0, --s);
  56406. }
  56407. if (tem1 === "" || tem2.indexOf(tem1) !== 0) {
  56408. return {
  56409. str:prepend_n_prc('', min_lead_prct),
  56410. type: "computed",
  56411. from: B[0].from,
  56412. to: B[0].to
  56413. };
  56414. }
  56415. return {
  56416. str: prepend_n_prc(tem1, min_lead_prct),
  56417. type: "computed",
  56418. from: B[0].from,
  56419. to: B[0].to
  56420. };
  56421. }
  56422. return null;
  56423. }
  56424. var Completer = function (cell, events) {
  56425. this.cell = cell;
  56426. this.editor = cell.code_mirror;
  56427. var that = this;
  56428. events.on('kernel_busy.Kernel', function () {
  56429. that.skip_kernel_completion = true;
  56430. });
  56431. events.on('kernel_idle.Kernel', function () {
  56432. that.skip_kernel_completion = false;
  56433. });
  56434. };
  56435. Completer.prototype.startCompletion = function () {
  56436. /**
  56437. * call for a 'first' completion, that will set the editor and do some
  56438. * special behavior like autopicking if only one completion available.
  56439. */
  56440. if (this.editor.somethingSelected()|| this.editor.getSelections().length > 1) return;
  56441. this.done = false;
  56442. // use to get focus back on opera
  56443. this.carry_on_completion(true);
  56444. };
  56445. // easy access for julia to monkeypatch
  56446. //
  56447. Completer.reinvoke_re = /[%0-9a-z._/\\:~-]/i;
  56448. Completer.prototype.reinvoke= function(pre_cursor, block, cursor){
  56449. return Completer.reinvoke_re.test(pre_cursor);
  56450. };
  56451. /**
  56452. *
  56453. * pass true as parameter if this is the first invocation of the completer
  56454. * this will prevent the completer to dismiss itself if it is not on a
  56455. * word boundary like pressing tab after a space, and make it autopick the
  56456. * only choice if there is only one which prevent from popping the UI. as
  56457. * well as fast-forwarding the typing if all completion have a common
  56458. * shared start
  56459. **/
  56460. Completer.prototype.carry_on_completion = function (first_invocation) {
  56461. /**
  56462. * Pass true as parameter if you want the completer to autopick when
  56463. * only one completion. This function is automatically reinvoked at
  56464. * each keystroke with first_invocation = false
  56465. */
  56466. var cur = this.editor.getCursor();
  56467. var line = this.editor.getLine(cur.line);
  56468. var pre_cursor = this.editor.getRange({
  56469. line: cur.line,
  56470. ch: cur.ch - 1
  56471. }, cur);
  56472. // we need to check that we are still on a word boundary
  56473. // because while typing the completer is still reinvoking itself
  56474. // so dismiss if we are on a "bad" character
  56475. if (!this.reinvoke(pre_cursor) && !first_invocation) {
  56476. this.close();
  56477. return;
  56478. }
  56479. this.autopick = false;
  56480. if (first_invocation) {
  56481. this.autopick = true;
  56482. }
  56483. // We want a single cursor position.
  56484. if (this.editor.somethingSelected()|| this.editor.getSelections().length > 1) {
  56485. return;
  56486. }
  56487. // one kernel completion came back, finish_completing will be called with the results
  56488. // we fork here and directly call finish completing if kernel is busy
  56489. var cursor_pos = this.editor.indexFromPos(cur);
  56490. var text = this.editor.getValue();
  56491. cursor_pos = utils.js_idx_to_char_idx(cursor_pos, text);
  56492. if (this.skip_kernel_completion) {
  56493. this.finish_completing({ content: {
  56494. matches: [],
  56495. cursor_start: cursor_pos,
  56496. cursor_end: cursor_pos,
  56497. }});
  56498. } else {
  56499. this.cell.kernel.complete(text, cursor_pos,
  56500. $.proxy(this.finish_completing, this)
  56501. );
  56502. }
  56503. };
  56504. Completer.prototype.finish_completing = function (msg) {
  56505. /**
  56506. * let's build a function that wrap all that stuff into what is needed
  56507. * for the new completer:
  56508. */
  56509. var content = msg.content;
  56510. var start = content.cursor_start;
  56511. var end = content.cursor_end;
  56512. var matches = content.matches;
  56513. console.log(content);
  56514. var cur = this.editor.getCursor();
  56515. if (end === null) {
  56516. // adapted message spec replies don't have cursor position info,
  56517. // interpret end=null as current position,
  56518. // and negative start relative to that
  56519. end = this.editor.indexFromPos(cur);
  56520. if (start === null) {
  56521. start = end;
  56522. } else if (start < 0) {
  56523. start = end + start;
  56524. }
  56525. } else {
  56526. // handle surrogate pairs
  56527. var text = this.editor.getValue();
  56528. end = utils.char_idx_to_js_idx(end, text);
  56529. start = utils.char_idx_to_js_idx(start, text);
  56530. }
  56531. var results = CodeMirror.contextHint(this.editor);
  56532. var filtered_results = [];
  56533. //remove results from context completion
  56534. //that are already in kernel completion
  56535. var i;
  56536. for (i=0; i < results.length; i++) {
  56537. if (!_existing_completion(results[i].str, matches)) {
  56538. filtered_results.push(results[i]);
  56539. }
  56540. }
  56541. // append the introspection result, in order, at at the beginning of
  56542. // the table and compute the replacement range from current cursor
  56543. // position and matched_text length.
  56544. var from = this.editor.posFromIndex(start);
  56545. var to = this.editor.posFromIndex(end);
  56546. for (i = matches.length - 1; i >= 0; --i) {
  56547. filtered_results.unshift({
  56548. str: matches[i],
  56549. type: "introspection",
  56550. from: from,
  56551. to: to
  56552. });
  56553. }
  56554. // one the 2 sources results have been merge, deal with it
  56555. this.raw_result = filtered_results;
  56556. // if empty result return
  56557. if (!this.raw_result || !this.raw_result.length) return;
  56558. // When there is only one completion, use it directly.
  56559. if (this.autopick && this.raw_result.length == 1) {
  56560. this.insert(this.raw_result[0]);
  56561. return;
  56562. }
  56563. if (this.raw_result.length == 1) {
  56564. // test if first and only completion totally matches
  56565. // what is typed, in this case dismiss
  56566. var str = this.raw_result[0].str;
  56567. var pre_cursor = this.editor.getRange({
  56568. line: cur.line,
  56569. ch: cur.ch - str.length
  56570. }, cur);
  56571. if (pre_cursor == str) {
  56572. this.close();
  56573. return;
  56574. }
  56575. }
  56576. if (!this.visible) {
  56577. this.complete = $('<div/>').addClass('completions');
  56578. this.complete.attr('id', 'complete');
  56579. // Currently webkit doesn't use the size attr correctly. See:
  56580. // https://code.google.com/p/chromium/issues/detail?id=4579
  56581. this.sel = $('<select/>')
  56582. .attr('tabindex', -1)
  56583. .attr('multiple', 'true');
  56584. this.complete.append(this.sel);
  56585. this.visible = true;
  56586. $('body').append(this.complete);
  56587. //build the container
  56588. var that = this;
  56589. this.sel.click(function () {
  56590. that.pick();
  56591. that.editor.focus();
  56592. });
  56593. this._handle_keydown = function (cm, event) {
  56594. that.keydown(event);
  56595. };
  56596. this.editor.on('keydown', this._handle_keydown);
  56597. this._handle_keypress = function (cm, event) {
  56598. that.keypress(event);
  56599. };
  56600. this.editor.on('keypress', this._handle_keypress);
  56601. }
  56602. this.sel.attr('size', Math.min(10, this.raw_result.length));
  56603. // After everything is on the page, compute the position.
  56604. // We put it above the code if it is too close to the bottom of the page.
  56605. var pos = this.editor.cursorCoords(
  56606. this.editor.posFromIndex(start)
  56607. );
  56608. var left = pos.left-3;
  56609. var top;
  56610. var cheight = this.complete.height();
  56611. var wheight = $(window).height();
  56612. if (pos.bottom+cheight+5 > wheight) {
  56613. top = pos.top-cheight-4;
  56614. } else {
  56615. top = pos.bottom+1;
  56616. }
  56617. this.complete.css('left', left + 'px');
  56618. this.complete.css('top', top + 'px');
  56619. // Clear and fill the list.
  56620. this.sel.text('');
  56621. this.build_gui_list(this.raw_result);
  56622. return true;
  56623. };
  56624. Completer.prototype.insert = function (completion) {
  56625. this.editor.replaceRange(completion.str, completion.from, completion.to);
  56626. };
  56627. Completer.prototype.build_gui_list = function (completions) {
  56628. var MAXIMUM_GUI_LIST_LENGTH = 1000;
  56629. for (var i = 0; i < completions.length && i < MAXIMUM_GUI_LIST_LENGTH; ++i) {
  56630. var opt = $('<option/>').text(completions[i].str).addClass(completions[i].type);
  56631. this.sel.append(opt);
  56632. }
  56633. this.sel.children().first().attr('selected', 'true');
  56634. this.sel.scrollTop(0);
  56635. };
  56636. Completer.prototype.close = function () {
  56637. this.done = true;
  56638. $('#complete').remove();
  56639. this.editor.off('keydown', this._handle_keydown);
  56640. this.editor.off('keypress', this._handle_keypress);
  56641. this.visible = false;
  56642. };
  56643. Completer.prototype.pick = function () {
  56644. this.insert(this.raw_result[this.sel[0].selectedIndex]);
  56645. this.close();
  56646. };
  56647. Completer.prototype.keydown = function (event) {
  56648. var code = event.keyCode;
  56649. // Enter
  56650. var options;
  56651. var index;
  56652. if (code == keycodes.enter) {
  56653. event.codemirrorIgnore = true;
  56654. event._ipkmIgnore = true;
  56655. event.preventDefault();
  56656. this.pick();
  56657. // Escape or backspace
  56658. } else if (code == keycodes.esc || code == keycodes.backspace) {
  56659. event.codemirrorIgnore = true;
  56660. event._ipkmIgnore = true;
  56661. event.preventDefault();
  56662. this.close();
  56663. } else if (code == keycodes.tab) {
  56664. //all the fastforwarding operation,
  56665. //Check that shared start is not null which can append with prefixed completion
  56666. // like %pylab , pylab have no shared start, and ff will result in py<tab><tab>
  56667. // to erase py
  56668. var sh = shared_start(this.raw_result, true);
  56669. if (sh.str !== '') {
  56670. this.insert(sh);
  56671. }
  56672. this.close();
  56673. this.carry_on_completion();
  56674. } else if (code == keycodes.up || code == keycodes.down) {
  56675. // need to do that to be able to move the arrow
  56676. // when on the first or last line of a code cell
  56677. event.codemirrorIgnore = true;
  56678. event._ipkmIgnore = true;
  56679. event.preventDefault();
  56680. options = this.sel.find('option');
  56681. index = this.sel[0].selectedIndex;
  56682. if (code == keycodes.up) {
  56683. index--;
  56684. }
  56685. if (code == keycodes.down) {
  56686. index++;
  56687. }
  56688. index = Math.min(Math.max(index, 0), options.length-1);
  56689. this.sel[0].selectedIndex = index;
  56690. } else if (code == keycodes.pageup || code == keycodes.pagedown) {
  56691. event.codemirrorIgnore = true;
  56692. event._ipkmIgnore = true;
  56693. options = this.sel.find('option');
  56694. index = this.sel[0].selectedIndex;
  56695. if (code == keycodes.pageup) {
  56696. index -= 10; // As 10 is the hard coded size of the drop down menu
  56697. } else {
  56698. index += 10;
  56699. }
  56700. index = Math.min(Math.max(index, 0), options.length-1);
  56701. this.sel[0].selectedIndex = index;
  56702. } else if (code == keycodes.left || code == keycodes.right) {
  56703. this.close();
  56704. }
  56705. };
  56706. Completer.prototype.keypress = function (event) {
  56707. /**
  56708. * FIXME: This is a band-aid.
  56709. * on keypress, trigger insertion of a single character.
  56710. * This simulates the old behavior of completion as you type,
  56711. * before events were disconnected and CodeMirror stopped
  56712. * receiving events while the completer is focused.
  56713. */
  56714. var that = this;
  56715. var code = event.keyCode;
  56716. // don't handle keypress if it's not a character (arrows on FF)
  56717. // or ENTER/TAB
  56718. if (event.charCode === 0 ||
  56719. code == keycodes.tab ||
  56720. code == keycodes.enter
  56721. ) return;
  56722. this.close();
  56723. this.editor.focus();
  56724. setTimeout(function () {
  56725. that.carry_on_completion();
  56726. }, 50);
  56727. };
  56728. return {'Completer': Completer};
  56729. });
  56730. // IPython mode is just a slightly altered Python Mode with `?` beeing a extra
  56731. // single operator. Here we define `ipython` mode in the require `python`
  56732. // callback to auto-load python mode, which is more likely not the best things
  56733. // to do, but at least the simple one for now.
  56734. (function(mod) {
  56735. if (typeof exports == "object" && typeof module == "object"){ // CommonJS
  56736. mod(requirejs("codemirror/lib/codemirror"),
  56737. requirejs("codemirror/mode/python/python")
  56738. );
  56739. } else if (typeof define == "function" && define.amd){ // AMD
  56740. define('notebook/js/codemirror-ipython',["codemirror/lib/codemirror",
  56741. "codemirror/mode/python/python"], mod);
  56742. } else {// Plain browser env
  56743. mod(CodeMirror);
  56744. }
  56745. })(function(CodeMirror) {
  56746. "use strict";
  56747. CodeMirror.defineMode("ipython", function(conf, parserConf) {
  56748. var pythonConf = {};
  56749. for (var prop in parserConf) {
  56750. if (parserConf.hasOwnProperty(prop)) {
  56751. pythonConf[prop] = parserConf[prop];
  56752. }
  56753. }
  56754. pythonConf.name = 'python';
  56755. pythonConf.singleOperators = new RegExp("^[\\+\\-\\*/%&|@\\^~<>!\\?]");
  56756. if (pythonConf.version === 3) {
  56757. pythonConf.identifiers = new RegExp("^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*");
  56758. } else if (pythonConf.version === 2) {
  56759. pythonConf.identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*");
  56760. }
  56761. return CodeMirror.getMode(conf, pythonConf);
  56762. }, 'python');
  56763. CodeMirror.defineMIME("text/x-ipython", "ipython");
  56764. })
  56765. ;
  56766. // Copyright (c) Jupyter Development Team.
  56767. // Distributed under the terms of the Modified BSD License.
  56768. /**
  56769. *
  56770. *
  56771. * @module codecell
  56772. * @namespace codecell
  56773. * @class CodeCell
  56774. */
  56775. define('notebook/js/codecell',[
  56776. 'jquery',
  56777. 'base/js/namespace',
  56778. 'base/js/utils',
  56779. 'base/js/i18n',
  56780. 'base/js/keyboard',
  56781. 'services/config',
  56782. 'notebook/js/cell',
  56783. 'notebook/js/outputarea',
  56784. 'notebook/js/completer',
  56785. 'notebook/js/celltoolbar',
  56786. 'codemirror/lib/codemirror',
  56787. 'codemirror/mode/python/python',
  56788. 'notebook/js/codemirror-ipython'
  56789. ], function(
  56790. $,
  56791. IPython,
  56792. utils,
  56793. i18n,
  56794. keyboard,
  56795. configmod,
  56796. cell,
  56797. outputarea,
  56798. completer,
  56799. celltoolbar,
  56800. CodeMirror,
  56801. cmpython,
  56802. cmip
  56803. ) {
  56804. "use strict";
  56805. var Cell = cell.Cell;
  56806. /* local util for codemirror */
  56807. var posEq = function(a, b) {return a.line === b.line && a.ch === b.ch;};
  56808. /**
  56809. *
  56810. * function to delete until previous non blanking space character
  56811. * or first multiple of 4 tabstop.
  56812. * @private
  56813. */
  56814. CodeMirror.commands.delSpaceToPrevTabStop = function(cm){
  56815. var tabSize = cm.getOption('tabSize');
  56816. var ranges = cm.listSelections(); // handle multicursor
  56817. for (var i = ranges.length - 1; i >= 0; i--) { // iterate reverse so any deletions don't overlap
  56818. var head = ranges[i].head;
  56819. var anchor = ranges[i].anchor;
  56820. var sel = !posEq(head, anchor);
  56821. if (sel) {
  56822. // range is selection
  56823. cm.replaceRange("", anchor, head);
  56824. } else {
  56825. // range is cursor
  56826. var line = cm.getLine(head.line).substring(0, head.ch);
  56827. if (line.match(/^\ +$/) !== null){
  56828. // delete tabs
  56829. var prevTabStop = (Math.ceil(head.ch/tabSize)-1)*tabSize;
  56830. var from = CodeMirror.Pos(head.line, prevTabStop)
  56831. cm.replaceRange("", from, head);
  56832. } else {
  56833. // delete normally
  56834. var from = cm.findPosH(head, -1, 'char', false);
  56835. cm.replaceRange("", from, head);
  56836. }
  56837. }
  56838. }
  56839. };
  56840. var keycodes = keyboard.keycodes;
  56841. var CodeCell = function (kernel, options) {
  56842. /**
  56843. * Constructor
  56844. *
  56845. * A Cell conceived to write code.
  56846. *
  56847. * Parameters:
  56848. * kernel: Kernel instance
  56849. * The kernel doesn't have to be set at creation time, in that case
  56850. * it will be null and set_kernel has to be called later.
  56851. * options: dictionary
  56852. * Dictionary of keyword arguments.
  56853. * events: $(Events) instance
  56854. * config: dictionary
  56855. * keyboard_manager: KeyboardManager instance
  56856. * notebook: Notebook instance
  56857. * tooltip: Tooltip instance
  56858. */
  56859. this.kernel = kernel || null;
  56860. this.notebook = options.notebook;
  56861. this.collapsed = false;
  56862. this.events = options.events;
  56863. this.tooltip = options.tooltip;
  56864. this.config = options.config;
  56865. this.class_config = new configmod.ConfigWithDefaults(this.config,
  56866. CodeCell.options_default, 'CodeCell');
  56867. // create all attributed in constructor function
  56868. // even if null for V8 VM optimisation
  56869. this.input_prompt_number = null;
  56870. this.celltoolbar = null;
  56871. this.output_area = null;
  56872. this.last_msg_id = null;
  56873. this.completer = null;
  56874. Cell.apply(this,[{
  56875. config: options.config,
  56876. keyboard_manager: options.keyboard_manager,
  56877. events: this.events}]);
  56878. // Attributes we want to override in this subclass.
  56879. this.cell_type = "code";
  56880. var that = this;
  56881. this.element.focusout(
  56882. function() { that.auto_highlight(); }
  56883. );
  56884. };
  56885. CodeCell.options_default = {
  56886. cm_config : {
  56887. extraKeys: {
  56888. "Backspace" : "delSpaceToPrevTabStop",
  56889. },
  56890. mode: 'text',
  56891. theme: 'ipython',
  56892. matchBrackets: true,
  56893. autoCloseBrackets: true
  56894. },
  56895. highlight_modes : {
  56896. 'magic_javascript' :{'reg':['^%%javascript']},
  56897. 'magic_perl' :{'reg':['^%%perl']},
  56898. 'magic_ruby' :{'reg':['^%%ruby']},
  56899. 'magic_python' :{'reg':['^%%python3?']},
  56900. 'magic_shell' :{'reg':['^%%bash']},
  56901. 'magic_r' :{'reg':['^%%R']},
  56902. 'magic_text/x-cython' :{'reg':['^%%cython']},
  56903. },
  56904. };
  56905. CodeCell.msg_cells = {};
  56906. CodeCell.prototype = Object.create(Cell.prototype);
  56907. /** @method create_element */
  56908. CodeCell.prototype.create_element = function () {
  56909. Cell.prototype.create_element.apply(this, arguments);
  56910. var that = this;
  56911. var cell = $('<div></div>').addClass('cell code_cell');
  56912. cell.attr('tabindex','2');
  56913. var input = $('<div></div>').addClass('input');
  56914. this.input = input;
  56915. var prompt_container = $('<div/>').addClass('prompt_container');
  56916. var run_this_cell = $('<div></div>').addClass('run_this_cell');
  56917. run_this_cell.prop('title', 'Run this cell');
  56918. run_this_cell.append('<i class="fa-step-forward fa"></i>');
  56919. run_this_cell.click(function (event) {
  56920. event.stopImmediatePropagation();
  56921. that.execute();
  56922. });
  56923. var prompt = $('<div/>').addClass('prompt input_prompt');
  56924. var inner_cell = $('<div/>').addClass('inner_cell');
  56925. this.celltoolbar = new celltoolbar.CellToolbar({
  56926. cell: this,
  56927. notebook: this.notebook});
  56928. inner_cell.append(this.celltoolbar.element);
  56929. var input_area = $('<div/>').addClass('input_area').attr("aria-label", i18n.msg._("Edit code here"));
  56930. this.code_mirror = new CodeMirror(input_area.get(0), this._options.cm_config);
  56931. // In case of bugs that put the keyboard manager into an inconsistent state,
  56932. // ensure KM is enabled when CodeMirror is focused:
  56933. this.code_mirror.on('focus', function () {
  56934. if (that.keyboard_manager) {
  56935. that.keyboard_manager.enable();
  56936. }
  56937. that.code_mirror.setOption('readOnly', !that.is_editable());
  56938. });
  56939. this.code_mirror.on('keydown', $.proxy(this.handle_keyevent,this));
  56940. $(this.code_mirror.getInputField()).attr("spellcheck", "false");
  56941. inner_cell.append(input_area);
  56942. prompt_container.append(prompt).append(run_this_cell);
  56943. input.append(prompt_container).append(inner_cell);
  56944. var output = $('<div></div>');
  56945. cell.append(input).append(output);
  56946. this.element = cell;
  56947. this.output_area = new outputarea.OutputArea({
  56948. config: this.config,
  56949. selector: output,
  56950. prompt_area: true,
  56951. events: this.events,
  56952. keyboard_manager: this.keyboard_manager,
  56953. });
  56954. this.completer = new completer.Completer(this, this.events);
  56955. };
  56956. /** @method bind_events */
  56957. CodeCell.prototype.bind_events = function () {
  56958. Cell.prototype.bind_events.apply(this, arguments);
  56959. var that = this;
  56960. this.element.focusout(
  56961. function() { that.auto_highlight(); }
  56962. );
  56963. this.events.on('kernel_restarting.Kernel', function() {
  56964. if (that.input_prompt_number === '*') {
  56965. that.set_input_prompt();
  56966. }
  56967. });
  56968. };
  56969. /**
  56970. * This method gets called in CodeMirror's onKeyDown/onKeyPress
  56971. * handlers and is used to provide custom key handling. Its return
  56972. * value is used to determine if CodeMirror should ignore the event:
  56973. * true = ignore, false = don't ignore.
  56974. * @method handle_codemirror_keyevent
  56975. */
  56976. CodeCell.prototype.handle_codemirror_keyevent = function (editor, event) {
  56977. var that = this;
  56978. // whatever key is pressed, first, cancel the tooltip request before
  56979. // they are sent, and remove tooltip if any, except for tab again
  56980. var tooltip_closed = null;
  56981. if (event.type === 'keydown' && event.which !== keycodes.tab ) {
  56982. tooltip_closed = this.tooltip.remove_and_cancel_tooltip();
  56983. }
  56984. var cur = editor.getCursor();
  56985. if (event.keyCode === keycodes.enter){
  56986. this.auto_highlight();
  56987. }
  56988. if (event.which === keycodes.down && event.type === 'keypress' && this.tooltip.time_before_tooltip >= 0) {
  56989. // triger on keypress (!) otherwise inconsistent event.which depending on platform
  56990. // browser and keyboard layout !
  56991. // Pressing '(' , request tooltip, don't forget to reappend it
  56992. // The second argument says to hide the tooltip if the docstring
  56993. // is actually empty
  56994. this.tooltip.pending(that, true);
  56995. } else if ( tooltip_closed && event.which === keycodes.esc && event.type === 'keydown') {
  56996. // If tooltip is active, cancel it. The call to
  56997. // remove_and_cancel_tooltip above doesn't pass, force=true.
  56998. // Because of this it won't actually close the tooltip
  56999. // if it is in sticky mode. Thus, we have to check again if it is open
  57000. // and close it with force=true.
  57001. if (!this.tooltip._hidden) {
  57002. this.tooltip.remove_and_cancel_tooltip(true);
  57003. }
  57004. // If we closed the tooltip, don't let CM or the global handlers
  57005. // handle this event.
  57006. event.codemirrorIgnore = true;
  57007. event._ipkmIgnore = true;
  57008. event.preventDefault();
  57009. return true;
  57010. } else if (event.keyCode === keycodes.tab && event.type === 'keydown' && event.shiftKey) {
  57011. if (editor.somethingSelected() || editor.getSelections().length !== 1){
  57012. var anchor = editor.getCursor("anchor");
  57013. var head = editor.getCursor("head");
  57014. if( anchor.line !== head.line){
  57015. return false;
  57016. }
  57017. }
  57018. var pre_cursor = editor.getRange({line:cur.line,ch:0},cur);
  57019. if (pre_cursor.trim() === "") {
  57020. // Don't show tooltip if the part of the line before the cursor
  57021. // is empty. In this case, let CodeMirror handle indentation.
  57022. return false;
  57023. }
  57024. this.tooltip.request(that);
  57025. event.codemirrorIgnore = true;
  57026. event.preventDefault();
  57027. return true;
  57028. } else if (event.keyCode === keycodes.tab && event.type === 'keydown') {
  57029. // Tab completion.
  57030. this.tooltip.remove_and_cancel_tooltip();
  57031. // completion does not work on multicursor, it might be possible though in some cases
  57032. if (editor.somethingSelected() || editor.getSelections().length > 1) {
  57033. return false;
  57034. }
  57035. var pre_cursor = editor.getRange({line:cur.line,ch:0},cur);
  57036. if (pre_cursor.trim() === "") {
  57037. // Don't autocomplete if the part of the line before the cursor
  57038. // is empty. In this case, let CodeMirror handle indentation.
  57039. return false;
  57040. } else {
  57041. event.codemirrorIgnore = true;
  57042. event.preventDefault();
  57043. this.completer.startCompletion();
  57044. return true;
  57045. }
  57046. }
  57047. // keyboard event wasn't one of those unique to code cells, let's see
  57048. // if it's one of the generic ones (i.e. check edit mode shortcuts)
  57049. return Cell.prototype.handle_codemirror_keyevent.apply(this, [editor, event]);
  57050. };
  57051. // Kernel related calls.
  57052. CodeCell.prototype.set_kernel = function (kernel) {
  57053. this.kernel = kernel;
  57054. };
  57055. /**
  57056. * Execute current code cell to the kernel
  57057. * @method execute
  57058. */
  57059. CodeCell.prototype.execute = function (stop_on_error) {
  57060. if (!this.kernel) {
  57061. console.log(i18n.msg._("Can't execute cell since kernel is not set."));
  57062. return;
  57063. }
  57064. if (stop_on_error === undefined) {
  57065. if (this.metadata !== undefined &&
  57066. this.metadata.tags !== undefined) {
  57067. if (this.metadata.tags.indexOf('raises-exception') !== -1) {
  57068. stop_on_error = false;
  57069. } else {
  57070. stop_on_error = true;
  57071. }
  57072. } else {
  57073. stop_on_error = true;
  57074. }
  57075. }
  57076. this.clear_output(false, true);
  57077. var old_msg_id = this.last_msg_id;
  57078. if (old_msg_id) {
  57079. this.kernel.clear_callbacks_for_msg(old_msg_id);
  57080. delete CodeCell.msg_cells[old_msg_id];
  57081. this.last_msg_id = null;
  57082. }
  57083. if (this.get_text().trim().length === 0) {
  57084. // nothing to do
  57085. this.set_input_prompt(null);
  57086. return;
  57087. }
  57088. this.set_input_prompt('*');
  57089. this.element.addClass("running");
  57090. var callbacks = this.get_callbacks();
  57091. this.last_msg_id = this.kernel.execute(this.get_text(), callbacks, {silent: false, store_history: true,
  57092. stop_on_error : stop_on_error});
  57093. CodeCell.msg_cells[this.last_msg_id] = this;
  57094. this.render();
  57095. this.events.trigger('execute.CodeCell', {cell: this});
  57096. var that = this;
  57097. function handleFinished(evt, data) {
  57098. if (that.kernel.id === data.kernel.id && that.last_msg_id === data.msg_id) {
  57099. that.events.trigger('finished_execute.CodeCell', {cell: that});
  57100. that.events.off('finished_iopub.Kernel', handleFinished);
  57101. }
  57102. }
  57103. this.events.on('finished_iopub.Kernel', handleFinished);
  57104. };
  57105. /**
  57106. * Construct the default callbacks for
  57107. * @method get_callbacks
  57108. */
  57109. CodeCell.prototype.get_callbacks = function () {
  57110. var that = this;
  57111. return {
  57112. clear_on_done: false,
  57113. shell : {
  57114. reply : $.proxy(this._handle_execute_reply, this),
  57115. payload : {
  57116. set_next_input : $.proxy(this._handle_set_next_input, this),
  57117. page : $.proxy(this._open_with_pager, this)
  57118. }
  57119. },
  57120. iopub : {
  57121. output : function() {
  57122. that.events.trigger('set_dirty.Notebook', {value: true});
  57123. that.output_area.handle_output.apply(that.output_area, arguments);
  57124. },
  57125. clear_output : function() {
  57126. that.events.trigger('set_dirty.Notebook', {value: true});
  57127. that.output_area.handle_clear_output.apply(that.output_area, arguments);
  57128. },
  57129. },
  57130. input : $.proxy(this._handle_input_request, this),
  57131. };
  57132. };
  57133. CodeCell.prototype._open_with_pager = function (payload) {
  57134. this.events.trigger('open_with_text.Pager', payload);
  57135. };
  57136. /**
  57137. * @method _handle_execute_reply
  57138. * @private
  57139. */
  57140. CodeCell.prototype._handle_execute_reply = function (msg) {
  57141. this.set_input_prompt(msg.content.execution_count);
  57142. this.element.removeClass("running");
  57143. this.events.trigger('set_dirty.Notebook', {value: true});
  57144. };
  57145. /**
  57146. * @method _handle_set_next_input
  57147. * @private
  57148. */
  57149. CodeCell.prototype._handle_set_next_input = function (payload) {
  57150. var data = {
  57151. cell: this,
  57152. text: payload.text,
  57153. replace: payload.replace,
  57154. clear_output: payload.clear_output,
  57155. };
  57156. this.events.trigger('set_next_input.Notebook', data);
  57157. };
  57158. /**
  57159. * @method _handle_input_request
  57160. * @private
  57161. */
  57162. CodeCell.prototype._handle_input_request = function (msg) {
  57163. this.output_area.append_raw_input(msg);
  57164. };
  57165. // Basic cell manipulation.
  57166. CodeCell.prototype.select = function () {
  57167. var cont = Cell.prototype.select.apply(this, arguments);
  57168. if (cont) {
  57169. this.code_mirror.refresh();
  57170. this.auto_highlight();
  57171. }
  57172. return cont;
  57173. };
  57174. CodeCell.prototype.render = function () {
  57175. var cont = Cell.prototype.render.apply(this, arguments);
  57176. // Always execute, even if we are already in the rendered state
  57177. return cont;
  57178. };
  57179. CodeCell.prototype.select_all = function () {
  57180. var start = {line: 0, ch: 0};
  57181. var nlines = this.code_mirror.lineCount();
  57182. var last_line = this.code_mirror.getLine(nlines-1);
  57183. var end = {line: nlines-1, ch: last_line.length};
  57184. this.code_mirror.setSelection(start, end);
  57185. };
  57186. CodeCell.prototype.collapse_output = function () {
  57187. this.output_area.collapse();
  57188. };
  57189. CodeCell.prototype.expand_output = function () {
  57190. this.output_area.expand();
  57191. this.output_area.unscroll_area();
  57192. };
  57193. CodeCell.prototype.scroll_output = function () {
  57194. this.output_area.expand();
  57195. this.output_area.scroll_if_long();
  57196. };
  57197. CodeCell.prototype.toggle_output = function () {
  57198. this.output_area.toggle_output();
  57199. };
  57200. CodeCell.prototype.toggle_output_scroll = function () {
  57201. this.output_area.toggle_scroll();
  57202. };
  57203. CodeCell.input_prompt_classical = function (prompt_value, lines_number) {
  57204. var ns;
  57205. if (prompt_value === undefined || prompt_value === null) {
  57206. ns = "&nbsp;";
  57207. } else {
  57208. ns = encodeURIComponent(prompt_value);
  57209. }
  57210. return '<bdi>'+i18n.msg._('In')+'</bdi>&nbsp;[' + ns + ']:';
  57211. };
  57212. CodeCell.input_prompt_continuation = function (prompt_value, lines_number) {
  57213. var html = [CodeCell.input_prompt_classical(prompt_value, lines_number)];
  57214. for(var i=1; i < lines_number; i++) {
  57215. html.push(['...:']);
  57216. }
  57217. return html.join('<br/>');
  57218. };
  57219. CodeCell.input_prompt_function = CodeCell.input_prompt_classical;
  57220. CodeCell.prototype.set_input_prompt = function (number) {
  57221. var nline = 1;
  57222. if (this.code_mirror !== undefined) {
  57223. nline = this.code_mirror.lineCount();
  57224. }
  57225. this.input_prompt_number = number;
  57226. var prompt_html = CodeCell.input_prompt_function(this.input_prompt_number, nline);
  57227. // This HTML call is okay because the user contents are escaped.
  57228. this.element.find('div.input_prompt').html(prompt_html);
  57229. this.events.trigger('set_dirty.Notebook', {value: true});
  57230. };
  57231. CodeCell.prototype.clear_input = function () {
  57232. this.code_mirror.setValue('');
  57233. };
  57234. CodeCell.prototype.get_text = function () {
  57235. return this.code_mirror.getValue();
  57236. };
  57237. CodeCell.prototype.set_text = function (code) {
  57238. return this.code_mirror.setValue(code);
  57239. };
  57240. CodeCell.prototype.clear_output = function (wait, ignore_queue) {
  57241. this.events.trigger('clear_output.CodeCell', {cell: this});
  57242. this.output_area.clear_output(wait, ignore_queue);
  57243. this.set_input_prompt();
  57244. };
  57245. // JSON serialization
  57246. CodeCell.prototype.fromJSON = function (data) {
  57247. Cell.prototype.fromJSON.apply(this, arguments);
  57248. if (data.cell_type === 'code') {
  57249. if (data.source !== undefined) {
  57250. this.set_text(data.source);
  57251. // make this value the starting point, so that we can only undo
  57252. // to this state, instead of a blank cell
  57253. this.code_mirror.clearHistory();
  57254. this.auto_highlight();
  57255. }
  57256. this.set_input_prompt(data.execution_count);
  57257. this.output_area.trusted = data.metadata.trusted || false;
  57258. this.output_area.fromJSON(data.outputs, data.metadata);
  57259. }
  57260. };
  57261. CodeCell.prototype.toJSON = function () {
  57262. var data = Cell.prototype.toJSON.apply(this);
  57263. data.source = this.get_text();
  57264. // is finite protect against undefined and '*' value
  57265. if (isFinite(this.input_prompt_number)) {
  57266. data.execution_count = this.input_prompt_number;
  57267. } else {
  57268. data.execution_count = null;
  57269. }
  57270. var outputs = this.output_area.toJSON();
  57271. data.outputs = outputs;
  57272. data.metadata.trusted = this.output_area.trusted;
  57273. if (this.output_area.collapsed) {
  57274. data.metadata.collapsed = this.output_area.collapsed;
  57275. } else {
  57276. delete data.metadata.collapsed;
  57277. }
  57278. if (this.output_area.scroll_state === 'auto') {
  57279. delete data.metadata.scrolled;
  57280. } else {
  57281. data.metadata.scrolled = this.output_area.scroll_state;
  57282. }
  57283. return data;
  57284. };
  57285. /**
  57286. * handle cell level logic when the cell is unselected
  57287. * @method unselect
  57288. * @return is the action being taken
  57289. */
  57290. CodeCell.prototype.unselect = function() {
  57291. var cont = Cell.prototype.unselect.apply(this, arguments);
  57292. if (cont) {
  57293. // When a code cell is unselected, make sure that the corresponding
  57294. // tooltip and completer to that cell is closed.
  57295. this.tooltip.remove_and_cancel_tooltip(true);
  57296. if (this.completer !== null) {
  57297. this.completer.close();
  57298. }
  57299. }
  57300. return cont;
  57301. };
  57302. // Backwards compatibility.
  57303. IPython.CodeCell = CodeCell;
  57304. return {'CodeCell': CodeCell};
  57305. });
  57306. // Copyright (c) Jupyter Development Team.
  57307. // Distributed under the terms of the Modified BSD License.
  57308. define('services/kernels/comm',[
  57309. 'jquery',
  57310. 'base/js/utils',
  57311. ], function($, utils) {
  57312. "use strict";
  57313. //-----------------------------------------------------------------------
  57314. // CommManager class
  57315. //-----------------------------------------------------------------------
  57316. var CommManager = function (kernel) {
  57317. this.comms = {};
  57318. this.targets = {};
  57319. if (kernel !== undefined) {
  57320. this.init_kernel(kernel);
  57321. }
  57322. };
  57323. CommManager.prototype.init_kernel = function (kernel) {
  57324. /**
  57325. * connect the kernel, and register message handlers
  57326. */
  57327. this.kernel = kernel;
  57328. var msg_types = ['comm_open', 'comm_msg', 'comm_close'];
  57329. for (var i = 0; i < msg_types.length; i++) {
  57330. var msg_type = msg_types[i];
  57331. kernel.register_iopub_handler(msg_type, $.proxy(this[msg_type], this));
  57332. }
  57333. };
  57334. CommManager.prototype.new_comm = function (target_name, data, callbacks, metadata, comm_id, buffers) {
  57335. /**
  57336. * Create a new Comm, register it, and open its Kernel-side counterpart
  57337. * Mimics the auto-registration in `Comm.__init__` in the Jupyter Comm.
  57338. *
  57339. * argument comm_id is optional
  57340. */
  57341. var comm = new Comm(target_name, comm_id);
  57342. this.register_comm(comm);
  57343. comm.open(data, callbacks, metadata, buffers);
  57344. return comm;
  57345. };
  57346. CommManager.prototype.register_target = function (target_name, f) {
  57347. /**
  57348. * Register a target function for a given target name
  57349. */
  57350. this.targets[target_name] = f;
  57351. };
  57352. CommManager.prototype.unregister_target = function (target_name, f) {
  57353. /**
  57354. * Unregister a target function for a given target name
  57355. */
  57356. delete this.targets[target_name];
  57357. };
  57358. CommManager.prototype.register_comm = function (comm) {
  57359. /**
  57360. * Register a comm in the mapping
  57361. */
  57362. this.comms[comm.comm_id] = Promise.resolve(comm);
  57363. comm.kernel = this.kernel;
  57364. return comm.comm_id;
  57365. };
  57366. CommManager.prototype.unregister_comm = function (comm) {
  57367. /**
  57368. * Remove a comm from the mapping
  57369. */
  57370. delete this.comms[comm.comm_id];
  57371. };
  57372. // comm message handlers
  57373. CommManager.prototype.comm_open = function (msg) {
  57374. var content = msg.content;
  57375. var that = this;
  57376. var comm_id = content.comm_id;
  57377. this.comms[comm_id] = utils.load_class(content.target_name, content.target_module,
  57378. this.targets).then(function(target) {
  57379. var comm = new Comm(content.target_name, comm_id);
  57380. comm.kernel = that.kernel;
  57381. try {
  57382. var response = target(comm, msg);
  57383. } catch (e) {
  57384. comm.close();
  57385. that.unregister_comm(comm);
  57386. var wrapped_error = new utils.WrappedError("Exception opening new comm", e);
  57387. console.error(wrapped_error);
  57388. return Promise.reject(wrapped_error);
  57389. }
  57390. // Regardless of the target return value, we need to
  57391. // then return the comm
  57392. return Promise.resolve(response).then(function() {return comm;});
  57393. }, utils.reject('Could not open comm', true));
  57394. return this.comms[comm_id];
  57395. };
  57396. CommManager.prototype.comm_close = function(msg) {
  57397. var content = msg.content;
  57398. if (this.comms[content.comm_id] === undefined) {
  57399. console.error('Comm promise not found for comm id ' + content.comm_id);
  57400. return;
  57401. }
  57402. var that = this;
  57403. this.comms[content.comm_id] = this.comms[content.comm_id].then(function(comm) {
  57404. that.unregister_comm(comm);
  57405. try {
  57406. comm.handle_close(msg);
  57407. } catch (e) {
  57408. console.log("Exception closing comm: ", e, e.stack, msg);
  57409. }
  57410. // don't return a comm, so that further .then() functions
  57411. // get an undefined comm input
  57412. });
  57413. return this.comms[content.comm_id];
  57414. };
  57415. CommManager.prototype.comm_msg = function(msg) {
  57416. var content = msg.content;
  57417. if (this.comms[content.comm_id] === undefined) {
  57418. console.error('Comm promise not found for comm id ' + content.comm_id);
  57419. return;
  57420. }
  57421. this.comms[content.comm_id] = this.comms[content.comm_id].then(function(comm) {
  57422. return (Promise.resolve(comm.handle_msg(msg))
  57423. .catch(utils.reject('Exception handling comm message'))
  57424. .then(function() {return comm;}));
  57425. });
  57426. return this.comms[content.comm_id];
  57427. };
  57428. //-----------------------------------------------------------------------
  57429. // Comm base class
  57430. //-----------------------------------------------------------------------
  57431. var Comm = function (target_name, comm_id) {
  57432. this.target_name = target_name;
  57433. this.comm_id = comm_id || utils.uuid();
  57434. this._msg_callback = this._close_callback = null;
  57435. };
  57436. // methods for sending messages
  57437. Comm.prototype.open = function (data, callbacks, metadata, buffers) {
  57438. var content = {
  57439. comm_id : this.comm_id,
  57440. target_name : this.target_name,
  57441. data : data || {},
  57442. };
  57443. return this.kernel.send_shell_message("comm_open", content, callbacks, metadata, buffers);
  57444. };
  57445. Comm.prototype.send = function (data, callbacks, metadata, buffers) {
  57446. var content = {
  57447. comm_id : this.comm_id,
  57448. data : data || {},
  57449. };
  57450. return this.kernel.send_shell_message("comm_msg", content, callbacks, metadata, buffers);
  57451. };
  57452. Comm.prototype.close = function (data, callbacks, metadata, buffers) {
  57453. var content = {
  57454. comm_id : this.comm_id,
  57455. data : data || {},
  57456. };
  57457. return this.kernel.send_shell_message("comm_close", content, callbacks, metadata, buffers);
  57458. };
  57459. // methods for registering callbacks for incoming messages
  57460. Comm.prototype._register_callback = function (key, callback) {
  57461. this['_' + key + '_callback'] = callback;
  57462. };
  57463. Comm.prototype.on_msg = function (callback) {
  57464. this._register_callback('msg', callback);
  57465. };
  57466. Comm.prototype.on_close = function (callback) {
  57467. this._register_callback('close', callback);
  57468. };
  57469. // methods for handling incoming messages
  57470. Comm.prototype._callback = function (key, msg) {
  57471. var callback = this['_' + key + '_callback'];
  57472. if (callback) {
  57473. try {
  57474. return callback(msg);
  57475. } catch (e) {
  57476. console.log("Exception in Comm callback", e, e.stack, msg);
  57477. }
  57478. }
  57479. };
  57480. Comm.prototype.handle_msg = function (msg) {
  57481. return this._callback('msg', msg);
  57482. };
  57483. Comm.prototype.handle_close = function (msg) {
  57484. this._callback('close', msg);
  57485. };
  57486. return {
  57487. 'CommManager': CommManager,
  57488. 'Comm': Comm
  57489. };
  57490. });
  57491. // Copyright (c) Jupyter Development Team.
  57492. // Distributed under the terms of the Modified BSD License.
  57493. define('services/kernels/serialize',[
  57494. 'underscore',
  57495. ], function (_) {
  57496. "use strict";
  57497. var _deserialize_array_buffer = function (buf) {
  57498. var data = new DataView(buf);
  57499. // read the header: 1 + nbufs 32b integers
  57500. var nbufs = data.getUint32(0);
  57501. var offsets = [];
  57502. var i;
  57503. for (i = 1; i <= nbufs; i++) {
  57504. offsets.push(data.getUint32(i * 4));
  57505. }
  57506. var json_bytes = new Uint8Array(buf.slice(offsets[0], offsets[1]));
  57507. var msg = JSON.parse(
  57508. (new TextDecoder('utf8')).decode(json_bytes)
  57509. );
  57510. // the remaining chunks are stored as DataViews in msg.buffers
  57511. msg.buffers = [];
  57512. var start, stop;
  57513. for (i = 1; i < nbufs; i++) {
  57514. start = offsets[i];
  57515. stop = offsets[i+1] || buf.byteLength;
  57516. msg.buffers.push(new DataView(buf.slice(start, stop)));
  57517. }
  57518. return msg;
  57519. };
  57520. var _deserialize_binary = function(data) {
  57521. /**
  57522. * deserialize the binary message format
  57523. * callback will be called with a message whose buffers attribute
  57524. * will be an array of DataViews.
  57525. */
  57526. if (data instanceof Blob) {
  57527. // data is Blob, have to deserialize from ArrayBuffer in reader callback
  57528. var reader = new FileReader();
  57529. var promise = new Promise(function(resolve, reject) {
  57530. reader.onload = function () {
  57531. var msg = _deserialize_array_buffer(this.result);
  57532. resolve(msg);
  57533. };
  57534. });
  57535. reader.readAsArrayBuffer(data);
  57536. return promise;
  57537. } else {
  57538. // data is ArrayBuffer, can deserialize directly
  57539. var msg = _deserialize_array_buffer(data);
  57540. return msg;
  57541. }
  57542. };
  57543. var deserialize = function (data) {
  57544. /**
  57545. * deserialize a message and return a promise for the unpacked message
  57546. */
  57547. if (typeof data === "string") {
  57548. // text JSON message
  57549. return Promise.resolve(JSON.parse(data));
  57550. } else {
  57551. // binary message
  57552. return Promise.resolve(_deserialize_binary(data));
  57553. }
  57554. };
  57555. var _serialize_binary = function (msg) {
  57556. /**
  57557. * implement the binary serialization protocol
  57558. * serializes JSON message to ArrayBuffer
  57559. */
  57560. msg = _.clone(msg);
  57561. var offsets = [];
  57562. var buffers = [];
  57563. var i;
  57564. for (i = 0; i < msg.buffers.length; i++) {
  57565. // msg.buffers elements could be either views or ArrayBuffers
  57566. // buffers elements are ArrayBuffers
  57567. var b = msg.buffers[i];
  57568. buffers.push(b.buffer instanceof ArrayBuffer ? b.buffer : b);
  57569. }
  57570. delete msg.buffers;
  57571. var json_utf8 = (new TextEncoder('utf8')).encode(JSON.stringify(msg));
  57572. buffers.unshift(json_utf8);
  57573. var nbufs = buffers.length;
  57574. offsets.push(4 * (nbufs + 1));
  57575. for (i = 0; i + 1 < buffers.length; i++) {
  57576. offsets.push(offsets[offsets.length-1] + buffers[i].byteLength);
  57577. }
  57578. var msg_buf = new Uint8Array(
  57579. offsets[offsets.length-1] + buffers[buffers.length-1].byteLength
  57580. );
  57581. // use DataView.setUint32 for network byte-order
  57582. var view = new DataView(msg_buf.buffer);
  57583. // write nbufs to first 4 bytes
  57584. view.setUint32(0, nbufs);
  57585. // write offsets to next 4 * nbufs bytes
  57586. for (i = 0; i < offsets.length; i++) {
  57587. view.setUint32(4 * (i+1), offsets[i]);
  57588. }
  57589. // write all the buffers at their respective offsets
  57590. for (i = 0; i < buffers.length; i++) {
  57591. msg_buf.set(new Uint8Array(buffers[i]), offsets[i]);
  57592. }
  57593. // return raw ArrayBuffer
  57594. return msg_buf.buffer;
  57595. };
  57596. var serialize = function (msg) {
  57597. if (msg.buffers && msg.buffers.length) {
  57598. return _serialize_binary(msg);
  57599. } else {
  57600. return JSON.stringify(msg);
  57601. }
  57602. };
  57603. var exports = {
  57604. deserialize : deserialize,
  57605. serialize: serialize
  57606. };
  57607. return exports;
  57608. });
  57609. // Copyright (c) Jupyter Development Team.
  57610. // Distributed under the terms of the Modified BSD License.
  57611. define('services/kernels/kernel',[
  57612. 'jquery',
  57613. 'base/js/utils',
  57614. './comm',
  57615. './serialize',
  57616. 'base/js/events'
  57617. ], function($, utils, comm, serialize, events) {
  57618. "use strict";
  57619. /**
  57620. * A Kernel class to communicate with the Python kernel. This
  57621. * should generally not be constructed directly, but be created
  57622. * by. the `Session` object. Once created, this object should be
  57623. * used to communicate with the kernel.
  57624. *
  57625. * Preliminary documentation for the REST API is at
  57626. * https://github.com/ipython/ipython/wiki/IPEP-16%3A-Notebook-multi-directory-dashboard-and-URL-mapping#kernels-api
  57627. *
  57628. * Documentation for the messaging specifications is at
  57629. * https://jupyter-client.readthedocs.io/en/stable/messaging.html
  57630. *
  57631. * @class Kernel
  57632. * @param {string} kernel_service_url - the URL to access the kernel REST api
  57633. * @param {string} ws_url - the websockets URL
  57634. * @param {string} name - the kernel type (e.g. python3)
  57635. */
  57636. var Kernel = function (kernel_service_url, ws_url, name) {
  57637. this.events = events;
  57638. this.id = null;
  57639. this.name = name;
  57640. this.ws = null;
  57641. this._stopping = false;
  57642. this.kernel_service_url = kernel_service_url;
  57643. this.kernel_url = null;
  57644. this.ws_url = ws_url || utils.get_body_data("wsUrl");
  57645. if (!this.ws_url) {
  57646. // trailing 's' in https will become wss for secure web sockets
  57647. this.ws_url = location.protocol.replace('http', 'ws') + "//" + location.host;
  57648. }
  57649. this.username = "username";
  57650. this.session_id = utils.uuid();
  57651. this._msg_callbacks = {};
  57652. this._msg_callbacks_overrides = {};
  57653. this._display_id_to_parent_ids = {};
  57654. this._msg_queue = Promise.resolve();
  57655. this.info_reply = {}; // kernel_info_reply stored here after starting
  57656. if (typeof(WebSocket) !== 'undefined') {
  57657. this.WebSocket = WebSocket;
  57658. } else if (typeof(MozWebSocket) !== 'undefined') {
  57659. this.WebSocket = MozWebSocket;
  57660. } else {
  57661. alert('Your browser does not have WebSocket support, please try Chrome, Safari or Firefox ≥ 6. Firefox 4 and 5 are also supported by you have to enable WebSockets in about:config.');
  57662. }
  57663. this.bind_events();
  57664. this.init_iopub_handlers();
  57665. this.comm_manager = new comm.CommManager(this);
  57666. this.last_msg_id = null;
  57667. this.last_msg_callbacks = {};
  57668. this._autorestart_attempt = 0;
  57669. this._reconnect_attempt = 0;
  57670. this.reconnect_limit = 7;
  57671. this._pending_messages = [];
  57672. };
  57673. /**
  57674. * @function _get_msg
  57675. */
  57676. Kernel.prototype._get_msg = function (msg_type, content, metadata, buffers) {
  57677. var msg = {
  57678. header : {
  57679. date: new Date().toISOString(),
  57680. msg_id : utils.uuid(),
  57681. username : this.username,
  57682. session : this.session_id,
  57683. msg_type : msg_type,
  57684. version : "5.2",
  57685. },
  57686. metadata : metadata || {},
  57687. content : content,
  57688. buffers : buffers || [],
  57689. parent_header : {}
  57690. };
  57691. return msg;
  57692. };
  57693. /**
  57694. * @function bind_events
  57695. */
  57696. Kernel.prototype.bind_events = function () {
  57697. var that = this;
  57698. this.events.on('send_input_reply.Kernel', function(evt, data) {
  57699. that.send_input_reply(data);
  57700. });
  57701. var record_status = function (evt, info) {
  57702. console.log('Kernel: ' + evt.type + ' (' + info.kernel.id + ')');
  57703. };
  57704. this.events.on('kernel_created.Kernel', record_status);
  57705. this.events.on('kernel_reconnecting.Kernel', record_status);
  57706. this.events.on('kernel_connected.Kernel', record_status);
  57707. this.events.on('kernel_starting.Kernel', record_status);
  57708. this.events.on('kernel_restarting.Kernel', record_status);
  57709. this.events.on('kernel_autorestarting.Kernel', record_status);
  57710. this.events.on('kernel_interrupting.Kernel', record_status);
  57711. this.events.on('kernel_disconnected.Kernel', record_status);
  57712. // these are commented out because they are triggered a lot, but can
  57713. // be uncommented for debugging purposes
  57714. //this.events.on('kernel_idle.Kernel', record_status);
  57715. //this.events.on('kernel_busy.Kernel', record_status);
  57716. this.events.on('kernel_ready.Kernel', record_status);
  57717. this.events.on('kernel_killed.Kernel', record_status);
  57718. this.events.on('kernel_dead.Kernel', record_status);
  57719. this.events.on('kernel_ready.Kernel', function () {
  57720. that._autorestart_attempt = 0;
  57721. });
  57722. this.events.on('kernel_connected.Kernel', function () {
  57723. that._reconnect_attempt = 0;
  57724. });
  57725. };
  57726. /**
  57727. * Initialize the iopub handlers.
  57728. *
  57729. * @function init_iopub_handlers
  57730. */
  57731. Kernel.prototype.init_iopub_handlers = function () {
  57732. var output_msg_types = ['stream', 'display_data', 'execute_result', 'error', 'update_display_data'];
  57733. this._iopub_handlers = {};
  57734. this.register_iopub_handler('status', $.proxy(this._handle_status_message, this));
  57735. this.register_iopub_handler('clear_output', $.proxy(this._handle_clear_output, this));
  57736. this.register_iopub_handler('execute_input', $.proxy(this._handle_input_message, this));
  57737. this.register_iopub_handler('shutdown_reply', $.proxy(this._handle_shutdown_message, this));
  57738. for (var i=0; i < output_msg_types.length; i++) {
  57739. this.register_iopub_handler(output_msg_types[i], $.proxy(this._handle_output_message, this));
  57740. }
  57741. };
  57742. /**
  57743. * GET /api/kernels
  57744. *
  57745. * Get the list of running kernels.
  57746. *
  57747. * @function list
  57748. * @param {function} [success] - function executed on ajax success
  57749. * @param {function} [error] - function executed on ajax error
  57750. */
  57751. Kernel.prototype.list = function (success, error) {
  57752. utils.ajax(this.kernel_service_url, {
  57753. processData: false,
  57754. cache: false,
  57755. type: "GET",
  57756. dataType: "json",
  57757. success: success,
  57758. error: this._on_error(error)
  57759. });
  57760. };
  57761. /**
  57762. * POST /api/kernels
  57763. *
  57764. * Start a new kernel.
  57765. *
  57766. * In general this shouldn't be used -- the kernel should be
  57767. * started through the session API. If you use this function and
  57768. * are also using the session API then your session and kernel
  57769. * WILL be out of sync!
  57770. *
  57771. * @function start
  57772. * @param {params} [Object] - parameters to include in the query string
  57773. * @param {function} [success] - function executed on ajax success
  57774. * @param {function} [error] - function executed on ajax error
  57775. */
  57776. Kernel.prototype.start = function (params, success, error) {
  57777. var url = this.kernel_service_url;
  57778. var qs = $.param(params || {}); // query string for sage math stuff
  57779. if (qs !== "") {
  57780. url = url + "?" + qs;
  57781. }
  57782. this.events.trigger('kernel_starting.Kernel', {kernel: this});
  57783. var that = this;
  57784. var on_success = function (data, status, xhr) {
  57785. that.events.trigger('kernel_created.Kernel', {kernel: that});
  57786. that._kernel_created(data);
  57787. if (success) {
  57788. success(data, status, xhr);
  57789. }
  57790. };
  57791. utils.ajax(url, {
  57792. processData: false,
  57793. cache: false,
  57794. type: "POST",
  57795. data: JSON.stringify({name: this.name}),
  57796. contentType: 'application/json',
  57797. dataType: "json",
  57798. success: this._on_success(on_success),
  57799. error: this._on_error(error)
  57800. });
  57801. return url;
  57802. };
  57803. /**
  57804. * GET /api/kernels/[:kernel_id]
  57805. *
  57806. * Get information about the kernel.
  57807. *
  57808. * @function get_info
  57809. * @param {function} [success] - function executed on ajax success
  57810. * @param {function} [error] - function executed on ajax error
  57811. */
  57812. Kernel.prototype.get_info = function (success, error) {
  57813. utils.ajax(this.kernel_url, {
  57814. processData: false,
  57815. cache: false,
  57816. type: "GET",
  57817. dataType: "json",
  57818. success: this._on_success(success),
  57819. error: this._on_error(error)
  57820. });
  57821. };
  57822. /**
  57823. * DELETE /api/kernels/[:kernel_id]
  57824. *
  57825. * Shutdown the kernel.
  57826. *
  57827. * If you are also using sessions, then this function should NOT be
  57828. * used. Instead, use Session.delete. Otherwise, the session and
  57829. * kernel WILL be out of sync.
  57830. *
  57831. * @function kill
  57832. * @param {function} [success] - function executed on ajax success
  57833. * @param {function} [error] - function executed on ajax error
  57834. */
  57835. Kernel.prototype.kill = function (success, error) {
  57836. this.events.trigger('kernel_killed.Kernel', {kernel: this});
  57837. this._kernel_dead();
  57838. utils.ajax(this.kernel_url, {
  57839. processData: false,
  57840. cache: false,
  57841. type: "DELETE",
  57842. dataType: "json",
  57843. success: this._on_success(success),
  57844. error: this._on_error(error)
  57845. });
  57846. };
  57847. /**
  57848. * POST /api/kernels/[:kernel_id]/interrupt
  57849. *
  57850. * Interrupt the kernel.
  57851. *
  57852. * @function interrupt
  57853. * @param {function} [success] - function executed on ajax success
  57854. * @param {function} [error] - function executed on ajax error
  57855. */
  57856. Kernel.prototype.interrupt = function (success, error) {
  57857. this.events.trigger('kernel_interrupting.Kernel', {kernel: this});
  57858. var that = this;
  57859. var on_success = function (data, status, xhr) {
  57860. /**
  57861. * get kernel info so we know what state the kernel is in
  57862. */
  57863. that.kernel_info();
  57864. if (success) {
  57865. success(data, status, xhr);
  57866. }
  57867. };
  57868. var url = utils.url_path_join(this.kernel_url, 'interrupt');
  57869. utils.ajax(url, {
  57870. processData: false,
  57871. cache: false,
  57872. type: "POST",
  57873. contentType: false, // there's no data with this
  57874. dataType: "json",
  57875. success: this._on_success(on_success),
  57876. error: this._on_error(error)
  57877. });
  57878. };
  57879. Kernel.prototype.restart = function (success, error) {
  57880. /**
  57881. * POST /api/kernels/[:kernel_id]/restart
  57882. *
  57883. * Restart the kernel.
  57884. *
  57885. * @function interrupt
  57886. * @param {function} [success] - function executed on ajax success
  57887. * @param {function} [error] - function executed on ajax error
  57888. */
  57889. this.events.trigger('kernel_restarting.Kernel', {kernel: this});
  57890. this.stop_channels();
  57891. this._msg_callbacks = {};
  57892. this._msg_callbacks_overrides = {};
  57893. this._display_id_to_parent_ids = {};
  57894. var that = this;
  57895. var on_success = function (data, status, xhr) {
  57896. that.events.trigger('kernel_created.Kernel', {kernel: that});
  57897. that._kernel_created(data);
  57898. if (success) {
  57899. success(data, status, xhr);
  57900. }
  57901. };
  57902. var on_error = function (xhr, status, err) {
  57903. that.events.trigger('kernel_failed_restart.Kernel', {kernel: that});
  57904. that._kernel_dead();
  57905. if (error) {
  57906. error(xhr, status, err);
  57907. }
  57908. };
  57909. var url = utils.url_path_join(this.kernel_url, 'restart');
  57910. utils.ajax(url, {
  57911. processData: false,
  57912. cache: false,
  57913. type: "POST",
  57914. contentType: false, // there's no data with this
  57915. dataType: "json",
  57916. success: this._on_success(on_success),
  57917. error: this._on_error(on_error)
  57918. });
  57919. };
  57920. Kernel.prototype.reconnect = function () {
  57921. /**
  57922. * Reconnect to a disconnected kernel. This is not actually a
  57923. * standard HTTP request, but useful function nonetheless for
  57924. * reconnecting to the kernel if the connection is somehow lost.
  57925. *
  57926. * @function reconnect
  57927. */
  57928. if (this.is_connected()) {
  57929. this.stop_channels();
  57930. }
  57931. this._reconnect_attempt = this._reconnect_attempt + 1;
  57932. this.events.trigger('kernel_reconnecting.Kernel', {
  57933. kernel: this,
  57934. attempt: this._reconnect_attempt,
  57935. });
  57936. this.start_channels();
  57937. };
  57938. Kernel.prototype._on_success = function (success) {
  57939. /**
  57940. * Handle a successful AJAX request by updating the kernel id and
  57941. * name from the response, and then optionally calling a provided
  57942. * callback.
  57943. *
  57944. * @function _on_success
  57945. * @param {function} success - callback
  57946. */
  57947. var that = this;
  57948. return function (data, status, xhr) {
  57949. if (data) {
  57950. that.id = data.id;
  57951. that.name = data.name;
  57952. }
  57953. that.kernel_url = utils.url_path_join(that.kernel_service_url,
  57954. encodeURIComponent(that.id));
  57955. if (success) {
  57956. success(data, status, xhr);
  57957. }
  57958. };
  57959. };
  57960. Kernel.prototype._on_error = function (error) {
  57961. /**
  57962. * Handle a failed AJAX request by logging the error message, and
  57963. * then optionally calling a provided callback.
  57964. *
  57965. * @function _on_error
  57966. * @param {function} error - callback
  57967. */
  57968. return function (xhr, status, err) {
  57969. utils.log_ajax_error(xhr, status, err);
  57970. if (error) {
  57971. error(xhr, status, err);
  57972. }
  57973. };
  57974. };
  57975. Kernel.prototype._kernel_created = function (data) {
  57976. /**
  57977. * Perform necessary tasks once the kernel has been started,
  57978. * including actually connecting to the kernel.
  57979. *
  57980. * @function _kernel_created
  57981. * @param {Object} data - information about the kernel including id
  57982. */
  57983. this.id = data.id;
  57984. this.kernel_url = utils.url_path_join(this.kernel_service_url,
  57985. encodeURIComponent(this.id));
  57986. this.start_channels();
  57987. };
  57988. Kernel.prototype._kernel_connected = function () {
  57989. /**
  57990. * Perform necessary tasks once the connection to the kernel has
  57991. * been established. This includes requesting information about
  57992. * the kernel.
  57993. *
  57994. * @function _kernel_connected
  57995. */
  57996. this.events.trigger('kernel_connected.Kernel', {kernel: this});
  57997. // Send pending messages. We shift the message off the queue
  57998. // after the message is sent so that if there is an exception,
  57999. // the message is still pending.
  58000. while (this._pending_messages.length > 0) {
  58001. this.ws.send(this._pending_messages[0]);
  58002. this._pending_messages.shift();
  58003. }
  58004. // get kernel info so we know what state the kernel is in
  58005. var that = this;
  58006. this.kernel_info(function (reply) {
  58007. that.info_reply = reply.content;
  58008. that.events.trigger('kernel_ready.Kernel', {kernel: that});
  58009. });
  58010. };
  58011. Kernel.prototype._kernel_dead = function () {
  58012. /**
  58013. * Perform necessary tasks after the kernel has died. This closing
  58014. * communication channels to the kernel if they are still somehow
  58015. * open.
  58016. *
  58017. * @function _kernel_dead
  58018. */
  58019. this.stop_channels();
  58020. };
  58021. Kernel.prototype.start_channels = function () {
  58022. /**
  58023. * Start the websocket channels.
  58024. * Will stop and restart them if they already exist.
  58025. *
  58026. * @function start_channels
  58027. */
  58028. var that = this;
  58029. this.stop_channels();
  58030. var ws_host_url = this.ws_url + this.kernel_url;
  58031. console.log("Starting WebSockets:", ws_host_url);
  58032. this.ws = new this.WebSocket([
  58033. that.ws_url,
  58034. utils.url_path_join(that.kernel_url, 'channels'),
  58035. "?session_id=" + that.session_id
  58036. ].join('')
  58037. );
  58038. var already_called_onclose = false; // only alert once
  58039. var ws_closed_early = function(evt){
  58040. console.log("WebSocket closed early", evt);
  58041. if (already_called_onclose){
  58042. return;
  58043. }
  58044. already_called_onclose = true;
  58045. // If the websocket was closed early, that could mean
  58046. // that the kernel is actually dead. Try getting
  58047. // information about the kernel from the API call --
  58048. // if that fails, then assume the kernel is dead,
  58049. // otherwise just follow the typical websocket closed
  58050. // protocol.
  58051. that.get_info(function () {
  58052. that._ws_closed(ws_host_url, false);
  58053. }, function () {
  58054. that.events.trigger('kernel_dead.Kernel', {kernel: that});
  58055. that._kernel_dead();
  58056. });
  58057. };
  58058. var ws_closed_late = function(evt){
  58059. console.log("WebSocket closed unexpectedly", evt);
  58060. if (already_called_onclose){
  58061. return;
  58062. }
  58063. already_called_onclose = true;
  58064. that._ws_closed(ws_host_url, false);
  58065. };
  58066. var ws_error = function(evt){
  58067. if (already_called_onclose){
  58068. return;
  58069. }
  58070. already_called_onclose = true;
  58071. that._ws_closed(ws_host_url, true);
  58072. };
  58073. this.ws.onopen = $.proxy(this._ws_opened, this);
  58074. this.ws.onclose = ws_closed_early;
  58075. this.ws.onerror = ws_error;
  58076. // switch from early-close to late-close message after 1s
  58077. setTimeout(function() {
  58078. if (that.ws !== null && !that._stopping) {
  58079. that.ws.onclose = ws_closed_late;
  58080. }
  58081. }, 1000);
  58082. this.ws.onmessage = $.proxy(this._handle_ws_message, this);
  58083. };
  58084. Kernel.prototype._ws_opened = function (evt) {
  58085. /**
  58086. * Handle a websocket entering the open state,
  58087. * signaling that the kernel is connected when websocket is open.
  58088. *
  58089. * @function _ws_opened
  58090. */
  58091. if (this.is_connected()) {
  58092. // all events ready, trigger started event.
  58093. this._kernel_connected();
  58094. }
  58095. };
  58096. Kernel.prototype._ws_closed = function(ws_url, error) {
  58097. /**
  58098. * Handle a websocket entering the closed state. If the websocket
  58099. * was not closed due to an error, try to reconnect to the kernel.
  58100. *
  58101. * @function _ws_closed
  58102. * @param {string} ws_url - the websocket url
  58103. * @param {bool} error - whether the connection was closed due to an error
  58104. */
  58105. this.stop_channels();
  58106. this.events.trigger('kernel_disconnected.Kernel', {kernel: this});
  58107. if (error) {
  58108. console.log('WebSocket connection failed: ', ws_url, error);
  58109. this.events.trigger('kernel_connection_failed.Kernel', {
  58110. kernel: this,
  58111. ws_url: ws_url,
  58112. attempt: this._reconnect_attempt,
  58113. error: error,
  58114. });
  58115. }
  58116. this._schedule_reconnect();
  58117. };
  58118. Kernel.prototype._schedule_reconnect = function () {
  58119. /**
  58120. * function to call when kernel connection is lost
  58121. * schedules reconnect, or fires 'connection_dead' if reconnect limit is hit
  58122. */
  58123. if (this._reconnect_attempt < this.reconnect_limit) {
  58124. var timeout = Math.pow(2, this._reconnect_attempt);
  58125. console.log("Connection lost, reconnecting in " + timeout + " seconds.");
  58126. setTimeout($.proxy(this.reconnect, this), 1e3 * timeout);
  58127. } else {
  58128. this.events.trigger('kernel_connection_dead.Kernel', {
  58129. kernel: this,
  58130. reconnect_attempt: this._reconnect_attempt,
  58131. });
  58132. console.log("Failed to reconnect, giving up.");
  58133. }
  58134. };
  58135. Kernel.prototype.stop_channels = function () {
  58136. /**
  58137. * Close the websocket. After successful close, the value
  58138. * in `this.ws` will be null.
  58139. *
  58140. * @function stop_channels
  58141. */
  58142. var that = this;
  58143. var close = function () {
  58144. that._stopping = false;
  58145. if (that.ws && that.ws.readyState === WebSocket.CLOSED) {
  58146. that.ws = null;
  58147. }
  58148. };
  58149. if (this.ws !== null) {
  58150. // flag to avoid races with on_close_late
  58151. this._stopping = true;
  58152. if (this.ws.readyState === WebSocket.OPEN) {
  58153. this.ws.onclose = close;
  58154. this.ws.close();
  58155. } else {
  58156. close();
  58157. }
  58158. }
  58159. };
  58160. Kernel.prototype.is_connected = function () {
  58161. /**
  58162. * Check whether there is a connection to the kernel. This
  58163. * function only returns true if websocket has been
  58164. * created and has a state of WebSocket.OPEN.
  58165. *
  58166. * @function is_connected
  58167. * @returns {bool} - whether there is a connection
  58168. */
  58169. // if any channel is not ready, then we're not connected
  58170. if (this.ws === null) {
  58171. return false;
  58172. }
  58173. if (this.ws.readyState !== WebSocket.OPEN) {
  58174. return false;
  58175. }
  58176. return true;
  58177. };
  58178. Kernel.prototype.is_fully_disconnected = function () {
  58179. /**
  58180. * Check whether the connection to the kernel has been completely
  58181. * severed. This function only returns true if all channel objects
  58182. * are null.
  58183. *
  58184. * @function is_fully_disconnected
  58185. * @returns {bool} - whether the kernel is fully disconnected
  58186. */
  58187. return (this.ws === null);
  58188. };
  58189. Kernel.prototype._send = function(msg) {
  58190. /**
  58191. * Send a message (if the kernel is connected) or queue the message for future delivery
  58192. *
  58193. * Pending messages will automatically be sent when a kernel becomes connected.
  58194. *
  58195. * @function _send
  58196. * @param msg
  58197. */
  58198. if (this.is_connected()) {
  58199. this.ws.send(msg);
  58200. } else {
  58201. this._pending_messages.push(msg);
  58202. }
  58203. };
  58204. Kernel.prototype.send_shell_message = function (msg_type, content, callbacks, metadata, buffers) {
  58205. /**
  58206. * Send a message on the Kernel's shell channel
  58207. *
  58208. * If the kernel is not connected, the message will be buffered.
  58209. *
  58210. * @function send_shell_message
  58211. */
  58212. var msg = this._get_msg(msg_type, content, metadata, buffers);
  58213. msg.channel = 'shell';
  58214. this.set_callbacks_for_msg(msg.header.msg_id, callbacks);
  58215. this._send(serialize.serialize(msg));
  58216. return msg.header.msg_id;
  58217. };
  58218. Kernel.prototype.kernel_info = function (callback) {
  58219. /**
  58220. * Get kernel info
  58221. *
  58222. * @function kernel_info
  58223. * @param callback {function}
  58224. *
  58225. * When calling this method, pass a callback function that expects one argument.
  58226. * The callback will be passed the complete `kernel_info_reply` message documented
  58227. * [here](https://jupyter-client.readthedocs.io/en/latest/messaging.html#kernel-info)
  58228. */
  58229. var callbacks;
  58230. if (callback) {
  58231. callbacks = { shell : { reply : callback } };
  58232. }
  58233. return this.send_shell_message("kernel_info_request", {}, callbacks);
  58234. };
  58235. Kernel.prototype.comm_info = function (target_name, callback) {
  58236. /**
  58237. * Get comm info
  58238. *
  58239. * @function comm_info
  58240. * @param callback {function}
  58241. *
  58242. * When calling this method, pass a callback function that expects one argument.
  58243. * The callback will be passed the complete `comm_info_reply` message documented
  58244. * [here](https://jupyter-client.readthedocs.io/en/latest/messaging.html#comm_info)
  58245. */
  58246. var callbacks;
  58247. if (callback) {
  58248. callbacks = { shell : { reply : callback } };
  58249. }
  58250. var content = {
  58251. target_name : target_name,
  58252. };
  58253. return this.send_shell_message("comm_info_request", content, callbacks);
  58254. };
  58255. Kernel.prototype.inspect = function (code, cursor_pos, callback) {
  58256. /**
  58257. * Get info on an object
  58258. *
  58259. * When calling this method, pass a callback function that expects one argument.
  58260. * The callback will be passed the complete `inspect_reply` message documented
  58261. * [here](https://jupyter-client.readthedocs.io/en/latest/messaging.html#object-information)
  58262. *
  58263. * @function inspect
  58264. * @param code {string}
  58265. * @param cursor_pos {integer}
  58266. * @param callback {function}
  58267. */
  58268. var callbacks;
  58269. if (callback) {
  58270. callbacks = { shell : { reply : callback } };
  58271. }
  58272. var content = {
  58273. code : code,
  58274. cursor_pos : cursor_pos,
  58275. detail_level : 0
  58276. };
  58277. return this.send_shell_message("inspect_request", content, callbacks);
  58278. };
  58279. Kernel.prototype.execute = function (code, callbacks, options) {
  58280. /**
  58281. * Execute given code into kernel, and pass result to callback.
  58282. *
  58283. * @async
  58284. * @function execute
  58285. * @param {string} code
  58286. * @param [callbacks] {Object} With the following keys (all optional)
  58287. * @param callbacks.shell.reply {function}
  58288. * @param callbacks.shell.payload.[payload_name] {function}
  58289. * @param callbacks.iopub.output {function}
  58290. * @param callbacks.iopub.clear_output {function}
  58291. * @param callbacks.input {function}
  58292. * @param callbacks.clear_on_done=true {Boolean}
  58293. * @param {object} [options]
  58294. * @param [options.silent=false] {Boolean}
  58295. * @param [options.user_expressions=empty_dict] {Dict}
  58296. * @param [options.allow_stdin=false] {Boolean} true|false
  58297. *
  58298. * @example
  58299. *
  58300. * The options object should contain the options for the execute
  58301. * call. Its default values are:
  58302. *
  58303. * options = {
  58304. * silent : true,
  58305. * user_expressions : {},
  58306. * allow_stdin : false
  58307. * }
  58308. *
  58309. * When calling this method pass a callbacks structure of the
  58310. * form:
  58311. *
  58312. * callbacks = {
  58313. * shell : {
  58314. * reply : execute_reply_callback,
  58315. * payload : {
  58316. * set_next_input : set_next_input_callback,
  58317. * }
  58318. * },
  58319. * iopub : {
  58320. * output : output_callback,
  58321. * clear_output : clear_output_callback,
  58322. * },
  58323. * input : raw_input_callback
  58324. * }
  58325. *
  58326. * Each callback will be passed the entire message as a single
  58327. * argument. Payload handlers will be passed the corresponding
  58328. * payload and the execute_reply message.
  58329. */
  58330. var content = {
  58331. code : code,
  58332. silent : true,
  58333. store_history : false,
  58334. user_expressions : {},
  58335. allow_stdin : false
  58336. };
  58337. callbacks = callbacks || {};
  58338. if (callbacks.input !== undefined) {
  58339. content.allow_stdin = true;
  58340. }
  58341. $.extend(true, content, options);
  58342. this.events.trigger('execution_request.Kernel', {kernel: this, content: content});
  58343. return this.send_shell_message("execute_request", content, callbacks);
  58344. };
  58345. /**
  58346. * When calling this method, pass a function to be called with the
  58347. * `complete_reply` message as its only argument when it arrives.
  58348. *
  58349. * `complete_reply` is documented
  58350. * [here](https://jupyter-client.readthedocs.io/en/latest/messaging.html#complete)
  58351. *
  58352. * @function complete
  58353. * @param code {string}
  58354. * @param cursor_pos {integer}
  58355. * @param callback {function}
  58356. */
  58357. Kernel.prototype.complete = function (code, cursor_pos, callback) {
  58358. var callbacks;
  58359. if (callback) {
  58360. callbacks = { shell : { reply : callback } };
  58361. }
  58362. var content = {
  58363. code : code,
  58364. cursor_pos : cursor_pos
  58365. };
  58366. return this.send_shell_message("complete_request", content, callbacks);
  58367. };
  58368. /**
  58369. * @function send_input_reply
  58370. */
  58371. Kernel.prototype.send_input_reply = function (input) {
  58372. var content = {
  58373. value : input
  58374. };
  58375. this.events.trigger('input_reply.Kernel', {kernel: this, content: content});
  58376. var msg = this._get_msg("input_reply", content);
  58377. msg.channel = 'stdin';
  58378. this._send(serialize.serialize(msg));
  58379. return msg.header.msg_id;
  58380. };
  58381. /**
  58382. * @function register_iopub_handler
  58383. */
  58384. Kernel.prototype.register_iopub_handler = function (msg_type, callback) {
  58385. this._iopub_handlers[msg_type] = callback;
  58386. };
  58387. /**
  58388. * Get the iopub handler for a specific message type.
  58389. *
  58390. * @function get_iopub_handler
  58391. */
  58392. Kernel.prototype.get_iopub_handler = function (msg_type) {
  58393. return this._iopub_handlers[msg_type];
  58394. };
  58395. /**
  58396. * Get callbacks for a specific message.
  58397. *
  58398. * @function get_callbacks_for_msg
  58399. */
  58400. Kernel.prototype.get_callbacks_for_msg = function (msg_id) {
  58401. if (msg_id == this.last_msg_id) {
  58402. return this.last_msg_callbacks;
  58403. } else {
  58404. return this._msg_callbacks[msg_id];
  58405. }
  58406. };
  58407. /**
  58408. * Get output callbacks for a specific message.
  58409. *
  58410. * @function get_output_callbacks_for_msg
  58411. *
  58412. * Since output callbacks can be overridden, we first check the override stack.
  58413. */
  58414. Kernel.prototype.get_output_callbacks_for_msg = function (msg_id) {
  58415. return this.get_callbacks_for_msg(this.get_output_callback_id(msg_id));
  58416. };
  58417. /**
  58418. * Get the output callback id for a message
  58419. *
  58420. * Since output callbacks can be redirected, this may not be the same as
  58421. * the msg_id.
  58422. *
  58423. * @function get_output_callback_id
  58424. */
  58425. Kernel.prototype.get_output_callback_id = function (msg_id) {
  58426. var callback_id = msg_id;
  58427. var overrides = this._msg_callbacks_overrides[msg_id];
  58428. if (overrides && overrides.length > 0) {
  58429. callback_id = overrides[overrides.length-1];
  58430. }
  58431. return callback_id
  58432. }
  58433. /**
  58434. * Clear callbacks for a specific message.
  58435. *
  58436. * @function clear_callbacks_for_msg
  58437. */
  58438. Kernel.prototype.clear_callbacks_for_msg = function (msg_id) {
  58439. if (this._msg_callbacks[msg_id] !== undefined ) {
  58440. var callbacks = this._msg_callbacks[msg_id];
  58441. var kernel = this;
  58442. // clear display_id:msg_id map for display_ids associated with this msg_id
  58443. if (!callbacks) return;
  58444. callbacks.display_ids.map(function (display_id) {
  58445. var msg_ids = kernel._display_id_to_parent_ids[display_id];
  58446. if (msg_ids) {
  58447. var idx = msg_ids.indexOf(msg_id);
  58448. if (idx === -1) {
  58449. return;
  58450. }
  58451. if (msg_ids.length === 1) {
  58452. delete kernel._display_id_to_parent_ids[display_id];
  58453. } else {
  58454. msg_ids.splice(idx, 1);
  58455. kernel._display_id_to_parent_ids[display_id] = msg_ids;
  58456. }
  58457. }
  58458. });
  58459. delete this._msg_callbacks[msg_id];
  58460. }
  58461. };
  58462. /**
  58463. * @function _finish_shell
  58464. */
  58465. Kernel.prototype._finish_shell = function (msg_id) {
  58466. var callbacks = this._msg_callbacks[msg_id];
  58467. if (callbacks !== undefined) {
  58468. callbacks.shell_done = true;
  58469. if (callbacks.clear_on_done && callbacks.iopub_done) {
  58470. this.clear_callbacks_for_msg(msg_id);
  58471. }
  58472. }
  58473. };
  58474. /**
  58475. * @function _finish_iopub
  58476. */
  58477. Kernel.prototype._finish_iopub = function (msg_id) {
  58478. var callbacks = this._msg_callbacks[msg_id];
  58479. if (callbacks !== undefined) {
  58480. callbacks.iopub_done = true;
  58481. if (callbacks.clear_on_done && callbacks.shell_done) {
  58482. this.clear_callbacks_for_msg(msg_id);
  58483. }
  58484. }
  58485. this.events.trigger('finished_iopub.Kernel', {kernel: this, msg_id: msg_id});
  58486. };
  58487. /**
  58488. * Set callbacks for a particular message.
  58489. * Callbacks should be a struct of the following form:
  58490. * shell : {
  58491. *
  58492. * }
  58493. *
  58494. * If the third parameter is truthy, the callback is set as the last
  58495. * callback registered.
  58496. *
  58497. * @function set_callbacks_for_msg
  58498. */
  58499. Kernel.prototype.set_callbacks_for_msg = function (msg_id, callbacks, save) {
  58500. var remember = save || true;
  58501. if (remember) {
  58502. this.last_msg_id = msg_id;
  58503. }
  58504. if (callbacks) {
  58505. // shallow-copy mapping, because we will modify it at the top level
  58506. var cbcopy = this._msg_callbacks[msg_id] = this.last_msg_callbacks = {};
  58507. cbcopy.shell = callbacks.shell;
  58508. cbcopy.iopub = callbacks.iopub;
  58509. cbcopy.input = callbacks.input;
  58510. cbcopy.clear_on_done = callbacks.clear_on_done;
  58511. cbcopy.shell_done = (!callbacks.shell);
  58512. cbcopy.iopub_done = (!callbacks.iopub);
  58513. cbcopy.display_ids = [];
  58514. if (callbacks.clear_on_done === undefined) {
  58515. // default to clear-on-done
  58516. cbcopy.clear_on_done = true;
  58517. }
  58518. } else if (remember) {
  58519. this.last_msg_callbacks = {};
  58520. }
  58521. };
  58522. /**
  58523. * Override output callbacks for a particular msg_id
  58524. */
  58525. Kernel.prototype.output_callback_overrides_push = function(msg_id, callback_id) {
  58526. var output_callbacks = this._msg_callbacks_overrides[msg_id];
  58527. if (!output_callbacks) {
  58528. this._msg_callbacks_overrides[msg_id] = output_callbacks = [];
  58529. }
  58530. output_callbacks.push(callback_id);
  58531. }
  58532. Kernel.prototype.output_callback_overrides_pop = function(msg_id) {
  58533. var callback_ids = this._msg_callbacks_overrides[msg_id];
  58534. if (!callback_ids) {
  58535. console.error("Popping callback overrides, but none registered", msg_id);
  58536. return;
  58537. }
  58538. return callback_ids.pop();
  58539. }
  58540. Kernel.prototype._handle_ws_message = function (e) {
  58541. var that = this;
  58542. this._msg_queue = this._msg_queue.then(function() {
  58543. return serialize.deserialize(e.data);
  58544. }).then(function(msg) {return that._finish_ws_message(msg);})
  58545. .catch(function(error) { console.error("Couldn't process kernel message", error); });
  58546. };
  58547. Kernel.prototype._finish_ws_message = function (msg) {
  58548. switch (msg.channel) {
  58549. case 'shell':
  58550. return this._handle_shell_reply(msg);
  58551. case 'iopub':
  58552. return this._handle_iopub_message(msg);
  58553. case 'stdin':
  58554. return this._handle_input_request(msg);
  58555. default:
  58556. console.error("unrecognized message channel", msg.channel, msg);
  58557. }
  58558. };
  58559. Kernel.prototype._handle_shell_reply = function (reply) {
  58560. this.events.trigger('shell_reply.Kernel', {kernel: this, reply:reply});
  58561. var that = this;
  58562. var content = reply.content;
  58563. var metadata = reply.metadata;
  58564. var parent_id = reply.parent_header.msg_id;
  58565. var callbacks = this.get_callbacks_for_msg(parent_id);
  58566. var promise = Promise.resolve();
  58567. if (!callbacks || !callbacks.shell) {
  58568. return;
  58569. }
  58570. var shell_callbacks = callbacks.shell;
  58571. // signal that shell callbacks are done
  58572. this._finish_shell(parent_id);
  58573. if (shell_callbacks.reply !== undefined) {
  58574. promise = promise.then(function() {return shell_callbacks.reply(reply);});
  58575. }
  58576. if (content.payload && shell_callbacks.payload) {
  58577. promise = promise.then(function() {
  58578. return that._handle_payloads(content.payload, shell_callbacks.payload, reply);
  58579. });
  58580. }
  58581. return promise;
  58582. };
  58583. /**
  58584. * @function _handle_payloads
  58585. */
  58586. Kernel.prototype._handle_payloads = function (payloads, payload_callbacks, msg) {
  58587. var promise = [];
  58588. var l = payloads.length;
  58589. // Payloads are handled by triggering events because we don't want the Kernel
  58590. // to depend on the Notebook or Pager classes.
  58591. for (var i=0; i<l; i++) {
  58592. var payload = payloads[i];
  58593. var callback = payload_callbacks[payload.source];
  58594. if (callback) {
  58595. promise.push(callback(payload, msg));
  58596. }
  58597. }
  58598. return Promise.all(promise);
  58599. };
  58600. /**
  58601. * @function _handle_status_message
  58602. */
  58603. Kernel.prototype._handle_status_message = function (msg) {
  58604. var execution_state = msg.content.execution_state;
  58605. var parent_id = msg.parent_header.msg_id;
  58606. // dispatch status msg callbacks, if any
  58607. var callbacks = this.get_callbacks_for_msg(parent_id);
  58608. if (callbacks && callbacks.iopub && callbacks.iopub.status) {
  58609. try {
  58610. callbacks.iopub.status(msg);
  58611. } catch (e) {
  58612. console.log("Exception in status msg handler", e, e.stack);
  58613. }
  58614. }
  58615. if (execution_state === 'busy') {
  58616. this.events.trigger('kernel_busy.Kernel', {kernel: this});
  58617. } else if (execution_state === 'idle') {
  58618. // signal that iopub callbacks are (probably) done
  58619. // async output may still arrive,
  58620. // but only for the most recent request
  58621. this._finish_iopub(parent_id);
  58622. // trigger status_idle event
  58623. this.events.trigger('kernel_idle.Kernel', {kernel: this});
  58624. } else if (execution_state === 'starting') {
  58625. this.events.trigger('kernel_starting.Kernel', {kernel: this});
  58626. var that = this;
  58627. this.kernel_info(function (reply) {
  58628. that.info_reply = reply.content;
  58629. that.events.trigger('kernel_ready.Kernel', {kernel: that});
  58630. });
  58631. } else if (execution_state === 'restarting') {
  58632. // autorestarting is distinct from restarting,
  58633. // in that it means the kernel died and the server is restarting it.
  58634. // kernel_restarting sets the notification widget,
  58635. // autorestart shows the more prominent dialog.
  58636. this._autorestart_attempt = this._autorestart_attempt + 1;
  58637. this.events.trigger('kernel_restarting.Kernel', {kernel: this});
  58638. this.events.trigger('kernel_autorestarting.Kernel', {kernel: this, attempt: this._autorestart_attempt});
  58639. } else if (execution_state === 'dead') {
  58640. this.events.trigger('kernel_dead.Kernel', {kernel: this});
  58641. this._kernel_dead();
  58642. }
  58643. };
  58644. /**
  58645. * Handle clear_output message
  58646. *
  58647. * @function _handle_clear_output
  58648. */
  58649. Kernel.prototype._handle_clear_output = function (msg) {
  58650. var callbacks = this.get_output_callbacks_for_msg(msg.parent_header.msg_id);
  58651. if (!callbacks || !callbacks.iopub) {
  58652. return;
  58653. }
  58654. var callback = callbacks.iopub.clear_output;
  58655. if (callback) {
  58656. callback(msg);
  58657. }
  58658. };
  58659. /**
  58660. * handle an output message (execute_result, display_data, etc.)
  58661. *
  58662. * @function _handle_output_message
  58663. */
  58664. Kernel.prototype._handle_output_message = function (msg) {
  58665. var that = this;
  58666. var msg_id = msg.parent_header.msg_id;
  58667. var callbacks = this.get_output_callbacks_for_msg(msg_id);
  58668. if (['display_data', 'update_display_data', 'execute_result'].indexOf(msg.header.msg_type) > -1) {
  58669. // display_data messages may re-route based on their display_id
  58670. var display_id = (msg.content.transient || {}).display_id;
  58671. if (display_id) {
  58672. // it has a display_id
  58673. var parent_ids = this._display_id_to_parent_ids[display_id];
  58674. if (parent_ids) {
  58675. // we've seen it before, update existing outputs with same display_id
  58676. // by handling display_data as update_display_data
  58677. var update_msg = $.extend(true, {}, msg);
  58678. update_msg.header.msg_type = 'update_display_data';
  58679. parent_ids.map(function (parent_id) {
  58680. var callbacks = that.get_callbacks_for_msg(parent_id);
  58681. if (!callbacks) return;
  58682. var callback = callbacks.iopub.output;
  58683. if (callback) {
  58684. callback(update_msg);
  58685. }
  58686. });
  58687. }
  58688. // we're done here if it's update_display
  58689. if (msg.header.msg_type === 'update_display_data') {
  58690. // it's an update, don't proceed to the normal display
  58691. return;
  58692. }
  58693. // regular display_data with id, record it for future updating
  58694. // in _display_id_to_parent_ids for future lookup
  58695. if (this._display_id_to_parent_ids[display_id] === undefined) {
  58696. this._display_id_to_parent_ids[display_id] = [];
  58697. }
  58698. var callback_id = this.get_output_callback_id(msg_id);
  58699. if (this._display_id_to_parent_ids[display_id].indexOf(callback_id) === -1) {
  58700. this._display_id_to_parent_ids[display_id].push(callback_id);
  58701. }
  58702. // and in callbacks for cleanup on clear_callbacks_for_msg
  58703. if (callbacks && callbacks.display_ids.indexOf(display_id) === -1) {
  58704. callbacks.display_ids.push(display_id);
  58705. }
  58706. }
  58707. }
  58708. if (!callbacks || !callbacks.iopub) {
  58709. // The message came from another client. Let the UI decide what to
  58710. // do with it.
  58711. this.events.trigger('received_unsolicited_message.Kernel', msg);
  58712. return;
  58713. }
  58714. var callback = callbacks.iopub.output;
  58715. if (callback) {
  58716. callback(msg);
  58717. }
  58718. };
  58719. /**
  58720. * Handle an input message (execute_input).
  58721. *
  58722. * @function _handle_input message
  58723. */
  58724. Kernel.prototype._handle_input_message = function (msg) {
  58725. var callbacks = this.get_callbacks_for_msg(msg.parent_header.msg_id);
  58726. if (!callbacks) {
  58727. // The message came from another client. Let the UI decide what to
  58728. // do with it.
  58729. this.events.trigger('received_unsolicited_message.Kernel', msg);
  58730. }
  58731. };
  58732. /**
  58733. * Handle a kernel shutdown message
  58734. * @function _handle_shutdown_message
  58735. */
  58736. Kernel.prototype._handle_shutdown_message = function (msg) {
  58737. if (!msg.content.restart) {
  58738. this.events.trigger('kernel_dead.Kernel', {kernel: this});
  58739. this._kernel_dead();
  58740. }
  58741. }
  58742. /**
  58743. * Dispatch IOPub messages to respective handlers. Each message
  58744. * type should have a handler.
  58745. *
  58746. * @function _handle_iopub_message
  58747. */
  58748. Kernel.prototype._handle_iopub_message = function (msg) {
  58749. var handler = this.get_iopub_handler(msg.header.msg_type);
  58750. if (handler !== undefined) {
  58751. return handler(msg);
  58752. }
  58753. };
  58754. /**
  58755. * @function _handle_input_request
  58756. */
  58757. Kernel.prototype._handle_input_request = function (request) {
  58758. var header = request.header;
  58759. var content = request.content;
  58760. var metadata = request.metadata;
  58761. var msg_type = header.msg_type;
  58762. if (msg_type !== 'input_request') {
  58763. console.log("Invalid input request!", request);
  58764. return;
  58765. }
  58766. var callbacks = this.get_callbacks_for_msg(request.parent_header.msg_id);
  58767. if (callbacks) {
  58768. if (callbacks.input) {
  58769. callbacks.input(request);
  58770. }
  58771. }
  58772. };
  58773. return {'Kernel': Kernel};
  58774. });
  58775. // Copyright (c) Jupyter Development Team.
  58776. // Distributed under the terms of the Modified BSD License.
  58777. define('services/sessions/session',[
  58778. 'jquery',
  58779. 'base/js/utils',
  58780. 'services/kernels/kernel',
  58781. ], function($, utils, kernel) {
  58782. "use strict";
  58783. /**
  58784. * Session object for accessing the session REST api. The session
  58785. * should be used to start kernels and then shut them down -- for
  58786. * all other operations, the kernel object should be used.
  58787. *
  58788. * Preliminary documentation for the REST API is at
  58789. * https://github.com/ipython/ipython/wiki/IPEP-16%3A-Notebook-multi-directory-dashboard-and-URL-mapping#sessions-api
  58790. *
  58791. * Options should include:
  58792. * - notebook_path: the path (not including name) to the notebook
  58793. * - kernel_name: the type of kernel (e.g. python3)
  58794. * - base_url: the root url of the notebook server
  58795. * - ws_url: the url to access websockets
  58796. * - notebook: Notebook object
  58797. *
  58798. * @class Session
  58799. * @param {Object} options
  58800. */
  58801. var Session = function (options) {
  58802. this.id = null;
  58803. this.notebook_model = {
  58804. path: options.notebook_path
  58805. };
  58806. this.kernel_model = {
  58807. id: null,
  58808. name: options.kernel_name
  58809. };
  58810. this.nbclassic_path = options.nbclassic_path;
  58811. this.base_url = options.base_url;
  58812. this.ws_url = options.ws_url;
  58813. this.session_service_url = utils.url_path_join(this.base_url, 'api/sessions');
  58814. this.session_url = null;
  58815. this.notebook = options.notebook;
  58816. this.kernel = null;
  58817. this.events = options.notebook.events;
  58818. this.bind_events();
  58819. };
  58820. Session.prototype.bind_events = function () {
  58821. var that = this;
  58822. var record_status = function (evt, info) {
  58823. console.log('Session: ' + evt.type + ' (' + info.session.id + ')');
  58824. };
  58825. this.events.on('kernel_created.Session', record_status);
  58826. this.events.on('kernel_dead.Session', record_status);
  58827. this.events.on('kernel_killed.Session', record_status);
  58828. // if the kernel dies, then also remove the session
  58829. this.events.on('kernel_dead.Kernel', function () {
  58830. that.delete();
  58831. });
  58832. this.events.on('kernel_failed_restart.Kernel', function () {
  58833. that.notebook.start_session();
  58834. });
  58835. };
  58836. // Public REST api functions
  58837. /**
  58838. * GET /api/sessions
  58839. *
  58840. * Get a list of the current sessions.
  58841. *
  58842. * @function list
  58843. * @param {function} [success] - function executed on ajax success
  58844. * @param {function} [error] - function executed on ajax error
  58845. */
  58846. Session.prototype.list = function (success, error) {
  58847. utils.ajax(this.session_service_url, {
  58848. processData: false,
  58849. cache: false,
  58850. type: "GET",
  58851. dataType: "json",
  58852. success: success,
  58853. error: this._on_error(error)
  58854. });
  58855. };
  58856. /**
  58857. * POST /api/sessions
  58858. *
  58859. * Start a new session. This function can only executed once.
  58860. *
  58861. * @function start
  58862. * @param {function} [success] - function executed on ajax success
  58863. * @param {function} [error] - function executed on ajax error
  58864. */
  58865. Session.prototype.start = function (success, error) {
  58866. var that = this;
  58867. var on_success = function (data, status, xhr) {
  58868. if (that.kernel) {
  58869. that.kernel.name = that.kernel_model.name;
  58870. } else {
  58871. var kernel_service_url = utils.url_path_join(that.base_url, "api/kernels");
  58872. that.kernel = new kernel.Kernel(kernel_service_url, that.ws_url, that.kernel_model.name);
  58873. }
  58874. that.events.trigger('kernel_created.Session', {session: that, kernel: that.kernel});
  58875. that.kernel._kernel_created(data.kernel);
  58876. if (success) {
  58877. success(data, status, xhr);
  58878. }
  58879. };
  58880. var on_error = function (xhr, status, err) {
  58881. that.events.trigger('kernel_dead.Session', {session: that, xhr: xhr, status: status, error: err});
  58882. if (error) {
  58883. error(xhr, status, err);
  58884. }
  58885. };
  58886. utils.ajax(this.session_service_url, {
  58887. processData: false,
  58888. cache: false,
  58889. type: "POST",
  58890. data: JSON.stringify(this._get_model()),
  58891. contentType: 'application/json',
  58892. dataType: "json",
  58893. success: this._on_success(on_success),
  58894. error: this._on_error(on_error)
  58895. });
  58896. };
  58897. /**
  58898. * GET /api/sessions/[:session_id]
  58899. *
  58900. * Get information about a session.
  58901. *
  58902. * @function get_info
  58903. * @param {function} [success] - function executed on ajax success
  58904. * @param {function} [error] - function executed on ajax error
  58905. */
  58906. Session.prototype.get_info = function (success, error) {
  58907. utils.ajax(this.session_url, {
  58908. processData: false,
  58909. cache: false,
  58910. type: "GET",
  58911. dataType: "json",
  58912. success: this._on_success(success),
  58913. error: this._on_error(error)
  58914. });
  58915. };
  58916. /**
  58917. * PATCH /api/sessions/[:session_id]
  58918. *
  58919. * Rename or move a notebook. If the given name or path are
  58920. * undefined, then they will not be changed.
  58921. *
  58922. * @function rename_notebook
  58923. * @param {string} [path] - new notebook path
  58924. * @param {function} [success] - function executed on ajax success
  58925. * @param {function} [error] - function executed on ajax error
  58926. */
  58927. Session.prototype.rename_notebook = function (path, success, error) {
  58928. if (path !== undefined) {
  58929. this.notebook_model.path = path;
  58930. }
  58931. utils.ajax(this.session_url, {
  58932. processData: false,
  58933. cache: false,
  58934. type: "PATCH",
  58935. data: JSON.stringify(this._get_model()),
  58936. contentType: 'application/json',
  58937. dataType: "json",
  58938. success: this._on_success(success),
  58939. error: this._on_error(error)
  58940. });
  58941. };
  58942. /**
  58943. * DELETE /api/sessions/[:session_id]
  58944. *
  58945. * Kill the kernel and shutdown the session.
  58946. *
  58947. * @function delete
  58948. * @param {function} [success] - function executed on ajax success
  58949. * @param {function} [error] - function executed on ajax error
  58950. */
  58951. Session.prototype.delete = function (success, error) {
  58952. if (this.kernel && this.kernel.is_connected()) {
  58953. this.events.trigger('kernel_killed.Session', {session: this, kernel: this.kernel});
  58954. this.kernel._kernel_dead();
  58955. }
  58956. utils.ajax(this.session_url, {
  58957. processData: false,
  58958. cache: false,
  58959. type: "DELETE",
  58960. dataType: "json",
  58961. success: this._on_success(success),
  58962. error: this._on_error(error)
  58963. });
  58964. };
  58965. /**
  58966. * Restart the session by deleting it and the starting it
  58967. * fresh. If options are given, they can include any of the
  58968. * following:
  58969. *
  58970. * - notebook_path - the path to the notebook
  58971. * - kernel_name - the name (type) of the kernel
  58972. *
  58973. * @function restart
  58974. * @param {Object} [options] - options for the new kernel
  58975. * @param {function} [success] - function executed on ajax success
  58976. * @param {function} [error] - function executed on ajax error
  58977. */
  58978. Session.prototype.restart = function (options, success, error) {
  58979. var that = this;
  58980. var start = function () {
  58981. if (options && options.notebook_path) {
  58982. that.notebook_model.path = options.notebook_path;
  58983. }
  58984. if (options && options.kernel_name) {
  58985. that.kernel_model.name = options.kernel_name;
  58986. }
  58987. that.kernel_model.id = null;
  58988. that.start(success, error);
  58989. };
  58990. this.delete(start, start);
  58991. };
  58992. // Helper functions
  58993. /**
  58994. * Get the data model for the session, which includes the notebook path
  58995. * and kernel (name and id).
  58996. *
  58997. * @function _get_model
  58998. * @returns {Object} - the data model
  58999. */
  59000. Session.prototype._get_model = function () {
  59001. return {
  59002. path: this.notebook_model.path,
  59003. type: 'notebook',
  59004. name: '',
  59005. kernel: this.kernel_model
  59006. };
  59007. };
  59008. /**
  59009. * Update the data model from the given JSON object, which should
  59010. * have attributes of `id`, `notebook`, and/or `kernel`. If
  59011. * provided, the notebook data must include name and path, and the
  59012. * kernel data must include name and id.
  59013. *
  59014. * @function _update_model
  59015. * @param {Object} data - updated data model
  59016. */
  59017. Session.prototype._update_model = function (data) {
  59018. if (data && data.id) {
  59019. this.id = data.id;
  59020. this.session_url = utils.url_path_join(this.session_service_url, this.id);
  59021. }
  59022. if (data && data.notebook) {
  59023. this.notebook_model.path = data.path;
  59024. }
  59025. if (data && data.kernel) {
  59026. this.kernel_model.name = data.kernel.name;
  59027. this.kernel_model.id = data.kernel.id;
  59028. }
  59029. };
  59030. /**
  59031. * Handle a successful AJAX request by updating the session data
  59032. * model with the response, and then optionally calling a provided
  59033. * callback.
  59034. *
  59035. * @function _on_success
  59036. * @param {function} success - callback
  59037. */
  59038. Session.prototype._on_success = function (success) {
  59039. var that = this;
  59040. return function (data, status, xhr) {
  59041. that._update_model(data);
  59042. if (success) {
  59043. success(data, status, xhr);
  59044. }
  59045. };
  59046. };
  59047. /**
  59048. * Handle a failed AJAX request by logging the error message, and
  59049. * then optionally calling a provided callback.
  59050. *
  59051. * @function _on_error
  59052. * @param {function} error - callback
  59053. */
  59054. Session.prototype._on_error = function (error) {
  59055. return function (xhr, status, err) {
  59056. utils.log_ajax_error(xhr, status, err);
  59057. if (error) {
  59058. error(xhr, status, err);
  59059. }
  59060. };
  59061. };
  59062. /**
  59063. * Error type indicating that the session is already starting.
  59064. */
  59065. var SessionAlreadyStarting = function (message) {
  59066. this.name = "SessionAlreadyStarting";
  59067. this.message = (message || "");
  59068. };
  59069. SessionAlreadyStarting.prototype = Error.prototype;
  59070. return {
  59071. Session: Session,
  59072. SessionAlreadyStarting: SessionAlreadyStarting
  59073. };
  59074. });
  59075. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  59076. // Distributed under an MIT license: https://codemirror.net/LICENSE
  59077. (function(mod) {
  59078. if (typeof exports == "object" && typeof module == "object") // CommonJS
  59079. mod(require("../../lib/codemirror"));
  59080. else if (typeof define == "function" && define.amd) // AMD
  59081. define('codemirror/addon/runmode/runmode',["../../lib/codemirror"], mod);
  59082. else // Plain browser env
  59083. mod(CodeMirror);
  59084. })(function(CodeMirror) {
  59085. "use strict";
  59086. CodeMirror.runMode = function(string, modespec, callback, options) {
  59087. var mode = CodeMirror.getMode(CodeMirror.defaults, modespec);
  59088. var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize;
  59089. // Create a tokenizing callback function if passed-in callback is a DOM element.
  59090. if (callback.appendChild) {
  59091. var ie = /MSIE \d/.test(navigator.userAgent);
  59092. var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9);
  59093. var node = callback, col = 0;
  59094. node.innerHTML = "";
  59095. callback = function(text, style) {
  59096. if (text == "\n") {
  59097. // Emitting LF or CRLF on IE8 or earlier results in an incorrect display.
  59098. // Emitting a carriage return makes everything ok.
  59099. node.appendChild(document.createTextNode(ie_lt9 ? '\r' : text));
  59100. col = 0;
  59101. return;
  59102. }
  59103. var content = "";
  59104. // replace tabs
  59105. for (var pos = 0;;) {
  59106. var idx = text.indexOf("\t", pos);
  59107. if (idx == -1) {
  59108. content += text.slice(pos);
  59109. col += text.length - pos;
  59110. break;
  59111. } else {
  59112. col += idx - pos;
  59113. content += text.slice(pos, idx);
  59114. var size = tabSize - col % tabSize;
  59115. col += size;
  59116. for (var i = 0; i < size; ++i) content += " ";
  59117. pos = idx + 1;
  59118. }
  59119. }
  59120. // Create a node with token style and append it to the callback DOM element.
  59121. if (style) {
  59122. var sp = node.appendChild(document.createElement("span"));
  59123. sp.className = "cm-" + style.replace(/ +/g, " cm-");
  59124. sp.appendChild(document.createTextNode(content));
  59125. } else {
  59126. node.appendChild(document.createTextNode(content));
  59127. }
  59128. };
  59129. }
  59130. var lines = CodeMirror.splitLines(string), state = (options && options.state) || CodeMirror.startState(mode);
  59131. for (var i = 0, e = lines.length; i < e; ++i) {
  59132. if (i) callback("\n");
  59133. var stream = new CodeMirror.StringStream(lines[i], null, {
  59134. lookAhead: function(n) { return lines[i + n] },
  59135. baseToken: function() {}
  59136. });
  59137. if (!stream.string && mode.blankLine) mode.blankLine(state);
  59138. while (!stream.eol()) {
  59139. var style = mode.token(stream, state);
  59140. callback(stream.current(), style, i, stream.start, state);
  59141. stream.start = stream.pos;
  59142. }
  59143. }
  59144. };
  59145. });
  59146. // Copyright (c) Jupyter Development Team.
  59147. // Distributed under the terms of the Modified BSD License.
  59148. define('notebook/js/tooltip',[
  59149. 'jquery',
  59150. 'base/js/utils',
  59151. 'base/js/i18n'
  59152. ], function($, utils, i18n) {
  59153. "use strict";
  59154. // tooltip constructor
  59155. var Tooltip = function (events) {
  59156. var that = this;
  59157. this.events = events;
  59158. this.time_before_tooltip = 1200;
  59159. // handle to html
  59160. this.tooltip = $('#tooltip');
  59161. this._hidden = true;
  59162. // variable for consecutive call
  59163. this._old_cell = null;
  59164. this._old_request = null;
  59165. this._consecutive_counter = 0;
  59166. // 'sticky ?'
  59167. this._sticky = false;
  59168. // display tooltip if the docstring is empty?
  59169. this._hide_if_no_docstring = false;
  59170. // contain the button in the upper right corner
  59171. this.buttons = $('<div/>').addClass('tooltipbuttons');
  59172. // will contain the docstring
  59173. this.text = $('<div/>').addClass('tooltiptext').addClass('smalltooltip');
  59174. // build the buttons menu on the upper right
  59175. // expand the tooltip to see more
  59176. var expandlink = $('<a/>').attr('href', "#").attr('role', "button").addClass('ui-button')
  59177. .attr('id', 'expanbutton').attr('title', i18n.msg._('Grow the tooltip vertically (press shift-tab twice)')).click(function () {
  59178. that.expand();
  59179. event.preventDefault();
  59180. }).append(
  59181. $('<span/>').text('Expand').addClass('ui-icon').addClass('ui-icon-plus'));
  59182. // open in pager
  59183. var morelink = $('<a/>').attr('href', "#").attr('role', "button").addClass('ui-button').attr('title', i18n.msg._('show the current docstring in pager (press shift-tab 4 times)'));
  59184. var morespan = $('<span/>').text(i18n.msg._('Open in Pager')).addClass('ui-icon').addClass('ui-icon-arrowstop-l-n');
  59185. morelink.append(morespan);
  59186. morelink.click(function () {
  59187. that.showInPager(that._old_cell);
  59188. event.preventDefault();
  59189. });
  59190. // close the tooltip
  59191. var closelink = $('<a/>').attr('href', "#").attr('role', "button").addClass('ui-button');
  59192. var closespan = $('<span/>').text(i18n.msg._('Close')).addClass('ui-icon').addClass('ui-icon-close');
  59193. closelink.append(closespan);
  59194. closelink.click(function () {
  59195. that.remove_and_cancel_tooltip(true);
  59196. event.preventDefault();
  59197. });
  59198. this._clocklink = $('<a/>').attr('href', "#");
  59199. this._clocklink.attr('role', "button");
  59200. this._clocklink.addClass('ui-button');
  59201. this._clocklink.attr('title', i18n.msg._('Tooltip will linger for 10 seconds while you type'));
  59202. var clockspan = $('<span/>').text(i18n.msg._('Close'));
  59203. clockspan.addClass('ui-icon');
  59204. clockspan.addClass('ui-icon-clock');
  59205. this._clocklink.append(clockspan);
  59206. this._clocklink.click(function () {
  59207. that.cancel_stick();
  59208. event.preventDefault();
  59209. });
  59210. //construct the tooltip
  59211. // add in the reverse order you want them to appear
  59212. this.buttons.append(closelink);
  59213. this.buttons.append(expandlink);
  59214. this.buttons.append(morelink);
  59215. this.buttons.append(this._clocklink);
  59216. this._clocklink.hide();
  59217. // we need a phony element to make the small arrow
  59218. // of the tooltip in css
  59219. // we will move the arrow later
  59220. this.arrow = $('<div/>').addClass('pretooltiparrow');
  59221. this.tooltip.append(this.buttons);
  59222. this.tooltip.append(this.arrow);
  59223. this.tooltip.append(this.text);
  59224. // function that will be called if you press tab 1, 2, 3... times in a row
  59225. this.tabs_functions = [function (cell, text, cursor) {
  59226. that._request_tooltip(cell, text, cursor);
  59227. }, function () {
  59228. that.expand();
  59229. }, function () {
  59230. that.stick();
  59231. }, function (cell) {
  59232. that.cancel_stick();
  59233. that.showInPager(cell);
  59234. }];
  59235. // call after all the tabs function above have bee call to clean their effects
  59236. // if necessary
  59237. this.reset_tabs_function = function (cell, text) {
  59238. this._old_cell = (cell) ? cell : null;
  59239. this._old_request = (text) ? text : null;
  59240. this._consecutive_counter = 0;
  59241. };
  59242. };
  59243. Tooltip.prototype.is_visible = function () {
  59244. return !this._hidden;
  59245. };
  59246. Tooltip.prototype.showInPager = function (cell) {
  59247. /**
  59248. * reexecute last call in pager by appending ? to show back in pager
  59249. */
  59250. this.events.trigger('open_with_text.Pager', this._reply.content);
  59251. this.remove_and_cancel_tooltip();
  59252. };
  59253. // grow the tooltip vertically
  59254. Tooltip.prototype.expand = function () {
  59255. this.text.removeClass('smalltooltip');
  59256. this.text.addClass('bigtooltip');
  59257. $('#expanbutton').hide('slow');
  59258. };
  59259. // deal with all the logic of hiding the tooltip
  59260. // and reset its status
  59261. Tooltip.prototype._hide = function () {
  59262. this._hidden = true;
  59263. this.tooltip.fadeOut('fast');
  59264. $('#expanbutton').show('slow');
  59265. this.text.removeClass('bigtooltip');
  59266. this.text.addClass('smalltooltip');
  59267. // keep scroll top to be sure to always see the first line
  59268. this.text.scrollTop(0);
  59269. this.code_mirror = null;
  59270. };
  59271. // return true on successfully removing a visible tooltip; otherwise return
  59272. // false.
  59273. Tooltip.prototype.remove_and_cancel_tooltip = function (force) {
  59274. /**
  59275. * note that we don't handle closing directly inside the calltip
  59276. * as in the completer, because it is not focusable, so won't
  59277. * get the event.
  59278. */
  59279. this.cancel_pending();
  59280. if (!this._hidden) {
  59281. if (force || !this._sticky) {
  59282. this.cancel_stick();
  59283. this._hide();
  59284. }
  59285. this.reset_tabs_function();
  59286. return true;
  59287. } else {
  59288. return false;
  59289. }
  59290. };
  59291. // cancel autocall done after '(' for example.
  59292. Tooltip.prototype.cancel_pending = function () {
  59293. if (this._tooltip_timeout !== null) {
  59294. clearTimeout(this._tooltip_timeout);
  59295. this._tooltip_timeout = null;
  59296. }
  59297. };
  59298. // will trigger tooltip after timeout
  59299. Tooltip.prototype.pending = function (cell, hide_if_no_docstring) {
  59300. var that = this;
  59301. this._tooltip_timeout = setTimeout(function () {
  59302. that.request(cell, hide_if_no_docstring);
  59303. }, that.time_before_tooltip);
  59304. };
  59305. // easy access for julia monkey patching.
  59306. Tooltip.last_token_re = /[a-z_][0-9a-z._]*$/gi;
  59307. Tooltip.prototype._request_tooltip = function (cell, text, cursor_pos) {
  59308. var callbacks = $.proxy(this._show, this);
  59309. var msg_id = cell.kernel.inspect(text, cursor_pos, callbacks);
  59310. };
  59311. // make an immediate completion request
  59312. Tooltip.prototype.request = function (cell, hide_if_no_docstring) {
  59313. /**
  59314. * request(codecell)
  59315. * Deal with extracting the text from the cell and counting
  59316. * call in a row
  59317. */
  59318. this.cancel_pending();
  59319. var editor = cell.code_mirror;
  59320. var cursor = editor.getCursor();
  59321. var text = cell.get_text();
  59322. var cursor_pos = utils.js_idx_to_char_idx(editor.indexFromPos(cursor), text);
  59323. this._hide_if_no_docstring = hide_if_no_docstring;
  59324. if(editor.somethingSelected()){
  59325. // get only the most recent selection.
  59326. text = editor.getSelection();
  59327. }
  59328. // need a permanent handle to code_mirror for future auto recall
  59329. this.code_mirror = editor;
  59330. // now we treat the different number of keypress
  59331. // first if same cell, same text, increment counter by 1
  59332. if (this._old_cell == cell && this._old_request == text && this._hidden === false) {
  59333. this._consecutive_counter++;
  59334. } else {
  59335. // else reset
  59336. this.cancel_stick();
  59337. this.reset_tabs_function (cell, text);
  59338. }
  59339. this.tabs_functions[this._consecutive_counter](cell, text, cursor_pos);
  59340. // then if we are at the end of list function, reset
  59341. if (this._consecutive_counter == this.tabs_functions.length) {
  59342. this.reset_tabs_function (cell, text, cursor);
  59343. }
  59344. return;
  59345. };
  59346. // cancel the option of having the tooltip to stick
  59347. Tooltip.prototype.cancel_stick = function () {
  59348. clearTimeout(this._stick_timeout);
  59349. this._stick_timeout = null;
  59350. this._clocklink.hide('slow');
  59351. this._sticky = false;
  59352. };
  59353. // put the tooltip in a sticky state for 10 seconds
  59354. // it won't be removed by remove_and_cancel() unless you called with
  59355. // the first parameter set to true.
  59356. // remove_and_cancel_tooltip(true)
  59357. Tooltip.prototype.stick = function (time) {
  59358. time = (time !== undefined) ? time : 10;
  59359. var that = this;
  59360. this._sticky = true;
  59361. this._clocklink.show('slow');
  59362. this._stick_timeout = setTimeout(function () {
  59363. that._sticky = false;
  59364. that._clocklink.hide('slow');
  59365. }, time * 1000);
  59366. };
  59367. // should be called with the kernel reply to actually show the tooltip
  59368. Tooltip.prototype._show = function (reply) {
  59369. /**
  59370. * move the bubble if it is not hidden
  59371. * otherwise fade it
  59372. */
  59373. this._reply = reply;
  59374. var content = reply.content;
  59375. if (!content.found) {
  59376. // object not found, nothing to show
  59377. return;
  59378. }
  59379. this.name = content.name;
  59380. // do some math to have the tooltip arrow on more or less on left or right
  59381. // position of the editor
  59382. var cm_pos = $(this.code_mirror.getWrapperElement()).position();
  59383. var cell_pos = $(this.code_mirror.getWrapperElement().offsetParent).position();
  59384. // anchor and head positions are local within CodeMirror element
  59385. var anchor = this.code_mirror.cursorCoords(false, 'local');
  59386. var head = this.code_mirror.cursorCoords(true, 'local');
  59387. // locate the target at the center of anchor, head
  59388. var center_left = (head.left + anchor.left) / 2;
  59389. // locate the left edge of the tooltip, at most 450 px left of the arrow
  59390. var edge_left = Math.max(center_left - 450, 0);
  59391. // locate the arrow at the cursor. A 24 px offset seems necessary.
  59392. var arrow_left = center_left - edge_left - 24;
  59393. // locate left, top within container element
  59394. var left = (cell_pos.left + cm_pos.left + edge_left) + 'px';
  59395. var top = (cell_pos.top + cm_pos.top + head.bottom + 10) + 'px';
  59396. if (this._hidden === false) {
  59397. this.tooltip.animate({
  59398. left: left,
  59399. top: top
  59400. });
  59401. } else {
  59402. this.tooltip.css({
  59403. left: left
  59404. });
  59405. this.tooltip.css({
  59406. top: top
  59407. });
  59408. }
  59409. this.arrow.animate({
  59410. 'left': arrow_left + 'px'
  59411. });
  59412. this._hidden = false;
  59413. this.tooltip.fadeIn('fast');
  59414. this.text.children().remove();
  59415. // This should support rich data types, but only text/plain for now
  59416. // Any HTML within the docstring is escaped by the fixConsole() method.
  59417. var pre = $('<pre/>').html(utils.fixConsole(content.data['text/plain']));
  59418. this.text.append(pre);
  59419. // keep scroll top to be sure to always see the first line
  59420. this.text.scrollTop(0);
  59421. };
  59422. return {'Tooltip': Tooltip};
  59423. });
  59424. // Copyright (c) Jupyter Development Team.
  59425. // Distributed under the terms of the Modified BSD License.
  59426. define('notebook/js/celltoolbarpresets/default',[
  59427. 'notebook/js/celltoolbar',
  59428. 'base/js/dialog',
  59429. 'base/js/i18n'
  59430. ], function(celltoolbar, dialog, i18n) {
  59431. "use strict";
  59432. var CellToolbar = celltoolbar.CellToolbar;
  59433. var raw_edit = function (cell , edit_metadata_button) {
  59434. dialog.edit_metadata({
  59435. md: cell.metadata,
  59436. callback: function (md) {
  59437. cell.metadata = md;
  59438. },
  59439. name: i18n.msg._('Cell'),
  59440. notebook: this.notebook,
  59441. keyboard_manager: this.keyboard_manager,
  59442. edit_metadata_button: edit_metadata_button
  59443. });
  59444. };
  59445. var add_raw_edit_button = function(div, cell) {
  59446. var button_container = $(div);
  59447. var button = $('<button/>')
  59448. .addClass("btn btn-default btn-xs")
  59449. .text(i18n.msg._("Edit Metadata"))
  59450. .click( function () {
  59451. raw_edit(cell, this);
  59452. return false;
  59453. });
  59454. button_container.append(button);
  59455. };
  59456. var register = function (notebook) {
  59457. CellToolbar.register_callback('default.rawedit', add_raw_edit_button);
  59458. raw_edit = $.proxy(raw_edit, {
  59459. notebook: notebook,
  59460. keyboard_manager: notebook.keyboard_manager
  59461. });
  59462. var example_preset = [];
  59463. example_preset.push('default.rawedit');
  59464. CellToolbar.register_preset(i18n.msg._('Edit Metadata'), example_preset, notebook);
  59465. };
  59466. return {'register': register};
  59467. });
  59468. // Copyright (c) Jupyter Development Team.
  59469. // Distributed under the terms of the Modified BSD License.
  59470. define('notebook/js/celltoolbarpresets/rawcell',[
  59471. 'notebook/js/celltoolbar',
  59472. 'base/js/dialog',
  59473. 'base/js/keyboard',
  59474. 'base/js/i18n'
  59475. ], function(celltoolbar, dialog, keyboard, i18n) {
  59476. "use strict";
  59477. var CellToolbar = celltoolbar.CellToolbar;
  59478. var raw_cell_preset = [];
  59479. var select_type = CellToolbar.utils.select_ui_generator([
  59480. [i18n.msg._("None"), "-"],
  59481. ["LaTeX", "text/latex"],
  59482. ["reST", "text/restructuredtext"],
  59483. ["HTML", "text/html"],
  59484. ["Markdown", "text/markdown"],
  59485. ["Python", "text/x-python"],
  59486. [i18n.msg._("Custom"), "dialog"],
  59487. ],
  59488. // setter
  59489. function(cell, value) {
  59490. if (value === "-") {
  59491. delete cell.metadata.raw_mimetype;
  59492. } else if (value === 'dialog') {
  59493. var message =
  59494. i18n.msg._("Set the MIME type of the raw cell:");
  59495. var mimeinput = $('<input/>')
  59496. .attr('type', 'text')
  59497. .attr('size', '25')
  59498. .attr('name', 'mimetype')
  59499. .val(cell.metadata.raw_mimetype || "-");
  59500. var dialogform = $('<div/>').attr('title', i18n.msg._("Edit MIME type"))
  59501. .append(
  59502. $('<form/>').append(
  59503. $('<fieldset/>').append(
  59504. $('<label/>')
  59505. .attr('for', 'mimetype')
  59506. .text(message)
  59507. )
  59508. .append($('<br/>'))
  59509. .append(mimeinput)
  59510. )
  59511. );
  59512. dialog.modal({
  59513. title: i18n.msg._("Raw Cell MIME Type"),
  59514. body: dialogform,
  59515. buttons : {
  59516. Cancel: {},
  59517. OK: {
  59518. class: "btn-primary",
  59519. click: function () {
  59520. console.log(cell);
  59521. cell.metadata.raw_mimetype = $(this).find('input').val();
  59522. console.log(cell.metadata);
  59523. }
  59524. }
  59525. },
  59526. notebook: cell.notebook,
  59527. keyboard_manager: cell.keyboard_manager,
  59528. open : function (event, ui) {
  59529. var that = $(this);
  59530. // Upon ENTER, click the OK button.
  59531. that.find('input[type="text"]').keydown(function (event, ui) {
  59532. if (event.which === keyboard.keycodes.enter) {
  59533. that.find('.btn-primary').first().click();
  59534. return false;
  59535. }
  59536. });
  59537. that.find('input[type="text"]').focus().select();
  59538. }
  59539. });
  59540. } else {
  59541. cell.metadata.raw_mimetype = value;
  59542. }
  59543. },
  59544. //getter
  59545. function(cell) {
  59546. return cell.metadata.raw_mimetype || "";
  59547. },
  59548. // name
  59549. i18n.msg._("Raw NBConvert Format")
  59550. );
  59551. var register = function (notebook) {
  59552. CellToolbar.register_callback('raw_cell.select', select_type, ['raw']);
  59553. raw_cell_preset.push('raw_cell.select');
  59554. CellToolbar.register_preset(i18n.msg._('Raw Cell Format'), raw_cell_preset, notebook);
  59555. };
  59556. return {'register': register};
  59557. });
  59558. // Copyright (c) Jupyter Development Team.
  59559. // Distributed under the terms of the Modified BSD License.
  59560. define('notebook/js/celltoolbarpresets/slideshow',[
  59561. 'notebook/js/celltoolbar',
  59562. 'base/js/i18n'
  59563. ], function(celltoolbar, i18n) {
  59564. "use strict";
  59565. var CellToolbar = celltoolbar.CellToolbar;
  59566. var slideshow_preset = [];
  59567. var select_type = CellToolbar.utils.select_ui_generator([
  59568. ["-" ,"-" ],
  59569. [i18n.msg._("Slide") ,"slide" ],
  59570. [i18n.msg._("Sub-Slide") ,"subslide" ],
  59571. [i18n.msg._("Fragment") ,"fragment" ],
  59572. [i18n.msg._("Skip") ,"skip" ],
  59573. [i18n.msg._("Notes") ,"notes" ],
  59574. ],
  59575. // setter
  59576. function(cell, value){
  59577. // we check that the slideshow namespace exist and create it if needed
  59578. if (cell.metadata.slideshow === undefined){cell.metadata.slideshow = {};}
  59579. // set the value
  59580. cell.metadata.slideshow.slide_type = value;
  59581. },
  59582. // getter
  59583. function(cell){ var ns = cell.metadata.slideshow;
  59584. // if the slideshow namespace does not exist return `undefined`
  59585. // (will be interpreted as `false` by checkbox) otherwise
  59586. // return the value
  59587. return (ns === undefined)? undefined: ns.slide_type;
  59588. },
  59589. i18n.msg._("Slide Type"));
  59590. var register = function (notebook) {
  59591. CellToolbar.register_callback('slideshow.select',select_type);
  59592. slideshow_preset.push('slideshow.select');
  59593. CellToolbar.register_preset(i18n.msg._('Slideshow'),slideshow_preset, notebook);
  59594. };
  59595. return {'register': register};
  59596. });
  59597. // Copyright (c) Jupyter Development Team.
  59598. // Distributed under the terms of the Modified BSD License.
  59599. define('notebook/js/celltoolbarpresets/attachments',[
  59600. 'notebook/js/celltoolbar',
  59601. 'base/js/dialog',
  59602. 'base/js/i18n'
  59603. ], function(celltoolbar, dialog, i18n) {
  59604. "use strict";
  59605. var CellToolbar = celltoolbar.CellToolbar;
  59606. var edit_attachments_dialog = function(cell) {
  59607. dialog.edit_attachments({
  59608. attachments: cell.attachments,
  59609. callback: function(attachments) {
  59610. cell.attachments = attachments;
  59611. // Force cell refresh
  59612. cell.unrender();
  59613. cell.render();
  59614. },
  59615. name: 'Cell',
  59616. notebook: cell.notebook,
  59617. keyboard_manager: cell.keyboard_manager
  59618. });
  59619. };
  59620. var add_dialog_button = function(div, cell) {
  59621. var button_container = $(div);
  59622. var button = $('<button />')
  59623. .addClass('btn btn-default btn-xs')
  59624. .text(i18n.msg._('Edit Attachments'))
  59625. .click( function() {
  59626. edit_attachments_dialog(cell);
  59627. return false;
  59628. });
  59629. button_container.append(button);
  59630. };
  59631. var register = function(notebook) {
  59632. CellToolbar.register_callback('attachments.edit', add_dialog_button);
  59633. var attachments_preset = [];
  59634. attachments_preset.push('attachments.edit');
  59635. CellToolbar.register_preset(i18n.msg._('Attachments'), attachments_preset, notebook);
  59636. };
  59637. return {'register' : register};
  59638. });
  59639. // Copyright (c) Jupyter Development Team.
  59640. // Distributed under the terms of the Modified BSD License.
  59641. define('notebook/js/celltoolbarpresets/tags',[
  59642. 'notebook/js/celltoolbar',
  59643. 'base/js/dialog',
  59644. 'base/js/i18n'
  59645. ], function(celltoolbar, dialog, i18n) {
  59646. "use strict";
  59647. var CellToolbar = celltoolbar.CellToolbar;
  59648. var array_difference = function(a, b) {
  59649. return a.filter(function(n) {
  59650. return b.indexOf(n) === -1;
  59651. });
  59652. };
  59653. var write_tag = function(cell, name, add) {
  59654. if (add) {
  59655. // Add to metadata
  59656. if (cell.metadata.tags === undefined) {
  59657. cell.metadata.tags = [];
  59658. } else if (cell.metadata.tags.indexOf(name) !== -1) {
  59659. // Tag already exists
  59660. return false;
  59661. }
  59662. cell.metadata.tags.push(name);
  59663. } else {
  59664. // Remove from metadata
  59665. if (!cell.metadata || !cell.metadata.tags) {
  59666. // No tags to remove
  59667. return false;
  59668. }
  59669. // Remove tag from tags list
  59670. var index = cell.metadata.tags.indexOf(name);
  59671. if (index !== -1) {
  59672. cell.metadata.tags.splice(index, 1);
  59673. }
  59674. // If tags list is empty, remove it
  59675. if (cell.metadata.tags.length === 0) {
  59676. delete cell.metadata.tags;
  59677. }
  59678. }
  59679. cell.events.trigger('set_dirty.Notebook', {value: true});
  59680. return true;
  59681. };
  59682. var preprocess_input = function(input) {
  59683. // Split on whitespace + commas:
  59684. return input.split(/[,\s]+/)
  59685. };
  59686. var add_tag = function(cell, tag_container, on_remove) {
  59687. return function(name) {
  59688. if (name === '') {
  59689. // Skip empty strings
  59690. return;
  59691. }
  59692. // Write tag to metadata
  59693. var changed = write_tag(cell, name, true);
  59694. if (changed) {
  59695. // Make tag UI
  59696. var tag = make_tag(name, on_remove, cell.is_editable());
  59697. tag_container.append(tag);
  59698. var tag_map = jQuery.data(tag_container, "tag_map") || {};
  59699. tag_map[name] = tag;
  59700. jQuery.data(tag_container, 'tag_map', tag_map);
  59701. }
  59702. };
  59703. };
  59704. var remove_tag = function(cell, tag_container) {
  59705. return function(name) {
  59706. var changed = write_tag(cell, name, false);
  59707. if (changed) {
  59708. // Remove tag UI
  59709. var tag_map = jQuery.data(tag_container, "tag_map") || {};
  59710. var tag_UI = tag_map[name];
  59711. delete tag_map[name];
  59712. tag_UI.remove();
  59713. }
  59714. };
  59715. };
  59716. var init_tag_container = function(cell, tag_container, on_remove) {
  59717. var tag_list = cell.metadata.tags || [];
  59718. if (!Array.isArray(tag_list)) {
  59719. // We cannot make tags UI for this cell!
  59720. // Maybe someone else used "tags" for something?
  59721. return false; // Fail gracefully
  59722. }
  59723. var tag_map = {};
  59724. for (var i=0; i < tag_list.length; ++i) {
  59725. var tag_name = tag_list[i];
  59726. if (typeof tag_name !== 'string') {
  59727. // Unexpected type, disable toolbar for safety
  59728. return false;
  59729. }
  59730. var tag = make_tag(tag_name, on_remove, cell.is_editable());
  59731. tag_container.append(tag);
  59732. tag_map[tag_name] = tag;
  59733. }
  59734. jQuery.data(tag_container, 'tag_map', tag_map);
  59735. return true;
  59736. };
  59737. var make_tag = function(name, on_remove, is_editable) {
  59738. var tag_UI = $('<span/>')
  59739. .addClass('cell-tag')
  59740. .text(name);
  59741. if(is_editable){
  59742. var remove_button = $('<i/>')
  59743. .addClass('remove-tag-btn')
  59744. .addClass('fa fa-times')
  59745. .click(function () {
  59746. on_remove(name);
  59747. return false;
  59748. });
  59749. tag_UI.append(remove_button);
  59750. }
  59751. return tag_UI;
  59752. };
  59753. // Single edit with button to add tags
  59754. var add_tag_edit = function(div, cell, on_add, on_remove) {
  59755. var button_container = $(div);
  59756. var text = $('<input/>').attr('type', 'text');
  59757. var button = $('<button />')
  59758. .addClass('btn btn-default btn-xs')
  59759. .text(i18n.msg._('Add tag'))
  59760. .click(function() {
  59761. var tags = preprocess_input(text[0].value);
  59762. for (var i=0; i < tags.length; ++i) {
  59763. on_add(tags[i]);
  59764. }
  59765. // Clear input after adding:
  59766. text[0].value = '';
  59767. return false;
  59768. });
  59769. // Wire enter in input to button click
  59770. text.keyup(function(event){
  59771. if(event.keyCode == 13){
  59772. button.click();
  59773. }
  59774. });
  59775. var input_container = $('<span/>')
  59776. .addClass('tags-input');
  59777. add_dialog_button(input_container, cell, on_add, on_remove);
  59778. button_container.append(input_container
  59779. .append(text)
  59780. .append(button)
  59781. );
  59782. IPython.keyboard_manager.register_events(text);
  59783. };
  59784. var tag_dialog = function(cell, on_add, on_remove) {
  59785. var tag_list = cell.metadata.tags || [];
  59786. var message =
  59787. i18n.msg._("Edit the list of tags below. All whitespace " +
  59788. "is treated as tag separators.");
  59789. var textarea = $('<textarea/>')
  59790. .attr('aria-label', i18n.msg._('Edit the tags in the text area'))
  59791. .attr('rows', '13')
  59792. .attr('cols', '80')
  59793. .attr('name', 'tags')
  59794. .text(tag_list.join('\n'));
  59795. var dialogform = $('<div/>').attr('title', i18n.msg._('Edit the tags'))
  59796. .append(
  59797. $('<form/>').append(
  59798. $('<fieldset/>').append(
  59799. $('<label/>')
  59800. .attr('for','tags')
  59801. .text(message)
  59802. )
  59803. .append($('<br/>'))
  59804. .append(textarea)
  59805. )
  59806. );
  59807. var modal_obj = dialog.modal({
  59808. title: i18n.msg._("Edit Tags"),
  59809. body: dialogform,
  59810. default_button: "Cancel",
  59811. buttons: {
  59812. Cancel: {},
  59813. Edit: { class : "btn-primary",
  59814. click: function() {
  59815. var old_tags = cell.metadata.tags || [];
  59816. var new_tags = preprocess_input(textarea[0].value);
  59817. var added_tags = array_difference(new_tags, old_tags);
  59818. var removed_tags = array_difference(old_tags, new_tags);
  59819. for (var i=0; i < added_tags.length; ++i) {
  59820. on_add(added_tags[i]);
  59821. }
  59822. for (var i=0; i < removed_tags.length; ++i) {
  59823. on_remove(removed_tags[i]);
  59824. }
  59825. }
  59826. }
  59827. },
  59828. notebook: cell.notebook,
  59829. keyboard_manager: cell.keyboard_manager,
  59830. });
  59831. };
  59832. var add_dialog_button = function(container, cell, on_add, on_remove) {
  59833. var button = $('<button />')
  59834. .addClass('btn btn-default btn-xs tags-dialog-btn')
  59835. .text('...')
  59836. .click( function() {
  59837. tag_dialog(cell, on_add, on_remove);
  59838. return false;
  59839. });
  59840. container.append(button);
  59841. };
  59842. var add_tags_cellbar = function(div, cell) {
  59843. var button_container = $(div);
  59844. button_container.addClass('tags_button_container');
  59845. var tag_container = $('<span/>').
  59846. addClass('tag-container');
  59847. var on_remove = remove_tag(cell, tag_container);
  59848. var ok = init_tag_container(cell, tag_container, on_remove);
  59849. if (!ok) {
  59850. return;
  59851. }
  59852. button_container.append(tag_container);
  59853. var on_add = add_tag(cell, tag_container, on_remove);
  59854. if(cell.is_editable()){
  59855. add_tag_edit(div, cell, on_add, on_remove);
  59856. }
  59857. };
  59858. var register = function(notebook) {
  59859. CellToolbar.register_callback('tags.edit', add_tags_cellbar);
  59860. var tags_preset = [];
  59861. tags_preset.push('tags.edit');
  59862. CellToolbar.register_preset('Tags', tags_preset, notebook);
  59863. };
  59864. return {'register' : register};
  59865. });
  59866. // Copyright (c) Jupyter Development Team.
  59867. // Distributed under the terms of the Modified BSD License.
  59868. define('notebook/js/scrollmanager',['jquery'], function($) {
  59869. "use strict";
  59870. var ScrollManager = function(notebook, options) {
  59871. /**
  59872. * Public constructor.
  59873. */
  59874. this.notebook = notebook;
  59875. this.element = $('#site');
  59876. options = options || {};
  59877. this.animation_speed = options.animation_speed || 250; //ms
  59878. };
  59879. ScrollManager.prototype.onScroll = function (func, rate) {
  59880. /**
  59881. * Register a function to be called when the page is scrolled, throttled
  59882. * at a particular rate limit.
  59883. */
  59884. rate = rate || 100; // default rate limit
  59885. this.element.scroll(function () {
  59886. clearTimeout(func._timeout);
  59887. func._timeout = setTimeout(func, rate);
  59888. });
  59889. };
  59890. ScrollManager.prototype.scroll = function (delta) {
  59891. /**
  59892. * Scroll the document.
  59893. *
  59894. * Parameters
  59895. * ----------
  59896. * delta: integer
  59897. * direction to scroll the document. Positive is downwards.
  59898. * Unit is one page length.
  59899. */
  59900. this.scroll_some(delta);
  59901. return false;
  59902. };
  59903. ScrollManager.prototype.scroll_to = function(selector) {
  59904. /**
  59905. * Scroll to an element in the notebook.
  59906. */
  59907. this.element.animate({'scrollTop': $(selector).offset().top + this.element.scrollTop() - this.element.offset().top}, this.animation_speed);
  59908. };
  59909. ScrollManager.prototype.scroll_some = function(pages) {
  59910. /**
  59911. * Scroll up or down a given number of pages.
  59912. *
  59913. * Parameters
  59914. * ----------
  59915. * pages: integer
  59916. * number of pages to scroll the document, may be positive or negative.
  59917. */
  59918. this.element.animate({'scrollTop': this.element.scrollTop() + pages * this.element.height()}, this.animation_speed);
  59919. };
  59920. ScrollManager.prototype.get_first_visible_cell = function() {
  59921. /**
  59922. * Gets the index of the first visible cell in the document.
  59923. *
  59924. * First, attempt to be smart by guessing the index of the cell we are
  59925. * scrolled to. Then, walk from there up or down until the right cell
  59926. * is found. To guess the index, get the top of the last cell, and
  59927. * divide that by the number of cells to get an average cell height.
  59928. * Then divide the scroll height by the average cell height.
  59929. */
  59930. var cell_count = this.notebook.ncells();
  59931. var first_cell_top = this.notebook.get_cell(0).element.offset().top;
  59932. var last_cell_top = this.notebook.get_cell(cell_count-1).element.offset().top;
  59933. var avg_cell_height = (last_cell_top - first_cell_top) / cell_count;
  59934. var i = Math.ceil(this.element.scrollTop() / avg_cell_height);
  59935. i = Math.min(Math.max(i , 0), cell_count - 1);
  59936. while (this.notebook.get_cell(i).element.offset().top - first_cell_top < this.element.scrollTop() && i < cell_count - 1) {
  59937. i += 1;
  59938. }
  59939. while (this.notebook.get_cell(i).element.offset().top - first_cell_top > this.element.scrollTop() - 50 && i >= 0) {
  59940. i -= 1;
  59941. }
  59942. return Math.min(i + 1, cell_count - 1);
  59943. };
  59944. ScrollManager.prototype.is_cell_visible = function (cell) {
  59945. var cell_rect = cell.element[0].getBoundingClientRect();
  59946. var scroll_rect = this.element[0].getBoundingClientRect();
  59947. return ((cell_rect.top <= scroll_rect.bottom) && (cell_rect.bottom >= scroll_rect.top));
  59948. };
  59949. var TargetScrollManager = function(notebook, options) {
  59950. /**
  59951. * Public constructor.
  59952. */
  59953. ScrollManager.apply(this, [notebook, options]);
  59954. };
  59955. TargetScrollManager.prototype = Object.create(ScrollManager.prototype);
  59956. TargetScrollManager.prototype.is_target = function (index) {
  59957. /**
  59958. * Check if a cell should be a scroll stop.
  59959. *
  59960. * Returns `true` if the cell is a cell that the scroll manager
  59961. * should scroll to. Otherwise, false is returned.
  59962. *
  59963. * Parameters
  59964. * ----------
  59965. * index: integer
  59966. * index of the cell to test.
  59967. */
  59968. return false;
  59969. };
  59970. TargetScrollManager.prototype.scroll = function (delta) {
  59971. /**
  59972. * Scroll the document.
  59973. *
  59974. * Parameters
  59975. * ----------
  59976. * delta: integer
  59977. * direction to scroll the document. Positive is downwards.
  59978. * Units are targets.
  59979. *
  59980. * Try to scroll to the next slide.
  59981. */
  59982. var cell_count = this.notebook.ncells();
  59983. var selected_index = this.get_first_visible_cell() + delta;
  59984. while (0 <= selected_index && selected_index < cell_count && !this.is_target(selected_index)) {
  59985. selected_index += delta;
  59986. }
  59987. if (selected_index < 0 || cell_count <= selected_index) {
  59988. return ScrollManager.prototype.scroll.apply(this, [delta]);
  59989. } else {
  59990. this.scroll_to(this.notebook.get_cell(selected_index).element);
  59991. // Cancel browser keyboard scroll.
  59992. return false;
  59993. }
  59994. };
  59995. var SlideScrollManager = function(notebook, options) {
  59996. /**
  59997. * Public constructor.
  59998. */
  59999. TargetScrollManager.apply(this, [notebook, options]);
  60000. };
  60001. SlideScrollManager.prototype = Object.create(TargetScrollManager.prototype);
  60002. SlideScrollManager.prototype.is_target = function (index) {
  60003. var cell = this.notebook.get_cell(index);
  60004. return cell.metadata && cell.metadata.slideshow &&
  60005. cell.metadata.slideshow.slide_type &&
  60006. (cell.metadata.slideshow.slide_type === "slide" ||
  60007. cell.metadata.slideshow.slide_type === "subslide");
  60008. };
  60009. var HeadingScrollManager = function(notebook, options) {
  60010. /**
  60011. * Public constructor.
  60012. */
  60013. ScrollManager.apply(this, [notebook, options]);
  60014. options = options || {};
  60015. this._level = options.heading_level || 1;
  60016. };
  60017. HeadingScrollManager.prototype = Object.create(ScrollManager.prototype);
  60018. HeadingScrollManager.prototype.scroll = function (delta) {
  60019. /**
  60020. * Scroll the document.
  60021. *
  60022. * Parameters
  60023. * ----------
  60024. * delta: integer
  60025. * direction to scroll the document. Positive is downwards.
  60026. * Units are headers.
  60027. *
  60028. * Get all of the header elements that match the heading level or are of
  60029. * greater magnitude (a smaller header number).
  60030. */
  60031. var headers = $();
  60032. var i;
  60033. for (i = 1; i <= this._level; i++) {
  60034. headers = headers.add('#notebook-container h' + i);
  60035. }
  60036. // Find the header the user is on or below.
  60037. var first_cell_top = this.notebook.get_cell(0).element.offset().top;
  60038. var current_scroll = this.element.scrollTop();
  60039. var header_scroll = 0;
  60040. i = -1;
  60041. while (current_scroll >= header_scroll && i < headers.length) {
  60042. if (++i < headers.length) {
  60043. header_scroll = $(headers[i]).offset().top - first_cell_top;
  60044. }
  60045. }
  60046. i--;
  60047. // Check if the user is below the header.
  60048. if (i < 0 || current_scroll > $(headers[i]).offset().top - first_cell_top + 30) {
  60049. // Below the header, count the header as a target.
  60050. if (delta < 0) {
  60051. delta += 1;
  60052. }
  60053. }
  60054. i += delta;
  60055. // Scroll!
  60056. if (0 <= i && i < headers.length) {
  60057. this.scroll_to(headers[i]);
  60058. return false;
  60059. } else {
  60060. // Default to the base's scroll behavior when target header doesn't
  60061. // exist.
  60062. return ScrollManager.prototype.scroll.apply(this, [delta]);
  60063. }
  60064. };
  60065. // Return namespace for require.js loads
  60066. return {
  60067. 'ScrollManager': ScrollManager,
  60068. 'SlideScrollManager': SlideScrollManager,
  60069. 'HeadingScrollManager': HeadingScrollManager,
  60070. 'TargetScrollManager': TargetScrollManager
  60071. };
  60072. });
  60073. /*!
  60074. * jQuery Typeahead
  60075. * Copyright (C) 2019 RunningCoder.org
  60076. * Licensed under the MIT license
  60077. *
  60078. * @author Tom Bertrand
  60079. * @version 2.10.7 (2019-10-19)
  60080. * @link http://www.runningcoder.org/jquerytypeahead/
  60081. */
  60082. !function(e){var t;"function"==typeof define&&define.amd?define("jquery-typeahead",["jquery"],function(t){return e(t)}):"object"==typeof module&&module.exports?module.exports=(void 0===t&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(void 0)),e(t)):e(jQuery)}(function(j){"use strict";function r(t,e){this.rawQuery=t.val()||"",this.query=t.val()||"",this.selector=t[0].selector,this.deferred=null,this.tmpSource={},this.source={},this.dynamicGroups=[],this.hasDynamicGroups=!1,this.generatedGroupCount=0,this.groupBy="group",this.groups=[],this.searchGroups=[],this.generateGroups=[],this.requestGroups=[],this.result=[],this.tmpResult={},this.groupTemplate="",this.resultHtml=null,this.resultCount=0,this.resultCountPerGroup={},this.options=e,this.node=t,this.namespace="."+this.helper.slugify.call(this,this.selector)+".typeahead",this.isContentEditable=void 0!==this.node.attr("contenteditable")&&"false"!==this.node.attr("contenteditable"),this.container=null,this.resultContainer=null,this.item=null,this.items=null,this.comparedItems=null,this.xhr={},this.hintIndex=null,this.filters={dropdown:{},dynamic:{}},this.dropdownFilter={static:[],dynamic:[]},this.dropdownFilterAll=null,this.isDropdownEvent=!1,this.requests={},this.backdrop={},this.hint={},this.label={},this.hasDragged=!1,this.focusOnly=!1,this.displayEmptyTemplate,this.__construct()}var i,s={input:null,minLength:2,maxLength:!(window.Typeahead={version:"2.10.7"}),maxItem:8,dynamic:!1,delay:300,order:null,offset:!1,hint:!1,accent:!1,highlight:!0,multiselect:null,group:!1,groupOrder:null,maxItemPerGroup:null,dropdownFilter:!1,dynamicFilter:null,backdrop:!1,backdropOnFocus:!1,cache:!1,ttl:36e5,compression:!1,searchOnFocus:!1,blurOnTab:!0,resultContainer:null,generateOnLoad:null,mustSelectItem:!1,href:null,display:["display"],template:null,templateValue:null,groupTemplate:null,correlativeTemplate:!1,emptyTemplate:!1,cancelButton:!0,loadingAnimation:!0,filter:!0,matcher:null,source:null,callback:{onInit:null,onReady:null,onShowLayout:null,onHideLayout:null,onSearch:null,onResult:null,onLayoutBuiltBefore:null,onLayoutBuiltAfter:null,onNavigateBefore:null,onNavigateAfter:null,onEnter:null,onLeave:null,onClickBefore:null,onClickAfter:null,onDropdownFilter:null,onSendRequest:null,onReceiveRequest:null,onPopulateSource:null,onCacheSave:null,onSubmit:null,onCancel:null},selector:{container:"typeahead__container",result:"typeahead__result",list:"typeahead__list",group:"typeahead__group",item:"typeahead__item",empty:"typeahead__empty",display:"typeahead__display",query:"typeahead__query",filter:"typeahead__filter",filterButton:"typeahead__filter-button",dropdown:"typeahead__dropdown",dropdownItem:"typeahead__dropdown-item",labelContainer:"typeahead__label-container",label:"typeahead__label",button:"typeahead__button",backdrop:"typeahead__backdrop",hint:"typeahead__hint",cancelButton:"typeahead__cancel-button"},debug:!1},o={from:"ãàáäâẽèéëêìíïîõòóöôùúüûñç",to:"aaaaaeeeeeiiiiooooouuuunc"},n=~window.navigator.appVersion.indexOf("MSIE 9."),a=~window.navigator.appVersion.indexOf("MSIE 10"),l=!!~window.navigator.userAgent.indexOf("Trident")&&~window.navigator.userAgent.indexOf("rv:11");r.prototype={_validateCacheMethod:function(t){var e;if(!0===t)t="localStorage";else if("string"==typeof t&&!~["localStorage","sessionStorage"].indexOf(t))return!1;e=void 0!==window[t];try{window[t].setItem("typeahead","typeahead"),window[t].removeItem("typeahead")}catch(t){e=!1}return e&&t||!1},extendOptions:function(){if(this.options.cache=this._validateCacheMethod(this.options.cache),this.options.compression&&("object"==typeof LZString&&this.options.cache||(this.options.compression=!1)),this.options.maxLength&&!isNaN(this.options.maxLength)||(this.options.maxLength=1/0),void 0!==this.options.maxItem&&~[0,!1].indexOf(this.options.maxItem)&&(this.options.maxItem=1/0),this.options.maxItemPerGroup&&!/^\d+$/.test(this.options.maxItemPerGroup)&&(this.options.maxItemPerGroup=null),this.options.display&&!Array.isArray(this.options.display)&&(this.options.display=[this.options.display]),this.options.multiselect&&(this.items=[],this.comparedItems=[],"string"==typeof this.options.multiselect.matchOn&&(this.options.multiselect.matchOn=[this.options.multiselect.matchOn])),this.options.group&&(Array.isArray(this.options.group)||("string"==typeof this.options.group?this.options.group={key:this.options.group}:"boolean"==typeof this.options.group&&(this.options.group={key:"group"}),this.options.group.key=this.options.group.key||"group")),this.options.highlight&&!~["any",!0].indexOf(this.options.highlight)&&(this.options.highlight=!1),this.options.dropdownFilter&&this.options.dropdownFilter instanceof Object){Array.isArray(this.options.dropdownFilter)||(this.options.dropdownFilter=[this.options.dropdownFilter]);for(var t=0,e=this.options.dropdownFilter.length;t<e;++t)this.dropdownFilter[this.options.dropdownFilter[t].value?"static":"dynamic"].push(this.options.dropdownFilter[t])}this.options.dynamicFilter&&!Array.isArray(this.options.dynamicFilter)&&(this.options.dynamicFilter=[this.options.dynamicFilter]),this.options.accent&&("object"==typeof this.options.accent?this.options.accent.from&&this.options.accent.to&&(this.options.accent.from.length,this.options.accent.to.length):this.options.accent=o),this.options.groupTemplate&&(this.groupTemplate=this.options.groupTemplate),this.options.resultContainer&&("string"==typeof this.options.resultContainer&&(this.options.resultContainer=j(this.options.resultContainer)),this.options.resultContainer instanceof j&&this.options.resultContainer[0]&&(this.resultContainer=this.options.resultContainer)),this.options.group&&this.options.group.key&&(this.groupBy=this.options.group.key),this.options.callback&&this.options.callback.onClick&&(this.options.callback.onClickBefore=this.options.callback.onClick,delete this.options.callback.onClick),this.options.callback&&this.options.callback.onNavigate&&(this.options.callback.onNavigateBefore=this.options.callback.onNavigate,delete this.options.callback.onNavigate),this.options=j.extend(!0,{},s,this.options)},unifySourceFormat:function(){var t,e,i;for(t in this.dynamicGroups=[],Array.isArray(this.options.source)&&(this.options.source={group:{data:this.options.source}}),"string"==typeof this.options.source&&(this.options.source={group:{ajax:{url:this.options.source}}}),this.options.source.ajax&&(this.options.source={group:{ajax:this.options.source.ajax}}),(this.options.source.url||this.options.source.data)&&(this.options.source={group:this.options.source}),this.options.source)if(this.options.source.hasOwnProperty(t)){if("string"==typeof(e=this.options.source[t])&&(e={ajax:{url:e}}),i=e.url||e.ajax,Array.isArray(i)?(e.ajax="string"==typeof i[0]?{url:i[0]}:i[0],e.ajax.path=e.ajax.path||i[1]||null):"object"==typeof e.url?e.ajax=e.url:"string"==typeof e.url&&(e.ajax={url:e.url}),delete e.url,!e.data&&!e.ajax)return!1;e.display&&!Array.isArray(e.display)&&(e.display=[e.display]),e.minLength="number"==typeof e.minLength?e.minLength:this.options.minLength,e.maxLength="number"==typeof e.maxLength?e.maxLength:this.options.maxLength,e.dynamic="boolean"==typeof e.dynamic||this.options.dynamic,e.minLength>e.maxLength&&(e.minLength=e.maxLength),this.options.source[t]=e,this.options.source[t].dynamic&&this.dynamicGroups.push(t),e.cache=void 0!==e.cache?this._validateCacheMethod(e.cache):this.options.cache,e.compression&&("object"==typeof LZString&&e.cache||(e.compression=!1))}return this.hasDynamicGroups=this.options.dynamic||!!this.dynamicGroups.length,!0},init:function(){this.helper.executeCallback.call(this,this.options.callback.onInit,[this.node]),this.container=this.node.closest("."+this.options.selector.container)},delegateEvents:function(){var i=this,t=["focus"+this.namespace,"input"+this.namespace,"propertychange"+this.namespace,"keydown"+this.namespace,"keyup"+this.namespace,"search"+this.namespace,"generate"+this.namespace];j("html").on("touchmove",function(){i.hasDragged=!0}).on("touchstart",function(){i.hasDragged=!1}),this.node.closest("form").on("submit",function(t){if(!i.options.mustSelectItem||!i.helper.isEmpty(i.item))return i.options.backdropOnFocus||i.hideLayout(),i.options.callback.onSubmit?i.helper.executeCallback.call(i,i.options.callback.onSubmit,[i.node,this,i.item||i.items,t]):void 0;t.preventDefault()}).on("reset",function(){setTimeout(function(){i.node.trigger("input"+i.namespace),i.hideLayout()})});var s=!1;if(this.node.attr("placeholder")&&(a||l)){var e=!0;this.node.on("focusin focusout",function(){e=!(this.value||!this.placeholder)}),this.node.on("input",function(t){e&&(t.stopImmediatePropagation(),e=!1)})}this.node.off(this.namespace).on(t.join(" "),function(t,e){switch(t.type){case"generate":i.generateSource(Object.keys(i.options.source));break;case"focus":if(i.focusOnly){i.focusOnly=!1;break}i.options.backdropOnFocus&&(i.buildBackdropLayout(),i.showLayout()),i.options.searchOnFocus&&!i.item&&(i.deferred=j.Deferred(),i.assignQuery(),i.generateSource());break;case"keydown":8===t.keyCode&&i.options.multiselect&&i.options.multiselect.cancelOnBackspace&&""===i.query&&i.items.length?i.cancelMultiselectItem(i.items.length-1,null,t):t.keyCode&&~[9,13,27,38,39,40].indexOf(t.keyCode)&&(s=!0,i.navigate(t));break;case"keyup":n&&i.node[0].value.replace(/^\s+/,"").toString().length<i.query.length&&i.node.trigger("input"+i.namespace);break;case"propertychange":if(s){s=!1;break}case"input":i.deferred=j.Deferred(),i.assignQuery(),""===i.rawQuery&&""===i.query&&(t.originalEvent=e||{},i.helper.executeCallback.call(i,i.options.callback.onCancel,[i.node,i.item,t]),i.item=null),i.options.cancelButton&&i.toggleCancelButtonVisibility(),i.options.hint&&i.hint.container&&""!==i.hint.container.val()&&0!==i.hint.container.val().indexOf(i.rawQuery)&&(i.hint.container.val(""),i.isContentEditable&&i.hint.container.text("")),i.hasDynamicGroups?i.helper.typeWatch(function(){i.generateSource()},i.options.delay):i.generateSource();break;case"search":i.searchResult(),i.buildLayout(),i.result.length||i.searchGroups.length&&i.displayEmptyTemplate?i.showLayout():i.hideLayout(),i.deferred&&i.deferred.resolve()}return i.deferred&&i.deferred.promise()}),this.options.generateOnLoad&&this.node.trigger("generate"+this.namespace)},assignQuery:function(){this.isContentEditable?this.rawQuery=this.node.text():this.rawQuery=this.node.val().toString(),this.rawQuery=this.rawQuery.replace(/^\s+/,""),this.rawQuery!==this.query&&(this.query=this.rawQuery)},filterGenerateSource:function(){if(this.searchGroups=[],this.generateGroups=[],!this.focusOnly||this.options.multiselect)for(var t in this.options.source)if(this.options.source.hasOwnProperty(t)&&this.query.length>=this.options.source[t].minLength&&this.query.length<=this.options.source[t].maxLength){if(this.filters.dropdown&&"group"===this.filters.dropdown.key&&this.filters.dropdown.value!==t)continue;if(this.searchGroups.push(t),!this.options.source[t].dynamic&&this.source[t])continue;this.generateGroups.push(t)}},generateSource:function(t){if(this.filterGenerateSource(),Array.isArray(t)&&t.length)this.generateGroups=t;else if(!this.generateGroups.length)return void this.node.trigger("search"+this.namespace);if(this.requestGroups=[],this.generatedGroupCount=0,this.options.loadingAnimation&&this.container.addClass("loading"),!this.helper.isEmpty(this.xhr)){for(var e in this.xhr)this.xhr.hasOwnProperty(e)&&this.xhr[e].abort();this.xhr={}}for(var i,s,o,n,r,a,l,h=this,c=(e=0,this.generateGroups.length);e<c;++e){if(i=this.generateGroups[e],n=(o=this.options.source[i]).cache,r=o.compression,n&&(a=window[n].getItem("TYPEAHEAD_"+this.selector+":"+i))){r&&(a=LZString.decompressFromUTF16(a)),l=!1;try{(a=JSON.parse(a+"")).data&&a.ttl>(new Date).getTime()?(this.populateSource(a.data,i),l=!0):window[n].removeItem("TYPEAHEAD_"+this.selector+":"+i)}catch(t){}if(l)continue}!o.data||o.ajax?o.ajax&&(this.requests[i]||(this.requests[i]=this.generateRequestObject(i)),this.requestGroups.push(i)):"function"==typeof o.data?(s=o.data.call(this),Array.isArray(s)?h.populateSource(s,i):"function"==typeof s.promise&&function(e){j.when(s).then(function(t){t&&Array.isArray(t)&&h.populateSource(t,e)})}(i)):this.populateSource(j.extend(!0,[],o.data),i)}return this.requestGroups.length&&this.handleRequests(),!!this.generateGroups.length},generateRequestObject:function(s){var o=this,n=this.options.source[s],t={request:{url:n.ajax.url||null,dataType:"json",beforeSend:function(t,e){o.xhr[s]=t;var i=o.requests[s].callback.beforeSend||n.ajax.beforeSend;"function"==typeof i&&i.apply(null,arguments)}},callback:{beforeSend:null,done:null,fail:null,then:null,always:null},extra:{path:n.ajax.path||null,group:s},validForGroup:[s]};if("function"!=typeof n.ajax&&(n.ajax instanceof Object&&(t=this.extendXhrObject(t,n.ajax)),1<Object.keys(this.options.source).length))for(var e in this.requests)this.requests.hasOwnProperty(e)&&(this.requests[e].isDuplicated||t.request.url&&t.request.url===this.requests[e].request.url&&(this.requests[e].validForGroup.push(s),t.isDuplicated=!0,delete t.validForGroup));return t},extendXhrObject:function(t,e){return"object"==typeof e.callback&&(t.callback=e.callback,delete e.callback),"function"==typeof e.beforeSend&&(t.callback.beforeSend=e.beforeSend,delete e.beforeSend),t.request=j.extend(!0,t.request,e),"jsonp"!==t.request.dataType.toLowerCase()||t.request.jsonpCallback||(t.request.jsonpCallback="callback_"+t.extra.group),t},handleRequests:function(){var t,h=this,c=this.requestGroups.length;if(!1!==this.helper.executeCallback.call(this,this.options.callback.onSendRequest,[this.node,this.query]))for(var e=0,i=this.requestGroups.length;e<i;++e)t=this.requestGroups[e],this.requests[t].isDuplicated||function(t,r){if("function"==typeof h.options.source[t].ajax){var e=h.options.source[t].ajax.call(h,h.query);if("object"!=typeof(r=h.extendXhrObject(h.generateRequestObject(t),"object"==typeof e?e:{})).request||!r.request.url)return h.populateSource([],t);h.requests[t]=r}var a,i=!1,l={};if(~r.request.url.indexOf("{{query}}")&&(i||(r=j.extend(!0,{},r),i=!0),r.request.url=r.request.url.replace("{{query}}",encodeURIComponent(h.query))),r.request.data)for(var s in r.request.data)if(r.request.data.hasOwnProperty(s)&&~String(r.request.data[s]).indexOf("{{query}}")){i||(r=j.extend(!0,{},r),i=!0),r.request.data[s]=r.request.data[s].replace("{{query}}",h.query);break}j.ajax(r.request).done(function(t,e,i){for(var s,o=0,n=r.validForGroup.length;o<n;o++)s=r.validForGroup[o],"function"==typeof(a=h.requests[s]).callback.done&&(l[s]=a.callback.done.call(h,t,e,i))}).fail(function(t,e,i){for(var s=0,o=r.validForGroup.length;s<o;s++)(a=h.requests[r.validForGroup[s]]).callback.fail instanceof Function&&a.callback.fail.call(h,t,e,i)}).always(function(t,e,i){for(var s,o=0,n=r.validForGroup.length;o<n;o++){if(s=r.validForGroup[o],(a=h.requests[s]).callback.always instanceof Function&&a.callback.always.call(h,t,e,i),"abort"===e)return;h.populateSource(null!==t&&"function"==typeof t.promise&&[]||l[s]||t,a.extra.group,a.extra.path||a.request.path),0===(c-=1)&&h.helper.executeCallback.call(h,h.options.callback.onReceiveRequest,[h.node,h.query])}}).then(function(t,e){for(var i=0,s=r.validForGroup.length;i<s;i++)(a=h.requests[r.validForGroup[i]]).callback.then instanceof Function&&a.callback.then.call(h,t,e)})}(t,this.requests[t])},populateSource:function(i,t,e){var s=this,o=this.options.source[t],n=o.ajax&&o.data;e&&"string"==typeof e&&(i=this.helper.namespace.call(this,e,i)),Array.isArray(i)||(i=[]),n&&("function"==typeof n&&(n=n()),Array.isArray(n)&&(i=i.concat(n)));for(var r,a=o.display?"compiled"===o.display[0]?o.display[1]:o.display[0]:"compiled"===this.options.display[0]?this.options.display[1]:this.options.display[0],l=0,h=i.length;l<h;l++)null!==i[l]&&"boolean"!=typeof i[l]&&("string"==typeof i[l]&&((r={})[a]=i[l],i[l]=r),i[l].group=t);if(!this.hasDynamicGroups&&this.dropdownFilter.dynamic.length){var c,p,u={};for(l=0,h=i.length;l<h;l++)for(var d=0,f=this.dropdownFilter.dynamic.length;d<f;d++)c=this.dropdownFilter.dynamic[d].key,(p=i[l][c])&&(this.dropdownFilter.dynamic[d].value||(this.dropdownFilter.dynamic[d].value=[]),u[c]||(u[c]=[]),~u[c].indexOf(p.toLowerCase())||(u[c].push(p.toLowerCase()),this.dropdownFilter.dynamic[d].value.push(p)))}if(this.options.correlativeTemplate){var m=o.template||this.options.template,g="";if("function"==typeof m&&(m=m.call(this,"",{})),m){if(Array.isArray(this.options.correlativeTemplate))for(l=0,h=this.options.correlativeTemplate.length;l<h;l++)g+="{{"+this.options.correlativeTemplate[l]+"}} ";else g=m.replace(/<.+?>/g," ").replace(/\s{2,}/," ").trim();for(l=0,h=i.length;l<h;l++)i[l].compiled=j("<textarea />").html(g.replace(/\{\{([\w\-\.]+)(?:\|(\w+))?}}/g,function(t,e){return s.helper.namespace.call(s,e,i[l],"get","")}).trim()).text();o.display?~o.display.indexOf("compiled")||o.display.unshift("compiled"):~this.options.display.indexOf("compiled")||this.options.display.unshift("compiled")}else;}this.options.callback.onPopulateSource&&(i=this.helper.executeCallback.call(this,this.options.callback.onPopulateSource,[this.node,i,t,e])),this.tmpSource[t]=Array.isArray(i)&&i||[];var y=this.options.source[t].cache,v=this.options.source[t].compression,b=this.options.source[t].ttl||this.options.ttl;if(y&&!window[y].getItem("TYPEAHEAD_"+this.selector+":"+t)){this.options.callback.onCacheSave&&(i=this.helper.executeCallback.call(this,this.options.callback.onCacheSave,[this.node,i,t,e]));var k=JSON.stringify({data:i,ttl:(new Date).getTime()+b});v&&(k=LZString.compressToUTF16(k)),window[y].setItem("TYPEAHEAD_"+this.selector+":"+t,k)}this.incrementGeneratedGroup()},incrementGeneratedGroup:function(){if(this.generatedGroupCount++,this.generatedGroupCount===this.generateGroups.length){this.xhr={};for(var t=0,e=this.generateGroups.length;t<e;t++)this.source[this.generateGroups[t]]=this.tmpSource[this.generateGroups[t]];this.hasDynamicGroups||this.buildDropdownItemLayout("dynamic"),this.options.loadingAnimation&&this.container.removeClass("loading"),this.node.trigger("search"+this.namespace)}},navigate:function(t){if(this.helper.executeCallback.call(this,this.options.callback.onNavigateBefore,[this.node,this.query,t]),27===t.keyCode)return t.preventDefault(),void(this.query.length?(this.resetInput(),this.node.trigger("input"+this.namespace,[t])):(this.node.blur(),this.hideLayout()));if(this.result.length){var e,i=this.resultContainer.find("."+this.options.selector.item).not("[disabled]"),s=i.filter(".active"),o=s[0]?i.index(s):null,n=s[0]?s.attr("data-index"):null,r=null;if(this.clearActiveItem(),this.helper.executeCallback.call(this,this.options.callback.onLeave,[this.node,null!==o&&i.eq(o)||void 0,null!==n&&this.result[n]||void 0,t]),13===t.keyCode)return t.preventDefault(),void(0<s.length?"javascript:;"===s.find("a:first")[0].href?s.find("a:first").trigger("click",t):s.find("a:first")[0].click():this.node.closest("form").trigger("submit"));if(39!==t.keyCode){9===t.keyCode?this.options.blurOnTab?this.hideLayout():0<s.length?o+1<i.length?(t.preventDefault(),r=o+1,this.addActiveItem(i.eq(r))):this.hideLayout():i.length?(t.preventDefault(),r=0,this.addActiveItem(i.first())):this.hideLayout():38===t.keyCode?(t.preventDefault(),0<s.length?0<=o-1&&(r=o-1,this.addActiveItem(i.eq(r))):i.length&&(r=i.length-1,this.addActiveItem(i.last()))):40===t.keyCode&&(t.preventDefault(),0<s.length?o+1<i.length&&(r=o+1,this.addActiveItem(i.eq(r))):i.length&&(r=0,this.addActiveItem(i.first()))),e=null!==r?i.eq(r).attr("data-index"):null,this.helper.executeCallback.call(this,this.options.callback.onEnter,[this.node,null!==r&&i.eq(r)||void 0,null!==e&&this.result[e]||void 0,t]),t.preventInputChange&&~[38,40].indexOf(t.keyCode)&&this.buildHintLayout(null!==e&&e<this.result.length?[this.result[e]]:null),this.options.hint&&this.hint.container&&this.hint.container.css("color",t.preventInputChange?this.hint.css.color:null===e&&this.hint.css.color||this.hint.container.css("background-color")||"fff");var a=null===e||t.preventInputChange?this.rawQuery:this.getTemplateValue.call(this,this.result[e]);this.node.val(a),this.isContentEditable&&this.node.text(a),this.helper.executeCallback.call(this,this.options.callback.onNavigateAfter,[this.node,i,null!==r&&i.eq(r).find("a:first")||void 0,null!==e&&this.result[e]||void 0,this.query,t])}else null!==o?i.eq(o).find("a:first")[0].click():this.options.hint&&""!==this.hint.container.val()&&this.helper.getCaret(this.node[0])>=this.query.length&&i.filter('[data-index="'+this.hintIndex+'"]').find("a:first")[0].click()}},getTemplateValue:function(i){if(i){var t=i.group&&this.options.source[i.group].templateValue||this.options.templateValue;if("function"==typeof t&&(t=t.call(this)),!t)return this.helper.namespace.call(this,i.matchedKey,i).toString();var s=this;return t.replace(/\{\{([\w\-.]+)}}/gi,function(t,e){return s.helper.namespace.call(s,e,i,"get","")})}},clearActiveItem:function(){this.resultContainer.find("."+this.options.selector.item).removeClass("active")},addActiveItem:function(t){t.addClass("active")},searchResult:function(){this.resetLayout(),!1!==this.helper.executeCallback.call(this,this.options.callback.onSearch,[this.node,this.query])&&(!this.searchGroups.length||this.options.multiselect&&this.options.multiselect.limit&&this.items.length>=this.options.multiselect.limit||this.searchResultData(),this.helper.executeCallback.call(this,this.options.callback.onResult,[this.node,this.query,this.result,this.resultCount,this.resultCountPerGroup]),this.isDropdownEvent&&(this.helper.executeCallback.call(this,this.options.callback.onDropdownFilter,[this.node,this.query,this.filters.dropdown,this.result]),this.isDropdownEvent=!1))},searchResultData:function(){var t,e,i,s,o,n,r,a,l,h,c,p=this.groupBy,u=null,d=this.query.toLowerCase(),f=this.options.maxItem,m=this.options.maxItemPerGroup,g=this.filters.dynamic&&!this.helper.isEmpty(this.filters.dynamic),y="function"==typeof this.options.matcher&&this.options.matcher;this.options.accent&&(d=this.helper.removeAccent.call(this,d));for(var v=0,b=this.searchGroups.length;v<b;++v)if(F=this.searchGroups[v],!this.filters.dropdown||"group"!==this.filters.dropdown.key||this.filters.dropdown.value===F){o=void 0!==this.options.source[F].filter?this.options.source[F].filter:this.options.filter,r="function"==typeof this.options.source[F].matcher&&this.options.source[F].matcher||y;for(var k=0,w=this.source[F].length;k<w&&(!(this.resultItemCount>=f)||this.options.callback.onResult);k++)if((!g||this.dynamicFilter.validate.apply(this,[this.source[F][k]]))&&null!==(t=this.source[F][k])&&"boolean"!=typeof t&&(!this.options.multiselect||this.isMultiselectUniqueData(t))&&(!this.filters.dropdown||(t[this.filters.dropdown.key]||"").toLowerCase()===(this.filters.dropdown.value||"").toLowerCase())){if((u="group"===p?F:t[p]?t[p]:t.group)&&!this.tmpResult[u]&&(this.tmpResult[u]=[],this.resultCountPerGroup[u]=0),m&&"group"===p&&this.tmpResult[u].length>=m&&!this.options.callback.onResult)break;for(var x=0,C=(S=this.options.source[F].display||this.options.display).length;x<C;++x){if(!1!==o){if(void 0===(s=/\./.test(S[x])?this.helper.namespace.call(this,S[x],t):t[S[x]])||""===s)continue;s=this.helper.cleanStringFromScript(s)}if("function"==typeof o){if(void 0===(n=o.call(this,t,s)))break;if(!n)continue;"object"==typeof n&&(t=n)}if(~[void 0,!0].indexOf(o)){if(null===s)continue;if(i=(i=s).toString().toLowerCase(),this.options.accent&&(i=this.helper.removeAccent.call(this,i)),e=i.indexOf(d),this.options.correlativeTemplate&&"compiled"===S[x]&&e<0&&/\s/.test(d)){l=!0,c=i;for(var q=0,A=(h=d.split(" ")).length;q<A;q++)if(""!==h[q]){if(!~c.indexOf(h[q])){l=!1;break}c=c.replace(h[q],"")}}if(e<0&&!l)continue;if(this.options.offset&&0!==e)continue;if(r){if(void 0===(a=r.call(this,t,s)))break;if(!a)continue;"object"==typeof a&&(t=a)}}if(this.resultCount++,this.resultCountPerGroup[u]++,this.resultItemCount<f){if(m&&this.tmpResult[u].length>=m)break;this.tmpResult[u].push(j.extend(!0,{matchedKey:S[x]},t)),this.resultItemCount++}break}if(!this.options.callback.onResult){if(this.resultItemCount>=f)break;if(m&&this.tmpResult[u].length>=m&&"group"===p)break}}}if(this.options.order){var O,S=[];for(var F in this.tmpResult)if(this.tmpResult.hasOwnProperty(F)){for(v=0,b=this.tmpResult[F].length;v<b;v++)O=this.options.source[this.tmpResult[F][v].group].display||this.options.display,~S.indexOf(O[0])||S.push(O[0]);this.tmpResult[F].sort(this.helper.sort(S,"asc"===this.options.order,function(t){return t?t.toString().toUpperCase():""}))}}var L=[],I=[];for(v=0,b=(I="function"==typeof this.options.groupOrder?this.options.groupOrder.apply(this,[this.node,this.query,this.tmpResult,this.resultCount,this.resultCountPerGroup]):Array.isArray(this.options.groupOrder)?this.options.groupOrder:"string"==typeof this.options.groupOrder&&~["asc","desc"].indexOf(this.options.groupOrder)?Object.keys(this.tmpResult).sort(this.helper.sort([],"asc"===this.options.groupOrder,function(t){return t.toString().toUpperCase()})):Object.keys(this.tmpResult)).length;v<b;v++)L=L.concat(this.tmpResult[I[v]]||[]);this.groups=JSON.parse(JSON.stringify(I)),this.result=L},buildLayout:function(){this.buildHtmlLayout(),this.buildBackdropLayout(),this.buildHintLayout(),this.options.callback.onLayoutBuiltBefore&&(this.tmpResultHtml=this.helper.executeCallback.call(this,this.options.callback.onLayoutBuiltBefore,[this.node,this.query,this.result,this.resultHtml])),this.tmpResultHtml instanceof j?this.resultContainer.html(this.tmpResultHtml):this.resultHtml instanceof j&&this.resultContainer.html(this.resultHtml),this.options.callback.onLayoutBuiltAfter&&this.helper.executeCallback.call(this,this.options.callback.onLayoutBuiltAfter,[this.node,this.query,this.result])},buildHtmlLayout:function(){if(!1!==this.options.resultContainer){var h;if(this.resultContainer||(this.resultContainer=j("<div/>",{class:this.options.selector.result}),this.container.append(this.resultContainer)),!this.result.length)if(this.options.multiselect&&this.options.multiselect.limit&&this.items.length>=this.options.multiselect.limit)h=this.options.multiselect.limitTemplate?"function"==typeof this.options.multiselect.limitTemplate?this.options.multiselect.limitTemplate.call(this,this.query):this.options.multiselect.limitTemplate.replace(/\{\{query}}/gi,j("<div>").text(this.helper.cleanStringFromScript(this.query)).html()):"Can't select more than "+this.items.length+" items.";else{if(!this.options.emptyTemplate||""===this.query)return;h="function"==typeof this.options.emptyTemplate?this.options.emptyTemplate.call(this,this.query):this.options.emptyTemplate.replace(/\{\{query}}/gi,j("<div>").text(this.helper.cleanStringFromScript(this.query)).html())}this.displayEmptyTemplate=!!h;var o=this.query.toLowerCase();this.options.accent&&(o=this.helper.removeAccent.call(this,o));var c=this,t=this.groupTemplate||"<ul></ul>",p=!1;this.groupTemplate?t=j(t.replace(/<([^>]+)>\{\{(.+?)}}<\/[^>]+>/g,function(t,e,i,s,o){var n="",r="group"===i?c.groups:[i];if(!c.result.length)return!0===p?"":(p=!0,"<"+e+' class="'+c.options.selector.empty+'">'+h+"</"+e+">");for(var a=0,l=r.length;a<l;++a)n+="<"+e+' data-group-template="'+r[a]+'"><ul></ul></'+e+">";return n})):(t=j(t),this.result.length||t.append(h instanceof j?h:'<li class="'+c.options.selector.empty+'">'+h+"</li>")),t.addClass(this.options.selector.list+(this.helper.isEmpty(this.result)?" empty":""));for(var e,i,n,s,r,a,l,u,d,f,m,g,y,v=this.groupTemplate&&this.result.length&&c.groups||[],b=0,k=this.result.length;b<k;++b)e=(n=this.result[b]).group,s=!this.options.multiselect&&this.options.source[n.group].href||this.options.href,u=[],d=this.options.source[n.group].display||this.options.display,this.options.group&&(e=n[this.options.group.key],this.options.group.template&&("function"==typeof this.options.group.template?i=this.options.group.template.call(this,n):"string"==typeof this.options.group.template&&(i=this.options.group.template.replace(/\{\{([\w\-\.]+)}}/gi,function(t,e){return c.helper.namespace.call(c,e,n,"get","")}))),t.find('[data-search-group="'+e+'"]')[0]||(this.groupTemplate?t.find('[data-group-template="'+e+'"] ul'):t).append(j("<li/>",{class:c.options.selector.group,html:j("<a/>",{href:"javascript:;",html:i||e,tabindex:-1}),"data-search-group":e}))),this.groupTemplate&&v.length&&~(m=v.indexOf(e||n.group))&&v.splice(m,1),r=j("<li/>",{class:c.options.selector.item+" "+c.options.selector.group+"-"+this.helper.slugify.call(this,e),disabled:!!n.disabled,"data-group":e,"data-index":b,html:j("<a/>",{href:s&&!n.disabled?(g=s,y=n,y.href=c.generateHref.call(c,g,y)):"javascript:;",html:function(){if(a=n.group&&c.options.source[n.group].template||c.options.template)"function"==typeof a&&(a=a.call(c,c.query,n)),l=a.replace(/\{\{([^\|}]+)(?:\|([^}]+))*}}/gi,function(t,e,i){var s=c.helper.cleanStringFromScript(String(c.helper.namespace.call(c,e,n,"get","")));return~(i=i&&i.split("|")||[]).indexOf("slugify")&&(s=c.helper.slugify.call(c,s)),~i.indexOf("raw")||!0===c.options.highlight&&o&&~d.indexOf(e)&&(s=c.helper.highlight.call(c,s,o.split(" "),c.options.accent)),s});else{for(var t=0,e=d.length;t<e;t++)void 0!==(f=/\./.test(d[t])?c.helper.namespace.call(c,d[t],n,"get",""):n[d[t]])&&""!==f&&u.push(f);l='<span class="'+c.options.selector.display+'">'+c.helper.cleanStringFromScript(String(u.join(" ")))+"</span>"}(!0===c.options.highlight&&o&&!a||"any"===c.options.highlight)&&(l=c.helper.highlight.call(c,l,o.split(" "),c.options.accent)),j(this).append(l)}})}),function(t,i,e){e.on("click",function(t,e){i.disabled?t.preventDefault():(e&&"object"==typeof e&&(t.originalEvent=e),c.options.mustSelectItem&&c.helper.isEmpty(i)?t.preventDefault():(c.options.multiselect||(c.item=i),!1!==c.helper.executeCallback.call(c,c.options.callback.onClickBefore,[c.node,j(this),i,t])&&(t.originalEvent&&t.originalEvent.defaultPrevented||t.isDefaultPrevented()||(c.options.multiselect?(c.query=c.rawQuery="",c.addMultiselectItemLayout(i)):(c.focusOnly=!0,c.query=c.rawQuery=c.getTemplateValue.call(c,i),c.isContentEditable&&(c.node.text(c.query),c.helper.setCaretAtEnd(c.node[0]))),c.hideLayout(),c.node.val(c.query).focus(),c.options.cancelButton&&c.toggleCancelButtonVisibility(),c.helper.executeCallback.call(c,c.options.callback.onClickAfter,[c.node,j(this),i,t])))))}),e.on("mouseenter",function(t){i.disabled||(c.clearActiveItem(),c.addActiveItem(j(this))),c.helper.executeCallback.call(c,c.options.callback.onEnter,[c.node,j(this),i,t])}),e.on("mouseleave",function(t){i.disabled||c.clearActiveItem(),c.helper.executeCallback.call(c,c.options.callback.onLeave,[c.node,j(this),i,t])})}(0,n,r),(this.groupTemplate?t.find('[data-group-template="'+e+'"] ul'):t).append(r);if(this.result.length&&v.length)for(b=0,k=v.length;b<k;++b)t.find('[data-group-template="'+v[b]+'"]').remove();this.resultHtml=t}},generateHref:function(t,o){var n=this;return"string"==typeof t?t=t.replace(/\{\{([^\|}]+)(?:\|([^}]+))*}}/gi,function(t,e,i){var s=n.helper.namespace.call(n,e,o,"get","");return~(i=i&&i.split("|")||[]).indexOf("slugify")&&(s=n.helper.slugify.call(n,s)),s}):"function"==typeof t&&(t=t.call(this,o)),t},getMultiselectComparedData:function(t){var e="";if(Array.isArray(this.options.multiselect.matchOn))for(var i=0,s=this.options.multiselect.matchOn.length;i<s;++i)e+=void 0!==t[this.options.multiselect.matchOn[i]]?t[this.options.multiselect.matchOn[i]]:"";else{var o=JSON.parse(JSON.stringify(t)),n=["group","matchedKey","compiled","href"];for(i=0,s=n.length;i<s;++i)delete o[n[i]];e=JSON.stringify(o)}return e},buildBackdropLayout:function(){this.options.backdrop&&(this.backdrop.container||(this.backdrop.css=j.extend({opacity:.6,filter:"alpha(opacity=60)",position:"fixed",top:0,right:0,bottom:0,left:0,"z-index":1040,"background-color":"#000"},this.options.backdrop),this.backdrop.container=j("<div/>",{class:this.options.selector.backdrop,css:this.backdrop.css}).insertAfter(this.container)),this.container.addClass("backdrop").css({"z-index":this.backdrop.css["z-index"]+1,position:"relative"}))},buildHintLayout:function(t){if(this.options.hint)if(this.node[0].scrollWidth>Math.ceil(this.node.innerWidth()))this.hint.container&&this.hint.container.val("");else{var e=this,i="",s=(t=t||this.result,this.query.toLowerCase());if(this.options.accent&&(s=this.helper.removeAccent.call(this,s)),this.hintIndex=null,this.searchGroups.length){if(this.hint.container||(this.hint.css=j.extend({"border-color":"transparent",position:"absolute",top:0,display:"inline","z-index":-1,float:"none",color:"silver","box-shadow":"none",cursor:"default","-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"},this.options.hint),this.hint.container=j("<"+this.node[0].nodeName+"/>",{type:this.node.attr("type"),class:this.node.attr("class"),readonly:!0,unselectable:"on","aria-hidden":"true",tabindex:-1,click:function(){e.node.focus()}}).addClass(this.options.selector.hint).css(this.hint.css).insertAfter(this.node),this.node.parent().css({position:"relative"})),this.hint.container.css("color",this.hint.css.color),s)for(var o,n,r,a=0,l=t.length;a<l;a++)if(!t[a].disabled){n=t[a].group;for(var h=0,c=(o=this.options.source[n].display||this.options.display).length;h<c;h++)if(r=String(t[a][o[h]]).toLowerCase(),this.options.accent&&(r=this.helper.removeAccent.call(this,r)),0===r.indexOf(s)){i=String(t[a][o[h]]),this.hintIndex=a;break}if(null!==this.hintIndex)break}var p=0<i.length&&this.rawQuery+i.substring(this.query.length)||"";this.hint.container.val(p),this.isContentEditable&&this.hint.container.text(p)}}},buildDropdownLayout:function(){if(this.options.dropdownFilter){var i=this;j("<span/>",{class:this.options.selector.filter,html:function(){j(this).append(j("<button/>",{type:"button",class:i.options.selector.filterButton,style:"display: none;",click:function(){i.container.toggleClass("filter");var e=i.namespace+"-dropdown-filter";j("html").off(e),i.container.hasClass("filter")&&j("html").on("click"+e+" touchend"+e,function(t){j(t.target).closest("."+i.options.selector.filter)[0]&&j(t.target).closest(i.container)[0]||i.hasDragged||(i.container.removeClass("filter"),j("html").off(e))})}})),j(this).append(j("<ul/>",{class:i.options.selector.dropdown}))}}).insertAfter(i.container.find("."+i.options.selector.query))}},buildDropdownItemLayout:function(t){if(this.options.dropdownFilter){var e,i,o=this,n="string"==typeof this.options.dropdownFilter&&this.options.dropdownFilter||"All",r=this.container.find("."+this.options.selector.dropdown);"static"!==t||!0!==this.options.dropdownFilter&&"string"!=typeof this.options.dropdownFilter||this.dropdownFilter.static.push({key:"group",template:"{{group}}",all:n,value:Object.keys(this.options.source)});for(var s=0,a=this.dropdownFilter[t].length;s<a;s++){i=this.dropdownFilter[t][s],Array.isArray(i.value)||(i.value=[i.value]),i.all&&(this.dropdownFilterAll=i.all);for(var l=0,h=i.value.length;l<=h;l++)l===h&&s!==a-1||l===h&&s===a-1&&"static"===t&&this.dropdownFilter.dynamic.length||(e=this.dropdownFilterAll||n,i.value[l]?e=i.template?i.template.replace(new RegExp("{{"+i.key+"}}","gi"),i.value[l]):i.value[l]:this.container.find("."+o.options.selector.filterButton).html(e),function(e,i,s){r.append(j("<li/>",{class:o.options.selector.dropdownItem+" "+o.helper.slugify.call(o,i.key+"-"+(i.value[e]||n)),html:j("<a/>",{href:"javascript:;",html:s,click:function(t){t.preventDefault(),c.call(o,{key:i.key,value:i.value[e]||"*",template:s})}})}))}(l,i,e))}this.dropdownFilter[t].length&&this.container.find("."+o.options.selector.filterButton).removeAttr("style")}function c(t){"*"===t.value?delete this.filters.dropdown:this.filters.dropdown=t,this.container.removeClass("filter").find("."+this.options.selector.filterButton).html(t.template),this.isDropdownEvent=!0,this.node.trigger("input"+this.namespace),this.options.multiselect&&this.adjustInputSize(),this.node.focus()}},dynamicFilter:{isEnabled:!1,init:function(){this.options.dynamicFilter&&(this.dynamicFilter.bind.call(this),this.dynamicFilter.isEnabled=!0)},validate:function(t){var e,i,s=null,o=null;for(var n in this.filters.dynamic)if(this.filters.dynamic.hasOwnProperty(n)&&(i=~n.indexOf(".")?this.helper.namespace.call(this,n,t,"get"):t[n],"|"!==this.filters.dynamic[n].modifier||s||(s=i==this.filters.dynamic[n].value||!1),"&"===this.filters.dynamic[n].modifier)){if(i!=this.filters.dynamic[n].value){o=!1;break}o=!0}return e=s,null!==o&&!0===(e=o)&&null!==s&&(e=s),!!e},set:function(t,e){var i=t.match(/^([|&])?(.+)/);e?this.filters.dynamic[i[2]]={modifier:i[1]||"|",value:e}:delete this.filters.dynamic[i[2]],this.dynamicFilter.isEnabled&&this.generateSource()},bind:function(){for(var t,e=this,i=0,s=this.options.dynamicFilter.length;i<s;i++)"string"==typeof(t=this.options.dynamicFilter[i]).selector&&(t.selector=j(t.selector)),t.selector instanceof j&&t.selector[0]&&t.key&&function(t){t.selector.off(e.namespace).on("change"+e.namespace,function(){e.dynamicFilter.set.apply(e,[t.key,e.dynamicFilter.getValue(this)])}).trigger("change"+e.namespace)}(t)},getValue:function(t){var e;return"SELECT"===t.tagName?e=t.value:"INPUT"===t.tagName&&("checkbox"===t.type?e=t.checked&&t.getAttribute("value")||t.checked||null:"radio"===t.type&&t.checked&&(e=t.value)),e}},buildMultiselectLayout:function(){if(this.options.multiselect){var t,e=this;this.label.container=j("<span/>",{class:this.options.selector.labelContainer,"data-padding-left":parseFloat(this.node.css("padding-left"))||0,"data-padding-right":parseFloat(this.node.css("padding-right"))||0,"data-padding-top":parseFloat(this.node.css("padding-top"))||0,click:function(t){j(t.target).hasClass(e.options.selector.labelContainer)&&e.node.focus()}}),this.node.closest("."+this.options.selector.query).prepend(this.label.container),this.options.multiselect.data&&(Array.isArray(this.options.multiselect.data)?this.populateMultiselectData(this.options.multiselect.data):"function"==typeof this.options.multiselect.data&&(t=this.options.multiselect.data.call(this),Array.isArray(t)?this.populateMultiselectData(t):"function"==typeof t.promise&&j.when(t).then(function(t){t&&Array.isArray(t)&&e.populateMultiselectData(t)})))}},isMultiselectUniqueData:function(t){for(var e=!0,i=0,s=this.comparedItems.length;i<s;++i)if(this.comparedItems[i]===this.getMultiselectComparedData(t)){e=!1;break}return e},populateMultiselectData:function(t){for(var e=0,i=t.length;e<i;++e)this.addMultiselectItemLayout(t[e]);this.node.trigger("search"+this.namespace,{origin:"populateMultiselectData"})},addMultiselectItemLayout:function(t){if(this.isMultiselectUniqueData(t)){this.items.push(t),this.comparedItems.push(this.getMultiselectComparedData(t));var e,i=this.getTemplateValue(t),s=this,o=this.options.multiselect.href?"a":"span",n=j("<span/>",{class:this.options.selector.label,html:j("<"+o+"/>",{text:i,click:function(t){var e=j(this).closest("."+s.options.selector.label),i=s.label.container.find("."+s.options.selector.label).index(e);s.options.multiselect.callback&&s.helper.executeCallback.call(s,s.options.multiselect.callback.onClick,[s.node,s.items[i],t])},href:this.options.multiselect.href?(e=s.items[s.items.length-1],s.generateHref.call(s,s.options.multiselect.href,e)):null})});return n.append(j("<span/>",{class:this.options.selector.cancelButton,html:"×",click:function(t){var e=j(this).closest("."+s.options.selector.label),i=s.label.container.find("."+s.options.selector.label).index(e);s.cancelMultiselectItem(i,e,t)}})),this.label.container.append(n),this.adjustInputSize(),!0}},cancelMultiselectItem:function(t,e,i){var s=this.items[t];(e=e||this.label.container.find("."+this.options.selector.label).eq(t)).remove(),this.items.splice(t,1),this.comparedItems.splice(t,1),this.options.multiselect.callback&&this.helper.executeCallback.call(this,this.options.multiselect.callback.onCancel,[this.node,s,i]),this.adjustInputSize(),this.focusOnly=!0,this.node.focus().trigger("input"+this.namespace,{origin:"cancelMultiselectItem"})},adjustInputSize:function(){var i=this.node[0].getBoundingClientRect().width-(parseFloat(this.label.container.data("padding-right"))||0)-(parseFloat(this.label.container.css("padding-left"))||0),s=0,o=0,n=0,r=!1,a=0;this.label.container.find("."+this.options.selector.label).filter(function(t,e){0===t&&(a=j(e)[0].getBoundingClientRect().height+parseFloat(j(e).css("margin-bottom")||0)),s=j(e)[0].getBoundingClientRect().width+parseFloat(j(e).css("margin-right")||0),.7*i<n+s&&!r&&(o++,r=!0),n+s<i?n+=s:(r=!1,n=s)});var t=parseFloat(this.label.container.data("padding-left")||0)+(r?0:n),e=o*a+parseFloat(this.label.container.data("padding-top")||0);this.container.find("."+this.options.selector.query).find("input, textarea, [contenteditable], .typeahead__hint").css({paddingLeft:t,paddingTop:e})},showLayout:function(){!this.container.hasClass("result")&&(this.result.length||this.displayEmptyTemplate||this.options.backdropOnFocus)&&(function(){var e=this;j("html").off("keydown"+this.namespace).on("keydown"+this.namespace,function(t){t.keyCode&&9===t.keyCode&&setTimeout(function(){j(":focus").closest(e.container).find(e.node)[0]||e.hideLayout()},0)}),j("html").off("click"+this.namespace+" touchend"+this.namespace).on("click"+this.namespace+" touchend"+this.namespace,function(t){j(t.target).closest(e.container)[0]||j(t.target).closest("."+e.options.selector.item)[0]||t.target.className===e.options.selector.cancelButton||e.hasDragged||e.hideLayout()})}.call(this),this.container.addClass([this.result.length||this.searchGroups.length&&this.displayEmptyTemplate?"result ":"",this.options.hint&&this.searchGroups.length?"hint":"",this.options.backdrop||this.options.backdropOnFocus?"backdrop":""].join(" ")),this.helper.executeCallback.call(this,this.options.callback.onShowLayout,[this.node,this.query]))},hideLayout:function(){(this.container.hasClass("result")||this.container.hasClass("backdrop"))&&(this.container.removeClass("result hint filter"+(this.options.backdropOnFocus&&j(this.node).is(":focus")?"":" backdrop")),this.options.backdropOnFocus&&this.container.hasClass("backdrop")||(j("html").off(this.namespace),this.helper.executeCallback.call(this,this.options.callback.onHideLayout,[this.node,this.query])))},resetLayout:function(){this.result=[],this.tmpResult={},this.groups=[],this.resultCount=0,this.resultCountPerGroup={},this.resultItemCount=0,this.resultHtml=null,this.options.hint&&this.hint.container&&(this.hint.container.val(""),this.isContentEditable&&this.hint.container.text(""))},resetInput:function(){this.node.val(""),this.isContentEditable&&this.node.text(""),this.query="",this.rawQuery=""},buildCancelButtonLayout:function(){if(this.options.cancelButton){var e=this;j("<span/>",{class:this.options.selector.cancelButton,html:"×",mousedown:function(t){t.stopImmediatePropagation(),t.preventDefault(),e.resetInput(),e.node.trigger("input"+e.namespace,[t])}}).insertBefore(this.node)}},toggleCancelButtonVisibility:function(){this.container.toggleClass("cancel",!!this.query.length)},__construct:function(){this.extendOptions(),this.unifySourceFormat()&&(this.dynamicFilter.init.apply(this),this.init(),this.buildDropdownLayout(),this.buildDropdownItemLayout("static"),this.buildMultiselectLayout(),this.delegateEvents(),this.buildCancelButtonLayout(),this.helper.executeCallback.call(this,this.options.callback.onReady,[this.node]))},helper:{isEmpty:function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0},removeAccent:function(t){if("string"==typeof t){var e=o;return"object"==typeof this.options.accent&&(e=this.options.accent),t=t.toLowerCase().replace(new RegExp("["+e.from+"]","g"),function(t){return e.to[e.from.indexOf(t)]})}},slugify:function(t){return""!==(t=String(t))&&(t=(t=this.helper.removeAccent.call(this,t)).replace(/[^-a-z0-9]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")),t},sort:function(s,i,o){function n(t){for(var e=0,i=s.length;e<i;e++)if(void 0!==t[s[e]])return o(t[s[e]]);return t}return i=[-1,1][+!!i],function(t,e){return t=n(t),e=n(e),i*((e<t)-(t<e))}},replaceAt:function(t,e,i,s){return t.substring(0,e)+s+t.substring(e+i)},highlight:function(t,e,i){t=String(t);var s=i&&this.helper.removeAccent.call(this,t)||t,o=[];Array.isArray(e)||(e=[e]),e.sort(function(t,e){return e.length-t.length});for(var n=e.length-1;0<=n;n--)""!==e[n].trim()?e[n]=e[n].replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"):e.splice(n,1);s.replace(new RegExp("(?:"+e.join("|")+")(?!([^<]+)?>)","gi"),function(t,e,i){o.push({offset:i,length:t.length})});for(n=o.length-1;0<=n;n--)t=this.helper.replaceAt(t,o[n].offset,o[n].length,"<strong>"+t.substr(o[n].offset,o[n].length)+"</strong>");return t},getCaret:function(t){var e=0;if(t.selectionStart)return t.selectionStart;if(document.selection){var i=document.selection.createRange();if(null===i)return e;var s=t.createTextRange(),o=s.duplicate();s.moveToBookmark(i.getBookmark()),o.setEndPoint("EndToStart",s),e=o.text.length}else if(window.getSelection){var n=window.getSelection();if(n.rangeCount){var r=n.getRangeAt(0);r.commonAncestorContainer.parentNode==t&&(e=r.endOffset)}}return e},setCaretAtEnd:function(t){if(void 0!==window.getSelection&&void 0!==document.createRange){var e=document.createRange();e.selectNodeContents(t),e.collapse(!1);var i=window.getSelection();i.removeAllRanges(),i.addRange(e)}else if(void 0!==document.body.createTextRange){var s=document.body.createTextRange();s.moveToElementText(t),s.collapse(!1),s.select()}},cleanStringFromScript:function(t){return"string"==typeof t&&t.replace(/<\/?(?:script|iframe)\b[^>]*>/gm,"")||t},executeCallback:function(t,e){if(t){var i;if("function"==typeof t)i=t;else if(("string"==typeof t||Array.isArray(t))&&("string"==typeof t&&(t=[t,[]]),"function"!=typeof(i=this.helper.namespace.call(this,t[0],window))))return;return i.apply(this,(t[1]||[]).concat(e||[]))}},namespace:function(t,e,i,s){if("string"!=typeof t||""===t)return!1;var o=void 0!==s?s:void 0;if(!~t.indexOf("."))return e[t]||o;for(var n=t.split("."),r=e||window,a=(i=i||"get",""),l=0,h=n.length;l<h;l++){if(void 0===r[a=n[l]]){if(~["get","delete"].indexOf(i))return void 0!==s?s:void 0;r[a]={}}if(~["set","create","delete"].indexOf(i)&&l===h-1){if("set"!==i&&"create"!==i)return delete r[a],!0;r[a]=o}r=r[a]}return r},typeWatch:(i=0,function(t,e){clearTimeout(i),i=setTimeout(t,e)})}},j.fn.typeahead=j.typeahead=function(t){return e.typeahead(this,t)};var e={typeahead:function(t,e){if(e&&e.source&&"object"==typeof e.source){if("function"==typeof t){if(!e.input)return;t=j(e.input)}if(t.length){if(void 0===t[0].value&&(t[0].value=t.text()),1===t.length)return t[0].selector=t.selector||e.input||t[0].nodeName.toLowerCase(),window.Typeahead[t[0].selector]=new r(t,e);for(var i,s={},o=0,n=t.length;o<n;++o)void 0!==s[i=t[o].nodeName.toLowerCase()]&&(i+=o),t[o].selector=i,window.Typeahead[i]=s[i]=new r(t.eq(o),e);return s}}}};return window.console=window.console||{log:function(){}},Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),"trim"in String.prototype||(String.prototype.trim=function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}),"indexOf"in Array.prototype||(Array.prototype.indexOf=function(t,e){void 0===e&&(e=0),e<0&&(e+=this.length),e<0&&(e=0);for(var i=this.length;e<i;e++)if(e in this&&this[e]===t)return e;return-1}),Object.keys||(Object.keys=function(t){var e,i=[];for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&i.push(e);return i}),r});
  60083. // Copyright (c) Jupyter Development Team.
  60084. // Distributed under the terms of the Modified BSD License.
  60085. define('notebook/js/quickhelp',[
  60086. 'jquery',
  60087. 'base/js/utils',
  60088. 'base/js/i18n',
  60089. 'base/js/dialog',
  60090. 'underscore'
  60091. ], function($, utils, i18n, dialog, _) {
  60092. "use strict";
  60093. var platform = utils.platform;
  60094. var QuickHelp = function (options) {
  60095. /**
  60096. * Constructor
  60097. *
  60098. * Parameters:
  60099. * options: dictionary
  60100. * Dictionary of keyword arguments.
  60101. * events: $(Events) instance
  60102. * keyboard_manager: KeyboardManager instance
  60103. * notebook: Notebook instance
  60104. */
  60105. this.keyboard_manager = options.keyboard_manager;
  60106. this.notebook = options.notebook;
  60107. this.keyboard_manager.quick_help = this;
  60108. this.events = options.events;
  60109. };
  60110. var cmd_ctrl = 'Ctrl-';
  60111. var platform_specific;
  60112. if (platform === 'MacOS') {
  60113. // Mac OS X specific
  60114. cmd_ctrl = 'Cmd-';
  60115. platform_specific = [
  60116. { shortcut: "Cmd-Up", help:i18n.msg._("go to cell start") },
  60117. { shortcut: "Cmd-Down", help:i18n.msg._("go to cell end") },
  60118. { shortcut: "Alt-Left", help:i18n.msg._("go one word left") },
  60119. { shortcut: "Alt-Right", help:i18n.msg._("go one word right") },
  60120. { shortcut: "Alt-Backspace", help:i18n.msg._("delete word before") },
  60121. { shortcut: "Alt-Delete", help:i18n.msg._("delete word after") },
  60122. { shortcut: "Cmd-Shift-z", help:i18n.msg._("redo") },
  60123. { shortcut: "Cmd-Shift-u", help:i18n.msg._("redo selection") },
  60124. { shortcut: "Ctrl-k", help:i18n.msg._("emacs-style line kill") },
  60125. { shortcut: "Cmd-Backspace", help:i18n.msg._("delete line left of cursor") },
  60126. { shortcut: "Cmd-Delete", help:i18n.msg._("delete line right of cursor") }
  60127. ];
  60128. } else {
  60129. // PC specific
  60130. platform_specific = [
  60131. { shortcut: "Ctrl-Home", help:i18n.msg._("go to cell start") },
  60132. { shortcut: "Ctrl-Up", help:i18n.msg._("go to cell start") },
  60133. { shortcut: "Ctrl-End", help:i18n.msg._("go to cell end") },
  60134. { shortcut: "Ctrl-Down", help:i18n.msg._("go to cell end") },
  60135. { shortcut: "Ctrl-Left", help:i18n.msg._("go one word left") },
  60136. { shortcut: "Ctrl-Right", help:i18n.msg._("go one word right") },
  60137. { shortcut: "Ctrl-Backspace", help:i18n.msg._("delete word before")},
  60138. { shortcut: "Ctrl-Delete", help:i18n.msg._("delete word after")},
  60139. { shortcut: "Ctrl-y", help:i18n.msg._("redo")},
  60140. { shortcut: "Alt-u", help:i18n.msg._("redo selection") }
  60141. ];
  60142. }
  60143. var cm_shortcuts = [
  60144. { shortcut:"Tab", help:i18n.msg._("code completion or indent") },
  60145. { shortcut:"Shift-Tab", help:i18n.msg._("tooltip") },
  60146. { shortcut: cmd_ctrl + "]", help:i18n.msg._("indent") },
  60147. { shortcut: cmd_ctrl + "[", help:i18n.msg._("dedent") },
  60148. { shortcut: cmd_ctrl + "a", help:i18n.msg._("select all") },
  60149. { shortcut: cmd_ctrl + "z", help:i18n.msg._("undo") },
  60150. { shortcut: cmd_ctrl + "/", help:i18n.msg._("comment") },
  60151. { shortcut: cmd_ctrl + "d", help:i18n.msg._("delete whole line") },
  60152. { shortcut: cmd_ctrl + "u", help:i18n.msg._("undo selection") },
  60153. { shortcut: "Insert", help:i18n.msg._("toggle overwrite flag") }
  60154. ].concat( platform_specific );
  60155. var mac_humanize_map = {
  60156. // all these are unicode, will probably display badly on anything except macs.
  60157. // these are the standard symbol that are used in MacOS native menus
  60158. // cf https://apple.stackexchange.com/questions/55727/
  60159. // for htmlentities and/or unicode value
  60160. 'cmd':'⌘',
  60161. 'shift':'⇧',
  60162. 'alt':'⌥',
  60163. 'up':'↑',
  60164. 'down':'↓',
  60165. 'left':'←',
  60166. 'right':'→',
  60167. 'eject':'⏏',
  60168. 'tab':'⇥',
  60169. 'backtab':'⇤',
  60170. 'capslock':'⇪',
  60171. 'esc':'esc',
  60172. 'ctrl':'⌃',
  60173. 'enter':'↩',
  60174. 'pageup':'⇞',
  60175. 'pagedown':'⇟',
  60176. 'home':'↖',
  60177. 'end':'↘',
  60178. 'altenter':'⌤',
  60179. 'space':'␣',
  60180. 'delete':'⌦',
  60181. 'backspace':'⌫',
  60182. 'apple':'',
  60183. };
  60184. var default_humanize_map = {
  60185. 'shift':i18n.msg._('Shift'),
  60186. 'alt':i18n.msg._('Alt'),
  60187. 'up':i18n.msg._('Up'),
  60188. 'down':i18n.msg._('Down'),
  60189. 'left':i18n.msg._('Left'),
  60190. 'right':i18n.msg._('Right'),
  60191. 'tab':i18n.msg._('Tab'),
  60192. 'capslock':i18n.msg._('Caps Lock'),
  60193. 'esc':i18n.msg._('Esc'),
  60194. 'ctrl':i18n.msg._('Ctrl'),
  60195. 'enter':i18n.msg._('Enter'),
  60196. 'pageup':i18n.msg._('Page Up'),
  60197. 'pagedown':i18n.msg._('Page Down'),
  60198. 'home':i18n.msg._('Home'),
  60199. 'end':i18n.msg._('End'),
  60200. 'space':i18n.msg._('Space'),
  60201. 'backspace':i18n.msg._('Backspace'),
  60202. '-':i18n.msg._('Minus')
  60203. };
  60204. var humanize_map;
  60205. if (platform === 'MacOS'){
  60206. humanize_map = mac_humanize_map;
  60207. } else {
  60208. humanize_map = default_humanize_map;
  60209. }
  60210. var special_case = { pageup: i18n.msg._("PageUp"), pagedown: i18n.msg._("Page Down") };
  60211. function humanize_key(key){
  60212. if (key.length === 1){
  60213. return key.toUpperCase();
  60214. }
  60215. key = humanize_map[key.toLowerCase()]||key;
  60216. if (key.indexOf(',') === -1){
  60217. return ( special_case[key] ? special_case[key] : key.charAt(0).toUpperCase() + key.slice(1) );
  60218. }
  60219. }
  60220. // return an **html** string of the keyboard shortcut
  60221. // for human eyes consumption.
  60222. // the sequence is a string, comma separated linkt of shortcut,
  60223. // where the shortcut is a list of dash-joined keys.
  60224. // Each shortcut will be wrapped in <kbd> tag, and joined by comma is in a
  60225. // sequence.
  60226. //
  60227. // Depending on the platform each shortcut will be normalized, with or without dashes.
  60228. // and replace with the corresponding unicode symbol for modifier if necessary.
  60229. function humanize_sequence(sequence){
  60230. var joinchar = ',';
  60231. var hum = _.map(sequence.replace(/meta/g, 'cmd').split(','), humanize_shortcut).join(joinchar);
  60232. return hum;
  60233. }
  60234. function _humanize_sequence(sequence){
  60235. var joinchar = ',';
  60236. var hum = _.map(sequence.replace(/meta/g, 'cmd').split(','), _humanize_shortcut).join(joinchar);
  60237. return hum;
  60238. }
  60239. function _humanize_shortcut(shortcut){
  60240. var joinchar = '-';
  60241. if (platform === 'MacOS'){
  60242. joinchar = '';
  60243. }
  60244. return _.map(shortcut.split('-'), humanize_key ).join(joinchar);
  60245. }
  60246. function humanize_shortcut(shortcut){
  60247. return '<kbd>'+_humanize_shortcut(shortcut)+'</kbd>';
  60248. }
  60249. QuickHelp.prototype.show_keyboard_shortcuts = function () {
  60250. /**
  60251. * toggles display of keyboard shortcut dialog
  60252. */
  60253. var that = this;
  60254. if ( this.force_rebuild ) {
  60255. this.shortcut_dialog.remove();
  60256. delete(this.shortcut_dialog);
  60257. this.force_rebuild = false;
  60258. }
  60259. if ( this.shortcut_dialog ){
  60260. // if dialog is already shown, close it
  60261. $(this.shortcut_dialog).modal("toggle");
  60262. return;
  60263. }
  60264. var element = $('<div/>');
  60265. // The documentation
  60266. var doc = $('<div/>').addClass('alert alert-info');
  60267. doc.append(i18n.msg._('The Jupyter Notebook has two different keyboard input modes.'))
  60268. .append(' ')
  60269. .append(i18n.msg._('<b>Edit mode</b> allows you to type code or text into a cell and is indicated by a green cell border.'))
  60270. .append(' ')
  60271. .append(i18n.msg._('<b>Command mode</b> binds the keyboard to notebook level commands and is indicated by a grey cell border with a blue left margin.')
  60272. );
  60273. element.append(doc);
  60274. if (platform === 'MacOS') {
  60275. doc = $('<div/>').addClass('alert alert-info');
  60276. var key_div = this.build_key_names();
  60277. doc.append(key_div);
  60278. element.append(doc);
  60279. }
  60280. // Command mode
  60281. var cmd_div = this.build_command_help();
  60282. element.append(cmd_div);
  60283. // Edit mode
  60284. var edit_div = this.build_edit_help(cm_shortcuts);
  60285. element.append(edit_div);
  60286. // This statement is used simply so that message extraction
  60287. // will pick up the strings. The actual setting of the text
  60288. // for the button is in dialog.js.
  60289. var button_labels = [ i18n.msg._("Close") ];
  60290. this.shortcut_dialog = dialog.modal({
  60291. title : i18n.msg._("Keyboard shortcuts"),
  60292. body : element,
  60293. destroy : false,
  60294. buttons : {
  60295. Close : {}
  60296. },
  60297. notebook: this.notebook,
  60298. keyboard_manager: this.keyboard_manager,
  60299. });
  60300. this.shortcut_dialog.addClass("modal_stretch");
  60301. this.events.on('rebuild.QuickHelp', function() { that.force_rebuild = true;});
  60302. };
  60303. QuickHelp.prototype.build_key_names = function () {
  60304. var key_names_mac = [{ shortcut:"⌘", help:i18n.msg._("Command") },
  60305. { shortcut:"⌃", help:i18n.msg._("Control") },
  60306. { shortcut:"⌥", help:i18n.msg._("Option") },
  60307. { shortcut:"⇧", help:i18n.msg._("Shift") },
  60308. { shortcut:"↩", help:i18n.msg._("Return") },
  60309. { shortcut:"␣", help:i18n.msg._("Space") },
  60310. { shortcut:"⇥", help:i18n.msg._("Tab") }];
  60311. var i, half, n;
  60312. var div = $('<div/>').append('Mac OS X modifier keys:');
  60313. var sub_div = $('<div/>').addClass('container-fluid');
  60314. var col1 = $('<div/>').addClass('col-md-6');
  60315. var col2 = $('<div/>').addClass('col-md-6');
  60316. n = key_names_mac.length;
  60317. half = ~~(n/2);
  60318. for (i=0; i<half; i++) { col1.append(
  60319. build_one(key_names_mac[i])
  60320. ); }
  60321. for (i=half; i<n; i++) { col2.append(
  60322. build_one(key_names_mac[i])
  60323. ); }
  60324. sub_div.append(col1).append(col2);
  60325. div.append(sub_div);
  60326. return div;
  60327. };
  60328. QuickHelp.prototype.build_command_help = function () {
  60329. var that = this;
  60330. var command_shortcuts = this.keyboard_manager.command_shortcuts.help();
  60331. var cmdkey = '<kbd>'+i18n.msg._('Esc')+'</kbd>';
  60332. var div = build_div('<h4>'+i18n.msg.sprintf(i18n.msg._('Command Mode (press %s to enable)'),cmdkey)+'</h4>', command_shortcuts);
  60333. var edit_button = $('<button/>')
  60334. .text(i18n.msg._("Edit Shortcuts"))
  60335. .addClass('btn btn-xs btn-default pull-right')
  60336. .attr('href', '#')
  60337. .attr('title', i18n.msg._('edit command-mode keyboard shortcuts'))
  60338. .click(function () {
  60339. // close this dialog
  60340. $(that.shortcut_dialog).modal("toggle");
  60341. // and open the next one
  60342. $(that.shortcut_dialog).on('hidden.bs.modal', function (e) {
  60343. that.keyboard_manager.actions.call(
  60344. 'jupyter-notebook:edit-command-mode-keyboard-shortcuts'
  60345. );
  60346. });
  60347. });
  60348. div.find('h4').append(edit_button);
  60349. return div;
  60350. };
  60351. QuickHelp.prototype.build_edit_help = function (cm_shortcuts) {
  60352. var edit_shortcuts = this.keyboard_manager.edit_shortcuts.help();
  60353. var enterkey = '<kbd>'+i18n.msg._('Enter')+'</kbd>';
  60354. edit_shortcuts = $.merge($.merge([], cm_shortcuts), edit_shortcuts);
  60355. return build_div('<h4>'+i18n.msg.sprintf(i18n.msg._('Edit Mode (press %s to enable)'),enterkey)+'</h4>', edit_shortcuts);
  60356. };
  60357. var build_one = function (s) {
  60358. var help = s.help;
  60359. var shortcut = '';
  60360. if(s.shortcut){
  60361. shortcut = humanize_sequence(s.shortcut);
  60362. }
  60363. return $('<div>').addClass('quickhelp').
  60364. append($('<span/>').addClass('shortcut_key').append($(shortcut))).
  60365. append($('<span/>').addClass('shortcut_descr').text(' : ' + help));
  60366. };
  60367. var build_div = function (title, shortcuts) {
  60368. // Remove jupyter-notebook:ignore shortcuts.
  60369. shortcuts = shortcuts.filter(function(shortcut) {
  60370. if (shortcut.help === 'ignore') {
  60371. return false;
  60372. } else {
  60373. return true;
  60374. }
  60375. });
  60376. var i, half, n;
  60377. var div = $('<div/>').append($(title));
  60378. var sub_div = $('<div/>').addClass('container-fluid');
  60379. var col1 = $('<div/>').addClass('col-md-6');
  60380. var col2 = $('<div/>').addClass('col-md-6');
  60381. n = shortcuts.length;
  60382. half = ~~(n/2); // Truncate :)
  60383. for (i=0; i<half; i++) { col1.append( build_one(shortcuts[i]) ); }
  60384. for (i=half; i<n; i++) { col2.append( build_one(shortcuts[i]) ); }
  60385. sub_div.append(col1).append(col2);
  60386. div.append(sub_div);
  60387. return div;
  60388. };
  60389. return {'QuickHelp': QuickHelp,
  60390. humanize_shortcut: humanize_shortcut,
  60391. humanize_sequence: humanize_sequence,
  60392. _humanize_sequence: _humanize_sequence,
  60393. };
  60394. });
  60395. // Copyright (c) Jupyter Development Team.
  60396. // Distributed under the terms of the Modified BSD License.
  60397. define('notebook/js/commandpalette',[
  60398. 'jquery',
  60399. 'typeahead',
  60400. 'base/js/i18n',
  60401. 'notebook/js/quickhelp'
  60402. ],function($, typeahead, i18n, QH){
  60403. "use strict";
  60404. /**
  60405. * Humanize the action name to be consumed by user.
  60406. * internally the actions anem are of the form
  60407. * <namespace>:<description-with-dashes>
  60408. * we drop <namespace> and replace dashes for space.
  60409. */
  60410. var humanize_action_id = function(str) {
  60411. return str.split(':')[1].replace(/-/g, ' ').replace(/_/g, '-');
  60412. };
  60413. /**
  60414. * given an action id return 'command-shortcut', 'edit-shortcut' or 'no-shortcut'
  60415. * for the action. This allows us to tag UI in order to visually distinguish
  60416. * wether an action have a keybinding or not.
  60417. **/
  60418. var get_mode_for_action_id = function(name, notebook) {
  60419. var shortcut = notebook.keyboard_manager.command_shortcuts.get_action_shortcut(name);
  60420. if (shortcut) {
  60421. return 'command-shortcut';
  60422. }
  60423. shortcut = notebook.keyboard_manager.edit_shortcuts.get_action_shortcut(name);
  60424. if (shortcut) {
  60425. return 'edit-shortcut';
  60426. }
  60427. return 'no-shortcut';
  60428. };
  60429. var CommandPalette = function(notebook) {
  60430. if(!notebook){
  60431. throw new Error("CommandPalette takes a notebook non-null mandatory argument");
  60432. }
  60433. // typeahead lib need a specific layout with specific class names.
  60434. // the following just does that
  60435. var form = $('<form/>');
  60436. var container = $('<div/>').addClass('typeahead__container');
  60437. var field = $('<div/>').addClass('typeahead__field');
  60438. var input = $('<input/>').attr('type', 'search');
  60439. field
  60440. .append(
  60441. $('<span>').addClass('typeahead__query').append(
  60442. input
  60443. )
  60444. )
  60445. .append(
  60446. $('<span/>').addClass('typeahead__button').append(
  60447. $('<button/>').attr('type', 'submit').append(
  60448. $('<span/>').addClass('typeahead__search-icon')
  60449. )
  60450. )
  60451. );
  60452. container.append(field);
  60453. form.append(container);
  60454. var mod = $('<div/>').addClass('modal cmd-palette').append(
  60455. $('<div/>').addClass('modal-dialog')
  60456. .append(
  60457. $('<div/>').addClass('modal-content').append(
  60458. $('<div/>').addClass('modal-body')
  60459. .append(
  60460. form
  60461. )
  60462. )
  60463. )
  60464. )
  60465. // end setting up right layout
  60466. .modal({show: false, backdrop:true})
  60467. .on('shown.bs.modal', function () {
  60468. // click on button trigger de-focus on mouse up.
  60469. // or something like that.
  60470. setTimeout(function(){input.focus();}, 100);
  60471. });
  60472. notebook.keyboard_manager.disable();
  60473. var before_close = function() {
  60474. // little trick to trigger early in onsubmit
  60475. // when the action called pop-up a dialog
  60476. // insure this function is only called once
  60477. if (before_close.ok) {
  60478. return;
  60479. }
  60480. var cell = notebook.get_selected_cell();
  60481. if (cell) {
  60482. cell.select();
  60483. }
  60484. if (notebook.keyboard_manager) {
  60485. notebook.keyboard_manager.enable();
  60486. notebook.keyboard_manager.command_mode();
  60487. }
  60488. before_close.ok = true; // avoid double call.
  60489. };
  60490. mod.on("hide.bs.modal", before_close);
  60491. // will be trigger when user select action
  60492. var onSubmit = function(node, query, result, resultCount) {
  60493. if (actions.indexOf(result.key) >= 0) {
  60494. before_close();
  60495. notebook.keyboard_manager.actions.call(result.key);
  60496. } else {
  60497. console.warning("No command " + result.key);
  60498. }
  60499. mod.modal('hide');
  60500. };
  60501. /* Whenever a result is rendered, if there is only one resulting
  60502. * element then automatically select that element.
  60503. */
  60504. var onResult = function(node, query, result, resultCount) {
  60505. if (resultCount == 1) {
  60506. requestAnimationFrame(function() {
  60507. $('.typeahead-list > li:nth-child(2)').addClass('active');
  60508. });
  60509. }
  60510. };
  60511. // generate structure needed for typeahead layout and ability to search
  60512. var src = {};
  60513. var actions = Object.keys(notebook.keyboard_manager.actions._actions);
  60514. for (var i = 0; i < actions.length; i++) {
  60515. var action_id = actions[i];
  60516. var action = notebook.keyboard_manager.actions.get(action_id);
  60517. var group = action_id.split(':')[0];
  60518. src[group] = src[group] || {
  60519. data: [],
  60520. display: 'display'
  60521. };
  60522. var short = notebook.keyboard_manager.command_shortcuts.get_action_shortcut(action_id) ||
  60523. notebook.keyboard_manager.edit_shortcuts.get_action_shortcut(action_id);
  60524. if (short) {
  60525. short = QH.humanize_sequence(short);
  60526. }
  60527. var display_text;
  60528. if (action.cmd) {
  60529. display_text = i18n.msg._(action.cmd);
  60530. } else {
  60531. display_text = humanize_action_id(action_id);
  60532. }
  60533. var help = null;
  60534. if (action.help) {
  60535. help = i18n.msg._(action.help);
  60536. }
  60537. src[group].data.push({
  60538. display: display_text,
  60539. shortcut: short,
  60540. mode_shortcut: get_mode_for_action_id(action_id, notebook),
  60541. group: group,
  60542. icon: action.icon,
  60543. help: help,
  60544. key: action_id,
  60545. });
  60546. }
  60547. // now src is the right structure for typeahead
  60548. input.typeahead({
  60549. emptyTemplate: function(query) {
  60550. return $('<div>').text("No results found for ").append(
  60551. $('<code>').text(query)
  60552. );
  60553. },
  60554. maxItem: 1e3,
  60555. minLength: 0,
  60556. hint: true,
  60557. group: {
  60558. template:"{{group}} command group"
  60559. },
  60560. searchOnFocus: true,
  60561. mustSelectItem: true,
  60562. template: '<i class="fa fa-icon {{icon}}"></i>{{display}} <div title={{key}} class="pull-right {{mode_shortcut}}">{{shortcut}}</div>',
  60563. order: "asc",
  60564. source: src,
  60565. callback: {
  60566. onSubmit: onSubmit,
  60567. onClickAfter: onSubmit,
  60568. onResult: onResult
  60569. },
  60570. debug: false,
  60571. });
  60572. mod.modal('show');
  60573. };
  60574. return {'CommandPalette': CommandPalette};
  60575. });
  60576. // Copyright (c) Jupyter Development Team.
  60577. // Distributed under the terms of the Modified BSD License.
  60578. define('notebook/js/shortcuteditor',[
  60579. "jquery",
  60580. "notebook/js/quickhelp",
  60581. "base/js/dialog",
  60582. "components/marked/lib/marked"
  60583. ], function (
  60584. $,
  60585. QH,
  60586. dialog,
  60587. marked
  60588. ) {
  60589. /**
  60590. * Humanize the action name to be consumed by user.
  60591. * internally the actions name are of the form
  60592. * <namespace>:<description-with-dashes>
  60593. * we drop <namespace> and replace dashes for space.
  60594. */
  60595. var humanize_action_id = function(str) {
  60596. return str.split(':')[1].replace(/-/g, ' ').replace(/_/g, '-');
  60597. };
  60598. /**
  60599. * given an action id return 'command-shortcut', 'edit-shortcut' or 'no-shortcut'
  60600. * for the action. This allows us to tag UI in order to visually distinguish
  60601. * Wether an action have a keybinding or not.
  60602. **/
  60603. var KeyBinding = createReactClass({
  60604. displayName: 'KeyBindings',
  60605. getInitialState: function() {
  60606. return {shrt:''};
  60607. },
  60608. handleShrtChange: function (element){
  60609. this.setState({shrt:element.target.value});
  60610. },
  60611. render: function(){
  60612. var that = this;
  60613. var available = this.props.available(this.state.shrt);
  60614. var empty = (this.state.shrt === '');
  60615. var binding_setter = function(){
  60616. if (available) {
  60617. that.props.onAddBindings(that.state.shrt, that.props.ckey);
  60618. }
  60619. that.state.shrt='';
  60620. event.preventDefault();
  60621. return false;
  60622. };
  60623. return React.createElement('form', {className:'jupyter-keybindings',
  60624. onSubmit: binding_setter
  60625. },
  60626. React.createElement('i', {className: "pull-right fa fa-plus", alt: 'add-keyboard-shortcut',
  60627. onClick: binding_setter
  60628. }),
  60629. React.createElement('input', {
  60630. type:'text',
  60631. placeholder:'add shortcut',
  60632. className:'pull-right'+((available||empty)?'':' alert alert-danger'),
  60633. value:that.state.shrt,
  60634. onChange:that.handleShrtChange
  60635. }),
  60636. that.props.shortcuts ? that.props.shortcuts.map(function (item, index) {
  60637. return React.createElement('span', {className: 'pull-right'},
  60638. React.createElement('kbd', {}, [
  60639. item.h,
  60640. React.createElement('i', {className: "fa fa-times", alt: 'remove '+item.h,
  60641. onClick:function () {
  60642. that.props.unbind(item.raw);
  60643. }
  60644. })
  60645. ])
  60646. );
  60647. }): null,
  60648. React.createElement('div', {title: '(' + that.props.ckey + ')' ,
  60649. className:'jupyter-keybindings-text'}, that.props.display )
  60650. );
  60651. }
  60652. });
  60653. var KeyBindingList = createReactClass({
  60654. displayName: 'KeyBindingList',
  60655. getInitialState: function(){
  60656. return {data:[]};
  60657. },
  60658. componentDidMount: function(){
  60659. this.setState({data:this.props.callback()});
  60660. },
  60661. render: function() {
  60662. var that = this;
  60663. var children = this.state.data.map(function (binding) {
  60664. return React.createElement(KeyBinding, Object.assign({}, binding, {
  60665. onAddBindings: function (shortcut, action) {
  60666. that.props.bind(shortcut, action);
  60667. that.setState({data:that.props.callback()});
  60668. },
  60669. available: that.props.available,
  60670. unbind: function (shortcut) {
  60671. that.props.unbind(shortcut);
  60672. that.setState({data:that.props.callback()});
  60673. }
  60674. }));
  60675. });
  60676. children.unshift(React.createElement('div', {className:'well', key:'disclamer', id:'short-key-binding-intro', dangerouslySetInnerHTML:
  60677. {__html:
  60678. marked.marked(
  60679. "Here you can modify the keyboard shortcuts available in "+
  60680. "command mode. Your changes will be stored for later sessions. "+
  60681. "See more [**details of defining keyboard shortcuts**](#long-key-binding-intro) below."
  60682. )}
  60683. }));
  60684. children.push(React.createElement('div', {className:'well', key:'disclamer', id:'long-key-binding-intro', dangerouslySetInnerHTML:
  60685. {__html:
  60686. marked.marked(
  60687. "This dialog allows you to modify the keyboard shortcuts available in command mode. "+
  60688. "Any changes will be persisted between sessions and across environments. "+
  60689. "You can define two kinds of shortcuts: **key combinations** and **key sequences**.\n"+
  60690. "\n"+
  60691. " - **Key Combinations**:\n"+
  60692. " - Use hyphens `-` to represent keys that should be pressed at the same time.\n"+
  60693. " - This is designed for use with *modifier* keys: `Cmd`, `Ctrl`, `Alt` ,`Meta`, "+
  60694. "`Cmdtrl`, and `Shift`.\n"+
  60695. " - `Cmdtrl` acts like `Cmd` on OS X/MacOS and `Ctrl` on Windows/Linux.\n"+
  60696. " - At most, one non-modifier key can exist in a key combination.\n"+
  60697. " - Multiple modifier keys can exist in a key combination.\n"+
  60698. " - Modifier keys need to precede the non-modifier key in a combination.\n"+
  60699. " - *Valid Examples*: `Shift-a`, `Ctrl-;`, or `Ctrl-Shift-a`. \n"+
  60700. " - *Invalid Example*s: `a-b` and `a-Ctrl-Shift`. \n"+
  60701. " - **Key Sequences**:\n"+
  60702. " - Use commas `,` to represent keys that should be pressed in sequence.\n"+
  60703. " - The order in which keys must be pressed exactly matches the left-to-right order of "+
  60704. "the characters in the sequence, with no interruptions.\n"+
  60705. " - E.g., `h,a,l,t` would be triggered by typing <kbd>h</kbd> <kbd>a</kbd> "+
  60706. "<kbd>l</kbd> <kbd>t</kbd> but not <kbd>h</kbd> <kbd>a</kbd> <kbd>a</kbd> <kbd>l</kbd> "+
  60707. "<kbd>t</kbd> or <kbd>a</kbd> <kbd>h</kbd> <kbd>l</kbd> <kbd>t</kbd>.\n"+
  60708. " - Sequences can include the same key multiple times (e.g., `d,d`).\n"+
  60709. " - You cannot include any pairs of sequences where one is a 'prefix' the other.\n"+
  60710. " - E.g., `d,d,d` cannot be used a the same time as `d,d`.\n"+
  60711. " - Key combinations are unique elements that can be used in a sequence.\n"+
  60712. " - E.g., `Ctrl-d,d` and `d,d` can exist at the same time and are both valid key sequences.\n"+
  60713. "\n"+
  60714. "**Additional notes**:\n"+
  60715. "\n"+
  60716. "The case in which elements are written does not change the binding's meaning. "+
  60717. "E.g., `Ctrl-D` and `cTrl-d` are the same key binding. "+
  60718. "Thus, `Shift` needs to be explicitly included if it is part of the key binding. "+
  60719. "So, for example, if you set a command to be activated by `Shift-D,D`, the second `d` "+
  60720. "cannot be pressed at the same time as the `Shift` modifier key.\n"+
  60721. "\n"+
  60722. "Valid modifiers are specified by writing out their names explicitly: "+
  60723. "e.g., `Shift`, `Cmd`, `Ctrl`, `Alt` ,`Meta`, `Cmdtrl`. You cannot use the symbol equivalents "+
  60724. "(e.g., `⇧`, `⌘`, `⌃`, `⌥`); refer to developer docs for the corresponding keys "+
  60725. "(the mapping of which depends on the platform you are using)."+
  60726. "You can hover on the name/description of a command to see its exact internal name and "+
  60727. "differentiate from actions defined in various plugins. \n"+
  60728. "\n"+
  60729. "Changing the keybindings of edit mode is not currently available."
  60730. )}
  60731. }));
  60732. return React.createElement('div',{}, children);
  60733. }
  60734. });
  60735. var get_shortcuts_data = function(notebook) {
  60736. var actions = Object.keys(notebook.keyboard_manager.actions._actions);
  60737. var src = [];
  60738. for (var i = 0; i < actions.length; i++) {
  60739. var action_id = actions[i];
  60740. var action = notebook.keyboard_manager.actions.get(action_id);
  60741. var shortcuts = notebook.keyboard_manager.command_shortcuts.get_action_shortcuts(action_id);
  60742. var hshortcuts = [];
  60743. if (shortcuts.length > 0) {
  60744. hshortcuts = shortcuts.map(function (raw) {
  60745. return {h:QH._humanize_sequence(raw),raw:raw};}
  60746. );
  60747. }
  60748. src.push({
  60749. display: humanize_action_id(action_id),
  60750. shortcuts: hshortcuts,
  60751. key:action_id, // react specific thing
  60752. ckey: action_id
  60753. });
  60754. }
  60755. return src;
  60756. };
  60757. var ShortcutEditor = function(notebook) {
  60758. if(!notebook){
  60759. throw new Error("CommandPalette takes a notebook non-null mandatory argument");
  60760. }
  60761. var body = $('<div>');
  60762. var mod = dialog.modal({
  60763. notebook: notebook,
  60764. keyboard_manager: notebook.keyboard_manager,
  60765. title : "Edit Command mode Shortcuts",
  60766. body : body,
  60767. buttons : {
  60768. OK : {}
  60769. }
  60770. });
  60771. var src = get_shortcuts_data(notebook);
  60772. mod.addClass("modal_stretch");
  60773. mod.modal('show');
  60774. ReactDOM.render(
  60775. React.createElement(KeyBindingList, {
  60776. callback: function () { return get_shortcuts_data(notebook);},
  60777. bind: function (shortcut, command) {
  60778. return notebook.keyboard_manager.command_shortcuts._persist_shortcut(shortcut, command);
  60779. },
  60780. unbind: function (shortcut) {
  60781. return notebook.keyboard_manager.command_shortcuts._persist_remove_shortcut(shortcut);
  60782. },
  60783. available: function (shrt) { return notebook.keyboard_manager.command_shortcuts.is_available_shortcut(shrt);}
  60784. }),
  60785. body.get(0)
  60786. );
  60787. };
  60788. return {ShortcutEditor: ShortcutEditor};
  60789. });
  60790. // Copyright (c) Jupyter Development Team.
  60791. // Distributed under the terms of the Modified BSD License.
  60792. /**
  60793. * @module notebook
  60794. */
  60795. define('notebook/js/notebook',[
  60796. 'jquery',
  60797. 'base/js/namespace',
  60798. 'underscore',
  60799. 'base/js/utils',
  60800. 'base/js/i18n',
  60801. 'base/js/dialog',
  60802. 'base/js/markdown',
  60803. './cell',
  60804. './textcell',
  60805. './codecell',
  60806. 'moment',
  60807. 'services/config',
  60808. 'services/sessions/session',
  60809. './celltoolbar',
  60810. 'codemirror/lib/codemirror',
  60811. 'codemirror/addon/runmode/runmode',
  60812. 'base/js/mathjaxutils',
  60813. 'base/js/keyboard',
  60814. './tooltip',
  60815. './celltoolbarpresets/default',
  60816. './celltoolbarpresets/rawcell',
  60817. './celltoolbarpresets/slideshow',
  60818. './celltoolbarpresets/attachments',
  60819. './celltoolbarpresets/tags',
  60820. './scrollmanager',
  60821. './commandpalette',
  60822. './shortcuteditor',
  60823. ], function (
  60824. $,
  60825. IPython,
  60826. _,
  60827. utils,
  60828. i18n,
  60829. dialog,
  60830. markdown,
  60831. cellmod,
  60832. textcell,
  60833. codecell,
  60834. moment,
  60835. configmod,
  60836. session,
  60837. celltoolbar,
  60838. CodeMirror,
  60839. runMode,
  60840. mathjaxutils,
  60841. keyboard,
  60842. tooltip,
  60843. default_celltoolbar,
  60844. rawcell_celltoolbar,
  60845. slideshow_celltoolbar,
  60846. attachments_celltoolbar,
  60847. tags_celltoolbar,
  60848. scrollmanager,
  60849. commandpalette,
  60850. shortcuteditor
  60851. ) {
  60852. var ShortcutEditor = shortcuteditor.ShortcutEditor;
  60853. var _SOFT_SELECTION_CLASS = 'jupyter-soft-selected';
  60854. function soft_selected(cell){
  60855. return cell.element.hasClass(_SOFT_SELECTION_CLASS);
  60856. }
  60857. /**
  60858. * Contains and manages cells.
  60859. * @class Notebook
  60860. * @param {string} selector
  60861. * @param {object} options - Dictionary of keyword arguments.
  60862. * @param {jQuery} options.events - selector of Events
  60863. * @param {KeyboardManager} options.keyboard_manager
  60864. * @param {Contents} options.contents
  60865. * @param {SaveWidget} options.save_widget
  60866. * @param {object} options.config
  60867. * @param {string} options.base_url
  60868. * @param {string} options.notebook_path
  60869. * @param {string} options.notebook_name
  60870. */
  60871. function Notebook(selector, options) {
  60872. this.config = options.config;
  60873. this.config.loaded.then(this.validate_config.bind(this));
  60874. this.class_config = new configmod.ConfigWithDefaults(this.config,
  60875. Notebook.options_default, 'Notebook');
  60876. this.nbclassic_path = options.nbclassic_path;
  60877. this.base_url = options.base_url;
  60878. this.notebook_path = options.notebook_path;
  60879. this.notebook_name = options.notebook_name;
  60880. this.events = options.events;
  60881. this.keyboard_manager = options.keyboard_manager;
  60882. this.contents = options.contents;
  60883. this.save_widget = options.save_widget;
  60884. this.tooltip = new tooltip.Tooltip(this.events);
  60885. this.ws_url = options.ws_url;
  60886. this._session_starting = false;
  60887. this.last_modified = null;
  60888. // debug 484
  60889. this._last_modified = 'init';
  60890. // Firefox workaround
  60891. this._ff_beforeunload_fired = false;
  60892. // Create default scroll manager.
  60893. this.scroll_manager = new scrollmanager.ScrollManager(this);
  60894. // TODO: This code smells (and the other `= this` line a couple lines down)
  60895. // We need a better way to deal with circular instance references.
  60896. this.keyboard_manager.notebook = this;
  60897. this.save_widget.notebook = this;
  60898. mathjaxutils.init();
  60899. this.element = $(selector);
  60900. this.element.scroll();
  60901. this.element.data("notebook", this);
  60902. this.session = null;
  60903. this.kernel = null;
  60904. this.kernel_busy = false;
  60905. this.clipboard = null;
  60906. this.clipboard_attachments = null;
  60907. this.undelete_backup_stack = [];
  60908. this.paste_enabled = false;
  60909. this.paste_attachments_enabled = false;
  60910. this.writable = false;
  60911. // It is important to start out in command mode to match the initial mode
  60912. // of the KeyboardManager.
  60913. this.mode = 'command';
  60914. this.set_dirty(false);
  60915. this.metadata = {};
  60916. this._checkpoint_after_save = false;
  60917. this.last_checkpoint = null;
  60918. this.checkpoints = [];
  60919. this.autosave_interval = 0;
  60920. this.autosave_timer = null;
  60921. // autosave *at most* every two minutes
  60922. this.minimum_autosave_interval = 120000;
  60923. this.notebook_name_blacklist_re = /[\/\\:]/;
  60924. this.nbformat = 4; // Increment this when changing the nbformat
  60925. this.nbformat_minor = this.current_nbformat_minor = 1; // Increment this when changing the nbformat
  60926. this.codemirror_mode = 'text';
  60927. this.create_elements();
  60928. this.bind_events();
  60929. this.kernel_selector = null;
  60930. this.dirty = null;
  60931. this.trusted = null;
  60932. this._changed_on_disk_dialog = null;
  60933. this._fully_loaded = false;
  60934. // Trigger cell toolbar registration.
  60935. default_celltoolbar.register(this);
  60936. rawcell_celltoolbar.register(this);
  60937. slideshow_celltoolbar.register(this);
  60938. attachments_celltoolbar.register(this);
  60939. tags_celltoolbar.register(this);
  60940. var that = this;
  60941. Object.defineProperty(this, 'line_numbers', {
  60942. get: function() {
  60943. var d = that.config.data || {};
  60944. var cmc = (d['Cell'] || {}) ['cm_config'] || {};
  60945. return cmc['lineNumbers'] || false;
  60946. },
  60947. set: function(value) {
  60948. that.config.update({
  60949. 'Cell': {
  60950. 'cm_config': {
  60951. 'lineNumbers':value
  60952. }
  60953. }
  60954. });
  60955. }
  60956. });
  60957. Object.defineProperty(this, 'header', {
  60958. get: function() {
  60959. return that.class_config.get_sync('Header');
  60960. },
  60961. set: function(value) {
  60962. that.class_config.set('Header', value);
  60963. }
  60964. });
  60965. Object.defineProperty(this, 'toolbar', {
  60966. get: function() {
  60967. return that.class_config.get_sync('Toolbar');
  60968. },
  60969. set: function(value) {
  60970. that.class_config.set('Toolbar', value);
  60971. }
  60972. });
  60973. this.class_config.get('Header').then(function(header) {
  60974. if (header === false) {
  60975. that.keyboard_manager.actions.call('jupyter-notebook:hide-header');
  60976. }
  60977. });
  60978. this.class_config.get('Toolbar').then(function(toolbar) {
  60979. if (toolbar === false) {
  60980. that.keyboard_manager.actions.call('jupyter-notebook:hide-toolbar');
  60981. }
  60982. });
  60983. // prevent assign to miss-typed properties.
  60984. Object.seal(this);
  60985. }
  60986. Notebook.options_default = {
  60987. // can be any cell type, or the special values of
  60988. // 'above', 'below', or 'selected' to get the value from another cell.
  60989. default_cell_type: 'code',
  60990. Header: true,
  60991. Toolbar: true,
  60992. kill_kernel: false
  60993. };
  60994. Notebook.prototype.validate_config = function() {
  60995. var code_cell = this.config.data['CodeCell'] || {};
  60996. var cm_keymap = (code_cell['cm_config'] || {})['keyMap'];
  60997. if (cm_keymap && CodeMirror.keyMap[cm_keymap] === undefined) {
  60998. console.warn('CodeMirror keymap not found, ignoring: ' + cm_keymap);
  60999. delete code_cell.cm_config.keyMap;
  61000. }
  61001. };
  61002. /**
  61003. * Create an HTML and CSS representation of the notebook.
  61004. */
  61005. Notebook.prototype.create_elements = function () {
  61006. var that = this;
  61007. this.element.attr('tabindex','-1');
  61008. this.container = $("<div/>").addClass("container").attr("id", "notebook-container");
  61009. // We add this end_space div to the end of the notebook div to:
  61010. // i) provide a margin between the last cell and the end of the notebook
  61011. // ii) to prevent the div from scrolling up when the last cell is being
  61012. // edited, but is too low on the page, which browsers will do automatically.
  61013. var end_space = $('<div/>')
  61014. .addClass('end_space');
  61015. end_space.dblclick(function () {
  61016. var ncells = that.ncells();
  61017. that.insert_cell_below('code',ncells-1);
  61018. });
  61019. this.element.append(this.container);
  61020. this.container.after(end_space);
  61021. };
  61022. /**
  61023. * Bind JavaScript events: key presses and custom Jupyter events.
  61024. */
  61025. Notebook.prototype.bind_events = function () {
  61026. var that = this;
  61027. this.events.on('set_next_input.Notebook', function (event, data) {
  61028. if (data.replace) {
  61029. data.cell.set_text(data.text);
  61030. if (data.clear_output !== false) {
  61031. // default (undefined) is true to preserve prior behavior
  61032. data.cell.clear_output();
  61033. }
  61034. } else {
  61035. var index = that.find_cell_index(data.cell);
  61036. var new_cell = that.insert_cell_below('code',index);
  61037. new_cell.set_text(data.text);
  61038. }
  61039. that.dirty = true;
  61040. });
  61041. this.events.on('unrecognized_cell.Cell', function () {
  61042. that.warn_nbformat_minor();
  61043. });
  61044. this.events.on('unrecognized_output.OutputArea', function () {
  61045. that.warn_nbformat_minor();
  61046. });
  61047. this.events.on('set_dirty.Notebook', function (event, data) {
  61048. that.dirty = data.value;
  61049. });
  61050. this.events.on('trust_changed.Notebook', function (event, trusted) {
  61051. that.trusted = trusted;
  61052. });
  61053. this.events.on('select.Cell', function (event, data) {
  61054. var index = that.find_cell_index(data.cell);
  61055. that.select(index, !data.extendSelection);
  61056. });
  61057. this.events.on('edit_mode.Cell', function (event, data) {
  61058. that.handle_edit_mode(data.cell);
  61059. });
  61060. this.events.on('command_mode.Cell', function (event, data) {
  61061. that.handle_command_mode(data.cell);
  61062. });
  61063. this.events.on('spec_changed.Kernel', function(event, data) {
  61064. var existing_spec = that.metadata.kernelspec;
  61065. that.metadata.kernelspec = {
  61066. name: data.name,
  61067. display_name: data.spec.display_name,
  61068. language: data.spec.language,
  61069. };
  61070. if (!existing_spec || ! _.isEqual(existing_spec, that.metadata.kernelspec)) {
  61071. that.set_dirty(true);
  61072. }
  61073. // start a new session
  61074. that.start_session(data.name);
  61075. });
  61076. this.events.on('kernel_ready.Kernel', function(event, data) {
  61077. var kinfo = data.kernel.info_reply;
  61078. if (!kinfo.language_info) {
  61079. delete that.metadata.language_info;
  61080. return;
  61081. }
  61082. var existing_info = that.metadata.language_info;
  61083. var langinfo = kinfo.language_info;
  61084. that.metadata.language_info = langinfo;
  61085. if (!existing_info || ! _.isEqual(existing_info, langinfo)) {
  61086. that.set_dirty(true);
  61087. }
  61088. // Mode 'null' should be plain, unhighlighted text.
  61089. var cm_mode = langinfo.codemirror_mode || langinfo.name || 'null';
  61090. that.set_codemirror_mode(cm_mode);
  61091. });
  61092. this.events.on('kernel_idle.Kernel', function () {
  61093. that.kernel_busy = false;
  61094. });
  61095. this.events.on('kernel_busy.Kernel', function () {
  61096. that.kernel_busy = true;
  61097. });
  61098. var collapse_time = function (time) {
  61099. var app_height = $('#ipython-main-app').height(); // content height
  61100. var splitter_height = $('div#pager_splitter').outerHeight(true);
  61101. var new_height = app_height - splitter_height;
  61102. that.element.animate({height : new_height + 'px'}, time);
  61103. };
  61104. this.element.bind('collapse_pager', function (event, extrap) {
  61105. var time = (extrap !== undefined) ? ((extrap.duration !== undefined ) ? extrap.duration : 'fast') : 'fast';
  61106. collapse_time(time);
  61107. });
  61108. var expand_time = function (time) {
  61109. var app_height = $('#ipython-main-app').height(); // content height
  61110. var splitter_height = $('div#pager_splitter').outerHeight(true);
  61111. var pager_height = $('div#pager').outerHeight(true);
  61112. var new_height = app_height - pager_height - splitter_height;
  61113. that.element.animate({height : new_height + 'px'}, time);
  61114. };
  61115. this.element.bind('expand_pager', function (event, extrap) {
  61116. var time = (extrap !== undefined) ? ((extrap.duration !== undefined ) ? extrap.duration : 'fast') : 'fast';
  61117. expand_time(time);
  61118. });
  61119. // Firefox 22 broke $(window).on("beforeunload")
  61120. // I'm not sure why or how.
  61121. window.onbeforeunload = function () {
  61122. /* Make kill kernel configurable.
  61123. example in custom.js:
  61124. var notebook = Jupyter.notebook;
  61125. var config = notebook.config;
  61126. var patch = {
  61127. Notebook:{
  61128. kill_kernel: true
  61129. }
  61130. };
  61131. config.update(patch);
  61132. */
  61133. var kill_kernel = that.class_config.get_sync("kill_kernel");
  61134. if (kill_kernel) {
  61135. that.session.delete();
  61136. }
  61137. if ( utils.browser[0] === "Firefox") {
  61138. // Workaround ancient Firefox bug showing beforeunload twice: https://bugzilla.mozilla.org/show_bug.cgi?id=531199
  61139. if (that._ff_beforeunload_fired) {
  61140. return; // don't show twice on FF
  61141. }
  61142. that._ff_beforeunload_fired = true;
  61143. // unset flag immediately after dialog is dismissed
  61144. setTimeout(function () {
  61145. that._ff_beforeunload_fired = false;
  61146. }, 1);
  61147. }
  61148. // if we are autosaving, trigger an autosave on nav-away.
  61149. // still warn, because if we don't the autosave may fail.
  61150. if (that.dirty) {
  61151. if ( that.autosave_interval ) {
  61152. // schedule autosave in a timeout
  61153. // this gives you a chance to forcefully discard changes
  61154. // by reloading the page if you *really* want to.
  61155. // the timer doesn't start until you *dismiss* the dialog.
  61156. setTimeout(function () {
  61157. if (that.dirty) {
  61158. that.save_notebook();
  61159. }
  61160. }, 1000);
  61161. return i18n.msg._("Autosave in progress, latest changes may be lost.");
  61162. } else {
  61163. return i18n.msg._("Unsaved changes will be lost.");
  61164. }
  61165. }
  61166. // if the kernel is busy, prompt the user if he’s sure
  61167. if (that.kernel_busy) {
  61168. return i18n.msg._("The Kernel is busy, outputs may be lost.");
  61169. }
  61170. // IE treats null as a string. Instead just return which will avoid the dialog.
  61171. return;
  61172. };
  61173. };
  61174. Notebook.prototype.show_command_palette = function() {
  61175. new commandpalette.CommandPalette(this);
  61176. };
  61177. Notebook.prototype.show_shortcuts_editor = function() {
  61178. new ShortcutEditor(this);
  61179. };
  61180. /**
  61181. * Trigger a warning dialog about missing functionality from newer minor versions
  61182. */
  61183. Notebook.prototype.warn_nbformat_minor = function () {
  61184. var v = 'v' + this.nbformat + '.';
  61185. var orig_vs = v + this.nbformat_minor;
  61186. var this_vs = v + this.current_nbformat_minor;
  61187. var msg = i18n.msg.sprintf(i18n.msg._("This notebook is version %1$s, but we only fully support up to %2$s."),
  61188. orig_vs,this_vs) + " " +
  61189. i18n.msg._("You can still work with this notebook, but cell and output types introduced in later notebook versions will not be available.");
  61190. // This statement is used simply so that message extraction
  61191. // will pick up the strings. The actual setting of the text
  61192. // for the button is in dialog.js.
  61193. var button_labels = [
  61194. i18n.msg._("OK"),
  61195. i18n.msg._("Restart and Run All Cells"),
  61196. i18n.msg._("Restart and Clear All Outputs"),
  61197. i18n.msg._("Restart"),
  61198. i18n.msg._("Continue Running"),
  61199. i18n.msg._("Reload"),
  61200. i18n.msg._("Cancel"),
  61201. i18n.msg._("Overwrite"),
  61202. i18n.msg._("Trust"),
  61203. i18n.msg._("Revert")];
  61204. dialog.modal({
  61205. notebook: this,
  61206. keyboard_manager: this.keyboard_manager,
  61207. title : i18n.msg._("Newer Notebook"),
  61208. body : msg,
  61209. buttons : {
  61210. OK : {
  61211. "class" : "btn-danger"
  61212. }
  61213. }
  61214. });
  61215. };
  61216. /**
  61217. * Set the dirty flag, and trigger the set_dirty.Notebook event
  61218. */
  61219. Notebook.prototype.set_dirty = function (value) {
  61220. if (value === undefined) {
  61221. value = true;
  61222. }
  61223. if (this.dirty === value) {
  61224. return;
  61225. }
  61226. this.events.trigger('set_dirty.Notebook', {value: value});
  61227. };
  61228. /**
  61229. * Scroll the top of the page to a given cell.
  61230. *
  61231. * @param {integer} index - An index of the cell to view
  61232. * @param {integer} time - Animation time in milliseconds
  61233. * @return {integer} Pixel offset from the top of the container
  61234. */
  61235. Notebook.prototype.scroll_to_cell = function (index, time) {
  61236. return this.scroll_cell_percent(index, 0, time);
  61237. };
  61238. /**
  61239. * Scroll the middle of the page to a given cell.
  61240. *
  61241. * @param {integer} index - An index of the cell to view
  61242. * @param {integer} percent - 0-100, the location on the screen to scroll.
  61243. * 0 is the top, 100 is the bottom.
  61244. * @param {integer} time - Animation time in milliseconds
  61245. * @return {integer} Pixel offset from the top of the container
  61246. */
  61247. Notebook.prototype.scroll_cell_percent = function (index, percent, time) {
  61248. var cells = this.get_cells();
  61249. time = time || 0;
  61250. percent = percent || 0;
  61251. index = Math.min(cells.length-1,index);
  61252. index = Math.max(0 ,index);
  61253. var sme = this.scroll_manager.element;
  61254. var h = sme.height();
  61255. var st = sme.scrollTop();
  61256. var t = sme.offset().top;
  61257. var ct = cells[index].element.offset().top;
  61258. var scroll_value = st + ct - (t + 0.01 * percent * h);
  61259. this.scroll_manager.element.animate({scrollTop:scroll_value}, time);
  61260. return scroll_value;
  61261. };
  61262. /**
  61263. * Scroll to the bottom of the page.
  61264. */
  61265. Notebook.prototype.scroll_to_bottom = function () {
  61266. this.scroll_manager.element.animate({scrollTop:this.element.get(0).scrollHeight}, 0);
  61267. };
  61268. /**
  61269. * Scroll to the top of the page.
  61270. */
  61271. Notebook.prototype.scroll_to_top = function () {
  61272. this.scroll_manager.element.animate({scrollTop:0}, 0);
  61273. };
  61274. // Edit Notebook metadata
  61275. /**
  61276. * Display a dialog that allows the user to edit the Notebook's metadata.
  61277. */
  61278. Notebook.prototype.edit_metadata = function () {
  61279. var that = this;
  61280. dialog.edit_metadata({
  61281. md: this.metadata,
  61282. callback: function (new_md) {
  61283. if(!_.isEqual(that.metadata, new_md)){
  61284. that.set_dirty(true);
  61285. }
  61286. that.metadata = new_md;
  61287. },
  61288. name: 'Notebook',
  61289. notebook: this,
  61290. keyboard_manager: this.keyboard_manager});
  61291. };
  61292. // Cell indexing, retrieval, etc.
  61293. /**
  61294. * Get all cell elements in the notebook.
  61295. *
  61296. * @return {jQuery} A selector of all cell elements
  61297. */
  61298. Notebook.prototype.get_cell_elements = function () {
  61299. var container = this.container || $('#notebook-container');
  61300. return container.find(".cell").not('.cell .cell');
  61301. };
  61302. /**
  61303. * Get a particular cell element.
  61304. *
  61305. * @param {integer} index An index of a cell to select
  61306. * @return {jQuery} A selector of the given cell.
  61307. */
  61308. Notebook.prototype.get_cell_element = function (index) {
  61309. var result = null;
  61310. var e = this.get_cell_elements().eq(index);
  61311. if (e.length !== 0) {
  61312. result = e;
  61313. }
  61314. return result;
  61315. };
  61316. /**
  61317. * Try to get a particular cell by msg_id.
  61318. *
  61319. * @param {string} msg_id A message UUID
  61320. * @return {Cell} Cell or null if no cell was found.
  61321. */
  61322. Notebook.prototype.get_msg_cell = function (msg_id) {
  61323. return codecell.CodeCell.msg_cells[msg_id] || null;
  61324. };
  61325. /**
  61326. * Count the cells in this notebook.
  61327. *
  61328. * @return {integer} The number of cells in this notebook
  61329. */
  61330. Notebook.prototype.ncells = function () {
  61331. return this.get_cell_elements().length;
  61332. };
  61333. /**
  61334. * Get all cell objects in this notebook.
  61335. *
  61336. * @return {Array} This notebook's Cell objects
  61337. */
  61338. Notebook.prototype.get_cells = function () {
  61339. // TODO: we are often calling cells as cells()[i], which we should optimize
  61340. // to cells(i) or a new method.
  61341. return this.get_cell_elements().toArray().map(function (e) {
  61342. return $(e).data("cell");
  61343. });
  61344. };
  61345. /**
  61346. * Get a cell object from this notebook.
  61347. *
  61348. * @param {integer} index - An index of a cell to retrieve
  61349. * @return {Cell} Cell or null if no cell was found.
  61350. */
  61351. Notebook.prototype.get_cell = function (index) {
  61352. var result = null;
  61353. var ce = this.get_cell_element(index);
  61354. if (ce !== null) {
  61355. result = ce.data('cell');
  61356. }
  61357. return result;
  61358. };
  61359. /**
  61360. * Get the cell below a given cell.
  61361. *
  61362. * @param {Cell} cell
  61363. * @return {Cell} the next cell or null if no cell was found.
  61364. */
  61365. Notebook.prototype.get_next_cell = function (cell) {
  61366. var result = null;
  61367. var index = this.find_cell_index(cell);
  61368. if (this.is_valid_cell_index(index+1)) {
  61369. result = this.get_cell(index+1);
  61370. }
  61371. return result;
  61372. };
  61373. /**
  61374. * Toggles the display of line numbers in all cells.
  61375. */
  61376. Notebook.prototype.toggle_all_line_numbers = function () {
  61377. this.line_numbers = !this.line_numbers;
  61378. };
  61379. /**
  61380. * Reads direction settings (LTR/RTL) from nbclassic/cells metadata
  61381. * and applies them to display elements.
  61382. */
  61383. Notebook.prototype.apply_directionality = function () {
  61384. var notebook_direction = this.metadata.direction || 'ltr';
  61385. // html
  61386. document.body.setAttribute('dir', notebook_direction);
  61387. // existing cells
  61388. this.get_cells().forEach( function(cell) {
  61389. if (cell.cell_type == 'markdown') {
  61390. cell.code_mirror.setOption('direction', cell.metadata.direction || notebook_direction);
  61391. cell.element.find('.rendered_html').attr('dir', cell.metadata.direction || notebook_direction);
  61392. } else if (cell.cell_type == 'code') {
  61393. cell.element.find('.output_text').attr('dir', cell.metadata.direction || 'auto');
  61394. }
  61395. });
  61396. // new cells
  61397. textcell.MarkdownCell.options_default.cm_config.direction = notebook_direction;
  61398. };
  61399. /**
  61400. * Get the cell above a given cell.
  61401. *
  61402. * @param {Cell} cell
  61403. * @return {Cell} The previous cell or null if no cell was found.
  61404. */
  61405. Notebook.prototype.get_prev_cell = function (cell) {
  61406. var result = null;
  61407. var index = this.find_cell_index(cell);
  61408. if (index !== null && index > 0) {
  61409. result = this.get_cell(index-1);
  61410. }
  61411. return result;
  61412. };
  61413. /**
  61414. * Get the numeric index of a given cell.
  61415. *
  61416. * @param {Cell} cell
  61417. * @return {integer} The cell's numeric index or null if no cell was found.
  61418. */
  61419. Notebook.prototype.find_cell_index = function (cell) {
  61420. var result = null;
  61421. this.get_cell_elements().filter(function (index) {
  61422. if ($(this).data("cell") === cell) {
  61423. result = index;
  61424. }
  61425. });
  61426. return result;
  61427. };
  61428. /**
  61429. * Return given index if defined, or the selected index if not.
  61430. *
  61431. * @param {integer} [index] - A cell's index
  61432. * @return {integer} cell index
  61433. */
  61434. Notebook.prototype.index_or_selected = function (index) {
  61435. var i;
  61436. if (index === undefined || index === null) {
  61437. i = this.get_selected_index();
  61438. if (i === null) {
  61439. i = 0;
  61440. }
  61441. } else {
  61442. i = index;
  61443. }
  61444. return i;
  61445. };
  61446. /**
  61447. * Get the selected cells.
  61448. *
  61449. * @return {Cell} The selected cells or null if no cell was found.
  61450. */
  61451. Notebook.prototype.get_selected_cells = function () {
  61452. return this.get_cells().filter(function(cell, index){ return cell.selected || soft_selected(cell) || cell.anchor;});
  61453. };
  61454. /**
  61455. * Get the selected cells.
  61456. *
  61457. * @return {array} cell indicies
  61458. */
  61459. Notebook.prototype.get_selected_cells_indices = function () {
  61460. var result = [];
  61461. this.get_cells().filter(function (cell, index) {
  61462. if (cell.selected || soft_selected(cell) || cell.anchor) {
  61463. result.push(index);
  61464. }
  61465. });
  61466. return result;
  61467. };
  61468. /**
  61469. * Get the currently selected cell.
  61470. *
  61471. * @return {Cell} The selected cell
  61472. */
  61473. Notebook.prototype.get_selected_cell = function () {
  61474. var index = this.get_selected_index();
  61475. return this.get_cell(index);
  61476. };
  61477. /**
  61478. * Check whether a cell index is valid.
  61479. *
  61480. * @param {integer} index - A cell index
  61481. * @return True if the index is valid, false otherwise
  61482. */
  61483. Notebook.prototype.is_valid_cell_index = function (index) {
  61484. if (index !== null && index >= 0 && index < this.ncells()) {
  61485. return true;
  61486. } else {
  61487. return false;
  61488. }
  61489. };
  61490. /**
  61491. * Returns the index of the cell that the selection is currently anchored on.
  61492. *
  61493. * @return {integer} Index of first cell selected in selection
  61494. */
  61495. Notebook.prototype.get_anchor_index = function () {
  61496. var result = null;
  61497. this.get_cell_elements().filter(function (index) {
  61498. if ($(this).data("cell").anchor === true) {
  61499. result = index;
  61500. }
  61501. });
  61502. return result;
  61503. };
  61504. /**
  61505. * Get the index of the currently selected cell.
  61506. *
  61507. * @return {integer} The selected cell's numeric index
  61508. */
  61509. Notebook.prototype.get_selected_index = function () {
  61510. var result = null;
  61511. this.get_cell_elements().filter(function (index) {
  61512. if ($(this).data("cell").selected === true) {
  61513. result = index;
  61514. }
  61515. });
  61516. return result;
  61517. };
  61518. // Cell selection.
  61519. Notebook.prototype.extend_selection_by = function(delta) {
  61520. var index = this.get_selected_index();
  61521. // do not move anchor
  61522. return this.select(index+delta, false);
  61523. };
  61524. Notebook.prototype.update_soft_selection = function(){
  61525. var i1 = this.get_selected_index();
  61526. var i2 = this.get_anchor_index();
  61527. var low = Math.min(i1, i2);
  61528. var high = Math.max(i1, i2);
  61529. this.get_cells().map(function(cell, index, all){
  61530. if( low <= index && index <= high && low !== high){
  61531. cell.element.addClass(_SOFT_SELECTION_CLASS);
  61532. } else {
  61533. cell.element.removeClass(_SOFT_SELECTION_CLASS);
  61534. }
  61535. });
  61536. };
  61537. Notebook.prototype.select_all = function(){
  61538. this.select(0, true);
  61539. this.select(this.ncells()-1, false);
  61540. };
  61541. Notebook.prototype._contract_selection = function(){
  61542. var i = this.get_selected_index();
  61543. this.select(i, true);
  61544. };
  61545. /**
  61546. * Programmatically select a cell.
  61547. *
  61548. * @param {integer} index - A cell's index
  61549. * @param {boolean} moveanchor – whether to move the selection
  61550. * anchor, default to true.
  61551. * @return {Notebook} This notebook
  61552. */
  61553. Notebook.prototype.select = function (index, moveanchor) {
  61554. moveanchor = (moveanchor===undefined)? true : moveanchor;
  61555. if (this.is_valid_cell_index(index)) {
  61556. var sindex = this.get_selected_index();
  61557. if (sindex !== null && index !== sindex) {
  61558. // If we are about to select a different cell, make sure we are
  61559. // first in command mode.
  61560. if (this.mode !== 'command') {
  61561. this.command_mode();
  61562. }
  61563. this.get_cell(sindex).unselect(moveanchor);
  61564. }
  61565. if(moveanchor){
  61566. this.get_cell(this.get_anchor_index()).unselect(moveanchor);
  61567. }
  61568. var cell = this.get_cell(index);
  61569. cell.select(moveanchor);
  61570. this.update_soft_selection();
  61571. if (cell.cell_type === 'heading') {
  61572. this.events.trigger('selected_cell_type_changed.Notebook',
  61573. {
  61574. 'cell_type': cell.cell_type,
  61575. 'level': cell.level,
  61576. 'editable': cell.is_editable()
  61577. }
  61578. );
  61579. } else {
  61580. this.events.trigger('selected_cell_type_changed.Notebook',
  61581. {
  61582. 'cell_type': cell.cell_type,
  61583. 'editable': cell.is_editable()
  61584. }
  61585. );
  61586. }
  61587. }
  61588. return this;
  61589. };
  61590. /**
  61591. * Programmatically select the next cell.
  61592. *
  61593. * @param {bool} moveanchor – whether to move the selection
  61594. * anchor, default to true.
  61595. * @return {Notebook} This notebook
  61596. */
  61597. Notebook.prototype.select_next = function (moveanchor) {
  61598. var index = this.get_selected_index();
  61599. this.select(index+1, moveanchor);
  61600. return this;
  61601. };
  61602. /**
  61603. * Programmatically select the previous cell.
  61604. *
  61605. * @return {Notebook} This notebook
  61606. */
  61607. Notebook.prototype.select_prev = function (moveanchor) {
  61608. var index = this.get_selected_index();
  61609. this.select(index-1, moveanchor);
  61610. return this;
  61611. };
  61612. // Edit/Command mode
  61613. /**
  61614. * Gets the index of the cell that is in edit mode.
  61615. *
  61616. * @return {integer} index
  61617. */
  61618. Notebook.prototype.get_edit_index = function () {
  61619. var result = null;
  61620. this.get_cell_elements().filter(function (index) {
  61621. if ($(this).data("cell").mode === 'edit') {
  61622. result = index;
  61623. }
  61624. });
  61625. return result;
  61626. };
  61627. /**
  61628. * Handle when a a cell blurs and the notebook should enter command mode.
  61629. *
  61630. * @param {Cell} [cell] - Cell to enter command mode on.
  61631. */
  61632. Notebook.prototype.handle_command_mode = function (cell) {
  61633. if (this.mode !== 'command') {
  61634. cell.command_mode();
  61635. this.mode = 'command';
  61636. this.events.trigger('command_mode.Notebook');
  61637. this.keyboard_manager.command_mode();
  61638. }
  61639. };
  61640. /**
  61641. * Make the notebook enter command mode.
  61642. */
  61643. Notebook.prototype.command_mode = function () {
  61644. var cell = this.get_cell(this.get_edit_index());
  61645. if (cell && this.mode !== 'command') {
  61646. // We don't call cell.command_mode, but rather blur the CM editor
  61647. // which will trigger the call to handle_command_mode.
  61648. cell.code_mirror.getInputField().blur();
  61649. }
  61650. };
  61651. /**
  61652. * Handle when a cell fires it's edit_mode event.
  61653. *
  61654. * @param {Cell} [cell] Cell to enter edit mode on.
  61655. */
  61656. Notebook.prototype.handle_edit_mode = function (cell) {
  61657. this._contract_selection();
  61658. if (cell && this.mode !== 'edit') {
  61659. cell.edit_mode();
  61660. this.mode = 'edit';
  61661. this.events.trigger('edit_mode.Notebook');
  61662. this.keyboard_manager.edit_mode();
  61663. }
  61664. };
  61665. /**
  61666. * Make a cell enter edit mode.
  61667. */
  61668. Notebook.prototype.edit_mode = function () {
  61669. this._contract_selection();
  61670. var cell = this.get_selected_cell();
  61671. if (cell && this.mode !== 'edit') {
  61672. cell.unrender();
  61673. cell.focus_editor();
  61674. }
  61675. };
  61676. /**
  61677. * Ensure either cell or codemirror is focused. If none
  61678. * is focused, focus the cell.
  61679. */
  61680. Notebook.prototype.ensure_focused = function(){
  61681. var cell = this.get_selected_cell();
  61682. if (cell === null) {return;} // No cell is selected
  61683. cell.ensure_focused();
  61684. };
  61685. /**
  61686. * Focus the currently selected cell.
  61687. */
  61688. Notebook.prototype.focus_cell = function () {
  61689. var cell = this.get_selected_cell();
  61690. if (cell === null) {return;} // No cell is selected
  61691. cell.focus_cell();
  61692. };
  61693. // Cell movement
  61694. /**
  61695. * Move the current selection up, keeping the same cells selected
  61696. * No op if the selection is at the beginning of the notebook
  61697. */
  61698. Notebook.prototype.move_selection_up = function(){
  61699. // actually will move the cell before the selection, after the selection
  61700. var indices = this.get_selected_cells_indices();
  61701. var first = indices[0];
  61702. var last = indices[indices.length - 1];
  61703. var selected = this.get_selected_index();
  61704. var anchored = this.get_anchor_index();
  61705. if (first === 0){
  61706. return;
  61707. }
  61708. var tomove = this.get_cell_element(first - 1);
  61709. var pivot = this.get_cell_element(last);
  61710. tomove.detach();
  61711. pivot.after(tomove);
  61712. this.get_cell(selected-1).focus_cell();
  61713. this.select(anchored - 1);
  61714. this.select(selected - 1, false);
  61715. };
  61716. /**
  61717. * Move the current selection down, keeping the same cells selected.
  61718. * No op if the selection is at the end of the notebook
  61719. */
  61720. Notebook.prototype.move_selection_down = function(){
  61721. // actually will move the cell after the selection, before the selection
  61722. var indices = this.get_selected_cells_indices();
  61723. var first = indices[0];
  61724. var last = indices[indices.length - 1];
  61725. var selected = this.get_selected_index();
  61726. var anchored = this.get_anchor_index();
  61727. if(!this.is_valid_cell_index(last + 1)){
  61728. return;
  61729. }
  61730. var tomove = this.get_cell_element(last + 1);
  61731. var pivot = this.get_cell_element(first);
  61732. tomove.detach();
  61733. pivot.before(tomove);
  61734. this.get_cell(selected+1).focus_cell();
  61735. this.select(first);
  61736. this.select(anchored + 1);
  61737. this.select(selected + 1, false);
  61738. };
  61739. /**
  61740. * Move given (or selected) cell up and select it.
  61741. *
  61742. * @param {integer} [index] - cell index
  61743. * @return {Notebook} This notebook
  61744. */
  61745. Notebook.prototype.move_cell_up = function (index) {
  61746. console.warn('Notebook.move_cell_up is deprecated as of v4.1 and will be removed in v5.0');
  61747. if(index === undefined){
  61748. this.move_selection_up();
  61749. return this;
  61750. }
  61751. var i = this.index_or_selected(index);
  61752. if (this.is_valid_cell_index(i) && i > 0) {
  61753. var pivot = this.get_cell_element(i-1);
  61754. var tomove = this.get_cell_element(i);
  61755. if (pivot !== null && tomove !== null) {
  61756. tomove.detach();
  61757. pivot.before(tomove);
  61758. this.select(i-1);
  61759. var cell = this.get_selected_cell();
  61760. cell.focus_cell();
  61761. }
  61762. this.set_dirty(true);
  61763. }
  61764. return this;
  61765. };
  61766. /**
  61767. * Move given (or selected) cell down and select it.
  61768. *
  61769. * @param {integer} [index] - cell index
  61770. * @return {Notebook} This notebook
  61771. */
  61772. Notebook.prototype.move_cell_down = function (index) {
  61773. console.warn('Notebook.move_cell_down is deprecated as of v4.1 and will be removed in v5.0');
  61774. if(index === undefined){
  61775. this.move_selection_down();
  61776. return this;
  61777. }
  61778. var i = this.index_or_selected(index);
  61779. if (this.is_valid_cell_index(i) && this.is_valid_cell_index(i+1)) {
  61780. var pivot = this.get_cell_element(i+1);
  61781. var tomove = this.get_cell_element(i);
  61782. if (pivot !== null && tomove !== null) {
  61783. tomove.detach();
  61784. pivot.after(tomove);
  61785. this.select(i+1);
  61786. var cell = this.get_selected_cell();
  61787. cell.focus_cell();
  61788. }
  61789. }
  61790. this.set_dirty();
  61791. return this;
  61792. };
  61793. // Insertion, deletion.
  61794. /**
  61795. * Delete a cell from the notebook without any precautions
  61796. * Needed to reload checkpoints and other things like that.
  61797. *
  61798. * @param {integer} [index] - cell's numeric index
  61799. * @return {Notebook} This notebook
  61800. */
  61801. Notebook.prototype._unsafe_delete_cell = function (index) {
  61802. var i = this.index_or_selected(index);
  61803. var cell = this.get_cell(i);
  61804. $('#undelete_cell').addClass('disabled');
  61805. $('#undelete_cell > a').attr('aria-disabled','true');
  61806. if (this.is_valid_cell_index(i)) {
  61807. var old_ncells = this.ncells();
  61808. var ce = this.get_cell_element(i);
  61809. ce.remove();
  61810. this.set_dirty(true);
  61811. }
  61812. return this;
  61813. };
  61814. /**
  61815. * Delete cells from the notebook
  61816. *
  61817. * @param {Array} [indices] - the numeric indices of cells to delete.
  61818. * @return {Notebook} This notebook
  61819. */
  61820. Notebook.prototype.delete_cells = function(indices) {
  61821. if (indices === undefined) {
  61822. indices = this.get_selected_cells_indices();
  61823. }
  61824. var undelete_backup = {
  61825. cells: [],
  61826. below: false,
  61827. index: 0,
  61828. };
  61829. var cursor_ix_before = this.get_selected_index();
  61830. var deleting_before_cursor = 0;
  61831. for (var i=0; i < indices.length; i++) {
  61832. if (!this.get_cell(indices[i]).is_deletable()) {
  61833. // If any cell is marked undeletable, cancel
  61834. return this;
  61835. }
  61836. if (indices[i] < cursor_ix_before) {
  61837. deleting_before_cursor++;
  61838. }
  61839. }
  61840. // If we started deleting cells from the top, the later indices would
  61841. // get offset. We sort them into descending order to avoid that.
  61842. indices.sort(function(a, b) {return b-a;});
  61843. for (i=0; i < indices.length; i++) {
  61844. var cell = this.get_cell(indices[i]);
  61845. undelete_backup.cells.push(cell.toJSON());
  61846. this.get_cell_element(indices[i]).remove();
  61847. this.events.trigger('delete.Cell', {'cell': cell, 'index': indices[i]});
  61848. }
  61849. var new_ncells = this.ncells();
  61850. // Always make sure we have at least one cell.
  61851. if (new_ncells === 0) {
  61852. this.insert_cell_below('code');
  61853. new_ncells = 1;
  61854. }
  61855. var cursor_ix_after = this.get_selected_index();
  61856. if (cursor_ix_after === null) {
  61857. // Selected cell was deleted
  61858. cursor_ix_after = cursor_ix_before - deleting_before_cursor;
  61859. if (cursor_ix_after >= new_ncells) {
  61860. cursor_ix_after = new_ncells - 1;
  61861. undelete_backup.below = true;
  61862. }
  61863. this.select(cursor_ix_after);
  61864. }
  61865. // Check if the cells were after the cursor
  61866. for (i=0; i < indices.length; i++) {
  61867. if (indices[i] > cursor_ix_before) {
  61868. undelete_backup.below = true;
  61869. }
  61870. }
  61871. // This will put all the deleted cells back in one location, rather than
  61872. // where they came from. It will do until we have proper undo support.
  61873. undelete_backup.index = cursor_ix_after;
  61874. $('#undelete_cell').removeClass('disabled');
  61875. $('#undelete_cell > a').attr('aria-disabled','false');
  61876. this.undelete_backup_stack.push(undelete_backup);
  61877. this.set_dirty(true);
  61878. return this;
  61879. };
  61880. /**
  61881. * Delete a cell from the notebook.
  61882. *
  61883. * @param {integer} [index] - cell's numeric index
  61884. * @return {Notebook} This notebook
  61885. */
  61886. Notebook.prototype.delete_cell = function (index) {
  61887. if (index === undefined) {
  61888. return this.delete_cells();
  61889. } else {
  61890. return this.delete_cells([index]);
  61891. }
  61892. };
  61893. /**
  61894. * Restore the most recently deleted cells.
  61895. */
  61896. Notebook.prototype.undelete_cell = function() {
  61897. if (this.undelete_backup_stack.length > 0) {
  61898. var undelete_backup = this.undelete_backup_stack.pop();
  61899. var i, cell_data, new_cell, insert;
  61900. if (undelete_backup.below) {
  61901. insert = $.proxy(this.insert_cell_below, this);
  61902. } else {
  61903. insert = $.proxy(this.insert_cell_above, this);
  61904. }
  61905. for (i=0; i < undelete_backup.cells.length; i++) {
  61906. cell_data = undelete_backup.cells[i];
  61907. new_cell = insert(cell_data.cell_type, undelete_backup.index);
  61908. new_cell.fromJSON(cell_data);
  61909. }
  61910. this.set_dirty(true);
  61911. }
  61912. if (this.undelete_backup_stack.length === 0) {
  61913. $('#undelete_cell').addClass('disabled');
  61914. $('#undelete_cell > a').attr('aria-disabled','true');
  61915. }
  61916. };
  61917. /**
  61918. * Insert a cell so that after insertion the cell is at given index.
  61919. *
  61920. * If cell type is not provided, it will default to the type of the
  61921. * currently active cell.
  61922. *
  61923. * Similar to insert_above, but index parameter is mandatory.
  61924. *
  61925. * Index will be brought back into the accessible range [0,n].
  61926. *
  61927. * @param {string} [type] - in ['code','markdown', 'raw'], defaults to 'code'
  61928. * @param {integer} [index] - a valid index where to insert cell
  61929. * @return {Cell|null} created cell or null
  61930. */
  61931. Notebook.prototype.insert_cell_at_index = function(type, index){
  61932. var ncells = this.ncells();
  61933. index = Math.min(index, ncells);
  61934. index = Math.max(index, 0);
  61935. var cell = null;
  61936. type = type || this.class_config.get_sync('default_cell_type');
  61937. if (type === 'above') {
  61938. if (index > 0) {
  61939. type = this.get_cell(index-1).cell_type;
  61940. } else {
  61941. type = 'code';
  61942. }
  61943. } else if (type === 'below') {
  61944. if (index < ncells) {
  61945. type = this.get_cell(index).cell_type;
  61946. } else {
  61947. type = 'code';
  61948. }
  61949. } else if (type === 'selected') {
  61950. type = this.get_selected_cell().cell_type;
  61951. }
  61952. if (ncells === 0 || this.is_valid_cell_index(index) || index === ncells) {
  61953. var cell_options = {
  61954. events: this.events,
  61955. config: this.config,
  61956. keyboard_manager: this.keyboard_manager,
  61957. notebook: this,
  61958. tooltip: this.tooltip
  61959. };
  61960. switch(type) {
  61961. case 'code':
  61962. cell = new codecell.CodeCell(this.kernel, cell_options);
  61963. cell.set_input_prompt();
  61964. break;
  61965. case 'markdown':
  61966. cell = new textcell.MarkdownCell(cell_options);
  61967. break;
  61968. case 'raw':
  61969. cell = new textcell.RawCell(cell_options);
  61970. break;
  61971. default:
  61972. console.log("Unrecognized cell type: ", type, cellmod);
  61973. cell = new cellmod.UnrecognizedCell(cell_options);
  61974. }
  61975. if(this._insert_element_at_index(cell.element,index)) {
  61976. cell.render();
  61977. this.events.trigger('create.Cell', {'cell': cell, 'index': index});
  61978. cell.refresh();
  61979. // We used to select the cell after we refresh it, but there
  61980. // are now cases were this method is called where select is
  61981. // not appropriate. The selection logic should be handled by the
  61982. // caller of the the top level insert_cell methods.
  61983. this.set_dirty(true);
  61984. }
  61985. }
  61986. return cell;
  61987. };
  61988. /**
  61989. * Insert an element at given cell index.
  61990. *
  61991. * @param {HTMLElement} element - a cell element
  61992. * @param {integer} [index] - a valid index where to inser cell
  61993. * @returns {boolean} success
  61994. */
  61995. Notebook.prototype._insert_element_at_index = function(element, index){
  61996. if (element === undefined){
  61997. return false;
  61998. }
  61999. var ncells = this.ncells();
  62000. if (ncells === 0) {
  62001. // special case append if empty
  62002. this.container.append(element);
  62003. } else if ( ncells === index ) {
  62004. // special case append it the end, but not empty
  62005. this.get_cell_element(index-1).after(element);
  62006. } else if (this.is_valid_cell_index(index)) {
  62007. // otherwise always somewhere to append to
  62008. this.get_cell_element(index).before(element);
  62009. } else {
  62010. return false;
  62011. }
  62012. this.undelete_backup_stack.map(function (undelete_backup) {
  62013. if (index < undelete_backup.index) {
  62014. undelete_backup.index += 1;
  62015. }
  62016. });
  62017. this.set_dirty(true);
  62018. return true;
  62019. };
  62020. /**
  62021. * Insert a cell of given type above given index, or at top
  62022. * of notebook if index smaller than 0.
  62023. *
  62024. * @param {string} [type] - cell type
  62025. * @param {integer} [index] - defaults to the currently selected cell
  62026. * @return {Cell|null} handle to created cell or null
  62027. */
  62028. Notebook.prototype.insert_cell_above = function (type, index) {
  62029. if (index === null || index === undefined) {
  62030. index = Math.min(this.get_selected_index(index), this.get_anchor_index());
  62031. }
  62032. return this.insert_cell_at_index(type, index);
  62033. };
  62034. /**
  62035. * Insert a cell of given type below given index, or at bottom
  62036. * of notebook if index greater than number of cells
  62037. *
  62038. * @param {string} [type] - cell type
  62039. * @param {integer} [index] - defaults to the currently selected cell
  62040. * @return {Cell|null} handle to created cell or null
  62041. */
  62042. Notebook.prototype.insert_cell_below = function (type, index) {
  62043. if (index === null || index === undefined) {
  62044. index = Math.max(this.get_selected_index(index), this.get_anchor_index());
  62045. }
  62046. return this.insert_cell_at_index(type, index+1);
  62047. };
  62048. /**
  62049. * Insert cell at end of notebook
  62050. *
  62051. * @param {string} type - cell type
  62052. * @return {Cell|null} handle to created cell or null
  62053. */
  62054. Notebook.prototype.insert_cell_at_bottom = function (type){
  62055. var len = this.ncells();
  62056. return this.insert_cell_below(type,len-1);
  62057. };
  62058. /**
  62059. * Transfer contents from one cell to a new type cell
  62060. */
  62061. Notebook.prototype.transfer_to_new_cell = function (source_cell, target_cell){
  62062. var text = source_cell.get_text();
  62063. if (text === source_cell.placeholder) {
  62064. text = '';
  62065. }
  62066. // metadata
  62067. target_cell.metadata = source_cell.metadata;
  62068. target_cell.attachments = source_cell.attachments;
  62069. // We must show the editor before setting its contents
  62070. target_cell.unrender();
  62071. target_cell.set_text(text);
  62072. // make this value the starting point, so that we can only undo
  62073. // to this state, instead of a blank cell
  62074. target_cell.code_mirror.clearHistory();
  62075. source_cell.element.remove();
  62076. }
  62077. /**
  62078. * Turn one or more cells into code.
  62079. *
  62080. * @param {Array} indices - cell indices to convert
  62081. */
  62082. Notebook.prototype.cells_to_code = function (indices) {
  62083. if (indices === undefined){
  62084. indices = this.get_selected_cells_indices();
  62085. }
  62086. for (var i=0; i <indices.length; i++){
  62087. this.to_code(indices[i]);
  62088. }
  62089. };
  62090. /**
  62091. * Turn a cell into a code cell.
  62092. *
  62093. * @param {integer} [index] - cell index
  62094. */
  62095. Notebook.prototype.to_code = function (index) {
  62096. var i = this.index_or_selected(index);
  62097. if (this.is_valid_cell_index(i)) {
  62098. var source_cell = this.get_cell(i);
  62099. if (!(source_cell instanceof codecell.CodeCell) && source_cell.is_editable()) {
  62100. var target_cell = this.insert_cell_below('code',i);
  62101. var text = source_cell.get_text();
  62102. if (text === source_cell.placeholder) {
  62103. text = '';
  62104. }
  62105. //metadata
  62106. target_cell.metadata = source_cell.metadata;
  62107. // attachments (we transfer them so they aren't lost if the
  62108. // cell is turned back into markdown)
  62109. target_cell.attachments = source_cell.attachments;
  62110. target_cell.set_text(text);
  62111. // make this value the starting point, so that we can only undo
  62112. // to this state, instead of a blank cell
  62113. target_cell.code_mirror.clearHistory();
  62114. source_cell.element.remove();
  62115. this.select(i);
  62116. var cursor = source_cell.code_mirror.getCursor();
  62117. target_cell.code_mirror.setCursor(cursor);
  62118. this.set_dirty(true);
  62119. }
  62120. }
  62121. };
  62122. /**
  62123. * Turn one or more cells into Markdown.
  62124. *
  62125. * @param {Array} indices - cell indices to convert
  62126. */
  62127. Notebook.prototype.cells_to_markdown = function (indices) {
  62128. if (indices === undefined) {
  62129. indices = this.get_selected_cells_indices();
  62130. }
  62131. for(var i=0; i < indices.length; i++) {
  62132. this.to_markdown(indices[i]);
  62133. }
  62134. };
  62135. /**
  62136. * Turn a cell into a Markdown cell.
  62137. *
  62138. * @param {integer} [index] - cell index
  62139. */
  62140. Notebook.prototype.to_markdown = function (index) {
  62141. var i = this.index_or_selected(index);
  62142. if (this.is_valid_cell_index(i)) {
  62143. var source_cell = this.get_cell(i);
  62144. if (!(source_cell instanceof textcell.MarkdownCell) && source_cell.is_editable()) {
  62145. var target_cell = this.insert_cell_below('markdown',i);
  62146. this.transfer_to_new_cell(source_cell, target_cell);
  62147. this.select(i);
  62148. if ((source_cell instanceof textcell.TextCell) && source_cell.rendered) {
  62149. target_cell.render();
  62150. }
  62151. var cursor = source_cell.code_mirror.getCursor();
  62152. target_cell.code_mirror.setCursor(cursor);
  62153. this.set_dirty(true);
  62154. }
  62155. }
  62156. };
  62157. /**
  62158. * Turn one or more cells into a raw text cell.
  62159. *
  62160. * @param {Array} indices - cell indices to convert
  62161. */
  62162. Notebook.prototype.cells_to_raw = function (indices) {
  62163. if (indices === undefined) {
  62164. indices = this.get_selected_cells_indices();
  62165. }
  62166. for(var i=0; i < indices.length; i++) {
  62167. this.to_raw(indices[i]);
  62168. }
  62169. };
  62170. /**
  62171. * Turn a cell into a raw text cell.
  62172. *
  62173. * @param {integer} [index] - cell index
  62174. */
  62175. Notebook.prototype.to_raw = function (index) {
  62176. var i = this.index_or_selected(index);
  62177. if (this.is_valid_cell_index(i)) {
  62178. var target_cell = null;
  62179. var source_cell = this.get_cell(i);
  62180. if (!(source_cell instanceof textcell.RawCell) && source_cell.is_editable()) {
  62181. target_cell = this.insert_cell_below('raw',i);
  62182. this.transfer_to_new_cell(source_cell, target_cell);
  62183. this.select(i);
  62184. var cursor = source_cell.code_mirror.getCursor();
  62185. target_cell.code_mirror.setCursor(cursor);
  62186. this.set_dirty(true);
  62187. }
  62188. }
  62189. };
  62190. /**
  62191. * Warn about heading cell support removal.
  62192. */
  62193. Notebook.prototype._warn_heading = function () {
  62194. dialog.modal({
  62195. notebook: this,
  62196. keyboard_manager: this.keyboard_manager,
  62197. title : i18n.msg._("Use markdown headings"),
  62198. body : $("<p/>").text(
  62199. i18n.msg._('Jupyter no longer uses special heading cells. ' +
  62200. 'Instead, write your headings in Markdown cells using # characters:')
  62201. ).append($('<pre/>').text(
  62202. i18n.msg._('## This is a level 2 heading')
  62203. )),
  62204. buttons : {
  62205. "OK" : {}
  62206. }
  62207. });
  62208. };
  62209. /**
  62210. * Turn a cell into a heading containing markdown cell.
  62211. *
  62212. * @param {integer} [index] - cell index
  62213. * @param {integer} [level] - heading level (e.g., 1 for h1)
  62214. */
  62215. Notebook.prototype.to_heading = function (index, level) {
  62216. this.to_markdown(index);
  62217. level = level || 1;
  62218. var i = this.index_or_selected(index);
  62219. if (this.is_valid_cell_index(i)) {
  62220. var cell = this.get_cell(i);
  62221. cell.set_heading_level(level);
  62222. this.set_dirty(true);
  62223. }
  62224. };
  62225. // Cut/Copy/Paste
  62226. /**
  62227. * Enable the UI elements for pasting cells.
  62228. */
  62229. Notebook.prototype.enable_paste = function () {
  62230. var that = this;
  62231. if (!this.paste_enabled) {
  62232. $('#paste_cell_replace').removeClass('disabled')
  62233. $('#paste_cell_replace > a').attr('aria-disabled', 'false');
  62234. $('#paste_cell_above').removeClass('disabled')
  62235. $('#paste_cell_above > a').attr('aria-disabled', 'false');
  62236. $('#paste_cell_below').removeClass('disabled')
  62237. $('#paste_cell_below > a').attr('aria-disabled', 'false');
  62238. this.paste_enabled = true;
  62239. }
  62240. };
  62241. /**
  62242. * Disable the UI elements for pasting cells.
  62243. */
  62244. Notebook.prototype.disable_paste = function () {
  62245. if (this.paste_enabled) {
  62246. $('#paste_cell_replace').addClass('disabled');
  62247. $('#paste_cell_replace > a').attr('aria-disabled', 'true');
  62248. $('#paste_cell_above').addClass('disabled');
  62249. $('#paste_cell_above > a').attr('aria-disabled', 'true');
  62250. $('#paste_cell_below').addClass('disabled');
  62251. $('#paste_cell_below > a').attr('aria-disabled', 'true');
  62252. this.paste_enabled = false;
  62253. }
  62254. };
  62255. /**
  62256. * Cut a cell.
  62257. */
  62258. Notebook.prototype.cut_cell = function () {
  62259. this.copy_cell();
  62260. this.delete_cell();
  62261. };
  62262. /**
  62263. * Copy cells.
  62264. */
  62265. Notebook.prototype.copy_cell = function () {
  62266. var cells = this.get_selected_cells();
  62267. if (cells.length === 0) {
  62268. cells = [this.get_selected_cell()];
  62269. }
  62270. this.clipboard = [];
  62271. var cell_json;
  62272. for (var i=0; i < cells.length; i++) {
  62273. cell_json = cells[i].toJSON();
  62274. if (cell_json.metadata.deletable !== undefined) {
  62275. delete cell_json.metadata.deletable;
  62276. }
  62277. if (cell_json.id !== undefined) {
  62278. delete cell_json.id;
  62279. }
  62280. this.clipboard.push(cell_json);
  62281. }
  62282. this.enable_paste();
  62283. };
  62284. /**
  62285. * Replace the selected cell with the cells in the clipboard.
  62286. */
  62287. Notebook.prototype.paste_cell_replace = function () {
  62288. if (!(this.clipboard !== null && this.paste_enabled)) {
  62289. return;
  62290. }
  62291. var selected = this.get_selected_cells_indices();
  62292. var insertion_index = selected[0];
  62293. this.delete_cells(selected);
  62294. for (var i=this.clipboard.length-1; i >= 0; i--) {
  62295. var cell_data = this.clipboard[i];
  62296. var new_cell = this.insert_cell_at_index(cell_data.cell_type, insertion_index);
  62297. new_cell.fromJSON(cell_data);
  62298. }
  62299. this.select(insertion_index+this.clipboard.length-1);
  62300. };
  62301. /**
  62302. * Paste cells from the clipboard above the selected cell.
  62303. */
  62304. Notebook.prototype.paste_cell_above = function () {
  62305. if (this.clipboard !== null && this.paste_enabled) {
  62306. var first_inserted = null;
  62307. for (var i=0; i < this.clipboard.length; i++) {
  62308. var cell_data = this.clipboard[i];
  62309. var new_cell = this.insert_cell_above(cell_data.cell_type);
  62310. new_cell.fromJSON(cell_data);
  62311. if (first_inserted === null) {
  62312. first_inserted = new_cell;
  62313. }
  62314. }
  62315. first_inserted.focus_cell();
  62316. }
  62317. };
  62318. /**
  62319. * Paste cells from the clipboard below the selected cell.
  62320. */
  62321. Notebook.prototype.paste_cell_below = function () {
  62322. if (this.clipboard !== null && this.paste_enabled) {
  62323. var first_inserted = null;
  62324. for (var i = this.clipboard.length-1; i >= 0; i--) {
  62325. var cell_data = this.clipboard[i];
  62326. var new_cell = this.insert_cell_below(cell_data.cell_type);
  62327. new_cell.fromJSON(cell_data);
  62328. if (first_inserted === null) {
  62329. first_inserted = new_cell;
  62330. }
  62331. }
  62332. first_inserted.focus_cell();
  62333. }
  62334. };
  62335. /**
  62336. * Re-render the output of a code cell.
  62337. */
  62338. Notebook.prototype.render_cell_output = function (code_cell) {
  62339. var cell_data = code_cell.toJSON();
  62340. var cell_index = this.find_cell_index(code_cell);
  62341. var trusted = code_cell.output_area.trusted;
  62342. this.clear_output(cell_index);
  62343. code_cell.output_area.trusted = trusted;
  62344. code_cell.fromJSON(cell_data);
  62345. };
  62346. // Split/merge
  62347. /**
  62348. * Split the selected cell into two cells.
  62349. */
  62350. Notebook.prototype.split_cell = function () {
  62351. var cell = this.get_selected_cell();
  62352. if (cell.is_splittable()) {
  62353. var text_list = cell.get_split_text();
  62354. for (var i = 0; i < text_list.length-1; i++) {
  62355. // Create new cell with same type
  62356. var new_cell = this.insert_cell_above(cell.cell_type);
  62357. // Unrender the new cell so we can call set_text.
  62358. new_cell.unrender();
  62359. new_cell.set_text(text_list[i]);
  62360. // Duplicate metadata
  62361. new_cell.metadata = JSON.parse(JSON.stringify(cell.metadata));
  62362. }
  62363. // Original cell becomes the last one
  62364. // so we don't need to worry about selection
  62365. cell.set_text(text_list[text_list.length-1]);
  62366. }
  62367. };
  62368. /**
  62369. * Merge a series of cells into one
  62370. *
  62371. * @param {Array} indices - the numeric indices of the cells to be merged
  62372. * @param {boolean} into_last - merge into the last cell instead of the first
  62373. */
  62374. Notebook.prototype.merge_cells = function(indices, into_last) {
  62375. if (indices.length <= 1) {
  62376. return;
  62377. }
  62378. // Check if trying to merge above on topmost cell or wrap around
  62379. // when merging above, see #330
  62380. if (indices.filter(function(item) {return item < 0;}).length > 0) {
  62381. return;
  62382. }
  62383. for (var i=0; i < indices.length; i++) {
  62384. if (!this.get_cell(indices[i]).is_mergeable()) {
  62385. return;
  62386. }
  62387. }
  62388. var target = this.get_cell(into_last ? indices.pop() : indices.shift());
  62389. // Get all the cells' contents
  62390. var contents = [];
  62391. for (i=0; i < indices.length; i++) {
  62392. contents.push(this.get_cell(indices[i]).get_text());
  62393. }
  62394. if (into_last) {
  62395. contents.push(target.get_text());
  62396. } else {
  62397. contents.unshift(target.get_text());
  62398. }
  62399. // Update the contents of the target cell
  62400. if (target instanceof codecell.CodeCell) {
  62401. target.set_text(contents.join('\n\n'));
  62402. } else {
  62403. var was_rendered = target.rendered;
  62404. target.unrender(); // Must unrender before we set_text.
  62405. target.set_text(contents.join('\n\n'));
  62406. if (was_rendered) {
  62407. // The rendered state of the final cell should match
  62408. // that of the original selected cell;
  62409. target.render();
  62410. }
  62411. }
  62412. // Delete the other cells
  62413. this.delete_cells(indices);
  62414. // Reset the target cell's undo history
  62415. target.code_mirror.clearHistory();
  62416. this.select(this.find_cell_index(target));
  62417. };
  62418. /**
  62419. * Merge the selected range of cells
  62420. */
  62421. Notebook.prototype.merge_selected_cells = function() {
  62422. this.merge_cells(this.get_selected_cells_indices());
  62423. };
  62424. /**
  62425. * Merge the selected cell into the cell above it.
  62426. */
  62427. Notebook.prototype.merge_cell_above = function () {
  62428. var index = this.get_selected_index();
  62429. this.merge_cells([index-1, index], true);
  62430. };
  62431. /**
  62432. * Merge the selected cell into the cell below it.
  62433. */
  62434. Notebook.prototype.merge_cell_below = function () {
  62435. var index = this.get_selected_index();
  62436. this.merge_cells([index, index+1], false);
  62437. };
  62438. // Attachments handling
  62439. /**
  62440. * Shows a dialog letting the user pick an image from her computer and
  62441. * insert it into the edited markdown cell
  62442. */
  62443. Notebook.prototype.insert_image = function () {
  62444. var that = this;
  62445. var cell = this.get_selected_cell();
  62446. // The following should not happen as the menu item is greyed out
  62447. // when those conditions are not fulfilled (see MarkdownCell
  62448. // unselect/select/unrender handlers)
  62449. if (cell.cell_type !== 'markdown') {
  62450. console.log('Error: insert_image called on non-markdown cell');
  62451. return;
  62452. }
  62453. if (cell.rendered) {
  62454. console.log('Error: insert_image called on rendered cell');
  62455. return;
  62456. }
  62457. dialog.insert_image({
  62458. callback: function(file) {
  62459. cell.edit_mode();
  62460. cell.insert_inline_image_from_blob(file);
  62461. },
  62462. notebook: this,
  62463. keyboard_manager: this.keyboard_manager
  62464. });
  62465. };
  62466. /**
  62467. * Cut the attachments of a cell
  62468. */
  62469. Notebook.prototype.cut_cell_attachments = function() {
  62470. var cell = this.get_selected_cell();
  62471. if (cell.attachments !== undefined) {
  62472. this.clipboard_attachments = cell.attachments;
  62473. this.enable_attachments_paste();
  62474. delete cell.attachments;
  62475. cell.unrender();
  62476. cell.render();
  62477. }
  62478. };
  62479. /**
  62480. * Copy the attachments of a cell
  62481. */
  62482. Notebook.prototype.copy_cell_attachments = function() {
  62483. var cell = this.get_selected_cell();
  62484. if (cell.attachments !== undefined) {
  62485. // Do a deep copy of attachments to avoid subsequent modification
  62486. // to the cell to modify the clipboard
  62487. this.clipboard_attachments = $.extend(true, {}, cell.attachments);
  62488. this.enable_attachments_paste();
  62489. }
  62490. };
  62491. /**
  62492. * Paste the attachments in the clipboard into the currently selected
  62493. * cell
  62494. */
  62495. Notebook.prototype.paste_cell_attachments = function() {
  62496. if (this.clipboard_attachments !== null &&
  62497. this.paste_attachments_enabled) {
  62498. var cell = this.get_selected_cell();
  62499. if (cell.attachments === undefined) {
  62500. cell.attachments = {};
  62501. }
  62502. // Do a deep copy so we can paste multiple times
  62503. $.extend(true, cell.attachments, this.clipboard_attachments);
  62504. cell.unrender();
  62505. cell.render();
  62506. }
  62507. };
  62508. /**
  62509. * Disable the "Paste Cell Attachments" menu item
  62510. */
  62511. Notebook.prototype.disable_attachments_paste = function () {
  62512. if (this.paste_attachments_enabled) {
  62513. $('#paste_cell_attachments').addClass('disabled');
  62514. $('#paste_cell_attachments > a').attr('disabled','true');
  62515. this.paste_attachments_enabled = false;
  62516. }
  62517. };
  62518. /**
  62519. * Enable the "Paste Cell Attachments" menu item
  62520. */
  62521. Notebook.prototype.enable_attachments_paste = function () {
  62522. if (!this.paste_attachments_enabled) {
  62523. $('#paste_cell_attachments').removeClass('disabled');
  62524. $('#paste_cell_attachments > a').attr('aria-disabled','false');
  62525. this.paste_attachments_enabled = true;
  62526. }
  62527. };
  62528. /**
  62529. * Enable/disable the "Insert image" menu item
  62530. */
  62531. Notebook.prototype.set_insert_image_enabled = function(enabled) {
  62532. if (enabled) {
  62533. $('#insert_image').removeClass('disabled');
  62534. $('#insert_image > a').attr('aria-disabled', 'false');
  62535. } else {
  62536. $('#insert_image').addClass('disabled');
  62537. $('#insert_image > a').attr('aria-disabled', 'true');
  62538. }
  62539. };
  62540. // Cell collapsing and output clearing
  62541. /**
  62542. * Hide a cell's output.
  62543. *
  62544. * @param {integer} index - cell index
  62545. */
  62546. Notebook.prototype.collapse_output = function (index) {
  62547. var i = this.index_or_selected(index);
  62548. var cell = this.get_cell(i);
  62549. if (cell !== null && (cell instanceof codecell.CodeCell)) {
  62550. cell.collapse_output();
  62551. this.set_dirty(true);
  62552. }
  62553. };
  62554. /**
  62555. * Hide each code cell's output area.
  62556. */
  62557. Notebook.prototype.collapse_all_output = function () {
  62558. this.get_cells().map(function (cell) {
  62559. if (cell instanceof codecell.CodeCell) {
  62560. cell.collapse_output();
  62561. }
  62562. });
  62563. // this should not be set if the `collapse` key is removed from nbformat
  62564. this.set_dirty(true);
  62565. };
  62566. /**
  62567. * Show a cell's output.
  62568. *
  62569. * @param {integer} index - cell index
  62570. */
  62571. Notebook.prototype.expand_output = function (index) {
  62572. var i = this.index_or_selected(index);
  62573. var cell = this.get_cell(i);
  62574. if (cell !== null && (cell instanceof codecell.CodeCell)) {
  62575. cell.expand_output();
  62576. this.set_dirty(true);
  62577. }
  62578. };
  62579. /**
  62580. * Expand each code cell's output area, and remove scrollbars.
  62581. */
  62582. Notebook.prototype.expand_all_output = function () {
  62583. this.get_cells().map(function (cell) {
  62584. if (cell instanceof codecell.CodeCell) {
  62585. cell.expand_output();
  62586. }
  62587. });
  62588. // this should not be set if the `collapse` key is removed from nbformat
  62589. this.set_dirty(true);
  62590. };
  62591. /**
  62592. * Clear a code cell's output area.
  62593. *
  62594. * @param {integer} index - cell index
  62595. */
  62596. Notebook.prototype.clear_output = function (index) {
  62597. var i = this.index_or_selected(index);
  62598. var cell = this.get_cell(i);
  62599. if (cell !== null && (cell instanceof codecell.CodeCell)) {
  62600. cell.clear_output();
  62601. this.set_dirty(true);
  62602. }
  62603. };
  62604. /**
  62605. * Clear multiple selected code cells' output areas.
  62606. *
  62607. */
  62608. Notebook.prototype.clear_cells_outputs = function(indices) {
  62609. if (!indices) {
  62610. indices = this.get_selected_cells_indices();
  62611. }
  62612. for (var i = 0; i < indices.length; i++){
  62613. this.clear_output(indices[i]);
  62614. }
  62615. };
  62616. /**
  62617. * Clear each code cell's output area.
  62618. */
  62619. Notebook.prototype.clear_all_output = function () {
  62620. this.get_cells().map(function (cell) {
  62621. if (cell instanceof codecell.CodeCell) {
  62622. cell.clear_output();
  62623. }
  62624. });
  62625. this.set_dirty(true);
  62626. };
  62627. /**
  62628. * Scroll the selected CodeCell's output area.
  62629. *
  62630. * @param {integer} index - cell index
  62631. */
  62632. Notebook.prototype.scroll_output = function (index) {
  62633. var i = this.index_or_selected(index);
  62634. var cell = this.get_cell(i);
  62635. if (cell !== null && (cell instanceof codecell.CodeCell)) {
  62636. cell.scroll_output();
  62637. this.set_dirty(true);
  62638. }
  62639. };
  62640. /**
  62641. * Expand each code cell's output area and add a scrollbar for long output.
  62642. */
  62643. Notebook.prototype.scroll_all_output = function () {
  62644. this.get_cells().map(function (cell, i) {
  62645. if (cell instanceof codecell.CodeCell) {
  62646. cell.scroll_output();
  62647. }
  62648. });
  62649. // this should not be set if the `collapse` key is removed from nbformat
  62650. this.set_dirty(true);
  62651. };
  62652. /**
  62653. * Toggle whether a cell's output is collapsed or expanded.
  62654. *
  62655. * @param {integer} index - cell index
  62656. */
  62657. Notebook.prototype.toggle_output = function (index) {
  62658. var i = this.index_or_selected(index);
  62659. var cell = this.get_cell(i);
  62660. if (cell !== null && (cell instanceof codecell.CodeCell)) {
  62661. cell.toggle_output();
  62662. this.set_dirty(true);
  62663. }
  62664. };
  62665. /**
  62666. * Toggle whether all selected cells' outputs are collapsed or expanded.
  62667. *
  62668. * @param {integer} indices - the indices of the cells to toggle
  62669. */
  62670. Notebook.prototype.toggle_cells_outputs = function(indices) {
  62671. if (!indices) {
  62672. indices = this.get_selected_cells_indices();
  62673. }
  62674. for (var i = 0; i < indices.length; i++){
  62675. this.toggle_output(indices[i]);
  62676. }
  62677. };
  62678. /**
  62679. * Toggle the output of all cells.
  62680. */
  62681. Notebook.prototype.toggle_all_output = function () {
  62682. this.get_cells().map(function (cell) {
  62683. if (cell instanceof codecell.CodeCell) {
  62684. cell.toggle_output();
  62685. }
  62686. });
  62687. // this should not be set if the `collapse` key is removed from nbformat
  62688. this.set_dirty(true);
  62689. };
  62690. /**
  62691. * Toggle a scrollbar for long cell outputs.
  62692. *
  62693. * @param {integer} index - cell index
  62694. */
  62695. Notebook.prototype.toggle_output_scroll = function (index) {
  62696. var i = this.index_or_selected(index);
  62697. var cell = this.get_cell(i);
  62698. if (cell !== null && (cell instanceof codecell.CodeCell)) {
  62699. cell.toggle_output_scroll();
  62700. this.set_dirty(true);
  62701. }
  62702. };
  62703. /**
  62704. * Toggle a scrollbar for selected long cells' outputs.
  62705. *
  62706. * @param {integer} indices - the indices of the cells to toggle
  62707. */
  62708. Notebook.prototype.toggle_cells_outputs_scroll = function(indices) {
  62709. if (!indices) {
  62710. indices = this.get_selected_cells_indices();
  62711. }
  62712. for (var i = 0; i < indices.length; i++){
  62713. this.toggle_output_scroll(indices[i]);
  62714. }
  62715. };
  62716. /**
  62717. * Toggle the scrolling of long output on all cells.
  62718. */
  62719. Notebook.prototype.toggle_all_output_scroll = function () {
  62720. this.get_cells().map(function (cell) {
  62721. if (cell instanceof codecell.CodeCell) {
  62722. cell.toggle_output_scroll();
  62723. }
  62724. });
  62725. // this should not be set if the `collapse` key is removed from nbformat
  62726. this.set_dirty(true);
  62727. };
  62728. // Other cell functions: line numbers, ...
  62729. /**
  62730. * Toggle line numbers in the selected cell's input area.
  62731. */
  62732. Notebook.prototype.cell_toggle_line_numbers = function() {
  62733. this.get_selected_cells().map(function(cell){cell.toggle_line_numbers();});
  62734. };
  62735. //dispatch codemirror mode to all cells.
  62736. Notebook.prototype._dispatch_mode = function(spec, newmode){
  62737. this.codemirror_mode = newmode;
  62738. codecell.CodeCell.options_default.cm_config.mode = newmode;
  62739. this.get_cells().map(function(cell) {
  62740. if (cell.cell_type === 'code'){
  62741. cell.code_mirror.setOption('mode', spec);
  62742. // This is currently redundant, because cm_config ends up as
  62743. // codemirror's own .options object, but I don't want to
  62744. // rely on that.
  62745. cell._options.cm_config.mode = spec;
  62746. }
  62747. });
  62748. };
  62749. // roughly try to check mode equality
  62750. var _mode_equal = function(mode1, mode2){
  62751. return ((mode1||{}).name||mode1)===((mode2||{}).name||mode2);
  62752. };
  62753. /**
  62754. * Set the codemirror mode for all code cells, including the default for
  62755. * new code cells.
  62756. * Set the mode to 'null' (no highlighting) if it can't be found.
  62757. */
  62758. Notebook.prototype.set_codemirror_mode = function(newmode){
  62759. // if mode is the same don't reset,
  62760. // to avoid n-time re-highlighting.
  62761. if (_mode_equal(newmode, this.codemirror_mode)) {
  62762. return;
  62763. }
  62764. var that = this;
  62765. utils.requireCodeMirrorMode(newmode, function (spec) {
  62766. that._dispatch_mode(spec, newmode);
  62767. }, function(){
  62768. // on error don't dispatch the new mode as re-setting it later will not work.
  62769. // don't either set to null mode if it has been changed in the meantime
  62770. if( _mode_equal(newmode, that.codemirror_mode) ){
  62771. that._dispatch_mode('null','null');
  62772. }
  62773. });
  62774. };
  62775. // Session related things
  62776. /**
  62777. * Start a new session and set it on each code cell.
  62778. */
  62779. Notebook.prototype.start_session = function (kernel_name) {
  62780. if (this._session_starting) {
  62781. throw new session.SessionAlreadyStarting();
  62782. }
  62783. this._session_starting = true;
  62784. var options = {
  62785. base_url: this.base_url,
  62786. ws_url: this.ws_url,
  62787. notebook_path: this.notebook_path,
  62788. notebook_name: this.notebook_name,
  62789. kernel_name: kernel_name,
  62790. notebook: this
  62791. };
  62792. var success = $.proxy(this._session_started, this);
  62793. var failure = $.proxy(this._session_start_failed, this);
  62794. if (this.session && this.session.kernel) {
  62795. this.session.restart(options, success, failure);
  62796. } else {
  62797. this.session = new session.Session(options);
  62798. this.session.start(success, failure);
  62799. }
  62800. };
  62801. /**
  62802. * Once a session is started, link the code cells to the kernel and pass the
  62803. * comm manager to the widget manager.
  62804. */
  62805. Notebook.prototype._session_started = function (){
  62806. this._session_starting = false;
  62807. this.kernel = this.session.kernel;
  62808. var ncells = this.ncells();
  62809. for (var i=0; i<ncells; i++) {
  62810. var cell = this.get_cell(i);
  62811. if (cell instanceof codecell.CodeCell) {
  62812. cell.set_kernel(this.session.kernel);
  62813. }
  62814. }
  62815. };
  62816. /**
  62817. * Called when the session fails to start.
  62818. */
  62819. Notebook.prototype._session_start_failed = function(jqxhr, status, error){
  62820. this._session_starting = false;
  62821. utils.log_ajax_error(jqxhr, status, error);
  62822. };
  62823. /**
  62824. * Prompt the user to restart the kernel and re-run everything.
  62825. * if options.confirm === false, no confirmation dialog is shown.
  62826. */
  62827. Notebook.prototype.restart_run_all = function (options) {
  62828. var that = this;
  62829. var restart_options = {};
  62830. restart_options.confirm = (options || {}).confirm;
  62831. restart_options.dialog = {
  62832. notebook: that,
  62833. keyboard_manager: that.keyboard_manager,
  62834. title : i18n.msg._("Restart kernel and re-run the whole notebook?"),
  62835. body : $("<p/>").text(
  62836. i18n.msg._('Are you sure you want to restart the current kernel and re-execute the whole notebook? All variables and outputs will be lost.')
  62837. ),
  62838. buttons : {
  62839. "Restart and Run All Cells" : {
  62840. "class" : "btn-danger",
  62841. "click" : function () {
  62842. that.execute_all_cells();
  62843. },
  62844. },
  62845. }
  62846. };
  62847. return this._restart_kernel(restart_options);
  62848. };
  62849. /**
  62850. * Prompt the user to restart the kernel and clear output.
  62851. * if options.confirm === false, no confirmation dialog is shown.
  62852. */
  62853. Notebook.prototype.restart_clear_output = function (options) {
  62854. var that = this;
  62855. var restart_options = {};
  62856. restart_options.confirm = (options || {}).confirm;
  62857. restart_options.dialog = {
  62858. notebook: that,
  62859. keyboard_manager: that.keyboard_manager,
  62860. title : i18n.msg._("Restart kernel and clear all output?"),
  62861. body : $("<p/>").text(
  62862. i18n.msg._('Do you want to restart the current kernel and clear all output? All variables and outputs will be lost.')
  62863. ),
  62864. buttons : {
  62865. "Restart and Clear All Outputs" : {
  62866. "class" : "btn-danger",
  62867. "click" : function (){
  62868. that.clear_all_output();
  62869. },
  62870. },
  62871. }
  62872. };
  62873. return this._restart_kernel(restart_options);
  62874. };
  62875. /**
  62876. * Prompt the user to restart the kernel.
  62877. * if options.confirm === false, no confirmation dialog is shown.
  62878. */
  62879. Notebook.prototype.shutdown_kernel = function (options) {
  62880. var that = this;
  62881. var shutdown_options = {};
  62882. shutdown_options.confirm = (options || {}).confirm;
  62883. shutdown_options.dialog = {
  62884. title : "Shutdown kernel?",
  62885. body : $("<p/>").text(
  62886. i18n.msg._('Do you want to shutdown the current kernel? All variables will be lost.')
  62887. ),
  62888. buttons : {
  62889. "Shutdown" : {
  62890. "class" : "btn-danger",
  62891. "click" : function () {},
  62892. },
  62893. }
  62894. };
  62895. shutdown_options.kernel_action = function() {
  62896. that.session.delete();
  62897. };
  62898. return this._restart_kernel(shutdown_options);
  62899. };
  62900. Notebook.prototype.restart_kernel = function (options) {
  62901. var restart_options = {};
  62902. restart_options.confirm = (options || {}).confirm;
  62903. restart_options.dialog = {
  62904. title : i18n.msg._("Restart kernel?"),
  62905. body : $("<p/>").text(
  62906. i18n.msg._('Do you want to restart the current kernel? All variables will be lost.')
  62907. ),
  62908. buttons : {
  62909. "Restart" : {
  62910. "class" : "btn-danger",
  62911. "click" : function () {},
  62912. },
  62913. }
  62914. };
  62915. return this._restart_kernel(restart_options);
  62916. };
  62917. // inner implementation of restart dialog & promise
  62918. Notebook.prototype._restart_kernel = function (options) {
  62919. var that = this;
  62920. options = options || {};
  62921. var resolve_promise, reject_promise;
  62922. var promise = new Promise(function (resolve, reject){
  62923. resolve_promise = resolve;
  62924. reject_promise = reject;
  62925. });
  62926. function restart_and_resolve () {
  62927. that.kernel.restart(function () {
  62928. // resolve when the kernel is *ready* not just started
  62929. that.events.one('kernel_ready.Kernel', resolve_promise);
  62930. }, reject_promise);
  62931. }
  62932. var do_kernel_action = options.kernel_action || restart_and_resolve;
  62933. // no need to confirm if the kernel is not connected
  62934. if (options.confirm === false || !that.kernel.is_connected()) {
  62935. var default_button = options.dialog.buttons[Object.keys(options.dialog.buttons)[0]];
  62936. promise.then(default_button.click);
  62937. do_kernel_action();
  62938. return promise;
  62939. }
  62940. options.dialog.notebook = this;
  62941. options.dialog.keyboard_manager = this.keyboard_manager;
  62942. // add 'Continue running' cancel button
  62943. var buttons = {
  62944. "Continue Running": {},
  62945. };
  62946. // hook up button.click actions after restart promise resolves
  62947. Object.keys(options.dialog.buttons).map(function (key) {
  62948. var button = buttons[key] = options.dialog.buttons[key];
  62949. var click = button.click;
  62950. button.click = function () {
  62951. promise.then(click);
  62952. do_kernel_action();
  62953. };
  62954. });
  62955. options.dialog.buttons = buttons;
  62956. dialog.modal(options.dialog);
  62957. return promise;
  62958. };
  62959. /**
  62960. *
  62961. * Halt the kernel and close the notebook window
  62962. */
  62963. Notebook.prototype.close_and_halt = function () {
  62964. var close_window = function () {
  62965. /**
  62966. * allow closing of new tabs in Chromium, impossible in FF
  62967. */
  62968. window.open('', '_self', '');
  62969. window.close();
  62970. };
  62971. // finish with close on success or failure
  62972. this.session.delete(close_window, close_window);
  62973. };
  62974. /**
  62975. * Execute cells corresponding to the given indices.
  62976. *
  62977. * @param {Array} indices - indices of the cells to execute
  62978. */
  62979. Notebook.prototype.execute_cells = function (indices) {
  62980. if (indices.length === 0) {
  62981. return;
  62982. }
  62983. var cell;
  62984. for (var i = 0; i < indices.length; i++) {
  62985. cell = this.get_cell(indices[i]);
  62986. cell.execute();
  62987. }
  62988. this.select(indices[indices.length - 1]);
  62989. this.command_mode();
  62990. this.set_dirty(true);
  62991. };
  62992. /**
  62993. * Execute or render cell outputs and go into command mode.
  62994. */
  62995. Notebook.prototype.execute_selected_cells = function () {
  62996. this.execute_cells(this.get_selected_cells_indices());
  62997. };
  62998. /**
  62999. * Alias for execute_selected_cells, for backwards compatibility --
  63000. * previously, doing "Run Cell" would only ever run a single cell (hence
  63001. * `execute_cell`), but now it runs all marked cells, so that's the
  63002. * preferable function to use. But it is good to keep this function to avoid
  63003. * breaking existing extensions, etc.
  63004. */
  63005. Notebook.prototype.execute_cell = function () {
  63006. this.execute_selected_cells();
  63007. };
  63008. /**
  63009. * Execute or render cell outputs and insert a new cell below.
  63010. */
  63011. Notebook.prototype.execute_cell_and_insert_below = function () {
  63012. var indices = this.get_selected_cells_indices();
  63013. var cell_index;
  63014. if (indices.length > 1) {
  63015. this.execute_cells(indices);
  63016. cell_index = Math.max.apply(Math, indices);
  63017. } else {
  63018. var cell = this.get_selected_cell();
  63019. cell_index = this.find_cell_index(cell);
  63020. cell.execute();
  63021. }
  63022. // If we are at the end always insert a new cell and return
  63023. if (cell_index === (this.ncells()-1)) {
  63024. this.command_mode();
  63025. this.insert_cell_below();
  63026. this.select(cell_index+1);
  63027. this.edit_mode();
  63028. this.scroll_to_bottom();
  63029. this.set_dirty(true);
  63030. return;
  63031. }
  63032. this.command_mode();
  63033. this.insert_cell_below();
  63034. this.select(cell_index+1);
  63035. this.edit_mode();
  63036. this.set_dirty(true);
  63037. };
  63038. /**
  63039. * Execute or render cell outputs and select the next cell.
  63040. */
  63041. Notebook.prototype.execute_cell_and_select_below = function () {
  63042. var indices = this.get_selected_cells_indices();
  63043. var cell_index;
  63044. if (indices.length > 1) {
  63045. this.execute_cells(indices);
  63046. cell_index = Math.max.apply(Math, indices);
  63047. } else {
  63048. var cell = this.get_selected_cell();
  63049. cell_index = this.find_cell_index(cell);
  63050. cell.execute();
  63051. }
  63052. // If we are at the end always insert a new cell and return
  63053. if (cell_index === (this.ncells()-1)) {
  63054. this.command_mode();
  63055. this.insert_cell_below();
  63056. this.select(cell_index+1);
  63057. this.edit_mode();
  63058. this.scroll_to_bottom();
  63059. this.set_dirty(true);
  63060. return;
  63061. }
  63062. this.command_mode();
  63063. this.select(cell_index+1);
  63064. this.focus_cell();
  63065. this.set_dirty(true);
  63066. };
  63067. /**
  63068. * Execute all cells below the selected cell.
  63069. */
  63070. Notebook.prototype.execute_cells_below = function () {
  63071. this.execute_cell_range(this.get_selected_index(), this.ncells());
  63072. this.scroll_to_bottom();
  63073. };
  63074. /**
  63075. * Execute all cells above the selected cell.
  63076. */
  63077. Notebook.prototype.execute_cells_above = function () {
  63078. this.execute_cell_range(0, this.get_selected_index());
  63079. };
  63080. /**
  63081. * Execute all cells.
  63082. */
  63083. Notebook.prototype.execute_all_cells = function () {
  63084. this.execute_cell_range(0, this.ncells());
  63085. this.scroll_to_bottom();
  63086. };
  63087. /**
  63088. * Execute a contiguous range of cells.
  63089. *
  63090. * @param {integer} start - index of the first cell to execute (inclusive)
  63091. * @param {integer} end - index of the last cell to execute (exclusive)
  63092. */
  63093. Notebook.prototype.execute_cell_range = function (start, end) {
  63094. this.command_mode();
  63095. var indices = [];
  63096. for (var i=start; i<end; i++) {
  63097. indices.push(i);
  63098. }
  63099. this.execute_cells(indices);
  63100. };
  63101. // Persistance and loading
  63102. /**
  63103. * Getter method for this notebook's name.
  63104. *
  63105. * @return {string} This notebook's name (excluding file extension)
  63106. */
  63107. Notebook.prototype.get_notebook_name = function () {
  63108. return utils.splitext(this.notebook_name)[0];
  63109. };
  63110. /**
  63111. * Setter method for this notebook's name.
  63112. *
  63113. * @param {string} name
  63114. */
  63115. Notebook.prototype.set_notebook_name = function (name) {
  63116. var parent = utils.url_path_split(this.notebook_path)[0];
  63117. this.notebook_name = name;
  63118. this.notebook_path = utils.url_path_join(parent, name);
  63119. };
  63120. /**
  63121. * Check that a notebook's name is valid.
  63122. *
  63123. * @param {string} nbname - A name for this notebook
  63124. * @return {boolean} True if the name is valid, false if invalid
  63125. */
  63126. Notebook.prototype.test_notebook_name = function (nbname) {
  63127. nbname = nbname || '';
  63128. return nbname.length > 0 && !this.notebook_name_blacklist_re.test(nbname);
  63129. };
  63130. /**
  63131. Move the unused attachments garbage collection logic to TextCell.toJSON.
  63132. * Load a notebook from JSON (.ipynb).
  63133. *
  63134. * @param {object} data - JSON representation of a notebook
  63135. */
  63136. Notebook.prototype.fromJSON = function (data) {
  63137. var content = data.content;
  63138. var ncells = this.ncells();
  63139. var i;
  63140. for (i=0; i<ncells; i++) {
  63141. // Always delete cell 0 as they get renumbered as they are deleted.
  63142. this._unsafe_delete_cell(0);
  63143. }
  63144. // Save the metadata and name.
  63145. this.metadata = content.metadata;
  63146. this.notebook_name = data.name;
  63147. this.notebook_path = data.path;
  63148. var trusted = true;
  63149. // Set the codemirror mode from language_info metadata
  63150. if (this.metadata.language_info !== undefined) {
  63151. var langinfo = this.metadata.language_info;
  63152. // Mode 'null' should be plain, unhighlighted text.
  63153. var cm_mode = langinfo.codemirror_mode || langinfo.name || 'null';
  63154. this.set_codemirror_mode(cm_mode);
  63155. }
  63156. var new_cells = content.cells;
  63157. ncells = new_cells.length;
  63158. var cell_data = null;
  63159. var new_cell = null;
  63160. for (i=0; i<ncells; i++) {
  63161. cell_data = new_cells[i];
  63162. new_cell = this.insert_cell_at_index(cell_data.cell_type, i);
  63163. new_cell.fromJSON(cell_data);
  63164. if (new_cell.cell_type === 'code' && !new_cell.output_area.trusted) {
  63165. trusted = false;
  63166. }
  63167. }
  63168. if (trusted !== this.trusted) {
  63169. this.trusted = trusted;
  63170. this.events.trigger("trust_changed.Notebook", trusted);
  63171. }
  63172. this.apply_directionality();
  63173. };
  63174. /**
  63175. * Dump this notebook into a JSON-friendly object.
  63176. *
  63177. * @return {object} A JSON-friendly representation of this notebook.
  63178. */
  63179. Notebook.prototype.toJSON = function () {
  63180. // remove the conversion indicator, which only belongs in-memory
  63181. delete this.metadata.orig_nbformat;
  63182. delete this.metadata.orig_nbformat_minor;
  63183. var cells = this.get_cells();
  63184. var ncells = cells.length;
  63185. var cell_array = new Array(ncells);
  63186. var trusted = true;
  63187. for (var i=0; i<ncells; i++) {
  63188. var cell = cells[i];
  63189. if (cell.cell_type === 'code' && !cell.output_area.trusted) {
  63190. trusted = false;
  63191. }
  63192. cell_array[i] = cell.toJSON(true);
  63193. }
  63194. var data = {
  63195. cells: cell_array,
  63196. metadata: this.metadata,
  63197. nbformat: this.nbformat,
  63198. nbformat_minor: this.nbformat_minor
  63199. };
  63200. if (trusted !== this.trusted) {
  63201. this.trusted = trusted;
  63202. this.events.trigger("trust_changed.Notebook", trusted);
  63203. }
  63204. return data;
  63205. };
  63206. /**
  63207. * Start an autosave timer which periodically saves the notebook.
  63208. *
  63209. * @param {integer} interval - the autosave interval in milliseconds
  63210. */
  63211. Notebook.prototype.set_autosave_interval = function (interval) {
  63212. var that = this;
  63213. // clear previous interval, so we don't get simultaneous timers
  63214. if (this.autosave_timer) {
  63215. clearInterval(this.autosave_timer);
  63216. }
  63217. if (!this.writable) {
  63218. // disable autosave if not writable
  63219. interval = 0;
  63220. }
  63221. this.autosave_interval = this.minimum_autosave_interval = interval;
  63222. if (interval) {
  63223. this.autosave_timer = setInterval(function() {
  63224. if (that.dirty) {
  63225. that.save_notebook();
  63226. }
  63227. }, interval);
  63228. this.events.trigger("autosave_enabled.Notebook", interval);
  63229. } else {
  63230. this.autosave_timer = null;
  63231. this.events.trigger("autosave_disabled.Notebook");
  63232. }
  63233. };
  63234. /**
  63235. * Save this notebook on the server. This becomes a notebook instance's
  63236. * .save_notebook method *after* the entire notebook has been loaded.
  63237. *
  63238. */
  63239. Notebook.prototype.save_notebook = function (check_last_modified) {
  63240. if (check_last_modified === undefined) {
  63241. check_last_modified = true;
  63242. }
  63243. var error;
  63244. if (!this._fully_loaded) {
  63245. error = new Error("Load failed, save is disabled");
  63246. this.events.trigger('notebook_save_failed.Notebook', error);
  63247. return Promise.reject(error);
  63248. } else if (!this.writable) {
  63249. error = new Error("Notebook is read-only");
  63250. this.events.trigger('notebook_save_failed.Notebook', error);
  63251. return Promise.reject(error);
  63252. }
  63253. // Trigger an event before save, which allows listeners to modify
  63254. // the notebook as needed.
  63255. this.events.trigger('before_save.Notebook');
  63256. // Create a JSON model to be sent to the server.
  63257. var model = {
  63258. type : "notebook",
  63259. content : this.toJSON()
  63260. };
  63261. // time the ajax call for autosave tuning purposes.
  63262. var start = new Date().getTime();
  63263. var that = this;
  63264. var _save = function () {
  63265. return that.contents.save(that.notebook_path, model).then(
  63266. $.proxy(that.save_notebook_success, that, start),
  63267. function (error) {
  63268. that.events.trigger('notebook_save_failed.Notebook', error);
  63269. // This hasn't handled the error, so propagate it up
  63270. return Promise.reject(error);
  63271. }
  63272. );
  63273. };
  63274. if (check_last_modified) {
  63275. return this.contents.get(this.notebook_path, {content: false}).then(
  63276. function (data) {
  63277. var last_modified = new Date(data.last_modified);
  63278. var last_modified_check_margin = (that.config.data['last_modified_check_margin'] || 0.5) * 1000; // 500 ms
  63279. // We want to check last_modified (disk) > that.last_modified (our last save)
  63280. // In some cases the filesystem reports an inconsistent time,
  63281. // so we allow 0.5 seconds difference before complaining.
  63282. // This is configurable in nbconfig/notebook.json as `last_modified_check_margin`.
  63283. if ((last_modified.getTime() - that.last_modified.getTime()) > last_modified_check_margin) {
  63284. console.warn("Last saving was done on `"+that.last_modified+"`("+that._last_modified+"), "+
  63285. "while the current file seem to have been saved on `"+data.last_modified+"`");
  63286. if (that._changed_on_disk_dialog !== null) {
  63287. // update save callback on the confirmation button
  63288. that._changed_on_disk_dialog.find('.save-confirm-btn').click(_save);
  63289. //Rebind Click Event on Reload
  63290. that._changed_on_disk_dialog.find('.btn-warning').click(function () {window.location.reload()});
  63291. // redisplay existing dialog
  63292. that._changed_on_disk_dialog.modal('show');
  63293. } else {
  63294. // create new dialog
  63295. that._changed_on_disk_dialog = dialog.modal({
  63296. notebook: that,
  63297. keyboard_manager: that.keyboard_manager,
  63298. title: i18n.msg._("Notebook changed"),
  63299. body: i18n.msg._("The notebook file has changed on disk since the last time we opened or saved it. "
  63300. + "Do you want to overwrite the file on disk with the version open here, or load "
  63301. + "the version on disk (reload the page)?"),
  63302. buttons: {
  63303. Reload: {
  63304. class: 'btn-warning',
  63305. click: function() {
  63306. window.location.reload();
  63307. }
  63308. },
  63309. Cancel: {},
  63310. Overwrite: {
  63311. class: 'btn-danger save-confirm-btn',
  63312. click: function () {
  63313. _save();
  63314. }
  63315. },
  63316. }
  63317. });
  63318. }
  63319. } else {
  63320. return _save();
  63321. }
  63322. }, function () {
  63323. // maybe it has been deleted or renamed? Go ahead and save.
  63324. return _save();
  63325. }
  63326. );
  63327. } else {
  63328. return _save();
  63329. }
  63330. };
  63331. /**
  63332. * Success callback for saving a notebook.
  63333. *
  63334. * @param {integer} start - Time when the save request start
  63335. * @param {object} data - JSON representation of a notebook
  63336. */
  63337. Notebook.prototype.save_notebook_success = function (start, data) {
  63338. this.set_dirty(false);
  63339. this.last_modified = new Date(data.last_modified);
  63340. // debug 484
  63341. this._last_modified = 'save-success:'+data.last_modified;
  63342. if (data.message) {
  63343. // save succeeded, but validation failed.
  63344. var body = $("<div>");
  63345. var title = i18n.msg._("Notebook validation failed");
  63346. body.append($("<p>").text(
  63347. i18n.msg._("The save operation succeeded," +
  63348. " but the notebook does not appear to be valid." +
  63349. " The validation error was:")
  63350. )).append($("<div>").addClass("validation-error").append(
  63351. $("<pre>").text(data.message)
  63352. ));
  63353. dialog.modal({
  63354. notebook: this,
  63355. keyboard_manager: this.keyboard_manager,
  63356. title: title,
  63357. body: body,
  63358. buttons : {
  63359. OK : {
  63360. "class" : "btn-primary"
  63361. }
  63362. }
  63363. });
  63364. }
  63365. this.events.trigger('notebook_saved.Notebook');
  63366. this._update_autosave_interval(start);
  63367. if (this._checkpoint_after_save) {
  63368. this.create_checkpoint();
  63369. this._checkpoint_after_save = false;
  63370. }
  63371. return data;
  63372. };
  63373. Notebook.prototype.save_notebook_as = function() {
  63374. var that = this;
  63375. var current_dir = $('body').attr('data-notebook-path').split('/').slice(0, -1).join("/");
  63376. current_dir = current_dir? current_dir + "/": "";
  63377. current_dir = decodeURIComponent(current_dir);
  63378. var dialog_body = $('<div/>').append(
  63379. $('<p/>').addClass('save-message')
  63380. .text(i18n.msg._('Enter a notebook path relative to notebook dir'))
  63381. ).append(
  63382. $('<br/>')
  63383. ).append(
  63384. $('<input/>').attr('type','text').attr('size','25')
  63385. .attr('data-testid', 'save-as')
  63386. .addClass('form-control')
  63387. );
  63388. var d = dialog.modal({
  63389. title: 'Save As',
  63390. body: dialog_body,
  63391. keyboard_manager: this.keyboard_manager,
  63392. notebook: this,
  63393. buttons: {
  63394. Cancel: {},
  63395. Save: {
  63396. class: 'btn-primary',
  63397. click: function() {
  63398. var nb_path = d.find('input').val();
  63399. var nb_name = nb_path.split('/').slice(-1).pop();
  63400. if (!nb_name) {
  63401. $(".save-message").html(
  63402. $("<span>")
  63403. .attr("style", "color:red;")
  63404. .text($(".save-message").text())
  63405. );
  63406. return false;
  63407. }
  63408. // If notebook name does not contain extension '.ipynb' add it
  63409. var ext = utils.splitext(nb_name)[1];
  63410. if (ext === '') {
  63411. nb_name = nb_name + '.ipynb';
  63412. nb_path = nb_path + '.ipynb';
  63413. }
  63414. var save_thunk = function() {
  63415. var model = {
  63416. 'type': 'notebook',
  63417. 'content': that.toJSON(),
  63418. 'name': nb_name
  63419. };
  63420. var start = new Date().getTime();
  63421. return that.contents.save(nb_path, model)
  63422. .then(function(data) {
  63423. d.modal('hide');
  63424. that.writable = true;
  63425. that.notebook_name = data.name;
  63426. that.notebook_path = data.path;
  63427. that.session.rename_notebook(data.path);
  63428. that.events.trigger('notebook_renamed.Notebook', data);
  63429. that.save_notebook_success(start, data);
  63430. }, function(error) {
  63431. var msg = i18n.msg._(error.message || 'Unknown error saving notebook');
  63432. $(".save-message").html(
  63433. $("<span>")
  63434. .attr("style", "color:red;")
  63435. .text(msg)
  63436. );
  63437. });
  63438. };
  63439. that.contents.get(nb_path, {type: 'notebook', content: false}).then(function(data) {
  63440. var warning_body = $('<div/>').append(
  63441. $("<p/>").text(i18n.msg._('Notebook with that name exists.')));
  63442. dialog.modal({
  63443. title: 'Save As',
  63444. body: warning_body,
  63445. buttons: {Cancel: {},
  63446. Overwrite: {
  63447. class: 'btn-warning',
  63448. click: function() {
  63449. return save_thunk();
  63450. }
  63451. }
  63452. }
  63453. });
  63454. }, function(err) {
  63455. return save_thunk();
  63456. });
  63457. return false;
  63458. }
  63459. },
  63460. },
  63461. open : function () {
  63462. d.find('input[type="text"]').keydown(function (event) {
  63463. if (event.which === keyboard.keycodes.enter) {
  63464. d.find('.btn-primary').first().click();
  63465. return false;
  63466. }
  63467. });
  63468. d.find('input[type="text"]').val(current_dir).focus();
  63469. }
  63470. });
  63471. };
  63472. /**
  63473. * Update the autosave interval based on the duration of the last save.
  63474. *
  63475. * @param {integer} start - when the save request started
  63476. */
  63477. Notebook.prototype._update_autosave_interval = function (start) {
  63478. var duration = (new Date().getTime() - start);
  63479. if (this.autosave_interval) {
  63480. // new save interval: higher of 10x save duration or parameter (default 30 seconds)
  63481. var interval = Math.max(10 * duration, this.minimum_autosave_interval);
  63482. // ceil to 10 seconds, otherwise we will be setting a new interval too often
  63483. // do not round or anything below 5000ms will desactivate saving.
  63484. interval = 10000 * Math.ceil(interval / 10000);
  63485. // set new interval, if it's changed
  63486. if (interval !== this.autosave_interval) {
  63487. this.set_autosave_interval(interval);
  63488. }
  63489. }
  63490. };
  63491. /**
  63492. * Explicitly trust the output of this notebook.
  63493. */
  63494. Notebook.prototype.trust_notebook = function (from_notification) {
  63495. var body = $("<div>").append($("<p>")
  63496. .text(i18n.msg._("A trusted Jupyter notebook may execute hidden malicious code when you open it. " +
  63497. "Selecting trust will immediately reload this notebook in a trusted state. " +
  63498. "For more information, see the Jupyter security documentation: "))
  63499. .append($("<a>").attr("href", "https://jupyter-notebook.readthedocs.io/en/stable/security.html")
  63500. .text(i18n.msg._("here"))
  63501. )
  63502. );
  63503. var nb = this;
  63504. dialog.modal({
  63505. notebook: this,
  63506. keyboard_manager: this.keyboard_manager,
  63507. title: i18n.msg._("Trust this notebook?"),
  63508. body: body,
  63509. focus_button: from_notification,
  63510. buttons: {
  63511. Cancel : {},
  63512. Trust : {
  63513. class : "btn-danger",
  63514. click : function () {
  63515. var cells = nb.get_cells();
  63516. for (var i = 0; i < cells.length; i++) {
  63517. var cell = cells[i];
  63518. if (cell.cell_type === 'code') {
  63519. cell.output_area.trusted = true;
  63520. }
  63521. }
  63522. // If its write only and dirty, save before
  63523. // trusting
  63524. var pr;
  63525. if(nb.writable && nb.dirty) {
  63526. pr = nb.save_notebook();
  63527. }
  63528. else {
  63529. pr = Promise.resolve();
  63530. }
  63531. return pr.then(function() {
  63532. nb.contents.trust(nb.notebook_path)
  63533. .then(function() {
  63534. nb.events.trigger("trust_changed.Notebook", true);
  63535. window.location.reload();
  63536. }, function(err) {
  63537. console.log(err);
  63538. });
  63539. });
  63540. }
  63541. }
  63542. }
  63543. });
  63544. };
  63545. /**
  63546. * Make a copy of the current notebook.
  63547. * If the notebook has unsaved changes, it is saved first.
  63548. */
  63549. Notebook.prototype.copy_notebook = function () {
  63550. var that = this;
  63551. var base_url = this.base_url;
  63552. var w = window.open('', IPython._target);
  63553. var parent = utils.url_path_split(this.notebook_path)[0];
  63554. var p;
  63555. if (this.dirty && this.writable) {
  63556. p = this.save_notebook(true);
  63557. } else {
  63558. p = Promise.resolve();
  63559. }
  63560. return p.then(function () {
  63561. return that.contents.copy(that.notebook_path, parent).then(
  63562. function (data) {
  63563. w.location = utils.url_path_join(
  63564. base_url, 'notebooks', utils.encode_uri_components(data.path)
  63565. );
  63566. },
  63567. function(error) {
  63568. w.close();
  63569. that.events.trigger('notebook_copy_failed', error);
  63570. }
  63571. );
  63572. });
  63573. };
  63574. /**
  63575. * Ensure a filename has the right extension
  63576. * Returns the filename with the appropriate extension, appending if necessary.
  63577. */
  63578. Notebook.prototype.ensure_extension = function (name) {
  63579. var ext = utils.splitext(this.notebook_path)[1];
  63580. if (ext.length && name.slice(-ext.length) !== ext) {
  63581. name = name + ext;
  63582. }
  63583. return name;
  63584. };
  63585. /**
  63586. * Rename the notebook.
  63587. * @param {string} new_name
  63588. * @return {Promise} promise that resolves when the notebook is renamed.
  63589. */
  63590. Notebook.prototype.rename = function (new_name) {
  63591. new_name = this.ensure_extension(new_name);
  63592. var that = this;
  63593. var parent = utils.url_path_split(this.notebook_path)[0];
  63594. var new_path = utils.url_path_join(parent, new_name);
  63595. return this.contents.rename(this.notebook_path, new_path).then(
  63596. function (json) {
  63597. that.notebook_name = json.name;
  63598. that.notebook_path = json.path;
  63599. that.last_modified = new Date(json.last_modified);
  63600. // debug 484
  63601. that._last_modified = json.last_modified;
  63602. that.session.rename_notebook(json.path);
  63603. that.events.trigger('notebook_renamed.Notebook', json);
  63604. }
  63605. );
  63606. };
  63607. /**
  63608. * Delete this notebook
  63609. */
  63610. Notebook.prototype.delete = function () {
  63611. this.contents.delete(this.notebook_path);
  63612. };
  63613. /**
  63614. * Request a notebook's data from the server.
  63615. *
  63616. * @param {string} notebook_path - A notebook to load
  63617. */
  63618. Notebook.prototype.load_notebook = function (notebook_path) {
  63619. this.notebook_path = notebook_path;
  63620. this.notebook_name = utils.url_path_split(this.notebook_path)[1];
  63621. this.events.trigger('notebook_loading.Notebook');
  63622. this.contents.get(notebook_path, {type: 'notebook'}).then(
  63623. $.proxy(this.load_notebook_success, this),
  63624. $.proxy(this.load_notebook_error, this)
  63625. );
  63626. };
  63627. /**
  63628. * Success callback for loading a notebook from the server.
  63629. *
  63630. * Load notebook data from the JSON response.
  63631. *
  63632. * @param {object} data JSON representation of a notebook
  63633. */
  63634. Notebook.prototype.load_notebook_success = function (data) {
  63635. var failed, msg;
  63636. try {
  63637. this.fromJSON(data);
  63638. } catch (e) {
  63639. failed = e;
  63640. console.error("Notebook failed to load from JSON:", e);
  63641. }
  63642. if (failed || data.message) {
  63643. // *either* fromJSON failed or validation failed
  63644. var body = $("<div>");
  63645. var title;
  63646. if (failed) {
  63647. title = i18n.msg._("Notebook failed to load");
  63648. body.append($("<p>").text(
  63649. i18n.msg._("The error was: ")
  63650. )).append($("<div>").addClass("js-error").text(
  63651. failed.toString()
  63652. )).append($("<p>").text(
  63653. i18n.msg._("See the error console for details.")
  63654. ));
  63655. } else {
  63656. title = i18n.msg._("Notebook validation failed");
  63657. }
  63658. if (data.message) {
  63659. if (failed) {
  63660. msg = i18n.msg._("The notebook also failed validation:");
  63661. } else {
  63662. msg = i18n.msg._("An invalid notebook may not function properly." +
  63663. " The validation error was:");
  63664. }
  63665. body.append($("<p>").text(
  63666. msg
  63667. )).append($("<div>").addClass("validation-error").append(
  63668. $("<pre>").text(data.message)
  63669. ));
  63670. }
  63671. dialog.modal({
  63672. notebook: this,
  63673. keyboard_manager: this.keyboard_manager,
  63674. title: title,
  63675. body: body,
  63676. buttons : {
  63677. OK : {
  63678. "class" : "btn-primary"
  63679. }
  63680. }
  63681. });
  63682. }
  63683. if (this.ncells() === 0) {
  63684. this.insert_cell_below('code');
  63685. this.edit_mode(0);
  63686. } else {
  63687. this.select(0);
  63688. this.handle_command_mode(this.get_cell(0));
  63689. }
  63690. this.set_dirty(false);
  63691. this.scroll_to_top();
  63692. this.writable = data.writable || false;
  63693. this.last_modified = new Date(data.last_modified);
  63694. // debug 484
  63695. this._last_modified = 'load-success:'+data.last_modified;
  63696. var nbmodel = data.content;
  63697. var orig_nbformat = nbmodel.metadata.orig_nbformat;
  63698. var orig_nbformat_minor = nbmodel.metadata.orig_nbformat_minor;
  63699. if (orig_nbformat !== undefined && nbmodel.nbformat !== orig_nbformat) {
  63700. var oldmsg = i18n.msg._("This notebook has been converted from an older notebook format" +
  63701. " to the current notebook format v(%s).");
  63702. var newmsg = i18n.msg._("This notebook has been converted from a newer notebook format" +
  63703. " to the current notebook format v(%s).");
  63704. if (nbmodel.nbformat > orig_nbformat) {
  63705. msg = i18n.msg.sprintf(oldmsg,nbmodel.nbformat);
  63706. } else {
  63707. msg = i18n.msg.sprintf(newmsg,nbmodel.nbformat);
  63708. }
  63709. msg += " ";
  63710. msg += i18n.msg._("The next time you save this notebook, the " +
  63711. "current notebook format will be used.");
  63712. msg += " ";
  63713. if (nbmodel.nbformat > orig_nbformat) {
  63714. msg += i18n.msg._("Older versions of Jupyter may not be able to read the new format.");
  63715. } else {
  63716. msg += i18n.msg._("Some features of the original notebook may not be available.");
  63717. }
  63718. msg += " ";
  63719. msg += i18n.msg._("To preserve the original version, close the " +
  63720. "notebook without saving it.");
  63721. dialog.modal({
  63722. notebook: this,
  63723. keyboard_manager: this.keyboard_manager,
  63724. title : i18n.msg._("Notebook converted"),
  63725. body : msg,
  63726. buttons : {
  63727. OK : {
  63728. class : "btn-primary"
  63729. }
  63730. }
  63731. });
  63732. } else if (this.nbformat_minor < nbmodel.nbformat_minor) {
  63733. this.nbformat_minor = nbmodel.nbformat_minor;
  63734. }
  63735. if (this.session === null) {
  63736. var kernel_name = utils.get_url_param('kernel_name');
  63737. if (kernel_name) {
  63738. this.kernel_selector.set_kernel(kernel_name);
  63739. } else if (this.metadata.kernelspec) {
  63740. this.kernel_selector.set_kernel(this.metadata.kernelspec);
  63741. } else if (this.metadata.language) {
  63742. // compat with IJulia, IHaskell, and other early kernels
  63743. // adopters that where setting a language metadata.
  63744. this.kernel_selector.set_kernel({
  63745. name: i18n.msg._("(No name)"),
  63746. language: this.metadata.language
  63747. });
  63748. // this should be stored in kspec now, delete it.
  63749. // remove once we do not support notebook v3 anymore.
  63750. delete this.metadata.language;
  63751. } else {
  63752. // setting kernel via set_kernel above triggers start_session,
  63753. // otherwise start a new session with the server's default kernel
  63754. // spec_changed events will fire after kernel is loaded
  63755. this.start_session();
  63756. }
  63757. }
  63758. // load our checkpoint list
  63759. this.list_checkpoints();
  63760. // load toolbar state
  63761. if (this.metadata.celltoolbar) {
  63762. celltoolbar.CellToolbar.global_show();
  63763. celltoolbar.CellToolbar.activate_preset(this.metadata.celltoolbar);
  63764. } else {
  63765. celltoolbar.CellToolbar.global_hide();
  63766. }
  63767. if (!this.writable) {
  63768. this.set_autosave_interval(0);
  63769. this.events.trigger('notebook_read_only.Notebook');
  63770. }
  63771. // now that we're fully loaded, it is safe to restore save functionality
  63772. this._fully_loaded = true;
  63773. this.events.trigger('notebook_loaded.Notebook');
  63774. };
  63775. Notebook.prototype.set_kernelselector = function(k_selector){
  63776. this.kernel_selector = k_selector;
  63777. };
  63778. /**
  63779. * Failure callback for loading a notebook from the server.
  63780. *
  63781. * @param {Error} error
  63782. */
  63783. Notebook.prototype.load_notebook_error = function (error) {
  63784. var isSanitized = true;
  63785. this.events.trigger('notebook_load_failed.Notebook', error);
  63786. var msg;
  63787. if (error.name === utils.XHR_ERROR && error.xhr.status === 500) {
  63788. utils.log_ajax_error(error.xhr, error.xhr_status, error.xhr_error);
  63789. msg = i18n.msg.sprintf(i18n.msg._("An unknown error occurred while loading this notebook. " +
  63790. "This version can load notebook formats %s or earlier. See the server log for details.",
  63791. "v" + this.nbformat));
  63792. } else {
  63793. msg = error.message;
  63794. console.warn('Error stack trace while loading notebook was:');
  63795. console.warn(error.stack);
  63796. }
  63797. if (navigator.cookieEnabled == false){
  63798. msg = i18n.msg._("Jupyter requires cookies to work; please enable cookies" +
  63799. " and refresh page. <a href=\"https://www.wikihow.com/Enable-Cookies-in-Your-Internet-Web-Browser\"> Learn more about enabling cookies. </a>");
  63800. isSanitized = false;
  63801. }
  63802. dialog.modal({
  63803. notebook: this,
  63804. keyboard_manager: this.keyboard_manager,
  63805. title: i18n.msg._("Error loading notebook"),
  63806. body : msg,
  63807. buttons : {
  63808. "Close": {
  63809. class : 'btn-danger',
  63810. click : function () {
  63811. window.close();
  63812. }
  63813. }
  63814. },
  63815. sanitize: isSanitized
  63816. });
  63817. };
  63818. /********************* checkpoint-related ********************/
  63819. /**
  63820. * Save the notebook then immediately create a checkpoint.
  63821. */
  63822. Notebook.prototype.save_checkpoint = function () {
  63823. this._checkpoint_after_save = true;
  63824. return this.save_notebook(true);
  63825. };
  63826. /**
  63827. * Add a checkpoint for this notebook.
  63828. */
  63829. Notebook.prototype.add_checkpoint = function (checkpoint) {
  63830. var found = false;
  63831. for (var i = 0; i < this.checkpoints.length; i++) {
  63832. var existing = this.checkpoints[i];
  63833. if (existing.id === checkpoint.id) {
  63834. found = true;
  63835. this.checkpoints[i] = checkpoint;
  63836. break;
  63837. }
  63838. }
  63839. if (!found) {
  63840. this.checkpoints.push(checkpoint);
  63841. }
  63842. this.last_checkpoint = this.checkpoints[this.checkpoints.length - 1];
  63843. };
  63844. /**
  63845. * List checkpoints for this notebook.
  63846. */
  63847. Notebook.prototype.list_checkpoints = function () {
  63848. var that = this;
  63849. this.contents.list_checkpoints(this.notebook_path).then(
  63850. $.proxy(this.list_checkpoints_success, this),
  63851. function(error) {
  63852. that.events.trigger('list_checkpoints_failed.Notebook', error);
  63853. }
  63854. );
  63855. };
  63856. /**
  63857. * Success callback for listing checkpoints.
  63858. *
  63859. * @param {object} data - JSON representation of a checkpoint
  63860. */
  63861. Notebook.prototype.list_checkpoints_success = function (data) {
  63862. this.checkpoints = data;
  63863. if (data.length) {
  63864. this.last_checkpoint = data[data.length - 1];
  63865. } else {
  63866. this.last_checkpoint = null;
  63867. }
  63868. this.events.trigger('checkpoints_listed.Notebook', [data]);
  63869. };
  63870. /**
  63871. * Create a checkpoint of this notebook on the server from the most recent save.
  63872. */
  63873. Notebook.prototype.create_checkpoint = function () {
  63874. var that = this;
  63875. this.contents.create_checkpoint(this.notebook_path).then(
  63876. $.proxy(this.create_checkpoint_success, this),
  63877. function (error) {
  63878. that.events.trigger('checkpoint_failed.Notebook', error);
  63879. }
  63880. );
  63881. };
  63882. /**
  63883. * Success callback for creating a checkpoint.
  63884. *
  63885. * @param {object} data - JSON representation of a checkpoint
  63886. */
  63887. Notebook.prototype.create_checkpoint_success = function (data) {
  63888. this.add_checkpoint(data);
  63889. this.events.trigger('checkpoint_created.Notebook', data);
  63890. };
  63891. /**
  63892. * Display the restore checkpoint dialog
  63893. * @param {string} checkpoint ID
  63894. */
  63895. Notebook.prototype.restore_checkpoint_dialog = function (checkpoint) {
  63896. var that = this;
  63897. checkpoint = checkpoint || this.last_checkpoint;
  63898. if ( ! checkpoint ) {
  63899. console.log("restore dialog, but no checkpoint to restore to!");
  63900. return;
  63901. }
  63902. var body = $('<div/>').append(
  63903. $('<p/>').addClass("p-space").text(
  63904. i18n.msg._("Are you sure you want to revert the notebook to " +
  63905. "the latest checkpoint?")
  63906. ).append(
  63907. $("<strong/>").text(" "+i18n.msg._("This cannot be undone."))
  63908. )
  63909. ).append(
  63910. $('<p/>').addClass("p-space").text(i18n.msg._("The checkpoint was last updated at:"))
  63911. ).append(
  63912. $('<p/>').addClass("p-space").text(
  63913. moment(checkpoint.last_modified).format('LLLL') +
  63914. ' ('+moment(checkpoint.last_modified).fromNow()+')'// Long form: Tuesday, January 27, 2015 12:15 PM
  63915. ).css("text-align", "center")
  63916. );
  63917. dialog.modal({
  63918. notebook: this,
  63919. keyboard_manager: this.keyboard_manager,
  63920. title : i18n.msg._("Revert notebook to checkpoint"),
  63921. body : body,
  63922. default_button: "Cancel",
  63923. buttons : {
  63924. Cancel: {},
  63925. Revert : {
  63926. class : "btn-danger",
  63927. click : function () {
  63928. that.restore_checkpoint(checkpoint.id);
  63929. }
  63930. }
  63931. }
  63932. });
  63933. };
  63934. /**
  63935. * Restore the notebook to a checkpoint state.
  63936. *
  63937. * @param {string} checkpoint ID
  63938. */
  63939. Notebook.prototype.restore_checkpoint = function (checkpoint) {
  63940. this.events.trigger('notebook_restoring.Notebook', checkpoint);
  63941. var that = this;
  63942. this.contents.restore_checkpoint(this.notebook_path, checkpoint).then(
  63943. $.proxy(this.restore_checkpoint_success, this),
  63944. function (error) {
  63945. that.events.trigger('checkpoint_restore_failed.Notebook', error);
  63946. }
  63947. );
  63948. };
  63949. /**
  63950. * Success callback for restoring a notebook to a checkpoint.
  63951. */
  63952. Notebook.prototype.restore_checkpoint_success = function () {
  63953. this.events.trigger('checkpoint_restored.Notebook');
  63954. this.load_notebook(this.notebook_path);
  63955. };
  63956. /**
  63957. * Delete a notebook checkpoint.
  63958. *
  63959. * @param {string} checkpoint ID
  63960. */
  63961. Notebook.prototype.delete_checkpoint = function (checkpoint) {
  63962. this.events.trigger('notebook_restoring.Notebook', checkpoint);
  63963. var that = this;
  63964. this.contents.delete_checkpoint(this.notebook_path, checkpoint).then(
  63965. $.proxy(this.delete_checkpoint_success, this),
  63966. function (error) {
  63967. that.events.trigger('checkpoint_delete_failed.Notebook', error);
  63968. }
  63969. );
  63970. };
  63971. /**
  63972. * Success callback for deleting a notebook checkpoint.
  63973. */
  63974. Notebook.prototype.delete_checkpoint_success = function () {
  63975. this.events.trigger('checkpoint_deleted.Notebook');
  63976. this.load_notebook(this.notebook_path);
  63977. };
  63978. return {Notebook: Notebook};
  63979. });
  63980. // Copyright (c) Jupyter Development Team.
  63981. // Distributed under the terms of the Modified BSD License.
  63982. define('base/js/page',[
  63983. 'jquery',
  63984. 'base/js/events',
  63985. ], function($, events){
  63986. "use strict";
  63987. var Page = function (header_div_selector, site_div_selector) {
  63988. /**
  63989. * Constructor
  63990. *
  63991. * Parameters
  63992. * header_div_selector: string
  63993. * site_div_selector: string
  63994. */
  63995. this.header_div_element = $(header_div_selector || 'div#header');
  63996. this.site_div_element = $(site_div_selector || 'div#site');
  63997. this.bind_events();
  63998. };
  63999. Page.prototype.bind_events = function () {
  64000. // resize site on:
  64001. // - window resize
  64002. // - header change
  64003. // - page load
  64004. var _handle_resize = $.proxy(this._resize_site, this);
  64005. $(window).resize(_handle_resize);
  64006. // On document ready, resize codemirror.
  64007. $(document).ready(_handle_resize);
  64008. events.on('resize-header.Page', _handle_resize);
  64009. };
  64010. Page.prototype.show = function () {
  64011. /**
  64012. * The header and site divs start out hidden to prevent FLOUC.
  64013. * Main scripts should call this method after styling everything.
  64014. */
  64015. this.show_header();
  64016. this.show_site();
  64017. };
  64018. Page.prototype.show_header = function () {
  64019. /**
  64020. * The header and site divs start out hidden to prevent FLOUC.
  64021. * Main scripts should call this method after styling everything.
  64022. */
  64023. this.header_div_element.css('display','block');
  64024. };
  64025. Page.prototype.show_site = function () {
  64026. /**
  64027. * The header and site divs start out hidden to prevent FLOUC.
  64028. * Main scripts should call this method after styling everything.
  64029. */
  64030. this.site_div_element.css('display', 'block');
  64031. this._resize_site();
  64032. };
  64033. Page.prototype._resize_site = function(e) {
  64034. /**
  64035. * Update the site's size.
  64036. */
  64037. // In the case an event is passed in, only trigger if the event does
  64038. // *not* have a target DOM node (i.e., it is not bubbling up). See
  64039. // https://bugs.jquery.com/ticket/9841#comment:8
  64040. if (!(e && e.target && e.target.tagName)) {
  64041. $('div#site').height($(window).height() - $('#header').height());
  64042. }
  64043. };
  64044. return {'Page': Page};
  64045. });
  64046. // Copyright (c) Jupyter Development Team.
  64047. // Distributed under the terms of the Modified BSD License.
  64048. // Define an object to attach promises to for one-time events.
  64049. define('base/js/promises',['base/js/events', 'base/js/namespace'], function(events, Jupyter) {
  64050. "use strict";
  64051. // Promise to be resolved when the application is initialized.
  64052. // The value is the name of the app on the current page.
  64053. var app_initialized = new Promise(function(resolve, reject) {
  64054. events.on('app_initialized.NotebookApp', function() {
  64055. resolve('NotebookApp');
  64056. });
  64057. events.on('app_initialized.DashboardApp', function() {
  64058. resolve('DashboardApp');
  64059. });
  64060. });
  64061. var promises = {
  64062. app_initialized: app_initialized
  64063. };
  64064. Jupyter.promises = promises;
  64065. return promises;
  64066. });
  64067. // Copyright (c) Jupyter Development Team.
  64068. // Distributed under the terms of the Modified BSD License.
  64069. define('auth/js/loginwidget',[
  64070. 'jquery',
  64071. 'base/js/utils',
  64072. ], function($, utils){
  64073. "use strict";
  64074. var LoginWidget = function (selector, options) {
  64075. options = options || {};
  64076. this.base_url = options.base_url || utils.get_body_data("baseUrl");
  64077. this.selector = selector;
  64078. if (this.selector !== undefined) {
  64079. this.element = $(selector);
  64080. this.bind_events();
  64081. }
  64082. };
  64083. LoginWidget.prototype.bind_events = function () {
  64084. var that = this;
  64085. this.element.find("button#logout").click(function () {
  64086. window.location = utils.url_path_join(
  64087. that.base_url,
  64088. "logout"
  64089. );
  64090. });
  64091. this.element.find("button#login").click(function () {
  64092. window.location = utils.url_path_join(
  64093. that.base_url,
  64094. "login"
  64095. );
  64096. });
  64097. };
  64098. return {'LoginWidget': LoginWidget};
  64099. });
  64100. // Copyright (c) Jupyter Development Team.
  64101. // Distributed under the terms of the Modified BSD License.
  64102. define('notebook/js/toolbar',['jquery','base/js/i18n'], function($, i18n) {
  64103. "use strict";
  64104. /**
  64105. * A generic toolbar on which one can add button
  64106. * @class ToolBar
  64107. * @constructor
  64108. * @param {Dom_object} selector
  64109. */
  64110. var ToolBar = function (selector, options) {
  64111. this.selector = selector;
  64112. this.actions = (options||{}).actions;
  64113. if (this.selector !== undefined) {
  64114. this.element = $(selector);
  64115. this.style();
  64116. }
  64117. };
  64118. ToolBar.prototype._pseudo_actions={};
  64119. ToolBar.prototype.construct = function (config) {
  64120. for(var k=0; k<config.length; k++) {
  64121. this.add_buttons_group(config[k][0],config[k][1]);
  64122. }
  64123. };
  64124. /**
  64125. * Add a group of button into the current toolbar.
  64126. *
  64127. * Use a [dict of [list of action name]] to trigger
  64128. * on click to the button
  64129. *
  64130. * @example
  64131. *
  64132. * ... todo, maybe use a list of list to keep ordering.
  64133. *
  64134. * [
  64135. * [
  64136. * [
  64137. * action_name_1,
  64138. * action_name_2,
  64139. * action_name_3,
  64140. * ],
  64141. * optional_group_name
  64142. * ],
  64143. * ...
  64144. * ]
  64145. *
  64146. * @param list {List}
  64147. * List of button of the group, with the following parameter for each :
  64148. * @param list.label {string} text to show on button hover
  64149. * @param list.icon {string} icon to choose from [Font Awesome](http://fortawesome.github.io/Font-Awesome)
  64150. * @param list.callback {function} function to be called on button click
  64151. * @param [list.id] {String} id to give to the button
  64152. * @param [group_id] {String} optional id to give to the group
  64153. *
  64154. *
  64155. * for private usage, the key can also be strings starting with '<' and ending with '>' to inject custom element that cannot
  64156. * be bound to an action.
  64157. *
  64158. */
  64159. // TODO JUPYTER:
  64160. // get rid of legacy code that handle things that are not actions.
  64161. ToolBar.prototype.add_buttons_group = function (list, group_id) {
  64162. // handle custom call of pseudoaction binding.
  64163. if(typeof(list) === 'string' && list.slice(0,1) === '<' && list.slice(-1) === '>'){
  64164. var _pseudo_action;
  64165. try{
  64166. _pseudo_action = list.slice(1,-1);
  64167. this.element.append(this._pseudo_actions[_pseudo_action].call(this));
  64168. } catch (e) {
  64169. console.warn('ouch, calling ', _pseudo_action, 'does not seem to work...:', e);
  64170. }
  64171. return ;
  64172. }
  64173. var that = this;
  64174. var btn_group = $('<div/>').addClass("btn-group");
  64175. if( group_id !== undefined ) {
  64176. btn_group.attr('id',group_id);
  64177. }
  64178. list.forEach(function(el) {
  64179. var action_name;
  64180. var action;
  64181. if(typeof(el) === 'string'){
  64182. action = that.actions.get(el);
  64183. action_name = el;
  64184. } else if (el.action) {
  64185. action = that.actions.get(el.action);
  64186. action_name = el.action
  64187. }
  64188. var title = el.label;
  64189. if(action && action.help) {
  64190. title = i18n.msg._(action.help) || el.label;
  64191. }
  64192. var button = $('<button/>')
  64193. .addClass('btn btn-default')
  64194. .attr("aria-label", el.label)
  64195. .attr("title", title)
  64196. .append(
  64197. $("<i/>").addClass(el.icon||(action||{icon:'fa-exclamation-triangle'}).icon).addClass('fa')
  64198. );
  64199. if (el.label) {
  64200. var label = $('<span/>').text(i18n.msg._(el.label)).addClass('toolbar-btn-label');
  64201. button.append(label);
  64202. }
  64203. var id = el.id;
  64204. if( id !== undefined ){
  64205. button.attr('id',id);
  64206. }
  64207. button.attr('data-jupyter-action', action_name);
  64208. var fun = el.callback|| function(){
  64209. that.actions.call(action_name);
  64210. };
  64211. button.click(fun);
  64212. btn_group.append(button);
  64213. });
  64214. $(this.selector).append(btn_group);
  64215. return btn_group;
  64216. };
  64217. ToolBar.prototype.style = function () {
  64218. this.element.addClass('toolbar');
  64219. };
  64220. /**
  64221. * Show and hide toolbar
  64222. * @method toggle
  64223. */
  64224. ToolBar.prototype.toggle = function () {
  64225. this.element.toggle();
  64226. };
  64227. /**
  64228. * A simple class to hold information defining one toolbar button.
  64229. * @class ToolBar
  64230. * @constructor
  64231. * @param action {String} name of a Jupyter action taken when pressed
  64232. * @param options.label {String} short label to display on the button
  64233. */
  64234. var Button = function(action, options) {
  64235. this.action = action;
  64236. this.label = (options||{}).label;
  64237. };
  64238. return {
  64239. 'ToolBar': ToolBar,
  64240. 'Button': Button
  64241. };
  64242. });
  64243. // Copyright (c) Jupyter Development Team.
  64244. // Distributed under the terms of the Modified BSD License.
  64245. define('notebook/js/maintoolbar',[
  64246. 'jquery',
  64247. 'require',
  64248. './toolbar',
  64249. './celltoolbar',
  64250. 'base/js/i18n'
  64251. ], function($, requirejs, toolbar, celltoolbar, i18n) {
  64252. "use strict";
  64253. var MainToolBar = function (selector, options) {
  64254. /**
  64255. * Constructor
  64256. *
  64257. * Parameters:
  64258. * selector: string
  64259. * options: dictionary
  64260. * Dictionary of keyword arguments.
  64261. * events: $(Events) instance
  64262. * notebook: Notebook instance
  64263. **/
  64264. toolbar.ToolBar.apply(this, [selector, options] );
  64265. this.events = options.events;
  64266. this.notebook = options.notebook;
  64267. this._make();
  64268. Object.seal(this);
  64269. };
  64270. MainToolBar.prototype = Object.create(toolbar.ToolBar.prototype);
  64271. MainToolBar.prototype._make = function () {
  64272. var grps = [
  64273. [
  64274. ['jupyter-notebook:save-notebook'],
  64275. 'save-notbook'
  64276. ],
  64277. [
  64278. ['jupyter-notebook:insert-cell-below'],
  64279. 'insert_above_below'],
  64280. [
  64281. ['jupyter-notebook:cut-cell',
  64282. 'jupyter-notebook:copy-cell',
  64283. 'jupyter-notebook:paste-cell-below'
  64284. ] ,
  64285. 'cut_copy_paste'],
  64286. [
  64287. ['jupyter-notebook:move-cell-up',
  64288. 'jupyter-notebook:move-cell-down'
  64289. ],
  64290. 'move_up_down'],
  64291. [ [new toolbar.Button('jupyter-notebook:run-cell-and-select-next',
  64292. {label: i18n.msg._('Run')}),
  64293. 'jupyter-notebook:interrupt-kernel',
  64294. 'jupyter-notebook:confirm-restart-kernel',
  64295. 'jupyter-notebook:confirm-restart-kernel-and-run-all-cells'
  64296. ],
  64297. 'run_int'],
  64298. ['<add_celltype_list>'],
  64299. [
  64300. ['jupyter-notebook:show-command-palette'],
  64301. 'cmd_palette']
  64302. ];
  64303. this.construct(grps);
  64304. };
  64305. MainToolBar.prototype._pseudo_actions = {};
  64306. // add a cell type drop down to the maintoolbar.
  64307. // triggered when the pseudo action `<add_celltype_list>` is
  64308. // encountered when building a toolbar.
  64309. MainToolBar.prototype._pseudo_actions.add_celltype_list = function () {
  64310. var that = this;
  64311. var multiselect = $('<option/>').attr('value','multiselect').attr('disabled','').text('-');
  64312. var sel = $('<select/>')
  64313. .attr('id','cell_type')
  64314. .attr('aria-label', i18n.msg._('combobox, select cell type'))
  64315. .attr('role', 'combobox')
  64316. .addClass('form-control select-xs')
  64317. .append($('<option/>').attr('value','code').text(i18n.msg._('Code')))
  64318. .append($('<option/>').attr('value','markdown').text(i18n.msg._('Markdown')))
  64319. .append($('<option/>').attr('value','raw').text(i18n.msg._('Raw NBConvert')))
  64320. .append($('<option/>').attr('value','heading').text(i18n.msg._('Heading')))
  64321. .append(multiselect);
  64322. this.notebook.keyboard_manager.register_events(sel);
  64323. this.events.on('selected_cell_type_changed.Notebook', function (event, data) {
  64324. if (data.editable === false) {
  64325. sel.attr('disabled', true);
  64326. } else {
  64327. sel.removeAttr('disabled');
  64328. }
  64329. if (that.notebook.get_selected_cells_indices().length > 1) {
  64330. multiselect.show();
  64331. sel.val('multiselect');
  64332. } else {
  64333. multiselect.hide();
  64334. if (data.cell_type === 'heading') {
  64335. sel.val('Markdown');
  64336. } else {
  64337. sel.val(data.cell_type);
  64338. }
  64339. }
  64340. });
  64341. sel.change(function () {
  64342. var cell_type = $(this).val();
  64343. switch (cell_type) {
  64344. case 'code':
  64345. that.notebook.cells_to_code();
  64346. break;
  64347. case 'markdown':
  64348. that.notebook.cells_to_markdown();
  64349. break;
  64350. case 'raw':
  64351. that.notebook.cells_to_raw();
  64352. break;
  64353. case 'heading':
  64354. that.notebook._warn_heading();
  64355. that.notebook.to_heading();
  64356. sel.val('markdown');
  64357. break;
  64358. case 'multiselect':
  64359. break;
  64360. default:
  64361. console.log(i18n.msg._("unrecognized cell type:"), cell_type);
  64362. }
  64363. that.notebook.focus_cell();
  64364. });
  64365. return sel;
  64366. };
  64367. return {'MainToolBar': MainToolBar};
  64368. });
  64369. /*! jQuery UI - v1.13.2 - 2022-07-14
  64370. * http://jqueryui.com
  64371. * Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js
  64372. * Copyright jQuery Foundation and other contributors; Licensed MIT */
  64373. !function(t){"use strict";"function"==typeof define&&define.amd?define('jquery-ui',["jquery"],t):t(jQuery)}(function(V){"use strict";V.ui=V.ui||{};V.ui.version="1.13.2";var n,i=0,a=Array.prototype.hasOwnProperty,r=Array.prototype.slice;V.cleanData=(n=V.cleanData,function(t){for(var e,i,s=0;null!=(i=t[s]);s++)(e=V._data(i,"events"))&&e.remove&&V(i).triggerHandler("remove");n(t)}),V.widget=function(t,i,e){var s,n,o,a={},r=t.split(".")[0],l=r+"-"+(t=t.split(".")[1]);return e||(e=i,i=V.Widget),Array.isArray(e)&&(e=V.extend.apply(null,[{}].concat(e))),V.expr.pseudos[l.toLowerCase()]=function(t){return!!V.data(t,l)},V[r]=V[r]||{},s=V[r][t],n=V[r][t]=function(t,e){if(!this||!this._createWidget)return new n(t,e);arguments.length&&this._createWidget(t,e)},V.extend(n,s,{version:e.version,_proto:V.extend({},e),_childConstructors:[]}),(o=new i).options=V.widget.extend({},o.options),V.each(e,function(e,s){function n(){return i.prototype[e].apply(this,arguments)}function o(t){return i.prototype[e].apply(this,t)}a[e]="function"==typeof s?function(){var t,e=this._super,i=this._superApply;return this._super=n,this._superApply=o,t=s.apply(this,arguments),this._super=e,this._superApply=i,t}:s}),n.prototype=V.widget.extend(o,{widgetEventPrefix:s&&o.widgetEventPrefix||t},a,{constructor:n,namespace:r,widgetName:t,widgetFullName:l}),s?(V.each(s._childConstructors,function(t,e){var i=e.prototype;V.widget(i.namespace+"."+i.widgetName,n,e._proto)}),delete s._childConstructors):i._childConstructors.push(n),V.widget.bridge(t,n),n},V.widget.extend=function(t){for(var e,i,s=r.call(arguments,1),n=0,o=s.length;n<o;n++)for(e in s[n])i=s[n][e],a.call(s[n],e)&&void 0!==i&&(V.isPlainObject(i)?t[e]=V.isPlainObject(t[e])?V.widget.extend({},t[e],i):V.widget.extend({},i):t[e]=i);return t},V.widget.bridge=function(o,e){var a=e.prototype.widgetFullName||o;V.fn[o]=function(i){var t="string"==typeof i,s=r.call(arguments,1),n=this;return t?this.length||"instance"!==i?this.each(function(){var t,e=V.data(this,a);return"instance"===i?(n=e,!1):e?"function"!=typeof e[i]||"_"===i.charAt(0)?V.error("no such method '"+i+"' for "+o+" widget instance"):(t=e[i].apply(e,s))!==e&&void 0!==t?(n=t&&t.jquery?n.pushStack(t.get()):t,!1):void 0:V.error("cannot call methods on "+o+" prior to initialization; attempted to call method '"+i+"'")}):n=void 0:(s.length&&(i=V.widget.extend.apply(null,[i].concat(s))),this.each(function(){var t=V.data(this,a);t?(t.option(i||{}),t._init&&t._init()):V.data(this,a,new e(i,this))})),n}},V.Widget=function(){},V.Widget._childConstructors=[],V.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(t,e){e=V(e||this.defaultElement||this)[0],this.element=V(e),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=V(),this.hoverable=V(),this.focusable=V(),this.classesElementLookup={},e!==this&&(V.data(e,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===e&&this.destroy()}}),this.document=V(e.style?e.ownerDocument:e.document||e),this.window=V(this.document[0].defaultView||this.document[0].parentWindow)),this.options=V.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:V.noop,_create:V.noop,_init:V.noop,destroy:function(){var i=this;this._destroy(),V.each(this.classesElementLookup,function(t,e){i._removeClass(e,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:V.noop,widget:function(){return this.element},option:function(t,e){var i,s,n,o=t;if(0===arguments.length)return V.widget.extend({},this.options);if("string"==typeof t)if(o={},t=(i=t.split(".")).shift(),i.length){for(s=o[t]=V.widget.extend({},this.options[t]),n=0;n<i.length-1;n++)s[i[n]]=s[i[n]]||{},s=s[i[n]];if(t=i.pop(),1===arguments.length)return void 0===s[t]?null:s[t];s[t]=e}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];o[t]=e}return this._setOptions(o),this},_setOptions:function(t){for(var e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(t){var e,i,s;for(e in t)s=this.classesElementLookup[e],t[e]!==this.options.classes[e]&&s&&s.length&&(i=V(s.get()),this._removeClass(s,e),i.addClass(this._classes({element:i,keys:e,classes:t,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(n){var o=[],a=this;function t(t,e){for(var i,s=0;s<t.length;s++)i=a.classesElementLookup[t[s]]||V(),i=n.add?(function(){var i=[];n.element.each(function(t,e){V.map(a.classesElementLookup,function(t){return t}).some(function(t){return t.is(e)})||i.push(e)}),a._on(V(i),{remove:"_untrackClassesElement"})}(),V(V.uniqueSort(i.get().concat(n.element.get())))):V(i.not(n.element).get()),a.classesElementLookup[t[s]]=i,o.push(t[s]),e&&n.classes[t[s]]&&o.push(n.classes[t[s]])}return(n=V.extend({element:this.element,classes:this.options.classes||{}},n)).keys&&t(n.keys.match(/\S+/g)||[],!0),n.extra&&t(n.extra.match(/\S+/g)||[]),o.join(" ")},_untrackClassesElement:function(i){var s=this;V.each(s.classesElementLookup,function(t,e){-1!==V.inArray(i.target,e)&&(s.classesElementLookup[t]=V(e.not(i.target).get()))}),this._off(V(i.target))},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){var n="string"==typeof t||null===t,i={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s="boolean"==typeof s?s:i};return i.element.toggleClass(this._classes(i),s),this},_on:function(n,o,t){var a,r=this;"boolean"!=typeof n&&(t=o,o=n,n=!1),t?(o=a=V(o),this.bindings=this.bindings.add(o)):(t=o,o=this.element,a=this.widget()),V.each(t,function(t,e){function i(){if(n||!0!==r.options.disabled&&!V(this).hasClass("ui-state-disabled"))return("string"==typeof e?r[e]:e).apply(r,arguments)}"string"!=typeof e&&(i.guid=e.guid=e.guid||i.guid||V.guid++);var s=t.match(/^([\w:-]*)\s*(.*)$/),t=s[1]+r.eventNamespace,s=s[2];s?a.on(t,s,i):o.on(t,i)})},_off:function(t,e){e=(e||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.off(e),this.bindings=V(this.bindings.not(t).get()),this.focusable=V(this.focusable.not(t).get()),this.hoverable=V(this.hoverable.not(t).get())},_delay:function(t,e){var i=this;return setTimeout(function(){return("string"==typeof t?i[t]:t).apply(i,arguments)},e||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){this._addClass(V(t.currentTarget),null,"ui-state-hover")},mouseleave:function(t){this._removeClass(V(t.currentTarget),null,"ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){this._addClass(V(t.currentTarget),null,"ui-state-focus")},focusout:function(t){this._removeClass(V(t.currentTarget),null,"ui-state-focus")}})},_trigger:function(t,e,i){var s,n,o=this.options[t];if(i=i||{},(e=V.Event(e)).type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),e.target=this.element[0],n=e.originalEvent)for(s in n)s in e||(e[s]=n[s]);return this.element.trigger(e,i),!("function"==typeof o&&!1===o.apply(this.element[0],[e].concat(i))||e.isDefaultPrevented())}},V.each({show:"fadeIn",hide:"fadeOut"},function(o,a){V.Widget.prototype["_"+o]=function(e,t,i){var s,n=(t="string"==typeof t?{effect:t}:t)?!0!==t&&"number"!=typeof t&&t.effect||a:o;"number"==typeof(t=t||{})?t={duration:t}:!0===t&&(t={}),s=!V.isEmptyObject(t),t.complete=i,t.delay&&e.delay(t.delay),s&&V.effects&&V.effects.effect[n]?e[o](t):n!==o&&e[n]?e[n](t.duration,t.easing,i):e.queue(function(t){V(this)[o](),i&&i.call(e[0]),t()})}});var s,x,k,o,l,h,c,u,C;V.widget;function D(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function I(t,e){return parseInt(V.css(t,e),10)||0}function T(t){return null!=t&&t===t.window}x=Math.max,k=Math.abs,o=/left|center|right/,l=/top|center|bottom/,h=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,C=V.fn.position,V.position={scrollbarWidth:function(){if(void 0!==s)return s;var t,e=V("<div style='display:block;position:absolute;width:200px;height:200px;overflow:hidden;'><div style='height:300px;width:auto;'></div></div>"),i=e.children()[0];return V("body").append(e),t=i.offsetWidth,e.css("overflow","scroll"),t===(i=i.offsetWidth)&&(i=e[0].clientWidth),e.remove(),s=t-i},getScrollInfo:function(t){var e=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),i=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),e="scroll"===e||"auto"===e&&t.width<t.element[0].scrollWidth;return{width:"scroll"===i||"auto"===i&&t.height<t.element[0].scrollHeight?V.position.scrollbarWidth():0,height:e?V.position.scrollbarWidth():0}},getWithinInfo:function(t){var e=V(t||window),i=T(e[0]),s=!!e[0]&&9===e[0].nodeType;return{element:e,isWindow:i,isDocument:s,offset:!i&&!s?V(t).offset():{left:0,top:0},scrollLeft:e.scrollLeft(),scrollTop:e.scrollTop(),width:e.outerWidth(),height:e.outerHeight()}}},V.fn.position=function(u){if(!u||!u.of)return C.apply(this,arguments);var d,p,f,g,m,t,_="string"==typeof(u=V.extend({},u)).of?V(document).find(u.of):V(u.of),v=V.position.getWithinInfo(u.within),b=V.position.getScrollInfo(v),y=(u.collision||"flip").split(" "),w={},e=9===(t=(e=_)[0]).nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:T(t)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:t.preventDefault?{width:0,height:0,offset:{top:t.pageY,left:t.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()};return _[0].preventDefault&&(u.at="left top"),p=e.width,f=e.height,m=V.extend({},g=e.offset),V.each(["my","at"],function(){var t,e,i=(u[this]||"").split(" ");(i=1===i.length?o.test(i[0])?i.concat(["center"]):l.test(i[0])?["center"].concat(i):["center","center"]:i)[0]=o.test(i[0])?i[0]:"center",i[1]=l.test(i[1])?i[1]:"center",t=h.exec(i[0]),e=h.exec(i[1]),w[this]=[t?t[0]:0,e?e[0]:0],u[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===y.length&&(y[1]=y[0]),"right"===u.at[0]?m.left+=p:"center"===u.at[0]&&(m.left+=p/2),"bottom"===u.at[1]?m.top+=f:"center"===u.at[1]&&(m.top+=f/2),d=D(w.at,p,f),m.left+=d[0],m.top+=d[1],this.each(function(){var i,t,a=V(this),r=a.outerWidth(),l=a.outerHeight(),e=I(this,"marginLeft"),s=I(this,"marginTop"),n=r+e+I(this,"marginRight")+b.width,o=l+s+I(this,"marginBottom")+b.height,h=V.extend({},m),c=D(w.my,a.outerWidth(),a.outerHeight());"right"===u.my[0]?h.left-=r:"center"===u.my[0]&&(h.left-=r/2),"bottom"===u.my[1]?h.top-=l:"center"===u.my[1]&&(h.top-=l/2),h.left+=c[0],h.top+=c[1],i={marginLeft:e,marginTop:s},V.each(["left","top"],function(t,e){V.ui.position[y[t]]&&V.ui.position[y[t]][e](h,{targetWidth:p,targetHeight:f,elemWidth:r,elemHeight:l,collisionPosition:i,collisionWidth:n,collisionHeight:o,offset:[d[0]+c[0],d[1]+c[1]],my:u.my,at:u.at,within:v,elem:a})}),u.using&&(t=function(t){var e=g.left-h.left,i=e+p-r,s=g.top-h.top,n=s+f-l,o={target:{element:_,left:g.left,top:g.top,width:p,height:f},element:{element:a,left:h.left,top:h.top,width:r,height:l},horizontal:i<0?"left":0<e?"right":"center",vertical:n<0?"top":0<s?"bottom":"middle"};p<r&&k(e+i)<p&&(o.horizontal="center"),f<l&&k(s+n)<f&&(o.vertical="middle"),x(k(e),k(i))>x(k(s),k(n))?o.important="horizontal":o.important="vertical",u.using.call(this,t,o)}),a.offset(V.extend(h,{using:t}))})},V.ui.position={fit:{left:function(t,e){var i=e.within,s=i.isWindow?i.scrollLeft:i.offset.left,n=i.width,o=t.left-e.collisionPosition.marginLeft,a=s-o,r=o+e.collisionWidth-n-s;e.collisionWidth>n?0<a&&r<=0?(i=t.left+a+e.collisionWidth-n-s,t.left+=a-i):t.left=!(0<r&&a<=0)&&r<a?s+n-e.collisionWidth:s:0<a?t.left+=a:0<r?t.left-=r:t.left=x(t.left-o,t.left)},top:function(t,e){var i=e.within,s=i.isWindow?i.scrollTop:i.offset.top,n=e.within.height,o=t.top-e.collisionPosition.marginTop,a=s-o,r=o+e.collisionHeight-n-s;e.collisionHeight>n?0<a&&r<=0?(i=t.top+a+e.collisionHeight-n-s,t.top+=a-i):t.top=!(0<r&&a<=0)&&r<a?s+n-e.collisionHeight:s:0<a?t.top+=a:0<r?t.top-=r:t.top=x(t.top-o,t.top)}},flip:{left:function(t,e){var i=e.within,s=i.offset.left+i.scrollLeft,n=i.width,o=i.isWindow?i.scrollLeft:i.offset.left,a=t.left-e.collisionPosition.marginLeft,r=a-o,l=a+e.collisionWidth-n-o,h="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,i="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,a=-2*e.offset[0];r<0?((s=t.left+h+i+a+e.collisionWidth-n-s)<0||s<k(r))&&(t.left+=h+i+a):0<l&&(0<(o=t.left-e.collisionPosition.marginLeft+h+i+a-o)||k(o)<l)&&(t.left+=h+i+a)},top:function(t,e){var i=e.within,s=i.offset.top+i.scrollTop,n=i.height,o=i.isWindow?i.scrollTop:i.offset.top,a=t.top-e.collisionPosition.marginTop,r=a-o,l=a+e.collisionHeight-n-o,h="top"===e.my[1]?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,i="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,a=-2*e.offset[1];r<0?((s=t.top+h+i+a+e.collisionHeight-n-s)<0||s<k(r))&&(t.top+=h+i+a):0<l&&(0<(o=t.top-e.collisionPosition.marginTop+h+i+a-o)||k(o)<l)&&(t.top+=h+i+a)}},flipfit:{left:function(){V.ui.position.flip.left.apply(this,arguments),V.ui.position.fit.left.apply(this,arguments)},top:function(){V.ui.position.flip.top.apply(this,arguments),V.ui.position.fit.top.apply(this,arguments)}}};V.ui.position,V.extend(V.expr.pseudos,{data:V.expr.createPseudo?V.expr.createPseudo(function(e){return function(t){return!!V.data(t,e)}}):function(t,e,i){return!!V.data(t,i[3])}}),V.fn.extend({disableSelection:(t="onselectstart"in document.createElement("div")?"selectstart":"mousedown",function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}),enableSelection:function(){return this.off(".ui-disableSelection")}});var t,d=V,p={},e=p.toString,f=/^([\-+])=\s*(\d+\.?\d*)/,g=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[t[1],t[2],t[3],t[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[2.55*t[1],2.55*t[2],2.55*t[3],t[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/,parse:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16),t[4]?(parseInt(t[4],16)/255).toFixed(2):1]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/,parse:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),t[4]?(parseInt(t[4]+t[4],16)/255).toFixed(2):1]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(t){return[t[1],t[2]/100,t[3]/100,t[4]]}}],m=d.Color=function(t,e,i,s){return new d.Color.fn.parse(t,e,i,s)},_={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},v={byte:{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},b=m.support={},y=d("<p>")[0],w=d.each;function P(t){return null==t?t+"":"object"==typeof t?p[e.call(t)]||"object":typeof t}function M(t,e,i){var s=v[e.type]||{};return null==t?i||!e.def?null:e.def:(t=s.floor?~~t:parseFloat(t),isNaN(t)?e.def:s.mod?(t+s.mod)%s.mod:Math.min(s.max,Math.max(0,t)))}function S(s){var n=m(),o=n._rgba=[];return s=s.toLowerCase(),w(g,function(t,e){var i=e.re.exec(s),i=i&&e.parse(i),e=e.space||"rgba";if(i)return i=n[e](i),n[_[e].cache]=i[_[e].cache],o=n._rgba=i._rgba,!1}),o.length?("0,0,0,0"===o.join()&&d.extend(o,B.transparent),n):B[s]}function H(t,e,i){return 6*(i=(i+1)%1)<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}y.style.cssText="background-color:rgba(1,1,1,.5)",b.rgba=-1<y.style.backgroundColor.indexOf("rgba"),w(_,function(t,e){e.cache="_"+t,e.props.alpha={idx:3,type:"percent",def:1}}),d.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(t,e){p["[object "+e+"]"]=e.toLowerCase()}),(m.fn=d.extend(m.prototype,{parse:function(n,t,e,i){if(void 0===n)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=d(n).css(t),t=void 0);var o=this,s=P(n),a=this._rgba=[];return void 0!==t&&(n=[n,t,e,i],s="array"),"string"===s?this.parse(S(n)||B._default):"array"===s?(w(_.rgba.props,function(t,e){a[e.idx]=M(n[e.idx],e)}),this):"object"===s?(w(_,n instanceof m?function(t,e){n[e.cache]&&(o[e.cache]=n[e.cache].slice())}:function(t,i){var s=i.cache;w(i.props,function(t,e){if(!o[s]&&i.to){if("alpha"===t||null==n[t])return;o[s]=i.to(o._rgba)}o[s][e.idx]=M(n[t],e,!0)}),o[s]&&d.inArray(null,o[s].slice(0,3))<0&&(null==o[s][3]&&(o[s][3]=1),i.from&&(o._rgba=i.from(o[s])))}),this):void 0},is:function(t){var n=m(t),o=!0,a=this;return w(_,function(t,e){var i,s=n[e.cache];return s&&(i=a[e.cache]||e.to&&e.to(a._rgba)||[],w(e.props,function(t,e){if(null!=s[e.idx])return o=s[e.idx]===i[e.idx]})),o}),o},_space:function(){var i=[],s=this;return w(_,function(t,e){s[e.cache]&&i.push(t)}),i.pop()},transition:function(t,a){var e=(h=m(t))._space(),i=_[e],t=0===this.alpha()?m("transparent"):this,r=t[i.cache]||i.to(t._rgba),l=r.slice(),h=h[i.cache];return w(i.props,function(t,e){var i=e.idx,s=r[i],n=h[i],o=v[e.type]||{};null!==n&&(null===s?l[i]=n:(o.mod&&(n-s>o.mod/2?s+=o.mod:s-n>o.mod/2&&(s-=o.mod)),l[i]=M((n-s)*a+s,e)))}),this[e](l)},blend:function(t){if(1===this._rgba[3])return this;var e=this._rgba.slice(),i=e.pop(),s=m(t)._rgba;return m(d.map(e,function(t,e){return(1-i)*s[e]+i*t}))},toRgbaString:function(){var t="rgba(",e=d.map(this._rgba,function(t,e){return null!=t?t:2<e?1:0});return 1===e[3]&&(e.pop(),t="rgb("),t+e.join()+")"},toHslaString:function(){var t="hsla(",e=d.map(this.hsla(),function(t,e){return null==t&&(t=2<e?1:0),t=e&&e<3?Math.round(100*t)+"%":t});return 1===e[3]&&(e.pop(),t="hsl("),t+e.join()+")"},toHexString:function(t){var e=this._rgba.slice(),i=e.pop();return t&&e.push(~~(255*i)),"#"+d.map(e,function(t){return 1===(t=(t||0).toString(16)).length?"0"+t:t}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}})).parse.prototype=m.fn,_.hsla.to=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/255,i=t[1]/255,s=t[2]/255,n=t[3],o=Math.max(e,i,s),a=Math.min(e,i,s),r=o-a,l=o+a,t=.5*l,i=a===o?0:e===o?60*(i-s)/r+360:i===o?60*(s-e)/r+120:60*(e-i)/r+240,l=0==r?0:t<=.5?r/l:r/(2-l);return[Math.round(i)%360,l,t,null==n?1:n]},_.hsla.from=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/360,i=t[1],s=t[2],t=t[3],i=s<=.5?s*(1+i):s+i-s*i,s=2*s-i;return[Math.round(255*H(s,i,e+1/3)),Math.round(255*H(s,i,e)),Math.round(255*H(s,i,e-1/3)),t]},w(_,function(l,t){var e=t.props,o=t.cache,a=t.to,r=t.from;m.fn[l]=function(t){if(a&&!this[o]&&(this[o]=a(this._rgba)),void 0===t)return this[o].slice();var i=P(t),s="array"===i||"object"===i?t:arguments,n=this[o].slice();return w(e,function(t,e){t=s["object"===i?t:e.idx];null==t&&(t=n[e.idx]),n[e.idx]=M(t,e)}),r?((t=m(r(n)))[o]=n,t):m(n)},w(e,function(a,r){m.fn[a]||(m.fn[a]=function(t){var e,i=P(t),s="alpha"===a?this._hsla?"hsla":"rgba":l,n=this[s](),o=n[r.idx];return"undefined"===i?o:("function"===i&&(i=P(t=t.call(this,o))),null==t&&r.empty?this:("string"===i&&(e=f.exec(t))&&(t=o+parseFloat(e[2])*("+"===e[1]?1:-1)),n[r.idx]=t,this[s](n)))})})}),(m.hook=function(t){t=t.split(" ");w(t,function(t,o){d.cssHooks[o]={set:function(t,e){var i,s,n="";if("transparent"!==e&&("string"!==P(e)||(i=S(e)))){if(e=m(i||e),!b.rgba&&1!==e._rgba[3]){for(s="backgroundColor"===o?t.parentNode:t;(""===n||"transparent"===n)&&s&&s.style;)try{n=d.css(s,"backgroundColor"),s=s.parentNode}catch(t){}e=e.blend(n&&"transparent"!==n?n:"_default")}e=e.toRgbaString()}try{t.style[o]=e}catch(t){}}},d.fx.step[o]=function(t){t.colorInit||(t.start=m(t.elem,o),t.end=m(t.end),t.colorInit=!0),d.cssHooks[o].set(t.elem,t.start.transition(t.end,t.pos))}})})("backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor"),d.cssHooks.borderColor={expand:function(i){var s={};return w(["Top","Right","Bottom","Left"],function(t,e){s["border"+e+"Color"]=i}),s}};var z,A,O,N,E,W,F,L,R,Y,B=d.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"},j="ui-effects-",q="ui-effects-style",K="ui-effects-animated";function U(t){var e,i,s=t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(t,null):t.currentStyle,n={};if(s&&s.length&&s[0]&&s[s[0]])for(i=s.length;i--;)"string"==typeof s[e=s[i]]&&(n[e.replace(/-([\da-z])/gi,function(t,e){return e.toUpperCase()})]=s[e]);else for(e in s)"string"==typeof s[e]&&(n[e]=s[e]);return n}function X(t,e,i,s){return t={effect:t=V.isPlainObject(t)?(e=t).effect:t},"function"==typeof(e=null==e?{}:e)&&(s=e,i=null,e={}),"number"!=typeof e&&!V.fx.speeds[e]||(s=i,i=e,e={}),"function"==typeof i&&(s=i,i=null),e&&V.extend(t,e),i=i||e.duration,t.duration=V.fx.off?0:"number"==typeof i?i:i in V.fx.speeds?V.fx.speeds[i]:V.fx.speeds._default,t.complete=s||e.complete,t}function $(t){return!t||"number"==typeof t||V.fx.speeds[t]||("string"==typeof t&&!V.effects.effect[t]||("function"==typeof t||"object"==typeof t&&!t.effect))}function G(t,e){var i=e.outerWidth(),e=e.outerHeight(),t=/^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/.exec(t)||["",0,i,e,0];return{top:parseFloat(t[1])||0,right:"auto"===t[2]?i:parseFloat(t[2]),bottom:"auto"===t[3]?e:parseFloat(t[3]),left:parseFloat(t[4])||0}}V.effects={effect:{}},N=["add","remove","toggle"],E={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1},V.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,e){V.fx.step[e]=function(t){("none"!==t.end&&!t.setAttr||1===t.pos&&!t.setAttr)&&(d.style(t.elem,e,t.end),t.setAttr=!0)}}),V.fn.addBack||(V.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),V.effects.animateClass=function(n,t,e,i){var o=V.speed(t,e,i);return this.queue(function(){var i=V(this),t=i.attr("class")||"",e=(e=o.children?i.find("*").addBack():i).map(function(){return{el:V(this),start:U(this)}}),s=function(){V.each(N,function(t,e){n[e]&&i[e+"Class"](n[e])})};s(),e=e.map(function(){return this.end=U(this.el[0]),this.diff=function(t,e){var i,s,n={};for(i in e)s=e[i],t[i]!==s&&(E[i]||!V.fx.step[i]&&isNaN(parseFloat(s))||(n[i]=s));return n}(this.start,this.end),this}),i.attr("class",t),e=e.map(function(){var t=this,e=V.Deferred(),i=V.extend({},o,{queue:!1,complete:function(){e.resolve(t)}});return this.el.animate(this.diff,i),e.promise()}),V.when.apply(V,e.get()).done(function(){s(),V.each(arguments,function(){var e=this.el;V.each(this.diff,function(t){e.css(t,"")})}),o.complete.call(i[0])})})},V.fn.extend({addClass:(O=V.fn.addClass,function(t,e,i,s){return e?V.effects.animateClass.call(this,{add:t},e,i,s):O.apply(this,arguments)}),removeClass:(A=V.fn.removeClass,function(t,e,i,s){return 1<arguments.length?V.effects.animateClass.call(this,{remove:t},e,i,s):A.apply(this,arguments)}),toggleClass:(z=V.fn.toggleClass,function(t,e,i,s,n){return"boolean"==typeof e||void 0===e?i?V.effects.animateClass.call(this,e?{add:t}:{remove:t},i,s,n):z.apply(this,arguments):V.effects.animateClass.call(this,{toggle:t},e,i,s)}),switchClass:function(t,e,i,s,n){return V.effects.animateClass.call(this,{add:e,remove:t},i,s,n)}}),V.expr&&V.expr.pseudos&&V.expr.pseudos.animated&&(V.expr.pseudos.animated=(W=V.expr.pseudos.animated,function(t){return!!V(t).data(K)||W(t)})),!1!==V.uiBackCompat&&V.extend(V.effects,{save:function(t,e){for(var i=0,s=e.length;i<s;i++)null!==e[i]&&t.data(j+e[i],t[0].style[e[i]])},restore:function(t,e){for(var i,s=0,n=e.length;s<n;s++)null!==e[s]&&(i=t.data(j+e[s]),t.css(e[s],i))},setMode:function(t,e){return e="toggle"===e?t.is(":hidden")?"show":"hide":e},createWrapper:function(i){if(i.parent().is(".ui-effects-wrapper"))return i.parent();var s={width:i.outerWidth(!0),height:i.outerHeight(!0),float:i.css("float")},t=V("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e={width:i.width(),height:i.height()},n=document.activeElement;try{n.id}catch(t){n=document.body}return i.wrap(t),i[0]!==n&&!V.contains(i[0],n)||V(n).trigger("focus"),t=i.parent(),"static"===i.css("position")?(t.css({position:"relative"}),i.css({position:"relative"})):(V.extend(s,{position:i.css("position"),zIndex:i.css("z-index")}),V.each(["top","left","bottom","right"],function(t,e){s[e]=i.css(e),isNaN(parseInt(s[e],10))&&(s[e]="auto")}),i.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),i.css(e),t.css(s).show()},removeWrapper:function(t){var e=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),t[0]!==e&&!V.contains(t[0],e)||V(e).trigger("focus")),t}}),V.extend(V.effects,{version:"1.13.2",define:function(t,e,i){return i||(i=e,e="effect"),V.effects.effect[t]=i,V.effects.effect[t].mode=e,i},scaledDimensions:function(t,e,i){if(0===e)return{height:0,width:0,outerHeight:0,outerWidth:0};var s="horizontal"!==i?(e||100)/100:1,e="vertical"!==i?(e||100)/100:1;return{height:t.height()*e,width:t.width()*s,outerHeight:t.outerHeight()*e,outerWidth:t.outerWidth()*s}},clipToBox:function(t){return{width:t.clip.right-t.clip.left,height:t.clip.bottom-t.clip.top,left:t.clip.left,top:t.clip.top}},unshift:function(t,e,i){var s=t.queue();1<e&&s.splice.apply(s,[1,0].concat(s.splice(e,i))),t.dequeue()},saveStyle:function(t){t.data(q,t[0].style.cssText)},restoreStyle:function(t){t[0].style.cssText=t.data(q)||"",t.removeData(q)},mode:function(t,e){t=t.is(":hidden");return"toggle"===e&&(e=t?"show":"hide"),e=(t?"hide"===e:"show"===e)?"none":e},getBaseline:function(t,e){var i,s;switch(t[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=t[0]/e.height}switch(t[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=t[1]/e.width}return{x:s,y:i}},createPlaceholder:function(t){var e,i=t.css("position"),s=t.position();return t.css({marginTop:t.css("marginTop"),marginBottom:t.css("marginBottom"),marginLeft:t.css("marginLeft"),marginRight:t.css("marginRight")}).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()),/^(static|relative)/.test(i)&&(i="absolute",e=V("<"+t[0].nodeName+">").insertAfter(t).css({display:/^(inline|ruby)/.test(t.css("display"))?"inline-block":"block",visibility:"hidden",marginTop:t.css("marginTop"),marginBottom:t.css("marginBottom"),marginLeft:t.css("marginLeft"),marginRight:t.css("marginRight"),float:t.css("float")}).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).addClass("ui-effects-placeholder"),t.data(j+"placeholder",e)),t.css({position:i,left:s.left,top:s.top}),e},removePlaceholder:function(t){var e=j+"placeholder",i=t.data(e);i&&(i.remove(),t.removeData(e))},cleanUp:function(t){V.effects.restoreStyle(t),V.effects.removePlaceholder(t)},setTransition:function(s,t,n,o){return o=o||{},V.each(t,function(t,e){var i=s.cssUnit(e);0<i[0]&&(o[e]=i[0]*n+i[1])}),o}}),V.fn.extend({effect:function(){function t(t){var e=V(this),i=V.effects.mode(e,r)||o;e.data(K,!0),l.push(i),o&&("show"===i||i===o&&"hide"===i)&&e.show(),o&&"none"===i||V.effects.saveStyle(e),"function"==typeof t&&t()}var s=X.apply(this,arguments),n=V.effects.effect[s.effect],o=n.mode,e=s.queue,i=e||"fx",a=s.complete,r=s.mode,l=[];return V.fx.off||!n?r?this[r](s.duration,a):this.each(function(){a&&a.call(this)}):!1===e?this.each(t).each(h):this.queue(i,t).queue(i,h);function h(t){var e=V(this);function i(){"function"==typeof a&&a.call(e[0]),"function"==typeof t&&t()}s.mode=l.shift(),!1===V.uiBackCompat||o?"none"===s.mode?(e[r](),i()):n.call(e[0],s,function(){e.removeData(K),V.effects.cleanUp(e),"hide"===s.mode&&e.hide(),i()}):(e.is(":hidden")?"hide"===r:"show"===r)?(e[r](),i()):n.call(e[0],s,i)}},show:(R=V.fn.show,function(t){if($(t))return R.apply(this,arguments);t=X.apply(this,arguments);return t.mode="show",this.effect.call(this,t)}),hide:(L=V.fn.hide,function(t){if($(t))return L.apply(this,arguments);t=X.apply(this,arguments);return t.mode="hide",this.effect.call(this,t)}),toggle:(F=V.fn.toggle,function(t){if($(t)||"boolean"==typeof t)return F.apply(this,arguments);t=X.apply(this,arguments);return t.mode="toggle",this.effect.call(this,t)}),cssUnit:function(t){var i=this.css(t),s=[];return V.each(["em","px","%","pt"],function(t,e){0<i.indexOf(e)&&(s=[parseFloat(i),e])}),s},cssClip:function(t){return t?this.css("clip","rect("+t.top+"px "+t.right+"px "+t.bottom+"px "+t.left+"px)"):G(this.css("clip"),this)},transfer:function(t,e){var i=V(this),s=V(t.to),n="fixed"===s.css("position"),o=V("body"),a=n?o.scrollTop():0,r=n?o.scrollLeft():0,o=s.offset(),o={top:o.top-a,left:o.left-r,height:s.innerHeight(),width:s.innerWidth()},s=i.offset(),l=V("<div class='ui-effects-transfer'></div>");l.appendTo("body").addClass(t.className).css({top:s.top-a,left:s.left-r,height:i.innerHeight(),width:i.innerWidth(),position:n?"fixed":"absolute"}).animate(o,t.duration,t.easing,function(){l.remove(),"function"==typeof e&&e()})}}),V.fx.step.clip=function(t){t.clipInit||(t.start=V(t.elem).cssClip(),"string"==typeof t.end&&(t.end=G(t.end,t.elem)),t.clipInit=!0),V(t.elem).cssClip({top:t.pos*(t.end.top-t.start.top)+t.start.top,right:t.pos*(t.end.right-t.start.right)+t.start.right,bottom:t.pos*(t.end.bottom-t.start.bottom)+t.start.bottom,left:t.pos*(t.end.left-t.start.left)+t.start.left})},Y={},V.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,t){Y[t]=function(t){return Math.pow(t,e+2)}}),V.extend(Y,{Sine:function(t){return 1-Math.cos(t*Math.PI/2)},Circ:function(t){return 1-Math.sqrt(1-t*t)},Elastic:function(t){return 0===t||1===t?t:-Math.pow(2,8*(t-1))*Math.sin((80*(t-1)-7.5)*Math.PI/15)},Back:function(t){return t*t*(3*t-2)},Bounce:function(t){for(var e,i=4;t<((e=Math.pow(2,--i))-1)/11;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}}),V.each(Y,function(t,e){V.easing["easeIn"+t]=e,V.easing["easeOut"+t]=function(t){return 1-e(1-t)},V.easing["easeInOut"+t]=function(t){return t<.5?e(2*t)/2:1-e(-2*t+2)/2}});y=V.effects,V.effects.define("blind","hide",function(t,e){var i={up:["bottom","top"],vertical:["bottom","top"],down:["top","bottom"],left:["right","left"],horizontal:["right","left"],right:["left","right"]},s=V(this),n=t.direction||"up",o=s.cssClip(),a={clip:V.extend({},o)},r=V.effects.createPlaceholder(s);a.clip[i[n][0]]=a.clip[i[n][1]],"show"===t.mode&&(s.cssClip(a.clip),r&&r.css(V.effects.clipToBox(a)),a.clip=o),r&&r.animate(V.effects.clipToBox(a),t.duration,t.easing),s.animate(a,{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),V.effects.define("bounce",function(t,e){var i,s,n=V(this),o=t.mode,a="hide"===o,r="show"===o,l=t.direction||"up",h=t.distance,c=t.times||5,o=2*c+(r||a?1:0),u=t.duration/o,d=t.easing,p="up"===l||"down"===l?"top":"left",f="up"===l||"left"===l,g=0,t=n.queue().length;for(V.effects.createPlaceholder(n),l=n.css(p),h=h||n["top"==p?"outerHeight":"outerWidth"]()/3,r&&((s={opacity:1})[p]=l,n.css("opacity",0).css(p,f?2*-h:2*h).animate(s,u,d)),a&&(h/=Math.pow(2,c-1)),(s={})[p]=l;g<c;g++)(i={})[p]=(f?"-=":"+=")+h,n.animate(i,u,d).animate(s,u,d),h=a?2*h:h/2;a&&((i={opacity:0})[p]=(f?"-=":"+=")+h,n.animate(i,u,d)),n.queue(e),V.effects.unshift(n,t,1+o)}),V.effects.define("clip","hide",function(t,e){var i={},s=V(this),n=t.direction||"vertical",o="both"===n,a=o||"horizontal"===n,o=o||"vertical"===n,n=s.cssClip();i.clip={top:o?(n.bottom-n.top)/2:n.top,right:a?(n.right-n.left)/2:n.right,bottom:o?(n.bottom-n.top)/2:n.bottom,left:a?(n.right-n.left)/2:n.left},V.effects.createPlaceholder(s),"show"===t.mode&&(s.cssClip(i.clip),i.clip=n),s.animate(i,{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),V.effects.define("drop","hide",function(t,e){var i=V(this),s="show"===t.mode,n=t.direction||"left",o="up"===n||"down"===n?"top":"left",a="up"===n||"left"===n?"-=":"+=",r="+="==a?"-=":"+=",l={opacity:0};V.effects.createPlaceholder(i),n=t.distance||i["top"==o?"outerHeight":"outerWidth"](!0)/2,l[o]=a+n,s&&(i.css(l),l[o]=r+n,l.opacity=1),i.animate(l,{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),V.effects.define("explode","hide",function(t,e){var i,s,n,o,a,r,l=t.pieces?Math.round(Math.sqrt(t.pieces)):3,h=l,c=V(this),u="show"===t.mode,d=c.show().css("visibility","hidden").offset(),p=Math.ceil(c.outerWidth()/h),f=Math.ceil(c.outerHeight()/l),g=[];function m(){g.push(this),g.length===l*h&&(c.css({visibility:"visible"}),V(g).remove(),e())}for(i=0;i<l;i++)for(o=d.top+i*f,r=i-(l-1)/2,s=0;s<h;s++)n=d.left+s*p,a=s-(h-1)/2,c.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-s*p,top:-i*f}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:p,height:f,left:n+(u?a*p:0),top:o+(u?r*f:0),opacity:u?0:1}).animate({left:n+(u?0:a*p),top:o+(u?0:r*f),opacity:u?1:0},t.duration||500,t.easing,m)}),V.effects.define("fade","toggle",function(t,e){var i="show"===t.mode;V(this).css("opacity",i?0:1).animate({opacity:i?1:0},{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),V.effects.define("fold","hide",function(e,t){var i=V(this),s=e.mode,n="show"===s,o="hide"===s,a=e.size||15,r=/([0-9]+)%/.exec(a),l=!!e.horizFirst?["right","bottom"]:["bottom","right"],h=e.duration/2,c=V.effects.createPlaceholder(i),u=i.cssClip(),d={clip:V.extend({},u)},p={clip:V.extend({},u)},f=[u[l[0]],u[l[1]]],s=i.queue().length;r&&(a=parseInt(r[1],10)/100*f[o?0:1]),d.clip[l[0]]=a,p.clip[l[0]]=a,p.clip[l[1]]=0,n&&(i.cssClip(p.clip),c&&c.css(V.effects.clipToBox(p)),p.clip=u),i.queue(function(t){c&&c.animate(V.effects.clipToBox(d),h,e.easing).animate(V.effects.clipToBox(p),h,e.easing),t()}).animate(d,h,e.easing).animate(p,h,e.easing).queue(t),V.effects.unshift(i,s,4)}),V.effects.define("highlight","show",function(t,e){var i=V(this),s={backgroundColor:i.css("backgroundColor")};"hide"===t.mode&&(s.opacity=0),V.effects.saveStyle(i),i.css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(s,{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),V.effects.define("size",function(s,e){var n,i=V(this),t=["fontSize"],o=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],a=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],r=s.mode,l="effect"!==r,h=s.scale||"both",c=s.origin||["middle","center"],u=i.css("position"),d=i.position(),p=V.effects.scaledDimensions(i),f=s.from||p,g=s.to||V.effects.scaledDimensions(i,0);V.effects.createPlaceholder(i),"show"===r&&(r=f,f=g,g=r),n={from:{y:f.height/p.height,x:f.width/p.width},to:{y:g.height/p.height,x:g.width/p.width}},"box"!==h&&"both"!==h||(n.from.y!==n.to.y&&(f=V.effects.setTransition(i,o,n.from.y,f),g=V.effects.setTransition(i,o,n.to.y,g)),n.from.x!==n.to.x&&(f=V.effects.setTransition(i,a,n.from.x,f),g=V.effects.setTransition(i,a,n.to.x,g))),"content"!==h&&"both"!==h||n.from.y!==n.to.y&&(f=V.effects.setTransition(i,t,n.from.y,f),g=V.effects.setTransition(i,t,n.to.y,g)),c&&(c=V.effects.getBaseline(c,p),f.top=(p.outerHeight-f.outerHeight)*c.y+d.top,f.left=(p.outerWidth-f.outerWidth)*c.x+d.left,g.top=(p.outerHeight-g.outerHeight)*c.y+d.top,g.left=(p.outerWidth-g.outerWidth)*c.x+d.left),delete f.outerHeight,delete f.outerWidth,i.css(f),"content"!==h&&"both"!==h||(o=o.concat(["marginTop","marginBottom"]).concat(t),a=a.concat(["marginLeft","marginRight"]),i.find("*[width]").each(function(){var t=V(this),e=V.effects.scaledDimensions(t),i={height:e.height*n.from.y,width:e.width*n.from.x,outerHeight:e.outerHeight*n.from.y,outerWidth:e.outerWidth*n.from.x},e={height:e.height*n.to.y,width:e.width*n.to.x,outerHeight:e.height*n.to.y,outerWidth:e.width*n.to.x};n.from.y!==n.to.y&&(i=V.effects.setTransition(t,o,n.from.y,i),e=V.effects.setTransition(t,o,n.to.y,e)),n.from.x!==n.to.x&&(i=V.effects.setTransition(t,a,n.from.x,i),e=V.effects.setTransition(t,a,n.to.x,e)),l&&V.effects.saveStyle(t),t.css(i),t.animate(e,s.duration,s.easing,function(){l&&V.effects.restoreStyle(t)})})),i.animate(g,{queue:!1,duration:s.duration,easing:s.easing,complete:function(){var t=i.offset();0===g.opacity&&i.css("opacity",f.opacity),l||(i.css("position","static"===u?"relative":u).offset(t),V.effects.saveStyle(i)),e()}})}),V.effects.define("scale",function(t,e){var i=V(this),s=t.mode,s=parseInt(t.percent,10)||(0===parseInt(t.percent,10)||"effect"!==s?0:100),s=V.extend(!0,{from:V.effects.scaledDimensions(i),to:V.effects.scaledDimensions(i,s,t.direction||"both"),origin:t.origin||["middle","center"]},t);t.fade&&(s.from.opacity=1,s.to.opacity=0),V.effects.effect.size.call(this,s,e)}),V.effects.define("puff","hide",function(t,e){t=V.extend(!0,{},t,{fade:!0,percent:parseInt(t.percent,10)||150});V.effects.effect.scale.call(this,t,e)}),V.effects.define("pulsate","show",function(t,e){var i=V(this),s=t.mode,n="show"===s,o=2*(t.times||5)+(n||"hide"===s?1:0),a=t.duration/o,r=0,l=1,s=i.queue().length;for(!n&&i.is(":visible")||(i.css("opacity",0).show(),r=1);l<o;l++)i.animate({opacity:r},a,t.easing),r=1-r;i.animate({opacity:r},a,t.easing),i.queue(e),V.effects.unshift(i,s,1+o)}),V.effects.define("shake",function(t,e){var i=1,s=V(this),n=t.direction||"left",o=t.distance||20,a=t.times||3,r=2*a+1,l=Math.round(t.duration/r),h="up"===n||"down"===n?"top":"left",c="up"===n||"left"===n,u={},d={},p={},n=s.queue().length;for(V.effects.createPlaceholder(s),u[h]=(c?"-=":"+=")+o,d[h]=(c?"+=":"-=")+2*o,p[h]=(c?"-=":"+=")+2*o,s.animate(u,l,t.easing);i<a;i++)s.animate(d,l,t.easing).animate(p,l,t.easing);s.animate(d,l,t.easing).animate(u,l/2,t.easing).queue(e),V.effects.unshift(s,n,1+r)}),V.effects.define("slide","show",function(t,e){var i,s,n=V(this),o={up:["bottom","top"],down:["top","bottom"],left:["right","left"],right:["left","right"]},a=t.mode,r=t.direction||"left",l="up"===r||"down"===r?"top":"left",h="up"===r||"left"===r,c=t.distance||n["top"==l?"outerHeight":"outerWidth"](!0),u={};V.effects.createPlaceholder(n),i=n.cssClip(),s=n.position()[l],u[l]=(h?-1:1)*c+s,u.clip=n.cssClip(),u.clip[o[r][1]]=u.clip[o[r][0]],"show"===a&&(n.cssClip(u.clip),n.css(l,u[l]),u.clip=i,u[l]=s),n.animate(u,{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),y=!1!==V.uiBackCompat?V.effects.define("transfer",function(t,e){V(this).transfer(t,e)}):y;V.ui.focusable=function(t,e){var i,s,n,o,a=t.nodeName.toLowerCase();return"area"===a?(s=(i=t.parentNode).name,!(!t.href||!s||"map"!==i.nodeName.toLowerCase())&&(0<(s=V("img[usemap='#"+s+"']")).length&&s.is(":visible"))):(/^(input|select|textarea|button|object)$/.test(a)?(n=!t.disabled)&&(o=V(t).closest("fieldset")[0])&&(n=!o.disabled):n="a"===a&&t.href||e,n&&V(t).is(":visible")&&function(t){var e=t.css("visibility");for(;"inherit"===e;)t=t.parent(),e=t.css("visibility");return"visible"===e}(V(t)))},V.extend(V.expr.pseudos,{focusable:function(t){return V.ui.focusable(t,null!=V.attr(t,"tabindex"))}});var Q,J;V.ui.focusable,V.fn._form=function(){return"string"==typeof this[0].form?this.closest("form"):V(this[0].form)},V.ui.formResetMixin={_formResetHandler:function(){var e=V(this);setTimeout(function(){var t=e.data("ui-form-reset-instances");V.each(t,function(){this.refresh()})})},_bindFormResetHandler:function(){var t;this.form=this.element._form(),this.form.length&&((t=this.form.data("ui-form-reset-instances")||[]).length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t))},_unbindFormResetHandler:function(){var t;this.form.length&&((t=this.form.data("ui-form-reset-instances")).splice(V.inArray(this,t),1),t.length?this.form.data("ui-form-reset-instances",t):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset"))}};V.expr.pseudos||(V.expr.pseudos=V.expr[":"]),V.uniqueSort||(V.uniqueSort=V.unique),V.escapeSelector||(Q=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,J=function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t},V.escapeSelector=function(t){return(t+"").replace(Q,J)}),V.fn.even&&V.fn.odd||V.fn.extend({even:function(){return this.filter(function(t){return t%2==0})},odd:function(){return this.filter(function(t){return t%2==1})}});var Z;V.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},V.fn.labels=function(){var t,e,i;return this.length?this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(e=this.eq(0).parents("label"),(t=this.attr("id"))&&(i=(i=this.eq(0).parents().last()).add((i.length?i:this).siblings()),t="label[for='"+V.escapeSelector(t)+"']",e=e.add(i.find(t).addBack(t))),this.pushStack(e)):this.pushStack([])},V.fn.scrollParent=function(t){var e=this.css("position"),i="absolute"===e,s=t?/(auto|scroll|hidden)/:/(auto|scroll)/,t=this.parents().filter(function(){var t=V(this);return(!i||"static"!==t.css("position"))&&s.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==e&&t.length?t:V(this[0].ownerDocument||document)},V.extend(V.expr.pseudos,{tabbable:function(t){var e=V.attr(t,"tabindex"),i=null!=e;return(!i||0<=e)&&V.ui.focusable(t,i)}}),V.fn.extend({uniqueId:(Z=0,function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++Z)})}),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&V(this).removeAttr("id")})}}),V.widget("ui.accordion",{version:"1.13.2",options:{active:0,animate:{},classes:{"ui-accordion-header":"ui-corner-top","ui-accordion-header-collapsed":"ui-corner-all","ui-accordion-content":"ui-corner-bottom"},collapsible:!1,event:"click",header:function(t){return t.find("> li > :first-child").add(t.find("> :not(li)").even())},heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var t=this.options;this.prevShow=this.prevHide=V(),this._addClass("ui-accordion","ui-widget ui-helper-reset"),this.element.attr("role","tablist"),t.collapsible||!1!==t.active&&null!=t.active||(t.active=0),this._processPanels(),t.active<0&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():V()}},_createIcons:function(){var t,e=this.options.icons;e&&(t=V("<span>"),this._addClass(t,"ui-accordion-header-icon","ui-icon "+e.header),t.prependTo(this.headers),t=this.active.children(".ui-accordion-header-icon"),this._removeClass(t,e.header)._addClass(t,null,e.activeHeader)._addClass(this.headers,"ui-accordion-icons"))},_destroyIcons:function(){this._removeClass(this.headers,"ui-accordion-icons"),this.headers.children(".ui-accordion-header-icon").remove()},_destroy:function(){var t;this.element.removeAttr("role"),this.headers.removeAttr("role aria-expanded aria-selected aria-controls tabIndex").removeUniqueId(),this._destroyIcons(),t=this.headers.next().css("display","").removeAttr("role aria-hidden aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&t.css("height","")},_setOption:function(t,e){"active"!==t?("event"===t&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(e)),this._super(t,e),"collapsible"!==t||e||!1!==this.options.active||this._activate(0),"icons"===t&&(this._destroyIcons(),e&&this._createIcons())):this._activate(e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t),this._toggleClass(this.headers.add(this.headers.next()),null,"ui-state-disabled",!!t)},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var e=V.ui.keyCode,i=this.headers.length,s=this.headers.index(t.target),n=!1;switch(t.keyCode){case e.RIGHT:case e.DOWN:n=this.headers[(s+1)%i];break;case e.LEFT:case e.UP:n=this.headers[(s-1+i)%i];break;case e.SPACE:case e.ENTER:this._eventHandler(t);break;case e.HOME:n=this.headers[0];break;case e.END:n=this.headers[i-1]}n&&(V(t.target).attr("tabIndex",-1),V(n).attr("tabIndex",0),V(n).trigger("focus"),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===V.ui.keyCode.UP&&t.ctrlKey&&V(t.currentTarget).prev().trigger("focus")},refresh:function(){var t=this.options;this._processPanels(),!1===t.active&&!0===t.collapsible||!this.headers.length?(t.active=!1,this.active=V()):!1===t.active?this._activate(0):this.active.length&&!V.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=V()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var t=this.headers,e=this.panels;"function"==typeof this.options.header?this.headers=this.options.header(this.element):this.headers=this.element.find(this.options.header),this._addClass(this.headers,"ui-accordion-header ui-accordion-header-collapsed","ui-state-default"),this.panels=this.headers.next().filter(":not(.ui-accordion-content-active)").hide(),this._addClass(this.panels,"ui-accordion-content","ui-helper-reset ui-widget-content"),e&&(this._off(t.not(this.headers)),this._off(e.not(this.panels)))},_refresh:function(){var i,t=this.options,e=t.heightStyle,s=this.element.parent();this.active=this._findActive(t.active),this._addClass(this.active,"ui-accordion-header-active","ui-state-active")._removeClass(this.active,"ui-accordion-header-collapsed"),this._addClass(this.active.next(),"ui-accordion-content-active"),this.active.next().show(),this.headers.attr("role","tab").each(function(){var t=V(this),e=t.uniqueId().attr("id"),i=t.next(),s=i.uniqueId().attr("id");t.attr("aria-controls",s),i.attr("aria-labelledby",e)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(t.event),"fill"===e?(i=s.height(),this.element.siblings(":visible").each(function(){var t=V(this),e=t.css("position");"absolute"!==e&&"fixed"!==e&&(i-=t.outerHeight(!0))}),this.headers.each(function(){i-=V(this).outerHeight(!0)}),this.headers.next().each(function(){V(this).height(Math.max(0,i-V(this).innerHeight()+V(this).height()))}).css("overflow","auto")):"auto"===e&&(i=0,this.headers.next().each(function(){var t=V(this).is(":visible");t||V(this).show(),i=Math.max(i,V(this).css("height","").height()),t||V(this).hide()}).height(i))},_activate:function(t){t=this._findActive(t)[0];t!==this.active[0]&&(t=t||this.active[0],this._eventHandler({target:t,currentTarget:t,preventDefault:V.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):V()},_setupEvents:function(t){var i={keydown:"_keydown"};t&&V.each(t.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var e=this.options,i=this.active,s=V(t.currentTarget),n=s[0]===i[0],o=n&&e.collapsible,a=o?V():s.next(),r=i.next(),a={oldHeader:i,oldPanel:r,newHeader:o?V():s,newPanel:a};t.preventDefault(),n&&!e.collapsible||!1===this._trigger("beforeActivate",t,a)||(e.active=!o&&this.headers.index(s),this.active=n?V():s,this._toggle(a),this._removeClass(i,"ui-accordion-header-active","ui-state-active"),e.icons&&(i=i.children(".ui-accordion-header-icon"),this._removeClass(i,null,e.icons.activeHeader)._addClass(i,null,e.icons.header)),n||(this._removeClass(s,"ui-accordion-header-collapsed")._addClass(s,"ui-accordion-header-active","ui-state-active"),e.icons&&(n=s.children(".ui-accordion-header-icon"),this._removeClass(n,null,e.icons.header)._addClass(n,null,e.icons.activeHeader)),this._addClass(s.next(),"ui-accordion-content-active")))},_toggle:function(t){var e=t.newPanel,i=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=e,this.prevHide=i,this.options.animate?this._animate(e,i,t):(i.hide(),e.show(),this._toggleComplete(t)),i.attr({"aria-hidden":"true"}),i.prev().attr({"aria-selected":"false","aria-expanded":"false"}),e.length&&i.length?i.prev().attr({tabIndex:-1,"aria-expanded":"false"}):e.length&&this.headers.filter(function(){return 0===parseInt(V(this).attr("tabIndex"),10)}).attr("tabIndex",-1),e.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(t,i,e){var s,n,o,a=this,r=0,l=t.css("box-sizing"),h=t.length&&(!i.length||t.index()<i.index()),c=this.options.animate||{},u=h&&c.down||c,h=function(){a._toggleComplete(e)};return n=(n="string"==typeof u?u:n)||u.easing||c.easing,o=(o="number"==typeof u?u:o)||u.duration||c.duration,i.length?t.length?(s=t.show().outerHeight(),i.animate(this.hideProps,{duration:o,easing:n,step:function(t,e){e.now=Math.round(t)}}),void t.hide().animate(this.showProps,{duration:o,easing:n,complete:h,step:function(t,e){e.now=Math.round(t),"height"!==e.prop?"content-box"===l&&(r+=e.now):"content"!==a.options.heightStyle&&(e.now=Math.round(s-i.outerHeight()-r),r=0)}})):i.animate(this.hideProps,o,n,h):t.animate(this.showProps,o,n,h)},_toggleComplete:function(t){var e=t.oldPanel,i=e.prev();this._removeClass(e,"ui-accordion-content-active"),this._removeClass(i,"ui-accordion-header-active")._addClass(i,"ui-accordion-header-collapsed"),e.length&&(e.parent()[0].className=e.parent()[0].className),this._trigger("activate",null,t)}}),V.ui.safeActiveElement=function(e){var i;try{i=e.activeElement}catch(t){i=e.body}return i=!(i=i||e.body).nodeName?e.body:i},V.widget("ui.menu",{version:"1.13.2",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.lastMousePosition={x:null,y:null},this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault(),this._activateItem(t)},"click .ui-menu-item":function(t){var e=V(t.target),i=V(V.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&e.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),e.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&i.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":"_activateItem","mousemove .ui-menu-item":"_activateItem",mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this._menuItems().first();e||this.focus(t,i)},blur:function(t){this._delay(function(){V.contains(this.element[0],V.ui.safeActiveElement(this.document[0]))||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t,!0),this.mouseHandled=!1}})},_activateItem:function(t){var e,i;this.previousFilter||t.clientX===this.lastMousePosition.x&&t.clientY===this.lastMousePosition.y||(this.lastMousePosition={x:t.clientX,y:t.clientY},e=V(t.target).closest(".ui-menu-item"),i=V(t.currentTarget),e[0]===i[0]&&(i.is(".ui-state-active")||(this._removeClass(i.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(t,i))))},_destroy:function(){var t=this.element.find(".ui-menu-item").removeAttr("role aria-disabled").children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),t.children().each(function(){var t=V(this);t.data("ui-menu-submenu-caret")&&t.remove()})},_keydown:function(t){var e,i,s,n=!0;switch(t.keyCode){case V.ui.keyCode.PAGE_UP:this.previousPage(t);break;case V.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case V.ui.keyCode.HOME:this._move("first","first",t);break;case V.ui.keyCode.END:this._move("last","last",t);break;case V.ui.keyCode.UP:this.previous(t);break;case V.ui.keyCode.DOWN:this.next(t);break;case V.ui.keyCode.LEFT:this.collapse(t);break;case V.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case V.ui.keyCode.ENTER:case V.ui.keyCode.SPACE:this._activate(t);break;case V.ui.keyCode.ESCAPE:this.collapse(t);break;default:e=this.previousFilter||"",s=n=!1,i=96<=t.keyCode&&t.keyCode<=105?(t.keyCode-96).toString():String.fromCharCode(t.keyCode),clearTimeout(this.filterTimer),i===e?s=!0:i=e+i,e=this._filterMenuItems(i),(e=s&&-1!==e.index(this.active.next())?this.active.nextAll(".ui-menu-item"):e).length||(i=String.fromCharCode(t.keyCode),e=this._filterMenuItems(i)),e.length?(this.focus(t,e),this.previousFilter=i,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}n&&t.preventDefault()},_activate:function(t){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var t,e,s=this,n=this.options.icons.submenu,i=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),e=i.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=V(this),e=t.prev(),i=V("<span>").data("ui-menu-submenu-caret",!0);s._addClass(i,"ui-menu-icon","ui-icon "+n),e.attr("aria-haspopup","true").prepend(i),t.attr("aria-labelledby",e.attr("id"))}),this._addClass(e,"ui-menu","ui-widget ui-widget-content ui-front"),(t=i.add(this.element).find(this.options.items)).not(".ui-menu-item").each(function(){var t=V(this);s._isDivider(t)&&s._addClass(t,"ui-menu-divider","ui-widget-content")}),i=(e=t.not(".ui-menu-item, .ui-menu-divider")).children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(e,"ui-menu-item")._addClass(i,"ui-menu-item-wrapper"),t.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!V.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){var i;"icons"===t&&(i=this.element.find(".ui-menu-icon"),this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,e.submenu)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",String(t)),this._toggleClass(null,"ui-state-disabled",!!t)},focus:function(t,e){var i;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),i=this.active.children(".ui-menu-item-wrapper"),this._addClass(i,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",i.attr("id")),i=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(i,null,"ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),(i=e.children(".ui-menu")).length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(t){var e,i,s;this._hasScroll()&&(i=parseFloat(V.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(V.css(this.activeMenu[0],"paddingTop"))||0,e=t.offset().top-this.activeMenu.offset().top-i-s,i=this.activeMenu.scrollTop(),s=this.activeMenu.height(),t=t.outerHeight(),e<0?this.activeMenu.scrollTop(i+e):s<e+t&&this.activeMenu.scrollTop(i+e-s+t))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this._removeClass(this.active.children(".ui-menu-item-wrapper"),null,"ui-state-active"),this._trigger("blur",t,{item:this.active}),this.active=null)},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(t)},this.delay))},_open:function(t){var e=V.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(t.parents(".ui-menu")).hide().attr("aria-hidden","true"),t.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(e)},collapseAll:function(e,i){clearTimeout(this.timer),this.timer=this._delay(function(){var t=i?this.element:V(e&&e.target).closest(this.element.find(".ui-menu"));t.length||(t=this.element),this._close(t),this.blur(e),this._removeClass(t.find(".ui-state-active"),null,"ui-state-active"),this.activeMenu=t},i?0:this.delay)},_close:function(t){(t=t||(this.active?this.active.parent():this.element)).find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false")},_closeOnDocumentClick:function(t){return!V(t.target).closest(".ui-menu").length},_isDivider:function(t){return!/[^\-\u2014\u2013\s]/.test(t.text())},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this._menuItems(this.active.children(".ui-menu")).first();e&&e.length&&(this._open(e.parent()),this._delay(function(){this.focus(t,e)}))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_menuItems:function(t){return(t||this.element).find(this.options.items).filter(".ui-menu-item")},_move:function(t,e,i){var s;(s=this.active?"first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").last():this.active[t+"All"](".ui-menu-item").first():s)&&s.length&&this.active||(s=this._menuItems(this.activeMenu)[e]()),this.focus(i,s)},nextPage:function(t){var e,i,s;this.active?this.isLastItem()||(this._hasScroll()?(i=this.active.offset().top,s=this.element.innerHeight(),0===V.fn.jquery.indexOf("3.2.")&&(s+=this.element[0].offsetHeight-this.element.outerHeight()),this.active.nextAll(".ui-menu-item").each(function(){return(e=V(this)).offset().top-i-s<0}),this.focus(t,e)):this.focus(t,this._menuItems(this.activeMenu)[this.active?"last":"first"]())):this.next(t)},previousPage:function(t){var e,i,s;this.active?this.isFirstItem()||(this._hasScroll()?(i=this.active.offset().top,s=this.element.innerHeight(),0===V.fn.jquery.indexOf("3.2.")&&(s+=this.element[0].offsetHeight-this.element.outerHeight()),this.active.prevAll(".ui-menu-item").each(function(){return 0<(e=V(this)).offset().top-i+s}),this.focus(t,e)):this.focus(t,this._menuItems(this.activeMenu).first())):this.next(t)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(t){this.active=this.active||V(t.target).closest(".ui-menu-item");var e={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(t,!0),this._trigger("select",t,e)},_filterMenuItems:function(t){var t=t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),e=new RegExp("^"+t,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return e.test(String.prototype.trim.call(V(this).children(".ui-menu-item-wrapper").text()))})}});V.widget("ui.autocomplete",{version:"1.13.2",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,liveRegionTimer:null,_create:function(){var i,s,n,t=this.element[0].nodeName.toLowerCase(),e="textarea"===t,t="input"===t;this.isMultiLine=e||!t&&this._isContentEditable(this.element),this.valueMethod=this.element[e||t?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(t){if(this.element.prop("readOnly"))s=n=i=!0;else{s=n=i=!1;var e=V.ui.keyCode;switch(t.keyCode){case e.PAGE_UP:i=!0,this._move("previousPage",t);break;case e.PAGE_DOWN:i=!0,this._move("nextPage",t);break;case e.UP:i=!0,this._keyEvent("previous",t);break;case e.DOWN:i=!0,this._keyEvent("next",t);break;case e.ENTER:this.menu.active&&(i=!0,t.preventDefault(),this.menu.select(t));break;case e.TAB:this.menu.active&&this.menu.select(t);break;case e.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(t),t.preventDefault());break;default:s=!0,this._searchTimeout(t)}}},keypress:function(t){if(i)return i=!1,void(this.isMultiLine&&!this.menu.element.is(":visible")||t.preventDefault());if(!s){var e=V.ui.keyCode;switch(t.keyCode){case e.PAGE_UP:this._move("previousPage",t);break;case e.PAGE_DOWN:this._move("nextPage",t);break;case e.UP:this._keyEvent("previous",t);break;case e.DOWN:this._keyEvent("next",t)}}},input:function(t){if(n)return n=!1,void t.preventDefault();this._searchTimeout(t)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){clearTimeout(this.searching),this.close(t),this._change(t)}}),this._initSource(),this.menu=V("<ul>").appendTo(this._appendTo()).menu({role:null}).hide().attr({unselectable:"on"}).menu("instance"),this._addClass(this.menu.element,"ui-autocomplete","ui-front"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault()},menufocus:function(t,e){var i,s;if(this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type)))return this.menu.blur(),void this.document.one("mousemove",function(){V(t.target).trigger(t.originalEvent)});s=e.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",t,{item:s})&&t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(s.value),(i=e.item.attr("aria-label")||s.value)&&String.prototype.trim.call(i).length&&(clearTimeout(this.liveRegionTimer),this.liveRegionTimer=this._delay(function(){this.liveRegion.html(V("<div>").text(i))},100))},menuselect:function(t,e){var i=e.item.data("ui-autocomplete-item"),s=this.previous;this.element[0]!==V.ui.safeActiveElement(this.document[0])&&(this.element.trigger("focus"),this.previous=s,this._delay(function(){this.previous=s,this.selectedItem=i})),!1!==this._trigger("select",t,{item:i})&&this._value(i.value),this.term=this._value(),this.close(t),this.selectedItem=i}}),this.liveRegion=V("<div>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_isEventTargetInWidget:function(t){var e=this.menu.element[0];return t.target===this.element[0]||t.target===e||V.contains(e,t.target)},_closeOnClickOutside:function(t){this._isEventTargetInWidget(t)||this.close()},_appendTo:function(){var t=this.options.appendTo;return t=!(t=!(t=t&&(t.jquery||t.nodeType?V(t):this.document.find(t).eq(0)))||!t[0]?this.element.closest(".ui-front, dialog"):t).length?this.document[0].body:t},_initSource:function(){var i,s,n=this;Array.isArray(this.options.source)?(i=this.options.source,this.source=function(t,e){e(V.ui.autocomplete.filter(i,t.term))}):"string"==typeof this.options.source?(s=this.options.source,this.source=function(t,e){n.xhr&&n.xhr.abort(),n.xhr=V.ajax({url:s,data:t,dataType:"json",success:function(t){e(t)},error:function(){e([])}})}):this.source=this.options.source},_searchTimeout:function(s){clearTimeout(this.searching),this.searching=this._delay(function(){var t=this.term===this._value(),e=this.menu.element.is(":visible"),i=s.altKey||s.ctrlKey||s.metaKey||s.shiftKey;t&&(e||i)||(this.selectedItem=null,this.search(null,s))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length<this.options.minLength?this.close(e):!1!==this._trigger("search",e)?this._search(t):void 0},_search:function(t){this.pending++,this._addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:t},this._response())},_response:function(){var e=++this.requestIndex;return function(t){e===this.requestIndex&&this.__response(t),this.pending--,this.pending||this._removeClass("ui-autocomplete-loading")}.bind(this)},__response:function(t){t=t&&this._normalize(t),this._trigger("response",null,{content:t}),!this.options.disabled&&t&&t.length&&!this.cancelSearch?(this._suggest(t),this._trigger("open")):this._close()},close:function(t){this.cancelSearch=!0,this._close(t)},_close:function(t){this._off(this.document,"mousedown"),this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",t))},_change:function(t){this.previous!==this._value()&&this._trigger("change",t,{item:this.selectedItem})},_normalize:function(t){return t.length&&t[0].label&&t[0].value?t:V.map(t,function(t){return"string"==typeof t?{label:t,value:t}:V.extend({},t,{label:t.label||t.value,value:t.value||t.label})})},_suggest:function(t){var e=this.menu.element.empty();this._renderMenu(e,t),this.isNewMenu=!0,this.menu.refresh(),e.show(),this._resizeMenu(),e.position(V.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next(),this._on(this.document,{mousedown:"_closeOnClickOutside"})},_resizeMenu:function(){var t=this.menu.element;t.outerWidth(Math.max(t.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(i,t){var s=this;V.each(t,function(t,e){s._renderItemData(i,e)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-autocomplete-item",e)},_renderItem:function(t,e){return V("<li>").append(V("<div>").text(e.label)).appendTo(t)},_move:function(t,e){if(this.menu.element.is(":visible"))return this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this.isMultiLine||this._value(this.term),void this.menu.blur()):void this.menu[t](e);this.search(null,e)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){this.isMultiLine&&!this.menu.element.is(":visible")||(this._move(t,e),e.preventDefault())},_isContentEditable:function(t){if(!t.length)return!1;var e=t.prop("contentEditable");return"inherit"===e?this._isContentEditable(t.parent()):"true"===e}}),V.extend(V.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,e){var i=new RegExp(V.ui.autocomplete.escapeRegex(e),"i");return V.grep(t,function(t){return i.test(t.label||t.value||t)})}}),V.widget("ui.autocomplete",V.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(1<t?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(t){var e;this._superApply(arguments),this.options.disabled||this.cancelSearch||(e=t&&t.length?this.options.messages.results(t.length):this.options.messages.noResults,clearTimeout(this.liveRegionTimer),this.liveRegionTimer=this._delay(function(){this.liveRegion.html(V("<div>").text(e))},100))}});V.ui.autocomplete;var tt=/ui-corner-([a-z]){2,6}/g;V.widget("ui.controlgroup",{version:"1.13.2",defaultElement:"<div>",options:{direction:"horizontal",disabled:null,onlyVisible:!0,items:{button:"input[type=button], input[type=submit], input[type=reset], button, a",controlgroupLabel:".ui-controlgroup-label",checkboxradio:"input[type='checkbox'], input[type='radio']",selectmenu:"select",spinner:".ui-spinner-input"}},_create:function(){this._enhance()},_enhance:function(){this.element.attr("role","toolbar"),this.refresh()},_destroy:function(){this._callChildMethod("destroy"),this.childWidgets.removeData("ui-controlgroup-data"),this.element.removeAttr("role"),this.options.items.controlgroupLabel&&this.element.find(this.options.items.controlgroupLabel).find(".ui-controlgroup-label-contents").contents().unwrap()},_initWidgets:function(){var o=this,a=[];V.each(this.options.items,function(s,t){var e,n={};if(t)return"controlgroupLabel"===s?((e=o.element.find(t)).each(function(){var t=V(this);t.children(".ui-controlgroup-label-contents").length||t.contents().wrapAll("<span class='ui-controlgroup-label-contents'></span>")}),o._addClass(e,null,"ui-widget ui-widget-content ui-state-default"),void(a=a.concat(e.get()))):void(V.fn[s]&&(n=o["_"+s+"Options"]?o["_"+s+"Options"]("middle"):{classes:{}},o.element.find(t).each(function(){var t=V(this),e=t[s]("instance"),i=V.widget.extend({},n);"button"===s&&t.parent(".ui-spinner").length||((e=e||t[s]()[s]("instance"))&&(i.classes=o._resolveClassesValues(i.classes,e)),t[s](i),i=t[s]("widget"),V.data(i[0],"ui-controlgroup-data",e||t[s]("instance")),a.push(i[0]))})))}),this.childWidgets=V(V.uniqueSort(a)),this._addClass(this.childWidgets,"ui-controlgroup-item")},_callChildMethod:function(e){this.childWidgets.each(function(){var t=V(this).data("ui-controlgroup-data");t&&t[e]&&t[e]()})},_updateCornerClass:function(t,e){e=this._buildSimpleOptions(e,"label").classes.label;this._removeClass(t,null,"ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all"),this._addClass(t,null,e)},_buildSimpleOptions:function(t,e){var i="vertical"===this.options.direction,s={classes:{}};return s.classes[e]={middle:"",first:"ui-corner-"+(i?"top":"left"),last:"ui-corner-"+(i?"bottom":"right"),only:"ui-corner-all"}[t],s},_spinnerOptions:function(t){t=this._buildSimpleOptions(t,"ui-spinner");return t.classes["ui-spinner-up"]="",t.classes["ui-spinner-down"]="",t},_buttonOptions:function(t){return this._buildSimpleOptions(t,"ui-button")},_checkboxradioOptions:function(t){return this._buildSimpleOptions(t,"ui-checkboxradio-label")},_selectmenuOptions:function(t){var e="vertical"===this.options.direction;return{width:e&&"auto",classes:{middle:{"ui-selectmenu-button-open":"","ui-selectmenu-button-closed":""},first:{"ui-selectmenu-button-open":"ui-corner-"+(e?"top":"tl"),"ui-selectmenu-button-closed":"ui-corner-"+(e?"top":"left")},last:{"ui-selectmenu-button-open":e?"":"ui-corner-tr","ui-selectmenu-button-closed":"ui-corner-"+(e?"bottom":"right")},only:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"}}[t]}},_resolveClassesValues:function(i,s){var n={};return V.each(i,function(t){var e=s.options.classes[t]||"",e=String.prototype.trim.call(e.replace(tt,""));n[t]=(e+" "+i[t]).replace(/\s+/g," ")}),n},_setOption:function(t,e){"direction"===t&&this._removeClass("ui-controlgroup-"+this.options.direction),this._super(t,e),"disabled"!==t?this.refresh():this._callChildMethod(e?"disable":"enable")},refresh:function(){var n,o=this;this._addClass("ui-controlgroup ui-controlgroup-"+this.options.direction),"horizontal"===this.options.direction&&this._addClass(null,"ui-helper-clearfix"),this._initWidgets(),n=this.childWidgets,(n=this.options.onlyVisible?n.filter(":visible"):n).length&&(V.each(["first","last"],function(t,e){var i,s=n[e]().data("ui-controlgroup-data");s&&o["_"+s.widgetName+"Options"]?((i=o["_"+s.widgetName+"Options"](1===n.length?"only":e)).classes=o._resolveClassesValues(i.classes,s),s.element[s.widgetName](i)):o._updateCornerClass(n[e](),e)}),this._callChildMethod("refresh"))}});V.widget("ui.checkboxradio",[V.ui.formResetMixin,{version:"1.13.2",options:{disabled:null,label:null,icon:!0,classes:{"ui-checkboxradio-label":"ui-corner-all","ui-checkboxradio-icon":"ui-corner-all"}},_getCreateOptions:function(){var t,e=this._super()||{};return this._readType(),t=this.element.labels(),this.label=V(t[t.length-1]),this.label.length||V.error("No label found for checkboxradio widget"),this.originalLabel="",(t=this.label.contents().not(this.element[0])).length&&(this.originalLabel+=t.clone().wrapAll("<div></div>").parent().html()),this.originalLabel&&(e.label=this.originalLabel),null!=(t=this.element[0].disabled)&&(e.disabled=t),e},_create:function(){var t=this.element[0].checked;this._bindFormResetHandler(),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled),this._setOption("disabled",this.options.disabled),this._addClass("ui-checkboxradio","ui-helper-hidden-accessible"),this._addClass(this.label,"ui-checkboxradio-label","ui-button ui-widget"),"radio"===this.type&&this._addClass(this.label,"ui-checkboxradio-radio-label"),this.options.label&&this.options.label!==this.originalLabel?this._updateLabel():this.originalLabel&&(this.options.label=this.originalLabel),this._enhance(),t&&this._addClass(this.label,"ui-checkboxradio-checked","ui-state-active"),this._on({change:"_toggleClasses",focus:function(){this._addClass(this.label,null,"ui-state-focus ui-visual-focus")},blur:function(){this._removeClass(this.label,null,"ui-state-focus ui-visual-focus")}})},_readType:function(){var t=this.element[0].nodeName.toLowerCase();this.type=this.element[0].type,"input"===t&&/radio|checkbox/.test(this.type)||V.error("Can't create checkboxradio on element.nodeName="+t+" and element.type="+this.type)},_enhance:function(){this._updateIcon(this.element[0].checked)},widget:function(){return this.label},_getRadioGroup:function(){var t=this.element[0].name,e="input[name='"+V.escapeSelector(t)+"']";return t?(this.form.length?V(this.form[0].elements).filter(e):V(e).filter(function(){return 0===V(this)._form().length})).not(this.element):V([])},_toggleClasses:function(){var t=this.element[0].checked;this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",t),this.options.icon&&"checkbox"===this.type&&this._toggleClass(this.icon,null,"ui-icon-check ui-state-checked",t)._toggleClass(this.icon,null,"ui-icon-blank",!t),"radio"===this.type&&this._getRadioGroup().each(function(){var t=V(this).checkboxradio("instance");t&&t._removeClass(t.label,"ui-checkboxradio-checked","ui-state-active")})},_destroy:function(){this._unbindFormResetHandler(),this.icon&&(this.icon.remove(),this.iconSpace.remove())},_setOption:function(t,e){if("label"!==t||e){if(this._super(t,e),"disabled"===t)return this._toggleClass(this.label,null,"ui-state-disabled",e),void(this.element[0].disabled=e);this.refresh()}},_updateIcon:function(t){var e="ui-icon ui-icon-background ";this.options.icon?(this.icon||(this.icon=V("<span>"),this.iconSpace=V("<span> </span>"),this._addClass(this.iconSpace,"ui-checkboxradio-icon-space")),"checkbox"===this.type?(e+=t?"ui-icon-check ui-state-checked":"ui-icon-blank",this._removeClass(this.icon,null,t?"ui-icon-blank":"ui-icon-check")):e+="ui-icon-blank",this._addClass(this.icon,"ui-checkboxradio-icon",e),t||this._removeClass(this.icon,null,"ui-icon-check ui-state-checked"),this.icon.prependTo(this.label).after(this.iconSpace)):void 0!==this.icon&&(this.icon.remove(),this.iconSpace.remove(),delete this.icon)},_updateLabel:function(){var t=this.label.contents().not(this.element[0]);this.icon&&(t=t.not(this.icon[0])),(t=this.iconSpace?t.not(this.iconSpace[0]):t).remove(),this.label.append(this.options.label)},refresh:function(){var t=this.element[0].checked,e=this.element[0].disabled;this._updateIcon(t),this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",t),null!==this.options.label&&this._updateLabel(),e!==this.options.disabled&&this._setOptions({disabled:e})}}]);var et;V.ui.checkboxradio;V.widget("ui.button",{version:"1.13.2",defaultElement:"<button>",options:{classes:{"ui-button":"ui-corner-all"},disabled:null,icon:null,iconPosition:"beginning",label:null,showLabel:!0},_getCreateOptions:function(){var t,e=this._super()||{};return this.isInput=this.element.is("input"),null!=(t=this.element[0].disabled)&&(e.disabled=t),this.originalLabel=this.isInput?this.element.val():this.element.html(),this.originalLabel&&(e.label=this.originalLabel),e},_create:function(){!this.option.showLabel&!this.options.icon&&(this.options.showLabel=!0),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled||!1),this.hasTitle=!!this.element.attr("title"),this.options.label&&this.options.label!==this.originalLabel&&(this.isInput?this.element.val(this.options.label):this.element.html(this.options.label)),this._addClass("ui-button","ui-widget"),this._setOption("disabled",this.options.disabled),this._enhance(),this.element.is("a")&&this._on({keyup:function(t){t.keyCode===V.ui.keyCode.SPACE&&(t.preventDefault(),this.element[0].click?this.element[0].click():this.element.trigger("click"))}})},_enhance:function(){this.element.is("button")||this.element.attr("role","button"),this.options.icon&&(this._updateIcon("icon",this.options.icon),this._updateTooltip())},_updateTooltip:function(){this.title=this.element.attr("title"),this.options.showLabel||this.title||this.element.attr("title",this.options.label)},_updateIcon:function(t,e){var i="iconPosition"!==t,s=i?this.options.iconPosition:e,t="top"===s||"bottom"===s;this.icon?i&&this._removeClass(this.icon,null,this.options.icon):(this.icon=V("<span>"),this._addClass(this.icon,"ui-button-icon","ui-icon"),this.options.showLabel||this._addClass("ui-button-icon-only")),i&&this._addClass(this.icon,null,e),this._attachIcon(s),t?(this._addClass(this.icon,null,"ui-widget-icon-block"),this.iconSpace&&this.iconSpace.remove()):(this.iconSpace||(this.iconSpace=V("<span> </span>"),this._addClass(this.iconSpace,"ui-button-icon-space")),this._removeClass(this.icon,null,"ui-wiget-icon-block"),this._attachIconSpace(s))},_destroy:function(){this.element.removeAttr("role"),this.icon&&this.icon.remove(),this.iconSpace&&this.iconSpace.remove(),this.hasTitle||this.element.removeAttr("title")},_attachIconSpace:function(t){this.icon[/^(?:end|bottom)/.test(t)?"before":"after"](this.iconSpace)},_attachIcon:function(t){this.element[/^(?:end|bottom)/.test(t)?"append":"prepend"](this.icon)},_setOptions:function(t){var e=(void 0===t.showLabel?this.options:t).showLabel,i=(void 0===t.icon?this.options:t).icon;e||i||(t.showLabel=!0),this._super(t)},_setOption:function(t,e){"icon"===t&&(e?this._updateIcon(t,e):this.icon&&(this.icon.remove(),this.iconSpace&&this.iconSpace.remove())),"iconPosition"===t&&this._updateIcon(t,e),"showLabel"===t&&(this._toggleClass("ui-button-icon-only",null,!e),this._updateTooltip()),"label"===t&&(this.isInput?this.element.val(e):(this.element.html(e),this.icon&&(this._attachIcon(this.options.iconPosition),this._attachIconSpace(this.options.iconPosition)))),this._super(t,e),"disabled"===t&&(this._toggleClass(null,"ui-state-disabled",e),(this.element[0].disabled=e)&&this.element.trigger("blur"))},refresh:function(){var t=this.element.is("input, button")?this.element[0].disabled:this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOptions({disabled:t}),this._updateTooltip()}}),!1!==V.uiBackCompat&&(V.widget("ui.button",V.ui.button,{options:{text:!0,icons:{primary:null,secondary:null}},_create:function(){this.options.showLabel&&!this.options.text&&(this.options.showLabel=this.options.text),!this.options.showLabel&&this.options.text&&(this.options.text=this.options.showLabel),this.options.icon||!this.options.icons.primary&&!this.options.icons.secondary?this.options.icon&&(this.options.icons.primary=this.options.icon):this.options.icons.primary?this.options.icon=this.options.icons.primary:(this.options.icon=this.options.icons.secondary,this.options.iconPosition="end"),this._super()},_setOption:function(t,e){"text"!==t?("showLabel"===t&&(this.options.text=e),"icon"===t&&(this.options.icons.primary=e),"icons"===t&&(e.primary?(this._super("icon",e.primary),this._super("iconPosition","beginning")):e.secondary&&(this._super("icon",e.secondary),this._super("iconPosition","end"))),this._superApply(arguments)):this._super("showLabel",e)}}),V.fn.button=(et=V.fn.button,function(i){var t="string"==typeof i,s=Array.prototype.slice.call(arguments,1),n=this;return t?this.length||"instance"!==i?this.each(function(){var t=V(this).attr("type"),e=V.data(this,"ui-"+("checkbox"!==t&&"radio"!==t?"button":"checkboxradio"));return"instance"===i?(n=e,!1):e?"function"!=typeof e[i]||"_"===i.charAt(0)?V.error("no such method '"+i+"' for button widget instance"):(t=e[i].apply(e,s))!==e&&void 0!==t?(n=t&&t.jquery?n.pushStack(t.get()):t,!1):void 0:V.error("cannot call methods on button prior to initialization; attempted to call method '"+i+"'")}):n=void 0:(s.length&&(i=V.widget.extend.apply(null,[i].concat(s))),this.each(function(){var t=V(this).attr("type"),e="checkbox"!==t&&"radio"!==t?"button":"checkboxradio",t=V.data(this,"ui-"+e);t?(t.option(i||{}),t._init&&t._init()):"button"!=e?V(this).checkboxradio(V.extend({icon:!1},i)):et.call(V(this),i)})),n}),V.fn.buttonset=function(){return V.ui.controlgroup||V.error("Controlgroup widget missing"),"option"===arguments[0]&&"items"===arguments[1]&&arguments[2]?this.controlgroup.apply(this,[arguments[0],"items.button",arguments[2]]):"option"===arguments[0]&&"items"===arguments[1]?this.controlgroup.apply(this,[arguments[0],"items.button"]):("object"==typeof arguments[0]&&arguments[0].items&&(arguments[0].items={button:arguments[0].items}),this.controlgroup.apply(this,arguments))});var it;V.ui.button;function st(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:"",selectMonthLabel:"Select month",selectYearLabel:"Select year"},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,onUpdateDatepicker:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},V.extend(this._defaults,this.regional[""]),this.regional.en=V.extend(!0,{},this.regional[""]),this.regional["en-US"]=V.extend(!0,{},this.regional.en),this.dpDiv=nt(V("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function nt(t){var e="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.on("mouseout",e,function(){V(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&V(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&V(this).removeClass("ui-datepicker-next-hover")}).on("mouseover",e,ot)}function ot(){V.datepicker._isDisabledDatepicker((it.inline?it.dpDiv.parent():it.input)[0])||(V(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),V(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&V(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&V(this).addClass("ui-datepicker-next-hover"))}function at(t,e){for(var i in V.extend(t,e),e)null==e[i]&&(t[i]=e[i]);return t}V.extend(V.ui,{datepicker:{version:"1.13.2"}}),V.extend(st.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(t){return at(this._defaults,t||{}),this},_attachDatepicker:function(t,e){var i,s=t.nodeName.toLowerCase(),n="div"===s||"span"===s;t.id||(this.uuid+=1,t.id="dp"+this.uuid),(i=this._newInst(V(t),n)).settings=V.extend({},e||{}),"input"===s?this._connectDatepicker(t,i):n&&this._inlineDatepicker(t,i)},_newInst:function(t,e){return{id:t[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1"),input:t,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:e,dpDiv:e?nt(V("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(t,e){var i=V(t);e.append=V([]),e.trigger=V([]),i.hasClass(this.markerClassName)||(this._attachments(i,e),i.addClass(this.markerClassName).on("keydown",this._doKeyDown).on("keypress",this._doKeyPress).on("keyup",this._doKeyUp),this._autoSize(e),V.data(t,"datepicker",e),e.settings.disabled&&this._disableDatepicker(t))},_attachments:function(t,e){var i,s=this._get(e,"appendText"),n=this._get(e,"isRTL");e.append&&e.append.remove(),s&&(e.append=V("<span>").addClass(this._appendClass).text(s),t[n?"before":"after"](e.append)),t.off("focus",this._showDatepicker),e.trigger&&e.trigger.remove(),"focus"!==(i=this._get(e,"showOn"))&&"both"!==i||t.on("focus",this._showDatepicker),"button"!==i&&"both"!==i||(s=this._get(e,"buttonText"),i=this._get(e,"buttonImage"),this._get(e,"buttonImageOnly")?e.trigger=V("<img>").addClass(this._triggerClass).attr({src:i,alt:s,title:s}):(e.trigger=V("<button type='button'>").addClass(this._triggerClass),i?e.trigger.html(V("<img>").attr({src:i,alt:s,title:s})):e.trigger.text(s)),t[n?"before":"after"](e.trigger),e.trigger.on("click",function(){return V.datepicker._datepickerShowing&&V.datepicker._lastInput===t[0]?V.datepicker._hideDatepicker():(V.datepicker._datepickerShowing&&V.datepicker._lastInput!==t[0]&&V.datepicker._hideDatepicker(),V.datepicker._showDatepicker(t[0])),!1}))},_autoSize:function(t){var e,i,s,n,o,a;this._get(t,"autoSize")&&!t.inline&&(o=new Date(2009,11,20),(a=this._get(t,"dateFormat")).match(/[DM]/)&&(e=function(t){for(n=s=i=0;n<t.length;n++)t[n].length>i&&(i=t[n].length,s=n);return s},o.setMonth(e(this._get(t,a.match(/MM/)?"monthNames":"monthNamesShort"))),o.setDate(e(this._get(t,a.match(/DD/)?"dayNames":"dayNamesShort"))+20-o.getDay())),t.input.attr("size",this._formatDate(t,o).length))},_inlineDatepicker:function(t,e){var i=V(t);i.hasClass(this.markerClassName)||(i.addClass(this.markerClassName).append(e.dpDiv),V.data(t,"datepicker",e),this._setDate(e,this._getDefaultDate(e),!0),this._updateDatepicker(e),this._updateAlternate(e),e.settings.disabled&&this._disableDatepicker(t),e.dpDiv.css("display","block"))},_dialogDatepicker:function(t,e,i,s,n){var o,a=this._dialogInst;return a||(this.uuid+=1,o="dp"+this.uuid,this._dialogInput=V("<input type='text' id='"+o+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.on("keydown",this._doKeyDown),V("body").append(this._dialogInput),(a=this._dialogInst=this._newInst(this._dialogInput,!1)).settings={},V.data(this._dialogInput[0],"datepicker",a)),at(a.settings,s||{}),e=e&&e.constructor===Date?this._formatDate(a,e):e,this._dialogInput.val(e),this._pos=n?n.length?n:[n.pageX,n.pageY]:null,this._pos||(o=document.documentElement.clientWidth,s=document.documentElement.clientHeight,e=document.documentElement.scrollLeft||document.body.scrollLeft,n=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[o/2-100+e,s/2-150+n]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),a.settings.onSelect=i,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),V.blockUI&&V.blockUI(this.dpDiv),V.data(this._dialogInput[0],"datepicker",a),this},_destroyDatepicker:function(t){var e,i=V(t),s=V.data(t,"datepicker");i.hasClass(this.markerClassName)&&(e=t.nodeName.toLowerCase(),V.removeData(t,"datepicker"),"input"===e?(s.append.remove(),s.trigger.remove(),i.removeClass(this.markerClassName).off("focus",this._showDatepicker).off("keydown",this._doKeyDown).off("keypress",this._doKeyPress).off("keyup",this._doKeyUp)):"div"!==e&&"span"!==e||i.removeClass(this.markerClassName).empty(),it===s&&(it=null,this._curInst=null))},_enableDatepicker:function(e){var t,i=V(e),s=V.data(e,"datepicker");i.hasClass(this.markerClassName)&&("input"===(t=e.nodeName.toLowerCase())?(e.disabled=!1,s.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):"div"!==t&&"span"!==t||((i=i.children("."+this._inlineClass)).children().removeClass("ui-state-disabled"),i.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=V.map(this._disabledInputs,function(t){return t===e?null:t}))},_disableDatepicker:function(e){var t,i=V(e),s=V.data(e,"datepicker");i.hasClass(this.markerClassName)&&("input"===(t=e.nodeName.toLowerCase())?(e.disabled=!0,s.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):"div"!==t&&"span"!==t||((i=i.children("."+this._inlineClass)).children().addClass("ui-state-disabled"),i.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=V.map(this._disabledInputs,function(t){return t===e?null:t}),this._disabledInputs[this._disabledInputs.length]=e)},_isDisabledDatepicker:function(t){if(!t)return!1;for(var e=0;e<this._disabledInputs.length;e++)if(this._disabledInputs[e]===t)return!0;return!1},_getInst:function(t){try{return V.data(t,"datepicker")}catch(t){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(t,e,i){var s,n,o=this._getInst(t);if(2===arguments.length&&"string"==typeof e)return"defaults"===e?V.extend({},V.datepicker._defaults):o?"all"===e?V.extend({},o.settings):this._get(o,e):null;s=e||{},"string"==typeof e&&((s={})[e]=i),o&&(this._curInst===o&&this._hideDatepicker(),n=this._getDateDatepicker(t,!0),e=this._getMinMaxDate(o,"min"),i=this._getMinMaxDate(o,"max"),at(o.settings,s),null!==e&&void 0!==s.dateFormat&&void 0===s.minDate&&(o.settings.minDate=this._formatDate(o,e)),null!==i&&void 0!==s.dateFormat&&void 0===s.maxDate&&(o.settings.maxDate=this._formatDate(o,i)),"disabled"in s&&(s.disabled?this._disableDatepicker(t):this._enableDatepicker(t)),this._attachments(V(t),o),this._autoSize(o),this._setDate(o,n),this._updateAlternate(o),this._updateDatepicker(o))},_changeDatepicker:function(t,e,i){this._optionDatepicker(t,e,i)},_refreshDatepicker:function(t){t=this._getInst(t);t&&this._updateDatepicker(t)},_setDateDatepicker:function(t,e){t=this._getInst(t);t&&(this._setDate(t,e),this._updateDatepicker(t),this._updateAlternate(t))},_getDateDatepicker:function(t,e){t=this._getInst(t);return t&&!t.inline&&this._setDateFromField(t,e),t?this._getDate(t):null},_doKeyDown:function(t){var e,i,s=V.datepicker._getInst(t.target),n=!0,o=s.dpDiv.is(".ui-datepicker-rtl");if(s._keyEvent=!0,V.datepicker._datepickerShowing)switch(t.keyCode){case 9:V.datepicker._hideDatepicker(),n=!1;break;case 13:return(i=V("td."+V.datepicker._dayOverClass+":not(."+V.datepicker._currentClass+")",s.dpDiv))[0]&&V.datepicker._selectDay(t.target,s.selectedMonth,s.selectedYear,i[0]),(e=V.datepicker._get(s,"onSelect"))?(i=V.datepicker._formatDate(s),e.apply(s.input?s.input[0]:null,[i,s])):V.datepicker._hideDatepicker(),!1;case 27:V.datepicker._hideDatepicker();break;case 33:V.datepicker._adjustDate(t.target,t.ctrlKey?-V.datepicker._get(s,"stepBigMonths"):-V.datepicker._get(s,"stepMonths"),"M");break;case 34:V.datepicker._adjustDate(t.target,t.ctrlKey?+V.datepicker._get(s,"stepBigMonths"):+V.datepicker._get(s,"stepMonths"),"M");break;case 35:(t.ctrlKey||t.metaKey)&&V.datepicker._clearDate(t.target),n=t.ctrlKey||t.metaKey;break;case 36:(t.ctrlKey||t.metaKey)&&V.datepicker._gotoToday(t.target),n=t.ctrlKey||t.metaKey;break;case 37:(t.ctrlKey||t.metaKey)&&V.datepicker._adjustDate(t.target,o?1:-1,"D"),n=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&V.datepicker._adjustDate(t.target,t.ctrlKey?-V.datepicker._get(s,"stepBigMonths"):-V.datepicker._get(s,"stepMonths"),"M");break;case 38:(t.ctrlKey||t.metaKey)&&V.datepicker._adjustDate(t.target,-7,"D"),n=t.ctrlKey||t.metaKey;break;case 39:(t.ctrlKey||t.metaKey)&&V.datepicker._adjustDate(t.target,o?-1:1,"D"),n=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&V.datepicker._adjustDate(t.target,t.ctrlKey?+V.datepicker._get(s,"stepBigMonths"):+V.datepicker._get(s,"stepMonths"),"M");break;case 40:(t.ctrlKey||t.metaKey)&&V.datepicker._adjustDate(t.target,7,"D"),n=t.ctrlKey||t.metaKey;break;default:n=!1}else 36===t.keyCode&&t.ctrlKey?V.datepicker._showDatepicker(this):n=!1;n&&(t.preventDefault(),t.stopPropagation())},_doKeyPress:function(t){var e,i=V.datepicker._getInst(t.target);if(V.datepicker._get(i,"constrainInput"))return e=V.datepicker._possibleChars(V.datepicker._get(i,"dateFormat")),i=String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),t.ctrlKey||t.metaKey||i<" "||!e||-1<e.indexOf(i)},_doKeyUp:function(t){t=V.datepicker._getInst(t.target);if(t.input.val()!==t.lastVal)try{V.datepicker.parseDate(V.datepicker._get(t,"dateFormat"),t.input?t.input.val():null,V.datepicker._getFormatConfig(t))&&(V.datepicker._setDateFromField(t),V.datepicker._updateAlternate(t),V.datepicker._updateDatepicker(t))}catch(t){}return!0},_showDatepicker:function(t){var e,i,s,n;"input"!==(t=t.target||t).nodeName.toLowerCase()&&(t=V("input",t.parentNode)[0]),V.datepicker._isDisabledDatepicker(t)||V.datepicker._lastInput===t||(n=V.datepicker._getInst(t),V.datepicker._curInst&&V.datepicker._curInst!==n&&(V.datepicker._curInst.dpDiv.stop(!0,!0),n&&V.datepicker._datepickerShowing&&V.datepicker._hideDatepicker(V.datepicker._curInst.input[0])),!1!==(i=(s=V.datepicker._get(n,"beforeShow"))?s.apply(t,[t,n]):{})&&(at(n.settings,i),n.lastVal=null,V.datepicker._lastInput=t,V.datepicker._setDateFromField(n),V.datepicker._inDialog&&(t.value=""),V.datepicker._pos||(V.datepicker._pos=V.datepicker._findPos(t),V.datepicker._pos[1]+=t.offsetHeight),e=!1,V(t).parents().each(function(){return!(e|="fixed"===V(this).css("position"))}),s={left:V.datepicker._pos[0],top:V.datepicker._pos[1]},V.datepicker._pos=null,n.dpDiv.empty(),n.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),V.datepicker._updateDatepicker(n),s=V.datepicker._checkOffset(n,s,e),n.dpDiv.css({position:V.datepicker._inDialog&&V.blockUI?"static":e?"fixed":"absolute",display:"none",left:s.left+"px",top:s.top+"px"}),n.inline||(i=V.datepicker._get(n,"showAnim"),s=V.datepicker._get(n,"duration"),n.dpDiv.css("z-index",function(t){for(var e,i;t.length&&t[0]!==document;){if(("absolute"===(e=t.css("position"))||"relative"===e||"fixed"===e)&&(i=parseInt(t.css("zIndex"),10),!isNaN(i)&&0!==i))return i;t=t.parent()}return 0}(V(t))+1),V.datepicker._datepickerShowing=!0,V.effects&&V.effects.effect[i]?n.dpDiv.show(i,V.datepicker._get(n,"showOptions"),s):n.dpDiv[i||"show"](i?s:null),V.datepicker._shouldFocusInput(n)&&n.input.trigger("focus"),V.datepicker._curInst=n)))},_updateDatepicker:function(t){this.maxRows=4,(it=t).dpDiv.empty().append(this._generateHTML(t)),this._attachHandlers(t);var e,i=this._getNumberOfMonths(t),s=i[1],n=t.dpDiv.find("."+this._dayOverClass+" a"),o=V.datepicker._get(t,"onUpdateDatepicker");0<n.length&&ot.apply(n.get(0)),t.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),1<s&&t.dpDiv.addClass("ui-datepicker-multi-"+s).css("width",17*s+"em"),t.dpDiv[(1!==i[0]||1!==i[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),t.dpDiv[(this._get(t,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),t===V.datepicker._curInst&&V.datepicker._datepickerShowing&&V.datepicker._shouldFocusInput(t)&&t.input.trigger("focus"),t.yearshtml&&(e=t.yearshtml,setTimeout(function(){e===t.yearshtml&&t.yearshtml&&t.dpDiv.find("select.ui-datepicker-year").first().replaceWith(t.yearshtml),e=t.yearshtml=null},0)),o&&o.apply(t.input?t.input[0]:null,[t])},_shouldFocusInput:function(t){return t.input&&t.input.is(":visible")&&!t.input.is(":disabled")&&!t.input.is(":focus")},_checkOffset:function(t,e,i){var s=t.dpDiv.outerWidth(),n=t.dpDiv.outerHeight(),o=t.input?t.input.outerWidth():0,a=t.input?t.input.outerHeight():0,r=document.documentElement.clientWidth+(i?0:V(document).scrollLeft()),l=document.documentElement.clientHeight+(i?0:V(document).scrollTop());return e.left-=this._get(t,"isRTL")?s-o:0,e.left-=i&&e.left===t.input.offset().left?V(document).scrollLeft():0,e.top-=i&&e.top===t.input.offset().top+a?V(document).scrollTop():0,e.left-=Math.min(e.left,e.left+s>r&&s<r?Math.abs(e.left+s-r):0),e.top-=Math.min(e.top,e.top+n>l&&n<l?Math.abs(n+a):0),e},_findPos:function(t){for(var e=this._getInst(t),i=this._get(e,"isRTL");t&&("hidden"===t.type||1!==t.nodeType||V.expr.pseudos.hidden(t));)t=t[i?"previousSibling":"nextSibling"];return[(e=V(t).offset()).left,e.top]},_hideDatepicker:function(t){var e,i,s=this._curInst;!s||t&&s!==V.data(t,"datepicker")||this._datepickerShowing&&(e=this._get(s,"showAnim"),i=this._get(s,"duration"),t=function(){V.datepicker._tidyDialog(s)},V.effects&&(V.effects.effect[e]||V.effects[e])?s.dpDiv.hide(e,V.datepicker._get(s,"showOptions"),i,t):s.dpDiv["slideDown"===e?"slideUp":"fadeIn"===e?"fadeOut":"hide"](e?i:null,t),e||t(),this._datepickerShowing=!1,(t=this._get(s,"onClose"))&&t.apply(s.input?s.input[0]:null,[s.input?s.input.val():"",s]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),V.blockUI&&(V.unblockUI(),V("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(t){t.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar")},_checkExternalClick:function(t){var e;V.datepicker._curInst&&(e=V(t.target),t=V.datepicker._getInst(e[0]),(e[0].id===V.datepicker._mainDivId||0!==e.parents("#"+V.datepicker._mainDivId).length||e.hasClass(V.datepicker.markerClassName)||e.closest("."+V.datepicker._triggerClass).length||!V.datepicker._datepickerShowing||V.datepicker._inDialog&&V.blockUI)&&(!e.hasClass(V.datepicker.markerClassName)||V.datepicker._curInst===t)||V.datepicker._hideDatepicker())},_adjustDate:function(t,e,i){var s=V(t),t=this._getInst(s[0]);this._isDisabledDatepicker(s[0])||(this._adjustInstDate(t,e,i),this._updateDatepicker(t))},_gotoToday:function(t){var e=V(t),i=this._getInst(e[0]);this._get(i,"gotoCurrent")&&i.currentDay?(i.selectedDay=i.currentDay,i.drawMonth=i.selectedMonth=i.currentMonth,i.drawYear=i.selectedYear=i.currentYear):(t=new Date,i.selectedDay=t.getDate(),i.drawMonth=i.selectedMonth=t.getMonth(),i.drawYear=i.selectedYear=t.getFullYear()),this._notifyChange(i),this._adjustDate(e)},_selectMonthYear:function(t,e,i){var s=V(t),t=this._getInst(s[0]);t["selected"+("M"===i?"Month":"Year")]=t["draw"+("M"===i?"Month":"Year")]=parseInt(e.options[e.selectedIndex].value,10),this._notifyChange(t),this._adjustDate(s)},_selectDay:function(t,e,i,s){var n=V(t);V(s).hasClass(this._unselectableClass)||this._isDisabledDatepicker(n[0])||((n=this._getInst(n[0])).selectedDay=n.currentDay=parseInt(V("a",s).attr("data-date")),n.selectedMonth=n.currentMonth=e,n.selectedYear=n.currentYear=i,this._selectDate(t,this._formatDate(n,n.currentDay,n.currentMonth,n.currentYear)))},_clearDate:function(t){t=V(t);this._selectDate(t,"")},_selectDate:function(t,e){var i=V(t),t=this._getInst(i[0]);e=null!=e?e:this._formatDate(t),t.input&&t.input.val(e),this._updateAlternate(t),(i=this._get(t,"onSelect"))?i.apply(t.input?t.input[0]:null,[e,t]):t.input&&t.input.trigger("change"),t.inline?this._updateDatepicker(t):(this._hideDatepicker(),this._lastInput=t.input[0],"object"!=typeof t.input[0]&&t.input.trigger("focus"),this._lastInput=null)},_updateAlternate:function(t){var e,i,s=this._get(t,"altField");s&&(e=this._get(t,"altFormat")||this._get(t,"dateFormat"),i=this._getDate(t),t=this.formatDate(e,i,this._getFormatConfig(t)),V(document).find(s).val(t))},noWeekends:function(t){t=t.getDay();return[0<t&&t<6,""]},iso8601Week:function(t){var e=new Date(t.getTime());return e.setDate(e.getDate()+4-(e.getDay()||7)),t=e.getTime(),e.setMonth(0),e.setDate(1),Math.floor(Math.round((t-e)/864e5)/7)+1},parseDate:function(e,n,t){if(null==e||null==n)throw"Invalid arguments";if(""===(n="object"==typeof n?n.toString():n+""))return null;for(var i,s,o,a=0,r=(t?t.shortYearCutoff:null)||this._defaults.shortYearCutoff,r="string"!=typeof r?r:(new Date).getFullYear()%100+parseInt(r,10),l=(t?t.dayNamesShort:null)||this._defaults.dayNamesShort,h=(t?t.dayNames:null)||this._defaults.dayNames,c=(t?t.monthNamesShort:null)||this._defaults.monthNamesShort,u=(t?t.monthNames:null)||this._defaults.monthNames,d=-1,p=-1,f=-1,g=-1,m=!1,_=function(t){t=w+1<e.length&&e.charAt(w+1)===t;return t&&w++,t},v=function(t){var e=_(t),e="@"===t?14:"!"===t?20:"y"===t&&e?4:"o"===t?3:2,e=new RegExp("^\\d{"+("y"===t?e:1)+","+e+"}"),e=n.substring(a).match(e);if(!e)throw"Missing number at position "+a;return a+=e[0].length,parseInt(e[0],10)},b=function(t,e,i){var s=-1,e=V.map(_(t)?i:e,function(t,e){return[[e,t]]}).sort(function(t,e){return-(t[1].length-e[1].length)});if(V.each(e,function(t,e){var i=e[1];if(n.substr(a,i.length).toLowerCase()===i.toLowerCase())return s=e[0],a+=i.length,!1}),-1!==s)return s+1;throw"Unknown name at position "+a},y=function(){if(n.charAt(a)!==e.charAt(w))throw"Unexpected literal at position "+a;a++},w=0;w<e.length;w++)if(m)"'"!==e.charAt(w)||_("'")?y():m=!1;else switch(e.charAt(w)){case"d":f=v("d");break;case"D":b("D",l,h);break;case"o":g=v("o");break;case"m":p=v("m");break;case"M":p=b("M",c,u);break;case"y":d=v("y");break;case"@":d=(o=new Date(v("@"))).getFullYear(),p=o.getMonth()+1,f=o.getDate();break;case"!":d=(o=new Date((v("!")-this._ticksTo1970)/1e4)).getFullYear(),p=o.getMonth()+1,f=o.getDate();break;case"'":_("'")?y():m=!0;break;default:y()}if(a<n.length&&(s=n.substr(a),!/^\s+/.test(s)))throw"Extra/unparsed characters found in date: "+s;if(-1===d?d=(new Date).getFullYear():d<100&&(d+=(new Date).getFullYear()-(new Date).getFullYear()%100+(d<=r?0:-100)),-1<g)for(p=1,f=g;;){if(f<=(i=this._getDaysInMonth(d,p-1)))break;p++,f-=i}if((o=this._daylightSavingAdjust(new Date(d,p-1,f))).getFullYear()!==d||o.getMonth()+1!==p||o.getDate()!==f)throw"Invalid date";return o},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*60*60*1e7,formatDate:function(e,t,i){if(!t)return"";function s(t,e,i){var s=""+e;if(c(t))for(;s.length<i;)s="0"+s;return s}function n(t,e,i,s){return(c(t)?s:i)[e]}var o,a=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,r=(i?i.dayNames:null)||this._defaults.dayNames,l=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,h=(i?i.monthNames:null)||this._defaults.monthNames,c=function(t){t=o+1<e.length&&e.charAt(o+1)===t;return t&&o++,t},u="",d=!1;if(t)for(o=0;o<e.length;o++)if(d)"'"!==e.charAt(o)||c("'")?u+=e.charAt(o):d=!1;else switch(e.charAt(o)){case"d":u+=s("d",t.getDate(),2);break;case"D":u+=n("D",t.getDay(),a,r);break;case"o":u+=s("o",Math.round((new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(t.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=s("m",t.getMonth()+1,2);break;case"M":u+=n("M",t.getMonth(),l,h);break;case"y":u+=c("y")?t.getFullYear():(t.getFullYear()%100<10?"0":"")+t.getFullYear()%100;break;case"@":u+=t.getTime();break;case"!":u+=1e4*t.getTime()+this._ticksTo1970;break;case"'":c("'")?u+="'":d=!0;break;default:u+=e.charAt(o)}return u},_possibleChars:function(e){for(var t="",i=!1,s=function(t){t=n+1<e.length&&e.charAt(n+1)===t;return t&&n++,t},n=0;n<e.length;n++)if(i)"'"!==e.charAt(n)||s("'")?t+=e.charAt(n):i=!1;else switch(e.charAt(n)){case"d":case"m":case"y":case"@":t+="0123456789";break;case"D":case"M":return null;case"'":s("'")?t+="'":i=!0;break;default:t+=e.charAt(n)}return t},_get:function(t,e){return(void 0!==t.settings[e]?t.settings:this._defaults)[e]},_setDateFromField:function(t,e){if(t.input.val()!==t.lastVal){var i=this._get(t,"dateFormat"),s=t.lastVal=t.input?t.input.val():null,n=this._getDefaultDate(t),o=n,a=this._getFormatConfig(t);try{o=this.parseDate(i,s,a)||n}catch(t){s=e?"":s}t.selectedDay=o.getDate(),t.drawMonth=t.selectedMonth=o.getMonth(),t.drawYear=t.selectedYear=o.getFullYear(),t.currentDay=s?o.getDate():0,t.currentMonth=s?o.getMonth():0,t.currentYear=s?o.getFullYear():0,this._adjustInstDate(t)}},_getDefaultDate:function(t){return this._restrictMinMax(t,this._determineDate(t,this._get(t,"defaultDate"),new Date))},_determineDate:function(r,t,e){var i,s,t=null==t||""===t?e:"string"==typeof t?function(t){try{return V.datepicker.parseDate(V.datepicker._get(r,"dateFormat"),t,V.datepicker._getFormatConfig(r))}catch(t){}for(var e=(t.toLowerCase().match(/^c/)?V.datepicker._getDate(r):null)||new Date,i=e.getFullYear(),s=e.getMonth(),n=e.getDate(),o=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,a=o.exec(t);a;){switch(a[2]||"d"){case"d":case"D":n+=parseInt(a[1],10);break;case"w":case"W":n+=7*parseInt(a[1],10);break;case"m":case"M":s+=parseInt(a[1],10),n=Math.min(n,V.datepicker._getDaysInMonth(i,s));break;case"y":case"Y":i+=parseInt(a[1],10),n=Math.min(n,V.datepicker._getDaysInMonth(i,s))}a=o.exec(t)}return new Date(i,s,n)}(t):"number"==typeof t?isNaN(t)?e:(i=t,(s=new Date).setDate(s.getDate()+i),s):new Date(t.getTime());return(t=t&&"Invalid Date"===t.toString()?e:t)&&(t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0)),this._daylightSavingAdjust(t)},_daylightSavingAdjust:function(t){return t?(t.setHours(12<t.getHours()?t.getHours()+2:0),t):null},_setDate:function(t,e,i){var s=!e,n=t.selectedMonth,o=t.selectedYear,e=this._restrictMinMax(t,this._determineDate(t,e,new Date));t.selectedDay=t.currentDay=e.getDate(),t.drawMonth=t.selectedMonth=t.currentMonth=e.getMonth(),t.drawYear=t.selectedYear=t.currentYear=e.getFullYear(),n===t.selectedMonth&&o===t.selectedYear||i||this._notifyChange(t),this._adjustInstDate(t),t.input&&t.input.val(s?"":this._formatDate(t))},_getDate:function(t){return!t.currentYear||t.input&&""===t.input.val()?null:this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay))},_attachHandlers:function(t){var e=this._get(t,"stepMonths"),i="#"+t.id.replace(/\\\\/g,"\\");t.dpDiv.find("[data-handler]").map(function(){var t={prev:function(){V.datepicker._adjustDate(i,-e,"M")},next:function(){V.datepicker._adjustDate(i,+e,"M")},hide:function(){V.datepicker._hideDatepicker()},today:function(){V.datepicker._gotoToday(i)},selectDay:function(){return V.datepicker._selectDay(i,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return V.datepicker._selectMonthYear(i,this,"M"),!1},selectYear:function(){return V.datepicker._selectMonthYear(i,this,"Y"),!1}};V(this).on(this.getAttribute("data-event"),t[this.getAttribute("data-handler")])})},_generateHTML:function(t){var e,i,s,n,o,a,r,l,h,c,u,d,p,f,g,m,_,v,b,y,w,x,k,C,D,I,T,P,M,S,H,z,A=new Date,O=this._daylightSavingAdjust(new Date(A.getFullYear(),A.getMonth(),A.getDate())),N=this._get(t,"isRTL"),E=this._get(t,"showButtonPanel"),W=this._get(t,"hideIfNoPrevNext"),F=this._get(t,"navigationAsDateFormat"),L=this._getNumberOfMonths(t),R=this._get(t,"showCurrentAtPos"),A=this._get(t,"stepMonths"),Y=1!==L[0]||1!==L[1],B=this._daylightSavingAdjust(t.currentDay?new Date(t.currentYear,t.currentMonth,t.currentDay):new Date(9999,9,9)),j=this._getMinMaxDate(t,"min"),q=this._getMinMaxDate(t,"max"),K=t.drawMonth-R,U=t.drawYear;if(K<0&&(K+=12,U--),q)for(e=this._daylightSavingAdjust(new Date(q.getFullYear(),q.getMonth()-L[0]*L[1]+1,q.getDate())),e=j&&e<j?j:e;this._daylightSavingAdjust(new Date(U,K,1))>e;)--K<0&&(K=11,U--);for(t.drawMonth=K,t.drawYear=U,R=this._get(t,"prevText"),R=F?this.formatDate(R,this._daylightSavingAdjust(new Date(U,K-A,1)),this._getFormatConfig(t)):R,i=this._canAdjustMonth(t,-1,U,K)?V("<a>").attr({class:"ui-datepicker-prev ui-corner-all","data-handler":"prev","data-event":"click",title:R}).append(V("<span>").addClass("ui-icon ui-icon-circle-triangle-"+(N?"e":"w")).text(R))[0].outerHTML:W?"":V("<a>").attr({class:"ui-datepicker-prev ui-corner-all ui-state-disabled",title:R}).append(V("<span>").addClass("ui-icon ui-icon-circle-triangle-"+(N?"e":"w")).text(R))[0].outerHTML,R=this._get(t,"nextText"),R=F?this.formatDate(R,this._daylightSavingAdjust(new Date(U,K+A,1)),this._getFormatConfig(t)):R,s=this._canAdjustMonth(t,1,U,K)?V("<a>").attr({class:"ui-datepicker-next ui-corner-all","data-handler":"next","data-event":"click",title:R}).append(V("<span>").addClass("ui-icon ui-icon-circle-triangle-"+(N?"w":"e")).text(R))[0].outerHTML:W?"":V("<a>").attr({class:"ui-datepicker-next ui-corner-all ui-state-disabled",title:R}).append(V("<span>").attr("class","ui-icon ui-icon-circle-triangle-"+(N?"w":"e")).text(R))[0].outerHTML,A=this._get(t,"currentText"),W=this._get(t,"gotoCurrent")&&t.currentDay?B:O,A=F?this.formatDate(A,W,this._getFormatConfig(t)):A,R="",t.inline||(R=V("<button>").attr({type:"button",class:"ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all","data-handler":"hide","data-event":"click"}).text(this._get(t,"closeText"))[0].outerHTML),F="",E&&(F=V("<div class='ui-datepicker-buttonpane ui-widget-content'>").append(N?R:"").append(this._isInRange(t,W)?V("<button>").attr({type:"button",class:"ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all","data-handler":"today","data-event":"click"}).text(A):"").append(N?"":R)[0].outerHTML),n=parseInt(this._get(t,"firstDay"),10),n=isNaN(n)?0:n,o=this._get(t,"showWeek"),a=this._get(t,"dayNames"),r=this._get(t,"dayNamesMin"),l=this._get(t,"monthNames"),h=this._get(t,"monthNamesShort"),c=this._get(t,"beforeShowDay"),u=this._get(t,"showOtherMonths"),d=this._get(t,"selectOtherMonths"),p=this._getDefaultDate(t),f="",m=0;m<L[0];m++){for(_="",this.maxRows=4,v=0;v<L[1];v++){if(b=this._daylightSavingAdjust(new Date(U,K,t.selectedDay)),y=" ui-corner-all",w="",Y){if(w+="<div class='ui-datepicker-group",1<L[1])switch(v){case 0:w+=" ui-datepicker-group-first",y=" ui-corner-"+(N?"right":"left");break;case L[1]-1:w+=" ui-datepicker-group-last",y=" ui-corner-"+(N?"left":"right");break;default:w+=" ui-datepicker-group-middle",y=""}w+="'>"}for(w+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+y+"'>"+(/all|left/.test(y)&&0===m?N?s:i:"")+(/all|right/.test(y)&&0===m?N?i:s:"")+this._generateMonthYearHeader(t,K,U,j,q,0<m||0<v,l,h)+"</div><table class='ui-datepicker-calendar'><thead><tr>",x=o?"<th class='ui-datepicker-week-col'>"+this._get(t,"weekHeader")+"</th>":"",g=0;g<7;g++)x+="<th scope='col'"+(5<=(g+n+6)%7?" class='ui-datepicker-week-end'":"")+"><span title='"+a[k=(g+n)%7]+"'>"+r[k]+"</span></th>";for(w+=x+"</tr></thead><tbody>",D=this._getDaysInMonth(U,K),U===t.selectedYear&&K===t.selectedMonth&&(t.selectedDay=Math.min(t.selectedDay,D)),C=(this._getFirstDayOfMonth(U,K)-n+7)%7,D=Math.ceil((C+D)/7),I=Y&&this.maxRows>D?this.maxRows:D,this.maxRows=I,T=this._daylightSavingAdjust(new Date(U,K,1-C)),P=0;P<I;P++){for(w+="<tr>",M=o?"<td class='ui-datepicker-week-col'>"+this._get(t,"calculateWeek")(T)+"</td>":"",g=0;g<7;g++)S=c?c.apply(t.input?t.input[0]:null,[T]):[!0,""],z=(H=T.getMonth()!==K)&&!d||!S[0]||j&&T<j||q&&q<T,M+="<td class='"+(5<=(g+n+6)%7?" ui-datepicker-week-end":"")+(H?" ui-datepicker-other-month":"")+(T.getTime()===b.getTime()&&K===t.selectedMonth&&t._keyEvent||p.getTime()===T.getTime()&&p.getTime()===b.getTime()?" "+this._dayOverClass:"")+(z?" "+this._unselectableClass+" ui-state-disabled":"")+(H&&!u?"":" "+S[1]+(T.getTime()===B.getTime()?" "+this._currentClass:"")+(T.getTime()===O.getTime()?" ui-datepicker-today":""))+"'"+(H&&!u||!S[2]?"":" title='"+S[2].replace(/'/g,"&#39;")+"'")+(z?"":" data-handler='selectDay' data-event='click' data-month='"+T.getMonth()+"' data-year='"+T.getFullYear()+"'")+">"+(H&&!u?"&#xa0;":z?"<span class='ui-state-default'>"+T.getDate()+"</span>":"<a class='ui-state-default"+(T.getTime()===O.getTime()?" ui-state-highlight":"")+(T.getTime()===B.getTime()?" ui-state-active":"")+(H?" ui-priority-secondary":"")+"' href='#' aria-current='"+(T.getTime()===B.getTime()?"true":"false")+"' data-date='"+T.getDate()+"'>"+T.getDate()+"</a>")+"</td>",T.setDate(T.getDate()+1),T=this._daylightSavingAdjust(T);w+=M+"</tr>"}11<++K&&(K=0,U++),_+=w+="</tbody></table>"+(Y?"</div>"+(0<L[0]&&v===L[1]-1?"<div class='ui-datepicker-row-break'></div>":""):"")}f+=_}return f+=F,t._keyEvent=!1,f},_generateMonthYearHeader:function(t,e,i,s,n,o,a,r){var l,h,c,u,d,p,f=this._get(t,"changeMonth"),g=this._get(t,"changeYear"),m=this._get(t,"showMonthAfterYear"),_=this._get(t,"selectMonthLabel"),v=this._get(t,"selectYearLabel"),b="<div class='ui-datepicker-title'>",y="";if(o||!f)y+="<span class='ui-datepicker-month'>"+a[e]+"</span>";else{for(l=s&&s.getFullYear()===i,h=n&&n.getFullYear()===i,y+="<select class='ui-datepicker-month' aria-label='"+_+"' data-handler='selectMonth' data-event='change'>",c=0;c<12;c++)(!l||c>=s.getMonth())&&(!h||c<=n.getMonth())&&(y+="<option value='"+c+"'"+(c===e?" selected='selected'":"")+">"+r[c]+"</option>");y+="</select>"}if(m||(b+=y+(!o&&f&&g?"":"&#xa0;")),!t.yearshtml)if(t.yearshtml="",o||!g)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(a=this._get(t,"yearRange").split(":"),u=(new Date).getFullYear(),d=(_=function(t){t=t.match(/c[+\-].*/)?i+parseInt(t.substring(1),10):t.match(/[+\-].*/)?u+parseInt(t,10):parseInt(t,10);return isNaN(t)?u:t})(a[0]),p=Math.max(d,_(a[1]||"")),d=s?Math.max(d,s.getFullYear()):d,p=n?Math.min(p,n.getFullYear()):p,t.yearshtml+="<select class='ui-datepicker-year' aria-label='"+v+"' data-handler='selectYear' data-event='change'>";d<=p;d++)t.yearshtml+="<option value='"+d+"'"+(d===i?" selected='selected'":"")+">"+d+"</option>";t.yearshtml+="</select>",b+=t.yearshtml,t.yearshtml=null}return b+=this._get(t,"yearSuffix"),m&&(b+=(!o&&f&&g?"":"&#xa0;")+y),b+="</div>"},_adjustInstDate:function(t,e,i){var s=t.selectedYear+("Y"===i?e:0),n=t.selectedMonth+("M"===i?e:0),e=Math.min(t.selectedDay,this._getDaysInMonth(s,n))+("D"===i?e:0),e=this._restrictMinMax(t,this._daylightSavingAdjust(new Date(s,n,e)));t.selectedDay=e.getDate(),t.drawMonth=t.selectedMonth=e.getMonth(),t.drawYear=t.selectedYear=e.getFullYear(),"M"!==i&&"Y"!==i||this._notifyChange(t)},_restrictMinMax:function(t,e){var i=this._getMinMaxDate(t,"min"),t=this._getMinMaxDate(t,"max"),e=i&&e<i?i:e;return t&&t<e?t:e},_notifyChange:function(t){var e=this._get(t,"onChangeMonthYear");e&&e.apply(t.input?t.input[0]:null,[t.selectedYear,t.selectedMonth+1,t])},_getNumberOfMonths:function(t){t=this._get(t,"numberOfMonths");return null==t?[1,1]:"number"==typeof t?[1,t]:t},_getMinMaxDate:function(t,e){return this._determineDate(t,this._get(t,e+"Date"),null)},_getDaysInMonth:function(t,e){return 32-this._daylightSavingAdjust(new Date(t,e,32)).getDate()},_getFirstDayOfMonth:function(t,e){return new Date(t,e,1).getDay()},_canAdjustMonth:function(t,e,i,s){var n=this._getNumberOfMonths(t),n=this._daylightSavingAdjust(new Date(i,s+(e<0?e:n[0]*n[1]),1));return e<0&&n.setDate(this._getDaysInMonth(n.getFullYear(),n.getMonth())),this._isInRange(t,n)},_isInRange:function(t,e){var i=this._getMinMaxDate(t,"min"),s=this._getMinMaxDate(t,"max"),n=null,o=null,a=this._get(t,"yearRange");return a&&(t=a.split(":"),a=(new Date).getFullYear(),n=parseInt(t[0],10),o=parseInt(t[1],10),t[0].match(/[+\-].*/)&&(n+=a),t[1].match(/[+\-].*/)&&(o+=a)),(!i||e.getTime()>=i.getTime())&&(!s||e.getTime()<=s.getTime())&&(!n||e.getFullYear()>=n)&&(!o||e.getFullYear()<=o)},_getFormatConfig:function(t){var e=this._get(t,"shortYearCutoff");return{shortYearCutoff:e="string"!=typeof e?e:(new Date).getFullYear()%100+parseInt(e,10),dayNamesShort:this._get(t,"dayNamesShort"),dayNames:this._get(t,"dayNames"),monthNamesShort:this._get(t,"monthNamesShort"),monthNames:this._get(t,"monthNames")}},_formatDate:function(t,e,i,s){e||(t.currentDay=t.selectedDay,t.currentMonth=t.selectedMonth,t.currentYear=t.selectedYear);e=e?"object"==typeof e?e:this._daylightSavingAdjust(new Date(s,i,e)):this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return this.formatDate(this._get(t,"dateFormat"),e,this._getFormatConfig(t))}}),V.fn.datepicker=function(t){if(!this.length)return this;V.datepicker.initialized||(V(document).on("mousedown",V.datepicker._checkExternalClick),V.datepicker.initialized=!0),0===V("#"+V.datepicker._mainDivId).length&&V("body").append(V.datepicker.dpDiv);var e=Array.prototype.slice.call(arguments,1);return"string"==typeof t&&("isDisabled"===t||"getDate"===t||"widget"===t)||"option"===t&&2===arguments.length&&"string"==typeof arguments[1]?V.datepicker["_"+t+"Datepicker"].apply(V.datepicker,[this[0]].concat(e)):this.each(function(){"string"==typeof t?V.datepicker["_"+t+"Datepicker"].apply(V.datepicker,[this].concat(e)):V.datepicker._attachDatepicker(this,t)})},V.datepicker=new st,V.datepicker.initialized=!1,V.datepicker.uuid=(new Date).getTime(),V.datepicker.version="1.13.2";V.datepicker,V.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var rt=!1;V(document).on("mouseup",function(){rt=!1});V.widget("ui.mouse",{version:"1.13.2",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(t){if(!0===V.data(t.target,e.widgetName+".preventClickEvent"))return V.removeData(t.target,e.widgetName+".preventClickEvent"),t.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(!rt){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var e=this,i=1===t.which,s=!("string"!=typeof this.options.cancel||!t.target.nodeName)&&V(t.target).closest(this.options.cancel).length;return i&&!s&&this._mouseCapture(t)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){e.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=!1!==this._mouseStart(t),!this._mouseStarted)?(t.preventDefault(),!0):(!0===V.data(t.target,this.widgetName+".preventClickEvent")&&V.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return e._mouseMove(t)},this._mouseUpDelegate=function(t){return e._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),rt=!0)):!0}},_mouseMove:function(t){if(this._mouseMoved){if(V.ui.ie&&(!document.documentMode||document.documentMode<9)&&!t.button)return this._mouseUp(t);if(!t.which)if(t.originalEvent.altKey||t.originalEvent.ctrlKey||t.originalEvent.metaKey||t.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(t)}return(t.which||t.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=!1!==this._mouseStart(this._mouseDownEvent,t),this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&V.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,rt=!1,t.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),V.ui.plugin={add:function(t,e,i){var s,n=V.ui[t].prototype;for(s in i)n.plugins[s]=n.plugins[s]||[],n.plugins[s].push([e,i[s]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;n<o.length;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}},V.ui.safeBlur=function(t){t&&"body"!==t.nodeName.toLowerCase()&&V(t).trigger("blur")};V.widget("ui.draggable",V.ui.mouse,{version:"1.13.2",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this._addClass("ui-draggable"),this._setHandleClassName(),this._mouseInit()},_setOption:function(t,e){this._super(t,e),"handle"===t&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){(this.helper||this.element).is(".ui-draggable-dragging")?this.destroyOnClear=!0:(this._removeHandleClassName(),this._mouseDestroy())},_mouseCapture:function(t){var e=this.options;return!(this.helper||e.disabled||0<V(t.target).closest(".ui-resizable-handle").length)&&(this.handle=this._getHandle(t),!!this.handle&&(this._blurActiveElement(t),this._blockFrames(!0===e.iframeFix?"iframe":e.iframeFix),!0))},_blockFrames:function(t){this.iframeBlocks=this.document.find(t).map(function(){var t=V(this);return V("<div>").css("position","absolute").appendTo(t.parent()).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(t){var e=V.ui.safeActiveElement(this.document[0]);V(t.target).closest(e).length||V.ui.safeBlur(e)},_mouseStart:function(t){var e=this.options;return this.helper=this._createHelper(t),this._addClass(this.helper,"ui-draggable-dragging"),this._cacheHelperProportions(),V.ui.ddmanager&&(V.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=0<this.helper.parents().filter(function(){return"fixed"===V(this).css("position")}).length,this.positionAbs=this.element.offset(),this._refreshOffsets(t),this.originalPosition=this.position=this._generatePosition(t,!1),this.originalPageX=t.pageX,this.originalPageY=t.pageY,e.cursorAt&&this._adjustOffsetFromHelper(e.cursorAt),this._setContainment(),!1===this._trigger("start",t)?(this._clear(),!1):(this._cacheHelperProportions(),V.ui.ddmanager&&!e.dropBehaviour&&V.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),V.ui.ddmanager&&V.ui.ddmanager.dragStart(this,t),!0)},_refreshOffsets:function(t){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:t.pageX-this.offset.left,top:t.pageY-this.offset.top}},_mouseDrag:function(t,e){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t,!0),this.positionAbs=this._convertPositionTo("absolute"),!e){e=this._uiHash();if(!1===this._trigger("drag",t,e))return this._mouseUp(new V.Event("mouseup",t)),!1;this.position=e.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",V.ui.ddmanager&&V.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var e=this,i=!1;return V.ui.ddmanager&&!this.options.dropBehaviour&&(i=V.ui.ddmanager.drop(this,t)),this.dropped&&(i=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!i||"valid"===this.options.revert&&i||!0===this.options.revert||"function"==typeof this.options.revert&&this.options.revert.call(this.element,i)?V(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){!1!==e._trigger("stop",t)&&e._clear()}):!1!==this._trigger("stop",t)&&this._clear(),!1},_mouseUp:function(t){return this._unblockFrames(),V.ui.ddmanager&&V.ui.ddmanager.dragStop(this,t),this.handleElement.is(t.target)&&this.element.trigger("focus"),V.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp(new V.Event("mouseup",{target:this.element[0]})):this._clear(),this},_getHandle:function(t){return!this.options.handle||!!V(t.target).closest(this.element.find(this.options.handle)).length},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle")},_createHelper:function(t){var e=this.options,i="function"==typeof e.helper,t=i?V(e.helper.apply(this.element[0],[t])):"clone"===e.helper?this.element.clone().removeAttr("id"):this.element;return t.parents("body").length||t.appendTo("parent"===e.appendTo?this.element[0].parentNode:e.appendTo),i&&t[0]===this.element[0]&&this._setPositionRelative(),t[0]===this.element[0]||/(fixed|absolute)/.test(t.css("position"))||t.css("position","absolute"),t},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),"left"in(t=Array.isArray(t)?{left:+t[0],top:+t[1]||0}:t)&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_isRootNode:function(t){return/(html|body)/i.test(t.tagName)||t===this.document[0]},_getParentOffset:function(){var t=this.offsetParent.offset(),e=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==e&&V.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),{top:(t=this._isRootNode(this.offsetParent[0])?{top:0,left:0}:t).top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var t=this.element.position(),e=this._isRootNode(this.scrollParent[0]);return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+(e?0:this.scrollParent.scrollTop()),left:t.left-(parseInt(this.helper.css("left"),10)||0)+(e?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,e,i,s=this.options,n=this.document[0];this.relativeContainer=null,s.containment?"window"!==s.containment?"document"!==s.containment?s.containment.constructor!==Array?("parent"===s.containment&&(s.containment=this.helper[0].parentNode),(i=(e=V(s.containment))[0])&&(t=/(scroll|auto)/.test(e.css("overflow")),this.containment=[(parseInt(e.css("borderLeftWidth"),10)||0)+(parseInt(e.css("paddingLeft"),10)||0),(parseInt(e.css("borderTopWidth"),10)||0)+(parseInt(e.css("paddingTop"),10)||0),(t?Math.max(i.scrollWidth,i.offsetWidth):i.offsetWidth)-(parseInt(e.css("borderRightWidth"),10)||0)-(parseInt(e.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(i.scrollHeight,i.offsetHeight):i.offsetHeight)-(parseInt(e.css("borderBottomWidth"),10)||0)-(parseInt(e.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=e)):this.containment=s.containment:this.containment=[0,0,V(n).width()-this.helperProportions.width-this.margins.left,(V(n).height()||n.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]:this.containment=[V(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,V(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,V(window).scrollLeft()+V(window).width()-this.helperProportions.width-this.margins.left,V(window).scrollTop()+(V(window).height()||n.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]:this.containment=null},_convertPositionTo:function(t,e){e=e||this.position;var i="absolute"===t?1:-1,t=this._isRootNode(this.scrollParent[0]);return{top:e.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:t?0:this.offset.scroll.top)*i,left:e.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:t?0:this.offset.scroll.left)*i}},_generatePosition:function(t,e){var i,s=this.options,n=this._isRootNode(this.scrollParent[0]),o=t.pageX,a=t.pageY;return n&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),e&&(this.containment&&(i=this.relativeContainer?(i=this.relativeContainer.offset(),[this.containment[0]+i.left,this.containment[1]+i.top,this.containment[2]+i.left,this.containment[3]+i.top]):this.containment,t.pageX-this.offset.click.left<i[0]&&(o=i[0]+this.offset.click.left),t.pageY-this.offset.click.top<i[1]&&(a=i[1]+this.offset.click.top),t.pageX-this.offset.click.left>i[2]&&(o=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(a=i[3]+this.offset.click.top)),s.grid&&(t=s.grid[1]?this.originalPageY+Math.round((a-this.originalPageY)/s.grid[1])*s.grid[1]:this.originalPageY,a=!i||t-this.offset.click.top>=i[1]||t-this.offset.click.top>i[3]?t:t-this.offset.click.top>=i[1]?t-s.grid[1]:t+s.grid[1],t=s.grid[0]?this.originalPageX+Math.round((o-this.originalPageX)/s.grid[0])*s.grid[0]:this.originalPageX,o=!i||t-this.offset.click.left>=i[0]||t-this.offset.click.left>i[2]?t:t-this.offset.click.left>=i[0]?t-s.grid[0]:t+s.grid[0]),"y"===s.axis&&(o=this.originalPageX),"x"===s.axis&&(a=this.originalPageY)),{top:a-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:n?0:this.offset.scroll.top),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:n?0:this.offset.scroll.left)}},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_trigger:function(t,e,i){return i=i||this._uiHash(),V.ui.plugin.call(this,t,[e,i,this],!0),/^(drag|start|stop)/.test(t)&&(this.positionAbs=this._convertPositionTo("absolute"),i.offset=this.positionAbs),V.Widget.prototype._trigger.call(this,t,e,i)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),V.ui.plugin.add("draggable","connectToSortable",{start:function(e,t,i){var s=V.extend({},t,{item:i.element});i.sortables=[],V(i.options.connectToSortable).each(function(){var t=V(this).sortable("instance");t&&!t.options.disabled&&(i.sortables.push(t),t.refreshPositions(),t._trigger("activate",e,s))})},stop:function(e,t,i){var s=V.extend({},t,{item:i.element});i.cancelHelperRemoval=!1,V.each(i.sortables,function(){var t=this;t.isOver?(t.isOver=0,i.cancelHelperRemoval=!0,t.cancelHelperRemoval=!1,t._storedCSS={position:t.placeholder.css("position"),top:t.placeholder.css("top"),left:t.placeholder.css("left")},t._mouseStop(e),t.options.helper=t.options._helper):(t.cancelHelperRemoval=!0,t._trigger("deactivate",e,s))})},drag:function(i,s,n){V.each(n.sortables,function(){var t=!1,e=this;e.positionAbs=n.positionAbs,e.helperProportions=n.helperProportions,e.offset.click=n.offset.click,e._intersectsWith(e.containerCache)&&(t=!0,V.each(n.sortables,function(){return this.positionAbs=n.positionAbs,this.helperProportions=n.helperProportions,this.offset.click=n.offset.click,t=this!==e&&this._intersectsWith(this.containerCache)&&V.contains(e.element[0],this.element[0])?!1:t})),t?(e.isOver||(e.isOver=1,n._parent=s.helper.parent(),e.currentItem=s.helper.appendTo(e.element).data("ui-sortable-item",!0),e.options._helper=e.options.helper,e.options.helper=function(){return s.helper[0]},i.target=e.currentItem[0],e._mouseCapture(i,!0),e._mouseStart(i,!0,!0),e.offset.click.top=n.offset.click.top,e.offset.click.left=n.offset.click.left,e.offset.parent.left-=n.offset.parent.left-e.offset.parent.left,e.offset.parent.top-=n.offset.parent.top-e.offset.parent.top,n._trigger("toSortable",i),n.dropped=e.element,V.each(n.sortables,function(){this.refreshPositions()}),n.currentItem=n.element,e.fromOutside=n),e.currentItem&&(e._mouseDrag(i),s.position=e.position)):e.isOver&&(e.isOver=0,e.cancelHelperRemoval=!0,e.options._revert=e.options.revert,e.options.revert=!1,e._trigger("out",i,e._uiHash(e)),e._mouseStop(i,!0),e.options.revert=e.options._revert,e.options.helper=e.options._helper,e.placeholder&&e.placeholder.remove(),s.helper.appendTo(n._parent),n._refreshOffsets(i),s.position=n._generatePosition(i,!0),n._trigger("fromSortable",i),n.dropped=!1,V.each(n.sortables,function(){this.refreshPositions()}))})}}),V.ui.plugin.add("draggable","cursor",{start:function(t,e,i){var s=V("body"),i=i.options;s.css("cursor")&&(i._cursor=s.css("cursor")),s.css("cursor",i.cursor)},stop:function(t,e,i){i=i.options;i._cursor&&V("body").css("cursor",i._cursor)}}),V.ui.plugin.add("draggable","opacity",{start:function(t,e,i){e=V(e.helper),i=i.options;e.css("opacity")&&(i._opacity=e.css("opacity")),e.css("opacity",i.opacity)},stop:function(t,e,i){i=i.options;i._opacity&&V(e.helper).css("opacity",i._opacity)}}),V.ui.plugin.add("draggable","scroll",{start:function(t,e,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(t,e,i){var s=i.options,n=!1,o=i.scrollParentNotHidden[0],a=i.document[0];o!==a&&"HTML"!==o.tagName?(s.axis&&"x"===s.axis||(i.overflowOffset.top+o.offsetHeight-t.pageY<s.scrollSensitivity?o.scrollTop=n=o.scrollTop+s.scrollSpeed:t.pageY-i.overflowOffset.top<s.scrollSensitivity&&(o.scrollTop=n=o.scrollTop-s.scrollSpeed)),s.axis&&"y"===s.axis||(i.overflowOffset.left+o.offsetWidth-t.pageX<s.scrollSensitivity?o.scrollLeft=n=o.scrollLeft+s.scrollSpeed:t.pageX-i.overflowOffset.left<s.scrollSensitivity&&(o.scrollLeft=n=o.scrollLeft-s.scrollSpeed))):(s.axis&&"x"===s.axis||(t.pageY-V(a).scrollTop()<s.scrollSensitivity?n=V(a).scrollTop(V(a).scrollTop()-s.scrollSpeed):V(window).height()-(t.pageY-V(a).scrollTop())<s.scrollSensitivity&&(n=V(a).scrollTop(V(a).scrollTop()+s.scrollSpeed))),s.axis&&"y"===s.axis||(t.pageX-V(a).scrollLeft()<s.scrollSensitivity?n=V(a).scrollLeft(V(a).scrollLeft()-s.scrollSpeed):V(window).width()-(t.pageX-V(a).scrollLeft())<s.scrollSensitivity&&(n=V(a).scrollLeft(V(a).scrollLeft()+s.scrollSpeed)))),!1!==n&&V.ui.ddmanager&&!s.dropBehaviour&&V.ui.ddmanager.prepareOffsets(i,t)}}),V.ui.plugin.add("draggable","snap",{start:function(t,e,i){var s=i.options;i.snapElements=[],V(s.snap.constructor!==String?s.snap.items||":data(ui-draggable)":s.snap).each(function(){var t=V(this),e=t.offset();this!==i.element[0]&&i.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:e.top,left:e.left})})},drag:function(t,e,i){for(var s,n,o,a,r,l,h,c,u,d=i.options,p=d.snapTolerance,f=e.offset.left,g=f+i.helperProportions.width,m=e.offset.top,_=m+i.helperProportions.height,v=i.snapElements.length-1;0<=v;v--)l=(r=i.snapElements[v].left-i.margins.left)+i.snapElements[v].width,c=(h=i.snapElements[v].top-i.margins.top)+i.snapElements[v].height,g<r-p||l+p<f||_<h-p||c+p<m||!V.contains(i.snapElements[v].item.ownerDocument,i.snapElements[v].item)?(i.snapElements[v].snapping&&i.options.snap.release&&i.options.snap.release.call(i.element,t,V.extend(i._uiHash(),{snapItem:i.snapElements[v].item})),i.snapElements[v].snapping=!1):("inner"!==d.snapMode&&(s=Math.abs(h-_)<=p,n=Math.abs(c-m)<=p,o=Math.abs(r-g)<=p,a=Math.abs(l-f)<=p,s&&(e.position.top=i._convertPositionTo("relative",{top:h-i.helperProportions.height,left:0}).top),n&&(e.position.top=i._convertPositionTo("relative",{top:c,left:0}).top),o&&(e.position.left=i._convertPositionTo("relative",{top:0,left:r-i.helperProportions.width}).left),a&&(e.position.left=i._convertPositionTo("relative",{top:0,left:l}).left)),u=s||n||o||a,"outer"!==d.snapMode&&(s=Math.abs(h-m)<=p,n=Math.abs(c-_)<=p,o=Math.abs(r-f)<=p,a=Math.abs(l-g)<=p,s&&(e.position.top=i._convertPositionTo("relative",{top:h,left:0}).top),n&&(e.position.top=i._convertPositionTo("relative",{top:c-i.helperProportions.height,left:0}).top),o&&(e.position.left=i._convertPositionTo("relative",{top:0,left:r}).left),a&&(e.position.left=i._convertPositionTo("relative",{top:0,left:l-i.helperProportions.width}).left)),!i.snapElements[v].snapping&&(s||n||o||a||u)&&i.options.snap.snap&&i.options.snap.snap.call(i.element,t,V.extend(i._uiHash(),{snapItem:i.snapElements[v].item})),i.snapElements[v].snapping=s||n||o||a||u)}}),V.ui.plugin.add("draggable","stack",{start:function(t,e,i){var s,i=i.options,i=V.makeArray(V(i.stack)).sort(function(t,e){return(parseInt(V(t).css("zIndex"),10)||0)-(parseInt(V(e).css("zIndex"),10)||0)});i.length&&(s=parseInt(V(i[0]).css("zIndex"),10)||0,V(i).each(function(t){V(this).css("zIndex",s+t)}),this.css("zIndex",s+i.length))}}),V.ui.plugin.add("draggable","zIndex",{start:function(t,e,i){e=V(e.helper),i=i.options;e.css("zIndex")&&(i._zIndex=e.css("zIndex")),e.css("zIndex",i.zIndex)},stop:function(t,e,i){i=i.options;i._zIndex&&V(e.helper).css("zIndex",i._zIndex)}});V.ui.draggable;V.widget("ui.resizable",V.ui.mouse,{version:"1.13.2",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_hasScroll:function(t,e){if("hidden"===V(t).css("overflow"))return!1;var i=e&&"left"===e?"scrollLeft":"scrollTop",e=!1;if(0<t[i])return!0;try{t[i]=1,e=0<t[i],t[i]=0}catch(t){}return e},_create:function(){var t,e=this.options,i=this;this._addClass("ui-resizable"),V.extend(this,{_aspectRatio:!!e.aspectRatio,aspectRatio:e.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:e.helper||e.ghost||e.animate?e.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(V("<div class='ui-wrapper'></div>").css({overflow:"hidden",position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,t={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(t),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(t),this._proportionallyResize()),this._setupHandles(),e.autoHide&&V(this.element).on("mouseenter",function(){e.disabled||(i._removeClass("ui-resizable-autohide"),i._handles.show())}).on("mouseleave",function(){e.disabled||i.resizing||(i._addClass("ui-resizable-autohide"),i._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy(),this._addedHandles.remove();function t(t){V(t).removeData("resizable").removeData("ui-resizable").off(".resizable")}var e;return this.elementIsWrapper&&(t(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),t(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;case"aspectRatio":this._aspectRatio=!!e}},_setupHandles:function(){var t,e,i,s,n,o=this.options,a=this;if(this.handles=o.handles||(V(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=V(),this._addedHandles=V(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),i=this.handles.split(","),this.handles={},e=0;e<i.length;e++)s="ui-resizable-"+(t=String.prototype.trim.call(i[e])),n=V("<div>"),this._addClass(n,"ui-resizable-handle "+s),n.css({zIndex:o.zIndex}),this.handles[t]=".ui-resizable-"+t,this.element.children(this.handles[t]).length||(this.element.append(n),this._addedHandles=this._addedHandles.add(n));this._renderAxis=function(t){var e,i,s;for(e in t=t||this.element,this.handles)this.handles[e].constructor===String?this.handles[e]=this.element.children(this.handles[e]).first().show():(this.handles[e].jquery||this.handles[e].nodeType)&&(this.handles[e]=V(this.handles[e]),this._on(this.handles[e],{mousedown:a._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(i=V(this.handles[e],this.element),s=/sw|ne|nw|se|n|s/.test(e)?i.outerHeight():i.outerWidth(),i=["padding",/ne|nw|n/.test(e)?"Top":/se|sw|s/.test(e)?"Bottom":/^e$/.test(e)?"Right":"Left"].join(""),t.css(i,s),this._proportionallyResize()),this._handles=this._handles.add(this.handles[e])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){a.resizing||(this.className&&(n=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),a.axis=n&&n[1]?n[1]:"se")}),o.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._addedHandles.remove()},_mouseCapture:function(t){var e,i,s=!1;for(e in this.handles)(i=V(this.handles[e])[0])!==t.target&&!V.contains(i,t.target)||(s=!0);return!this.options.disabled&&s},_mouseStart:function(t){var e,i,s=this.options,n=this.element;return this.resizing=!0,this._renderProxy(),e=this._num(this.helper.css("left")),i=this._num(this.helper.css("top")),s.containment&&(e+=V(s.containment).scrollLeft()||0,i+=V(s.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:e,top:i},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:n.width(),height:n.height()},this.originalSize=this._helper?{width:n.outerWidth(),height:n.outerHeight()}:{width:n.width(),height:n.height()},this.sizeDiff={width:n.outerWidth()-n.width(),height:n.outerHeight()-n.height()},this.originalPosition={left:e,top:i},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof s.aspectRatio?s.aspectRatio:this.originalSize.width/this.originalSize.height||1,s=V(".ui-resizable-"+this.axis).css("cursor"),V("body").css("cursor","auto"===s?this.axis+"-resize":s),this._addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var e=this.originalMousePosition,i=this.axis,s=t.pageX-e.left||0,e=t.pageY-e.top||0,i=this._change[i];return this._updatePrevProperties(),i&&(e=i.apply(this,[t,s,e]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(e=this._updateRatio(e,t)),e=this._respectSize(e,t),this._updateCache(e),this._propagate("resize",t),e=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),V.isEmptyObject(e)||(this._updatePrevProperties(),this._trigger("resize",t,this.ui()),this._applyChanges())),!1},_mouseStop:function(t){this.resizing=!1;var e,i,s,n=this.options,o=this;return this._helper&&(s=(e=(i=this._proportionallyResizeElements).length&&/textarea/i.test(i[0].nodeName))&&this._hasScroll(i[0],"left")?0:o.sizeDiff.height,i=e?0:o.sizeDiff.width,e={width:o.helper.width()-i,height:o.helper.height()-s},i=parseFloat(o.element.css("left"))+(o.position.left-o.originalPosition.left)||null,s=parseFloat(o.element.css("top"))+(o.position.top-o.originalPosition.top)||null,n.animate||this.element.css(V.extend(e,{top:s,left:i})),o.helper.height(o.size.height),o.helper.width(o.size.width),this._helper&&!n.animate&&this._proportionallyResize()),V("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s=this.options,n={minWidth:this._isNumber(s.minWidth)?s.minWidth:0,maxWidth:this._isNumber(s.maxWidth)?s.maxWidth:1/0,minHeight:this._isNumber(s.minHeight)?s.minHeight:0,maxHeight:this._isNumber(s.maxHeight)?s.maxHeight:1/0};(this._aspectRatio||t)&&(e=n.minHeight*this.aspectRatio,i=n.minWidth/this.aspectRatio,s=n.maxHeight*this.aspectRatio,t=n.maxWidth/this.aspectRatio,e>n.minWidth&&(n.minWidth=e),i>n.minHeight&&(n.minHeight=i),s<n.maxWidth&&(n.maxWidth=s),t<n.maxHeight&&(n.maxHeight=t)),this._vBoundaries=n},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidth<t.width,n=this._isNumber(t.height)&&e.maxHeight&&e.maxHeight<t.height,o=this._isNumber(t.width)&&e.minWidth&&e.minWidth>t.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,l=this.originalPosition.top+this.originalSize.height,h=/sw|nw|w/.test(i),i=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&h&&(t.left=r-e.minWidth),s&&h&&(t.left=r-e.maxWidth),a&&i&&(t.top=l-e.minHeight),n&&i&&(t.top=l-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];e<4;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;e<this._proportionallyResizeElements.length;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var t=this.element,e=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||V("<div></div>").css({overflow:"hidden"}),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++e.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize;return{left:this.originalPosition.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize;return{top:this.originalPosition.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(t,e,i){return V.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,e,i]))},sw:function(t,e,i){return V.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,e,i]))},ne:function(t,e,i){return V.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,e,i]))},nw:function(t,e,i){return V.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,e,i]))}},_propagate:function(t,e){V.ui.plugin.call(this,t,[e,this.ui()]),"resize"!==t&&this._trigger(t,e,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),V.ui.plugin.add("resizable","animate",{stop:function(e){var i=V(this).resizable("instance"),t=i.options,s=i._proportionallyResizeElements,n=s.length&&/textarea/i.test(s[0].nodeName),o=n&&i._hasScroll(s[0],"left")?0:i.sizeDiff.height,a=n?0:i.sizeDiff.width,n={width:i.size.width-a,height:i.size.height-o},a=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,o=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(V.extend(n,o&&a?{top:o,left:a}:{}),{duration:t.animateDuration,easing:t.animateEasing,step:function(){var t={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};s&&s.length&&V(s[0]).css({width:t.width,height:t.height}),i._updateCache(t),i._propagate("resize",e)}})}}),V.ui.plugin.add("resizable","containment",{start:function(){var i,s,n=V(this).resizable("instance"),t=n.options,e=n.element,o=t.containment,a=o instanceof V?o.get(0):/parent/.test(o)?e.parent().get(0):o;a&&(n.containerElement=V(a),/document/.test(o)||o===document?(n.containerOffset={left:0,top:0},n.containerPosition={left:0,top:0},n.parentData={element:V(document),left:0,top:0,width:V(document).width(),height:V(document).height()||document.body.parentNode.scrollHeight}):(i=V(a),s=[],V(["Top","Right","Left","Bottom"]).each(function(t,e){s[t]=n._num(i.css("padding"+e))}),n.containerOffset=i.offset(),n.containerPosition=i.position(),n.containerSize={height:i.innerHeight()-s[3],width:i.innerWidth()-s[1]},t=n.containerOffset,e=n.containerSize.height,o=n.containerSize.width,o=n._hasScroll(a,"left")?a.scrollWidth:o,e=n._hasScroll(a)?a.scrollHeight:e,n.parentData={element:a,left:t.left,top:t.top,width:o,height:e}))},resize:function(t){var e=V(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.position,o=e._aspectRatio||t.shiftKey,a={top:0,left:0},r=e.containerElement,t=!0;r[0]!==document&&/static/.test(r.css("position"))&&(a=s),n.left<(e._helper?s.left:0)&&(e.size.width=e.size.width+(e._helper?e.position.left-s.left:e.position.left-a.left),o&&(e.size.height=e.size.width/e.aspectRatio,t=!1),e.position.left=i.helper?s.left:0),n.top<(e._helper?s.top:0)&&(e.size.height=e.size.height+(e._helper?e.position.top-s.top:e.position.top),o&&(e.size.width=e.size.height*e.aspectRatio,t=!1),e.position.top=e._helper?s.top:0),i=e.containerElement.get(0)===e.element.parent().get(0),n=/relative|absolute/.test(e.containerElement.css("position")),i&&n?(e.offset.left=e.parentData.left+e.position.left,e.offset.top=e.parentData.top+e.position.top):(e.offset.left=e.element.offset().left,e.offset.top=e.element.offset().top),n=Math.abs(e.sizeDiff.width+(e._helper?e.offset.left-a.left:e.offset.left-s.left)),s=Math.abs(e.sizeDiff.height+(e._helper?e.offset.top-a.top:e.offset.top-s.top)),n+e.size.width>=e.parentData.width&&(e.size.width=e.parentData.width-n,o&&(e.size.height=e.size.width/e.aspectRatio,t=!1)),s+e.size.height>=e.parentData.height&&(e.size.height=e.parentData.height-s,o&&(e.size.width=e.size.height*e.aspectRatio,t=!1)),t||(e.position.left=e.prevPosition.left,e.position.top=e.prevPosition.top,e.size.width=e.prevSize.width,e.size.height=e.prevSize.height)},stop:function(){var t=V(this).resizable("instance"),e=t.options,i=t.containerOffset,s=t.containerPosition,n=t.containerElement,o=V(t.helper),a=o.offset(),r=o.outerWidth()-t.sizeDiff.width,o=o.outerHeight()-t.sizeDiff.height;t._helper&&!e.animate&&/relative/.test(n.css("position"))&&V(this).css({left:a.left-s.left-i.left,width:r,height:o}),t._helper&&!e.animate&&/static/.test(n.css("position"))&&V(this).css({left:a.left-s.left-i.left,width:r,height:o})}}),V.ui.plugin.add("resizable","alsoResize",{start:function(){var t=V(this).resizable("instance").options;V(t.alsoResize).each(function(){var t=V(this);t.data("ui-resizable-alsoresize",{width:parseFloat(t.width()),height:parseFloat(t.height()),left:parseFloat(t.css("left")),top:parseFloat(t.css("top"))})})},resize:function(t,i){var e=V(this).resizable("instance"),s=e.options,n=e.originalSize,o=e.originalPosition,a={height:e.size.height-n.height||0,width:e.size.width-n.width||0,top:e.position.top-o.top||0,left:e.position.left-o.left||0};V(s.alsoResize).each(function(){var t=V(this),s=V(this).data("ui-resizable-alsoresize"),n={},e=t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];V.each(e,function(t,e){var i=(s[e]||0)+(a[e]||0);i&&0<=i&&(n[e]=i||null)}),t.css(n)})},stop:function(){V(this).removeData("ui-resizable-alsoresize")}}),V.ui.plugin.add("resizable","ghost",{start:function(){var t=V(this).resizable("instance"),e=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}),t._addClass(t.ghost,"ui-resizable-ghost"),!1!==V.uiBackCompat&&"string"==typeof t.options.ghost&&t.ghost.addClass(this.options.ghost),t.ghost.appendTo(t.helper)},resize:function(){var t=V(this).resizable("instance");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=V(this).resizable("instance");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),V.ui.plugin.add("resizable","grid",{resize:function(){var t,e=V(this).resizable("instance"),i=e.options,s=e.size,n=e.originalSize,o=e.originalPosition,a=e.axis,r="number"==typeof i.grid?[i.grid,i.grid]:i.grid,l=r[0]||1,h=r[1]||1,c=Math.round((s.width-n.width)/l)*l,u=Math.round((s.height-n.height)/h)*h,d=n.width+c,p=n.height+u,f=i.maxWidth&&i.maxWidth<d,g=i.maxHeight&&i.maxHeight<p,m=i.minWidth&&i.minWidth>d,s=i.minHeight&&i.minHeight>p;i.grid=r,m&&(d+=l),s&&(p+=h),f&&(d-=l),g&&(p-=h),/^(se|s|e)$/.test(a)?(e.size.width=d,e.size.height=p):/^(ne)$/.test(a)?(e.size.width=d,e.size.height=p,e.position.top=o.top-u):/^(sw)$/.test(a)?(e.size.width=d,e.size.height=p,e.position.left=o.left-c):((p-h<=0||d-l<=0)&&(t=e._getPaddingPlusBorderDimensions(this)),0<p-h?(e.size.height=p,e.position.top=o.top-u):(p=h-t.height,e.size.height=p,e.position.top=o.top+n.height-p),0<d-l?(e.size.width=d,e.position.left=o.left-c):(d=l-t.width,e.size.width=d,e.position.left=o.left+n.width-d))}});V.ui.resizable;V.widget("ui.dialog",{version:"1.13.2",options:{appendTo:"body",autoOpen:!0,buttons:[],classes:{"ui-dialog":"ui-corner-all","ui-dialog-titlebar":"ui-corner-all"},closeOnEscape:!0,closeText:"Close",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(t){var e=V(this).css(t).offset().top;e<0&&V(this).css("top",t.top-e)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),null==this.options.title&&null!=this.originalTitle&&(this.options.title=this.originalTitle),this.options.disabled&&(this.options.disabled=!1),this._createWrapper(),this.element.show().removeAttr("title").appendTo(this.uiDialog),this._addClass("ui-dialog-content","ui-widget-content"),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&V.fn.draggable&&this._makeDraggable(),this.options.resizable&&V.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var t=this.options.appendTo;return t&&(t.jquery||t.nodeType)?V(t):this.document.find(t||"body").eq(0)},_destroy:function(){var t,e=this.originalPosition;this._untrackInstance(),this._destroyOverlay(),this.element.removeUniqueId().css(this.originalCss).detach(),this.uiDialog.remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),(t=e.parent.children().eq(e.index)).length&&t[0]!==this.element[0]?t.before(this.element):e.parent.append(this.element)},widget:function(){return this.uiDialog},disable:V.noop,enable:V.noop,close:function(t){var e=this;this._isOpen&&!1!==this._trigger("beforeClose",t)&&(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),this.opener.filter(":focusable").trigger("focus").length||V.ui.safeBlur(V.ui.safeActiveElement(this.document[0])),this._hide(this.uiDialog,this.options.hide,function(){e._trigger("close",t)}))},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(t,e){var i=!1,s=this.uiDialog.siblings(".ui-front:visible").map(function(){return+V(this).css("z-index")}).get(),s=Math.max.apply(null,s);return s>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",s+1),i=!0),i&&!e&&this._trigger("focus",t),i},open:function(){var t=this;this._isOpen?this._moveToTop()&&this._focusTabbable():(this._isOpen=!0,this.opener=V(V.ui.safeActiveElement(this.document[0])),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){t._focusTabbable(),t._trigger("focus")}),this._makeFocusTarget(),this._trigger("open"))},_focusTabbable:function(){var t=this._focusedElement;(t=!(t=!(t=!(t=!(t=t||this.element.find("[autofocus]")).length?this.element.find(":tabbable"):t).length?this.uiDialogButtonPane.find(":tabbable"):t).length?this.uiDialogTitlebarClose.filter(":tabbable"):t).length?this.uiDialog:t).eq(0).trigger("focus")},_restoreTabbableFocus:function(){var t=V.ui.safeActiveElement(this.document[0]);this.uiDialog[0]===t||V.contains(this.uiDialog[0],t)||this._focusTabbable()},_keepFocus:function(t){t.preventDefault(),this._restoreTabbableFocus(),this._delay(this._restoreTabbableFocus)},_createWrapper:function(){this.uiDialog=V("<div>").hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._addClass(this.uiDialog,"ui-dialog","ui-widget ui-widget-content ui-front"),this._on(this.uiDialog,{keydown:function(t){if(this.options.closeOnEscape&&!t.isDefaultPrevented()&&t.keyCode&&t.keyCode===V.ui.keyCode.ESCAPE)return t.preventDefault(),void this.close(t);var e,i,s;t.keyCode!==V.ui.keyCode.TAB||t.isDefaultPrevented()||(e=this.uiDialog.find(":tabbable"),i=e.first(),s=e.last(),t.target!==s[0]&&t.target!==this.uiDialog[0]||t.shiftKey?t.target!==i[0]&&t.target!==this.uiDialog[0]||!t.shiftKey||(this._delay(function(){s.trigger("focus")}),t.preventDefault()):(this._delay(function(){i.trigger("focus")}),t.preventDefault()))},mousedown:function(t){this._moveToTop(t)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var t;this.uiDialogTitlebar=V("<div>"),this._addClass(this.uiDialogTitlebar,"ui-dialog-titlebar","ui-widget-header ui-helper-clearfix"),this._on(this.uiDialogTitlebar,{mousedown:function(t){V(t.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.trigger("focus")}}),this.uiDialogTitlebarClose=V("<button type='button'></button>").button({label:V("<a>").text(this.options.closeText).html(),icon:"ui-icon-closethick",showLabel:!1}).appendTo(this.uiDialogTitlebar),this._addClass(this.uiDialogTitlebarClose,"ui-dialog-titlebar-close"),this._on(this.uiDialogTitlebarClose,{click:function(t){t.preventDefault(),this.close(t)}}),t=V("<span>").uniqueId().prependTo(this.uiDialogTitlebar),this._addClass(t,"ui-dialog-title"),this._title(t),this.uiDialogTitlebar.prependTo(this.uiDialog),this.uiDialog.attr({"aria-labelledby":t.attr("id")})},_title:function(t){this.options.title?t.text(this.options.title):t.html("&#160;")},_createButtonPane:function(){this.uiDialogButtonPane=V("<div>"),this._addClass(this.uiDialogButtonPane,"ui-dialog-buttonpane","ui-widget-content ui-helper-clearfix"),this.uiButtonSet=V("<div>").appendTo(this.uiDialogButtonPane),this._addClass(this.uiButtonSet,"ui-dialog-buttonset"),this._createButtons()},_createButtons:function(){var s=this,t=this.options.buttons;this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),V.isEmptyObject(t)||Array.isArray(t)&&!t.length?this._removeClass(this.uiDialog,"ui-dialog-buttons"):(V.each(t,function(t,e){var i;e=V.extend({type:"button"},e="function"==typeof e?{click:e,text:t}:e),i=e.click,t={icon:e.icon,iconPosition:e.iconPosition,showLabel:e.showLabel,icons:e.icons,text:e.text},delete e.click,delete e.icon,delete e.iconPosition,delete e.showLabel,delete e.icons,"boolean"==typeof e.text&&delete e.text,V("<button></button>",e).button(t).appendTo(s.uiButtonSet).on("click",function(){i.apply(s.element[0],arguments)})}),this._addClass(this.uiDialog,"ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog))},_makeDraggable:function(){var n=this,o=this.options;function a(t){return{position:t.position,offset:t.offset}}this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(t,e){n._addClass(V(this),"ui-dialog-dragging"),n._blockFrames(),n._trigger("dragStart",t,a(e))},drag:function(t,e){n._trigger("drag",t,a(e))},stop:function(t,e){var i=e.offset.left-n.document.scrollLeft(),s=e.offset.top-n.document.scrollTop();o.position={my:"left top",at:"left"+(0<=i?"+":"")+i+" top"+(0<=s?"+":"")+s,of:n.window},n._removeClass(V(this),"ui-dialog-dragging"),n._unblockFrames(),n._trigger("dragStop",t,a(e))}})},_makeResizable:function(){var n=this,o=this.options,t=o.resizable,e=this.uiDialog.css("position"),t="string"==typeof t?t:"n,e,s,w,se,sw,ne,nw";function a(t){return{originalPosition:t.originalPosition,originalSize:t.originalSize,position:t.position,size:t.size}}this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:o.maxWidth,maxHeight:o.maxHeight,minWidth:o.minWidth,minHeight:this._minHeight(),handles:t,start:function(t,e){n._addClass(V(this),"ui-dialog-resizing"),n._blockFrames(),n._trigger("resizeStart",t,a(e))},resize:function(t,e){n._trigger("resize",t,a(e))},stop:function(t,e){var i=n.uiDialog.offset(),s=i.left-n.document.scrollLeft(),i=i.top-n.document.scrollTop();o.height=n.uiDialog.height(),o.width=n.uiDialog.width(),o.position={my:"left top",at:"left"+(0<=s?"+":"")+s+" top"+(0<=i?"+":"")+i,of:n.window},n._removeClass(V(this),"ui-dialog-resizing"),n._unblockFrames(),n._trigger("resizeStop",t,a(e))}}).css("position",e)},_trackFocus:function(){this._on(this.widget(),{focusin:function(t){this._makeFocusTarget(),this._focusedElement=V(t.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var t=this._trackingInstances(),e=V.inArray(this,t);-1!==e&&t.splice(e,1)},_trackingInstances:function(){var t=this.document.data("ui-dialog-instances");return t||this.document.data("ui-dialog-instances",t=[]),t},_minHeight:function(){var t=this.options;return"auto"===t.height?t.minHeight:Math.min(t.minHeight,t.height)},_position:function(){var t=this.uiDialog.is(":visible");t||this.uiDialog.show(),this.uiDialog.position(this.options.position),t||this.uiDialog.hide()},_setOptions:function(t){var i=this,s=!1,n={};V.each(t,function(t,e){i._setOption(t,e),t in i.sizeRelatedOptions&&(s=!0),t in i.resizableRelatedOptions&&(n[t]=e)}),s&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",n)},_setOption:function(t,e){var i,s=this.uiDialog;"disabled"!==t&&(this._super(t,e),"appendTo"===t&&this.uiDialog.appendTo(this._appendTo()),"buttons"===t&&this._createButtons(),"closeText"===t&&this.uiDialogTitlebarClose.button({label:V("<a>").text(""+this.options.closeText).html()}),"draggable"===t&&((i=s.is(":data(ui-draggable)"))&&!e&&s.draggable("destroy"),!i&&e&&this._makeDraggable()),"position"===t&&this._position(),"resizable"===t&&((i=s.is(":data(ui-resizable)"))&&!e&&s.resizable("destroy"),i&&"string"==typeof e&&s.resizable("option","handles",e),i||!1===e||this._makeResizable()),"title"===t&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var t,e,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),t=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),e=Math.max(0,s.minHeight-t),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-t):"none","auto"===s.height?this.element.css({minHeight:e,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-t)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var t=V(this);return V("<div>").css({position:"absolute",width:t.outerWidth(),height:t.outerHeight()}).appendTo(t.parent()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(t){return!!V(t.target).closest(".ui-dialog").length||!!V(t.target).closest(".ui-datepicker").length},_createOverlay:function(){var i,s;this.options.modal&&(i=V.fn.jquery.substring(0,4),s=!0,this._delay(function(){s=!1}),this.document.data("ui-dialog-overlays")||this.document.on("focusin.ui-dialog",function(t){var e;s||((e=this._trackingInstances()[0])._allowInteraction(t)||(t.preventDefault(),e._focusTabbable(),"3.4."!==i&&"3.5."!==i||e._delay(e._restoreTabbableFocus)))}.bind(this)),this.overlay=V("<div>").appendTo(this._appendTo()),this._addClass(this.overlay,null,"ui-widget-overlay ui-front"),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1))},_destroyOverlay:function(){var t;this.options.modal&&this.overlay&&((t=this.document.data("ui-dialog-overlays")-1)?this.document.data("ui-dialog-overlays",t):(this.document.off("focusin.ui-dialog"),this.document.removeData("ui-dialog-overlays")),this.overlay.remove(),this.overlay=null)}}),!1!==V.uiBackCompat&&V.widget("ui.dialog",V.ui.dialog,{options:{dialogClass:""},_createWrapper:function(){this._super(),this.uiDialog.addClass(this.options.dialogClass)},_setOption:function(t,e){"dialogClass"===t&&this.uiDialog.removeClass(this.options.dialogClass).addClass(e),this._superApply(arguments)}});V.ui.dialog;function lt(t,e,i){return e<=t&&t<e+i}V.widget("ui.droppable",{version:"1.13.2",widgetEventPrefix:"drop",options:{accept:"*",addClasses:!0,greedy:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t,e=this.options,i=e.accept;this.isover=!1,this.isout=!0,this.accept="function"==typeof i?i:function(t){return t.is(i)},this.proportions=function(){if(!arguments.length)return t=t||{width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};t=arguments[0]},this._addToManager(e.scope),e.addClasses&&this._addClass("ui-droppable")},_addToManager:function(t){V.ui.ddmanager.droppables[t]=V.ui.ddmanager.droppables[t]||[],V.ui.ddmanager.droppables[t].push(this)},_splice:function(t){for(var e=0;e<t.length;e++)t[e]===this&&t.splice(e,1)},_destroy:function(){var t=V.ui.ddmanager.droppables[this.options.scope];this._splice(t)},_setOption:function(t,e){var i;"accept"===t?this.accept="function"==typeof e?e:function(t){return t.is(e)}:"scope"===t&&(i=V.ui.ddmanager.droppables[this.options.scope],this._splice(i),this._addToManager(e)),this._super(t,e)},_activate:function(t){var e=V.ui.ddmanager.current;this._addActiveClass(),e&&this._trigger("activate",t,this.ui(e))},_deactivate:function(t){var e=V.ui.ddmanager.current;this._removeActiveClass(),e&&this._trigger("deactivate",t,this.ui(e))},_over:function(t){var e=V.ui.ddmanager.current;e&&(e.currentItem||e.element)[0]!==this.element[0]&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this._addHoverClass(),this._trigger("over",t,this.ui(e)))},_out:function(t){var e=V.ui.ddmanager.current;e&&(e.currentItem||e.element)[0]!==this.element[0]&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this._removeHoverClass(),this._trigger("out",t,this.ui(e)))},_drop:function(e,t){var i=t||V.ui.ddmanager.current,s=!1;return!(!i||(i.currentItem||i.element)[0]===this.element[0])&&(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var t=V(this).droppable("instance");if(t.options.greedy&&!t.options.disabled&&t.options.scope===i.options.scope&&t.accept.call(t.element[0],i.currentItem||i.element)&&V.ui.intersect(i,V.extend(t,{offset:t.element.offset()}),t.options.tolerance,e))return!(s=!0)}),!s&&(!!this.accept.call(this.element[0],i.currentItem||i.element)&&(this._removeActiveClass(),this._removeHoverClass(),this._trigger("drop",e,this.ui(i)),this.element)))},ui:function(t){return{draggable:t.currentItem||t.element,helper:t.helper,position:t.position,offset:t.positionAbs}},_addHoverClass:function(){this._addClass("ui-droppable-hover")},_removeHoverClass:function(){this._removeClass("ui-droppable-hover")},_addActiveClass:function(){this._addClass("ui-droppable-active")},_removeActiveClass:function(){this._removeClass("ui-droppable-active")}}),V.ui.intersect=function(t,e,i,s){if(!e.offset)return!1;var n=(t.positionAbs||t.position.absolute).left+t.margins.left,o=(t.positionAbs||t.position.absolute).top+t.margins.top,a=n+t.helperProportions.width,r=o+t.helperProportions.height,l=e.offset.left,h=e.offset.top,c=l+e.proportions().width,u=h+e.proportions().height;switch(i){case"fit":return l<=n&&a<=c&&h<=o&&r<=u;case"intersect":return l<n+t.helperProportions.width/2&&a-t.helperProportions.width/2<c&&h<o+t.helperProportions.height/2&&r-t.helperProportions.height/2<u;case"pointer":return lt(s.pageY,h,e.proportions().height)&&lt(s.pageX,l,e.proportions().width);case"touch":return(h<=o&&o<=u||h<=r&&r<=u||o<h&&u<r)&&(l<=n&&n<=c||l<=a&&a<=c||n<l&&c<a);default:return!1}},!(V.ui.ddmanager={current:null,droppables:{default:[]},prepareOffsets:function(t,e){var i,s,n=V.ui.ddmanager.droppables[t.options.scope]||[],o=e?e.type:null,a=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();t:for(i=0;i<n.length;i++)if(!(n[i].options.disabled||t&&!n[i].accept.call(n[i].element[0],t.currentItem||t.element))){for(s=0;s<a.length;s++)if(a[s]===n[i].element[0]){n[i].proportions().height=0;continue t}n[i].visible="none"!==n[i].element.css("display"),n[i].visible&&("mousedown"===o&&n[i]._activate.call(n[i],e),n[i].offset=n[i].element.offset(),n[i].proportions({width:n[i].element[0].offsetWidth,height:n[i].element[0].offsetHeight}))}},drop:function(t,e){var i=!1;return V.each((V.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&V.ui.intersect(t,this,this.options.tolerance,e)&&(i=this._drop.call(this,e)||i),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,e)))}),i},dragStart:function(t,e){t.element.parentsUntil("body").on("scroll.droppable",function(){t.options.refreshPositions||V.ui.ddmanager.prepareOffsets(t,e)})},drag:function(n,o){n.options.refreshPositions&&V.ui.ddmanager.prepareOffsets(n,o),V.each(V.ui.ddmanager.droppables[n.options.scope]||[],function(){var t,e,i,s;this.options.disabled||this.greedyChild||!this.visible||(s=!(i=V.ui.intersect(n,this,this.options.tolerance,o))&&this.isover?"isout":i&&!this.isover?"isover":null)&&(this.options.greedy&&(e=this.options.scope,(i=this.element.parents(":data(ui-droppable)").filter(function(){return V(this).droppable("instance").options.scope===e})).length&&((t=V(i[0]).droppable("instance")).greedyChild="isover"===s)),t&&"isover"===s&&(t.isover=!1,t.isout=!0,t._out.call(t,o)),this[s]=!0,this["isout"===s?"isover":"isout"]=!1,this["isover"===s?"_over":"_out"].call(this,o),t&&"isout"===s&&(t.isout=!1,t.isover=!0,t._over.call(t,o)))})},dragStop:function(t,e){t.element.parentsUntil("body").off("scroll.droppable"),t.options.refreshPositions||V.ui.ddmanager.prepareOffsets(t,e)}})!==V.uiBackCompat&&V.widget("ui.droppable",V.ui.droppable,{options:{hoverClass:!1,activeClass:!1},_addActiveClass:function(){this._super(),this.options.activeClass&&this.element.addClass(this.options.activeClass)},_removeActiveClass:function(){this._super(),this.options.activeClass&&this.element.removeClass(this.options.activeClass)},_addHoverClass:function(){this._super(),this.options.hoverClass&&this.element.addClass(this.options.hoverClass)},_removeHoverClass:function(){this._super(),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass)}});V.ui.droppable,V.widget("ui.progressbar",{version:"1.13.2",options:{classes:{"ui-progressbar":"ui-corner-all","ui-progressbar-value":"ui-corner-left","ui-progressbar-complete":"ui-corner-right"},max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.attr({role:"progressbar","aria-valuemin":this.min}),this._addClass("ui-progressbar","ui-widget ui-widget-content"),this.valueDiv=V("<div>").appendTo(this.element),this._addClass(this.valueDiv,"ui-progressbar-value","ui-widget-header"),this._refreshValue()},_destroy:function(){this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow"),this.valueDiv.remove()},value:function(t){if(void 0===t)return this.options.value;this.options.value=this._constrainedValue(t),this._refreshValue()},_constrainedValue:function(t){return void 0===t&&(t=this.options.value),this.indeterminate=!1===t,"number"!=typeof t&&(t=0),!this.indeterminate&&Math.min(this.options.max,Math.max(this.min,t))},_setOptions:function(t){var e=t.value;delete t.value,this._super(t),this.options.value=this._constrainedValue(e),this._refreshValue()},_setOption:function(t,e){"max"===t&&(e=Math.max(this.min,e)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var t=this.options.value,e=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).width(e.toFixed(0)+"%"),this._toggleClass(this.valueDiv,"ui-progressbar-complete",null,t===this.options.max)._toggleClass("ui-progressbar-indeterminate",null,this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=V("<div>").appendTo(this.valueDiv),this._addClass(this.overlayDiv,"ui-progressbar-overlay"))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":t}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==t&&(this.oldValue=t,this._trigger("change")),t===this.options.max&&this._trigger("complete")}}),V.widget("ui.selectable",V.ui.mouse,{version:"1.13.2",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var i=this;this._addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){i.elementPos=V(i.element[0]).offset(),i.selectees=V(i.options.filter,i.element[0]),i._addClass(i.selectees,"ui-selectee"),i.selectees.each(function(){var t=V(this),e=t.offset(),e={left:e.left-i.elementPos.left,top:e.top-i.elementPos.top};V.data(this,"selectable-item",{element:this,$element:t,left:e.left,top:e.top,right:e.left+t.outerWidth(),bottom:e.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this._mouseInit(),this.helper=V("<div>"),this._addClass(this.helper,"ui-selectable-helper")},_destroy:function(){this.selectees.removeData("selectable-item"),this._mouseDestroy()},_mouseStart:function(i){var s=this,t=this.options;this.opos=[i.pageX,i.pageY],this.elementPos=V(this.element[0]).offset(),this.options.disabled||(this.selectees=V(t.filter,this.element[0]),this._trigger("start",i),V(t.appendTo).append(this.helper),this.helper.css({left:i.pageX,top:i.pageY,width:0,height:0}),t.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var t=V.data(this,"selectable-item");t.startselected=!0,i.metaKey||i.ctrlKey||(s._removeClass(t.$element,"ui-selected"),t.selected=!1,s._addClass(t.$element,"ui-unselecting"),t.unselecting=!0,s._trigger("unselecting",i,{unselecting:t.element}))}),V(i.target).parents().addBack().each(function(){var t,e=V.data(this,"selectable-item");if(e)return t=!i.metaKey&&!i.ctrlKey||!e.$element.hasClass("ui-selected"),s._removeClass(e.$element,t?"ui-unselecting":"ui-selected")._addClass(e.$element,t?"ui-selecting":"ui-unselecting"),e.unselecting=!t,e.selecting=t,(e.selected=t)?s._trigger("selecting",i,{selecting:e.element}):s._trigger("unselecting",i,{unselecting:e.element}),!1}))},_mouseDrag:function(s){if(this.dragged=!0,!this.options.disabled){var t,n=this,o=this.options,a=this.opos[0],r=this.opos[1],l=s.pageX,h=s.pageY;return l<a&&(t=l,l=a,a=t),h<r&&(t=h,h=r,r=t),this.helper.css({left:a,top:r,width:l-a,height:h-r}),this.selectees.each(function(){var t=V.data(this,"selectable-item"),e=!1,i={};t&&t.element!==n.element[0]&&(i.left=t.left+n.elementPos.left,i.right=t.right+n.elementPos.left,i.top=t.top+n.elementPos.top,i.bottom=t.bottom+n.elementPos.top,"touch"===o.tolerance?e=!(i.left>l||i.right<a||i.top>h||i.bottom<r):"fit"===o.tolerance&&(e=i.left>a&&i.right<l&&i.top>r&&i.bottom<h),e?(t.selected&&(n._removeClass(t.$element,"ui-selected"),t.selected=!1),t.unselecting&&(n._removeClass(t.$element,"ui-unselecting"),t.unselecting=!1),t.selecting||(n._addClass(t.$element,"ui-selecting"),t.selecting=!0,n._trigger("selecting",s,{selecting:t.element}))):(t.selecting&&((s.metaKey||s.ctrlKey)&&t.startselected?(n._removeClass(t.$element,"ui-selecting"),t.selecting=!1,n._addClass(t.$element,"ui-selected"),t.selected=!0):(n._removeClass(t.$element,"ui-selecting"),t.selecting=!1,t.startselected&&(n._addClass(t.$element,"ui-unselecting"),t.unselecting=!0),n._trigger("unselecting",s,{unselecting:t.element}))),t.selected&&(s.metaKey||s.ctrlKey||t.startselected||(n._removeClass(t.$element,"ui-selected"),t.selected=!1,n._addClass(t.$element,"ui-unselecting"),t.unselecting=!0,n._trigger("unselecting",s,{unselecting:t.element})))))}),!1}},_mouseStop:function(e){var i=this;return this.dragged=!1,V(".ui-unselecting",this.element[0]).each(function(){var t=V.data(this,"selectable-item");i._removeClass(t.$element,"ui-unselecting"),t.unselecting=!1,t.startselected=!1,i._trigger("unselected",e,{unselected:t.element})}),V(".ui-selecting",this.element[0]).each(function(){var t=V.data(this,"selectable-item");i._removeClass(t.$element,"ui-selecting")._addClass(t.$element,"ui-selected"),t.selecting=!1,t.selected=!0,t.startselected=!0,i._trigger("selected",e,{selected:t.element})}),this._trigger("stop",e),this.helper.remove(),!1}}),V.widget("ui.selectmenu",[V.ui.formResetMixin,{version:"1.13.2",defaultElement:"<select>",options:{appendTo:null,classes:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"},disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:!1,change:null,close:null,focus:null,open:null,select:null},_create:function(){var t=this.element.uniqueId().attr("id");this.ids={element:t,button:t+"-button",menu:t+"-menu"},this._drawButton(),this._drawMenu(),this._bindFormResetHandler(),this._rendered=!1,this.menuItems=V()},_drawButton:function(){var t,e=this,i=this._parseOption(this.element.find("option:selected"),this.element[0].selectedIndex);this.labels=this.element.labels().attr("for",this.ids.button),this._on(this.labels,{click:function(t){this.button.trigger("focus"),t.preventDefault()}}),this.element.hide(),this.button=V("<span>",{tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true",title:this.element.attr("title")}).insertAfter(this.element),this._addClass(this.button,"ui-selectmenu-button ui-selectmenu-button-closed","ui-button ui-widget"),t=V("<span>").appendTo(this.button),this._addClass(t,"ui-selectmenu-icon","ui-icon "+this.options.icons.button),this.buttonItem=this._renderButtonItem(i).appendTo(this.button),!1!==this.options.width&&this._resizeButton(),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){e._rendered||e._refreshMenu()})},_drawMenu:function(){var i=this;this.menu=V("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=V("<div>").append(this.menu),this._addClass(this.menuWrap,"ui-selectmenu-menu","ui-front"),this.menuWrap.appendTo(this._appendTo()),this.menuInstance=this.menu.menu({classes:{"ui-menu":"ui-corner-bottom"},role:"listbox",select:function(t,e){t.preventDefault(),i._setSelection(),i._select(e.item.data("ui-selectmenu-item"),t)},focus:function(t,e){e=e.item.data("ui-selectmenu-item");null!=i.focusIndex&&e.index!==i.focusIndex&&(i._trigger("focus",t,{item:e}),i.isOpen||i._select(e,t)),i.focusIndex=e.index,i.button.attr("aria-activedescendant",i.menuItems.eq(e.index).attr("id"))}}).menu("instance"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu(),this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(this._getSelectedItem().data("ui-selectmenu-item")||{})),null===this.options.width&&this._resizeButton()},_refreshMenu:function(){var t=this.element.find("option");this.menu.empty(),this._parseOptions(t),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup").find(".ui-menu-item-wrapper"),this._rendered=!0,t.length&&(t=this._getSelectedItem(),this.menuInstance.focus(null,t),this._setAria(t.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},open:function(t){this.options.disabled||(this._rendered?(this._removeClass(this.menu.find(".ui-state-active"),null,"ui-state-active"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.menuItems.length&&(this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",t)))},_position:function(){this.menuWrap.position(V.extend({of:this.button},this.options.position))},close:function(t){this.isOpen&&(this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",t))},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderButtonItem:function(t){var e=V("<span>");return this._setText(e,t.label),this._addClass(e,"ui-selectmenu-text"),e},_renderMenu:function(s,t){var n=this,o="";V.each(t,function(t,e){var i;e.optgroup!==o&&(i=V("<li>",{text:e.optgroup}),n._addClass(i,"ui-selectmenu-optgroup","ui-menu-divider"+(e.element.parent("optgroup").prop("disabled")?" ui-state-disabled":"")),i.appendTo(s),o=e.optgroup),n._renderItemData(s,e)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-selectmenu-item",e)},_renderItem:function(t,e){var i=V("<li>"),s=V("<div>",{title:e.element.attr("title")});return e.disabled&&this._addClass(i,null,"ui-state-disabled"),this._setText(s,e.label),i.append(s).appendTo(t)},_setText:function(t,e){e?t.text(e):t.html("&#160;")},_move:function(t,e){var i,s=".ui-menu-item";this.isOpen?i=this.menuItems.eq(this.focusIndex).parent("li"):(i=this.menuItems.eq(this.element[0].selectedIndex).parent("li"),s+=":not(.ui-state-disabled)"),(s="first"===t||"last"===t?i["first"===t?"prevAll":"nextAll"](s).eq(-1):i[t+"All"](s).eq(0)).length&&this.menuInstance.focus(e,s)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex).parent("li")},_toggle:function(t){this[this.isOpen?"close":"open"](t)},_setSelection:function(){var t;this.range&&(window.getSelection?((t=window.getSelection()).removeAllRanges(),t.addRange(this.range)):this.range.select(),this.button.trigger("focus"))},_documentClick:{mousedown:function(t){this.isOpen&&(V(t.target).closest(".ui-selectmenu-menu, #"+V.escapeSelector(this.ids.button)).length||this.close(t))}},_buttonEvents:{mousedown:function(){var t;window.getSelection?(t=window.getSelection()).rangeCount&&(this.range=t.getRangeAt(0)):this.range=document.selection.createRange()},click:function(t){this._setSelection(),this._toggle(t)},keydown:function(t){var e=!0;switch(t.keyCode){case V.ui.keyCode.TAB:case V.ui.keyCode.ESCAPE:this.close(t),e=!1;break;case V.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(t);break;case V.ui.keyCode.UP:t.altKey?this._toggle(t):this._move("prev",t);break;case V.ui.keyCode.DOWN:t.altKey?this._toggle(t):this._move("next",t);break;case V.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(t):this._toggle(t);break;case V.ui.keyCode.LEFT:this._move("prev",t);break;case V.ui.keyCode.RIGHT:this._move("next",t);break;case V.ui.keyCode.HOME:case V.ui.keyCode.PAGE_UP:this._move("first",t);break;case V.ui.keyCode.END:case V.ui.keyCode.PAGE_DOWN:this._move("last",t);break;default:this.menu.trigger(t),e=!1}e&&t.preventDefault()}},_selectFocusedItem:function(t){var e=this.menuItems.eq(this.focusIndex).parent("li");e.hasClass("ui-state-disabled")||this._select(e.data("ui-selectmenu-item"),t)},_select:function(t,e){var i=this.element[0].selectedIndex;this.element[0].selectedIndex=t.index,this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(t)),this._setAria(t),this._trigger("select",e,{item:t}),t.index!==i&&this._trigger("change",e,{item:t}),this.close(e)},_setAria:function(t){t=this.menuItems.eq(t.index).attr("id");this.button.attr({"aria-labelledby":t,"aria-activedescendant":t}),this.menu.attr("aria-activedescendant",t)},_setOption:function(t,e){var i;"icons"===t&&(i=this.button.find("span.ui-icon"),this._removeClass(i,null,this.options.icons.button)._addClass(i,null,e.button)),this._super(t,e),"appendTo"===t&&this.menuWrap.appendTo(this._appendTo()),"width"===t&&this._resizeButton()},_setOptionDisabled:function(t){this._super(t),this.menuInstance.option("disabled",t),this.button.attr("aria-disabled",t),this._toggleClass(this.button,null,"ui-state-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)},_appendTo:function(){var t=this.options.appendTo;return t=!(t=!(t=t&&(t.jquery||t.nodeType?V(t):this.document.find(t).eq(0)))||!t[0]?this.element.closest(".ui-front, dialog"):t).length?this.document[0].body:t},_toggleAttr:function(){this.button.attr("aria-expanded",this.isOpen),this._removeClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"closed":"open"))._addClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"open":"closed"))._toggleClass(this.menuWrap,"ui-selectmenu-open",null,this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var t=this.options.width;!1!==t?(null===t&&(t=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(t)):this.button.css("width","")},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){var t=this._super();return t.disabled=this.element.prop("disabled"),t},_parseOptions:function(t){var i=this,s=[];t.each(function(t,e){e.hidden||s.push(i._parseOption(V(e),t))}),this.items=s},_parseOption:function(t,e){var i=t.parent("optgroup");return{element:t,index:e,value:t.val(),label:t.text(),optgroup:i.attr("label")||"",disabled:i.prop("disabled")||t.prop("disabled")}},_destroy:function(){this._unbindFormResetHandler(),this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.labels.attr("for",this.ids.element)}}]),V.widget("ui.slider",V.ui.mouse,{version:"1.13.2",widgetEventPrefix:"slide",options:{animate:!1,classes:{"ui-slider":"ui-corner-all","ui-slider-handle":"ui-corner-all","ui-slider-range":"ui-corner-all ui-widget-header"},distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this._addClass("ui-slider ui-slider-"+this.orientation,"ui-widget ui-widget-content"),this._refresh(),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var t,e=this.options,i=this.element.find(".ui-slider-handle"),s=[],n=e.values&&e.values.length||1;for(i.length>n&&(i.slice(n).remove(),i=i.slice(0,n)),t=i.length;t<n;t++)s.push("<span tabindex='0'></span>");this.handles=i.add(V(s.join("")).appendTo(this.element)),this._addClass(this.handles,"ui-slider-handle","ui-state-default"),this.handle=this.handles.eq(0),this.handles.each(function(t){V(this).data("ui-slider-handle-index",t).attr("tabIndex",0)})},_createRange:function(){var t=this.options;t.range?(!0===t.range&&(t.values?t.values.length&&2!==t.values.length?t.values=[t.values[0],t.values[0]]:Array.isArray(t.values)&&(t.values=t.values.slice(0)):t.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?(this._removeClass(this.range,"ui-slider-range-min ui-slider-range-max"),this.range.css({left:"",bottom:""})):(this.range=V("<div>").appendTo(this.element),this._addClass(this.range,"ui-slider-range")),"min"!==t.range&&"max"!==t.range||this._addClass(this.range,"ui-slider-range-"+t.range)):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this._mouseDestroy()},_mouseCapture:function(t){var i,s,n,o,e,a,r=this,l=this.options;return!l.disabled&&(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),a={x:t.pageX,y:t.pageY},i=this._normValueFromMouse(a),s=this._valueMax()-this._valueMin()+1,this.handles.each(function(t){var e=Math.abs(i-r.values(t));(e<s||s===e&&(t===r._lastChangedValue||r.values(t)===l.min))&&(s=e,n=V(this),o=t)}),!1!==this._start(t,o)&&(this._mouseSliding=!0,this._handleIndex=o,this._addClass(n,null,"ui-state-active"),n.trigger("focus"),e=n.offset(),a=!V(t.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=a?{left:0,top:0}:{left:t.pageX-e.left-n.width()/2,top:t.pageY-e.top-n.height()/2-(parseInt(n.css("borderTopWidth"),10)||0)-(parseInt(n.css("borderBottomWidth"),10)||0)+(parseInt(n.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,o,i),this._animateOff=!0))},_mouseStart:function(){return!0},_mouseDrag:function(t){var e={x:t.pageX,y:t.pageY},e=this._normValueFromMouse(e);return this._slide(t,this._handleIndex,e),!1},_mouseStop:function(t){return this._removeClass(this.handles,null,"ui-state-active"),this._mouseSliding=!1,this._stop(t,this._handleIndex),this._change(t,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(t){var e,t="horizontal"===this.orientation?(e=this.elementSize.width,t.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(e=this.elementSize.height,t.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),t=t/e;return(t=1<t?1:t)<0&&(t=0),"vertical"===this.orientation&&(t=1-t),e=this._valueMax()-this._valueMin(),e=this._valueMin()+t*e,this._trimAlignValue(e)},_uiHash:function(t,e,i){var s={handle:this.handles[t],handleIndex:t,value:void 0!==e?e:this.value()};return this._hasMultipleValues()&&(s.value=void 0!==e?e:this.values(t),s.values=i||this.values()),s},_hasMultipleValues:function(){return this.options.values&&this.options.values.length},_start:function(t,e){return this._trigger("start",t,this._uiHash(e))},_slide:function(t,e,i){var s,n=this.value(),o=this.values();this._hasMultipleValues()&&(s=this.values(e?0:1),n=this.values(e),2===this.options.values.length&&!0===this.options.range&&(i=0===e?Math.min(s,i):Math.max(s,i)),o[e]=i),i!==n&&!1!==this._trigger("slide",t,this._uiHash(e,i,o))&&(this._hasMultipleValues()?this.values(e,i):this.value(i))},_stop:function(t,e){this._trigger("stop",t,this._uiHash(e))},_change:function(t,e){this._keySliding||this._mouseSliding||(this._lastChangedValue=e,this._trigger("change",t,this._uiHash(e)))},value:function(t){return arguments.length?(this.options.value=this._trimAlignValue(t),this._refreshValue(),void this._change(null,0)):this._value()},values:function(t,e){var i,s,n;if(1<arguments.length)return this.options.values[t]=this._trimAlignValue(e),this._refreshValue(),void this._change(null,t);if(!arguments.length)return this._values();if(!Array.isArray(t))return this._hasMultipleValues()?this._values(t):this.value();for(i=this.options.values,s=t,n=0;n<i.length;n+=1)i[n]=this._trimAlignValue(s[n]),this._change(null,n);this._refreshValue()},_setOption:function(t,e){var i,s=0;switch("range"===t&&!0===this.options.range&&("min"===e?(this.options.value=this._values(0),this.options.values=null):"max"===e&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),Array.isArray(this.options.values)&&(s=this.options.values.length),this._super(t,e),t){case"orientation":this._detectOrientation(),this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-"+this.orientation),this._refreshValue(),this.options.range&&this._refreshRange(e),this.handles.css("horizontal"===e?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),i=s-1;0<=i;i--)this._change(null,i);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_setOptionDisabled:function(t){this._super(t),this._toggleClass(null,"ui-state-disabled",!!t)},_value:function(){var t=this.options.value;return t=this._trimAlignValue(t)},_values:function(t){var e,i;if(arguments.length)return t=this.options.values[t],t=this._trimAlignValue(t);if(this._hasMultipleValues()){for(e=this.options.values.slice(),i=0;i<e.length;i+=1)e[i]=this._trimAlignValue(e[i]);return e}return[]},_trimAlignValue:function(t){if(t<=this._valueMin())return this._valueMin();if(t>=this._valueMax())return this._valueMax();var e=0<this.options.step?this.options.step:1,i=(t-this._valueMin())%e,t=t-i;return 2*Math.abs(i)>=e&&(t+=0<i?e:-e),parseFloat(t.toFixed(5))},_calculateNewMax:function(){var t=this.options.max,e=this._valueMin(),i=this.options.step;(t=Math.round((t-e)/i)*i+e)>this.options.max&&(t-=i),this.max=parseFloat(t.toFixed(this._precision()))},_precision:function(){var t=this._precisionOf(this.options.step);return t=null!==this.options.min?Math.max(t,this._precisionOf(this.options.min)):t},_precisionOf:function(t){var e=t.toString(),t=e.indexOf(".");return-1===t?0:e.length-t-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshRange:function(t){"vertical"===t&&this.range.css({width:"",left:""}),"horizontal"===t&&this.range.css({height:"",bottom:""})},_refreshValue:function(){var e,i,t,s,n,o=this.options.range,a=this.options,r=this,l=!this._animateOff&&a.animate,h={};this._hasMultipleValues()?this.handles.each(function(t){i=(r.values(t)-r._valueMin())/(r._valueMax()-r._valueMin())*100,h["horizontal"===r.orientation?"left":"bottom"]=i+"%",V(this).stop(1,1)[l?"animate":"css"](h,a.animate),!0===r.options.range&&("horizontal"===r.orientation?(0===t&&r.range.stop(1,1)[l?"animate":"css"]({left:i+"%"},a.animate),1===t&&r.range[l?"animate":"css"]({width:i-e+"%"},{queue:!1,duration:a.animate})):(0===t&&r.range.stop(1,1)[l?"animate":"css"]({bottom:i+"%"},a.animate),1===t&&r.range[l?"animate":"css"]({height:i-e+"%"},{queue:!1,duration:a.animate}))),e=i}):(t=this.value(),s=this._valueMin(),n=this._valueMax(),i=n!==s?(t-s)/(n-s)*100:0,h["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](h,a.animate),"min"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},a.animate),"max"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:100-i+"%"},a.animate),"min"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},a.animate),"max"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:100-i+"%"},a.animate))},_handleEvents:{keydown:function(t){var e,i,s,n=V(t.target).data("ui-slider-handle-index");switch(t.keyCode){case V.ui.keyCode.HOME:case V.ui.keyCode.END:case V.ui.keyCode.PAGE_UP:case V.ui.keyCode.PAGE_DOWN:case V.ui.keyCode.UP:case V.ui.keyCode.RIGHT:case V.ui.keyCode.DOWN:case V.ui.keyCode.LEFT:if(t.preventDefault(),!this._keySliding&&(this._keySliding=!0,this._addClass(V(t.target),null,"ui-state-active"),!1===this._start(t,n)))return}switch(s=this.options.step,e=i=this._hasMultipleValues()?this.values(n):this.value(),t.keyCode){case V.ui.keyCode.HOME:i=this._valueMin();break;case V.ui.keyCode.END:i=this._valueMax();break;case V.ui.keyCode.PAGE_UP:i=this._trimAlignValue(e+(this._valueMax()-this._valueMin())/this.numPages);break;case V.ui.keyCode.PAGE_DOWN:i=this._trimAlignValue(e-(this._valueMax()-this._valueMin())/this.numPages);break;case V.ui.keyCode.UP:case V.ui.keyCode.RIGHT:if(e===this._valueMax())return;i=this._trimAlignValue(e+s);break;case V.ui.keyCode.DOWN:case V.ui.keyCode.LEFT:if(e===this._valueMin())return;i=this._trimAlignValue(e-s)}this._slide(t,n,i)},keyup:function(t){var e=V(t.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(t,e),this._change(t,e),this._removeClass(V(t.target),null,"ui-state-active"))}}}),V.widget("ui.sortable",V.ui.mouse,{version:"1.13.2",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(t,e,i){return e<=t&&t<e+i},_isFloating:function(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))},_create:function(){this.containerCache={},this._addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(t,e){this._super(t,e),"handle"===t&&this._setHandleClassName()},_setHandleClassName:function(){var t=this;this._removeClass(this.element.find(".ui-sortable-handle"),"ui-sortable-handle"),V.each(this.items,function(){t._addClass(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item,"ui-sortable-handle")})},_destroy:function(){this._mouseDestroy();for(var t=this.items.length-1;0<=t;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(t,e){var i=null,s=!1,n=this;return!this.reverting&&(!this.options.disabled&&"static"!==this.options.type&&(this._refreshItems(t),V(t.target).parents().each(function(){if(V.data(this,n.widgetName+"-item")===n)return i=V(this),!1}),!!(i=V.data(t.target,n.widgetName+"-item")===n?V(t.target):i)&&(!(this.options.handle&&!e&&(V(this.options.handle,i).find("*").addBack().each(function(){this===t.target&&(s=!0)}),!s))&&(this.currentItem=i,this._removeCurrentsFromItems(),!0))))},_mouseStart:function(t,e,i){var s,n,o=this.options;if((this.currentContainer=this).refreshPositions(),this.appendTo=V("parent"!==o.appendTo?o.appendTo:this.currentItem.parent()),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},V.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),this.scrollParent=this.placeholder.scrollParent(),V.extend(this.offset,{parent:this._getParentOffset()}),o.containment&&this._setContainment(),o.cursor&&"auto"!==o.cursor&&(n=this.document.find("body"),this.storedCursor=n.css("cursor"),n.css("cursor",o.cursor),this.storedStylesheet=V("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(n)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!i)for(s=this.containers.length-1;0<=s;s--)this.containers[s]._trigger("activate",t,this._uiHash(this));return V.ui.ddmanager&&(V.ui.ddmanager.current=this),V.ui.ddmanager&&!o.dropBehaviour&&V.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this._addClass(this.helper,"ui-sortable-helper"),this.helper.parent().is(this.appendTo)||(this.helper.detach().appendTo(this.appendTo),this.offset.parent=this._getParentOffset()),this.position=this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,this.lastPositionAbs=this.positionAbs=this._convertPositionTo("absolute"),this._mouseDrag(t),!0},_scroll:function(t){var e=this.options,i=!1;return this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<e.scrollSensitivity?this.scrollParent[0].scrollTop=i=this.scrollParent[0].scrollTop+e.scrollSpeed:t.pageY-this.overflowOffset.top<e.scrollSensitivity&&(this.scrollParent[0].scrollTop=i=this.scrollParent[0].scrollTop-e.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<e.scrollSensitivity?this.scrollParent[0].scrollLeft=i=this.scrollParent[0].scrollLeft+e.scrollSpeed:t.pageX-this.overflowOffset.left<e.scrollSensitivity&&(this.scrollParent[0].scrollLeft=i=this.scrollParent[0].scrollLeft-e.scrollSpeed)):(t.pageY-this.document.scrollTop()<e.scrollSensitivity?i=this.document.scrollTop(this.document.scrollTop()-e.scrollSpeed):this.window.height()-(t.pageY-this.document.scrollTop())<e.scrollSensitivity&&(i=this.document.scrollTop(this.document.scrollTop()+e.scrollSpeed)),t.pageX-this.document.scrollLeft()<e.scrollSensitivity?i=this.document.scrollLeft(this.document.scrollLeft()-e.scrollSpeed):this.window.width()-(t.pageX-this.document.scrollLeft())<e.scrollSensitivity&&(i=this.document.scrollLeft(this.document.scrollLeft()+e.scrollSpeed))),i},_mouseDrag:function(t){var e,i,s,n,o=this.options;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),o.scroll&&!1!==this._scroll(t)&&(this._refreshItemPositions(!0),V.ui.ddmanager&&!o.dropBehaviour&&V.ui.ddmanager.prepareOffsets(this,t)),this.dragDirection={vertical:this._getDragVerticalDirection(),horizontal:this._getDragHorizontalDirection()},e=this.items.length-1;0<=e;e--)if(s=(i=this.items[e]).item[0],(n=this._intersectsWithPointer(i))&&i.instance===this.currentContainer&&!(s===this.currentItem[0]||this.placeholder[1===n?"next":"prev"]()[0]===s||V.contains(this.placeholder[0],s)||"semi-dynamic"===this.options.type&&V.contains(this.element[0],s))){if(this.direction=1===n?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;this._rearrange(t,i),this._trigger("change",t,this._uiHash());break}return this._contactContainers(t),V.ui.ddmanager&&V.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,e){var i,s,n,o;if(t)return V.ui.ddmanager&&!this.options.dropBehaviour&&V.ui.ddmanager.drop(this,t),this.options.revert?(s=(i=this).placeholder.offset(),o={},(n=this.options.axis)&&"x"!==n||(o.left=s.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),n&&"y"!==n||(o.top=s.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,V(this.helper).animate(o,parseInt(this.options.revert,10)||500,function(){i._clear(t)})):this._clear(t,e),!1},cancel:function(){if(this.dragging){this._mouseUp(new V.Event("mouseup",{target:null})),"original"===this.options.helper?(this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")):this.currentItem.show();for(var t=this.containers.length-1;0<=t;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),V.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?V(this.domPosition.prev).after(this.currentItem):V(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var t=this._getItemsAsjQuery(e&&e.connected),i=[];return e=e||{},V(t).each(function(){var t=(V(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);t&&i.push((e.key||t[1]+"[]")+"="+(e.key&&e.expression?t[1]:t[2]))}),!i.length&&e.key&&i.push(e.key+"="),i.join("&")},toArray:function(t){var e=this._getItemsAsjQuery(t&&t.connected),i=[];return t=t||{},e.each(function(){i.push(V(t.item||this).attr(t.attribute||"id")||"")}),i},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,o=t.left,a=o+t.width,r=t.top,l=r+t.height,h=this.offset.click.top,c=this.offset.click.left,h="x"===this.options.axis||r<s+h&&s+h<l,c="y"===this.options.axis||o<e+c&&e+c<a;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?h&&c:o<e+this.helperProportions.width/2&&i-this.helperProportions.width/2<a&&r<s+this.helperProportions.height/2&&n-this.helperProportions.height/2<l},_intersectsWithPointer:function(t){var e="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),t="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width);return!(!e||!t)&&(e=this.dragDirection.vertical,t=this.dragDirection.horizontal,this.floating?"right"===t||"down"===e?2:1:e&&("down"===e?2:1))},_intersectsWithSides:function(t){var e=this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this.dragDirection.vertical,t=this.dragDirection.horizontal;return this.floating&&t?"right"===t&&i||"left"===t&&!i:s&&("down"===s&&e||"up"===s&&!e)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!=t&&(0<t?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!=t&&(0<t?"right":"left")},refresh:function(t){return this._refreshItems(t),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(t){var e,i,s,n,o=[],a=[],r=this._connectWith();if(r&&t)for(e=r.length-1;0<=e;e--)for(i=(s=V(r[e],this.document[0])).length-1;0<=i;i--)(n=V.data(s[i],this.widgetFullName))&&n!==this&&!n.options.disabled&&a.push(["function"==typeof n.options.items?n.options.items.call(n.element):V(n.options.items,n.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),n]);function l(){o.push(this)}for(a.push(["function"==typeof this.options.items?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):V(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),e=a.length-1;0<=e;e--)a[e][0].each(l);return V(o)},_removeCurrentsFromItems:function(){var i=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=V.grep(this.items,function(t){for(var e=0;e<i.length;e++)if(i[e]===t.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var e,i,s,n,o,a,r,l,h=this.items,c=[["function"==typeof this.options.items?this.options.items.call(this.element[0],t,{item:this.currentItem}):V(this.options.items,this.element),this]],u=this._connectWith();if(u&&this.ready)for(e=u.length-1;0<=e;e--)for(i=(s=V(u[e],this.document[0])).length-1;0<=i;i--)(n=V.data(s[i],this.widgetFullName))&&n!==this&&!n.options.disabled&&(c.push(["function"==typeof n.options.items?n.options.items.call(n.element[0],t,{item:this.currentItem}):V(n.options.items,n.element),n]),this.containers.push(n));for(e=c.length-1;0<=e;e--)for(o=c[e][1],l=(a=c[e][i=0]).length;i<l;i++)(r=V(a[i])).data(this.widgetName+"-item",o),h.push({item:r,instance:o,width:0,height:0,left:0,top:0})},_refreshItemPositions:function(t){for(var e,i,s=this.items.length-1;0<=s;s--)e=this.items[s],this.currentContainer&&e.instance!==this.currentContainer&&e.item[0]!==this.currentItem[0]||(i=this.options.toleranceElement?V(this.options.toleranceElement,e.item):e.item,t||(e.width=i.outerWidth(),e.height=i.outerHeight()),i=i.offset(),e.left=i.left,e.top=i.top)},refreshPositions:function(t){var e,i;if(this.floating=!!this.items.length&&("x"===this.options.axis||this._isFloating(this.items[0].item)),this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset()),this._refreshItemPositions(t),this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(e=this.containers.length-1;0<=e;e--)i=this.containers[e].element.offset(),this.containers[e].containerCache.left=i.left,this.containers[e].containerCache.top=i.top,this.containers[e].containerCache.width=this.containers[e].element.outerWidth(),this.containers[e].containerCache.height=this.containers[e].element.outerHeight();return this},_createPlaceholder:function(i){var s,n,o=(i=i||this).options;o.placeholder&&o.placeholder.constructor!==String||(s=o.placeholder,n=i.currentItem[0].nodeName.toLowerCase(),o.placeholder={element:function(){var t=V("<"+n+">",i.document[0]);return i._addClass(t,"ui-sortable-placeholder",s||i.currentItem[0].className)._removeClass(t,"ui-sortable-helper"),"tbody"===n?i._createTrPlaceholder(i.currentItem.find("tr").eq(0),V("<tr>",i.document[0]).appendTo(t)):"tr"===n?i._createTrPlaceholder(i.currentItem,t):"img"===n&&t.attr("src",i.currentItem.attr("src")),s||t.css("visibility","hidden"),t},update:function(t,e){s&&!o.forcePlaceholderSize||(e.height()&&(!o.forcePlaceholderSize||"tbody"!==n&&"tr"!==n)||e.height(i.currentItem.innerHeight()-parseInt(i.currentItem.css("paddingTop")||0,10)-parseInt(i.currentItem.css("paddingBottom")||0,10)),e.width()||e.width(i.currentItem.innerWidth()-parseInt(i.currentItem.css("paddingLeft")||0,10)-parseInt(i.currentItem.css("paddingRight")||0,10)))}}),i.placeholder=V(o.placeholder.element.call(i.element,i.currentItem)),i.currentItem.after(i.placeholder),o.placeholder.update(i,i.placeholder)},_createTrPlaceholder:function(t,e){var i=this;t.children().each(function(){V("<td>&#160;</td>",i.document[0]).attr("colspan",V(this).attr("colspan")||1).appendTo(e)})},_contactContainers:function(t){for(var e,i,s,n,o,a,r,l,h,c=null,u=null,d=this.containers.length-1;0<=d;d--)V.contains(this.currentItem[0],this.containers[d].element[0])||(this._intersectsWith(this.containers[d].containerCache)?c&&V.contains(this.containers[d].element[0],c.element[0])||(c=this.containers[d],u=d):this.containers[d].containerCache.over&&(this.containers[d]._trigger("out",t,this._uiHash(this)),this.containers[d].containerCache.over=0));if(c)if(1===this.containers.length)this.containers[u].containerCache.over||(this.containers[u]._trigger("over",t,this._uiHash(this)),this.containers[u].containerCache.over=1);else{for(i=1e4,s=null,n=(l=c.floating||this._isFloating(this.currentItem))?"left":"top",o=l?"width":"height",h=l?"pageX":"pageY",e=this.items.length-1;0<=e;e--)V.contains(this.containers[u].element[0],this.items[e].item[0])&&this.items[e].item[0]!==this.currentItem[0]&&(a=this.items[e].item.offset()[n],r=!1,t[h]-a>this.items[e][o]/2&&(r=!0),Math.abs(t[h]-a)<i&&(i=Math.abs(t[h]-a),s=this.items[e],this.direction=r?"up":"down"));(s||this.options.dropOnEmpty)&&(this.currentContainer!==this.containers[u]?(s?this._rearrange(t,s,null,!0):this._rearrange(t,null,this.containers[u].element,!0),this._trigger("change",t,this._uiHash()),this.containers[u]._trigger("change",t,this._uiHash(this)),this.currentContainer=this.containers[u],this.options.placeholder.update(this.currentContainer,this.placeholder),this.scrollParent=this.placeholder.scrollParent(),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this.containers[u]._trigger("over",t,this._uiHash(this)),this.containers[u].containerCache.over=1):this.currentContainer.containerCache.over||(this.containers[u]._trigger("over",t,this._uiHash()),this.currentContainer.containerCache.over=1))}},_createHelper:function(t){var e=this.options,t="function"==typeof e.helper?V(e.helper.apply(this.element[0],[t,this.currentItem])):"clone"===e.helper?this.currentItem.clone():this.currentItem;return t.parents("body").length||this.appendTo[0].appendChild(t[0]),t[0]===this.currentItem[0]&&(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")}),t[0].style.width&&!e.forceHelperSize||t.width(this.currentItem.width()),t[0].style.height&&!e.forceHelperSize||t.height(this.currentItem.height()),t},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),"left"in(t=Array.isArray(t)?{left:+t[0],top:+t[1]||0}:t)&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&V.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),{top:(t=this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&V.ui.ie?{top:0,left:0}:t).top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,e,i=this.options;"parent"===i.containment&&(i.containment=this.helper[0].parentNode),"document"!==i.containment&&"window"!==i.containment||(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===i.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===i.containment?this.document.height()||document.body.parentNode.scrollHeight:this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(i.containment)||(t=V(i.containment)[0],e=V(i.containment).offset(),i="hidden"!==V(t).css("overflow"),this.containment=[e.left+(parseInt(V(t).css("borderLeftWidth"),10)||0)+(parseInt(V(t).css("paddingLeft"),10)||0)-this.margins.left,e.top+(parseInt(V(t).css("borderTopWidth"),10)||0)+(parseInt(V(t).css("paddingTop"),10)||0)-this.margins.top,e.left+(i?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(V(t).css("borderLeftWidth"),10)||0)-(parseInt(V(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,e.top+(i?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(V(t).css("borderTopWidth"),10)||0)-(parseInt(V(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,e){e=e||this.position;var i="absolute"===t?1:-1,s="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&V.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,t=/(html|body)/i.test(s[0].tagName);return{top:e.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():t?0:s.scrollTop())*i,left:e.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():t?0:s.scrollLeft())*i}},_generatePosition:function(t){var e=this.options,i=t.pageX,s=t.pageY,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&V.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(n[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.left<this.containment[0]&&(i=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(s=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(i=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(s=this.containment[3]+this.offset.click.top)),e.grid&&(t=this.originalPageY+Math.round((s-this.originalPageY)/e.grid[1])*e.grid[1],s=!this.containment||t-this.offset.click.top>=this.containment[1]&&t-this.offset.click.top<=this.containment[3]?t:t-this.offset.click.top>=this.containment[1]?t-e.grid[1]:t+e.grid[1],t=this.originalPageX+Math.round((i-this.originalPageX)/e.grid[0])*e.grid[0],i=!this.containment||t-this.offset.click.left>=this.containment[0]&&t-this.offset.click.left<=this.containment[2]?t:t-this.offset.click.left>=this.containment[0]?t-e.grid[0]:t+e.grid[0])),{top:s-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:n.scrollTop()),left:i-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:n.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){this.reverting=!1;var i,s=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(i in this._storedCSS)"auto"!==this._storedCSS[i]&&"static"!==this._storedCSS[i]||(this._storedCSS[i]="");this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")}else this.currentItem.show();function n(e,i,s){return function(t){s._trigger(e,t,i._uiHash(i))}}for(this.fromOutside&&!e&&s.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||s.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(s.push(function(t){this._trigger("remove",t,this._uiHash())}),s.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),s.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),i=this.containers.length-1;0<=i;i--)e||s.push(n("deactivate",this,this.containers[i])),this.containers[i].containerCache.over&&(s.push(n("out",this,this.containers[i])),this.containers[i].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!e){for(i=0;i<s.length;i++)s[i].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){!1===V.Widget.prototype._trigger.apply(this,arguments)&&this.cancel()},_uiHash:function(t){var e=t||this;return{helper:e.helper,placeholder:e.placeholder||V([]),position:e.position,originalPosition:e.originalPosition,offset:e.positionAbs,item:e.currentItem,sender:t?t.element:null}}});function ht(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}V.widget("ui.spinner",{version:"1.13.2",defaultElement:"<input>",widgetEventPrefix:"spin",options:{classes:{"ui-spinner":"ui-corner-all","ui-spinner-down":"ui-corner-br","ui-spinner-up":"ui-corner-tr"},culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var s=this._super(),n=this.element;return V.each(["min","max","step"],function(t,e){var i=n.attr(e);null!=i&&i.length&&(s[e]=i)}),s},_events:{keydown:function(t){this._start(t)&&this._keydown(t)&&t.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(t){this.cancelBlur?delete this.cancelBlur:(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",t))},mousewheel:function(t,e){var i=V.ui.safeActiveElement(this.document[0]);if(this.element[0]===i&&e){if(!this.spinning&&!this._start(t))return!1;this._spin((0<e?1:-1)*this.options.step,t),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(t)},100),t.preventDefault()}},"mousedown .ui-spinner-button":function(t){var e;function i(){this.element[0]===V.ui.safeActiveElement(this.document[0])||(this.element.trigger("focus"),this.previous=e,this._delay(function(){this.previous=e}))}e=this.element[0]===V.ui.safeActiveElement(this.document[0])?this.previous:this.element.val(),t.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),!1!==this._start(t)&&this._repeat(null,V(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){if(V(t.currentTarget).hasClass("ui-state-active"))return!1!==this._start(t)&&void this._repeat(null,V(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseleave .ui-spinner-button":"_stop"},_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap("<span>").parent().append("<a></a><a></a>")},_draw:function(){this._enhance(),this._addClass(this.uiSpinner,"ui-spinner","ui-widget ui-widget-content"),this._addClass("ui-spinner-input"),this.element.attr("role","spinbutton"),this.buttons=this.uiSpinner.children("a").attr("tabIndex",-1).attr("aria-hidden",!0).button({classes:{"ui-button":""}}),this._removeClass(this.buttons,"ui-corner-all"),this._addClass(this.buttons.first(),"ui-spinner-button ui-spinner-up"),this._addClass(this.buttons.last(),"ui-spinner-button ui-spinner-down"),this.buttons.first().button({icon:this.options.icons.up,showLabel:!1}),this.buttons.last().button({icon:this.options.icons.down,showLabel:!1}),this.buttons.height()>Math.ceil(.5*this.uiSpinner.height())&&0<this.uiSpinner.height()&&this.uiSpinner.height(this.uiSpinner.height())},_keydown:function(t){var e=this.options,i=V.ui.keyCode;switch(t.keyCode){case i.UP:return this._repeat(null,1,t),!0;case i.DOWN:return this._repeat(null,-1,t),!0;case i.PAGE_UP:return this._repeat(null,e.page,t),!0;case i.PAGE_DOWN:return this._repeat(null,-e.page,t),!0}return!1},_start:function(t){return!(!this.spinning&&!1===this._trigger("start",t))&&(this.counter||(this.counter=1),this.spinning=!0)},_repeat:function(t,e,i){t=t||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,e,i)},t),this._spin(e*this.options.step,i)},_spin:function(t,e){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+t*this._increment(this.counter)),this.spinning&&!1===this._trigger("spin",e,{value:i})||(this._value(i),this.counter++)},_increment:function(t){var e=this.options.incremental;return e?"function"==typeof e?e(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var t=this._precisionOf(this.options.step);return t=null!==this.options.min?Math.max(t,this._precisionOf(this.options.min)):t},_precisionOf:function(t){var e=t.toString(),t=e.indexOf(".");return-1===t?0:e.length-t-1},_adjustValue:function(t){var e=this.options,i=null!==e.min?e.min:0,s=t-i;return t=i+Math.round(s/e.step)*e.step,t=parseFloat(t.toFixed(this._precision())),null!==e.max&&t>e.max?e.max:null!==e.min&&t<e.min?e.min:t},_stop:function(t){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",t))},_setOption:function(t,e){var i;if("culture"===t||"numberFormat"===t)return i=this._parse(this.element.val()),this.options[t]=e,void this.element.val(this._format(i));"max"!==t&&"min"!==t&&"step"!==t||"string"==typeof e&&(e=this._parse(e)),"icons"===t&&(i=this.buttons.first().find(".ui-icon"),this._removeClass(i,null,this.options.icons.up),this._addClass(i,null,e.up),i=this.buttons.last().find(".ui-icon"),this._removeClass(i,null,this.options.icons.down),this._addClass(i,null,e.down)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this._toggleClass(this.uiSpinner,null,"ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable")},_setOptions:ht(function(t){this._super(t)}),_parse:function(t){return""===(t="string"==typeof t&&""!==t?window.Globalize&&this.options.numberFormat?Globalize.parseFloat(t,10,this.options.culture):+t:t)||isNaN(t)?null:t},_format:function(t){return""===t?"":window.Globalize&&this.options.numberFormat?Globalize.format(t,this.options.numberFormat,this.options.culture):t},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var t=this.value();return null!==t&&t===this._adjustValue(t)},_value:function(t,e){var i;""!==t&&null!==(i=this._parse(t))&&(e||(i=this._adjustValue(i)),t=this._format(i)),this.element.val(t),this._refresh()},_destroy:function(){this.element.prop("disabled",!1).removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:ht(function(t){this._stepUp(t)}),_stepUp:function(t){this._start()&&(this._spin((t||1)*this.options.step),this._stop())},stepDown:ht(function(t){this._stepDown(t)}),_stepDown:function(t){this._start()&&(this._spin((t||1)*-this.options.step),this._stop())},pageUp:ht(function(t){this._stepUp((t||1)*this.options.page)}),pageDown:ht(function(t){this._stepDown((t||1)*this.options.page)}),value:function(t){if(!arguments.length)return this._parse(this.element.val());ht(this._value).call(this,t)},widget:function(){return this.uiSpinner}}),!1!==V.uiBackCompat&&V.widget("ui.spinner",V.ui.spinner,{_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml())},_uiSpinnerHtml:function(){return"<span>"},_buttonHtml:function(){return"<a></a><a></a>"}});var ct;V.ui.spinner;V.widget("ui.tabs",{version:"1.13.2",delay:300,options:{active:null,classes:{"ui-tabs":"ui-corner-all","ui-tabs-nav":"ui-corner-all","ui-tabs-panel":"ui-corner-bottom","ui-tabs-tab":"ui-corner-top"},collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:(ct=/#.*$/,function(t){var e=t.href.replace(ct,""),i=location.href.replace(ct,"");try{e=decodeURIComponent(e)}catch(t){}try{i=decodeURIComponent(i)}catch(t){}return 1<t.hash.length&&e===i}),_create:function(){var e=this,t=this.options;this.running=!1,this._addClass("ui-tabs","ui-widget ui-widget-content"),this._toggleClass("ui-tabs-collapsible",null,t.collapsible),this._processTabs(),t.active=this._initialActive(),Array.isArray(t.disabled)&&(t.disabled=V.uniqueSort(t.disabled.concat(V.map(this.tabs.filter(".ui-state-disabled"),function(t){return e.tabs.index(t)}))).sort()),!1!==this.options.active&&this.anchors.length?this.active=this._findActive(t.active):this.active=V(),this._refresh(),this.active.length&&this.load(t.active)},_initialActive:function(){var i=this.options.active,t=this.options.collapsible,s=location.hash.substring(1);return null===i&&(s&&this.tabs.each(function(t,e){if(V(e).attr("aria-controls")===s)return i=t,!1}),null!==(i=null===i?this.tabs.index(this.tabs.filter(".ui-tabs-active")):i)&&-1!==i||(i=!!this.tabs.length&&0)),!1!==i&&-1===(i=this.tabs.index(this.tabs.eq(i)))&&(i=!t&&0),i=!t&&!1===i&&this.anchors.length?0:i},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):V()}},_tabKeydown:function(t){var e=V(V.ui.safeActiveElement(this.document[0])).closest("li"),i=this.tabs.index(e),s=!0;if(!this._handlePageNav(t)){switch(t.keyCode){case V.ui.keyCode.RIGHT:case V.ui.keyCode.DOWN:i++;break;case V.ui.keyCode.UP:case V.ui.keyCode.LEFT:s=!1,i--;break;case V.ui.keyCode.END:i=this.anchors.length-1;break;case V.ui.keyCode.HOME:i=0;break;case V.ui.keyCode.SPACE:return t.preventDefault(),clearTimeout(this.activating),void this._activate(i);case V.ui.keyCode.ENTER:return t.preventDefault(),clearTimeout(this.activating),void this._activate(i!==this.options.active&&i);default:return}t.preventDefault(),clearTimeout(this.activating),i=this._focusNextTab(i,s),t.ctrlKey||t.metaKey||(e.attr("aria-selected","false"),this.tabs.eq(i).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",i)},this.delay))}},_panelKeydown:function(t){this._handlePageNav(t)||t.ctrlKey&&t.keyCode===V.ui.keyCode.UP&&(t.preventDefault(),this.active.trigger("focus"))},_handlePageNav:function(t){return t.altKey&&t.keyCode===V.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):t.altKey&&t.keyCode===V.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(t,e){var i=this.tabs.length-1;for(;-1!==V.inArray(t=(t=i<t?0:t)<0?i:t,this.options.disabled);)t=e?t+1:t-1;return t},_focusNextTab:function(t,e){return t=this._findNextTab(t,e),this.tabs.eq(t).trigger("focus"),t},_setOption:function(t,e){"active"!==t?(this._super(t,e),"collapsible"===t&&(this._toggleClass("ui-tabs-collapsible",null,e),e||!1!==this.options.active||this._activate(0)),"event"===t&&this._setupEvents(e),"heightStyle"===t&&this._setupHeightStyle(e)):this._activate(e)},_sanitizeSelector:function(t){return t?t.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,e=this.tablist.children(":has(a[href])");t.disabled=V.map(e.filter(".ui-state-disabled"),function(t){return e.index(t)}),this._processTabs(),!1!==t.active&&this.anchors.length?this.active.length&&!V.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=V()):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active):(t.active=!1,this.active=V()),this._refresh()},_refresh:function(){this._setOptionDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._addClass(this.active,"ui-tabs-active","ui-state-active"),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var l=this,t=this.tabs,e=this.anchors,i=this.panels;this.tablist=this._getList().attr("role","tablist"),this._addClass(this.tablist,"ui-tabs-nav","ui-helper-reset ui-helper-clearfix ui-widget-header"),this.tablist.on("mousedown"+this.eventNamespace,"> li",function(t){V(this).is(".ui-state-disabled")&&t.preventDefault()}).on("focus"+this.eventNamespace,".ui-tabs-anchor",function(){V(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").attr({role:"tab",tabIndex:-1}),this._addClass(this.tabs,"ui-tabs-tab","ui-state-default"),this.anchors=this.tabs.map(function(){return V("a",this)[0]}).attr({tabIndex:-1}),this._addClass(this.anchors,"ui-tabs-anchor"),this.panels=V(),this.anchors.each(function(t,e){var i,s,n,o=V(e).uniqueId().attr("id"),a=V(e).closest("li"),r=a.attr("aria-controls");l._isLocal(e)?(n=(i=e.hash).substring(1),s=l.element.find(l._sanitizeSelector(i))):(n=a.attr("aria-controls")||V({}).uniqueId()[0].id,(s=l.element.find(i="#"+n)).length||(s=l._createPanel(n)).insertAfter(l.panels[t-1]||l.tablist),s.attr("aria-live","polite")),s.length&&(l.panels=l.panels.add(s)),r&&a.data("ui-tabs-aria-controls",r),a.attr({"aria-controls":n,"aria-labelledby":o}),s.attr("aria-labelledby",o)}),this.panels.attr("role","tabpanel"),this._addClass(this.panels,"ui-tabs-panel","ui-widget-content"),t&&(this._off(t.not(this.tabs)),this._off(e.not(this.anchors)),this._off(i.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol, ul").eq(0)},_createPanel:function(t){return V("<div>").attr("id",t).data("ui-tabs-destroy",!0)},_setOptionDisabled:function(t){var e,i;for(Array.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1),i=0;e=this.tabs[i];i++)e=V(e),!0===t||-1!==V.inArray(i,t)?(e.attr("aria-disabled","true"),this._addClass(e,null,"ui-state-disabled")):(e.removeAttr("aria-disabled"),this._removeClass(e,null,"ui-state-disabled"));this.options.disabled=t,this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!0===t)},_setupEvents:function(t){var i={};t&&V.each(t.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(t){t.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var i,e=this.element.parent();"fill"===t?(i=e.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var t=V(this),e=t.css("position");"absolute"!==e&&"fixed"!==e&&(i-=t.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=V(this).outerHeight(!0)}),this.panels.each(function(){V(this).height(Math.max(0,i-V(this).innerHeight()+V(this).height()))}).css("overflow","auto")):"auto"===t&&(i=0,this.panels.each(function(){i=Math.max(i,V(this).height("").height())}).height(i))},_eventHandler:function(t){var e=this.options,i=this.active,s=V(t.currentTarget).closest("li"),n=s[0]===i[0],o=n&&e.collapsible,a=o?V():this._getPanelForTab(s),r=i.length?this._getPanelForTab(i):V(),i={oldTab:i,oldPanel:r,newTab:o?V():s,newPanel:a};t.preventDefault(),s.hasClass("ui-state-disabled")||s.hasClass("ui-tabs-loading")||this.running||n&&!e.collapsible||!1===this._trigger("beforeActivate",t,i)||(e.active=!o&&this.tabs.index(s),this.active=n?V():s,this.xhr&&this.xhr.abort(),r.length||a.length||V.error("jQuery UI Tabs: Mismatching fragment identifier."),a.length&&this.load(this.tabs.index(s),t),this._toggle(t,i))},_toggle:function(t,e){var i=this,s=e.newPanel,n=e.oldPanel;function o(){i.running=!1,i._trigger("activate",t,e)}function a(){i._addClass(e.newTab.closest("li"),"ui-tabs-active","ui-state-active"),s.length&&i.options.show?i._show(s,i.options.show,o):(s.show(),o())}this.running=!0,n.length&&this.options.hide?this._hide(n,this.options.hide,function(){i._removeClass(e.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),a()}):(this._removeClass(e.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),n.hide(),a()),n.attr("aria-hidden","true"),e.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),s.length&&n.length?e.oldTab.attr("tabIndex",-1):s.length&&this.tabs.filter(function(){return 0===V(this).attr("tabIndex")}).attr("tabIndex",-1),s.attr("aria-hidden","false"),e.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(t){var t=this._findActive(t);t[0]!==this.active[0]&&(t=(t=!t.length?this.active:t).find(".ui-tabs-anchor")[0],this._eventHandler({target:t,currentTarget:t,preventDefault:V.noop}))},_findActive:function(t){return!1===t?V():this.tabs.eq(t)},_getIndex:function(t){return t="string"==typeof t?this.anchors.index(this.anchors.filter("[href$='"+V.escapeSelector(t)+"']")):t},_destroy:function(){this.xhr&&this.xhr.abort(),this.tablist.removeAttr("role").off(this.eventNamespace),this.anchors.removeAttr("role tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){V.data(this,"ui-tabs-destroy")?V(this).remove():V(this).removeAttr("role tabIndex aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded")}),this.tabs.each(function(){var t=V(this),e=t.data("ui-tabs-aria-controls");e?t.attr("aria-controls",e).removeData("ui-tabs-aria-controls"):t.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(i){var t=this.options.disabled;!1!==t&&(t=void 0!==i&&(i=this._getIndex(i),Array.isArray(t)?V.map(t,function(t){return t!==i?t:null}):V.map(this.tabs,function(t,e){return e!==i?e:null})),this._setOptionDisabled(t))},disable:function(t){var e=this.options.disabled;if(!0!==e){if(void 0===t)e=!0;else{if(t=this._getIndex(t),-1!==V.inArray(t,e))return;e=Array.isArray(e)?V.merge([t],e).sort():[t]}this._setOptionDisabled(e)}},load:function(t,s){t=this._getIndex(t);function n(t,e){"abort"===e&&o.panels.stop(!1,!0),o._removeClass(i,"ui-tabs-loading"),a.removeAttr("aria-busy"),t===o.xhr&&delete o.xhr}var o=this,i=this.tabs.eq(t),t=i.find(".ui-tabs-anchor"),a=this._getPanelForTab(i),r={tab:i,panel:a};this._isLocal(t[0])||(this.xhr=V.ajax(this._ajaxSettings(t,s,r)),this.xhr&&"canceled"!==this.xhr.statusText&&(this._addClass(i,"ui-tabs-loading"),a.attr("aria-busy","true"),this.xhr.done(function(t,e,i){setTimeout(function(){a.html(t),o._trigger("load",s,r),n(i,e)},1)}).fail(function(t,e){setTimeout(function(){n(t,e)},1)})))},_ajaxSettings:function(t,i,s){var n=this;return{url:t.attr("href").replace(/#.*$/,""),beforeSend:function(t,e){return n._trigger("beforeLoad",i,V.extend({jqXHR:t,ajaxSettings:e},s))}}},_getPanelForTab:function(t){t=V(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+t))}}),!1!==V.uiBackCompat&&V.widget("ui.tabs",V.ui.tabs,{_processTabs:function(){this._superApply(arguments),this._addClass(this.tabs,"ui-tab")}});V.ui.tabs;V.widget("ui.tooltip",{version:"1.13.2",options:{classes:{"ui-tooltip":"ui-corner-all ui-widget-shadow"},content:function(){var t=V(this).attr("title");return V("<a>").text(t).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,track:!1,close:null,open:null},_addDescribedBy:function(t,e){var i=(t.attr("aria-describedby")||"").split(/\s+/);i.push(e),t.data("ui-tooltip-id",e).attr("aria-describedby",String.prototype.trim.call(i.join(" ")))},_removeDescribedBy:function(t){var e=t.data("ui-tooltip-id"),i=(t.attr("aria-describedby")||"").split(/\s+/),e=V.inArray(e,i);-1!==e&&i.splice(e,1),t.removeData("ui-tooltip-id"),(i=String.prototype.trim.call(i.join(" ")))?t.attr("aria-describedby",i):t.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.liveRegion=V("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this.disabledTitles=V([])},_setOption:function(t,e){var i=this;this._super(t,e),"content"===t&&V.each(this.tooltips,function(t,e){i._updateContent(e.element)})},_setOptionDisabled:function(t){this[t?"_disable":"_enable"]()},_disable:function(){var s=this;V.each(this.tooltips,function(t,e){var i=V.Event("blur");i.target=i.currentTarget=e.element[0],s.close(i,!0)}),this.disabledTitles=this.disabledTitles.add(this.element.find(this.options.items).addBack().filter(function(){var t=V(this);if(t.is("[title]"))return t.data("ui-tooltip-title",t.attr("title")).removeAttr("title")}))},_enable:function(){this.disabledTitles.each(function(){var t=V(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))}),this.disabledTitles=V([])},open:function(t){var i=this,e=V(t?t.target:this.element).closest(this.options.items);e.length&&!e.data("ui-tooltip-id")&&(e.attr("title")&&e.data("ui-tooltip-title",e.attr("title")),e.data("ui-tooltip-open",!0),t&&"mouseover"===t.type&&e.parents().each(function(){var t,e=V(this);e.data("ui-tooltip-open")&&((t=V.Event("blur")).target=t.currentTarget=this,i.close(t,!0)),e.attr("title")&&(e.uniqueId(),i.parents[this.id]={element:this,title:e.attr("title")},e.attr("title",""))}),this._registerCloseHandlers(t,e),this._updateContent(e,t))},_updateContent:function(e,i){var t=this.options.content,s=this,n=i?i.type:null;if("string"==typeof t||t.nodeType||t.jquery)return this._open(i,e,t);(t=t.call(e[0],function(t){s._delay(function(){e.data("ui-tooltip-open")&&(i&&(i.type=n),this._open(i,e,t))})}))&&this._open(i,e,t)},_open:function(t,e,i){var s,n,o,a=V.extend({},this.options.position);function r(t){a.of=t,n.is(":hidden")||n.position(a)}i&&((s=this._find(e))?s.tooltip.find(".ui-tooltip-content").html(i):(e.is("[title]")&&(t&&"mouseover"===t.type?e.attr("title",""):e.removeAttr("title")),s=this._tooltip(e),n=s.tooltip,this._addDescribedBy(e,n.attr("id")),n.find(".ui-tooltip-content").html(i),this.liveRegion.children().hide(),(i=V("<div>").html(n.find(".ui-tooltip-content").html())).removeAttr("name").find("[name]").removeAttr("name"),i.removeAttr("id").find("[id]").removeAttr("id"),i.appendTo(this.liveRegion),this.options.track&&t&&/^mouse/.test(t.type)?(this._on(this.document,{mousemove:r}),r(t)):n.position(V.extend({of:e},this.options.position)),n.hide(),this._show(n,this.options.show),this.options.track&&this.options.show&&this.options.show.delay&&(o=this.delayedShow=setInterval(function(){n.is(":visible")&&(r(a.of),clearInterval(o))},13)),this._trigger("open",t,{tooltip:n})))},_registerCloseHandlers:function(t,e){var i={keyup:function(t){t.keyCode===V.ui.keyCode.ESCAPE&&((t=V.Event(t)).currentTarget=e[0],this.close(t,!0))}};e[0]!==this.element[0]&&(i.remove=function(){var t=this._find(e);t&&this._removeTooltip(t.tooltip)}),t&&"mouseover"!==t.type||(i.mouseleave="close"),t&&"focusin"!==t.type||(i.focusout="close"),this._on(!0,e,i)},close:function(t){var e,i=this,s=V(t?t.currentTarget:this.element),n=this._find(s);n?(e=n.tooltip,n.closing||(clearInterval(this.delayedShow),s.data("ui-tooltip-title")&&!s.attr("title")&&s.attr("title",s.data("ui-tooltip-title")),this._removeDescribedBy(s),n.hiding=!0,e.stop(!0),this._hide(e,this.options.hide,function(){i._removeTooltip(V(this))}),s.removeData("ui-tooltip-open"),this._off(s,"mouseleave focusout keyup"),s[0]!==this.element[0]&&this._off(s,"remove"),this._off(this.document,"mousemove"),t&&"mouseleave"===t.type&&V.each(this.parents,function(t,e){V(e.element).attr("title",e.title),delete i.parents[t]}),n.closing=!0,this._trigger("close",t,{tooltip:e}),n.hiding||(n.closing=!1))):s.removeData("ui-tooltip-open")},_tooltip:function(t){var e=V("<div>").attr("role","tooltip"),i=V("<div>").appendTo(e),s=e.uniqueId().attr("id");return this._addClass(i,"ui-tooltip-content"),this._addClass(e,"ui-tooltip","ui-widget ui-widget-content"),e.appendTo(this._appendTo(t)),this.tooltips[s]={element:t,tooltip:e}},_find:function(t){t=t.data("ui-tooltip-id");return t?this.tooltips[t]:null},_removeTooltip:function(t){clearInterval(this.delayedShow),t.remove(),delete this.tooltips[t.attr("id")]},_appendTo:function(t){t=t.closest(".ui-front, dialog");return t=!t.length?this.document[0].body:t},_destroy:function(){var s=this;V.each(this.tooltips,function(t,e){var i=V.Event("blur"),e=e.element;i.target=i.currentTarget=e[0],s.close(i,!0),V("#"+t).remove(),e.data("ui-tooltip-title")&&(e.attr("title")||e.attr("title",e.data("ui-tooltip-title")),e.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}}),!1!==V.uiBackCompat&&V.widget("ui.tooltip",V.ui.tooltip,{options:{tooltipClass:null},_tooltip:function(){var t=this._superApply(arguments);return this.options.tooltipClass&&t.tooltip.addClass(this.options.tooltipClass),t}});V.ui.tooltip});
  64374. // Copyright (c) Jupyter Development Team.
  64375. // Distributed under the terms of the Modified BSD License.
  64376. define('notebook/js/pager',[
  64377. 'jquery',
  64378. 'base/js/utils',
  64379. 'base/js/i18n',
  64380. 'jquery-ui'
  64381. ], function($, utils, i18n) {
  64382. "use strict";
  64383. var Pager = function (pager_selector, options) {
  64384. /**
  64385. * Constructor
  64386. *
  64387. * Parameters:
  64388. * pager_selector: string
  64389. * options: dictionary
  64390. * Dictionary of keyword arguments.
  64391. * events: $(Events) instance
  64392. */
  64393. this.events = options.events;
  64394. this.pager_element = $(pager_selector);
  64395. this.pager_button_area = $('#pager-button-area');
  64396. this._default_end_space = 100;
  64397. this.pager_element.resizable({handles: 'n', resize: $.proxy(this._resize, this)});
  64398. this.expanded = false;
  64399. this.create_button_area();
  64400. this.bind_events();
  64401. };
  64402. Pager.prototype.create_button_area = function(){
  64403. var that = this;
  64404. this.pager_button_area.append(
  64405. $('<a>').attr('role', "button")
  64406. .attr('title',i18n.msg._("Open the pager in an external window"))
  64407. .addClass('ui-button')
  64408. .click(function(){that.detach();})
  64409. .append(
  64410. $('<span>').addClass("ui-icon ui-icon-extlink")
  64411. )
  64412. );
  64413. this.pager_button_area.append(
  64414. $('<a>').attr('role', "button")
  64415. .attr('title',i18n.msg._("Close the pager"))
  64416. .addClass('ui-button')
  64417. .click(function(){that.collapse();})
  64418. .append(
  64419. $('<span>').addClass("ui-icon ui-icon-close")
  64420. )
  64421. );
  64422. };
  64423. Pager.prototype.bind_events = function () {
  64424. var that = this;
  64425. this.pager_element.bind('collapse_pager', function (event, extrap) {
  64426. // Animate hiding of the pager.
  64427. var time = (extrap && extrap.duration) ? extrap.duration : 'fast';
  64428. that.pager_element.animate({
  64429. height: 'toggle'
  64430. }, {
  64431. duration: time,
  64432. done: function() {
  64433. $('.end_space').css('height', that._default_end_space);
  64434. }
  64435. });
  64436. });
  64437. this.pager_element.bind('expand_pager', function (event, extrap) {
  64438. // Clear the pager's height attr if it's set. This allows the
  64439. // pager to size itself according to its contents.
  64440. that.pager_element.height('initial');
  64441. // Animate the showing of the pager
  64442. var time = (extrap && extrap.duration) ? extrap.duration : 'fast';
  64443. that.pager_element.show(time, function() {
  64444. // Explicitly set pager height once the pager has shown itself.
  64445. // This allows the pager-contents div to use percentage sizing.
  64446. that.pager_element.height(that.pager_element.height());
  64447. that._resize();
  64448. // HACK: Less horrible, but still horrible hack to force the
  64449. // pager to show it's scrollbars on FireFox. ipython/ipython/#8853
  64450. that.pager_element.css('position', 'relative');
  64451. window.requestAnimationFrame(function() { /* Wait one frame */
  64452. that.pager_element.css('position', '');
  64453. });
  64454. });
  64455. });
  64456. this.events.on('open_with_text.Pager', function (event, payload) {
  64457. // FIXME: support other mime types with generic mimebundle display
  64458. // mechanism
  64459. if (payload.data['text/html'] && payload.data['text/html'] !== "") {
  64460. that.clear();
  64461. that.expand();
  64462. that.append(payload.data['text/html']);
  64463. } else if (payload.data['text/plain'] && payload.data['text/plain'] !== "") {
  64464. that.clear();
  64465. that.expand();
  64466. that.append_text(payload.data['text/plain']);
  64467. }
  64468. });
  64469. };
  64470. Pager.prototype.collapse = function (extrap) {
  64471. if (this.expanded === true) {
  64472. this.expanded = false;
  64473. this.pager_element.trigger('collapse_pager', extrap);
  64474. }
  64475. };
  64476. Pager.prototype.expand = function (extrap) {
  64477. if (this.expanded !== true) {
  64478. this.expanded = true;
  64479. this.pager_element.trigger('expand_pager', extrap);
  64480. }
  64481. };
  64482. Pager.prototype.toggle = function () {
  64483. if (this.expanded === true) {
  64484. this.collapse();
  64485. } else {
  64486. this.expand();
  64487. }
  64488. };
  64489. Pager.prototype.clear = function (text) {
  64490. this.pager_element.find(".container").empty();
  64491. };
  64492. Pager.prototype.detach = function(){
  64493. var w = window.open("","_blank");
  64494. $(w.document.head)
  64495. .append(
  64496. $('<link>')
  64497. .attr('rel',"stylesheet")
  64498. .attr('href', utils.url_path_join(utils.get_body_data('baseUrl'), "static/style/style.min.css"))
  64499. .attr('type',"text/css")
  64500. )
  64501. .append(
  64502. $('<title>').text(i18n.msg._("Jupyter Pager"))
  64503. );
  64504. var pager_body = $(w.document.body);
  64505. pager_body.css('overflow','scroll');
  64506. pager_body.append(this.pager_element.clone().children());
  64507. w.document.close();
  64508. this.collapse();
  64509. };
  64510. Pager.prototype.append_text = function (text) {
  64511. /**
  64512. * The only user content injected with this HTML call is escaped by
  64513. * the fixConsole() method.
  64514. */
  64515. this.pager_element.find(".container").append($('<pre/>').html(utils.fixConsole(utils.fixOverwrittenChars(text))));
  64516. };
  64517. Pager.prototype.append = function (htm) {
  64518. /**
  64519. * The only user content injected with this HTML call is escaped by
  64520. * the fixConsole() method.
  64521. */
  64522. this.pager_element.find(".container").append(htm);
  64523. };
  64524. Pager.prototype._resize = function() {
  64525. /**
  64526. * Update document based on pager size.
  64527. */
  64528. // Make sure the padding at the end of the notebook is large
  64529. // enough that the user can scroll to the bottom of the
  64530. // notebook.
  64531. $('.end_space').css('height', Math.max(this.pager_element.height(), this._default_end_space));
  64532. };
  64533. return {'Pager': Pager};
  64534. });
  64535. // Copyright (c) Jupyter Development Team.
  64536. // Distributed under the terms of the Modified BSD License.
  64537. // Define promises for notebook events.
  64538. define('notebook/js/promises',['base/js/events', 'base/js/promises'], function(events, promises) {
  64539. "use strict";
  64540. // Promise to be resolved when the notebook is *initially* loaded.
  64541. // The event may fire again if the notebook is reloaded later, but this
  64542. // promise only tracks the initial load.
  64543. promises.notebook_loaded = new Promise(function(resolve, reject) {
  64544. events.one('notebook_loaded.Notebook', function() {
  64545. resolve();
  64546. });
  64547. events.one('notebook_load_failed.Notebook', function() {
  64548. reject();
  64549. });
  64550. });
  64551. return promises;
  64552. });
  64553. /* ===========================================================
  64554. # bootstrap-tour - v0.9.0
  64555. # http://bootstraptour.com
  64556. # ==============================================================
  64557. # Copyright 2012-2013 Ulrich Sossou
  64558. #
  64559. # Licensed under the Apache License, Version 2.0 (the "License");
  64560. # you may not use this file except in compliance with the License.
  64561. # You may obtain a copy of the License at
  64562. #
  64563. # http://www.apache.org/licenses/LICENSE-2.0
  64564. #
  64565. # Unless required by applicable law or agreed to in writing, software
  64566. # distributed under the License is distributed on an "AS IS" BASIS,
  64567. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  64568. # See the License for the specific language governing permissions and
  64569. # limitations under the License.
  64570. */
  64571. !function(a,b){var c,d;return d=b.document,c=function(){function c(c){this._options=a.extend({name:"tour",steps:[],container:"body",keyboard:!0,storage:b.localStorage,debug:!1,backdrop:!1,redirect:!0,orphan:!1,duration:!1,basePath:"",template:"<div class='popover'> <div class='arrow'></div> <h3 class='popover-title'></h3> <div class='popover-content'></div> <div class='popover-navigation'> <div class='btn-group'> <button class='btn btn-sm btn-default' data-role='prev'>&laquo; Prev</button> <button class='btn btn-sm btn-default' data-role='next'>Next &raquo;</button> <button class='btn btn-sm btn-default' data-role='pause-resume' data-pause-text='Pause' data-resume-text='Resume'>Pause</button> </div> <button class='btn btn-sm btn-default' data-role='end'>End tour</button> </div> </div>",afterSetState:function(){},afterGetState:function(){},afterRemoveState:function(){},onStart:function(){},onEnd:function(){},onShow:function(){},onShown:function(){},onHide:function(){},onHidden:function(){},onNext:function(){},onPrev:function(){},onPause:function(){},onResume:function(){}},c),this._force=!1,this._inited=!1,this.backdrop={overlay:null,$element:null,$background:null,backgroundShown:!1,overlayElementShown:!1}}return c.prototype.addSteps=function(a){var b,c,d;for(c=0,d=a.length;d>c;c++)b=a[c],this.addStep(b);return this},c.prototype.addStep=function(a){return this._options.steps.push(a),this},c.prototype.getStep=function(b){return null!=this._options.steps[b]?a.extend({id:"step-"+b,path:"",placement:"right",title:"",content:"<p></p>",next:b===this._options.steps.length-1?-1:b+1,prev:b-1,animation:!0,container:this._options.container,backdrop:this._options.backdrop,redirect:this._options.redirect,orphan:this._options.orphan,duration:this._options.duration,template:this._options.template,onShow:this._options.onShow,onShown:this._options.onShown,onHide:this._options.onHide,onHidden:this._options.onHidden,onNext:this._options.onNext,onPrev:this._options.onPrev,onPause:this._options.onPause,onResume:this._options.onResume},this._options.steps[b]):void 0},c.prototype.init=function(a){var b=this;return this._force=a,this.ended()?(this._debug("Tour ended, init prevented."),this):(this.setCurrentStep(),this._initMouseNavigation(),this._initKeyboardNavigation(),this._onResize(function(){return b.showStep(b._current)}),null!==this._current&&this.showStep(this._current),this._inited=!0,this)},c.prototype.start=function(a){var b;return null==a&&(a=!1),this._inited||this.init(a),null===this._current&&(b=this._makePromise(null!=this._options.onStart?this._options.onStart(this):void 0),this._callOnPromiseDone(b,this.showStep,0)),this},c.prototype.next=function(){var a;return a=this.hideStep(this._current),this._callOnPromiseDone(a,this._showNextStep)},c.prototype.prev=function(){var a;return a=this.hideStep(this._current),this._callOnPromiseDone(a,this._showPrevStep)},c.prototype.goTo=function(a){var b;return b=this.hideStep(this._current),this._callOnPromiseDone(b,this.showStep,a)},c.prototype.end=function(){var c,e,f=this;return c=function(){return a(d).off("click.tour-"+f._options.name),a(d).off("keyup.tour-"+f._options.name),a(b).off("resize.tour-"+f._options.name),f._setState("end","yes"),f._inited=!1,f._force=!1,f._clearTimer(),null!=f._options.onEnd?f._options.onEnd(f):void 0},e=this.hideStep(this._current),this._callOnPromiseDone(e,c)},c.prototype.ended=function(){return!this._force&&!!this._getState("end")},c.prototype.restart=function(){return this._removeState("current_step"),this._removeState("end"),this.setCurrentStep(0),this.start()},c.prototype.pause=function(){var a;return a=this.getStep(this._current),a&&a.duration?(this._paused=!0,this._duration-=(new Date).getTime()-this._start,b.clearTimeout(this._timer),this._debug("Paused/Stopped step "+(this._current+1)+" timer ("+this._duration+" remaining)."),null!=a.onPause?a.onPause(this,this._duration):void 0):this},c.prototype.resume=function(){var a,c=this;return a=this.getStep(this._current),a&&a.duration?(this._paused=!1,this._start=(new Date).getTime(),this._duration=this._duration||a.duration,this._timer=b.setTimeout(function(){return c._isLast()?c.next():c.end()},this._duration),this._debug("Started step "+(this._current+1)+" timer with duration "+this._duration),null!=a.onResume&&this._duration!==a.duration?a.onResume(this,this._duration):void 0):this},c.prototype.hideStep=function(b){var c,d,e,f=this;return(e=this.getStep(b))?(this._clearTimer(),d=this._makePromise(null!=e.onHide?e.onHide(this,b):void 0),c=function(){var b;return b=a(e.element),b.data("bs.popover")||b.data("popover")||(b=a("body")),b.popover("destroy"),e.reflex&&b.css("cursor","").off("click.tour-"+f._options.name),e.backdrop&&f._hideBackdrop(),null!=e.onHidden?e.onHidden(f):void 0},this._callOnPromiseDone(d,c),d):void 0},c.prototype.showStep=function(a){var b,c,e,f,g=this;return this.ended()?(this._debug("Tour ended, showStep prevented."),this):(f=this.getStep(a))?(e=a<this._current,b=this._makePromise(null!=f.onShow?f.onShow(this,a):void 0),c=function(){var b,c;if(g.setCurrentStep(a),c=function(){switch(toString.call(f.path)){case"[object Function]":return f.path();case"[object String]":return this._options.basePath+f.path;default:return f.path}}.call(g),b=[d.location.pathname,d.location.hash].join(""),g._isRedirect(c,b))return g._redirect(f,c),void 0;if(g._isOrphan(f)){if(!f.orphan)return g._debug("Skip the orphan step "+(g._current+1)+". Orphan option is false and the element doesn't exist or is hidden."),e?g._showPrevStep():g._showNextStep(),void 0;g._debug("Show the orphan step "+(g._current+1)+". Orphans option is true.")}return f.backdrop&&g._showBackdrop(g._isOrphan(f)?void 0:f.element),g._scrollIntoView(f.element,function(){return null!=f.element&&f.backdrop&&g._showOverlayElement(f.element),g._showPopover(f,a),null!=f.onShown&&f.onShown(g),g._debug("Step "+(g._current+1)+" of "+g._options.steps.length)}),f.duration?g.resume():void 0},this._callOnPromiseDone(b,c),b):void 0},c.prototype.getCurrentStep=function(){return this._current},c.prototype.setCurrentStep=function(a){return null!=a?(this._current=a,this._setState("current_step",a)):(this._current=this._getState("current_step"),this._current=null===this._current?null:parseInt(this._current,10)),this},c.prototype._setState=function(a,b){var c,d;if(this._options.storage){d=""+this._options.name+"_"+a;try{this._options.storage.setItem(d,b)}catch(e){c=e,c.code===DOMException.QUOTA_EXCEEDED_ERR&&this.debug("LocalStorage quota exceeded. State storage failed.")}return this._options.afterSetState(d,b)}return null==this._state&&(this._state={}),this._state[a]=b},c.prototype._removeState=function(a){var b;return this._options.storage?(b=""+this._options.name+"_"+a,this._options.storage.removeItem(b),this._options.afterRemoveState(b)):null!=this._state?delete this._state[a]:void 0},c.prototype._getState=function(a){var b,c;return this._options.storage?(b=""+this._options.name+"_"+a,c=this._options.storage.getItem(b)):null!=this._state&&(c=this._state[a]),(void 0===c||"null"===c)&&(c=null),this._options.afterGetState(a,c),c},c.prototype._showNextStep=function(){var a,b,c,d=this;return c=this.getStep(this._current),b=function(){return d.showStep(c.next)},a=this._makePromise(null!=c.onNext?c.onNext(this):void 0),this._callOnPromiseDone(a,b)},c.prototype._showPrevStep=function(){var a,b,c,d=this;return c=this.getStep(this._current),b=function(){return d.showStep(c.prev)},a=this._makePromise(null!=c.onPrev?c.onPrev(this):void 0),this._callOnPromiseDone(a,b)},c.prototype._debug=function(a){return this._options.debug?b.console.log("Bootstrap Tour '"+this._options.name+"' | "+a):void 0},c.prototype._isRedirect=function(a,b){return null!=a&&""!==a&&("[object RegExp]"===toString.call(a)&&!a.test(b)||"[object String]"===toString.call(a)&&a.replace(/\?.*$/,"").replace(/\/?$/,"")!==b.replace(/\/?$/,""))},c.prototype._redirect=function(b,c){return a.isFunction(b.redirect)?b.redirect.call(this,c):b.redirect===!0?(this._debug("Redirect to "+c),d.location.href=c):void 0},c.prototype._isOrphan=function(b){return null==b.element||!a(b.element).length||a(b.element).is(":hidden")&&"http://www.w3.org/2000/svg"!==a(b.element)[0].namespaceURI},c.prototype._isLast=function(){return this._current<this._options.steps.length-1},c.prototype._showPopover=function(b,c){var d,e,f,g,h,i,j=this;return i=a.extend({},this._options),f=a.isFunction(b.template)?a(b.template(c,b)):a(b.template),e=f.find(".popover-navigation"),h=this._isOrphan(b),h&&(b.element="body",b.placement="top",f=f.addClass("orphan")),d=a(b.element),f.addClass("tour-"+this._options.name+" tour-"+this._options.name+"-"+c),b.options&&a.extend(i,b.options),b.reflex&&d.css("cursor","pointer").on("click.tour-"+this._options.name,function(){return j._isLast()?j.next():j.end()}),b.prev<0&&e.find("[data-role='prev']").addClass("disabled"),b.next<0&&e.find("[data-role='next']").addClass("disabled"),b.duration||e.find("[data-role='pause-resume']").remove(),b.template=f.clone().wrap("<div>").parent().html(),d.popover({placement:b.placement,trigger:"manual",title:b.title,content:b.content,html:!0,animation:b.animation,container:b.container,template:b.template,selector:b.element}).popover("show"),g=d.data("bs.popover")?d.data("bs.popover").tip():d.data("popover").tip(),g.attr("id",b.id),this._reposition(g,b),h?this._center(g):void 0},c.prototype._reposition=function(b,c){var e,f,g,h,i,j,k;if(h=b[0].offsetWidth,f=b[0].offsetHeight,k=b.offset(),i=k.left,j=k.top,e=a(d).outerHeight()-k.top-b.outerHeight(),0>e&&(k.top=k.top+e),g=a("html").outerWidth()-k.left-b.outerWidth(),0>g&&(k.left=k.left+g),k.top<0&&(k.top=0),k.left<0&&(k.left=0),b.offset(k),"bottom"===c.placement||"top"===c.placement){if(i!==k.left)return this._replaceArrow(b,2*(k.left-i),h,"left")}else if(j!==k.top)return this._replaceArrow(b,2*(k.top-j),f,"top")},c.prototype._center=function(c){return c.css("top",a(b).outerHeight()/2-c.outerHeight()/2)},c.prototype._replaceArrow=function(a,b,c,d){return a.find(".arrow").css(d,b?50*(1-b/c)+"%":"")},c.prototype._scrollIntoView=function(c,d){var e,f,g,h,i,j,k=this;return e=a(c),e.length?(f=a(b),h=e.offset().top,j=f.height(),i=Math.max(0,h-j/2),this._debug("Scroll into view. ScrollTop: "+i+". Element offset: "+h+". Window height: "+j+"."),g=0,a("body,html").stop(!0,!0).animate({scrollTop:Math.ceil(i)},function(){return 2===++g?(d(),k._debug("Scroll into view. Animation end element offset: "+e.offset().top+". Window height: "+f.height()+".")):void 0})):d()},c.prototype._onResize=function(c,d){return a(b).on("resize.tour-"+this._options.name,function(){return clearTimeout(d),d=setTimeout(c,100)})},c.prototype._initMouseNavigation=function(){var b=this;return b=this,a(d).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='prev']:not(.disabled)").off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='next']:not(.disabled)").off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='end']").off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='pause-resume']").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='next']:not(.disabled)",function(a){return a.preventDefault(),b.next()}).on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='prev']:not(.disabled)",function(a){return a.preventDefault(),b.prev()}).on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='end']",function(a){return a.preventDefault(),b.end()}).on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='pause-resume']",function(c){var d;return c.preventDefault(),d=a(this),d.text(b._paused?d.data("pause-text"):d.data("resume-text")),b._paused?b.resume():b.pause()})},c.prototype._initKeyboardNavigation=function(){var b=this;if(this._options.keyboard)return a(d).on("keyup.tour-"+this._options.name,function(a){if(a.which)switch(a.which){case 39:return a.preventDefault(),b._isLast()?b.next():b.end();case 37:if(a.preventDefault(),b._current>0)return b.prev();break;case 27:return a.preventDefault(),b.end()}})},c.prototype._makePromise=function(b){return b&&a.isFunction(b.then)?b:null},c.prototype._callOnPromiseDone=function(a,b,c){var d=this;return a?a.then(function(){return b.call(d,c)}):b.call(this,c)},c.prototype._showBackdrop=function(){return this.backdrop.backgroundShown?void 0:(this.backdrop=a("<div/>",{"class":"tour-backdrop"}),this.backdrop.backgroundShown=!0,a("body").append(this.backdrop))},c.prototype._hideBackdrop=function(){return this._hideOverlayElement(),this._hideBackground()},c.prototype._hideBackground=function(){return this.backdrop.remove(),this.backdrop.overlay=null,this.backdrop.backgroundShown=!1},c.prototype._showOverlayElement=function(b){var c,d,e;return d=a(b),d&&0!==d.length&&!this.backdrop.overlayElementShown?(this.backdrop.overlayElementShown=!0,c=a("<div/>"),e=d.offset(),e.top=e.top,e.left=e.left,c.width(d.innerWidth()).height(d.innerHeight()).addClass("tour-step-background").offset(e),d.addClass("tour-step-backdrop"),a("body").append(c),this.backdrop.$element=d,this.backdrop.$background=c):void 0},c.prototype._hideOverlayElement=function(){return this.backdrop.overlayElementShown?(this.backdrop.$element.removeClass("tour-step-backdrop"),this.backdrop.$background.remove(),this.backdrop.$element=null,this.backdrop.$background=null,this.backdrop.overlayElementShown=!1):void 0},c.prototype._clearTimer=function(){return b.clearTimeout(this._timer),this._timer=null,this._duration=null},c}(),b.Tour=c}(jQuery,window);
  64572. define("bootstraptour", ["bootstrap"], (function (global) {
  64573. return function () {
  64574. var ret, fn;
  64575. return ret || global.Tour;
  64576. };
  64577. }(this)));
  64578. // Copyright (c) Jupyter Development Team.
  64579. // Distributed under the terms of the Modified BSD License.
  64580. define('notebook/js/tour',['jquery', 'bootstraptour', 'base/js/i18n'], function($, Tour, i18n) {
  64581. "use strict";
  64582. var tour_style = "<div class='popover tour'>\n" +
  64583. "<div class='arrow'></div>\n" +
  64584. "<div style='position:absolute; top:7px; right:7px'>\n" +
  64585. "<button class='btn btn-default btn-sm fa fa-times' data-role='end'></button>\n" +
  64586. "</div><h3 class='popover-title'></h3>\n" +
  64587. "<div class='popover-content'></div>\n" +
  64588. "<div class='popover-navigation'>\n" +
  64589. "<button class='btn btn-default fa fa-step-backward' data-role='prev'></button>\n" +
  64590. "<button class='btn btn-default fa fa-step-forward pull-right' data-role='next'></button>\n" +
  64591. "<button id='tour-pause' class='btn btn-sm btn-default fa fa-pause' data-resume-text='' data-pause-text='' data-role='pause-resume'></button>\n" +
  64592. "</div>\n" +
  64593. "</div>";
  64594. var NotebookTour = function (notebook, events) {
  64595. var that = this;
  64596. this.notebook = notebook;
  64597. this.step_duration = 0;
  64598. this.events = events;
  64599. this.tour_steps = [
  64600. {
  64601. title: i18n.msg._("Welcome to the Notebook Tour"),
  64602. placement: 'bottom',
  64603. orphan: true,
  64604. content: i18n.msg._("You can use the left and right arrow keys to go backwards and forwards.")
  64605. }, {
  64606. element: "#notebook_name",
  64607. title: i18n.msg._("Filename"),
  64608. placement: 'bottom',
  64609. content: i18n.msg._("Click here to change the filename for this notebook.")
  64610. }, {
  64611. element: $("#menus").parent(),
  64612. placement: 'bottom',
  64613. title: i18n.msg._("Notebook Menubar"),
  64614. content: i18n.msg._("The menubar has menus for actions on the notebook, its cells, and the kernel it communicates with.")
  64615. }, {
  64616. element: "#maintoolbar",
  64617. placement: 'bottom',
  64618. title: i18n.msg._("Notebook Toolbar"),
  64619. content: i18n.msg._("The toolbar has buttons for the most common actions. Hover your mouse over each button for more information.")
  64620. }, {
  64621. element: "#modal_indicator",
  64622. title: i18n.msg._("Mode Indicator"),
  64623. placement: 'bottom',
  64624. content: i18n.msg._("The Notebook has two modes: Edit Mode and Command Mode. In this area, an indicator can appear to tell you which mode you are in."),
  64625. onShow: function(tour) { that.command_icon_hack(); }
  64626. }, {
  64627. element: "#modal_indicator",
  64628. title: i18n.msg._("Command Mode"),
  64629. placement: 'bottom',
  64630. onShow: function(tour) { notebook.command_mode(); that.command_icon_hack(); },
  64631. onNext: function(tour) { that.edit_mode(); },
  64632. content: i18n.msg._("Right now you are in Command Mode, and many keyboard shortcuts are available. In this mode, no icon is displayed in the indicator area.")
  64633. }, {
  64634. element: "#modal_indicator",
  64635. title: i18n.msg._("Edit Mode"),
  64636. placement: 'bottom',
  64637. onShow: function(tour) { that.edit_mode(); },
  64638. content: i18n.msg._("Pressing <code>Enter</code> or clicking in the input text area of the cell switches to Edit Mode.")
  64639. }, {
  64640. element: '.selected',
  64641. title: i18n.msg._("Edit Mode"),
  64642. placement: 'bottom',
  64643. onShow: function(tour) { that.edit_mode(); },
  64644. content: i18n.msg._("Notice that the border around the currently active cell changed color. Typing will insert text into the currently active cell.")
  64645. }, {
  64646. element: '.selected',
  64647. title: i18n.msg._("Back to Command Mode"),
  64648. placement: 'bottom',
  64649. onShow: function(tour) { notebook.command_mode(); },
  64650. content: i18n.msg._("Pressing <code>Esc</code> or clicking outside of the input text area takes you back to Command Mode.")
  64651. }, {
  64652. element: '#keyboard_shortcuts',
  64653. title: i18n.msg._("Keyboard Shortcuts"),
  64654. placement: 'bottom',
  64655. onShow: function(tour) {
  64656. /** need to add `open` and `pulse` classes in 2 calls */
  64657. $('#help_menu').parent().addClass('open');
  64658. $('#help_menu').parent().addClass('pulse');
  64659. $('#keyboard_shortcuts').addClass('pulse');
  64660. },
  64661. onHide: function(tour) {
  64662. $('#help_menu').parent().removeClass('open pulse');
  64663. $('#keyboard_shortcuts').removeClass('pulse');
  64664. },
  64665. content: i18n.msg._("You can click here to get a list of all of the keyboard shortcuts.")
  64666. }, {
  64667. element: "#kernel_indicator_icon",
  64668. title: i18n.msg._("Kernel Indicator"),
  64669. placement: 'bottom',
  64670. onShow: function(tour) { events.trigger('kernel_idle.Kernel');},
  64671. content: i18n.msg._("This is the Kernel indicator. It looks like this when the Kernel is idle.")
  64672. }, {
  64673. element: "#kernel_indicator_icon",
  64674. title: i18n.msg._("Kernel Indicator"),
  64675. placement: 'bottom',
  64676. onShow: function(tour) { events.trigger('kernel_busy.Kernel'); },
  64677. content: i18n.msg._("The Kernel indicator looks like this when the Kernel is busy.")
  64678. }, {
  64679. element: ".fa-stop",
  64680. placement: 'bottom',
  64681. title: i18n.msg._("Interrupting the Kernel"),
  64682. onHide: function(tour) { events.trigger('kernel_idle.Kernel'); },
  64683. content: i18n.msg._("To cancel a computation in progress, you can click here.")
  64684. }, {
  64685. element: "#notification_kernel",
  64686. placement: 'bottom',
  64687. onShow: function(tour) { $('.fa-stop').click(); },
  64688. title: i18n.msg._("Notification Area"),
  64689. content: i18n.msg._("Messages in response to user actions (Save, Interrupt, etc.) appear here.")
  64690. }, {
  64691. title: i18n.msg._("End of Tour"),
  64692. placement: 'bottom',
  64693. orphan: true,
  64694. content: i18n.msg._("This concludes the Jupyter Notebook User Interface Tour.")
  64695. }
  64696. ];
  64697. this.tour = new Tour({
  64698. storage: false, // start tour from beginning every time
  64699. debug: true,
  64700. reflex: true, // click on element to continue tour
  64701. animation: false,
  64702. duration: this.step_duration,
  64703. onStart: function() { console.log('tour started'); },
  64704. // TODO: remove the onPause/onResume logic once pi's patch has been
  64705. // merged upstream to make this work via data-resume-class and
  64706. // data-resume-text attributes.
  64707. onPause: this.toggle_pause_play,
  64708. onResume: this.toggle_pause_play,
  64709. steps: this.tour_steps,
  64710. template: tour_style,
  64711. orphan: true
  64712. });
  64713. };
  64714. NotebookTour.prototype.start = function () {
  64715. console.log("let's start the tour");
  64716. this.tour.init();
  64717. this.tour.start();
  64718. if (this.tour.ended())
  64719. {
  64720. this.tour.restart();
  64721. }
  64722. };
  64723. NotebookTour.prototype.command_icon_hack = function() {
  64724. $('#modal_indicator').css('min-height', '18px');
  64725. };
  64726. NotebookTour.prototype.toggle_pause_play = function () {
  64727. $('#tour-pause').toggleClass('fa-pause fa-play');
  64728. };
  64729. NotebookTour.prototype.edit_mode = function() {
  64730. this.notebook.focus_cell();
  64731. this.notebook.edit_mode();
  64732. };
  64733. return {'Tour': NotebookTour};
  64734. });
  64735. // Copyright (c) Jupyter Development Team.
  64736. // Distributed under the terms of the Modified BSD License.
  64737. define('notebook/js/menubar',[
  64738. 'jquery',
  64739. 'base/js/namespace',
  64740. 'base/js/dialog',
  64741. 'base/js/utils',
  64742. 'base/js/i18n',
  64743. 'notebook/js/quickhelp',
  64744. './celltoolbar',
  64745. './tour',
  64746. 'moment',
  64747. ], function($, IPython, dialog, utils, i18n, quickhelp, celltoolbar, tour, moment) {
  64748. "use strict";
  64749. var MenuBar = function (selector, options) {
  64750. /**
  64751. * Constructor
  64752. *
  64753. * A MenuBar Class to generate the menubar of Jupyter notebook
  64754. *
  64755. * Parameters:
  64756. * selector: string
  64757. * options: dictionary
  64758. * Dictionary of keyword arguments.
  64759. * notebook: Notebook instance
  64760. * render keyboard shortcuts from KeyboardManager
  64761. * contents: ContentManager instance
  64762. * events: $(Events) instance
  64763. * save_widget: SaveWidget instance
  64764. * quick_help: QuickHelp instance
  64765. * base_url : string
  64766. * notebook_path : string
  64767. * notebook_name : string
  64768. * config: ConfigSection instance
  64769. */
  64770. options = options || {};
  64771. this.nbclassic_path = options.nbclassic_path;
  64772. this.base_url = options.base_url || utils.get_body_data("baseUrl");
  64773. this.selector = selector;
  64774. this.notebook = options.notebook;
  64775. this.keyboard_manager = this.notebook.keyboard_manager;
  64776. this.actions = this.keyboard_manager.actions;
  64777. this.contents = options.contents;
  64778. this.events = options.events;
  64779. this.save_widget = options.save_widget;
  64780. this.quick_help = options.quick_help;
  64781. this.actions = options.actions;
  64782. this.config = options.config;
  64783. try {
  64784. this.tour = new tour.Tour(this.notebook, this.events);
  64785. } catch (e) {
  64786. this.tour = undefined;
  64787. console.log("Failed to instantiate Notebook Tour", e);
  64788. }
  64789. if (this.selector !== undefined) {
  64790. this.element = $(selector);
  64791. this.style();
  64792. this.add_bundler_items();
  64793. this.bind_events();
  64794. }
  64795. };
  64796. // TODO: This has definitively nothing to do with style ...
  64797. MenuBar.prototype.style = function () {
  64798. var that = this;
  64799. this.element.find("li").click(function (event, ui) {
  64800. // The selected cell loses focus when the menu is entered, so we
  64801. // re-select it upon selection.
  64802. var i = that.notebook.get_selected_index();
  64803. that.notebook.select(i, false);
  64804. }
  64805. );
  64806. };
  64807. MenuBar.prototype.add_bundler_items = function() {
  64808. var that = this;
  64809. this.config.loaded.then(function() {
  64810. var bundlers = that.config.data.bundlerextensions;
  64811. if(bundlers) {
  64812. // Stable sort the keys to ensure menu items don't hop around
  64813. var ids = Object.keys(bundlers).sort()
  64814. ids.forEach(function(bundler_id) {
  64815. var bundler = bundlers[bundler_id];
  64816. var group = that.element.find('#'+bundler.group+'_menu')
  64817. // Validate menu item metadata
  64818. if(!group.length) {
  64819. console.warn('unknown group', bundler.group, 'for bundler ID', bundler_id, '; skipping');
  64820. return;
  64821. } else if(!bundler.label) {
  64822. console.warn('no label for bundler ID', bundler_id, '; skipping');
  64823. return;
  64824. }
  64825. // Insert menu item into correct group, click handler
  64826. group.parent().removeClass('hidden');
  64827. var $li = $('<li>')
  64828. .appendTo(group);
  64829. $('<a>')
  64830. .attr('href', '#')
  64831. .text(bundler.label)
  64832. .appendTo($li)
  64833. .on('click', that._bundle.bind(that, bundler_id))
  64834. .appendTo($li);
  64835. });
  64836. }
  64837. });
  64838. };
  64839. MenuBar.prototype._new_window = function(url) {
  64840. var w = window.open('', IPython._target);
  64841. if (this.notebook.dirty && this.notebook.writable) {
  64842. this.notebook.save_notebook().then(function() {
  64843. w.location = url;
  64844. });
  64845. } else {
  64846. w.location = url;
  64847. }
  64848. };
  64849. MenuBar.prototype._bundle = function(bundler_id) {
  64850. // Read notebook path and base url here in case they change
  64851. var notebook_path = utils.encode_uri_components(this.notebook.notebook_path);
  64852. var url = utils.url_path_join(
  64853. this.base_url,
  64854. 'bundle',
  64855. notebook_path
  64856. ) + '?bundler=' + utils.encode_uri_components(bundler_id);
  64857. this._new_window(url);
  64858. };
  64859. MenuBar.prototype._nbconvert = function (format, download) {
  64860. download = download || false;
  64861. var notebook_path = utils.encode_uri_components(this.notebook.notebook_path);
  64862. var url = utils.url_path_join(
  64863. this.base_url,
  64864. 'nbconvert',
  64865. format,
  64866. notebook_path
  64867. ) + "?download=" + download.toString();
  64868. this._new_window(url);
  64869. };
  64870. MenuBar.prototype._size_header = function() {
  64871. /**
  64872. * Update header spacer size.
  64873. */
  64874. console.warn('`_size_header` is deprecated and will be removed in future versions.'+
  64875. ' Please trigger the `resize-header.Page` manually if you rely on it.');
  64876. this.events.trigger('resize-header.Page');
  64877. };
  64878. (function($){
  64879. $(document).ready(function(){
  64880. $('ul.dropdown-menu [data-toggle=dropdown]').on('click', function(event) {
  64881. event.preventDefault();
  64882. event.stopPropagation();
  64883. $(this).parent().siblings().removeClass('open');
  64884. $(this).parent().toggleClass('open');
  64885. });
  64886. });
  64887. })(jQuery);
  64888. MenuBar.prototype.bind_events = function () {
  64889. /**
  64890. * File
  64891. */
  64892. var that = this;
  64893. this.element.find('#open_notebook').click(function () {
  64894. var parent = utils.url_path_split(that.notebook.notebook_path)[0];
  64895. window.open(
  64896. utils.url_path_join(
  64897. that.base_url, that.nbclassic_path, 'tree',
  64898. utils.encode_uri_components(parent)
  64899. ), IPython._target);
  64900. });
  64901. this.element.find('#copy_notebook').click(function () {
  64902. that.notebook.copy_notebook();
  64903. return false;
  64904. });
  64905. this.element.find('#save_notebook_as').click(function() {
  64906. that.notebook.save_notebook_as();
  64907. return false;
  64908. });
  64909. this.element.find('#print_preview').click(function () {
  64910. that._nbconvert('html', false);
  64911. });
  64912. this.element.find('#download_menu li').click(function (ev) {
  64913. that._nbconvert(ev.target.parentElement.getAttribute('id').substring(9), true);
  64914. });
  64915. this.events.on('trust_changed.Notebook', function (event, trusted) {
  64916. if (trusted) {
  64917. that.element.find('#trust_notebook')
  64918. .addClass("disabled").off('click')
  64919. .find("a").text(i18n.msg._("Trusted Notebook"));
  64920. } else {
  64921. that.element.find('#trust_notebook')
  64922. .removeClass("disabled").on('click', function () {
  64923. that.notebook.trust_notebook();
  64924. })
  64925. .find("a").text(i18n.msg._("Trust Notebook"));
  64926. }
  64927. });
  64928. // View
  64929. this._add_celltoolbar_list();
  64930. // Edit
  64931. this.element.find('#edit_nb_metadata').click(function () {
  64932. that.notebook.edit_metadata({
  64933. notebook: that.notebook,
  64934. keyboard_manager: that.notebook.keyboard_manager});
  64935. });
  64936. var id_actions_dict = {
  64937. '#trust_notebook' : 'trust-notebook',
  64938. '#rename_notebook' : 'rename-notebook',
  64939. '#find_and_replace' : 'find-and-replace',
  64940. '#save_checkpoint': 'save-notebook',
  64941. '#shutdown_kernel': 'confirm-shutdown-kernel',
  64942. '#restart_kernel': 'confirm-restart-kernel',
  64943. '#restart_clear_output': 'confirm-restart-kernel-and-clear-output',
  64944. '#restart_run_all': 'confirm-restart-kernel-and-run-all-cells',
  64945. '#close_and_halt': 'close-and-halt',
  64946. '#int_kernel': 'interrupt-kernel',
  64947. '#cut_cell': 'cut-cell',
  64948. '#copy_cell': 'copy-cell',
  64949. '#paste_cell_above': 'paste-cell-above',
  64950. '#paste_cell_below': 'paste-cell-below',
  64951. '#paste_cell_replace': 'paste-cell-replace',
  64952. '#delete_cell': 'delete-cell',
  64953. '#undelete_cell': 'undo-cell-deletion',
  64954. '#split_cell': 'split-cell-at-cursor',
  64955. '#merge_cell_above': 'merge-cell-with-previous-cell',
  64956. '#merge_cell_below': 'merge-cell-with-next-cell',
  64957. '#move_cell_up': 'move-cell-up',
  64958. '#move_cell_down': 'move-cell-down',
  64959. '#toggle_header': 'toggle-header',
  64960. '#toggle_toolbar': 'toggle-toolbar',
  64961. '#toggle_line_numbers': 'toggle-all-line-numbers',
  64962. '#insert_cell_above': 'insert-cell-above',
  64963. '#insert_cell_below': 'insert-cell-below',
  64964. '#run_cell': 'run-cell',
  64965. '#run_cell_select_below': 'run-cell-and-select-next',
  64966. '#run_cell_insert_below': 'run-cell-and-insert-below',
  64967. '#run_all_cells': 'run-all-cells',
  64968. '#run_all_cells_above': 'run-all-cells-above',
  64969. '#run_all_cells_below': 'run-all-cells-below',
  64970. '#to_code': 'change-cell-to-code',
  64971. '#to_markdown': 'change-cell-to-markdown',
  64972. '#to_raw': 'change-cell-to-raw',
  64973. '#toggle_current_output': 'toggle-cell-output-collapsed',
  64974. '#toggle_current_output_scroll': 'toggle-cell-output-scrolled',
  64975. '#clear_current_output': 'clear-cell-output',
  64976. '#toggle_all_output': 'toggle-all-cells-output-collapsed',
  64977. '#toggle_all_output_scroll': 'toggle-all-cells-output-scrolled',
  64978. '#clear_all_output': 'clear-all-cells-output',
  64979. '#cut_cell_attachments': 'cut-cell-attachments',
  64980. '#copy_cell_attachments': 'copy-cell-attachments',
  64981. '#paste_cell_attachments': 'paste-cell-attachments',
  64982. '#insert_image': 'insert-image',
  64983. '#keyboard_shortcuts' : 'show-keyboard-shortcuts',
  64984. '#edit_keyboard_shortcuts' : 'edit-command-mode-keyboard-shortcuts',
  64985. };
  64986. for(var idx in id_actions_dict){
  64987. if (!id_actions_dict.hasOwnProperty(idx)){
  64988. continue;
  64989. }
  64990. var id_act = 'jupyter-notebook:'+id_actions_dict[idx];
  64991. if(!that.actions.exists(id_act)){
  64992. console.warn('actions', id_act, 'does not exist, still binding it in case it will be defined later...');
  64993. }
  64994. // Immediately-Invoked Function Expression cause JS.
  64995. (function(that, id_act, idx){
  64996. var el = that.element.find(idx);
  64997. el.click(function(event){
  64998. that.actions.call(id_act, event);
  64999. });
  65000. var keybinding = that.keyboard_manager.command_shortcuts.get_action_shortcut(id_act) || that.keyboard_manager.edit_shortcuts.get_action_shortcut(id_act);
  65001. if (keybinding) {
  65002. var shortcut = quickhelp.humanize_sequence(keybinding);
  65003. var link_element = el.children('a');
  65004. var text = link_element.text();
  65005. link_element.text('');
  65006. link_element.addClass('menu-shortcut-container');
  65007. link_element.append('<span class="action">' + text + '</span>');
  65008. link_element.append('<span class="kb">' + shortcut + '</span>');
  65009. }
  65010. })(that, id_act, idx);
  65011. }
  65012. // Kernel
  65013. this.element.find('#reconnect_kernel').click(function () {
  65014. that.notebook.kernel.reconnect();
  65015. });
  65016. // Help
  65017. if (this.tour) {
  65018. this.element.find('#notebook_tour').click(function () {
  65019. that.tour.start();
  65020. });
  65021. } else {
  65022. this.element.find('#notebook_tour').addClass("disabled");
  65023. }
  65024. this.update_restore_checkpoint(null);
  65025. this.events.on('checkpoints_listed.Notebook', function (event, data) {
  65026. that.update_restore_checkpoint(that.notebook.checkpoints);
  65027. });
  65028. this.events.on('checkpoint_created.Notebook', function (event, data) {
  65029. that.update_restore_checkpoint(that.notebook.checkpoints);
  65030. });
  65031. this.events.on('notebook_loaded.Notebook', function() {
  65032. var langinfo = that.notebook.metadata.language_info || {};
  65033. that.update_nbconvert_script(langinfo);
  65034. });
  65035. this.events.on('kernel_ready.Kernel', function(event, data) {
  65036. var langinfo = data.kernel.info_reply.language_info || {};
  65037. that.update_nbconvert_script(langinfo);
  65038. that.add_kernel_help_links(data.kernel.info_reply.help_links || []);
  65039. });
  65040. };
  65041. MenuBar.prototype._add_celltoolbar_list = function () {
  65042. var that = this;
  65043. var submenu = $("#menu-cell-toolbar-submenu");
  65044. function preset_added(event, data) {
  65045. var name = data.name;
  65046. submenu.append(
  65047. $("<li/>")
  65048. .attr('data-name', encodeURIComponent(name))
  65049. .append(
  65050. $("<a/>")
  65051. .attr('href', '#')
  65052. .text(name)
  65053. .click(function () {
  65054. if (name ==='None') {
  65055. celltoolbar.CellToolbar.global_hide();
  65056. delete that.notebook.metadata.celltoolbar;
  65057. } else {
  65058. celltoolbar.CellToolbar.global_show();
  65059. celltoolbar.CellToolbar.activate_preset(name, that.events);
  65060. that.notebook.metadata.celltoolbar = name;
  65061. }
  65062. that.notebook.focus_cell();
  65063. })
  65064. )
  65065. );
  65066. }
  65067. // Setup the existing presets
  65068. var presets = celltoolbar.CellToolbar.list_presets();
  65069. preset_added(null, {name: i18n.msg._("None")});
  65070. presets.map(function (name) {
  65071. preset_added(null, {name: name});
  65072. });
  65073. // Setup future preset registrations
  65074. this.events.on('preset_added.CellToolbar', preset_added);
  65075. // Handle unregistered presets
  65076. this.events.on('unregistered_preset.CellToolbar', function (event, data) {
  65077. submenu.find("li[data-name='" + encodeURIComponent(data.name) + "']").remove();
  65078. });
  65079. };
  65080. MenuBar.prototype.update_restore_checkpoint = function(checkpoints) {
  65081. var ul = this.element.find("#restore_checkpoint").find("ul");
  65082. ul.empty();
  65083. if (!checkpoints || checkpoints.length === 0) {
  65084. ul.append(
  65085. $("<li/>")
  65086. .addClass("disabled")
  65087. .append(
  65088. $("<a/>")
  65089. .text(i18n.msg._("No checkpoints"))
  65090. )
  65091. );
  65092. return;
  65093. }
  65094. var that = this;
  65095. checkpoints.map(function (checkpoint) {
  65096. var d = new Date(checkpoint.last_modified);
  65097. ul.append(
  65098. $("<li/>").append(
  65099. $("<a/>")
  65100. .attr("href", "#")
  65101. .text(moment(d).format("LLLL"))
  65102. .click(function () {
  65103. that.notebook.restore_checkpoint_dialog(checkpoint);
  65104. })
  65105. )
  65106. );
  65107. });
  65108. };
  65109. MenuBar.prototype.update_nbconvert_script = function(langinfo) {
  65110. /**
  65111. * Set the 'Download as foo' menu option for the relevant language.
  65112. */
  65113. var el = this.element.find('#download_script');
  65114. // Set menu entry text to e.g. "Python (.py)"
  65115. var langname = (langinfo.name || 'Script');
  65116. langname = langname.charAt(0).toUpperCase()+langname.substr(1); // Capitalise
  65117. el.find('a').text(langname + ' ('+(langinfo.file_extension || 'txt')+')');
  65118. };
  65119. MenuBar.prototype.add_kernel_help_links = function(help_links) {
  65120. /** add links from kernel_info to the help menu */
  65121. var divider = $("#kernel-help-links");
  65122. if (divider.length === 0) {
  65123. // insert kernel help section above about link
  65124. var about = $("#notebook_about").parent();
  65125. divider = $("<li>")
  65126. .attr('id', "kernel-help-links")
  65127. .addClass('divider');
  65128. about.prev().before(divider);
  65129. }
  65130. // remove previous entries
  65131. while (!divider.next().hasClass('divider')) {
  65132. divider.next().remove();
  65133. }
  65134. if (help_links.length === 0) {
  65135. // no help links, remove the divider
  65136. divider.remove();
  65137. return;
  65138. }
  65139. var cursor = divider;
  65140. help_links.map(function (link) {
  65141. cursor.after($("<li>")
  65142. .append($("<a>")
  65143. .attr('target', '_blank')
  65144. .attr('title', i18n.msg._('Opens in a new window'))
  65145. .attr('href', requirejs.toUrl(link.url))
  65146. .append($("<i>")
  65147. .addClass("fa fa-external-link menu-icon pull-right")
  65148. )
  65149. .append($("<span>")
  65150. .text(link.text)
  65151. )
  65152. )
  65153. );
  65154. cursor = cursor.next();
  65155. });
  65156. };
  65157. return {'MenuBar': MenuBar};
  65158. });
  65159. // Copyright (c) Jupyter Development Team.
  65160. // Distributed under the terms of the Modified BSD License.
  65161. define('base/js/notificationwidget',['jquery'], function($) {
  65162. "use strict";
  65163. /**
  65164. * Construct a NotificationWidget object.
  65165. *
  65166. * @constructor
  65167. * @param {string} selector - a jQuery selector string for the
  65168. * notification widget element
  65169. */
  65170. var NotificationWidget = function (selector) {
  65171. this.selector = selector;
  65172. this.timeout = null;
  65173. this.busy = false;
  65174. if (this.selector !== undefined) {
  65175. this.element = $(selector);
  65176. this.style();
  65177. }
  65178. this.element.hide();
  65179. this.inner = $('<span/>');
  65180. this.element.append(this.inner);
  65181. };
  65182. /**
  65183. * Add the 'notification_widget' CSS class to the widget element.
  65184. *
  65185. * @method style
  65186. */
  65187. NotificationWidget.prototype.style = function () {
  65188. // use explicit bootstrap classes here,
  65189. // because multiple inheritance in LESS doesn't work
  65190. // for this particular combination
  65191. this.element.addClass('notification_widget btn btn-xs navbar-btn');
  65192. };
  65193. /**
  65194. * hide the widget and empty the text
  65195. **/
  65196. NotificationWidget.prototype.hide = function () {
  65197. var that = this;
  65198. this.element.fadeOut(100, function(){that.inner.text('');});
  65199. };
  65200. /**
  65201. * Set the notification widget message to display for a certain
  65202. * amount of time (timeout). The widget will be shown forever if
  65203. * timeout is <= 0 or undefined. If the widget is clicked while it
  65204. * is still displayed, execute an optional callback
  65205. * (click_callback). If the callback returns false, it will
  65206. * prevent the notification from being dismissed.
  65207. *
  65208. * Options:
  65209. * class - CSS class name for styling
  65210. * icon - CSS class name for the widget icon
  65211. * title - HTML title attribute for the widget
  65212. *
  65213. * @method set_message
  65214. * @param {string} msg - The notification to display
  65215. * @param {integer} [timeout] - The amount of time in milliseconds to display the widget
  65216. * @param {function} [click_callback] - The function to run when the widget is clicked
  65217. * @param {Object} [options] - Additional options
  65218. */
  65219. NotificationWidget.prototype.set_message = function (msg, timeout, click_callback, options) {
  65220. options = options || {};
  65221. // unbind potential previous callback
  65222. this.element.unbind('click');
  65223. this.inner.attr('class', options.icon);
  65224. this.inner.attr('title', options.title);
  65225. this.inner.text(msg);
  65226. this.element.fadeIn(100);
  65227. // reset previous set style
  65228. this.element.removeClass();
  65229. this.style();
  65230. if (options.class) {
  65231. this.element.addClass(options.class);
  65232. }
  65233. // clear previous timer
  65234. if (this.timeout !== null) {
  65235. clearTimeout(this.timeout);
  65236. this.timeout = null;
  65237. }
  65238. // set the timer if a timeout is given
  65239. var that = this;
  65240. if (timeout !== undefined && timeout >= 0) {
  65241. this.timeout = setTimeout(function () {
  65242. that.element.fadeOut(100, function () {that.inner.text('');});
  65243. that.element.unbind('click');
  65244. that.timeout = null;
  65245. }, timeout);
  65246. }
  65247. // if no click callback assume we will just dismiss the notification
  65248. if (click_callback === undefined) {
  65249. click_callback = function(){return true};
  65250. }
  65251. // on click, remove widget if click callback say so
  65252. // and unbind click event.
  65253. this.element.click(function () {
  65254. if (click_callback() !== false) {
  65255. that.element.fadeOut(100, function () {that.inner.text('');});
  65256. that.element.unbind('click');
  65257. }
  65258. if (that.timeout !== null) {
  65259. clearTimeout(that.timeout);
  65260. that.timeout = null;
  65261. }
  65262. });
  65263. };
  65264. /**
  65265. * Display an information message (styled with the 'info'
  65266. * class). Arguments are the same as in set_message. Default
  65267. * timeout is 3500 milliseconds.
  65268. *
  65269. * @method info
  65270. */
  65271. NotificationWidget.prototype.info = function (msg, timeout, click_callback, options) {
  65272. options = options || {};
  65273. options.class = options.class + ' info';
  65274. timeout = timeout || 3500;
  65275. this.set_message(msg, timeout, click_callback, options);
  65276. };
  65277. /**
  65278. * Display a warning message (styled with the 'warning'
  65279. * class). Arguments are the same as in set_message. Messages are
  65280. * sticky by default.
  65281. *
  65282. * @method warning
  65283. */
  65284. NotificationWidget.prototype.warning = function (msg, timeout, click_callback, options) {
  65285. options = options || {};
  65286. options.class = options.class + ' warning';
  65287. this.set_message(msg, timeout, click_callback, options);
  65288. };
  65289. /**
  65290. * Display a danger message (styled with the 'danger'
  65291. * class). Arguments are the same as in set_message. Messages are
  65292. * sticky by default.
  65293. *
  65294. * @method danger
  65295. */
  65296. NotificationWidget.prototype.danger = function (msg, timeout, click_callback, options) {
  65297. options = options || {};
  65298. options.class = options.class + ' danger';
  65299. this.set_message(msg, timeout, click_callback, options);
  65300. };
  65301. /**
  65302. * Get the text of the widget message.
  65303. *
  65304. * @method get_message
  65305. * @return {string} - the message text
  65306. */
  65307. NotificationWidget.prototype.get_message = function () {
  65308. return this.inner.html();
  65309. };
  65310. return {'NotificationWidget': NotificationWidget};
  65311. });
  65312. // Copyright (c) Jupyter Development Team.
  65313. // Distributed under the terms of the Modified BSD License.
  65314. define('base/js/notificationarea',[
  65315. 'jquery',
  65316. 'base/js/notificationwidget',
  65317. ], function($, notificationwidget) {
  65318. "use strict";
  65319. // store reference to the NotificationWidget class
  65320. var NotificationWidget = notificationwidget.NotificationWidget;
  65321. /**
  65322. * Construct the NotificationArea object. Options are:
  65323. * events: $(Events) instance
  65324. * save_widget: SaveWidget instance
  65325. * notebook: Notebook instance
  65326. * keyboard_manager: KeyboardManager instance
  65327. *
  65328. * @constructor
  65329. * @param {string} selector - a jQuery selector string for the
  65330. * notification area element
  65331. * @param {Object} [options] - a dictionary of keyword arguments.
  65332. */
  65333. var NotificationArea = function (selector, options) {
  65334. this.selector = selector;
  65335. this.events = options.events;
  65336. if (this.selector !== undefined) {
  65337. this.element = $(selector);
  65338. }
  65339. this.widget_dict = {};
  65340. };
  65341. /**
  65342. * Get a widget by name, creating it if it doesn't exist.
  65343. *
  65344. * @method widget
  65345. * @param {string} name - the widget name
  65346. */
  65347. NotificationArea.prototype.widget = function (name) {
  65348. if (this.widget_dict[name] === undefined) {
  65349. return this.new_notification_widget(name);
  65350. }
  65351. return this.get_widget(name);
  65352. };
  65353. /**
  65354. * Get a widget by name, throwing an error if it doesn't exist.
  65355. *
  65356. * @method get_widget
  65357. * @param {string} name - the widget name
  65358. */
  65359. NotificationArea.prototype.get_widget = function (name) {
  65360. if(this.widget_dict[name] === undefined) {
  65361. throw new Error('no widgets with this name');
  65362. }
  65363. return this.widget_dict[name];
  65364. };
  65365. /**
  65366. * Create a new notification widget with the given name. The
  65367. * widget must not already exist.
  65368. *
  65369. * @method new_notification_widget
  65370. * @param {string} name - the widget name
  65371. */
  65372. NotificationArea.prototype.new_notification_widget = function (name) {
  65373. if (this.widget_dict[name] !== undefined) {
  65374. throw new Error('widget with that name already exists!');
  65375. }
  65376. // create the element for the notification widget and add it
  65377. // to the notification aread element
  65378. var div = $('<div/>').attr('id', 'notification_' + name);
  65379. $(this.selector).append(div);
  65380. // create the widget object and return it
  65381. this.widget_dict[name] = new NotificationWidget('#notification_' + name);
  65382. return this.widget_dict[name];
  65383. };
  65384. return {'NotificationArea': NotificationArea};
  65385. });
  65386. define('notebook/js/notificationarea',[
  65387. 'jquery',
  65388. 'base/js/utils',
  65389. 'base/js/i18n',
  65390. 'base/js/dialog',
  65391. 'base/js/notificationarea',
  65392. 'moment'
  65393. ], function($, utils, i18n, dialog, notificationarea, moment) {
  65394. "use strict";
  65395. var NotificationArea = notificationarea.NotificationArea;
  65396. var NotebookNotificationArea = function(selector, options) {
  65397. NotificationArea.apply(this, [selector, options]);
  65398. this.save_widget = options.save_widget;
  65399. this.notebook = options.notebook;
  65400. this.keyboard_manager = options.keyboard_manager;
  65401. };
  65402. NotebookNotificationArea.prototype = Object.create(NotificationArea.prototype);
  65403. /**
  65404. * Initialize the default set of notification widgets.
  65405. *
  65406. * @method init_notification_widgets
  65407. */
  65408. NotebookNotificationArea.prototype.init_notification_widgets = function () {
  65409. this.init_kernel_notification_widget();
  65410. this.init_notebook_notification_widget();
  65411. this.init_trusted_notebook_notification_widget();
  65412. };
  65413. /**
  65414. * Initialize the notification widget for kernel status messages.
  65415. *
  65416. * @method init_kernel_notification_widget
  65417. */
  65418. NotebookNotificationArea.prototype.init_kernel_notification_widget = function () {
  65419. var that = this;
  65420. var knw = this.widget('kernel');
  65421. var $kernel_ind_icon = $("#kernel_indicator_icon");
  65422. var $modal_ind_icon = $("#modal_indicator");
  65423. var $readonly_ind_icon = $('#readonly-indicator');
  65424. var $body = $('body');
  65425. var busy_favicon_timer = -1;
  65426. var set_busy_favicon = function(on) {
  65427. if (on) {
  65428. // Only show the busy icon if execution lasts > 1s
  65429. // This is to avoid rapidly switching icons and making lots of
  65430. // HTTP requests.
  65431. clearTimeout(busy_favicon_timer);
  65432. busy_favicon_timer = setTimeout(function() {
  65433. utils.change_favicon('/static/base/images/favicon-busy-1.ico');
  65434. }, 1000);
  65435. } else {
  65436. clearTimeout(busy_favicon_timer);
  65437. utils.change_favicon('/static/base/images/favicon-notebook.ico');
  65438. }
  65439. };
  65440. // Listen for the notebook loaded event. Set readonly indicator.
  65441. this.events.on('notebook_loaded.Notebook', function() {
  65442. if (that.notebook.writable) {
  65443. $readonly_ind_icon.hide();
  65444. } else {
  65445. $readonly_ind_icon.show();
  65446. }
  65447. });
  65448. // Command/Edit mode
  65449. this.events.on('edit_mode.Notebook', function () {
  65450. that.save_widget.update_document_title();
  65451. $body.addClass('edit_mode');
  65452. $body.removeClass('command_mode');
  65453. $modal_ind_icon.attr('title',i18n.msg._('Edit Mode'));
  65454. });
  65455. this.events.on('command_mode.Notebook', function () {
  65456. that.save_widget.update_document_title();
  65457. $body.removeClass('edit_mode');
  65458. $body.addClass('command_mode');
  65459. $modal_ind_icon.attr('title',i18n.msg._('Command Mode'));
  65460. });
  65461. // Implicitly start off in Command mode, switching to Edit mode will trigger event
  65462. $modal_ind_icon.addClass('modal_indicator').attr('title',i18n.msg._('Command Mode'));
  65463. $body.addClass('command_mode');
  65464. // Kernel events
  65465. // this can be either kernel_created.Kernel or kernel_created.Session
  65466. this.events.on('kernel_created.Kernel kernel_created.Session', function () {
  65467. knw.info(i18n.msg._("Kernel Created"), 500);
  65468. });
  65469. this.events.on('kernel_reconnecting.Kernel', function () {
  65470. knw.warning(i18n.msg._("Connecting to kernel"));
  65471. });
  65472. this.events.on('kernel_connection_dead.Kernel', function (evt, info) {
  65473. knw.danger(i18n.msg._("Not Connected"), undefined, function () {
  65474. // schedule reconnect a short time in the future, don't reconnect immediately
  65475. setTimeout($.proxy(info.kernel.reconnect, info.kernel), 500);
  65476. }, {title: i18n.msg._('click to reconnect')});
  65477. });
  65478. this.events.on('kernel_connected.Kernel', function () {
  65479. knw.info("Connected", 500);
  65480. // trigger busy in the status to clear broken-link state immediately
  65481. // a kernel_ready event will come when the kernel becomes responsive.
  65482. $kernel_ind_icon
  65483. .attr('class', 'kernel_busy_icon')
  65484. .attr('title', i18n.msg._('Kernel Connected'));
  65485. });
  65486. this.events.on('kernel_restarting.Kernel', function () {
  65487. that.save_widget.update_document_title();
  65488. knw.set_message(i18n.msg._("Restarting kernel"), 2000);
  65489. });
  65490. this.events.on('kernel_autorestarting.Kernel', function (evt, info) {
  65491. // Only show the dialog on the first restart attempt. This
  65492. // number gets tracked by the `Kernel` object and passed
  65493. // along here, because we don't want to show the user 5
  65494. // dialogs saying the same thing (which is the number of
  65495. // times it tries restarting).
  65496. if (info.attempt === 1) {
  65497. dialog.kernel_modal({
  65498. notebook: that.notebook,
  65499. keyboard_manager: that.keyboard_manager,
  65500. title: i18n.msg._("Kernel Restarting"),
  65501. body: i18n.msg._("The kernel appears to have died. It will restart automatically."),
  65502. buttons: {
  65503. OK : {
  65504. class : "btn-primary"
  65505. }
  65506. }
  65507. });
  65508. }
  65509. that.save_widget.update_document_title();
  65510. knw.danger(i18n.msg._("Dead kernel"));
  65511. $kernel_ind_icon.attr('class','kernel_dead_icon').attr('title',i18n.msg._('Kernel Dead'));
  65512. });
  65513. this.events.on('kernel_interrupting.Kernel', function () {
  65514. knw.set_message(i18n.msg._("Interrupting kernel"), 2000);
  65515. });
  65516. this.events.on('kernel_disconnected.Kernel', function () {
  65517. $kernel_ind_icon
  65518. .attr('class', 'kernel_disconnected_icon')
  65519. .attr('title', i18n.msg._('No Connection to Kernel'));
  65520. });
  65521. this.events.on('kernel_connection_failed.Kernel', function (evt, info) {
  65522. // only show the dialog if this is the first failed
  65523. // connect attempt, because the kernel will continue
  65524. // trying to reconnect and we don't want to spam the user
  65525. // with messages
  65526. if (info.attempt === 1) {
  65527. var msg = i18n.msg._("A connection to the notebook server could not be established." +
  65528. " The notebook will continue trying to reconnect. Check your" +
  65529. " network connection or notebook server configuration.");
  65530. var the_dialog = dialog.kernel_modal({
  65531. title: i18n.msg._("Connection failed"),
  65532. body: msg,
  65533. keyboard_manager: that.keyboard_manager,
  65534. notebook: that.notebook,
  65535. buttons : {
  65536. "OK": {}
  65537. }
  65538. });
  65539. // hide the dialog on reconnect if it's still visible
  65540. var dismiss = function () {
  65541. the_dialog.modal('hide');
  65542. }
  65543. that.events.on("kernel_connected.Kernel", dismiss);
  65544. the_dialog.on("hidden.bs.modal", function () {
  65545. // clear handler on dismiss
  65546. that.events.off("kernel_connected.Kernel", dismiss);
  65547. });
  65548. }
  65549. });
  65550. this.events.on('kernel_killed.Kernel kernel_killed.Session', function () {
  65551. that.save_widget.update_document_title();
  65552. knw.warning(i18n.msg._("No kernel"));
  65553. $kernel_ind_icon.attr('class','kernel_busy_icon').attr('title',i18n.msg._('Kernel is not running'));
  65554. });
  65555. this.events.on('kernel_dead.Kernel', function () {
  65556. // This statement is used simply so that message extraction
  65557. // will pick up the strings. The actual setting of the text
  65558. // for the button is in dialog.js.
  65559. var button_labels = [ i18n.msg._("Don't Restart"), i18n.msg._("Try Restarting Now"), i18n.msg._("OK")];
  65560. var showMsg = function () {
  65561. var msg = i18n.msg._('The kernel has died, and the automatic restart has failed.' +
  65562. ' It is possible the kernel cannot be restarted. ' +
  65563. 'If you are not able to restart the kernel, you will still be able to save' +
  65564. ' the notebook, but running code will no longer work until the notebook' +
  65565. ' is reopened.');
  65566. dialog.kernel_modal({
  65567. title: i18n.msg._("Dead kernel"),
  65568. body : msg,
  65569. keyboard_manager: that.keyboard_manager,
  65570. notebook: that.notebook,
  65571. default_button: "Don't Restart",
  65572. buttons : {
  65573. "Don't Restart": {},
  65574. "Try Restarting Now": {
  65575. class: "btn-danger",
  65576. click: function () {
  65577. that.notebook.start_session();
  65578. }
  65579. }
  65580. }
  65581. });
  65582. return false;
  65583. };
  65584. that.save_widget.update_document_title();
  65585. knw.danger(i18n.msg._("Dead kernel"), undefined, showMsg);
  65586. $kernel_ind_icon.attr('class','kernel_dead_icon').attr('title',i18n.msg._('Kernel Dead'));
  65587. showMsg();
  65588. });
  65589. this.events.on("no_kernel.Kernel", function (evt, data) {
  65590. $("#kernel_indicator").find('.kernel_indicator_name').text(i18n.msg._("No Kernel"));
  65591. });
  65592. this.events.on('kernel_dead.Session', function (evt, info) {
  65593. var full = info.xhr.responseJSON.message;
  65594. var short = info.xhr.responseJSON.short_message || 'Kernel error';
  65595. var traceback = info.xhr.responseJSON.traceback;
  65596. var showMsg = function () {
  65597. var msg = $('<div/>').append($('<p/>').text(full));
  65598. var cm, cm_elem, cm_open;
  65599. if (traceback) {
  65600. cm_elem = $('<div/>')
  65601. .css('margin-top', '1em')
  65602. .css('padding', '1em')
  65603. .addClass('output_scroll');
  65604. msg.append(cm_elem);
  65605. cm = new CodeMirror(cm_elem.get(0), {
  65606. mode: "python",
  65607. readOnly : true
  65608. });
  65609. cm.setValue(traceback);
  65610. cm_open = $.proxy(cm.refresh, cm);
  65611. }
  65612. dialog.kernel_modal({
  65613. title: i18n.msg._("Failed to start the kernel"),
  65614. body : msg,
  65615. keyboard_manager: that.keyboard_manager,
  65616. notebook: that.notebook,
  65617. open: cm_open,
  65618. buttons : {
  65619. "OK": { class: 'btn-primary' }
  65620. }
  65621. });
  65622. return false;
  65623. };
  65624. that.save_widget.update_document_title();
  65625. $kernel_ind_icon.attr('class','kernel_dead_icon').attr('title',i18n.msg._('Kernel Dead'));
  65626. knw.danger(short, undefined, showMsg);
  65627. });
  65628. this.events.on('kernel_starting.Kernel kernel_created.Session', function () {
  65629. // window.document.title='(Starting) '+window.document.title;
  65630. $kernel_ind_icon.attr('class','kernel_busy_icon').attr('title',i18n.msg._('Kernel Busy'));
  65631. knw.set_message(i18n.msg._("Kernel starting, please wait..."));
  65632. set_busy_favicon(true);
  65633. });
  65634. this.events.on('kernel_ready.Kernel', function () {
  65635. // that.save_widget.update_document_title();
  65636. $kernel_ind_icon.attr('class','kernel_idle_icon').attr('title',i18n.msg._('Kernel Idle'));
  65637. knw.info(i18n.msg._("Kernel ready"), 500);
  65638. set_busy_favicon(false);
  65639. });
  65640. this.events.on('kernel_idle.Kernel', function () {
  65641. // that.save_widget.update_document_title();
  65642. $kernel_ind_icon.attr('class','kernel_idle_icon').attr('title',i18n.msg._('Kernel Idle'));
  65643. set_busy_favicon(false);
  65644. });
  65645. this.events.on('kernel_busy.Kernel', function () {
  65646. // window.document.title='(Busy) '+window.document.title;
  65647. $kernel_ind_icon.attr('class','kernel_busy_icon').attr('title',i18n.msg._('Kernel Busy'));
  65648. set_busy_favicon(true);
  65649. });
  65650. this.events.on('spec_match_found.Kernel', function (evt, data) {
  65651. that.widget('kernelspec').info(i18n.msg._("Using kernel: ") + data.found.spec.display_name, 3000, undefined, {
  65652. title: i18n.msg.sprintf(i18n.msg._("Only candidate for language: %1$s was %2$s."),
  65653. data.selected.language, data.found.spec.display_name)
  65654. });
  65655. });
  65656. // Start the kernel indicator in the busy state, and send a kernel_info request.
  65657. // When the kernel_info reply arrives, the kernel is idle.
  65658. $kernel_ind_icon.attr('class','kernel_busy_icon').attr('title',i18n.msg._('Kernel Busy'));
  65659. };
  65660. /**
  65661. * Initialize the notification widget for notebook status messages.
  65662. *
  65663. * @method init_notebook_notification_widget
  65664. */
  65665. NotebookNotificationArea.prototype.init_notebook_notification_widget = function () {
  65666. var nnw = this.widget('notebook');
  65667. // Notebook events
  65668. this.events.on('notebook_loading.Notebook', function () {
  65669. nnw.set_message(i18n.msg._("Loading notebook"),500);
  65670. });
  65671. this.events.on('notebook_loaded.Notebook', function () {
  65672. nnw.set_message(i18n.msg._("Notebook loaded"),500);
  65673. });
  65674. this.events.on('notebook_saving.Notebook', function () {
  65675. nnw.set_message(i18n.msg._("Saving notebook"),500);
  65676. });
  65677. this.events.on('notebook_saved.Notebook', function () {
  65678. nnw.set_message(i18n.msg._("Notebook saved"),2000);
  65679. });
  65680. this.events.on('notebook_save_failed.Notebook', function (evt, error) {
  65681. nnw.warning(error.message || i18n.msg._("Notebook save failed"));
  65682. });
  65683. this.events.on('notebook_copy_failed.Notebook', function (evt, error) {
  65684. nnw.warning(error.message || i18n.msg._("Notebook copy failed"));
  65685. });
  65686. // Checkpoint events
  65687. this.events.on('checkpoint_created.Notebook', function (evt, data) {
  65688. var msg = i18n.msg._("Checkpoint created");
  65689. if (data.last_modified) {
  65690. var d = new Date(data.last_modified);
  65691. msg = msg + ": " + moment(d).format("HH:mm:ss");
  65692. }
  65693. nnw.set_message(msg, 2000);
  65694. });
  65695. this.events.on('checkpoint_failed.Notebook', function () {
  65696. nnw.warning(i18n.msg._("Checkpoint failed"));
  65697. });
  65698. this.events.on('checkpoint_deleted.Notebook', function () {
  65699. nnw.set_message(i18n.msg._("Checkpoint deleted"), 500);
  65700. });
  65701. this.events.on('checkpoint_delete_failed.Notebook', function () {
  65702. nnw.warning(i18n.msg._("Checkpoint delete failed"));
  65703. });
  65704. this.events.on('checkpoint_restoring.Notebook', function () {
  65705. nnw.set_message(i18n.msg._("Restoring to checkpoint..."), 500);
  65706. });
  65707. this.events.on('checkpoint_restore_failed.Notebook', function () {
  65708. nnw.warning(i18n.msg._("Checkpoint restore failed"));
  65709. });
  65710. // Autosave events
  65711. this.events.on('autosave_disabled.Notebook', function () {
  65712. nnw.set_message(i18n.msg._("Autosave disabled"), 2000);
  65713. });
  65714. this.events.on('autosave_enabled.Notebook', function (evt, interval) {
  65715. nnw.set_message(i18n.msg.sprintf(i18n.msg._("Saving every %d sec."), interval / 1000) , 1000);
  65716. });
  65717. };
  65718. /**
  65719. * Initialize the notification widget for trusted notebook messages.
  65720. *
  65721. * @method init_trusted_notebook_notification_widget
  65722. */
  65723. NotebookNotificationArea.prototype.init_trusted_notebook_notification_widget = function () {
  65724. var that = this;
  65725. var tnw = this.widget('trusted');
  65726. // Notebook trust events
  65727. this.events.on('trust_changed.Notebook', function (event, trusted) {
  65728. if (trusted) {
  65729. tnw.set_message(i18n.msg._("Trusted"), undefined, function() {
  65730. return false;
  65731. }, {'title':'Javascript enabled for notebook display'});
  65732. // don't allow 'Trusted' button to be clicked
  65733. $(tnw.selector).attr('disabled', true);
  65734. $(tnw.selector).css('cursor', 'help');
  65735. } else {
  65736. tnw.set_message(i18n.msg._("Not Trusted"), undefined, function() {
  65737. that.notebook.trust_notebook("#notification_trusted");
  65738. return false;
  65739. }, {'title':'Javascript disabled for notebook display'});
  65740. $(tnw.selector).attr('role', 'button');
  65741. }
  65742. });
  65743. };
  65744. return {'NotebookNotificationArea': NotebookNotificationArea};
  65745. });
  65746. // Copyright (c) Jupyter Development Team.
  65747. // Distributed under the terms of the Modified BSD License.
  65748. define('notebook/js/savewidget',[
  65749. 'jquery',
  65750. 'base/js/utils',
  65751. 'base/js/i18n',
  65752. 'base/js/dialog',
  65753. 'base/js/keyboard',
  65754. 'moment',
  65755. 'bidi/bidi',
  65756. ], function($, utils, i18n, dialog, keyboard, moment, bidi) {
  65757. "use strict";
  65758. var SaveWidget = function (selector, options) {
  65759. /**
  65760. * TODO: Remove circular ref.
  65761. */
  65762. this.notebook = undefined;
  65763. this.selector = selector;
  65764. this.events = options.events;
  65765. this._checkpoint_date = undefined;
  65766. this.keyboard_manager = options.keyboard_manager;
  65767. if (this.selector !== undefined) {
  65768. this.element = $(selector);
  65769. this.bind_events();
  65770. }
  65771. };
  65772. SaveWidget.prototype.bind_events = function () {
  65773. var that = this;
  65774. this.element.find('span.filename').click(function () {
  65775. that.rename_notebook({notebook: that.notebook});
  65776. });
  65777. this.events.on('notebook_loaded.Notebook', function () {
  65778. that.update_notebook_name();
  65779. that.update_document_title();
  65780. });
  65781. this.events.on('notebook_saved.Notebook', function () {
  65782. that.update_notebook_name();
  65783. that.update_document_title();
  65784. });
  65785. this.events.on('notebook_renamed.Notebook', function () {
  65786. that.update_notebook_name();
  65787. that.update_document_title();
  65788. that.update_address_bar();
  65789. });
  65790. this.events.on('notebook_save_failed.Notebook', function () {
  65791. that.set_save_status(i18n.msg._('Autosave Failed!'));
  65792. });
  65793. this.events.on('notebook_read_only.Notebook', function () {
  65794. that.set_save_status('(read only)');
  65795. // disable future set_save_status
  65796. that.set_save_status = function () {};
  65797. });
  65798. this.events.on('checkpoints_listed.Notebook', function (event, data) {
  65799. that._set_last_checkpoint(data[0]);
  65800. });
  65801. this.events.on('checkpoint_created.Notebook', function (event, data) {
  65802. that._set_last_checkpoint(data);
  65803. });
  65804. this.events.on('set_dirty.Notebook', function (event, data) {
  65805. that.set_autosaved(data.value);
  65806. });
  65807. };
  65808. // This statement is used simply so that message extraction
  65809. // will pick up the strings. The actual setting of the text
  65810. // for the button is in dialog.js.
  65811. var button_labels = [ i18n.msg._("Cancel"), i18n.msg._("Rename"), i18n.msg._("OK")];
  65812. SaveWidget.prototype.rename_notebook = function (options) {
  65813. options = options || {};
  65814. var that = this;
  65815. var dialog_body = $('<div/>').append(
  65816. $("<p/>").addClass("rename-message")
  65817. .text(i18n.msg._('Enter a new notebook name:'))
  65818. ).append(
  65819. $("<br/>")
  65820. ).append(
  65821. $('<input/>').attr('type','text').attr('size','25').addClass('form-control')
  65822. .val(options.notebook.get_notebook_name())
  65823. );
  65824. var d = dialog.modal({
  65825. title: i18n.msg._("Rename Notebook"),
  65826. body: dialog_body,
  65827. notebook: options.notebook,
  65828. keyboard_manager: this.keyboard_manager,
  65829. default_button: "Cancel",
  65830. buttons : {
  65831. "Cancel": {},
  65832. "Rename": {
  65833. class: "btn-primary",
  65834. click: function () {
  65835. var new_name = d.find('input').val();
  65836. if (!options.notebook.test_notebook_name(new_name)) {
  65837. d.find('.rename-message').text(i18n.msg._(
  65838. "Invalid notebook name. Notebook names must have 1 or more characters and can contain any characters except :/\\. Please enter a new notebook name:")
  65839. );
  65840. return false;
  65841. } else {
  65842. d.find('.rename-message').text(i18n.msg._("Renaming..."));
  65843. d.find('input[type="text"]').prop('disabled', true);
  65844. that.notebook.rename(new_name).then(
  65845. function () {
  65846. d.modal('hide');
  65847. }, function (error) {
  65848. d.find('.rename-message').text(error.message || i18n.msg._('Unknown error'));
  65849. d.find('input[type="text"]').prop('disabled', false).focus().select();
  65850. }
  65851. );
  65852. return false;
  65853. }
  65854. }
  65855. }
  65856. },
  65857. open : function () {
  65858. /**
  65859. * Upon ENTER, click the OK button.
  65860. */
  65861. d.find('input[type="text"]').keydown(function (event) {
  65862. if (event.which === keyboard.keycodes.enter) {
  65863. d.find('.btn-primary').first().click();
  65864. return false;
  65865. }
  65866. });
  65867. d.find('input[type="text"]').focus().select();
  65868. }
  65869. });
  65870. };
  65871. SaveWidget.prototype.update_notebook_name = function () {
  65872. var nbname = this.notebook.get_notebook_name();
  65873. nbname = bidi.applyBidi(nbname);
  65874. this.element.find('span.filename').text(nbname);
  65875. };
  65876. SaveWidget.prototype.update_document_title = function () {
  65877. var nbname = this.notebook.get_notebook_name();
  65878. document.title = nbname + ' - Jupyter Notebook';
  65879. };
  65880. SaveWidget.prototype.update_address_bar = function(){
  65881. var base_url = this.notebook.base_url;
  65882. var path = this.notebook.notebook_path;
  65883. var state = {path : path};
  65884. window.history.replaceState(state, "", utils.url_path_join(
  65885. base_url,
  65886. "notebooks",
  65887. utils.encode_uri_components(path))
  65888. );
  65889. };
  65890. SaveWidget.prototype.set_save_status = function (msg) {
  65891. this.element.find('span.autosave_status').text(msg);
  65892. };
  65893. SaveWidget.prototype._set_last_checkpoint = function (checkpoint) {
  65894. if (checkpoint) {
  65895. this._checkpoint_date = new Date(checkpoint.last_modified);
  65896. } else {
  65897. this._checkpoint_date = null;
  65898. }
  65899. this._render_checkpoint();
  65900. };
  65901. SaveWidget.prototype._render_checkpoint = function () {
  65902. /** actually set the text in the element, from our _checkpoint value
  65903. called directly, and periodically in timeouts.
  65904. */
  65905. this._schedule_render_checkpoint();
  65906. var el = this.element.find('span.checkpoint_status');
  65907. if (!this._checkpoint_date) {
  65908. el.text('').attr('title', i18n.msg._('no checkpoint'));
  65909. return;
  65910. }
  65911. var chkd = moment(this._checkpoint_date);
  65912. var long_date = chkd.format('llll');
  65913. var human_date;
  65914. var tdelta = Math.ceil(new Date() - this._checkpoint_date);
  65915. if (tdelta < utils.time.milliseconds.d){
  65916. // less than 24 hours old, use relative date
  65917. human_date = chkd.fromNow();
  65918. } else {
  65919. // otherwise show calendar
  65920. // <Today | yesterday|...> at hh,mm,ss
  65921. human_date = chkd.calendar();
  65922. }
  65923. el.text(i18n.msg.sprintf(i18n.msg._('Last Checkpoint: %s'),human_date)).attr('title', long_date);
  65924. };
  65925. SaveWidget.prototype._schedule_render_checkpoint = function () {
  65926. /** schedule the next update to relative date
  65927. periodically updated, so short values like 'a few seconds ago' don't get stale.
  65928. */
  65929. if (!this._checkpoint_date) {
  65930. return;
  65931. }
  65932. if ((this._checkpoint_timeout)) {
  65933. clearTimeout(this._checkpoint_timeout);
  65934. }
  65935. var dt = Math.ceil(new Date() - this._checkpoint_date);
  65936. this._checkpoint_timeout = setTimeout(
  65937. $.proxy(this._render_checkpoint, this),
  65938. utils.time.timeout_from_dt(dt)
  65939. );
  65940. };
  65941. SaveWidget.prototype.set_autosaved = function (dirty) {
  65942. if (dirty) {
  65943. this.set_save_status(i18n.msg._("(unsaved changes)"));
  65944. } else {
  65945. this.set_save_status(i18n.msg._("(autosaved)"));
  65946. }
  65947. };
  65948. return {'SaveWidget': SaveWidget};
  65949. });
  65950. // Copyright (c) Jupyter Development Team.
  65951. // Distributed under the terms of the Modified BSD License.
  65952. // How to pick action names:
  65953. //
  65954. // * First pick a noun and a verb for the action. For example, if the action is "restart kernel," the verb is
  65955. // "restart" and the noun is "kernel".
  65956. // * Omit terms like "selected" and "active" by default, so "delete-cell", rather than "delete-selected-cell".
  65957. // Only provide a scope like "-all-" if it is other than the default "selected" or "active" scope.
  65958. // * If an action has a secondary action, separate the secondary action with "-and-", so
  65959. // "restart-kernel-and-clear-output".
  65960. // * Don't ever use before/after as they have a temporal connotation that is confusing when used in a spatial
  65961. // context.
  65962. // * Use above/below or previous/next to indicate spacial and sequential relationships.
  65963. // * For dialogs, use a verb that indicates what the dialog will accomplish, such as "confirm-restart-kernel".
  65964. define('notebook/js/actions',[
  65965. 'base/js/i18n',
  65966. ], function(i18n){
  65967. "use strict";
  65968. var warn_bad_name = function(name){
  65969. if(name !== "" && !name.match(/:/)){
  65970. console.warn('You are trying to use an action/command name, where the separator between prefix and name is not `:`\n'+
  65971. '"'+name+'"\n'+
  65972. 'You are likely to not use the API in a correct way. Typically use the following:\n'+
  65973. '`var key = actions.register(<object>, "<name>", "<prefix>");` and reuse the `key` variable'+
  65974. 'instead of re-generating the key yourself.'
  65975. );
  65976. }
  65977. };
  65978. var ActionHandler = function (env) {
  65979. this.env = env || {};
  65980. Object.seal(this);
  65981. };
  65982. var $ = requirejs('jquery');
  65983. var events = requirejs('base/js/events');
  65984. /**
  65985. * A bunch of predefined `Simple Actions` used by Jupyter.
  65986. * `Simple Actions` have the following keys:
  65987. * help (optional): a short string the describe the action.
  65988. * will be used in various context, like as menu name, tool tips on buttons,
  65989. * and short description in help menu.
  65990. * help_index (optional): a string used to sort action in help menu.
  65991. * icon (optional): a short string that represent the icon that have to be used with this
  65992. * action. this should mainly correspond to a Font_awesome class.
  65993. * handler : a function which is called when the action is activated. It will receive at first parameter
  65994. * a dictionary containing various handle to element of the notebook.
  65995. *
  65996. * action need to be registered with a **name** that can be use to refer to this action.
  65997. *
  65998. * if `help` is not provided it will be derived by replacing any dash by space
  65999. * in the **name** of the action. It is advised to provide a prefix to action name to
  66000. * avoid conflict the prefix should be all lowercase and end with a dot `.`
  66001. * in the absence of a prefix the behavior of the action is undefined.
  66002. *
  66003. * All action provided by the Jupyter notebook are prefixed with `jupyter-notebook:`.
  66004. *
  66005. * One can register extra actions or replace an existing action with another one is possible
  66006. * but is considered undefined behavior.
  66007. *
  66008. **/
  66009. var _actions = {
  66010. 'toggle-cell-rtl-layout': {
  66011. cmd: i18n.msg._('toggle current cell ltr/rtl direction'),
  66012. help: i18n.msg._('Toggle current cell directionality between left-to-right and right-to-left'),
  66013. handler: function (env) {
  66014. var notebook_direction = document.body.getAttribute('dir') == 'rtl' ? 'rtl' : 'ltr';
  66015. var current_cell_default_direction = env.notebook.get_selected_cell().cell_type == 'code' ? 'ltr' : notebook_direction;
  66016. var current_cell_direction = env.notebook.get_selected_cell().metadata.direction || current_cell_default_direction;
  66017. var new_direction = current_cell_direction == 'rtl' ? 'ltr' : 'rtl';
  66018. env.notebook.get_selected_cells().forEach(
  66019. function(cell) { cell.metadata.direction = new_direction; }
  66020. );
  66021. env.notebook.set_dirty(true);
  66022. env.notebook.apply_directionality();
  66023. }
  66024. },
  66025. 'toggle-rtl-layout': {
  66026. cmd: i18n.msg._('toggle notebook ltr/rtl direction'),
  66027. help: i18n.msg._('Toggle notebook directionality between left-to-right and right-to-left'),
  66028. handler: function (env) {
  66029. var new_direction = document.body.getAttribute('dir') == 'rtl' ? 'ltr' : 'rtl';
  66030. env.notebook.metadata.direction = new_direction;
  66031. env.notebook.set_dirty(true);
  66032. env.notebook.apply_directionality();
  66033. }
  66034. },
  66035. 'edit-command-mode-keyboard-shortcuts': {
  66036. cmd: i18n.msg._('edit command mode keyboard shortcuts'),
  66037. help: i18n.msg._('Open a dialog to edit the command mode keyboard shortcuts'),
  66038. handler: function (env) {
  66039. env.notebook.show_shortcuts_editor();
  66040. }
  66041. },
  66042. 'shutdown-kernel': {
  66043. help: 'Shutdown the kernel (no confirmation dialog)',
  66044. handler: function (env) {
  66045. env.notebook.shutdown_kernel({confirm: false});
  66046. }
  66047. },
  66048. 'confirm-shutdown-kernel':{
  66049. icon: 'fa-repeat',
  66050. help_index : 'hb',
  66051. help: 'Shutdown the kernel (with confirmation dialog)',
  66052. handler : function (env) {
  66053. env.notebook.shutdown_kernel();
  66054. }
  66055. },
  66056. 'restart-kernel': {
  66057. cmd: i18n.msg._('restart kernel'),
  66058. help: i18n.msg._('restart the kernel (no confirmation dialog)'),
  66059. handler: function (env) {
  66060. env.notebook.restart_kernel({confirm: false});
  66061. },
  66062. },
  66063. 'confirm-restart-kernel':{
  66064. icon: 'fa-repeat',
  66065. help_index : 'hb',
  66066. cmd: i18n.msg._('confirm restart kernel'),
  66067. help: i18n.msg._('restart the kernel (with dialog)'),
  66068. handler : function (env) {
  66069. env.notebook.restart_kernel();
  66070. }
  66071. },
  66072. 'restart-kernel-and-run-all-cells': {
  66073. cmd: i18n.msg._('restart kernel and run all cells'),
  66074. help: i18n.msg._('restart the kernel, then re-run the whole notebook (no confirmation dialog)'),
  66075. handler: function (env) {
  66076. env.notebook.restart_run_all({confirm: false});
  66077. }
  66078. },
  66079. 'confirm-restart-kernel-and-run-all-cells': {
  66080. icon: 'fa-forward',
  66081. cmd: i18n.msg._('confirm restart kernel and run all cells'),
  66082. help: i18n.msg._('restart the kernel, then re-run the whole notebook (with dialog)'),
  66083. handler: function (env) {
  66084. env.notebook.restart_run_all();
  66085. }
  66086. },
  66087. 'restart-kernel-and-clear-output': {
  66088. cmd: i18n.msg._('restart kernel and clear output'),
  66089. help: i18n.msg._('restart the kernel and clear all output (no confirmation dialog)'),
  66090. handler: function (env) {
  66091. env.notebook.restart_clear_output({confirm: false});
  66092. }
  66093. },
  66094. 'confirm-restart-kernel-and-clear-output': {
  66095. cmd: i18n.msg._('confirm restart kernel and clear output'),
  66096. help: i18n.msg._('restart the kernel and clear all output (with dialog)'),
  66097. handler: function (env) {
  66098. env.notebook.restart_clear_output();
  66099. }
  66100. },
  66101. 'interrupt-kernel':{
  66102. icon: 'fa-stop',
  66103. cmd: i18n.msg._('interrupt the kernel'),
  66104. help: i18n.msg._('interrupt the kernel'),
  66105. help_index : 'ha',
  66106. handler : function (env) {
  66107. env.notebook.kernel.interrupt();
  66108. }
  66109. },
  66110. 'run-cell-and-select-next': {
  66111. cmd: i18n.msg._('run cell and select next'),
  66112. icon: 'fa-play',
  66113. help: i18n.msg._('run cell, select below'),
  66114. help_index : 'ba',
  66115. handler : function (env) {
  66116. env.notebook.execute_cell_and_select_below();
  66117. }
  66118. },
  66119. 'run-cell':{
  66120. cmd: i18n.msg._('run selected cells'),
  66121. help : i18n.msg._('run selected cells'),
  66122. help_index : 'bb',
  66123. handler : function (env) {
  66124. env.notebook.execute_selected_cells();
  66125. }
  66126. },
  66127. 'run-cell-and-insert-below':{
  66128. cmd: i18n.msg._('run cell and insert below'),
  66129. help : i18n.msg._('run cell and insert below'),
  66130. help_index : 'bc',
  66131. handler : function (env) {
  66132. env.notebook.execute_cell_and_insert_below();
  66133. }
  66134. },
  66135. 'run-all-cells': {
  66136. cmd: i18n.msg._('run all cells'),
  66137. help: i18n.msg._('run all cells'),
  66138. help_index: 'bd',
  66139. handler: function (env) {
  66140. env.notebook.execute_all_cells();
  66141. }
  66142. },
  66143. 'run-all-cells-above':{
  66144. cmd: i18n.msg._('run all cells above'),
  66145. help: i18n.msg._('run all cells above'),
  66146. handler : function (env) {
  66147. env.notebook.execute_cells_above();
  66148. }
  66149. },
  66150. 'run-all-cells-below':{
  66151. cmd: i18n.msg._('run all cells below'),
  66152. help: i18n.msg._('run all cells below'),
  66153. handler : function (env) {
  66154. env.notebook.execute_cells_below();
  66155. }
  66156. },
  66157. 'enter-command-mode': {
  66158. cmd: i18n.msg._('enter command mode'),
  66159. help : i18n.msg._('enter command mode'),
  66160. help_index : 'aa',
  66161. handler : function (env) {
  66162. env.notebook.command_mode();
  66163. }
  66164. },
  66165. 'insert-image': {
  66166. cmd: i18n.msg._('insert image'),
  66167. help : i18n.msg._('insert image'),
  66168. help_index : 'dz',
  66169. handler : function (env) {
  66170. env.notebook.insert_image();
  66171. }
  66172. },
  66173. 'cut-cell-attachments': {
  66174. cmd: i18n.msg._('cut cell attachments'),
  66175. help : i18n.msg._('cut cell attachments'),
  66176. help_index : 'dza',
  66177. handler: function (env) {
  66178. env.notebook.cut_cell_attachments();
  66179. }
  66180. },
  66181. 'copy-cell-attachments': {
  66182. cmd: i18n.msg._('copy cell attachments'),
  66183. help : i18n.msg._('copy cell attachments'),
  66184. help_index: 'dzb',
  66185. handler: function (env) {
  66186. env.notebook.copy_cell_attachments();
  66187. }
  66188. },
  66189. 'paste-cell-attachments': {
  66190. cmd: i18n.msg._('paste cell attachments'),
  66191. help : i18n.msg._('paste cell attachments'),
  66192. help_index: 'dzc',
  66193. handler: function (env) {
  66194. env.notebook.paste_cell_attachments();
  66195. }
  66196. },
  66197. 'split-cell-at-cursor': {
  66198. cmd: i18n.msg._('split cell at cursor(s)'),
  66199. help : i18n.msg._('split cell at cursor(s)'),
  66200. help_index : 'ea',
  66201. handler : function (env) {
  66202. env.notebook.split_cell();
  66203. }
  66204. },
  66205. 'enter-edit-mode' : {
  66206. cmd: i18n.msg._('enter edit mode'),
  66207. help : i18n.msg._('enter edit mode'),
  66208. help_index : 'aa',
  66209. handler : function (env) {
  66210. env.notebook.edit_mode();
  66211. }
  66212. },
  66213. 'select-previous-cell' : {
  66214. cmd: i18n.msg._('select previous cell'),
  66215. help: i18n.msg._('select cell above'),
  66216. help_index : 'da',
  66217. handler : function (env) {
  66218. var index = env.notebook.get_selected_index();
  66219. if (index !== 0 && index !== null) {
  66220. env.notebook.select_prev(true);
  66221. env.notebook.focus_cell();
  66222. }
  66223. }
  66224. },
  66225. 'select-next-cell' : {
  66226. cmd: i18n.msg._('select next cell'),
  66227. help: i18n.msg._('select cell below'),
  66228. help_index : 'db',
  66229. handler : function (env) {
  66230. var index = env.notebook.get_selected_index();
  66231. if (index !== (env.notebook.ncells()-1) && index !== null) {
  66232. env.notebook.select_next(true);
  66233. env.notebook.focus_cell();
  66234. }
  66235. }
  66236. },
  66237. 'extend-selection-above' : {
  66238. cmd: i18n.msg._('extend selection above'),
  66239. help: i18n.msg._('extend selected cells above'),
  66240. help_index : 'dc',
  66241. handler : function (env) {
  66242. env.notebook.extend_selection_by(-1);
  66243. // scroll into view,
  66244. // do not call notebook.focus_cell(), or
  66245. // all the selection get thrown away
  66246. env.notebook.get_selected_cell().element.focus();
  66247. }
  66248. },
  66249. 'extend-selection-below' : {
  66250. cmd: i18n.msg._('extend selection below'),
  66251. help: i18n.msg._('extend selected cells below'),
  66252. help_index : 'dd',
  66253. handler : function (env) {
  66254. env.notebook.extend_selection_by(1);
  66255. // scroll into view,
  66256. // do not call notebook.focus_cell(), or
  66257. // all the selection get thrown away
  66258. env.notebook.get_selected_cell().element.focus();
  66259. }
  66260. },
  66261. 'select-all' : {
  66262. cmd: i18n.msg._('select all'),
  66263. help: i18n.msg._('select all cells'),
  66264. help_index : 'de',
  66265. handler : function (env) {
  66266. env.notebook.select_all();
  66267. env.notebook.get_selected_cell().element.focus();
  66268. }
  66269. },
  66270. 'cut-cell' : {
  66271. cmd: i18n.msg._('cut selected cells'),
  66272. help: i18n.msg._('cut selected cells'),
  66273. icon: 'fa-cut',
  66274. help_index : 'ee',
  66275. handler : function (env) {
  66276. var index = env.notebook.get_selected_index();
  66277. env.notebook.cut_cell();
  66278. env.notebook.select(index);
  66279. }
  66280. },
  66281. 'copy-cell' : {
  66282. cmd: i18n.msg._('copy selected cells'),
  66283. help: i18n.msg._('copy selected cells'),
  66284. icon: 'fa-copy',
  66285. help_index : 'ef',
  66286. handler : function (env) {
  66287. env.notebook.copy_cell();
  66288. }
  66289. },
  66290. 'paste-cell-replace' : {
  66291. help: 'paste cells replace',
  66292. handler : function (env) {
  66293. env.notebook.paste_cell_replace();
  66294. }
  66295. },
  66296. 'paste-cell-above' : {
  66297. cmd: i18n.msg._('paste cells above'),
  66298. help: i18n.msg._('paste cells above'),
  66299. help_index : 'eg',
  66300. handler : function (env) {
  66301. env.notebook.paste_cell_above();
  66302. }
  66303. },
  66304. 'paste-cell-below' : {
  66305. cmd: i18n.msg._('paste cells below'),
  66306. help: i18n.msg._('paste cells below'),
  66307. icon: 'fa-paste',
  66308. help_index : 'eh',
  66309. handler : function (env) {
  66310. env.notebook.paste_cell_below();
  66311. }
  66312. },
  66313. 'insert-cell-above' : {
  66314. cmd: i18n.msg._('insert cell above'),
  66315. help: i18n.msg._('insert cell above'),
  66316. help_index : 'ec',
  66317. handler : function (env) {
  66318. env.notebook.insert_cell_above();
  66319. env.notebook.select_prev(true);
  66320. env.notebook.focus_cell();
  66321. }
  66322. },
  66323. 'insert-cell-below' : {
  66324. cmd: i18n.msg._('insert cell below'),
  66325. help: i18n.msg._('insert cell below'),
  66326. icon : 'fa-plus',
  66327. help_index : 'ed',
  66328. handler : function (env) {
  66329. env.notebook.insert_cell_below();
  66330. env.notebook.select_next(true);
  66331. env.notebook.focus_cell();
  66332. }
  66333. },
  66334. 'change-cell-to-code' : {
  66335. cmd: i18n.msg._('change cell to code'),
  66336. help : i18n.msg._('change cell to code'),
  66337. help_index : 'ca',
  66338. handler : function (env) {
  66339. env.notebook.cells_to_code();
  66340. }
  66341. },
  66342. 'change-cell-to-markdown' : {
  66343. cmd: i18n.msg._('change cell to markdown'),
  66344. help : i18n.msg._('change cell to markdown'),
  66345. help_index : 'cb',
  66346. handler : function (env) {
  66347. env.notebook.cells_to_markdown();
  66348. }
  66349. },
  66350. 'change-cell-to-raw' : {
  66351. cmd: i18n.msg._('change cell to raw'),
  66352. help : i18n.msg._('change cell to raw'),
  66353. help_index : 'cc',
  66354. handler : function (env) {
  66355. env.notebook.cells_to_raw();
  66356. }
  66357. },
  66358. 'change-cell-to-heading-1' : {
  66359. cmd: i18n.msg._('change cell to heading 1'),
  66360. help : i18n.msg._('change cell to heading 1'),
  66361. help_index : 'cd',
  66362. handler : function (env) {
  66363. env.notebook.to_heading(undefined, 1);
  66364. }
  66365. },
  66366. 'change-cell-to-heading-2' : {
  66367. cmd: i18n.msg._('change cell to heading 2'),
  66368. help : i18n.msg._('change cell to heading 2'),
  66369. help_index : 'ce',
  66370. handler : function (env) {
  66371. env.notebook.to_heading(undefined, 2);
  66372. }
  66373. },
  66374. 'change-cell-to-heading-3' : {
  66375. cmd: i18n.msg._('change cell to heading 3'),
  66376. help : i18n.msg._('change cell to heading 3'),
  66377. help_index : 'cf',
  66378. handler : function (env) {
  66379. env.notebook.to_heading(undefined, 3);
  66380. }
  66381. },
  66382. 'change-cell-to-heading-4' : {
  66383. cmd: i18n.msg._('change cell to heading 4'),
  66384. help : i18n.msg._('change cell to heading 4'),
  66385. help_index : 'cg',
  66386. handler : function (env) {
  66387. env.notebook.to_heading(undefined, 4);
  66388. }
  66389. },
  66390. 'change-cell-to-heading-5' : {
  66391. cmd: i18n.msg._('change cell to heading 5'),
  66392. help : i18n.msg._('change cell to heading 5'),
  66393. help_index : 'ch',
  66394. handler : function (env) {
  66395. env.notebook.to_heading(undefined, 5);
  66396. }
  66397. },
  66398. 'change-cell-to-heading-6' : {
  66399. cmd: i18n.msg._('change cell to heading 6'),
  66400. help : i18n.msg._('change cell to heading 6'),
  66401. help_index : 'ci',
  66402. handler : function (env) {
  66403. env.notebook.to_heading(undefined, 6);
  66404. }
  66405. },
  66406. 'toggle-cell-output-collapsed' : {
  66407. cmd: i18n.msg._('toggle cell output'),
  66408. help : i18n.msg._('toggle output of selected cells'),
  66409. help_index : 'gb',
  66410. handler : function (env) {
  66411. env.notebook.toggle_cells_outputs();
  66412. }
  66413. },
  66414. 'toggle-cell-output-scrolled' : {
  66415. cmd: i18n.msg._('toggle cell scrolling'),
  66416. help : i18n.msg._('toggle output scrolling of selected cells'),
  66417. help_index : 'gc',
  66418. handler : function (env) {
  66419. env.notebook.toggle_cells_outputs_scroll();
  66420. }
  66421. },
  66422. 'clear-cell-output' : {
  66423. cmd: i18n.msg._('clear cell output'),
  66424. help : i18n.msg._('clear output of selected cells'),
  66425. handler : function (env) {
  66426. env.notebook.clear_cells_outputs();
  66427. }
  66428. },
  66429. 'move-cell-down' : {
  66430. cmd: i18n.msg._('move cells down'),
  66431. help: i18n.msg._('move selected cells down'),
  66432. icon: 'fa-arrow-down',
  66433. help_index : 'eb',
  66434. handler : function (env) {
  66435. env.notebook.move_cell_down();
  66436. }
  66437. },
  66438. 'move-cell-up' : {
  66439. cmd: i18n.msg._('move cells up'),
  66440. help: i18n.msg._('move selected cells up'),
  66441. icon: 'fa-arrow-up',
  66442. help_index : 'ea',
  66443. handler : function (env) {
  66444. env.notebook.move_cell_up();
  66445. }
  66446. },
  66447. 'toggle-cell-line-numbers' : {
  66448. cmd: i18n.msg._('toggle line numbers'),
  66449. help : i18n.msg._('toggle line numbers'),
  66450. help_index : 'ga',
  66451. handler : function (env) {
  66452. env.notebook.cell_toggle_line_numbers();
  66453. }
  66454. },
  66455. 'show-keyboard-shortcuts' : {
  66456. cmd: i18n.msg._('show keyboard shortcuts'),
  66457. help : i18n.msg._('show keyboard shortcuts'),
  66458. help_index : 'ge',
  66459. handler : function (env) {
  66460. env.quick_help.show_keyboard_shortcuts();
  66461. }
  66462. },
  66463. 'delete-cell': {
  66464. cmd: i18n.msg._('delete cells'),
  66465. help: i18n.msg._('delete selected cells'),
  66466. help_index : 'ej',
  66467. handler : function (env) {
  66468. env.notebook.delete_cell();
  66469. }
  66470. },
  66471. 'undo-cell-deletion' : {
  66472. cmd: i18n.msg._('undo cell deletion'),
  66473. help: i18n.msg._('undo cell deletion'),
  66474. help_index : 'ei',
  66475. handler : function (env) {
  66476. env.notebook.undelete_cell();
  66477. }
  66478. },
  66479. // TODO reminder
  66480. // open an issue, merge with above merge with last cell of notebook if at top.
  66481. 'merge-cell-with-previous-cell' : {
  66482. cmd: i18n.msg._('merge cell with previous cell'),
  66483. help : i18n.msg._('merge cell above'),
  66484. handler : function (env) {
  66485. env.notebook.merge_cell_above();
  66486. }
  66487. },
  66488. 'merge-cell-with-next-cell' : {
  66489. cmd: i18n.msg._('merge cell with next cell'),
  66490. help : i18n.msg._('merge cell below'),
  66491. help_index : 'ek',
  66492. handler : function (env) {
  66493. env.notebook.merge_cell_below();
  66494. }
  66495. },
  66496. 'merge-selected-cells' : {
  66497. cmd: i18n.msg._('merge selected cells'),
  66498. help : i18n.msg._('merge selected cells'),
  66499. help_index: 'el',
  66500. handler: function(env) {
  66501. env.notebook.merge_selected_cells();
  66502. }
  66503. },
  66504. 'merge-cells' : {
  66505. cmd: i18n.msg._('merge cells'),
  66506. help : i18n.msg._('merge selected cells, or current cell with cell below if only one cell is selected'),
  66507. help_index: 'el',
  66508. handler: function(env) {
  66509. var l = env.notebook.get_selected_cells_indices().length;
  66510. if(l == 1){
  66511. env.notebook.merge_cell_below();
  66512. } else {
  66513. env.notebook.merge_selected_cells();
  66514. }
  66515. }
  66516. },
  66517. 'show-command-palette': {
  66518. help_index : 'aa',
  66519. cmd: i18n.msg._('show command pallette'),
  66520. help: i18n.msg._('open the command palette'),
  66521. icon: 'fa-keyboard-o',
  66522. handler : function(env){
  66523. env.notebook.show_command_palette();
  66524. }
  66525. },
  66526. 'toggle-all-line-numbers': {
  66527. cmd: i18n.msg._('toggle all line numbers'),
  66528. help : i18n.msg._('toggles line numbers in all cells, and persist the setting'),
  66529. icon: 'fa-list-ol',
  66530. handler: function(env) {
  66531. var value = !env.notebook.line_numbers;
  66532. env.notebook.get_cells().map(function(c) {
  66533. c.code_mirror.setOption('lineNumbers', value);
  66534. });
  66535. env.notebook.line_numbers = value;
  66536. }
  66537. },
  66538. 'show-all-line-numbers': {
  66539. cmd: i18n.msg._('show all line numbers'),
  66540. help : i18n.msg._('show line numbers in all cells, and persist the setting'),
  66541. handler: function(env) {
  66542. env.notebook.get_cells().map(function(c) {
  66543. c.code_mirror.setOption('lineNumbers', true);
  66544. });
  66545. env.notebook.line_numbers = true;
  66546. }
  66547. },
  66548. 'hide-all-line-numbers': {
  66549. cmd: i18n.msg._('hide all line numbers'),
  66550. help : i18n.msg._('hide line numbers in all cells, and persist the setting'),
  66551. handler: function(env) {
  66552. env.notebook.get_cells().map(function(c) {
  66553. c.code_mirror.setOption('lineNumbers', false);
  66554. });
  66555. env.notebook.line_numbers = false;
  66556. }
  66557. },
  66558. 'toggle-header':{
  66559. cmd: i18n.msg._('toggle header'),
  66560. help: i18n.msg._('switch between showing and hiding the header'),
  66561. handler : function(env) {
  66562. var value = !env.notebook.header;
  66563. if (value === true) {
  66564. $('#header-container').show();
  66565. $('.header-bar').show();
  66566. } else if (value === false) {
  66567. $('#header-container').hide();
  66568. $('.header-bar').hide();
  66569. }
  66570. events.trigger('resize-header.Page');
  66571. env.notebook.header = value;
  66572. }
  66573. },
  66574. 'show-header':{
  66575. cmd: i18n.msg._('show the header'),
  66576. help: i18n.msg._('show the header'),
  66577. handler : function(env) {
  66578. $('#header-container').show();
  66579. $('.header-bar').show();
  66580. events.trigger('resize-header.Page');
  66581. env.notebook.header = true;
  66582. }
  66583. },
  66584. 'hide-header':{
  66585. cmd: i18n.msg._('hide the header'),
  66586. help: i18n.msg._('hide the header'),
  66587. handler : function(env) {
  66588. $('#header-container').hide();
  66589. $('.header-bar').hide();
  66590. events.trigger('resize-header.Page');
  66591. env.notebook.header = false;
  66592. }
  66593. },
  66594. 'toggle-menubar':{
  66595. help: 'hide/show the menu bar',
  66596. handler : function(env) {
  66597. $('#menubar-container').toggle();
  66598. events.trigger('resize-header.Page');
  66599. }
  66600. },
  66601. 'show-menubar':{
  66602. help: 'show the menu bar',
  66603. handler : function(env) {
  66604. $('#menubar-container').show();
  66605. events.trigger('resize-header.Page');
  66606. }
  66607. },
  66608. 'hide-menubar':{
  66609. help: 'hide the menu bar',
  66610. handler : function(env) {
  66611. $('#menubar-container').hide();
  66612. events.trigger('resize-header.Page');
  66613. }
  66614. },
  66615. 'toggle-toolbar':{
  66616. cmd: i18n.msg._('toggle toolbar'),
  66617. help: i18n.msg._('switch between showing and hiding the toolbar'),
  66618. handler : function(env) {
  66619. var value = !env.notebook.toolbar;
  66620. if (value === true) {
  66621. $('div#maintoolbar').show();
  66622. } else if (value === false) {
  66623. $('div#maintoolbar').hide();
  66624. }
  66625. events.trigger('resize-header.Page');
  66626. env.notebook.toolbar = value;
  66627. }
  66628. },
  66629. 'show-toolbar':{
  66630. cmd: i18n.msg._('show the toolbar'),
  66631. help: i18n.msg._('show the toolbar'),
  66632. handler : function(env) {
  66633. $('div#maintoolbar').show();
  66634. events.trigger('resize-header.Page');
  66635. env.notebook.toolbar = true;
  66636. }
  66637. },
  66638. 'hide-toolbar':{
  66639. cmd: i18n.msg._('hide the toolbar'),
  66640. help: i18n.msg._('hide the toolbar'),
  66641. handler : function(env) {
  66642. $('div#maintoolbar').hide();
  66643. events.trigger('resize-header.Page');
  66644. env.notebook.toolbar = false;
  66645. }
  66646. },
  66647. 'close-pager': {
  66648. cmd: i18n.msg._('close the pager'),
  66649. help : i18n.msg._('close the pager'),
  66650. handler : function(env) {
  66651. // Collapse the page if it is open
  66652. if (env.pager && env.pager.expanded) {
  66653. env.pager.collapse();
  66654. }
  66655. }
  66656. },
  66657. 'auto-indent': {
  66658. cmd: i18n.msg._('automatically indent selection'),
  66659. help : i18n.msg._('automatically indent selection'),
  66660. handler : function(env) {
  66661. // Get selected cell
  66662. var selected_cell = env.notebook.get_selected_cell();
  66663. // Execute a CM command
  66664. selected_cell.code_mirror.execCommand('indentAuto');
  66665. }
  66666. },
  66667. 'close-and-halt': {
  66668. cmd: i18n.msg._('shutdown kernel and close window'),
  66669. help : i18n.msg._('shutdown kernel and close window'),
  66670. handler : function(env) {
  66671. env.notebook.close_and_halt();
  66672. }
  66673. }
  66674. };
  66675. /**
  66676. * A bunch of `Advance actions` for Jupyter.
  66677. * Cf `Simple Action` plus the following properties.
  66678. *
  66679. * handler: first argument of the handler is the event that triggered the action
  66680. * (typically keypress). The handler is responsible for any modification of the
  66681. * event and event propagation.
  66682. * Is also responsible for returning false if the event have to be further ignored,
  66683. * true, to tell keyboard manager that it ignored the event.
  66684. *
  66685. * the second parameter of the handler is the environment passed to Simple Actions
  66686. *
  66687. **/
  66688. var custom_ignore = {
  66689. 'ignore':{
  66690. cmd: i18n.msg._('ignore'),
  66691. handler : function () {
  66692. return true;
  66693. }
  66694. },
  66695. 'move-cursor-up':{
  66696. cmd: i18n.msg._('move cursor up'),
  66697. help: i18n.msg._("move cursor up"),
  66698. handler : function (env, event) {
  66699. var index = env.notebook.get_selected_index();
  66700. var cell = env.notebook.get_cell(index);
  66701. var cm = env.notebook.get_selected_cell().code_mirror;
  66702. var cur = cm.getCursor();
  66703. if (cell && cell.at_top() && index !== 0 && cur.ch === 0) {
  66704. if(event){
  66705. event.preventDefault();
  66706. }
  66707. env.notebook.command_mode();
  66708. env.notebook.select_prev(true);
  66709. env.notebook.edit_mode();
  66710. cm = env.notebook.get_selected_cell().code_mirror;
  66711. cm.setCursor(cm.lastLine(), 0);
  66712. }
  66713. return false;
  66714. }
  66715. },
  66716. 'move-cursor-down':{
  66717. cmd: i18n.msg._('move cursor down'),
  66718. help: i18n.msg._("move cursor down"),
  66719. handler : function (env, event) {
  66720. var index = env.notebook.get_selected_index();
  66721. var cell = env.notebook.get_cell(index);
  66722. if (cell.at_bottom() && index !== (env.notebook.ncells()-1)) {
  66723. if(event){
  66724. event.preventDefault();
  66725. }
  66726. env.notebook.command_mode();
  66727. env.notebook.select_next(true);
  66728. env.notebook.edit_mode();
  66729. var cm = env.notebook.get_selected_cell().code_mirror;
  66730. cm.setCursor(0, 0);
  66731. }
  66732. return false;
  66733. }
  66734. },
  66735. 'scroll-notebook-down': {
  66736. cmd: i18n.msg._('scroll notebook down'),
  66737. help: i18n.msg._("scroll notebook down"),
  66738. handler: function(env, event) {
  66739. if(event){
  66740. event.preventDefault();
  66741. }
  66742. return env.notebook.scroll_manager.scroll(1);
  66743. },
  66744. },
  66745. 'scroll-notebook-up': {
  66746. cmd: i18n.msg._('scroll notebook up'),
  66747. help: i18n.msg._("scroll notebook up"),
  66748. handler: function(env, event) {
  66749. if(event){
  66750. event.preventDefault();
  66751. }
  66752. return env.notebook.scroll_manager.scroll(-1);
  66753. },
  66754. },
  66755. 'scroll-cell-center': {
  66756. cmd: i18n.msg._('scroll cell center'),
  66757. help: i18n.msg._("Scroll the current cell to the center"),
  66758. handler: function (env, event) {
  66759. if(event){
  66760. event.preventDefault();
  66761. }
  66762. var cell = env.notebook.get_selected_index();
  66763. return env.notebook.scroll_cell_percent(cell, 50, 0);
  66764. }
  66765. },
  66766. 'scroll-cell-top': {
  66767. cmd: i18n.msg._('scroll cell top'),
  66768. help: i18n.msg._("Scroll the current cell to the top"),
  66769. handler: function (env, event) {
  66770. if(event){
  66771. event.preventDefault();
  66772. }
  66773. var cell = env.notebook.get_selected_index();
  66774. return env.notebook.scroll_cell_percent(cell, 0, 0);
  66775. }
  66776. },
  66777. 'duplicate-notebook':{
  66778. cmd: i18n.msg._('duplicate notebook'),
  66779. help: i18n.msg._("Create and open a copy of the current notebook"),
  66780. handler : function (env, event) {
  66781. env.notebook.copy_notebook();
  66782. }
  66783. },
  66784. 'trust-notebook':{
  66785. cmd: i18n.msg._('trust notebook'),
  66786. help: i18n.msg._("Trust the current notebook"),
  66787. handler : function (env, event) {
  66788. env.notebook.trust_notebook();
  66789. }
  66790. },
  66791. 'rename-notebook':{
  66792. cmd: i18n.msg._('rename notebook'),
  66793. help: i18n.msg._("Rename the current notebook"),
  66794. handler : function (env, event) {
  66795. env.notebook.save_widget.rename_notebook({notebook: env.notebook});
  66796. }
  66797. },
  66798. 'toggle-all-cells-output-collapsed':{
  66799. cmd: i18n.msg._('toggle all cells output collapsed'),
  66800. help: i18n.msg._("Toggle the hidden state of all output areas"),
  66801. handler : function (env, event) {
  66802. env.notebook.toggle_all_output();
  66803. }
  66804. },
  66805. 'toggle-all-cells-output-scrolled':{
  66806. cmd: i18n.msg._('toggle all cells output scrolled'),
  66807. help: i18n.msg._("Toggle the scrolling state of all output areas"),
  66808. handler : function (env, event) {
  66809. env.notebook.toggle_all_output_scroll();
  66810. }
  66811. },
  66812. 'clear-all-cells-output':{
  66813. cmd: i18n.msg._('clear all cells output'),
  66814. help: i18n.msg._("Clear the content of all the outputs"),
  66815. handler : function (env, event) {
  66816. env.notebook.clear_all_output();
  66817. }
  66818. },
  66819. 'save-notebook':{
  66820. cmd: i18n.msg._('save notebook'),
  66821. help: i18n.msg._("Save and Checkpoint"),
  66822. help_index : 'fb',
  66823. icon: 'fa-save',
  66824. handler : function (env, event) {
  66825. env.notebook.save_checkpoint();
  66826. if(event){
  66827. event.preventDefault();
  66828. }
  66829. return false;
  66830. }
  66831. },
  66832. };
  66833. // private stuff that prepend `jupyter-notebook:` to actions names
  66834. // and uniformize/fill in missing pieces in of an action.
  66835. var _prepare_handler = function(registry, subkey, source){
  66836. registry['jupyter-notebook:'+subkey] = {};
  66837. registry['jupyter-notebook:'+subkey].cmd = source[subkey].cmd;
  66838. registry['jupyter-notebook:'+subkey].help = source[subkey].help||subkey.replace(/-/g,' ');
  66839. registry['jupyter-notebook:'+subkey].help_index = source[subkey].help_index;
  66840. registry['jupyter-notebook:'+subkey].icon = source[subkey].icon;
  66841. return source[subkey].handler;
  66842. };
  66843. // Will actually generate/register all the Jupyter actions
  66844. var fun = function(){
  66845. var final_actions = {};
  66846. var k;
  66847. for(k in _actions){
  66848. if(_actions.hasOwnProperty(k)){
  66849. // Js closure are function level not block level need to wrap in a IIFE
  66850. // and append jupyter-notebook: to event name these things do intercept event so are wrapped
  66851. // in a function that return false.
  66852. var handler = _prepare_handler(final_actions, k, _actions);
  66853. (function(key, handler){
  66854. final_actions['jupyter-notebook:'+key].handler = function(env, event){
  66855. handler(env);
  66856. if(event){
  66857. event.preventDefault();
  66858. }
  66859. return false;
  66860. };
  66861. })(k, handler);
  66862. }
  66863. }
  66864. for(k in custom_ignore){
  66865. // Js closure are function level not block level need to wrap in a IIFE
  66866. // same as above, but decide for themselves whether or not they intercept events.
  66867. if(custom_ignore.hasOwnProperty(k)){
  66868. handler = _prepare_handler(final_actions, k, custom_ignore);
  66869. (function(key, handler){
  66870. final_actions['jupyter-notebook:'+key].handler = function(env, event){
  66871. return handler(env, event);
  66872. };
  66873. })(k, handler);
  66874. }
  66875. }
  66876. return final_actions;
  66877. };
  66878. ActionHandler.prototype._actions = fun();
  66879. /**
  66880. * extend the environment variable that will be pass to handlers
  66881. **/
  66882. ActionHandler.prototype.extend_env = function(env){
  66883. for(var k in env){
  66884. this.env[k] = env[k];
  66885. }
  66886. };
  66887. ActionHandler.prototype.register = function(action, name, prefix){
  66888. /**
  66889. * Register an `action` with an optional name and prefix.
  66890. *
  66891. * if name and prefix are not given they will be determined automatically.
  66892. * if action if just a `function` it will be wrapped in an anonymous action.
  66893. *
  66894. * @return the full name to access this action .
  66895. **/
  66896. action = this.normalise(action);
  66897. if( !name ){
  66898. name = 'autogenerated-'+String(action.handler);
  66899. }
  66900. prefix = prefix || 'auto';
  66901. var full_name = prefix+':'+name;
  66902. this._actions[full_name] = action;
  66903. return full_name;
  66904. };
  66905. ActionHandler.prototype.normalise = function(data){
  66906. /**
  66907. * given an `action` or `function`, return a normalised `action`
  66908. * by setting all known attributes and removing unknown attributes;
  66909. **/
  66910. if(typeof(data) === 'function'){
  66911. data = {handler:data};
  66912. }
  66913. if(typeof(data.handler) !== 'function'){
  66914. throw new Error('unknown datatype, cannot register');
  66915. }
  66916. var _data = data;
  66917. data = {};
  66918. data.handler = _data.handler;
  66919. data.help = _data.help || '';
  66920. data.icon = _data.icon || '';
  66921. data.help_index = _data.help_index || '';
  66922. return data;
  66923. };
  66924. ActionHandler.prototype.get_name = function(name_or_data){
  66925. /**
  66926. * given an `action` or `name` of an action, return the name attached to this action.
  66927. * if given the name of and corresponding actions does not exist in registry, return `null`.
  66928. **/
  66929. if(typeof(name_or_data) === 'string'){
  66930. warn_bad_name(name_or_data);
  66931. if(this.exists(name_or_data)){
  66932. return name_or_data;
  66933. } else {
  66934. return null;
  66935. }
  66936. } else {
  66937. return this.register(name_or_data);
  66938. }
  66939. };
  66940. ActionHandler.prototype.get = function(name){
  66941. warn_bad_name(name);
  66942. return this._actions[name];
  66943. };
  66944. ActionHandler.prototype.call = function(name, event, env){
  66945. return this._actions[name].handler(env|| this.env, event);
  66946. };
  66947. ActionHandler.prototype.exists = function(name){
  66948. return (typeof(this._actions[name]) !== 'undefined');
  66949. };
  66950. return {init:ActionHandler};
  66951. });
  66952. // Copyright (c) Jupyter Development Team.
  66953. // Distributed under the terms of the Modified BSD License.
  66954. /**
  66955. *
  66956. *
  66957. * @module keyboardmanager
  66958. * @namespace keyboardmanager
  66959. * @class KeyboardManager
  66960. */
  66961. define('notebook/js/keyboardmanager',[
  66962. 'jquery',
  66963. 'base/js/utils',
  66964. 'base/js/keyboard',
  66965. ], function($, utils, keyboard) {
  66966. "use strict";
  66967. // Main keyboard manager for the notebook
  66968. var keycodes = keyboard.keycodes;
  66969. var KeyboardManager = function (options) {
  66970. /**
  66971. * A class to deal with keyboard event and shortcut
  66972. *
  66973. * @class KeyboardManager
  66974. * @constructor
  66975. * @param options {dict} Dictionary of keyword arguments :
  66976. * @param options.events {$(Events)} instance
  66977. * @param options.pager: {Pager} pager instance
  66978. */
  66979. this.mode = 'command';
  66980. this.enabled = true;
  66981. this.pager = options.pager;
  66982. this.quick_help = undefined;
  66983. this.notebook = undefined;
  66984. this.last_mode = undefined;
  66985. this.bind_events();
  66986. this.env = {pager:this.pager};
  66987. this.actions = options.actions;
  66988. this.command_shortcuts = new keyboard.ShortcutManager(undefined, options.events, this.actions, this.env, options.config, 'command');
  66989. this.command_shortcuts._add_default_shortcuts(this.get_default_common_shortcuts());
  66990. this.command_shortcuts._add_default_shortcuts(this.get_default_command_shortcuts());
  66991. this.edit_shortcuts = new keyboard.ShortcutManager(undefined, options.events, this.actions, this.env);
  66992. this.edit_shortcuts._add_default_shortcuts(this.get_default_common_shortcuts());
  66993. this.edit_shortcuts._add_default_shortcuts(this.get_default_edit_shortcuts());
  66994. this.config = options.config;
  66995. var that = this;
  66996. this.config.loaded.then(function(){
  66997. var edit_unbind;
  66998. try {
  66999. edit_unbind = that.config.data.keys.edit.unbind||[];
  67000. } catch (e) {
  67001. if (e instanceof TypeError) {
  67002. edit_unbind = [];
  67003. } else {
  67004. throw e;
  67005. }
  67006. }
  67007. edit_unbind.forEach(function(u){that.edit_shortcuts.remove_shortcut(u);});
  67008. var command_unbind;
  67009. try {
  67010. command_unbind = that.config.data.keys.command.unbind||[];
  67011. } catch (e) {
  67012. if (e instanceof TypeError) {
  67013. command_unbind = [];
  67014. } else {
  67015. throw e;
  67016. }
  67017. }
  67018. command_unbind.forEach(function(u){that.command_shortcuts.remove_shortcut(u);});
  67019. that.command_shortcuts.add_shortcuts( ((that.config.data.keys||{}).command||{}).bind);
  67020. that.edit_shortcuts.add_shortcuts( ((that.config.data.keys||{}).edit ||{}).bind);
  67021. }
  67022. );
  67023. Object.seal(this);
  67024. };
  67025. /**
  67026. * Return a dict of common shortcut
  67027. * @method get_default_common_shortcuts
  67028. *
  67029. * @example Example of returned shortcut
  67030. * ```
  67031. * 'shortcut-key': 'action-name'
  67032. * // a string representing the shortcut as dash separated value.
  67033. * // e.g. 'shift' , 'shift-enter', 'cmd-t'
  67034. *```
  67035. */
  67036. KeyboardManager.prototype.get_default_common_shortcuts = function() {
  67037. return {
  67038. 'shift' : 'jupyter-notebook:ignore',
  67039. 'shift-enter' : 'jupyter-notebook:run-cell-and-select-next',
  67040. 'alt-enter' : 'jupyter-notebook:run-cell-and-insert-below',
  67041. 'ctrl-enter' : 'jupyter-notebook:run-cell',
  67042. // cmd on mac, ctrl otherwise
  67043. 'cmdtrl-enter' : 'jupyter-notebook:run-cell',
  67044. 'cmdtrl-s' : 'jupyter-notebook:save-notebook'
  67045. };
  67046. };
  67047. KeyboardManager.prototype.get_default_edit_shortcuts = function() {
  67048. return {
  67049. 'cmdtrl-shift-p' : 'jupyter-notebook:show-command-palette',
  67050. 'cmdtrl-shift-f' : 'jupyter-notebook:show-command-palette',
  67051. 'esc' : 'jupyter-notebook:enter-command-mode',
  67052. 'ctrl-m' : 'jupyter-notebook:enter-command-mode',
  67053. 'up' : 'jupyter-notebook:move-cursor-up',
  67054. 'down' : 'jupyter-notebook:move-cursor-down',
  67055. 'ctrl-shift--' : 'jupyter-notebook:split-cell-at-cursor',
  67056. };
  67057. };
  67058. KeyboardManager.prototype.get_default_command_shortcuts = function() {
  67059. return {
  67060. 'cmdtrl-shift-p': 'jupyter-notebook:show-command-palette',
  67061. 'cmdtrl-shift-f': 'jupyter-notebook:show-command-palette',
  67062. 'shift-space': 'jupyter-notebook:scroll-notebook-up',
  67063. 'shift-v' : 'jupyter-notebook:paste-cell-above',
  67064. 'shift-m' : 'jupyter-notebook:merge-cells',
  67065. 'shift-o' : 'jupyter-notebook:toggle-cell-output-scrolled',
  67066. 'enter' : 'jupyter-notebook:enter-edit-mode',
  67067. 'space' : 'jupyter-notebook:scroll-notebook-down',
  67068. 'down' : 'jupyter-notebook:select-next-cell',
  67069. 'i,i' : 'jupyter-notebook:interrupt-kernel',
  67070. '0,0' : 'jupyter-notebook:confirm-restart-kernel',
  67071. 'd,d' : 'jupyter-notebook:delete-cell',
  67072. 'esc': 'jupyter-notebook:close-pager',
  67073. 'up' : 'jupyter-notebook:select-previous-cell',
  67074. 'k' : 'jupyter-notebook:select-previous-cell',
  67075. 'j' : 'jupyter-notebook:select-next-cell',
  67076. 'shift-k': 'jupyter-notebook:extend-selection-above',
  67077. 'shift-j': 'jupyter-notebook:extend-selection-below',
  67078. 'shift-up': 'jupyter-notebook:extend-selection-above',
  67079. 'shift-down': 'jupyter-notebook:extend-selection-below',
  67080. 'cmdtrl-a': 'jupyter-notebook:select-all',
  67081. 'x' : 'jupyter-notebook:cut-cell',
  67082. 'c' : 'jupyter-notebook:copy-cell',
  67083. 'v' : 'jupyter-notebook:paste-cell-below',
  67084. 'a' : 'jupyter-notebook:insert-cell-above',
  67085. 'b' : 'jupyter-notebook:insert-cell-below',
  67086. 'y' : 'jupyter-notebook:change-cell-to-code',
  67087. 'm' : 'jupyter-notebook:change-cell-to-markdown',
  67088. 'r' : 'jupyter-notebook:change-cell-to-raw',
  67089. '1' : 'jupyter-notebook:change-cell-to-heading-1',
  67090. '2' : 'jupyter-notebook:change-cell-to-heading-2',
  67091. '3' : 'jupyter-notebook:change-cell-to-heading-3',
  67092. '4' : 'jupyter-notebook:change-cell-to-heading-4',
  67093. '5' : 'jupyter-notebook:change-cell-to-heading-5',
  67094. '6' : 'jupyter-notebook:change-cell-to-heading-6',
  67095. 'o' : 'jupyter-notebook:toggle-cell-output-collapsed',
  67096. 's' : 'jupyter-notebook:save-notebook',
  67097. 'l' : 'jupyter-notebook:toggle-cell-line-numbers',
  67098. 'shift-l' : 'jupyter-notebook:toggle-all-line-numbers',
  67099. 'h' : 'jupyter-notebook:show-keyboard-shortcuts',
  67100. 'z' : 'jupyter-notebook:undo-cell-deletion',
  67101. 'q' : 'jupyter-notebook:close-pager',
  67102. 'p' : 'jupyter-notebook:show-command-palette',
  67103. };
  67104. };
  67105. KeyboardManager.prototype.bind_events = function () {
  67106. var that = this;
  67107. $(document).keydown(function (event) {
  67108. if(event._ipkmIgnore===true||(event.originalEvent||{})._ipkmIgnore===true){
  67109. return false;
  67110. }
  67111. return that.handle_keydown(event);
  67112. });
  67113. };
  67114. KeyboardManager.prototype.set_notebook = function (notebook) {
  67115. this.notebook = notebook;
  67116. this.actions.extend_env({notebook:notebook});
  67117. };
  67118. KeyboardManager.prototype.set_quickhelp = function (notebook) {
  67119. this.actions.extend_env({quick_help:notebook});
  67120. };
  67121. KeyboardManager.prototype.handle_keydown = function (event) {
  67122. /**
  67123. * returning false from this will stop event propagation
  67124. **/
  67125. if (event.which === keycodes.esc) {
  67126. // Intercept escape at highest level to avoid closing
  67127. // websocket connection with firefox
  67128. event.preventDefault();
  67129. }
  67130. if (!this.enabled) {
  67131. if (event.which === keycodes.esc) {
  67132. this.notebook.command_mode();
  67133. return false;
  67134. }
  67135. return true;
  67136. }
  67137. if (this.mode === 'edit') {
  67138. return this.edit_shortcuts.call_handler(event);
  67139. } else if (this.mode === 'command') {
  67140. return this.command_shortcuts.call_handler(event);
  67141. }
  67142. return true;
  67143. };
  67144. KeyboardManager.prototype.edit_mode = function () {
  67145. this.last_mode = this.mode;
  67146. this.mode = 'edit';
  67147. };
  67148. KeyboardManager.prototype.command_mode = function () {
  67149. this.last_mode = this.mode;
  67150. this.mode = 'command';
  67151. };
  67152. KeyboardManager.prototype.enable = function () {
  67153. this.enabled = true;
  67154. };
  67155. KeyboardManager.prototype.disable = function () {
  67156. this.enabled = false;
  67157. };
  67158. KeyboardManager.prototype.register_events = function (e) {
  67159. e = $(e);
  67160. var that = this;
  67161. var handle_focus = function () {
  67162. that.disable();
  67163. };
  67164. var handle_blur = function () {
  67165. that.enable();
  67166. };
  67167. e.on('focusin', handle_focus);
  67168. e.on('focusout', handle_blur);
  67169. // TODO: Very strange. The focusout event does not seem fire for the
  67170. // bootstrap textboxes on FF25&26... This works around that by
  67171. // registering focus and blur events recursively on all inputs within
  67172. // registered element.
  67173. e.find('input').blur(handle_blur);
  67174. e.on('DOMNodeInserted', function (event) {
  67175. var target = $(event.target);
  67176. if (target.is('input')) {
  67177. target.blur(handle_blur);
  67178. } else {
  67179. target.find('input').blur(handle_blur);
  67180. }
  67181. });
  67182. // There are times (raw_input) where we remove the element from the DOM before
  67183. // focusout is called. In this case we bind to the remove event of jQueryUI,
  67184. // which gets triggered upon removal, iff it is focused at the time.
  67185. // is_focused must be used to check for the case where an element within
  67186. // the element being removed is focused.
  67187. e.on('remove', function () {
  67188. if (utils.is_focused(e[0])) {
  67189. that.enable();
  67190. }
  67191. });
  67192. };
  67193. return {'KeyboardManager': KeyboardManager};
  67194. });
  67195. // Copyright (c) Jupyter Development Team.
  67196. // Distributed under the terms of the Modified BSD License.
  67197. define('notebook/js/kernelselector',[
  67198. 'jquery',
  67199. 'base/js/namespace',
  67200. 'base/js/dialog',
  67201. 'base/js/utils',
  67202. 'base/js/i18n'
  67203. ], function($, IPython, dialog, utils, i18n) {
  67204. "use strict";
  67205. var KernelSelector = function(selector, notebook, options) {
  67206. options = options || {};
  67207. var that = this;
  67208. this.selector = selector;
  67209. this.notebook = notebook;
  67210. this.nbclassic_path = options.nbclassic_path;
  67211. this.notebook.set_kernelselector(this);
  67212. this.events = notebook.events;
  67213. this.current_selection = null;
  67214. this.kernelspecs = {};
  67215. if (this.selector !== undefined) {
  67216. this.element = $(selector);
  67217. this.request_kernelspecs();
  67218. }
  67219. this.bind_events();
  67220. // Make the object globally available for user convenience & inspection
  67221. IPython.kernelselector = this;
  67222. this._finish_load = null;
  67223. this._loaded = false;
  67224. this.loaded = new Promise(function(resolve) {
  67225. that._finish_load = resolve;
  67226. });
  67227. Object.seal(this);
  67228. };
  67229. KernelSelector.prototype.request_kernelspecs = function() {
  67230. // Preliminary documentation for kernelspecs api is at
  67231. // https://github.com/ipython/ipython/wiki/IPEP-25%3A-Registry-of-installed-kernels#rest-api
  67232. var url = utils.url_path_join(this.notebook.base_url, 'api/kernelspecs');
  67233. utils.promising_ajax(url).then($.proxy(this._got_kernelspecs, this));
  67234. };
  67235. var _sorted_names = function(kernelspecs) {
  67236. // sort kernel names
  67237. return Object.keys(kernelspecs).sort(function (a, b) {
  67238. // sort by display_name
  67239. var da = kernelspecs[a].spec.display_name;
  67240. var db = kernelspecs[b].spec.display_name;
  67241. if (da === db) {
  67242. return 0;
  67243. } else if (da > db) {
  67244. return 1;
  67245. } else {
  67246. return -1;
  67247. }
  67248. });
  67249. };
  67250. KernelSelector.prototype._got_kernelspecs = function(data) {
  67251. var that = this;
  67252. this.kernelspecs = data.kernelspecs;
  67253. var change_kernel_submenu = $("#menu-change-kernel-submenu");
  67254. var new_notebook_submenu = $("#menu-new-notebook-submenu");
  67255. var keys = _sorted_names(data.kernelspecs);
  67256. keys.map(function (key) {
  67257. // Create the Kernel > Change kernel submenu
  67258. var ks = data.kernelspecs[key];
  67259. change_kernel_submenu.append(
  67260. $("<li>").attr("id", "kernel-submenu-"+ks.name).append(
  67261. $('<a>')
  67262. .attr('href', '#')
  67263. .click( function () {
  67264. that.set_kernel(ks.name);
  67265. })
  67266. .text(ks.spec.display_name)
  67267. )
  67268. );
  67269. // Create the File > New Notebook submenu
  67270. new_notebook_submenu.append(
  67271. $("<li>").attr("id", "new-notebook-submenu-"+ks.name).append(
  67272. $('<a>')
  67273. .attr('href', '#')
  67274. .click( function () {
  67275. that.new_notebook(ks.name);
  67276. })
  67277. .text(ks.spec.display_name)
  67278. )
  67279. );
  67280. });
  67281. // trigger loaded promise
  67282. this._loaded = true;
  67283. this._finish_load();
  67284. };
  67285. KernelSelector.prototype._spec_changed = function (event, ks) {
  67286. /** event handler for spec_changed */
  67287. var that = this;
  67288. // update selection
  67289. this.current_selection = ks.name;
  67290. // put the current kernel at the top of File > New Notebook
  67291. var cur_kernel_entry = $("#new-notebook-submenu-" + ks.name);
  67292. var parent = cur_kernel_entry.parent();
  67293. // do something only if there is more than one kernel
  67294. if (parent.children().length > 1) {
  67295. // first, sort back the submenu
  67296. parent.append(
  67297. parent.children("li[class!='divider']").sort(
  67298. function (a,b) {
  67299. var da = $("a",a).text();
  67300. var db = $("a",b).text();
  67301. if (da === db) {
  67302. return 0;
  67303. } else if (da > db) {
  67304. return 1;
  67305. } else {
  67306. return -1;
  67307. }}));
  67308. // then, if there is no divider yet, add one
  67309. if (!parent.children("li[class='divider']").length) {
  67310. parent.prepend($("<li>").attr("class","divider"));
  67311. }
  67312. // finally, put the current kernel at the top
  67313. parent.prepend(cur_kernel_entry);
  67314. }
  67315. // load logo
  67316. var logo_img = this.element.find("img.current_kernel_logo");
  67317. $("#kernel_indicator").find('.kernel_indicator_name').text(ks.spec.display_name);
  67318. if (ks.resources['logo-64x64']) {
  67319. logo_img.attr("src", ks.resources['logo-64x64']);
  67320. logo_img.attr("title", ks.spec.display_name);
  67321. logo_img.show();
  67322. } else {
  67323. logo_img.hide();
  67324. }
  67325. // load kernel css
  67326. var css_url = ks.resources['kernel.css'];
  67327. if (css_url) {
  67328. $('#kernel-css').attr('href', css_url);
  67329. } else {
  67330. $('#kernel-css').attr('href', '');
  67331. }
  67332. // load kernel js
  67333. if (ks.resources['kernel.js']) {
  67334. // Debug added for Notebook 4.2, please remove at some point in the
  67335. // future if the following does not append anymore when kernels
  67336. // have kernel.js
  67337. //
  67338. // > Uncaught (in promise) TypeError: require is not a function
  67339. //
  67340. console.info('Dynamically requiring kernel.js, `requirejs` is ', requirejs);
  67341. requirejs([ks.resources['kernel.js']],
  67342. function (kernel_mod) {
  67343. if (kernel_mod && kernel_mod.onload) {
  67344. kernel_mod.onload();
  67345. } else {
  67346. console.warn("Kernel " + ks.name + " has a kernel.js file that does not contain "+
  67347. "any asynchronous module definition. This is undefined behavior "+
  67348. "and not recommended.");
  67349. }
  67350. }, function (err) {
  67351. console.warn("Failed to load kernel.js from ", ks.resources['kernel.js'], err);
  67352. }
  67353. );
  67354. this.events.on('spec_changed.Kernel', function (evt, new_ks) {
  67355. if (ks.name != new_ks.name) {
  67356. console.warn("kernelspec %s had custom kernel.js. Forcing page reload for %s.",
  67357. ks.name, new_ks.name);
  67358. that.notebook.save_notebook().then(function () {
  67359. window.location.reload();
  67360. });
  67361. }
  67362. });
  67363. }
  67364. };
  67365. KernelSelector.prototype.set_kernel = function (selected) {
  67366. /** set the kernel by name, ensuring kernelspecs have been loaded, first
  67367. kernel can be just a kernel name, or a notebook kernelspec metadata
  67368. (name, language, display_name).
  67369. */
  67370. var that = this;
  67371. if (typeof selected === 'string') {
  67372. selected = {
  67373. name: selected
  67374. };
  67375. }
  67376. if (this._loaded) {
  67377. this._set_kernel(selected);
  67378. } else {
  67379. return this.loaded.then(function () {
  67380. that._set_kernel(selected);
  67381. });
  67382. }
  67383. };
  67384. KernelSelector.prototype._set_kernel = function (selected) {
  67385. /** Actually set the kernel (kernelspecs have been loaded) */
  67386. if (selected.name === this.current_selection) {
  67387. // only trigger event if value changed
  67388. return;
  67389. }
  67390. var kernelspecs = this.kernelspecs;
  67391. var ks = kernelspecs[selected.name];
  67392. if (ks === undefined) {
  67393. var available = _sorted_names(kernelspecs);
  67394. var matches = [];
  67395. if (selected.language && selected.language.length > 0) {
  67396. available.map(function (name) {
  67397. if (kernelspecs[name].spec.language.toLowerCase() === selected.language.toLowerCase()) {
  67398. matches.push(name);
  67399. }
  67400. });
  67401. }
  67402. if (matches.length === 1) {
  67403. ks = kernelspecs[matches[0]];
  67404. console.log("No exact match found for " + selected.name +
  67405. ", using only kernel that matches language=" + selected.language, ks);
  67406. this.events.trigger("spec_match_found.Kernel", {
  67407. selected: selected,
  67408. found: ks,
  67409. });
  67410. }
  67411. // if still undefined, trigger failure event
  67412. if (ks === undefined) {
  67413. this.events.trigger("spec_not_found.Kernel", {
  67414. selected: selected,
  67415. matches: matches,
  67416. available: available,
  67417. });
  67418. return;
  67419. }
  67420. }
  67421. if (this.notebook._session_starting &&
  67422. this.notebook.session.kernel.name !== ks.name) {
  67423. console.error("Cannot change kernel while waiting for pending session start.");
  67424. return;
  67425. }
  67426. this.current_selection = ks.name;
  67427. this.events.trigger('spec_changed.Kernel', ks);
  67428. };
  67429. KernelSelector.prototype._spec_not_found = function (event, data) {
  67430. var that = this;
  67431. var select = $("<select>").addClass('form-control');
  67432. console.warn("Kernelspec not found:", data);
  67433. var names;
  67434. if (data.matches.length > 1) {
  67435. names = data.matches;
  67436. } else {
  67437. names = data.available;
  67438. }
  67439. names.map(function (name) {
  67440. var ks = that.kernelspecs[name];
  67441. select.append(
  67442. $('<option/>').attr('value', ks.name).text(ks.spec.display_name || ks.name)
  67443. );
  67444. });
  67445. var no_kernel_msg = i18n.msg.sprintf(i18n.msg._("Could not find a kernel matching %s. Please select a kernel:"),
  67446. (data.selected.display_name || data.selected.name))
  67447. var body = $("<form>").addClass("form-inline").append(
  67448. $("<span>").text(no_kernel_msg)
  67449. ).append(select);
  67450. // This statement is used simply so that message extraction
  67451. // will pick up the strings. The actual setting of the text
  67452. // for the button is in dialog.js.
  67453. var button_labels = [ i18n.msg._("Continue Without Kernel"), i18n.msg._("Set Kernel"), i18n.msg._("OK") ];
  67454. dialog.modal({
  67455. title : i18n.msg._('Kernel not found'),
  67456. body : body,
  67457. buttons : {
  67458. 'Continue Without Kernel' : {
  67459. class : 'btn-danger',
  67460. click : function () {
  67461. that.events.trigger('no_kernel.Kernel');
  67462. }
  67463. },
  67464. 'Set Kernel' : {
  67465. class : 'btn-primary',
  67466. click : function () {
  67467. that.set_kernel(select.val());
  67468. }
  67469. }
  67470. }
  67471. });
  67472. };
  67473. KernelSelector.prototype.new_notebook = function (kernel_name) {
  67474. var w = window.open('', IPython._target);
  67475. // Create a new notebook in the same path as the current
  67476. // notebook's path.
  67477. var that = this;
  67478. var parent = utils.url_path_split(that.notebook.notebook_path)[0];
  67479. that.notebook.contents.new_untitled(parent, {type: "notebook"}).then(
  67480. function (data) {
  67481. var url = utils.url_path_join(
  67482. that.notebook.base_url, that.nbclassic_path, 'notebooks',
  67483. utils.encode_uri_components(data.path)
  67484. );
  67485. url += "?kernel_name=" + kernel_name;
  67486. w.location = url;
  67487. },
  67488. function(error) {
  67489. w.close();
  67490. dialog.modal({
  67491. title : i18n.msg._('Creating Notebook Failed'),
  67492. body : i18n.msg.sprintf(i18n.msg._("The error was: %s"), error.message),
  67493. buttons : {'OK' : {'class' : 'btn-primary'}}
  67494. });
  67495. }
  67496. );
  67497. };
  67498. KernelSelector.prototype.lock_switch = function() {
  67499. // should set a flag and display warning+reload if user want to
  67500. // re-change kernel. As UI discussion never finish
  67501. // making that a separate PR.
  67502. console.warn('switching kernel is not guaranteed to work !');
  67503. };
  67504. KernelSelector.prototype.bind_events = function() {
  67505. var that = this;
  67506. this.events.on('spec_changed.Kernel', $.proxy(this._spec_changed, this));
  67507. this.events.on('spec_not_found.Kernel', $.proxy(this._spec_not_found, this));
  67508. this.events.on('kernel_created.Session', function (event, data) {
  67509. that.set_kernel(data.kernel.name);
  67510. });
  67511. var logo_img = this.element.find("img.current_kernel_logo");
  67512. logo_img.on("load", function() {
  67513. logo_img.show();
  67514. });
  67515. logo_img.on("error", function() {
  67516. logo_img.hide();
  67517. });
  67518. };
  67519. return {'KernelSelector': KernelSelector};
  67520. });
  67521. // Copyright (c) Jupyter Development Team.
  67522. // Distributed under the terms of the Modified BSD License.
  67523. requirejs([
  67524. 'jquery',
  67525. 'base/js/dialog',
  67526. 'base/js/i18n',
  67527. 'underscore',
  67528. 'base/js/namespace'
  67529. ], function ($, dialog, i18n, _, IPython) {
  67530. 'use strict';
  67531. $('#notebook_about').click(function () {
  67532. // The nbclassicPath is only injected in the document by nbclassic.
  67533. var is_nbclassic = document.nbclassicPath !== undefined;
  67534. // use underscore template to auto html escape
  67535. if (sys_info) {
  67536. var text = '';
  67537. if (is_nbclassic) {
  67538. text = text + i18n.msg._('You are using Jupyter NbClassic.');
  67539. text = text + '<br/><br/>';
  67540. text = text + i18n.msg._('The version of the Jupyter server is: ');
  67541. text = text + _.template('<b><%- version %></b>')({ version: sys_info.jupyter_server_version });
  67542. if (sys_info.commit_hash) {
  67543. text = text + _.template('-<%- hash %>')({ hash: sys_info.commit_hash });
  67544. }
  67545. text = text + '<br/>';
  67546. text = text + 'To get the version of nbclassic, run in a terminal: jupyter nbclassic --version';
  67547. }
  67548. else {
  67549. text = text + i18n.msg._('You are using Jupyter Notebook.');
  67550. text = text + '<br/><br/>';
  67551. text = text + i18n.msg._('The version of the notebook server is: ');
  67552. text = text + _.template('<b><%- version %></b>')({ version: sys_info.notebook_version });
  67553. if (sys_info.commit_hash) {
  67554. text = text + _.template('-<%- hash %>')({ hash: sys_info.commit_hash });
  67555. }
  67556. }
  67557. text = text + '<br/>';
  67558. text = text + i18n.msg._('The server is running on this version of Python:');
  67559. text = text + _.template('<br/><pre>Python <%- pyver %></pre>')({
  67560. pyver: sys_info.sys_version });
  67561. var kinfo = $('<div/>').attr('id', '#about-kinfo').text(i18n.msg._('Waiting for kernel to be available...'));
  67562. var body = $('<div/>');
  67563. body.append($('<h4/>').text(i18n.msg._('Server Information:')));
  67564. body.append($('<p/>').html(text));
  67565. body.append($('<h4/>').text(i18n.msg._('Current Kernel Information:')));
  67566. body.append(kinfo);
  67567. } else {
  67568. var text = i18n.msg._('Could not access sys_info variable for version information.');
  67569. var body = $('<div/>');
  67570. body.append($('<h4/>').text(i18n.msg._('Cannot find sys_info!')));
  67571. body.append($('<p/>').html(text));
  67572. }
  67573. if (is_nbclassic) {
  67574. dialog.modal({
  67575. title: i18n.msg._('About Jupyter NbClassic'),
  67576. body: body,
  67577. buttons: { 'OK': {} }
  67578. });
  67579. } else {
  67580. dialog.modal({
  67581. title: i18n.msg._('About Jupyter Notebook'),
  67582. body: body,
  67583. buttons: { 'OK': {} }
  67584. });
  67585. }
  67586. try {
  67587. IPython.notebook.session.kernel.kernel_info(function (data) {
  67588. kinfo.html($('<pre/>').text(data.content.banner));
  67589. });
  67590. } catch (e) {
  67591. kinfo.html($('<p/>').text(i18n.msg._('unable to contact kernel')));
  67592. }
  67593. });
  67594. });
  67595. define("notebook/js/about", function(){});
  67596. define('notebook/js/searchandreplace',[
  67597. 'jquery',
  67598. 'base/js/dialog',
  67599. 'base/js/i18n'
  67600. ], function($, dialog, i18n){
  67601. "use strict";
  67602. /**
  67603. * escape a Regular expression to act as a pure search string.
  67604. * though it will still have the case sensitivity options and all
  67605. * the benefits
  67606. **/
  67607. function escapeRegExp(string){
  67608. return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
  67609. }
  67610. /**
  67611. * Compute the model of the preview for the search and replace.
  67612. * It might not be perfectly accurate if matches overlap...
  67613. * Parameter:
  67614. * sre: the string that will become the Search Regular Expression
  67615. * arr: a list of string on which the match will be applied.
  67616. * isCaseSensitive: should the match be CaseSensitive
  67617. * RegExOrNot: a `RegExOrNot` object.
  67618. * replace: the replacement string for the matching `sre`
  67619. * Return: a tuple of 2 value:
  67620. * 1) array of [before match, match, replacement, after match]
  67621. * where before and after match are cut to a reasonable length after the match.
  67622. * 2) Boolean, whether the matching has been aborted because one of the element of
  67623. * arr have too many matches.
  67624. **/
  67625. var compute_preview_model = function(sre, arr, isCaseSensitive, RegExpOrNot, replace){
  67626. var html = [];
  67627. // and create an array of
  67628. // before_match, match , replacement, after_match
  67629. var aborted = false;
  67630. var replacer_reg = new RegExpOrNot(sre);
  67631. for(var r=0; r < arr.length; r++){
  67632. var current_line = arr[r];
  67633. var match_abort = getMatches(sre, current_line, isCaseSensitive, RegExpOrNot);
  67634. aborted = aborted || match_abort[1];
  67635. var matches = match_abort[0];
  67636. for(var mindex=0; mindex < matches.length ; mindex++){
  67637. var start = matches[mindex][0];
  67638. var stop = matches[mindex][1];
  67639. var initial = current_line.slice(start, stop);
  67640. var replaced = initial.replace(replacer_reg, replace);
  67641. // that might be better as a dictionary
  67642. html.push([cutBefore(current_line.slice(0, start)),
  67643. initial,
  67644. replaced,
  67645. cutAfter(current_line.slice(stop), 30-(stop-start))]);
  67646. }
  67647. }
  67648. return [html, aborted];
  67649. };
  67650. /**
  67651. * Build the preview model where things matched and their replacement values
  67652. * are wrapped in tags with correct CSS classes.
  67653. * Parameter:
  67654. * body: jQuery element into which the preview will be build
  67655. * aborted : have the model been aborted (Boolean) use to tell the user
  67656. * that the preview might not show all the replacements
  67657. * html: array of model created by compute_preview_model
  67658. * replace: Boolean: whether we are actually replacing with something or just matching.
  67659. **/
  67660. var build_preview = function(body, aborted, html, replace){
  67661. body.empty();
  67662. if(aborted){
  67663. var warnmsg = i18n.msg.sprintf(i18n.msg._("Warning: too many matches (%d). Some changes might not be shown or applied."),html.length);
  67664. body.append($('<p/>').addClass('bg-warning').text(warnmsg));
  67665. } else {
  67666. var matchmsg = i18n.msg.sprintf(i18n.msg.ngettext("%d match","%d matches",html.length),html.length);
  67667. body.append($('<p/>').text(matchmsg));
  67668. }
  67669. for(var rindex=0; rindex<html.length; rindex++){
  67670. var pre = $('<pre/>')
  67671. .append(html[rindex][0])
  67672. .append($('<span/>').addClass('match').text(html[rindex][1]));
  67673. if(replace){
  67674. pre.append($('<span/>').addClass('insert').text(html[rindex][2]));
  67675. pre.addClass('replace');
  67676. }
  67677. pre.append(html[rindex][3]);
  67678. body.append(pre);
  67679. }
  67680. };
  67681. /**
  67682. * Given a string, return only the beginning, with potentially an ellipsis
  67683. * at the end.
  67684. **/
  67685. var cutAfter = function(string, n){
  67686. n=n||10;
  67687. while(n<10){
  67688. n+=15;
  67689. }
  67690. if(string.length > n+3){
  67691. return string.slice(0, n)+'...';
  67692. }
  67693. return string;
  67694. };
  67695. /**
  67696. * Given a string, return only the end, with potentially an ellipsis
  67697. * at the beginning.
  67698. **/
  67699. var cutBefore = function(string){
  67700. if(string.length > 33){
  67701. return '...'+string.slice(-30);
  67702. }
  67703. return string;
  67704. };
  67705. /**
  67706. * Find all occurrences of `re` in `string`, match in a `caseSensitive`
  67707. * manner or not, and determine whether `re` is a RegExp or not depending of
  67708. * the type of object passed as `r`.
  67709. *
  67710. * Return a tuple
  67711. * 1) list of matches [start, stop] indexes in the string.
  67712. * 2) abort Boolean, if more that 100 matches and the matches were aborted.
  67713. **/
  67714. var getMatches = function(re, string, caseSensitive, r){
  67715. var extra = caseSensitive ? '':'i';
  67716. extra = '';
  67717. try {
  67718. re = r(re, 'g'+extra);// have to global or infinite loop
  67719. } catch (e){
  67720. return [[], false];
  67721. }
  67722. var res = [];
  67723. var match;
  67724. var escape_hatch = 0;
  67725. var abort = false;
  67726. while((match = re.exec(string)) !== null) {
  67727. res.push([match.index, match.index+match[0].length]);
  67728. escape_hatch++;
  67729. if(escape_hatch > 100){
  67730. console.warn(i18n.msg._("More than 100 matches, aborting"));
  67731. abort = true;
  67732. break;
  67733. }
  67734. }
  67735. return [res, abort];
  67736. };
  67737. // main function
  67738. /**
  67739. * Search N' Replace action handler.
  67740. **/
  67741. var snr = function(env, event) {
  67742. var isRegExpButton = $('<button/>')
  67743. .attr('type', 'button')
  67744. .attr('id', 'isreg')
  67745. .addClass("btn btn-default btn-sm")
  67746. .attr('data-toggle','button')
  67747. .css('font-weight', 'bold')
  67748. .attr('title', i18n.msg._('Use regex (JavaScript regex syntax)'))
  67749. .text('.*');
  67750. var allCellsButton = $('<button/>')
  67751. .append($('<i/>').addClass('fa fa-arrows-v'))
  67752. .attr('id', 'findreplace_allcells_btn')
  67753. .attr('type', 'button')
  67754. .addClass("btn btn-default btn-sm")
  67755. .attr('data-toggle','button')
  67756. .attr('title', i18n.msg._('Replace in all cells'));
  67757. var isCaseSensitiveButton = $('<button/>')
  67758. .attr('type', 'button')
  67759. .addClass("btn btn-default btn-sm")
  67760. .attr('data-toggle','button')
  67761. .attr('tabindex', '0')
  67762. .attr('title', i18n.msg._('Match case'))
  67763. .css('font-weight', 'bold')
  67764. .text('Aa');
  67765. var search = $("<input/>")
  67766. .addClass('form-control input-sm')
  67767. .attr('id', 'findreplace_find_inp')
  67768. .attr('placeholder',i18n.msg._('Find'));
  67769. var findFormGroup = $('<div/>').addClass('form-group');
  67770. findFormGroup.append(
  67771. $('<div/>').addClass('input-group')
  67772. .append(
  67773. $('<div/>').addClass('input-group-btn')
  67774. .append(isCaseSensitiveButton)
  67775. .append(isRegExpButton)
  67776. .append(allCellsButton)
  67777. )
  67778. .append(search)
  67779. )
  67780. var replace = $("<input/>")
  67781. .attr('id', 'findreplace_replace_inp')
  67782. .addClass('form-control input-sm')
  67783. .attr('placeholder',i18n.msg._('Replace'));
  67784. var replaceFormGroup = $('<div/>').addClass('form-group');
  67785. replaceFormGroup.append(replace);
  67786. var body = $('<div/>').attr('id', 'replace-preview');
  67787. var form = $('<form/>').attr('id', 'find-and-replace')
  67788. form.append(findFormGroup);
  67789. form.append(replaceFormGroup);
  67790. form.append(body);
  67791. // return whether the search is case sensitive
  67792. var isCaseSensitive = function(){
  67793. var value = isCaseSensitiveButton.attr('aria-pressed') == 'true';
  67794. return value;
  67795. };
  67796. // return whether the search is RegExp based, or
  67797. // plain string matching.
  67798. var isReg = function(){
  67799. var value = isRegExpButton.attr('aria-pressed') == 'true';
  67800. return value;
  67801. };
  67802. var allCells = function(){
  67803. return (allCellsButton.attr('aria-pressed') == 'true');
  67804. };
  67805. // return a Pseudo RegExp object that acts
  67806. // either as a plain RegExp Object, or as a pure string matching.
  67807. // automatically set the flags for case sensitivity from the UI
  67808. var RegExpOrNot = function(str, flags){
  67809. if (!isCaseSensitive()){
  67810. flags = (flags || '')+'i';
  67811. }
  67812. if (isRegExpButton.attr('aria-pressed') === 'true'){
  67813. return new RegExp(str, flags);
  67814. } else {
  67815. return new RegExp(escapeRegExp(str), flags);
  67816. }
  67817. };
  67818. var onError = function(body){
  67819. body.empty();
  67820. body.append($('<p/>').text(i18n.msg._('No matches, invalid or empty regular expression')));
  67821. };
  67822. var get_cells = function(env){
  67823. if(allCells()){
  67824. return env.notebook.get_cells();
  67825. } else {
  67826. return env.notebook.get_selected_cells();
  67827. }
  67828. };
  67829. var get_all_text = function(cells) {
  67830. var arr = [];
  67831. for (var c = 0; c < cells.length; c++) {
  67832. arr = arr.concat(cells[c].code_mirror.getValue().split('\n'));
  67833. }
  67834. return arr;
  67835. };
  67836. /**
  67837. * callback triggered anytime a change is made to the
  67838. * request, case sensitivity, isregex, search or replace
  67839. * modification.
  67840. **/
  67841. var onChange = function(){
  67842. var sre = search.val();
  67843. // abort on invalid RE
  67844. if (!sre) {
  67845. return onError(body);
  67846. }
  67847. try {
  67848. new RegExpOrNot(sre);
  67849. } catch (e) {
  67850. return onError(body);
  67851. }
  67852. // might want to warn if replace is empty
  67853. var replaceValue = replace.val();
  67854. var lines = get_all_text(get_cells(env));
  67855. var _hb = compute_preview_model(sre, lines, isCaseSensitive(), RegExpOrNot, replaceValue);
  67856. var html = _hb[0];
  67857. var aborted = _hb[1];
  67858. build_preview(body, aborted, html, replaceValue);
  67859. // done on type return false not to submit form
  67860. return false;
  67861. };
  67862. var onsubmit = function(event) {
  67863. var sre = search.val();
  67864. var replaceValue = replace.val();
  67865. if (!sre) {
  67866. return false;
  67867. }
  67868. // should abort on invalid RegExp.
  67869. // need to be multi line if we want to directly replace in codemirror.
  67870. // or need to split/replace/join
  67871. var reg = RegExpOrNot(sre, 'gm');
  67872. var cells = get_cells(env);
  67873. for (var c = 0; c < cells.length; c++) {
  67874. var cell = cells[c];
  67875. if (!cell.is_editable()) {
  67876. continue;
  67877. }
  67878. var oldvalue = cell.code_mirror.getValue();
  67879. var newvalue = oldvalue.replace(reg , replaceValue);
  67880. cell.code_mirror.setValue(newvalue);
  67881. if (cell.cell_type === 'markdown') {
  67882. cell.rendered = false;
  67883. cell.render();
  67884. }
  67885. }
  67886. };
  67887. // wire-up the UI
  67888. isRegExpButton.click(function(){
  67889. search.focus();
  67890. setTimeout(function(){onChange();}, 100);
  67891. });
  67892. isCaseSensitiveButton.click(function(){
  67893. search.focus();
  67894. setTimeout(function(){onChange();}, 100);
  67895. });
  67896. allCellsButton.click(function(){
  67897. replace.focus();
  67898. setTimeout(function(){onChange();}, 100);
  67899. });
  67900. search.keypress(function (e) {
  67901. if (e.which == 13) {//enter
  67902. replace.focus();
  67903. }
  67904. });
  67905. search.on('input', onChange);
  67906. replace.on('input', onChange);
  67907. // This statement is used simply so that message extraction
  67908. // will pick up the strings. The actual setting of the text
  67909. // for the button is in dialog.js.
  67910. var button_labels = [ i18n.msg._("Replace All")];
  67911. var mod = dialog.modal({
  67912. show: false,
  67913. title: i18n.msg._("Find and Replace"),
  67914. body:form,
  67915. keyboard_manager: env.notebook.keyboard_manager,
  67916. buttons:{
  67917. 'Replace All':{ class: "btn-primary",
  67918. click: function(event){onsubmit(event); return true;},
  67919. id: "findreplace_replaceall_btn",
  67920. }
  67921. },
  67922. open: function(){
  67923. search.focus();
  67924. }
  67925. });
  67926. replace.keypress(function (e) {
  67927. if (e.which == 13) {//enter
  67928. onsubmit();
  67929. mod.modal('hide');
  67930. }
  67931. });
  67932. mod.modal('show');
  67933. };
  67934. var load = function(keyboard_manager){
  67935. var action_all = {
  67936. cmd: i18n.msg._('find and replace'),
  67937. help: i18n.msg._('find and replace'),
  67938. handler: function(env, event){
  67939. snr(env, event);
  67940. }
  67941. };
  67942. var act_all = keyboard_manager.actions.register(action_all, 'find-and-replace', 'jupyter-notebook');
  67943. keyboard_manager.command_shortcuts.add_shortcuts({
  67944. 'f': 'jupyter-notebook:find-and-replace'
  67945. });
  67946. };
  67947. return {load:load};
  67948. });
  67949. // Copyright (c) Jupyter Development Team.
  67950. // Distributed under the terms of the Modified BSD License.
  67951. define('notebook/js/clipboard',[
  67952. 'jquery',
  67953. 'base/js/namespace',
  67954. 'base/js/utils',
  67955. 'base/js/i18n',
  67956. 'base/js/dialog'
  67957. ], function($, Jupyter, utils, i18n, dialog) {
  67958. var jcbprefix = '<pre class="jupyter-nb-cells-json">';
  67959. var jcbsuffix = '</pre>';
  67960. function store_json(cells, clipboard) {
  67961. // Firefox ignores application/json mime type, so put it in HTML as well.
  67962. // We also copy a text version so you can paste cell sources into a text editor
  67963. var j = JSON.stringify(cells);
  67964. var t = cells.map(function(c) {return c.source;}).join('\n\n');
  67965. clipboard.setData('text/plain', t);
  67966. clipboard.setData('text/html', jcbprefix + j + jcbsuffix);
  67967. clipboard.setData('application/json', j);
  67968. }
  67969. function load_json(clipboard) {
  67970. var s = clipboard.getData('text/html');
  67971. // System/browsers may add some more stuff before/after our content, so
  67972. // find where our prefix and suffix are.
  67973. var pix = s.indexOf(jcbprefix);
  67974. var six = s.lastIndexOf(jcbsuffix);
  67975. if (pix === -1 || six === -1) {
  67976. return null;
  67977. }
  67978. return JSON.parse(s.slice(pix + jcbprefix.length, six));
  67979. }
  67980. function isProgrammaticCopy(event) {
  67981. return (typeof(event.target.selectionStart) !== 'undefined'
  67982. && typeof(event.target.selectionEnd) !== 'undefined'
  67983. && ((event.target.selectionEnd - event.target.selectionStart) > 0));
  67984. }
  67985. function copy(event) {
  67986. if ((Jupyter.notebook.mode !== 'command') ||
  67987. // window.getSelection checks if text is selected, e.g. in output
  67988. !window.getSelection().isCollapsed ||
  67989. // Allow programmatic copy
  67990. isProgrammaticCopy(event)) {
  67991. return;
  67992. }
  67993. var selecn = Jupyter.notebook.get_selected_cells().map(
  67994. function(c) { return c.toJSON();});
  67995. store_json(selecn, event.clipboardData);
  67996. event.preventDefault();
  67997. }
  67998. function paste(event) {
  67999. if (Jupyter.notebook.mode !== 'command') {
  68000. return;
  68001. }
  68002. console.log(i18n.msg.sprintf(i18n.msg._('Clipboard types: %s'),event.clipboardData.types));
  68003. cells = load_json(event.clipboardData);
  68004. // console.log(cells);
  68005. // Does this JSON look like cells?
  68006. if (Array.isArray(cells) && (cells.length > 0) &&
  68007. cells[0].cell_type && cells[0].source) {
  68008. var first_inserted = null;
  68009. for (var i=0; i < cells.length; i++) {
  68010. var cell_data = cells[i];
  68011. var new_cell = Jupyter.notebook.insert_cell_above(cell_data.cell_type);
  68012. new_cell.fromJSON(cell_data);
  68013. if (first_inserted === null) {
  68014. first_inserted = new_cell;
  68015. }
  68016. }
  68017. first_inserted.focus_cell();
  68018. }
  68019. event.preventDefault();
  68020. }
  68021. function notebookOnlyEvent(callback) {
  68022. // Only call the callback to redirect the event if the notebook should be
  68023. // handling the events, at the discretion of the keyboard manager.
  68024. // If the focus is in a text widget or something (kbmanager disabled),
  68025. // allow the default event.
  68026. return function() {
  68027. if (Jupyter.keyboard_manager.enabled) {
  68028. callback.apply(this, arguments);
  68029. }
  68030. };
  68031. }
  68032. function needs_text_box_for_paste_event() {
  68033. // I know this is bad, but I don't know a better way to check this
  68034. return navigator.userAgent.indexOf('Firefox') !== -1;
  68035. }
  68036. function setup_paste_dialog() {
  68037. // Firefox only fires a paste event if the cursor is in a text input. So, on
  68038. // Ctrl-V, bring up a dialog with an invisible text box and catch the
  68039. // second Ctrl-V
  68040. var action = {
  68041. icon: 'fa-clipboard', // a font-awesome class used on buttons, etc
  68042. help : i18n.msg._('Dialog for paste from system clipboard'),
  68043. help_index : 'zz',
  68044. handler : function () {
  68045. var entry_box = $('<input type="text"/>');
  68046. entry_box.css('opacity', 0);
  68047. function paste_close_dlg(e) {
  68048. paste(e);
  68049. // There must be a better way to do this, but it's not any of:
  68050. // .hide(), .remove() or .dialog('close')
  68051. paste_dlg.find('.close').click();
  68052. document.removeEventListener('paste', paste_close_dlg);
  68053. }
  68054. document.addEventListener('paste', paste_close_dlg);
  68055. var cmdtrl = i18n.msg._('Ctrl-V');
  68056. if (utils.platform === 'MacOS') {
  68057. cmdtrl = i18n.msg._('Cmd-V');
  68058. }
  68059. var dialog_body = $("<div/>").append("<p>").append(i18n.msg.sprintf(i18n.msg._("Press %s again to paste"),cmdtrl))
  68060. .append("<br/>")
  68061. .append("<p><b>")
  68062. .append(i18n.msg._("Why is this needed? "))
  68063. .append("</b>")
  68064. .append(i18n.msg._("We can't get paste events in this browser without a text box. "))
  68065. .append(i18n.msg._("There's an invisible text box focused in this dialog."))
  68066. .append($("<form/>").append(entry_box));
  68067. var paste_dlg = dialog.modal({
  68068. notebook: Jupyter.notebook,
  68069. keyboard_manager: Jupyter.keyboard_manager,
  68070. title : i18n.msg.sprintf(i18n.msg._("%s to paste"),cmdtrl),
  68071. body : dialog_body,
  68072. open: function() {
  68073. entry_box.focus();
  68074. },
  68075. buttons : {
  68076. "Cancel" : {
  68077. // click : function() { reject("Dialog cancelled"); },
  68078. }
  68079. }
  68080. });
  68081. }
  68082. };
  68083. var full_action_name = Jupyter.actions.register(action, 'paste-dialog', 'system-clipboard');
  68084. Jupyter.keyboard_manager.command_shortcuts.add_shortcut('Cmdtrl-V', full_action_name);
  68085. }
  68086. // Set clipboard event listeners on the document.
  68087. return {setup_clipboard_events: function() {
  68088. document.addEventListener('copy', notebookOnlyEvent(copy));
  68089. if (needs_text_box_for_paste_event()) {
  68090. setup_paste_dialog();
  68091. } else {
  68092. document.addEventListener('paste', notebookOnlyEvent(paste));
  68093. }
  68094. }};
  68095. });
  68096. // Copyright (c) Jupyter Development Team.
  68097. // Distributed under the terms of the Modified BSD License.
  68098. // adapted from Mozilla Developer Network example at
  68099. // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind
  68100. // shim `bind` for testing under casper.js
  68101. var bind = function bind(obj) {
  68102. var slice = [].slice;
  68103. var args = slice.call(arguments, 1),
  68104. self = this,
  68105. nop = function() {
  68106. },
  68107. bound = function() {
  68108. return self.apply(this instanceof nop ? this : (obj || {}), args.concat(slice.call(arguments)));
  68109. };
  68110. nop.prototype = this.prototype || {}; // Firefox cries sometimes if prototype is undefined
  68111. bound.prototype = new nop();
  68112. return bound;
  68113. };
  68114. Function.prototype.bind = Function.prototype.bind || bind ;
  68115. requirejs.config({
  68116. map: {
  68117. "*": {
  68118. "typeahead": "jquery-typeahead"
  68119. }
  68120. }
  68121. })
  68122. requirejs([
  68123. 'jquery',
  68124. 'contents',
  68125. 'base/js/namespace',
  68126. 'notebook/js/notebook',
  68127. 'services/config',
  68128. 'base/js/utils',
  68129. 'base/js/page',
  68130. 'base/js/events',
  68131. 'base/js/promises',
  68132. 'auth/js/loginwidget',
  68133. 'notebook/js/maintoolbar',
  68134. 'notebook/js/pager',
  68135. 'notebook/js/promises',
  68136. 'notebook/js/quickhelp',
  68137. 'notebook/js/menubar',
  68138. 'notebook/js/notificationarea',
  68139. 'notebook/js/savewidget',
  68140. 'notebook/js/actions',
  68141. 'notebook/js/keyboardmanager',
  68142. 'notebook/js/kernelselector',
  68143. 'codemirror/lib/codemirror',
  68144. 'notebook/js/about',
  68145. 'notebook/js/searchandreplace',
  68146. 'notebook/js/clipboard',
  68147. 'bidi/bidi',
  68148. 'notebook/js/celltoolbarpresets/tags',
  68149. 'custom-preload'
  68150. ], function(
  68151. $,
  68152. contents_service,
  68153. IPython,
  68154. notebook,
  68155. configmod,
  68156. utils,
  68157. page,
  68158. events,
  68159. promises,
  68160. loginwidget,
  68161. maintoolbar,
  68162. pager,
  68163. nb_promises,
  68164. quickhelp,
  68165. menubar,
  68166. notificationarea,
  68167. savewidget,
  68168. actions,
  68169. keyboardmanager,
  68170. kernelselector,
  68171. CodeMirror,
  68172. about,
  68173. searchandreplace,
  68174. clipboard,
  68175. bidi
  68176. ) {
  68177. "use strict";
  68178. // Pull typeahead from the global jquery object
  68179. var typeahead = $.typeahead;
  68180. try{
  68181. requirejs(['custom/custom'], function() {});
  68182. bidi.loadLocale();
  68183. } catch(err) {
  68184. console.log("Error processing custom.js. Logging and continuing");
  68185. console.warn(err);
  68186. }
  68187. // compat with old IPython, remove for IPython > 3.0
  68188. window.CodeMirror = CodeMirror;
  68189. // Setup all of the config related things
  68190. var common_options = {
  68191. ws_url : utils.get_body_data("wsUrl"),
  68192. base_url : utils.get_body_data("baseUrl"),
  68193. nbclassic_path: document.nbclassicPath || "",
  68194. notebook_path : utils.get_body_data("notebookPath"),
  68195. notebook_name : utils.get_body_data('notebookName')
  68196. };
  68197. var config_section = new configmod.ConfigSection('notebook', common_options);
  68198. config_section.load();
  68199. var common_config = new configmod.ConfigSection('common', common_options);
  68200. common_config.load();
  68201. // Instantiate the main objects
  68202. var page = new page.Page('div#header', 'div#site');
  68203. var pager = new pager.Pager('div#pager', {
  68204. events: events});
  68205. var acts = new actions.init();
  68206. var keyboard_manager = new keyboardmanager.KeyboardManager({
  68207. pager: pager,
  68208. events: events,
  68209. actions: acts,
  68210. config: config_section,
  68211. });
  68212. var save_widget = new savewidget.SaveWidget('span#save_widget', {
  68213. events: events,
  68214. keyboard_manager: keyboard_manager});
  68215. acts.extend_env({save_widget:save_widget});
  68216. var contents = new contents_service.Contents({
  68217. base_url: common_options.base_url,
  68218. common_config: common_config
  68219. });
  68220. var notebook = new notebook.Notebook('div#notebook', $.extend({
  68221. events: events,
  68222. keyboard_manager: keyboard_manager,
  68223. save_widget: save_widget,
  68224. contents: contents,
  68225. config: config_section},
  68226. common_options));
  68227. var login_widget = new loginwidget.LoginWidget('span#login_widget', common_options);
  68228. var toolbar = new maintoolbar.MainToolBar('#maintoolbar-container', {
  68229. notebook: notebook,
  68230. events: events,
  68231. actions: acts});
  68232. var quick_help = new quickhelp.QuickHelp({
  68233. keyboard_manager: keyboard_manager,
  68234. events: events,
  68235. notebook: notebook});
  68236. keyboard_manager.set_notebook(notebook);
  68237. keyboard_manager.set_quickhelp(quick_help);
  68238. var menubar = new menubar.MenuBar('#menubar', $.extend({
  68239. notebook: notebook,
  68240. contents: contents,
  68241. events: events,
  68242. save_widget: save_widget,
  68243. quick_help: quick_help,
  68244. actions: acts,
  68245. config: config_section},
  68246. common_options));
  68247. var notification_area = new notificationarea.NotebookNotificationArea(
  68248. '#notification_area', {
  68249. events: events,
  68250. save_widget: save_widget,
  68251. notebook: notebook,
  68252. keyboard_manager: keyboard_manager});
  68253. notification_area.init_notification_widgets();
  68254. var kernel_selector = new kernelselector.KernelSelector(
  68255. '#kernel_logo_widget', notebook, common_options);
  68256. searchandreplace.load(keyboard_manager);
  68257. $('body').append('<div id="fonttest"><pre><span id="test1">x</span>'+
  68258. '<span id="test2" style="font-weight: bold;">x</span>'+
  68259. '<span id="test3" style="font-style: italic;">x</span></pre></div>');
  68260. var nh = $('#test1').innerHeight();
  68261. var bh = $('#test2').innerHeight();
  68262. var ih = $('#test3').innerHeight();
  68263. if(nh != bh || nh != ih) {
  68264. $('head').append('<style>.CodeMirror span { vertical-align: bottom; }</style>');
  68265. }
  68266. $('#fonttest').remove();
  68267. page.show();
  68268. events.one('notebook_loaded.Notebook', function () {
  68269. var hash = document.location.hash;
  68270. if (hash) {
  68271. document.location.hash = '';
  68272. document.location.hash = hash;
  68273. }
  68274. notebook.set_autosave_interval(notebook.minimum_autosave_interval);
  68275. });
  68276. IPython.page = page;
  68277. IPython.notebook = notebook;
  68278. IPython.contents = contents;
  68279. IPython.pager = pager;
  68280. IPython.quick_help = quick_help;
  68281. IPython.login_widget = login_widget;
  68282. IPython.menubar = menubar;
  68283. IPython.toolbar = toolbar;
  68284. IPython.notification_area = notification_area;
  68285. IPython.keyboard_manager = keyboard_manager;
  68286. IPython.save_widget = save_widget;
  68287. IPython.tooltip = notebook.tooltip;
  68288. try {
  68289. events.trigger('app_initialized.NotebookApp');
  68290. } catch (e) {
  68291. console.error("Error in app_initialized callback", e);
  68292. }
  68293. Object.defineProperty( IPython, 'actions', {
  68294. get: function() {
  68295. console.warn('accessing "actions" on the global IPython/Jupyter is not recommended. Pass it to your objects constructors at creation time');
  68296. return acts;
  68297. },
  68298. enumerable: true,
  68299. configurable: false
  68300. });
  68301. clipboard.setup_clipboard_events();
  68302. // Now actually load nbextensionsload_extensions_from_config
  68303. Promise.all([
  68304. utils.load_extensions_from_config(config_section),
  68305. utils.load_extensions_from_config(common_config),
  68306. ])
  68307. .catch(function(error) {
  68308. console.error('Could not load nbextensions from user config files', error);
  68309. })
  68310. // BEGIN HARDCODED WIDGETS HACK
  68311. .then(function() {
  68312. if (!utils.is_loaded('jupyter-js-widgets/extension')) {
  68313. // Fallback to the ipywidgets extension
  68314. utils.load_extension('widgets/notebook/js/extension').catch(function () {
  68315. console.warn('Widgets are not available. Please install widgetsnbextension or ipywidgets 4.0');
  68316. });
  68317. }
  68318. })
  68319. .catch(function(error) {
  68320. console.error('Could not load ipywidgets', error);
  68321. });
  68322. // END HARDCODED WIDGETS HACK
  68323. notebook.load_notebook(common_options.notebook_path);
  68324. });
  68325. define("notebook/js/main", function(){});
  68326. //# sourceMappingURL=main.min.js.map