ivprog.bundle.js~ 1.9 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233
  1. var ivprogCore =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/
  6. /******/ // The require function
  7. /******/ function __webpack_require__(moduleId) {
  8. /******/
  9. /******/ // Check if module is in cache
  10. /******/ if(installedModules[moduleId]) {
  11. /******/ return installedModules[moduleId].exports;
  12. /******/ }
  13. /******/ // Create a new module (and put it into the cache)
  14. /******/ var module = installedModules[moduleId] = {
  15. /******/ i: moduleId,
  16. /******/ l: false,
  17. /******/ exports: {}
  18. /******/ };
  19. /******/
  20. /******/ // Execute the module function
  21. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22. /******/
  23. /******/ // Flag the module as loaded
  24. /******/ module.l = true;
  25. /******/
  26. /******/ // Return the exports of the module
  27. /******/ return module.exports;
  28. /******/ }
  29. /******/
  30. /******/
  31. /******/ // expose the modules object (__webpack_modules__)
  32. /******/ __webpack_require__.m = modules;
  33. /******/
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/
  37. /******/ // define getter function for harmony exports
  38. /******/ __webpack_require__.d = function(exports, name, getter) {
  39. /******/ if(!__webpack_require__.o(exports, name)) {
  40. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41. /******/ }
  42. /******/ };
  43. /******/
  44. /******/ // define __esModule on exports
  45. /******/ __webpack_require__.r = function(exports) {
  46. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48. /******/ }
  49. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  50. /******/ };
  51. /******/
  52. /******/ // create a fake namespace object
  53. /******/ // mode & 1: value is a module id, require it
  54. /******/ // mode & 2: merge all properties of value into the ns
  55. /******/ // mode & 4: return value when already ns object
  56. /******/ // mode & 8|1: behave like require
  57. /******/ __webpack_require__.t = function(value, mode) {
  58. /******/ if(mode & 1) value = __webpack_require__(value);
  59. /******/ if(mode & 8) return value;
  60. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61. /******/ var ns = Object.create(null);
  62. /******/ __webpack_require__.r(ns);
  63. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65. /******/ return ns;
  66. /******/ };
  67. /******/
  68. /******/ // getDefaultExport function for compatibility with non-harmony modules
  69. /******/ __webpack_require__.n = function(module) {
  70. /******/ var getter = module && module.__esModule ?
  71. /******/ function getDefault() { return module['default']; } :
  72. /******/ function getModuleExports() { return module; };
  73. /******/ __webpack_require__.d(getter, 'a', getter);
  74. /******/ return getter;
  75. /******/ };
  76. /******/
  77. /******/ // Object.prototype.hasOwnProperty.call
  78. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79. /******/
  80. /******/ // __webpack_public_path__
  81. /******/ __webpack_require__.p = "";
  82. /******/
  83. /******/
  84. /******/ // Load entry module and return exports
  85. /******/ return __webpack_require__(__webpack_require__.s = "./js/main.js");
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ({
  89. /***/ "./grammar/en/ivprog.g4":
  90. /*!******************************!*\
  91. !*** ./grammar/en/ivprog.g4 ***!
  92. \******************************/
  93. /*! no static exports found */
  94. /***/ (function(module, exports, __webpack_require__) {
  95. module.exports =
  96. /******/ (function(modules) { // webpackBootstrap
  97. /******/ // The module cache
  98. /******/ var installedModules = {};
  99. /******/
  100. /******/ // The require function
  101. /******/ function __webpack_require__(moduleId) {
  102. /******/
  103. /******/ // Check if module is in cache
  104. /******/ if(installedModules[moduleId]) {
  105. /******/ return installedModules[moduleId].exports;
  106. /******/ }
  107. /******/ // Create a new module (and put it into the cache)
  108. /******/ var module = installedModules[moduleId] = {
  109. /******/ i: moduleId,
  110. /******/ l: false,
  111. /******/ exports: {}
  112. /******/ };
  113. /******/
  114. /******/ // Execute the module function
  115. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  116. /******/
  117. /******/ // Flag the module as loaded
  118. /******/ module.l = true;
  119. /******/
  120. /******/ // Return the exports of the module
  121. /******/ return module.exports;
  122. /******/ }
  123. /******/
  124. /******/
  125. /******/ // expose the modules object (__webpack_modules__)
  126. /******/ __webpack_require__.m = modules;
  127. /******/
  128. /******/ // expose the module cache
  129. /******/ __webpack_require__.c = installedModules;
  130. /******/
  131. /******/ // identity function for calling harmony imports with the correct context
  132. /******/ __webpack_require__.i = function(value) { return value; };
  133. /******/
  134. /******/ // define getter function for harmony exports
  135. /******/ __webpack_require__.d = function(exports, name, getter) {
  136. /******/ if(!__webpack_require__.o(exports, name)) {
  137. /******/ Object.defineProperty(exports, name, {
  138. /******/ configurable: false,
  139. /******/ enumerable: true,
  140. /******/ get: getter
  141. /******/ });
  142. /******/ }
  143. /******/ };
  144. /******/
  145. /******/ // getDefaultExport function for compatibility with non-harmony modules
  146. /******/ __webpack_require__.n = function(module) {
  147. /******/ var getter = module && module.__esModule ?
  148. /******/ function getDefault() { return module['default']; } :
  149. /******/ function getModuleExports() { return module; };
  150. /******/ __webpack_require__.d(getter, 'a', getter);
  151. /******/ return getter;
  152. /******/ };
  153. /******/
  154. /******/ // Object.prototype.hasOwnProperty.call
  155. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  156. /******/
  157. /******/ // __webpack_public_path__
  158. /******/ __webpack_require__.p = "";
  159. /******/
  160. /******/ // Load entry module and return exports
  161. /******/ return __webpack_require__(__webpack_require__.s = 1);
  162. /******/ })
  163. /************************************************************************/
  164. /******/ ([
  165. /* 0 */
  166. /***/ (function(module, exports, __webpack_require__) {
  167. // Generated from /tmp/tmp-20960K1oDCbiw48SG/ivprog.g4 by ANTLR 4.7
  168. // jshint ignore: start
  169. var antlr4 = __webpack_require__(2);
  170. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  171. "\u0002/\u01d1\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  172. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  173. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  174. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  175. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  176. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  177. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  178. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  179. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  180. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  181. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  182. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  183. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  184. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003\u0003\u0003",
  185. "\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003\u0004\u0003",
  186. "\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003",
  187. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003\u0006\u0003",
  188. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0007\u0003",
  189. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  190. "\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  191. "\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  192. "\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b\u0003\u000b\u0003",
  193. "\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003",
  194. "\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003",
  195. "\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  196. "\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  197. "\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u0010\u0003",
  198. "\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0011\u0003",
  199. "\u0011\u0003\u0011\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  200. "\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003\u0014\u0003",
  201. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0015\u0003\u0015\u0003",
  202. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0016\u0003\u0016\u0003",
  203. "\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003\u0017\u0003\u0017\u0003",
  204. "\u0017\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  205. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  206. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  207. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  208. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  209. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0125\n&\u0003\'\u0003\'\u0003",
  210. "(\u0003(\u0003)\u0003)\u0007)\u012d\n)\f)\u000e)\u0130\u000b)\u0003",
  211. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0137\n+\r+\u000e+\u0138\u0003",
  212. "+\u0003+\u0003+\u0003+\u0005+\u013f\n+\u0003+\u0006+\u0142\n+\r+\u000e",
  213. "+\u0143\u0003+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d",
  214. "\n+\r+\u000e+\u014e\u0005+\u0151\n+\u0003,\u0006,\u0154\n,\r,\u000e",
  215. ",\u0155\u0003,\u0003,\u0006,\u015a\n,\r,\u000e,\u015b\u0003,\u0006,",
  216. "\u015f\n,\r,\u000e,\u0160\u0003,\u0003,\u0007,\u0165\n,\f,\u000e,\u0168",
  217. "\u000b,\u0003,\u0005,\u016b\n,\u0003-\u0003-\u0005-\u016f\n-\u0003-",
  218. "\u0006-\u0172\n-\r-\u000e-\u0173\u0003.\u0003.\u0007.\u0178\n.\f.\u000e",
  219. ".\u017b\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u0181\n/\u00030\u0003",
  220. "0\u00030\u00050\u0186\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  221. "2\u00032\u00033\u00063\u0191\n3\r3\u000e3\u0192\u00033\u00053\u0196",
  222. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01a0",
  223. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  224. "7\u00037\u00057\u01ad\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  225. "8\u00039\u00039\u00039\u00039\u00079\u01ba\n9\f9\u000e9\u01bd\u000b",
  226. "9\u00039\u00059\u01c0\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01c7",
  227. "\n9\f9\u000e9\u01ca\u000b9\u00039\u00039\u00059\u01ce\n9\u00039\u0003",
  228. "9\u0003\u01c8\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  229. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  230. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  231. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  232. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  233. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  234. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  235. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  236. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  237. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  238. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01e5\u0002\u0003\u0003",
  239. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  240. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  241. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  242. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  243. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  244. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  245. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  246. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  247. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  248. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  249. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  250. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  251. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  252. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  253. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  254. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  255. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  256. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  257. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  258. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  259. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  260. "s\u0003\u0002\u0002\u0002\u0005{\u0003\u0002\u0002\u0002\u0007\u0080",
  261. "\u0003\u0002\u0002\u0002\t\u0085\u0003\u0002\u0002\u0002\u000b\u008d",
  262. "\u0003\u0002\u0002\u0002\r\u0094\u0003\u0002\u0002\u0002\u000f\u009c",
  263. "\u0003\u0002\u0002\u0002\u0011\u00a6\u0003\u0002\u0002\u0002\u0013\u00ad",
  264. "\u0003\u0002\u0002\u0002\u0015\u00b2\u0003\u0002\u0002\u0002\u0017\u00bc",
  265. "\u0003\u0002\u0002\u0002\u0019\u00c2\u0003\u0002\u0002\u0002\u001b\u00cb",
  266. "\u0003\u0002\u0002\u0002\u001d\u00d2\u0003\u0002\u0002\u0002\u001f\u00d6",
  267. "\u0003\u0002\u0002\u0002!\u00dc\u0003\u0002\u0002\u0002#\u00df\u0003",
  268. "\u0002\u0002\u0002%\u00e5\u0003\u0002\u0002\u0002\'\u00e8\u0003\u0002",
  269. "\u0002\u0002)\u00ed\u0003\u0002\u0002\u0002+\u00f3\u0003\u0002\u0002",
  270. "\u0002-\u00f8\u0003\u0002\u0002\u0002/\u00fc\u0003\u0002\u0002\u0002",
  271. "1\u0100\u0003\u0002\u0002\u00023\u0103\u0003\u0002\u0002\u00025\u0105",
  272. "\u0003\u0002\u0002\u00027\u0107\u0003\u0002\u0002\u00029\u0109\u0003",
  273. "\u0002\u0002\u0002;\u010b\u0003\u0002\u0002\u0002=\u010d\u0003\u0002",
  274. "\u0002\u0002?\u010f\u0003\u0002\u0002\u0002A\u0111\u0003\u0002\u0002",
  275. "\u0002C\u0113\u0003\u0002\u0002\u0002E\u0115\u0003\u0002\u0002\u0002",
  276. "G\u0117\u0003\u0002\u0002\u0002I\u0119\u0003\u0002\u0002\u0002K\u0124",
  277. "\u0003\u0002\u0002\u0002M\u0126\u0003\u0002\u0002\u0002O\u0128\u0003",
  278. "\u0002\u0002\u0002Q\u012a\u0003\u0002\u0002\u0002S\u0131\u0003\u0002",
  279. "\u0002\u0002U\u0150\u0003\u0002\u0002\u0002W\u016a\u0003\u0002\u0002",
  280. "\u0002Y\u016c\u0003\u0002\u0002\u0002[\u0175\u0003\u0002\u0002\u0002",
  281. "]\u0180\u0003\u0002\u0002\u0002_\u0182\u0003\u0002\u0002\u0002a\u0189",
  282. "\u0003\u0002\u0002\u0002c\u018d\u0003\u0002\u0002\u0002e\u0195\u0003",
  283. "\u0002\u0002\u0002g\u0197\u0003\u0002\u0002\u0002i\u0199\u0003\u0002",
  284. "\u0002\u0002k\u019f\u0003\u0002\u0002\u0002m\u01ac\u0003\u0002\u0002",
  285. "\u0002o\u01ae\u0003\u0002\u0002\u0002q\u01cd\u0003\u0002\u0002\u0002",
  286. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  287. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  288. "\u0002z\u0004\u0003\u0002\u0002\u0002{|\u0007t\u0002\u0002|}\u0007g",
  289. "\u0002\u0002}~\u0007c\u0002\u0002~\u007f\u0007n\u0002\u0002\u007f\u0006",
  290. "\u0003\u0002\u0002\u0002\u0080\u0081\u0007x\u0002\u0002\u0081\u0082",
  291. "\u0007q\u0002\u0002\u0082\u0083\u0007k\u0002\u0002\u0083\u0084\u0007",
  292. "f\u0002\u0002\u0084\b\u0003\u0002\u0002\u0002\u0085\u0086\u0007d\u0002",
  293. "\u0002\u0086\u0087\u0007q\u0002\u0002\u0087\u0088\u0007q\u0002\u0002",
  294. "\u0088\u0089\u0007n\u0002\u0002\u0089\u008a\u0007g\u0002\u0002\u008a",
  295. "\u008b\u0007c\u0002\u0002\u008b\u008c\u0007p\u0002\u0002\u008c\n\u0003",
  296. "\u0002\u0002\u0002\u008d\u008e\u0007u\u0002\u0002\u008e\u008f\u0007",
  297. "v\u0002\u0002\u008f\u0090\u0007t\u0002\u0002\u0090\u0091\u0007k\u0002",
  298. "\u0002\u0091\u0092\u0007p\u0002\u0002\u0092\u0093\u0007i\u0002\u0002",
  299. "\u0093\f\u0003\u0002\u0002\u0002\u0094\u0095\u0007k\u0002\u0002\u0095",
  300. "\u0096\u0007p\u0002\u0002\u0096\u0097\u0007v\u0002\u0002\u0097\u0098",
  301. "\u0007g\u0002\u0002\u0098\u0099\u0007i\u0002\u0002\u0099\u009a\u0007",
  302. "g\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u000e\u0003\u0002",
  303. "\u0002\u0002\u009c\u009d\u0007e\u0002\u0002\u009d\u009e\u0007j\u0002",
  304. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  305. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  306. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  307. "\u0007t\u0002\u0002\u00a5\u0010\u0003\u0002\u0002\u0002\u00a6\u00a7",
  308. "\u0007u\u0002\u0002\u00a7\u00a8\u0007y\u0002\u0002\u00a8\u00a9\u0007",
  309. "k\u0002\u0002\u00a9\u00aa\u0007v\u0002\u0002\u00aa\u00ab\u0007e\u0002",
  310. "\u0002\u00ab\u00ac\u0007j\u0002\u0002\u00ac\u0012\u0003\u0002\u0002",
  311. "\u0002\u00ad\u00ae\u0007e\u0002\u0002\u00ae\u00af\u0007c\u0002\u0002",
  312. "\u00af\u00b0\u0007u\u0002\u0002\u00b0\u00b1\u0007g\u0002\u0002\u00b1",
  313. "\u0014\u0003\u0002\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3",
  314. "\u00b4\u0007v\u0002\u0002\u00b4\u00b5\u0007j\u0002\u0002\u00b5\u00b6",
  315. "\u0007g\u0002\u0002\u00b6\u00b7\u0007t\u0002\u0002\u00b7\u00b8\u0007",
  316. "y\u0002\u0002\u00b8\u00b9\u0007k\u0002\u0002\u00b9\u00ba\u0007u\u0002",
  317. "\u0002\u00ba\u00bb\u0007g\u0002\u0002\u00bb\u0016\u0003\u0002\u0002",
  318. "\u0002\u00bc\u00bd\u0007e\u0002\u0002\u00bd\u00be\u0007q\u0002\u0002",
  319. "\u00be\u00bf\u0007p\u0002\u0002\u00bf\u00c0\u0007u\u0002\u0002\u00c0",
  320. "\u00c1\u0007v\u0002\u0002\u00c1\u0018\u0003\u0002\u0002\u0002\u00c2",
  321. "\u00c3\u0007h\u0002\u0002\u00c3\u00c4\u0007w\u0002\u0002\u00c4\u00c5",
  322. "\u0007p\u0002\u0002\u00c5\u00c6\u0007e\u0002\u0002\u00c6\u00c7\u0007",
  323. "v\u0002\u0002\u00c7\u00c8\u0007k\u0002\u0002\u00c8\u00c9\u0007q\u0002",
  324. "\u0002\u00c9\u00ca\u0007p\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  325. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  326. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007w\u0002\u0002\u00cf",
  327. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u001c",
  328. "\u0003\u0002\u0002\u0002\u00d2\u00d3\u0007h\u0002\u0002\u00d3\u00d4",
  329. "\u0007q\u0002\u0002\u00d4\u00d5\u0007t\u0002\u0002\u00d5\u001e\u0003",
  330. "\u0002\u0002\u0002\u00d6\u00d7\u0007d\u0002\u0002\u00d7\u00d8\u0007",
  331. "t\u0002\u0002\u00d8\u00d9\u0007g\u0002\u0002\u00d9\u00da\u0007c\u0002",
  332. "\u0002\u00da\u00db\u0007m\u0002\u0002\u00db \u0003\u0002\u0002\u0002",
  333. "\u00dc\u00dd\u0007f\u0002\u0002\u00dd\u00de\u0007q\u0002\u0002\u00de",
  334. "\"\u0003\u0002\u0002\u0002\u00df\u00e0\u0007y\u0002\u0002\u00e0\u00e1",
  335. "\u0007j\u0002\u0002\u00e1\u00e2\u0007k\u0002\u0002\u00e2\u00e3\u0007",
  336. "n\u0002\u0002\u00e3\u00e4\u0007g\u0002\u0002\u00e4$\u0003\u0002\u0002",
  337. "\u0002\u00e5\u00e6\u0007k\u0002\u0002\u00e6\u00e7\u0007h\u0002\u0002",
  338. "\u00e7&\u0003\u0002\u0002\u0002\u00e8\u00e9\u0007g\u0002\u0002\u00e9",
  339. "\u00ea\u0007n\u0002\u0002\u00ea\u00eb\u0007u\u0002\u0002\u00eb\u00ec",
  340. "\u0007g\u0002\u0002\u00ec(\u0003\u0002\u0002\u0002\u00ed\u00ee\u0007",
  341. "h\u0002\u0002\u00ee\u00ef\u0007c\u0002\u0002\u00ef\u00f0\u0007n\u0002",
  342. "\u0002\u00f0\u00f1\u0007u\u0002\u0002\u00f1\u00f2\u0007g\u0002\u0002",
  343. "\u00f2*\u0003\u0002\u0002\u0002\u00f3\u00f4\u0007v\u0002\u0002\u00f4",
  344. "\u00f5\u0007t\u0002\u0002\u00f5\u00f6\u0007w\u0002\u0002\u00f6\u00f7",
  345. "\u0007g\u0002\u0002\u00f7,\u0003\u0002\u0002\u0002\u00f8\u00f9\u0007",
  346. "p\u0002\u0002\u00f9\u00fa\u0007q\u0002\u0002\u00fa\u00fb\u0007v\u0002",
  347. "\u0002\u00fb.\u0003\u0002\u0002\u0002\u00fc\u00fd\u0007C\u0002\u0002",
  348. "\u00fd\u00fe\u0007P\u0002\u0002\u00fe\u00ff\u0007F\u0002\u0002\u00ff",
  349. "0\u0003\u0002\u0002\u0002\u0100\u0101\u0007Q\u0002\u0002\u0101\u0102",
  350. "\u0007T\u0002\u0002\u01022\u0003\u0002\u0002\u0002\u0103\u0104\u0007",
  351. "*\u0002\u0002\u01044\u0003\u0002\u0002\u0002\u0105\u0106\u0007+\u0002",
  352. "\u0002\u01066\u0003\u0002\u0002\u0002\u0107\u0108\u0007]\u0002\u0002",
  353. "\u01088\u0003\u0002\u0002\u0002\u0109\u010a\u0007_\u0002\u0002\u010a",
  354. ":\u0003\u0002\u0002\u0002\u010b\u010c\u0007}\u0002\u0002\u010c<\u0003",
  355. "\u0002\u0002\u0002\u010d\u010e\u0007\u007f\u0002\u0002\u010e>\u0003",
  356. "\u0002\u0002\u0002\u010f\u0110\u0007.\u0002\u0002\u0110@\u0003\u0002",
  357. "\u0002\u0002\u0111\u0112\u0007?\u0002\u0002\u0112B\u0003\u0002\u0002",
  358. "\u0002\u0113\u0114\t\u0002\u0002\u0002\u0114D\u0003\u0002\u0002\u0002",
  359. "\u0115\u0116\t\u0003\u0002\u0002\u0116F\u0003\u0002\u0002\u0002\u0117",
  360. "\u0118\u0005/\u0018\u0002\u0118H\u0003\u0002\u0002\u0002\u0119\u011a",
  361. "\u00051\u0019\u0002\u011aJ\u0003\u0002\u0002\u0002\u011b\u011c\u0007",
  362. "@\u0002\u0002\u011c\u0125\u0007?\u0002\u0002\u011d\u011e\u0007?\u0002",
  363. "\u0002\u011e\u0125\u0007?\u0002\u0002\u011f\u0120\u0007>\u0002\u0002",
  364. "\u0120\u0125\u0007?\u0002\u0002\u0121\u0125\t\u0004\u0002\u0002\u0122",
  365. "\u0123\u0007#\u0002\u0002\u0123\u0125\u0007?\u0002\u0002\u0124\u011b",
  366. "\u0003\u0002\u0002\u0002\u0124\u011d\u0003\u0002\u0002\u0002\u0124\u011f",
  367. "\u0003\u0002\u0002\u0002\u0124\u0121\u0003\u0002\u0002\u0002\u0124\u0122",
  368. "\u0003\u0002\u0002\u0002\u0125L\u0003\u0002\u0002\u0002\u0126\u0127",
  369. "\u0007<\u0002\u0002\u0127N\u0003\u0002\u0002\u0002\u0128\u0129\u0005",
  370. "-\u0017\u0002\u0129P\u0003\u0002\u0002\u0002\u012a\u012e\t\u0005\u0002",
  371. "\u0002\u012b\u012d\t\u0006\u0002\u0002\u012c\u012b\u0003\u0002\u0002",
  372. "\u0002\u012d\u0130\u0003\u0002\u0002\u0002\u012e\u012c\u0003\u0002\u0002",
  373. "\u0002\u012e\u012f\u0003\u0002\u0002\u0002\u012fR\u0003\u0002\u0002",
  374. "\u0002\u0130\u012e\u0003\u0002\u0002\u0002\u0131\u0132\u0005Q)\u0002",
  375. "\u0132\u0133\u00070\u0002\u0002\u0133\u0134\u0005Q)\u0002\u0134T\u0003",
  376. "\u0002\u0002\u0002\u0135\u0137\t\u0007\u0002\u0002\u0136\u0135\u0003",
  377. "\u0002\u0002\u0002\u0137\u0138\u0003\u0002\u0002\u0002\u0138\u0136\u0003",
  378. "\u0002\u0002\u0002\u0138\u0139\u0003\u0002\u0002\u0002\u0139\u0151\u0003",
  379. "\u0002\u0002\u0002\u013a\u013b\u00072\u0002\u0002\u013b\u013f\u0007",
  380. "z\u0002\u0002\u013c\u013d\u00072\u0002\u0002\u013d\u013f\u0007Z\u0002",
  381. "\u0002\u013e\u013a\u0003\u0002\u0002\u0002\u013e\u013c\u0003\u0002\u0002",
  382. "\u0002\u013f\u0141\u0003\u0002\u0002\u0002\u0140\u0142\u0005g4\u0002",
  383. "\u0141\u0140\u0003\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002",
  384. "\u0143\u0141\u0003\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002",
  385. "\u0144\u0151\u0003\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002",
  386. "\u0146\u014a\u0007d\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148",
  387. "\u014a\u0007D\u0002\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149",
  388. "\u0147\u0003\u0002\u0002\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b",
  389. "\u014d\t\b\u0002\u0002\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e",
  390. "\u0003\u0002\u0002\u0002\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f",
  391. "\u0003\u0002\u0002\u0002\u014f\u0151\u0003\u0002\u0002\u0002\u0150\u0136",
  392. "\u0003\u0002\u0002\u0002\u0150\u013e\u0003\u0002\u0002\u0002\u0150\u0149",
  393. "\u0003\u0002\u0002\u0002\u0151V\u0003\u0002\u0002\u0002\u0152\u0154",
  394. "\t\u0007\u0002\u0002\u0153\u0152\u0003\u0002\u0002\u0002\u0154\u0155",
  395. "\u0003\u0002\u0002\u0002\u0155\u0153\u0003\u0002\u0002\u0002\u0155\u0156",
  396. "\u0003\u0002\u0002\u0002\u0156\u0157\u0003\u0002\u0002\u0002\u0157\u0159",
  397. "\u00070\u0002\u0002\u0158\u015a\t\u0007\u0002\u0002\u0159\u0158\u0003",
  398. "\u0002\u0002\u0002\u015a\u015b\u0003\u0002\u0002\u0002\u015b\u0159\u0003",
  399. "\u0002\u0002\u0002\u015b\u015c\u0003\u0002\u0002\u0002\u015c\u016b\u0003",
  400. "\u0002\u0002\u0002\u015d\u015f\t\u0007\u0002\u0002\u015e\u015d\u0003",
  401. "\u0002\u0002\u0002\u015f\u0160\u0003\u0002\u0002\u0002\u0160\u015e\u0003",
  402. "\u0002\u0002\u0002\u0160\u0161\u0003\u0002\u0002\u0002\u0161\u0162\u0003",
  403. "\u0002\u0002\u0002\u0162\u0166\u00070\u0002\u0002\u0163\u0165\t\u0007",
  404. "\u0002\u0002\u0164\u0163\u0003\u0002\u0002\u0002\u0165\u0168\u0003\u0002",
  405. "\u0002\u0002\u0166\u0164\u0003\u0002\u0002\u0002\u0166\u0167\u0003\u0002",
  406. "\u0002\u0002\u0167\u0169\u0003\u0002\u0002\u0002\u0168\u0166\u0003\u0002",
  407. "\u0002\u0002\u0169\u016b\u0005Y-\u0002\u016a\u0153\u0003\u0002\u0002",
  408. "\u0002\u016a\u015e\u0003\u0002\u0002\u0002\u016bX\u0003\u0002\u0002",
  409. "\u0002\u016c\u016e\t\t\u0002\u0002\u016d\u016f\t\u0002\u0002\u0002\u016e",
  410. "\u016d\u0003\u0002\u0002\u0002\u016e\u016f\u0003\u0002\u0002\u0002\u016f",
  411. "\u0171\u0003\u0002\u0002\u0002\u0170\u0172\t\u0007\u0002\u0002\u0171",
  412. "\u0170\u0003\u0002\u0002\u0002\u0172\u0173\u0003\u0002\u0002\u0002\u0173",
  413. "\u0171\u0003\u0002\u0002\u0002\u0173\u0174\u0003\u0002\u0002\u0002\u0174",
  414. "Z\u0003\u0002\u0002\u0002\u0175\u0179\u0007$\u0002\u0002\u0176\u0178",
  415. "\u0005]/\u0002\u0177\u0176\u0003\u0002\u0002\u0002\u0178\u017b\u0003",
  416. "\u0002\u0002\u0002\u0179\u0177\u0003\u0002\u0002\u0002\u0179\u017a\u0003",
  417. "\u0002\u0002\u0002\u017a\u017c\u0003\u0002\u0002\u0002\u017b\u0179\u0003",
  418. "\u0002\u0002\u0002\u017c\u017d\u0007$\u0002\u0002\u017d\\\u0003\u0002",
  419. "\u0002\u0002\u017e\u0181\n\n\u0002\u0002\u017f\u0181\u0005k6\u0002\u0180",
  420. "\u017e\u0003\u0002\u0002\u0002\u0180\u017f\u0003\u0002\u0002\u0002\u0181",
  421. "^\u0003\u0002\u0002\u0002\u0182\u0185\u0007)\u0002\u0002\u0183\u0186",
  422. "\u0005k6\u0002\u0184\u0186\n\u000b\u0002\u0002\u0185\u0183\u0003\u0002",
  423. "\u0002\u0002\u0185\u0184\u0003\u0002\u0002\u0002\u0186\u0187\u0003\u0002",
  424. "\u0002\u0002\u0187\u0188\u0007)\u0002\u0002\u0188`\u0003\u0002\u0002",
  425. "\u0002\u0189\u018a\t\f\u0002\u0002\u018a\u018b\u0003\u0002\u0002\u0002",
  426. "\u018b\u018c\b1\u0002\u0002\u018cb\u0003\u0002\u0002\u0002\u018d\u018e",
  427. "\u0007=\u0002\u0002\u018ed\u0003\u0002\u0002\u0002\u018f\u0191\t\r\u0002",
  428. "\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002\u0002",
  429. "\u0002\u0192\u0190\u0003\u0002\u0002\u0002\u0192\u0193\u0003\u0002\u0002",
  430. "\u0002\u0193\u0196\u0003\u0002\u0002\u0002\u0194\u0196\u0005c2\u0002",
  431. "\u0195\u0190\u0003\u0002\u0002\u0002\u0195\u0194\u0003\u0002\u0002\u0002",
  432. "\u0196f\u0003\u0002\u0002\u0002\u0197\u0198\t\u000e\u0002\u0002\u0198",
  433. "h\u0003\u0002\u0002\u0002\u0199\u019a\t\u000f\u0002\u0002\u019aj\u0003",
  434. "\u0002\u0002\u0002\u019b\u019c\u0007^\u0002\u0002\u019c\u01a0\t\u0010",
  435. "\u0002\u0002\u019d\u01a0\u0005o8\u0002\u019e\u01a0\u0005m7\u0002\u019f",
  436. "\u019b\u0003\u0002\u0002\u0002\u019f\u019d\u0003\u0002\u0002\u0002\u019f",
  437. "\u019e\u0003\u0002\u0002\u0002\u01a0l\u0003\u0002\u0002\u0002\u01a1",
  438. "\u01a2\u0007^\u0002\u0002\u01a2\u01a3\t\u0011\u0002\u0002\u01a3\u01a4",
  439. "\u0005i5\u0002\u01a4\u01a5\u0005i5\u0002\u01a5\u01ad\u0003\u0002\u0002",
  440. "\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01a8\u0005i5\u0002\u01a8",
  441. "\u01a9\u0005i5\u0002\u01a9\u01ad\u0003\u0002\u0002\u0002\u01aa\u01ab",
  442. "\u0007^\u0002\u0002\u01ab\u01ad\u0005i5\u0002\u01ac\u01a1\u0003\u0002",
  443. "\u0002\u0002\u01ac\u01a6\u0003\u0002\u0002\u0002\u01ac\u01aa\u0003\u0002",
  444. "\u0002\u0002\u01adn\u0003\u0002\u0002\u0002\u01ae\u01af\u0007^\u0002",
  445. "\u0002\u01af\u01b0\u0007w\u0002\u0002\u01b0\u01b1\u0005g4\u0002\u01b1",
  446. "\u01b2\u0005g4\u0002\u01b2\u01b3\u0005g4\u0002\u01b3\u01b4\u0005g4\u0002",
  447. "\u01b4p\u0003\u0002\u0002\u0002\u01b5\u01b6\u00071\u0002\u0002\u01b6",
  448. "\u01b7\u00071\u0002\u0002\u01b7\u01bb\u0003\u0002\u0002\u0002\u01b8",
  449. "\u01ba\n\r\u0002\u0002\u01b9\u01b8\u0003\u0002\u0002\u0002\u01ba\u01bd",
  450. "\u0003\u0002\u0002\u0002\u01bb\u01b9\u0003\u0002\u0002\u0002\u01bb\u01bc",
  451. "\u0003\u0002\u0002\u0002\u01bc\u01bf\u0003\u0002\u0002\u0002\u01bd\u01bb",
  452. "\u0003\u0002\u0002\u0002\u01be\u01c0\u0007\u000f\u0002\u0002\u01bf\u01be",
  453. "\u0003\u0002\u0002\u0002\u01bf\u01c0\u0003\u0002\u0002\u0002\u01c0\u01c1",
  454. "\u0003\u0002\u0002\u0002\u01c1\u01ce\u0007\f\u0002\u0002\u01c2\u01c3",
  455. "\u00071\u0002\u0002\u01c3\u01c4\u0007,\u0002\u0002\u01c4\u01c8\u0003",
  456. "\u0002\u0002\u0002\u01c5\u01c7\u000b\u0002\u0002\u0002\u01c6\u01c5\u0003",
  457. "\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c9\u0003",
  458. "\u0002\u0002\u0002\u01c8\u01c6\u0003\u0002\u0002\u0002\u01c9\u01cb\u0003",
  459. "\u0002\u0002\u0002\u01ca\u01c8\u0003\u0002\u0002\u0002\u01cb\u01cc\u0007",
  460. ",\u0002\u0002\u01cc\u01ce\u00071\u0002\u0002\u01cd\u01b5\u0003\u0002",
  461. "\u0002\u0002\u01cd\u01c2\u0003\u0002\u0002\u0002\u01ce\u01cf\u0003\u0002",
  462. "\u0002\u0002\u01cf\u01d0\b9\u0003\u0002\u01d0r\u0003\u0002\u0002\u0002",
  463. "\u001d\u0002\u0124\u012e\u0138\u013e\u0143\u0149\u014e\u0150\u0155\u015b",
  464. "\u0160\u0166\u016a\u016e\u0173\u0179\u0180\u0185\u0192\u0195\u019f\u01ac",
  465. "\u01bb\u01bf\u01c8\u01cd\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  466. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  467. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  468. function ivprog(input) {
  469. antlr4.Lexer.call(this, input);
  470. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  471. return this;
  472. }
  473. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  474. ivprog.prototype.constructor = ivprog;
  475. ivprog.EOF = antlr4.Token.EOF;
  476. ivprog.RK_PROGRAM = 1;
  477. ivprog.RK_REAL = 2;
  478. ivprog.RK_VOID = 3;
  479. ivprog.RK_BOOLEAN = 4;
  480. ivprog.RK_STRING = 5;
  481. ivprog.RK_INTEGER = 6;
  482. ivprog.RK_CHARACTER = 7;
  483. ivprog.RK_SWITCH = 8;
  484. ivprog.RK_CASE = 9;
  485. ivprog.RK_DEFAULT = 10;
  486. ivprog.RK_CONST = 11;
  487. ivprog.RK_FUNCTION = 12;
  488. ivprog.RK_RETURN = 13;
  489. ivprog.RK_FOR = 14;
  490. ivprog.RK_BREAK = 15;
  491. ivprog.RK_DO = 16;
  492. ivprog.RK_WHILE = 17;
  493. ivprog.RK_IF = 18;
  494. ivprog.RK_ELSE = 19;
  495. ivprog.RK_FALSE = 20;
  496. ivprog.RK_TRUE = 21;
  497. ivprog.OPEN_PARENTHESIS = 22;
  498. ivprog.CLOSE_PARENTHESIS = 23;
  499. ivprog.OPEN_BRACE = 24;
  500. ivprog.CLOSE_BRACE = 25;
  501. ivprog.OPEN_CURLY = 26;
  502. ivprog.CLOSE_CURLY = 27;
  503. ivprog.COMMA = 28;
  504. ivprog.EQUAL = 29;
  505. ivprog.SUM_OP = 30;
  506. ivprog.MULTI_OP = 31;
  507. ivprog.AND_OPERATOR = 32;
  508. ivprog.OR_OPERATOR = 33;
  509. ivprog.RELATIONAL_OPERATOR = 34;
  510. ivprog.COLON = 35;
  511. ivprog.NOT_OPERATOR = 36;
  512. ivprog.ID = 37;
  513. ivprog.LIB_ID = 38;
  514. ivprog.INTEGER = 39;
  515. ivprog.REAL = 40;
  516. ivprog.STRING = 41;
  517. ivprog.CHARACTER = 42;
  518. ivprog.WHITESPACE = 43;
  519. ivprog.EOS = 44;
  520. ivprog.COMMENTS = 45;
  521. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  522. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  523. ivprog.prototype.literalNames = [ null, "'program'", "'real'", "'void'",
  524. "'boolean'", "'string'", "'integer'",
  525. "'character'", "'switch'", "'case'", "'otherwise'",
  526. "'const'", "'function'", "'return'", "'for'",
  527. "'break'", "'do'", "'while'", "'if'",
  528. "'else'", "'false'", "'true'", "'('",
  529. "')'", "'['", "']'", "'{'", "'}'", "','",
  530. "'='", null, null, null, null, null, "':'" ];
  531. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  532. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  533. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  534. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  535. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  536. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  537. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  538. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  539. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  540. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  541. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  542. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  543. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  544. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  545. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  546. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  547. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  548. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  549. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  550. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  551. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  552. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  553. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  554. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  555. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  556. "STRING", "STRING_CHARACTER", "CHARACTER",
  557. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  558. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  559. "COMMENTS" ];
  560. ivprog.prototype.grammarFileName = "ivprog.g4";
  561. exports.ivprog = ivprog;
  562. /***/ }),
  563. /* 1 */
  564. /***/ (function(module, exports, __webpack_require__) {
  565. module.exports = {
  566. ivprog: __webpack_require__(0).ivprog
  567. };
  568. /***/ }),
  569. /* 2 */
  570. /***/ (function(module, exports) {
  571. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  572. /***/ })
  573. /******/ ]);
  574. /***/ }),
  575. /***/ "./grammar/en/langFunctions.js":
  576. /*!*************************************!*\
  577. !*** ./grammar/en/langFunctions.js ***!
  578. \*************************************/
  579. /*! no static exports found */
  580. /***/ (function(module, exports, __webpack_require__) {
  581. "use strict";
  582. Object.defineProperty(exports, "__esModule", {
  583. value: true
  584. });
  585. /* This is a dictionary of the language defined functions
  586. **/
  587. exports.default = {
  588. main_function: "start",
  589. $read: "read",
  590. $write: "write",
  591. $numElements: "numero_elementos",
  592. $matrixLines: "matriz_linhas",
  593. $matrixColumns: "matriz_colunas",
  594. $substring: "subcadeia",
  595. $length: "comprimento",
  596. $uppercase: "caixa_alta",
  597. $lowercase: "caixa_baixa",
  598. $charAt: "char_at",
  599. $isReal: "e_real",
  600. $isInt: "e_inteiro",
  601. $isBool: "e_logico",
  602. $castReal: "como_real",
  603. $castInt: "como_inteiro",
  604. $castBool: "como_logico",
  605. $castString: "como_cadeia",
  606. $sin: "sen",
  607. $cos: "cos",
  608. $tan: "tan",
  609. $sqrt: "raiz_quadrada",
  610. $pow: "pot",
  611. $log: "log",
  612. $abs: "modulo",
  613. $negate: "trocar_sinal",
  614. $invert: "inverter_valor",
  615. $max: "maximo",
  616. $min: "minimo"
  617. };
  618. /***/ }),
  619. /***/ "./grammar/en/langLibs.js":
  620. /*!********************************!*\
  621. !*** ./grammar/en/langLibs.js ***!
  622. \********************************/
  623. /*! no static exports found */
  624. /***/ (function(module, exports, __webpack_require__) {
  625. "use strict";
  626. Object.defineProperty(exports, "__esModule", {
  627. value: true
  628. });
  629. /**
  630. * This is the dictionary of the language defined libraries
  631. */
  632. exports.default = {
  633. $mathLib: "Matematica",
  634. $ioLib: "ES",
  635. $strLib: "Texto",
  636. $arrayLib: "Arranjo",
  637. $langLib: "IV"
  638. };
  639. /***/ }),
  640. /***/ "./grammar/es/ivprog.g4":
  641. /*!******************************!*\
  642. !*** ./grammar/es/ivprog.g4 ***!
  643. \******************************/
  644. /*! no static exports found */
  645. /***/ (function(module, exports, __webpack_require__) {
  646. module.exports =
  647. /******/ (function(modules) { // webpackBootstrap
  648. /******/ // The module cache
  649. /******/ var installedModules = {};
  650. /******/
  651. /******/ // The require function
  652. /******/ function __webpack_require__(moduleId) {
  653. /******/
  654. /******/ // Check if module is in cache
  655. /******/ if(installedModules[moduleId]) {
  656. /******/ return installedModules[moduleId].exports;
  657. /******/ }
  658. /******/ // Create a new module (and put it into the cache)
  659. /******/ var module = installedModules[moduleId] = {
  660. /******/ i: moduleId,
  661. /******/ l: false,
  662. /******/ exports: {}
  663. /******/ };
  664. /******/
  665. /******/ // Execute the module function
  666. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  667. /******/
  668. /******/ // Flag the module as loaded
  669. /******/ module.l = true;
  670. /******/
  671. /******/ // Return the exports of the module
  672. /******/ return module.exports;
  673. /******/ }
  674. /******/
  675. /******/
  676. /******/ // expose the modules object (__webpack_modules__)
  677. /******/ __webpack_require__.m = modules;
  678. /******/
  679. /******/ // expose the module cache
  680. /******/ __webpack_require__.c = installedModules;
  681. /******/
  682. /******/ // identity function for calling harmony imports with the correct context
  683. /******/ __webpack_require__.i = function(value) { return value; };
  684. /******/
  685. /******/ // define getter function for harmony exports
  686. /******/ __webpack_require__.d = function(exports, name, getter) {
  687. /******/ if(!__webpack_require__.o(exports, name)) {
  688. /******/ Object.defineProperty(exports, name, {
  689. /******/ configurable: false,
  690. /******/ enumerable: true,
  691. /******/ get: getter
  692. /******/ });
  693. /******/ }
  694. /******/ };
  695. /******/
  696. /******/ // getDefaultExport function for compatibility with non-harmony modules
  697. /******/ __webpack_require__.n = function(module) {
  698. /******/ var getter = module && module.__esModule ?
  699. /******/ function getDefault() { return module['default']; } :
  700. /******/ function getModuleExports() { return module; };
  701. /******/ __webpack_require__.d(getter, 'a', getter);
  702. /******/ return getter;
  703. /******/ };
  704. /******/
  705. /******/ // Object.prototype.hasOwnProperty.call
  706. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  707. /******/
  708. /******/ // __webpack_public_path__
  709. /******/ __webpack_require__.p = "";
  710. /******/
  711. /******/ // Load entry module and return exports
  712. /******/ return __webpack_require__(__webpack_require__.s = 1);
  713. /******/ })
  714. /************************************************************************/
  715. /******/ ([
  716. /* 0 */
  717. /***/ (function(module, exports, __webpack_require__) {
  718. // Generated from /tmp/tmp-20960KdmtVbsL5rbX/ivprog.g4 by ANTLR 4.7
  719. // jshint ignore: start
  720. var antlr4 = __webpack_require__(2);
  721. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  722. "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  723. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  724. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  725. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  726. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  727. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  728. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  729. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  730. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  731. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  732. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  733. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  734. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  735. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003",
  736. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003",
  737. "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003",
  738. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003",
  739. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
  740. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  741. "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  742. "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  743. "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b",
  744. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b",
  745. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f",
  746. "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  747. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  748. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  749. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  750. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  751. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  752. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  753. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  754. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  755. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  756. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  757. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  758. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  759. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  760. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  761. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  762. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003",
  763. "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003",
  764. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003",
  765. "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e",
  766. "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158",
  767. "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e",
  768. ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,",
  769. "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173",
  770. "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-",
  771. "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e",
  772. ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003",
  773. "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  774. "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1",
  775. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab",
  776. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  777. "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  778. "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b",
  779. "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2",
  780. "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003",
  781. "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  782. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  783. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  784. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  785. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  786. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  787. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  788. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  789. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  790. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  791. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003",
  792. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  793. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  794. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  795. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  796. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  797. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  798. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  799. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  800. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  801. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  802. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  803. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  804. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  805. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  806. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  807. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  808. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  809. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  810. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  811. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  812. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  813. "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081",
  814. "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e",
  815. "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d",
  816. "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af",
  817. "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be",
  818. "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb",
  819. "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8",
  820. "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003",
  821. "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002",
  822. "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002",
  823. "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002",
  824. "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110",
  825. "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003",
  826. "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002",
  827. "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002",
  828. "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002",
  829. "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f",
  830. "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003",
  831. "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002",
  832. "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002",
  833. "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002",
  834. "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194",
  835. "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003",
  836. "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002",
  837. "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002",
  838. "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002",
  839. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  840. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  841. "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t",
  842. "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080",
  843. "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082",
  844. "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007",
  845. "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002",
  846. "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002",
  847. "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a",
  848. "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d",
  849. "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007",
  850. "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002",
  851. "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002",
  852. "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095",
  853. "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098",
  854. "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007",
  855. "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002",
  856. "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002",
  857. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  858. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  859. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  860. "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003",
  861. "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007",
  862. "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002",
  863. "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002",
  864. "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002",
  865. "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1",
  866. "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014",
  867. "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6",
  868. "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007",
  869. "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002",
  870. "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002",
  871. "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002",
  872. "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0",
  873. "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3",
  874. "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5",
  875. "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007",
  876. "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002",
  877. "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  878. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  879. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf",
  880. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2",
  881. "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4",
  882. "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007",
  883. "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002",
  884. "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002",
  885. "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002",
  886. "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de",
  887. "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1",
  888. "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007",
  889. "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002",
  890. "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002",
  891. "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9",
  892. "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec",
  893. "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002",
  894. "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002",
  895. "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002",
  896. "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4",
  897. "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7",
  898. "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007",
  899. "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002",
  900. "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002",
  901. "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff",
  902. "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102",
  903. "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007",
  904. "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002",
  905. "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002",
  906. "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a",
  907. "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d",
  908. "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007",
  909. "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002",
  910. "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002",
  911. "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115",
  912. ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003",
  913. "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003",
  914. "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002",
  915. "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002",
  916. "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002",
  917. "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122",
  918. "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125",
  919. "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007",
  920. "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002",
  921. "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002",
  922. "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d",
  923. "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126",
  924. "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a",
  925. "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d",
  926. "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132",
  927. "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005",
  928. "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002",
  929. "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002",
  930. "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002",
  931. "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002",
  932. "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002",
  933. "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003",
  934. "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003",
  935. "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003",
  936. "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003",
  937. "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007",
  938. "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002",
  939. "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002",
  940. "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002",
  941. "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002",
  942. "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002",
  943. "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002",
  944. "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153",
  945. "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154",
  946. "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156",
  947. "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159",
  948. "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a",
  949. "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141",
  950. "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154",
  951. "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f",
  952. "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160",
  953. "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161",
  954. "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164",
  955. "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003",
  956. "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003",
  957. "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003",
  958. "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003",
  959. "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003",
  960. "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003",
  961. "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007",
  962. "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002",
  963. "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002",
  964. "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002",
  965. "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002",
  966. "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002",
  967. "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179",
  968. "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a",
  969. "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c",
  970. "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e",
  971. "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f",
  972. "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183",
  973. "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003",
  974. "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003",
  975. "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003",
  976. "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002",
  977. "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b",
  978. "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c",
  979. "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191",
  980. "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002",
  981. "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002",
  982. "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002",
  983. "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002",
  984. "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199",
  985. "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002",
  986. "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002",
  987. "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002",
  988. "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002",
  989. "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002",
  990. "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3",
  991. "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003",
  992. "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010",
  993. "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa",
  994. "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa",
  995. "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac",
  996. "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af",
  997. "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002",
  998. "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3",
  999. "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6",
  1000. "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002",
  1001. "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002",
  1002. "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002",
  1003. "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc",
  1004. "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002",
  1005. "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1",
  1006. "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3",
  1007. "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8",
  1008. "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7",
  1009. "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6",
  1010. "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9",
  1011. "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc",
  1012. "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce",
  1013. "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003",
  1014. "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003",
  1015. "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003",
  1016. "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003",
  1017. "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007",
  1018. ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002",
  1019. "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002",
  1020. "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002",
  1021. "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166",
  1022. "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7",
  1023. "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1024. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1025. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1026. function ivprog(input) {
  1027. antlr4.Lexer.call(this, input);
  1028. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1029. return this;
  1030. }
  1031. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1032. ivprog.prototype.constructor = ivprog;
  1033. ivprog.EOF = antlr4.Token.EOF;
  1034. ivprog.RK_PROGRAM = 1;
  1035. ivprog.RK_REAL = 2;
  1036. ivprog.RK_VOID = 3;
  1037. ivprog.RK_BOOLEAN = 4;
  1038. ivprog.RK_STRING = 5;
  1039. ivprog.RK_INTEGER = 6;
  1040. ivprog.RK_CHARACTER = 7;
  1041. ivprog.RK_SWITCH = 8;
  1042. ivprog.RK_CASE = 9;
  1043. ivprog.RK_DEFAULT = 10;
  1044. ivprog.RK_CONST = 11;
  1045. ivprog.RK_FUNCTION = 12;
  1046. ivprog.RK_RETURN = 13;
  1047. ivprog.RK_FOR = 14;
  1048. ivprog.RK_BREAK = 15;
  1049. ivprog.RK_DO = 16;
  1050. ivprog.RK_WHILE = 17;
  1051. ivprog.RK_IF = 18;
  1052. ivprog.RK_ELSE = 19;
  1053. ivprog.RK_FALSE = 20;
  1054. ivprog.RK_TRUE = 21;
  1055. ivprog.OPEN_PARENTHESIS = 22;
  1056. ivprog.CLOSE_PARENTHESIS = 23;
  1057. ivprog.OPEN_BRACE = 24;
  1058. ivprog.CLOSE_BRACE = 25;
  1059. ivprog.OPEN_CURLY = 26;
  1060. ivprog.CLOSE_CURLY = 27;
  1061. ivprog.COMMA = 28;
  1062. ivprog.EQUAL = 29;
  1063. ivprog.SUM_OP = 30;
  1064. ivprog.MULTI_OP = 31;
  1065. ivprog.AND_OPERATOR = 32;
  1066. ivprog.OR_OPERATOR = 33;
  1067. ivprog.RELATIONAL_OPERATOR = 34;
  1068. ivprog.COLON = 35;
  1069. ivprog.NOT_OPERATOR = 36;
  1070. ivprog.ID = 37;
  1071. ivprog.LIB_ID = 38;
  1072. ivprog.INTEGER = 39;
  1073. ivprog.REAL = 40;
  1074. ivprog.STRING = 41;
  1075. ivprog.CHARACTER = 42;
  1076. ivprog.WHITESPACE = 43;
  1077. ivprog.EOS = 44;
  1078. ivprog.COMMENTS = 45;
  1079. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1080. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1081. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1082. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1083. "'escolha'", "'caso'", "'contrario'",
  1084. "'const'", "'funcao'", "'retorne'", "'para'",
  1085. "'pare'", "'faca'", "'enquanto'", "'se'",
  1086. "'senao'", "'falso'", "'verdadeiro'",
  1087. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1088. "','", "'='", null, null, null, null,
  1089. null, "':'" ];
  1090. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1091. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1092. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1093. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1094. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1095. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1096. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1097. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1098. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1099. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1100. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1101. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  1102. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  1103. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1104. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1105. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1106. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1107. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1108. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1109. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1110. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1111. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1112. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1113. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1114. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  1115. "STRING", "STRING_CHARACTER", "CHARACTER",
  1116. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  1117. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  1118. "COMMENTS" ];
  1119. ivprog.prototype.grammarFileName = "ivprog.g4";
  1120. exports.ivprog = ivprog;
  1121. /***/ }),
  1122. /* 1 */
  1123. /***/ (function(module, exports, __webpack_require__) {
  1124. module.exports = {
  1125. ivprog: __webpack_require__(0).ivprog
  1126. };
  1127. /***/ }),
  1128. /* 2 */
  1129. /***/ (function(module, exports) {
  1130. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1131. /***/ })
  1132. /******/ ]);
  1133. /***/ }),
  1134. /***/ "./grammar/es/langFunctions.js":
  1135. /*!*************************************!*\
  1136. !*** ./grammar/es/langFunctions.js ***!
  1137. \*************************************/
  1138. /*! no static exports found */
  1139. /***/ (function(module, exports, __webpack_require__) {
  1140. "use strict";
  1141. Object.defineProperty(exports, "__esModule", {
  1142. value: true
  1143. });
  1144. /* This is a dictionary of the language defined functions
  1145. **/
  1146. exports.default = {
  1147. main_function: "inicio",
  1148. $read: "leia",
  1149. $write: "escreva",
  1150. $numElements: "numero_elementos",
  1151. $matrixLines: "matriz_linhas",
  1152. $matrixColumns: "matriz_colunas",
  1153. $substring: "subcadeia",
  1154. $length: "comprimento",
  1155. $uppercase: "caixa_alta",
  1156. $lowercase: "caixa_baixa",
  1157. $charAt: "char_at",
  1158. $isReal: "e_real",
  1159. $isInt: "e_inteiro",
  1160. $isBool: "e_logico",
  1161. $castReal: "como_real",
  1162. $castInt: "como_inteiro",
  1163. $castBool: "como_logico",
  1164. $castString: "como_cadeia",
  1165. $sin: "sen",
  1166. $cos: "cos",
  1167. $tan: "tan",
  1168. $sqrt: "raiz_quadrada",
  1169. $pow: "pot",
  1170. $log: "log",
  1171. $abs: "modulo",
  1172. $negate: "trocar_sinal",
  1173. $invert: "inverter_valor",
  1174. $max: "maximo",
  1175. $min: "minimo"
  1176. };
  1177. /***/ }),
  1178. /***/ "./grammar/es/langLibs.js":
  1179. /*!********************************!*\
  1180. !*** ./grammar/es/langLibs.js ***!
  1181. \********************************/
  1182. /*! no static exports found */
  1183. /***/ (function(module, exports, __webpack_require__) {
  1184. "use strict";
  1185. Object.defineProperty(exports, "__esModule", {
  1186. value: true
  1187. });
  1188. /**
  1189. * This is the dictionary of the language defined libraries
  1190. */
  1191. exports.default = {
  1192. $mathLib: "Matematica",
  1193. $ioLib: "ES",
  1194. $strLib: "Texto",
  1195. $arrayLib: "Arranjo",
  1196. $langLib: "IV"
  1197. };
  1198. /***/ }),
  1199. /***/ "./grammar/index.js":
  1200. /*!**************************!*\
  1201. !*** ./grammar/index.js ***!
  1202. \**************************/
  1203. /*! no static exports found */
  1204. /***/ (function(module, exports, __webpack_require__) {
  1205. "use strict";
  1206. var _ivprog = __webpack_require__(/*! ./pt/ivprog.g4 */ "./grammar/pt/ivprog.g4");
  1207. var PT = _interopRequireWildcard(_ivprog);
  1208. var _langFunctions = __webpack_require__(/*! ./pt/langFunctions */ "./grammar/pt/langFunctions.js");
  1209. var _langFunctions2 = _interopRequireDefault(_langFunctions);
  1210. var _langLibs = __webpack_require__(/*! ./pt/langLibs */ "./grammar/pt/langLibs.js");
  1211. var _langLibs2 = _interopRequireDefault(_langLibs);
  1212. var _ivprog2 = __webpack_require__(/*! ./en/ivprog.g4 */ "./grammar/en/ivprog.g4");
  1213. var EN = _interopRequireWildcard(_ivprog2);
  1214. var _langFunctions3 = __webpack_require__(/*! ./en/langFunctions */ "./grammar/en/langFunctions.js");
  1215. var _langFunctions4 = _interopRequireDefault(_langFunctions3);
  1216. var _langLibs3 = __webpack_require__(/*! ./en/langLibs */ "./grammar/en/langLibs.js");
  1217. var _langLibs4 = _interopRequireDefault(_langLibs3);
  1218. var _ivprog3 = __webpack_require__(/*! ./es/ivprog.g4 */ "./grammar/es/ivprog.g4");
  1219. var ES = _interopRequireWildcard(_ivprog3);
  1220. var _langFunctions5 = __webpack_require__(/*! ./es/langFunctions */ "./grammar/es/langFunctions.js");
  1221. var _langFunctions6 = _interopRequireDefault(_langFunctions5);
  1222. var _langLibs5 = __webpack_require__(/*! ./es/langLibs */ "./grammar/es/langLibs.js");
  1223. var _langLibs6 = _interopRequireDefault(_langLibs5);
  1224. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1225. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  1226. exports.pt = { lexer: PT.ivprog, langFuncs: _langFunctions2.default, langLibs: _langLibs2.default };
  1227. exports.en = { lexer: EN.ivprog, langFuncs: _langFunctions4.default, langLibs: _langLibs4.default };
  1228. exports.es = { lexer: ES.ivprog, langFuncs: _langFunctions6.default, langLibs: _langLibs6.default };
  1229. /***/ }),
  1230. /***/ "./grammar/pt/ivprog.g4":
  1231. /*!******************************!*\
  1232. !*** ./grammar/pt/ivprog.g4 ***!
  1233. \******************************/
  1234. /*! no static exports found */
  1235. /***/ (function(module, exports, __webpack_require__) {
  1236. module.exports =
  1237. /******/ (function(modules) { // webpackBootstrap
  1238. /******/ // The module cache
  1239. /******/ var installedModules = {};
  1240. /******/
  1241. /******/ // The require function
  1242. /******/ function __webpack_require__(moduleId) {
  1243. /******/
  1244. /******/ // Check if module is in cache
  1245. /******/ if(installedModules[moduleId]) {
  1246. /******/ return installedModules[moduleId].exports;
  1247. /******/ }
  1248. /******/ // Create a new module (and put it into the cache)
  1249. /******/ var module = installedModules[moduleId] = {
  1250. /******/ i: moduleId,
  1251. /******/ l: false,
  1252. /******/ exports: {}
  1253. /******/ };
  1254. /******/
  1255. /******/ // Execute the module function
  1256. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  1257. /******/
  1258. /******/ // Flag the module as loaded
  1259. /******/ module.l = true;
  1260. /******/
  1261. /******/ // Return the exports of the module
  1262. /******/ return module.exports;
  1263. /******/ }
  1264. /******/
  1265. /******/
  1266. /******/ // expose the modules object (__webpack_modules__)
  1267. /******/ __webpack_require__.m = modules;
  1268. /******/
  1269. /******/ // expose the module cache
  1270. /******/ __webpack_require__.c = installedModules;
  1271. /******/
  1272. /******/ // identity function for calling harmony imports with the correct context
  1273. /******/ __webpack_require__.i = function(value) { return value; };
  1274. /******/
  1275. /******/ // define getter function for harmony exports
  1276. /******/ __webpack_require__.d = function(exports, name, getter) {
  1277. /******/ if(!__webpack_require__.o(exports, name)) {
  1278. /******/ Object.defineProperty(exports, name, {
  1279. /******/ configurable: false,
  1280. /******/ enumerable: true,
  1281. /******/ get: getter
  1282. /******/ });
  1283. /******/ }
  1284. /******/ };
  1285. /******/
  1286. /******/ // getDefaultExport function for compatibility with non-harmony modules
  1287. /******/ __webpack_require__.n = function(module) {
  1288. /******/ var getter = module && module.__esModule ?
  1289. /******/ function getDefault() { return module['default']; } :
  1290. /******/ function getModuleExports() { return module; };
  1291. /******/ __webpack_require__.d(getter, 'a', getter);
  1292. /******/ return getter;
  1293. /******/ };
  1294. /******/
  1295. /******/ // Object.prototype.hasOwnProperty.call
  1296. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  1297. /******/
  1298. /******/ // __webpack_public_path__
  1299. /******/ __webpack_require__.p = "";
  1300. /******/
  1301. /******/ // Load entry module and return exports
  1302. /******/ return __webpack_require__(__webpack_require__.s = 1);
  1303. /******/ })
  1304. /************************************************************************/
  1305. /******/ ([
  1306. /* 0 */
  1307. /***/ (function(module, exports, __webpack_require__) {
  1308. // Generated from /tmp/tmp-20960Z6cKJnRTJX3z/ivprog.g4 by ANTLR 4.7
  1309. // jshint ignore: start
  1310. var antlr4 = __webpack_require__(2);
  1311. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  1312. "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  1313. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  1314. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  1315. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  1316. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  1317. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  1318. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  1319. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  1320. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  1321. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  1322. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  1323. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  1324. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  1325. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003",
  1326. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003",
  1327. "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003",
  1328. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003",
  1329. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
  1330. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  1331. "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  1332. "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  1333. "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b",
  1334. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b",
  1335. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f",
  1336. "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  1337. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  1338. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  1339. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  1340. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  1341. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  1342. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  1343. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  1344. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  1345. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  1346. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  1347. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  1348. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  1349. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  1350. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  1351. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  1352. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003",
  1353. "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003",
  1354. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003",
  1355. "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e",
  1356. "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158",
  1357. "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e",
  1358. ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,",
  1359. "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173",
  1360. "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-",
  1361. "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e",
  1362. ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003",
  1363. "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  1364. "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1",
  1365. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab",
  1366. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  1367. "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  1368. "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b",
  1369. "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2",
  1370. "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003",
  1371. "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  1372. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  1373. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  1374. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  1375. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  1376. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  1377. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  1378. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  1379. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  1380. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  1381. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003",
  1382. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  1383. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  1384. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  1385. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  1386. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  1387. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  1388. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  1389. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  1390. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  1391. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  1392. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  1393. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  1394. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  1395. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  1396. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  1397. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  1398. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  1399. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  1400. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  1401. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  1402. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  1403. "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081",
  1404. "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e",
  1405. "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d",
  1406. "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af",
  1407. "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be",
  1408. "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb",
  1409. "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8",
  1410. "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003",
  1411. "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002",
  1412. "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002",
  1413. "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002",
  1414. "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110",
  1415. "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003",
  1416. "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002",
  1417. "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002",
  1418. "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002",
  1419. "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f",
  1420. "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003",
  1421. "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002",
  1422. "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002",
  1423. "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002",
  1424. "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194",
  1425. "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003",
  1426. "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002",
  1427. "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002",
  1428. "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002",
  1429. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  1430. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  1431. "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t",
  1432. "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080",
  1433. "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082",
  1434. "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007",
  1435. "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002",
  1436. "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002",
  1437. "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a",
  1438. "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d",
  1439. "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007",
  1440. "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002",
  1441. "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002",
  1442. "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095",
  1443. "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098",
  1444. "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007",
  1445. "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002",
  1446. "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002",
  1447. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  1448. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  1449. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  1450. "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003",
  1451. "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007",
  1452. "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002",
  1453. "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002",
  1454. "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002",
  1455. "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1",
  1456. "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014",
  1457. "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6",
  1458. "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007",
  1459. "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002",
  1460. "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002",
  1461. "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002",
  1462. "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0",
  1463. "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3",
  1464. "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5",
  1465. "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007",
  1466. "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002",
  1467. "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  1468. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  1469. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf",
  1470. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2",
  1471. "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4",
  1472. "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007",
  1473. "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002",
  1474. "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002",
  1475. "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002",
  1476. "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de",
  1477. "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1",
  1478. "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007",
  1479. "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002",
  1480. "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002",
  1481. "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9",
  1482. "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec",
  1483. "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002",
  1484. "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002",
  1485. "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002",
  1486. "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4",
  1487. "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7",
  1488. "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007",
  1489. "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002",
  1490. "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002",
  1491. "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff",
  1492. "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102",
  1493. "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007",
  1494. "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002",
  1495. "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002",
  1496. "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a",
  1497. "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d",
  1498. "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007",
  1499. "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002",
  1500. "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002",
  1501. "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115",
  1502. ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003",
  1503. "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003",
  1504. "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002",
  1505. "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002",
  1506. "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002",
  1507. "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122",
  1508. "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125",
  1509. "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007",
  1510. "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002",
  1511. "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002",
  1512. "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d",
  1513. "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126",
  1514. "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a",
  1515. "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d",
  1516. "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132",
  1517. "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005",
  1518. "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002",
  1519. "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002",
  1520. "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002",
  1521. "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002",
  1522. "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002",
  1523. "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003",
  1524. "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003",
  1525. "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003",
  1526. "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003",
  1527. "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007",
  1528. "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002",
  1529. "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002",
  1530. "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002",
  1531. "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002",
  1532. "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002",
  1533. "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002",
  1534. "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153",
  1535. "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154",
  1536. "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156",
  1537. "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159",
  1538. "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a",
  1539. "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141",
  1540. "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154",
  1541. "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f",
  1542. "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160",
  1543. "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161",
  1544. "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164",
  1545. "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003",
  1546. "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003",
  1547. "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003",
  1548. "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003",
  1549. "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003",
  1550. "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003",
  1551. "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007",
  1552. "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002",
  1553. "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002",
  1554. "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002",
  1555. "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002",
  1556. "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002",
  1557. "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179",
  1558. "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a",
  1559. "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c",
  1560. "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e",
  1561. "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f",
  1562. "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183",
  1563. "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003",
  1564. "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003",
  1565. "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003",
  1566. "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002",
  1567. "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b",
  1568. "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c",
  1569. "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191",
  1570. "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002",
  1571. "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002",
  1572. "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002",
  1573. "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002",
  1574. "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199",
  1575. "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002",
  1576. "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002",
  1577. "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002",
  1578. "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002",
  1579. "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002",
  1580. "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3",
  1581. "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003",
  1582. "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010",
  1583. "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa",
  1584. "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa",
  1585. "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac",
  1586. "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af",
  1587. "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002",
  1588. "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3",
  1589. "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6",
  1590. "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002",
  1591. "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002",
  1592. "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002",
  1593. "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc",
  1594. "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002",
  1595. "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1",
  1596. "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3",
  1597. "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8",
  1598. "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7",
  1599. "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6",
  1600. "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9",
  1601. "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc",
  1602. "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce",
  1603. "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003",
  1604. "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003",
  1605. "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003",
  1606. "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003",
  1607. "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007",
  1608. ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002",
  1609. "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002",
  1610. "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002",
  1611. "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166",
  1612. "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7",
  1613. "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1614. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1615. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1616. function ivprog(input) {
  1617. antlr4.Lexer.call(this, input);
  1618. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1619. return this;
  1620. }
  1621. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1622. ivprog.prototype.constructor = ivprog;
  1623. ivprog.EOF = antlr4.Token.EOF;
  1624. ivprog.RK_PROGRAM = 1;
  1625. ivprog.RK_REAL = 2;
  1626. ivprog.RK_VOID = 3;
  1627. ivprog.RK_BOOLEAN = 4;
  1628. ivprog.RK_STRING = 5;
  1629. ivprog.RK_INTEGER = 6;
  1630. ivprog.RK_CHARACTER = 7;
  1631. ivprog.RK_SWITCH = 8;
  1632. ivprog.RK_CASE = 9;
  1633. ivprog.RK_DEFAULT = 10;
  1634. ivprog.RK_CONST = 11;
  1635. ivprog.RK_FUNCTION = 12;
  1636. ivprog.RK_RETURN = 13;
  1637. ivprog.RK_FOR = 14;
  1638. ivprog.RK_BREAK = 15;
  1639. ivprog.RK_DO = 16;
  1640. ivprog.RK_WHILE = 17;
  1641. ivprog.RK_IF = 18;
  1642. ivprog.RK_ELSE = 19;
  1643. ivprog.RK_FALSE = 20;
  1644. ivprog.RK_TRUE = 21;
  1645. ivprog.OPEN_PARENTHESIS = 22;
  1646. ivprog.CLOSE_PARENTHESIS = 23;
  1647. ivprog.OPEN_BRACE = 24;
  1648. ivprog.CLOSE_BRACE = 25;
  1649. ivprog.OPEN_CURLY = 26;
  1650. ivprog.CLOSE_CURLY = 27;
  1651. ivprog.COMMA = 28;
  1652. ivprog.EQUAL = 29;
  1653. ivprog.SUM_OP = 30;
  1654. ivprog.MULTI_OP = 31;
  1655. ivprog.AND_OPERATOR = 32;
  1656. ivprog.OR_OPERATOR = 33;
  1657. ivprog.RELATIONAL_OPERATOR = 34;
  1658. ivprog.COLON = 35;
  1659. ivprog.NOT_OPERATOR = 36;
  1660. ivprog.ID = 37;
  1661. ivprog.LIB_ID = 38;
  1662. ivprog.INTEGER = 39;
  1663. ivprog.REAL = 40;
  1664. ivprog.STRING = 41;
  1665. ivprog.CHARACTER = 42;
  1666. ivprog.WHITESPACE = 43;
  1667. ivprog.EOS = 44;
  1668. ivprog.COMMENTS = 45;
  1669. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1670. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1671. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1672. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1673. "'escolha'", "'caso'", "'contrario'",
  1674. "'const'", "'funcao'", "'retorne'", "'para'",
  1675. "'pare'", "'faca'", "'enquanto'", "'se'",
  1676. "'senao'", "'falso'", "'verdadeiro'",
  1677. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1678. "','", "'='", null, null, null, null,
  1679. null, "':'" ];
  1680. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1681. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1682. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1683. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1684. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1685. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1686. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1687. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1688. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1689. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1690. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1691. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  1692. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  1693. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1694. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1695. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1696. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1697. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1698. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1699. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1700. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1701. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1702. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1703. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1704. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  1705. "STRING", "STRING_CHARACTER", "CHARACTER",
  1706. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  1707. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  1708. "COMMENTS" ];
  1709. ivprog.prototype.grammarFileName = "ivprog.g4";
  1710. exports.ivprog = ivprog;
  1711. /***/ }),
  1712. /* 1 */
  1713. /***/ (function(module, exports, __webpack_require__) {
  1714. module.exports = {
  1715. ivprog: __webpack_require__(0).ivprog
  1716. };
  1717. /***/ }),
  1718. /* 2 */
  1719. /***/ (function(module, exports) {
  1720. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1721. /***/ })
  1722. /******/ ]);
  1723. /***/ }),
  1724. /***/ "./grammar/pt/langFunctions.js":
  1725. /*!*************************************!*\
  1726. !*** ./grammar/pt/langFunctions.js ***!
  1727. \*************************************/
  1728. /*! no static exports found */
  1729. /***/ (function(module, exports, __webpack_require__) {
  1730. "use strict";
  1731. Object.defineProperty(exports, "__esModule", {
  1732. value: true
  1733. });
  1734. /* This is a dictionary of the language defined functions
  1735. **/
  1736. exports.default = {
  1737. main_function: "inicio",
  1738. $read: "leia",
  1739. $write: "escreva",
  1740. $numElements: "numero_elementos",
  1741. $matrixLines: "matriz_linhas",
  1742. $matrixColumns: "matriz_colunas",
  1743. $substring: "subcadeia",
  1744. $length: "comprimento",
  1745. $uppercase: "caixa_alta",
  1746. $lowercase: "caixa_baixa",
  1747. $charAt: "char_at",
  1748. $isReal: "e_real",
  1749. $isInt: "e_inteiro",
  1750. $isBool: "e_logico",
  1751. $castReal: "como_real",
  1752. $castInt: "como_inteiro",
  1753. $castBool: "como_logico",
  1754. $castString: "como_cadeia",
  1755. $sin: "sen",
  1756. $cos: "cos",
  1757. $tan: "tan",
  1758. $sqrt: "raiz_quadrada",
  1759. $pow: "pot",
  1760. $log: "log",
  1761. $abs: "modulo",
  1762. $negate: "trocar_sinal",
  1763. $invert: "inverter_valor",
  1764. $max: "maximo",
  1765. $min: "minimo"
  1766. };
  1767. /***/ }),
  1768. /***/ "./grammar/pt/langLibs.js":
  1769. /*!********************************!*\
  1770. !*** ./grammar/pt/langLibs.js ***!
  1771. \********************************/
  1772. /*! no static exports found */
  1773. /***/ (function(module, exports, __webpack_require__) {
  1774. "use strict";
  1775. Object.defineProperty(exports, "__esModule", {
  1776. value: true
  1777. });
  1778. /**
  1779. * This is the dictionary of the language defined libraries
  1780. */
  1781. exports.default = {
  1782. $mathLib: "Matematica",
  1783. $ioLib: "ES",
  1784. $strLib: "Texto",
  1785. $arrayLib: "Arranjo",
  1786. $langLib: "IV"
  1787. };
  1788. /***/ }),
  1789. /***/ "./i18n/en/error.json":
  1790. /*!****************************!*\
  1791. !*** ./i18n/en/error.json ***!
  1792. \****************************/
  1793. /*! exports provided: token_missing_one, token_missing_two, eos_missing, invalid_type, invalid_array_dimension, invalid_array_size, extra_lines, invalid_main_return, invalid_var_declaration, invalid_break_command, invalid_terminal, id_missing, main_missing, invalid_global_var, not_implemented, function_missing, invalid_parameters_size, invalid_ref, invalid_parameter_type, unknown_command, loop_condition_type, if_condition_type, invalid_return_type, unexpected_break_command, invalid_dimension, void_in_expression, invalid_array, invalid_array_access, column_outbounds, line_outbounds, invalid_infix_op, invalid_unary_op, unknown_op, default */
  1794. /***/ (function(module) {
  1795. module.exports = {"token_missing_one":"Erro de sintaxe: Espera-se $0, mas encontrou-se $1 na linha:$2, coluna:$3","token_missing_two":"Erro de sintaxe: Esperava-se $0 ou $1 mas encontrou-se $2 na liha:$3, coluna: $4","eos_missing":"Falta uma nova linha ou ; na linha: $0, coluna: $1","invalid_type":"$0 na linha: $1, coluna: $2 é um tipo inválido. Os tipos válidos são: $3","invalid_array_dimension":"A dimensão inválida na linha: $0, coluna: $1. Insira um $2 ou identificador válido do mesmo tipo.","invalid_array_size":"O tamnho do vetor/matriz excede o máximo de 2 na linha $0","extra_lines":"Nenhum texto é permitido após '}' em 'programa {...}'","invalid_main_return":"A função $0 deve retornar $1 na linha $2","invalid_var_declaration":"Erro na linha $0. Variáveis só podem ser declarados no corpo principal da função e de preferência nas primeiras linhas.","invalid_break_command":"Erro na linha $0. O comando $1 não pode ser usado fora de uma estrutura de repetição ou 'escolha...caso'","invalid_terminal":"Não é possível utilizar $0 na expressão da linha: $1, coluna: $2. Tente um valor númerico, variável ou chamada de função.","id_missing":"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2","main_missing":"A função principal não foi encontrada","invalid_global_var":"Erro crítico: Chamada inválida da função initGlobal fora do contexto BASE","not_implemented":"Erro interno crítico: A função definida pelo sistema $0 não foi implementada.","function_missing":"A função $0 não foi encontrada","invalid_parameters_size":"A quantidade de parâmetros fornecidos está incorreta. Esperava-se $0, encontrou-se $1","invalid_ref":"Você deve fornecer apenas um identificador como parâmetro","invalid_parameter_type":"O valor fornecido como parâmetro é do tipo $0, mas o tipo esperado é $1","unknown_command":"Erro interno crítico: Comando desconhecido encontrado","loop_condition_type":"A condição dos laços de repetição deve ser do tipo lógico","if_condition_type":"A condição de um comando se...senao deve ser do tipo lógico","invalid_return_type":"A função $0 deve retornar um tipo $1, ao invés de $1","unexpected_break_command":"Erro interno crítico: Comando pare encontrado fora do contexto de um laço/escolha..caso","invalid_dimension":"As dimensões de um vetor/matriz devem ser do tipo inteiro","void_in_expression":"A função $0 não pode ser utilizada aqui pois seu tipo de retorno é vazio","invalid_array":"Expressão literal de Vetor/Mariz inválida","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","line_outbounds":"Número de linhas $0 é invaálido para a matriz $1 que possui $2 linhas","invalid_infix_op":"Não é possível aplicar a operação $0 entre os tipos $1 e $2","invalid_unary_op":"Não é possível aplicar a operação $0 ao tipo $1","unknown_op":"Erro interno crítico: Operação $0 desconhecida"};
  1796. /***/ }),
  1797. /***/ "./i18n/en/index.js":
  1798. /*!**************************!*\
  1799. !*** ./i18n/en/index.js ***!
  1800. \**************************/
  1801. /*! no static exports found */
  1802. /***/ (function(module, exports, __webpack_require__) {
  1803. "use strict";
  1804. Object.defineProperty(exports, "__esModule", {
  1805. value: true
  1806. });
  1807. var _error = __webpack_require__(/*! ./error.json */ "./i18n/en/error.json");
  1808. var _error2 = _interopRequireDefault(_error);
  1809. var _message = __webpack_require__(/*! ./message.json */ "./i18n/en/message.json");
  1810. var _message2 = _interopRequireDefault(_message);
  1811. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/en/ui.json");
  1812. var _ui2 = _interopRequireDefault(_ui);
  1813. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1814. exports.default = {
  1815. 'message': _message2.default,
  1816. 'error': _error2.default,
  1817. 'ui': _ui2.default
  1818. };
  1819. /***/ }),
  1820. /***/ "./i18n/en/message.json":
  1821. /*!******************************!*\
  1822. !*** ./i18n/en/message.json ***!
  1823. \******************************/
  1824. /*! exports provided: default */
  1825. /***/ (function(module) {
  1826. module.exports = {};
  1827. /***/ }),
  1828. /***/ "./i18n/en/ui.json":
  1829. /*!*************************!*\
  1830. !*** ./i18n/en/ui.json ***!
  1831. \*************************/
  1832. /*! exports provided: function, btn_clear, btn_function, btn_arithmetic_plus, btn_arithmetic_minus, btn_arithmetic_multiplication, btn_arithmetic_division, btn_arithmetic_module, btn_break, btn_case, start, void, integer, real, program, text, text_start, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_command_read, text_command_write, text_comment, text_attribution, text_if, text_else, text_break, text_for, text_code_while, text_code_do, text_code_switch, text_code_case, text_logic_expression, text_arithmetic_expression, text_iftrue, text_receives, text_repeatNtimes, text_return, text_btn_return, text_whiletrue, text_dowhiletrue, text_switch, text_functioncall, text_value, text_operator, text_parentheses, text_change, text_teacher_algorithm, text_teacher_algorithm_include, text_teacher_test_case, text_teacher_config, text_teacher_data_types, text_teacher_commands, text_teacher_functions, text_teacher_create_functions, text_teacher_create_movement_functions, text_teacher_test_case_input, text_teacher_test_case_output, text_teacher_test_case_actions, text_teacher_test_case_add, tooltip_visual, tooltip_textual, tooltip_upload, tooltip_download, tooltip_undo, tooltip_redo, tooltip_run, tooltip_evaluate, tooltip_help, tooltip_add_global, tooltip_minimize, tooltip_console, default */
  1833. /***/ (function(module) {
  1834. module.exports = {"function":"function","btn_clear":"Clear","btn_function":"Function","btn_arithmetic_plus":"Sum","btn_arithmetic_minus":"Minus","btn_arithmetic_multiplication":"Multiplication","btn_arithmetic_division":"Division","btn_arithmetic_module":"Module","btn_break":"Break","btn_case":"Case","start":"start","void":"void","integer":"integer","real":"real","program":"program","text":"text","text_start":"text","boolean":"boolean","true":"true","false":"false","variable":"Variable","command":"Command","new_parameter":"new_parameter","new_variable":"new_variable","new_global":"new_global","new_function":"new_function","vector":"vector","text_comment_start":"Initial comment of function...","text_comment_main":"This is the main function...","text_read_var":"Reading data","text_write_var":"Writing data","text_command_read":"read","text_command_write":"write","text_comment":"Comment","text_attribution":"Attribution","text_if":"if","text_else":"else","text_break":"break","text_for":"for","text_code_while":"while","text_code_do":"do","text_code_switch":"switch","text_code_case":"case","text_logic_expression":"Logic Expression","text_arithmetic_expression":"Arithmetic Expression","text_iftrue":"If true then","text_receives":"receives","text_repeatNtimes":"Repeat N times","text_return":"return","text_btn_return":"Return","text_whiletrue":"While true","text_dowhiletrue":"Do while true","text_switch":"Switch","text_functioncall":"Function call","text_value":"Value","text_operator":"Operator","text_parentheses":"Parentheses","text_change":"Change","text_teacher_algorithm":"Algorithm","text_teacher_algorithm_include":"Include the following algorithm in exercise","text_teacher_test_case":"Test cases","text_teacher_config":"Settings","text_teacher_data_types":"Data types","text_teacher_commands":"Commands","text_teacher_functions":"Functions","text_teacher_create_functions":"Create new functions","text_teacher_create_movement_functions":"Move functions","text_teacher_test_case_input":"Input","text_teacher_test_case_output":"Output","text_teacher_test_case_actions":"Actions","text_teacher_test_case_add":"Add test cases","tooltip_visual":"Visual programming","tooltip_textual":"Textual programming","tooltip_upload":"Upload code file","tooltip_download":"Download code file","tooltip_undo":"Undo","tooltip_redo":"Redo","tooltip_run":"Run program","tooltip_evaluate":"Evaluate program","tooltip_help":"Help","tooltip_add_global":"Add global variable","tooltip_minimize":"Hidde function elements","tooltip_console":"Open/Close console"};
  1835. /***/ }),
  1836. /***/ "./i18n/es/error.json":
  1837. /*!****************************!*\
  1838. !*** ./i18n/es/error.json ***!
  1839. \****************************/
  1840. /*! exports provided: default */
  1841. /***/ (function(module) {
  1842. module.exports = {};
  1843. /***/ }),
  1844. /***/ "./i18n/es/index.js":
  1845. /*!**************************!*\
  1846. !*** ./i18n/es/index.js ***!
  1847. \**************************/
  1848. /*! no static exports found */
  1849. /***/ (function(module, exports, __webpack_require__) {
  1850. "use strict";
  1851. Object.defineProperty(exports, "__esModule", {
  1852. value: true
  1853. });
  1854. var _error = __webpack_require__(/*! ./error.json */ "./i18n/es/error.json");
  1855. var _error2 = _interopRequireDefault(_error);
  1856. var _message = __webpack_require__(/*! ./message.json */ "./i18n/es/message.json");
  1857. var _message2 = _interopRequireDefault(_message);
  1858. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/es/ui.json");
  1859. var _ui2 = _interopRequireDefault(_ui);
  1860. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1861. exports.default = {
  1862. 'message': _message2.default,
  1863. 'error': _error2.default,
  1864. 'ui': _ui2.default
  1865. };
  1866. /***/ }),
  1867. /***/ "./i18n/es/message.json":
  1868. /*!******************************!*\
  1869. !*** ./i18n/es/message.json ***!
  1870. \******************************/
  1871. /*! exports provided: default */
  1872. /***/ (function(module) {
  1873. module.exports = {};
  1874. /***/ }),
  1875. /***/ "./i18n/es/ui.json":
  1876. /*!*************************!*\
  1877. !*** ./i18n/es/ui.json ***!
  1878. \*************************/
  1879. /*! exports provided: function, btn_clear, btn_function, btn_arithmetic_plus, btn_arithmetic_minus, btn_arithmetic_multiplication, btn_arithmetic_division, btn_arithmetic_module, btn_break, btn_case, start, void, integer, real, program, text, text_start, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_command_read, text_command_write, text_comment, text_attribution, text_if, text_break, text_else, text_return, text_btn_return, text_for, text_code_while, text_code_do, text_code_switch, text_code_case, text_logic_expression, text_arithmetic_expression, text_iftrue, text_repeatNtimes, text_receives, text_whiletrue, text_dowhiletrue, text_switch, text_functioncall, text_value, text_operator, text_parentheses, text_change, text_teacher_algorithm, text_teacher_algorithm_include, text_teacher_test_case, text_teacher_config, text_teacher_data_types, text_teacher_commands, text_teacher_functions, text_teacher_create_functions, text_teacher_create_movement_functions, text_teacher_test_case_input, text_teacher_test_case_output, text_teacher_test_case_actions, text_teacher_test_case_add, tooltip_visual, tooltip_textual, tooltip_upload, tooltip_download, tooltip_undo, tooltip_redo, tooltip_run, tooltip_evaluate, tooltip_help, tooltip_add_global, tooltip_minimize, tooltip_console, default */
  1880. /***/ (function(module) {
  1881. module.exports = {"function":"function","btn_clear":"Clear","btn_function":"Function","btn_arithmetic_plus":"Sum","btn_arithmetic_minus":"Minus","btn_arithmetic_multiplication":"Multiplication","btn_arithmetic_division":"Division","btn_arithmetic_module":"Module","btn_break":"Break","btn_case":"Case","start":"start","void":"void","integer":"integer","real":"real","program":"program","text":"text","text_start":"text","boolean":"boolean","true":"true","false":"false","variable":"Variable","command":"Command","new_parameter":"new_parameter","new_variable":"new_variable","new_global":"new_global","new_function":"new_function","vector":"vector","text_comment_start":"Initial comment of function...","text_comment_main":"This is the main function...","text_read_var":"Reading data","text_write_var":"Writing data","text_command_read":"read","text_command_write":"write","text_comment":"Comment","text_attribution":"Attribution","text_if":"if","text_break":"break","text_else":"else","text_return":"return","text_btn_return":"Return","text_for":"for","text_code_while":"while","text_code_do":"do","text_code_switch":"switch","text_code_case":"case","text_logic_expression":"Logic Expression","text_arithmetic_expression":"Arithmetic Expression","text_iftrue":"If true then","text_repeatNtimes":"Repeat N times","text_receives":"receives","text_whiletrue":"While true","text_dowhiletrue":"Do while true","text_switch":"Switch","text_functioncall":"Function call","text_value":"Value","text_operator":"Operator","text_parentheses":"Parentheses","text_change":"Change","text_teacher_algorithm":"Algorithm","text_teacher_algorithm_include":"Include the following algorithm in exercise","text_teacher_test_case":"Test cases","text_teacher_config":"Settings","text_teacher_data_types":"Data types","text_teacher_commands":"Commands","text_teacher_functions":"Functions","text_teacher_create_functions":"Create new functions","text_teacher_create_movement_functions":"Move functions","text_teacher_test_case_input":"Input","text_teacher_test_case_output":"Output","text_teacher_test_case_actions":"Actions","text_teacher_test_case_add":"Add test cases","tooltip_visual":"Visual programming","tooltip_textual":"Textual programming","tooltip_upload":"Upload code file","tooltip_download":"Download code file","tooltip_undo":"Undo","tooltip_redo":"Redo","tooltip_run":"Run program","tooltip_evaluate":"Evaluate program","tooltip_help":"Help","tooltip_add_global":"Add global variable","tooltip_minimize":"Hidde function elements","tooltip_console":"Open/Close console"};
  1882. /***/ }),
  1883. /***/ "./i18n/index.js":
  1884. /*!***********************!*\
  1885. !*** ./i18n/index.js ***!
  1886. \***********************/
  1887. /*! no static exports found */
  1888. /***/ (function(module, exports, __webpack_require__) {
  1889. "use strict";
  1890. Object.defineProperty(exports, "__esModule", {
  1891. value: true
  1892. });
  1893. var _en = __webpack_require__(/*! ./en */ "./i18n/en/index.js");
  1894. var _en2 = _interopRequireDefault(_en);
  1895. var _pt = __webpack_require__(/*! ./pt */ "./i18n/pt/index.js");
  1896. var _pt2 = _interopRequireDefault(_pt);
  1897. var _es = __webpack_require__(/*! ./es */ "./i18n/es/index.js");
  1898. var _es2 = _interopRequireDefault(_es);
  1899. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1900. exports.default = {
  1901. 'en': _en2.default,
  1902. 'pt': _pt2.default,
  1903. 'es': _es2.default
  1904. };
  1905. /***/ }),
  1906. /***/ "./i18n/pt/error.json":
  1907. /*!****************************!*\
  1908. !*** ./i18n/pt/error.json ***!
  1909. \****************************/
  1910. /*! exports provided: token_missing_one, token_missing_two, eos_missing, invalid_type, invalid_array_dimension, invalid_array_size, extra_lines, invalid_main_return, invalid_var_declaration, invalid_break_command, invalid_terminal, const_not_init, id_missing, invalid_id_format, main_missing, invalid_global_var, not_implemented, function_missing, invalid_parameters_size, invalid_ref, invalid_parameter_type, unknown_command, loop_condition_type, if_condition_type, invalid_return_type, unexpected_break_command, invalid_dimension, void_in_expression, invalid_array, invalid_array_access, column_outbounds, line_outbounds, invalid_infix_op, invalid_unary_op, unknown_op, default */
  1911. /***/ (function(module) {
  1912. module.exports = {"token_missing_one":"Erro de sintaxe: Espera-se $0, mas encontrou-se $1 na linha:$2, coluna:$3","token_missing_two":"Erro de sintaxe: Esperava-se $0 ou $1 mas encontrou-se $2 na liha:$3, coluna: $4","eos_missing":"Falta uma nova linha ou ; na linha: $0, coluna: $1","invalid_type":"$0 na linha: $1, coluna: $2 é um tipo inválido. Os tipos válidos são: $3","invalid_array_dimension":"A dimensão inválida na linha: $0, coluna: $1. Insira um $2 ou identificador válido do mesmo tipo.","invalid_array_size":"O tamnho do vetor/matriz excede o máximo de 2 na linha $0","extra_lines":"Nenhum texto é permitido após '}' em 'programa {...}'","invalid_main_return":"A função $0 deve retornar $1 na linha $2","invalid_var_declaration":"Erro na linha $0. Variáveis só podem ser declarados no corpo principal da função e de preferência nas primeiras linhas.","invalid_break_command":"Erro na linha $0. O comando $1 não pode ser usado fora de uma estrutura de repetição ou 'escolha...caso'","invalid_terminal":"Não é possível utilizar $0 na expressão da linha: $1, coluna: $2. Tente um valor númerico, variável ou chamada de função.","const_not_init":"Erro na linha: $0, coluna: $1. Uma variável declarada como const deve ser inicializada","id_missing":"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2","invalid_id_format":"$0 na linha: $1, coluna: $2 não é um identificador válido. O símbolo '.' não é permitido neste contexto.","main_missing":"A função principal não foi encontrada","invalid_global_var":"Erro crítico: Chamada inválida da função initGlobal fora do contexto BASE","not_implemented":"Erro interno crítico: A função definida pelo sistema $0 não foi implementada.","function_missing":"A função $0 não foi encontrada","invalid_parameters_size":"A quantidade de parâmetros fornecidos está incorreta. Esperava-se $0, encontrou-se $1","invalid_ref":"Você deve fornecer apenas um identificador como parâmetro","invalid_parameter_type":"O valor fornecido como parâmetro é do tipo $0, mas o tipo esperado é $1","unknown_command":"Erro interno crítico: Comando desconhecido encontrado","loop_condition_type":"A condição dos laços de repetição deve ser do tipo lógico","if_condition_type":"A condição de um comando se...senao deve ser do tipo lógico","invalid_return_type":"A função $0 deve retornar um tipo $1, ao invés de $1","unexpected_break_command":"Erro interno crítico: Comando pare encontrado fora do contexto de um laço/escolha..caso","invalid_dimension":"As dimensões de um vetor/matriz devem ser do tipo inteiro","void_in_expression":"A função $0 não pode ser utilizada aqui pois seu tipo de retorno é vazio","invalid_array":"Expressão literal de Vetor/Mariz inválida","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","line_outbounds":"Número de linhas $0 é invaálido para a matriz $1 que possui $2 linhas","invalid_infix_op":"Não é possível aplicar a operação $0 entre os tipos $1 e $2","invalid_unary_op":"Não é possível aplicar a operação $0 ao tipo $1","unknown_op":"Erro interno crítico: Operação $0 desconhecida"};
  1913. /***/ }),
  1914. /***/ "./i18n/pt/index.js":
  1915. /*!**************************!*\
  1916. !*** ./i18n/pt/index.js ***!
  1917. \**************************/
  1918. /*! no static exports found */
  1919. /***/ (function(module, exports, __webpack_require__) {
  1920. "use strict";
  1921. Object.defineProperty(exports, "__esModule", {
  1922. value: true
  1923. });
  1924. var _error = __webpack_require__(/*! ./error.json */ "./i18n/pt/error.json");
  1925. var _error2 = _interopRequireDefault(_error);
  1926. var _message = __webpack_require__(/*! ./message.json */ "./i18n/pt/message.json");
  1927. var _message2 = _interopRequireDefault(_message);
  1928. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/pt/ui.json");
  1929. var _ui2 = _interopRequireDefault(_ui);
  1930. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1931. exports.default = {
  1932. 'message': _message2.default,
  1933. 'error': _error2.default,
  1934. 'ui': _ui2.default
  1935. };
  1936. /***/ }),
  1937. /***/ "./i18n/pt/message.json":
  1938. /*!******************************!*\
  1939. !*** ./i18n/pt/message.json ***!
  1940. \******************************/
  1941. /*! exports provided: default */
  1942. /***/ (function(module) {
  1943. module.exports = {};
  1944. /***/ }),
  1945. /***/ "./i18n/pt/ui.json":
  1946. /*!*************************!*\
  1947. !*** ./i18n/pt/ui.json ***!
  1948. \*************************/
  1949. /*! exports provided: function, btn_clear, btn_function, btn_arithmetic_plus, btn_arithmetic_minus, btn_arithmetic_multiplication, btn_arithmetic_division, btn_arithmetic_module, btn_break, btn_case, start, void, integer, real, program, text, text_start, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_command_read, text_command_write, text_return, text_btn_return, text_comment, join_or, text_attribution, text_if, text_break, text_else, text_for, text_code_while, text_code_do, text_code_switch, text_code_case, text_logic_expression, text_arithmetic_expression, text_iftrue, text_repeatNtimes, text_receives, text_whiletrue, text_dowhiletrue, text_switch, text_functioncall, text_value, text_operator, text_parentheses, text_change, text_teacher_algorithm, text_teacher_algorithm_include, text_teacher_test_case, text_teacher_config, text_teacher_data_types, text_teacher_commands, text_teacher_functions, text_teacher_create_functions, text_teacher_create_movement_functions, text_teacher_test_case_input, text_teacher_test_case_output, text_teacher_test_case_actions, text_teacher_test_case_add, tooltip_visual, tooltip_textual, tooltip_upload, tooltip_download, tooltip_undo, tooltip_redo, tooltip_run, tooltip_evaluate, tooltip_help, tooltip_add_global, tooltip_minimize, tooltip_console, default */
  1950. /***/ (function(module) {
  1951. module.exports = {"function":"funcao","btn_clear":"Limpar","btn_function":"Função","btn_arithmetic_plus":"Adição","btn_arithmetic_minus":"Subtração","btn_arithmetic_multiplication":"Multiplicação","btn_arithmetic_division":"Divisão","btn_arithmetic_module":"Módulo","btn_break":"Pare","btn_case":"Caso","start":"inicio","void":"vazio","integer":"inteiro","real":"real","program":"programa","text":"cadeia","text_start":"texto","boolean":"logico","true":"verdadeiro","false":"falso","variable":"Variável","command":"Comando","new_parameter":"novo_parametro","new_variable":"nova_variavel","new_global":"nova_global","new_function":"nova_funcao","vector":"vetor","text_comment_start":"Comentário inicial da função...","text_comment_main":"Esta é a função principal...","text_read_var":"Leitura de dados","text_write_var":"Escrita de dados","text_command_read":"leia","text_command_write":"escreva","text_return":"retorne","text_btn_return":"Retorno","text_comment":"Comentário","join_or":"ou","text_attribution":"Atribuição","text_if":"se","text_break":"pare","text_else":"senao","text_for":"para","text_code_while":"enquanto","text_code_do":"faça","text_code_switch":"escolha","text_code_case":"caso","text_logic_expression":"Expressão Lógica","text_arithmetic_expression":"Expressão Aritmética","text_iftrue":"Se verdadeiro então","text_repeatNtimes":"Repita N vezes","text_receives":"recebe","text_whiletrue":"Enquanto verdadeiro","text_dowhiletrue":"Faça enquanto verdadeiro","text_switch":"Escolha","text_functioncall":"Chamada de função","text_value":"Valor","text_operator":"Operador","text_parentheses":"Parênteses","text_change":"Alterar","text_teacher_algorithm":"Algoritmo","text_teacher_algorithm_include":"Incluir o algoritmo abaixo no exercício","text_teacher_test_case":"Casos de teste","text_teacher_config":"Configurações","text_teacher_data_types":"Tipos de dados","text_teacher_commands":"Comandos","text_teacher_functions":"Funções","text_teacher_create_functions":"Criar novas funções","text_teacher_create_movement_functions":"Movimentar funções","text_teacher_test_case_input":"Entrada","text_teacher_test_case_output":"Saída","text_teacher_test_case_actions":"Ações","text_teacher_test_case_add":"Adicionar caso de teste","tooltip_visual":"Programação visual","tooltip_textual":"Programação textual","tooltip_upload":"Upload de código fonte","tooltip_download":"Download do código fonte","tooltip_undo":"Desfazer","tooltip_redo":"Refazer","tooltip_run":"Executar o programa","tooltip_evaluate":"Avaliar o programa","tooltip_help":"Ajuda","tooltip_add_global":"Adicionar variável global","tooltip_minimize":"Ocultar os elementos da função","tooltip_console":"Abrir/fechar o terminal"};
  1952. /***/ }),
  1953. /***/ "./js/assessment/ivprogAssessment.js":
  1954. /*!*******************************************!*\
  1955. !*** ./js/assessment/ivprogAssessment.js ***!
  1956. \*******************************************/
  1957. /*! no static exports found */
  1958. /***/ (function(module, exports, __webpack_require__) {
  1959. "use strict";
  1960. Object.defineProperty(exports, "__esModule", {
  1961. value: true
  1962. });
  1963. exports.IVProgAssessment = undefined;
  1964. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1965. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  1966. var _semanticAnalyser = __webpack_require__(/*! ./../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  1967. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  1968. var _inputTest = __webpack_require__(/*! ./../util/inputTest */ "./js/util/inputTest.js");
  1969. var _outputTest = __webpack_require__(/*! ./../util/outputTest */ "./js/util/outputTest.js");
  1970. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1971. var IVProgAssessment = exports.IVProgAssessment = function () {
  1972. function IVProgAssessment(textCode, testCases, domConsole) {
  1973. _classCallCheck(this, IVProgAssessment);
  1974. this.textCode = textCode;
  1975. this.testCases = testCases;
  1976. this.domConsole = domConsole;
  1977. }
  1978. _createClass(IVProgAssessment, [{
  1979. key: "runTest",
  1980. value: function runTest() {
  1981. var outerRef = this;
  1982. return new Promise(function (resolve, _) {
  1983. try {
  1984. // try and show error messages through domconsole
  1985. var parser = _ivprogParser.IVProgParser.createParser(outerRef.textCode);
  1986. var semantic = new _semanticAnalyser.SemanticAnalyser(parser.parseTree());
  1987. var validTree = semantic.analyseTree();
  1988. // loop test cases and show messages through domconsole
  1989. var tests = outerRef.testCases.map(function (t, name) {
  1990. return outerRef.evaluateTestCase(new _ivprogProcessor.IVProgProcessor(validTree), t.input, t.output, name);
  1991. });
  1992. Promise.all(tests).then(function (results) {
  1993. var count = results.reduce(function (lastValue, nextValue) {
  1994. return lastValue + nextValue;
  1995. }, 0);
  1996. resolve(count / outerRef.testCases.length);
  1997. }).catch(function (err) {
  1998. outerRef.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole
  1999. outerRef.domConsole.err(err.message);
  2000. resolve(0);
  2001. });
  2002. } catch (error) {
  2003. outerRef.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole
  2004. outerRef.domConsole.err(error.message);
  2005. resolve(0);
  2006. }
  2007. });
  2008. }
  2009. }, {
  2010. key: "evaluateTestCase",
  2011. value: function evaluateTestCase(prog, inputList, outputList, name) {
  2012. var outerThis = this;
  2013. return new Promise(function (resolve, reject) {
  2014. var input = new _inputTest.InputTest(inputList);
  2015. var output = new _outputTest.OutputTest();
  2016. prog.registerInput(input);
  2017. prog.registerOutput(output);
  2018. var startTime = Date.now();
  2019. prog.interpretAST().then(function (_) {
  2020. var millis = Date.now() - startTime;
  2021. if (input.inputList.length !== input.index) {
  2022. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou, ainda restam entradas!");
  2023. outerThis.domConsole.info("Levou " + millis + "ms");
  2024. resolve(1 * (input.index / inputList.length));
  2025. } else if (output.list.length < outputList.length) {
  2026. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">");
  2027. outerThis.domConsole.info("Levou " + millis + "ms");
  2028. resolve(1 * (output.list.length / outputList.length));
  2029. } else if (output.list.length > outputList.length) {
  2030. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">");
  2031. outerThis.domConsole.info("Levou " + millis + "ms");
  2032. resolve(1 * (outputList.length / output.list.length));
  2033. } else {
  2034. var isOk = outerThis.checkOutput(output.list, outputList);
  2035. if (!isOk) {
  2036. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">");
  2037. outerThis.domConsole.info("Levou " + millis + "ms");
  2038. resolve(0);
  2039. } else {
  2040. outerThis.domConsole.info("Caso de teste " + (name + 1) + ": OK!");
  2041. outerThis.domConsole.info("Levou " + millis + "ms");
  2042. resolve(1);
  2043. }
  2044. }
  2045. }).catch(function (_) {
  2046. return resolve(0);
  2047. });
  2048. });
  2049. }
  2050. }, {
  2051. key: "checkOutput",
  2052. value: function checkOutput(aList, bList) {
  2053. for (var i = 0; i < aList.length; i++) {
  2054. var outValue = aList[i];
  2055. if (outValue != bList[i]) {
  2056. return false;
  2057. }
  2058. }
  2059. return true;
  2060. }
  2061. }]);
  2062. return IVProgAssessment;
  2063. }();
  2064. /***/ }),
  2065. /***/ "./js/ast/commands/arrayAssign.js":
  2066. /*!****************************************!*\
  2067. !*** ./js/ast/commands/arrayAssign.js ***!
  2068. \****************************************/
  2069. /*! no static exports found */
  2070. /***/ (function(module, exports, __webpack_require__) {
  2071. "use strict";
  2072. Object.defineProperty(exports, "__esModule", {
  2073. value: true
  2074. });
  2075. exports.ArrayIndexAssign = undefined;
  2076. var _assign = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  2077. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2078. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2079. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2080. var ArrayIndexAssign = exports.ArrayIndexAssign = function (_Assign) {
  2081. _inherits(ArrayIndexAssign, _Assign);
  2082. function ArrayIndexAssign(id, lineExpression, columnExpression, expression) {
  2083. _classCallCheck(this, ArrayIndexAssign);
  2084. var _this = _possibleConstructorReturn(this, (ArrayIndexAssign.__proto__ || Object.getPrototypeOf(ArrayIndexAssign)).call(this, id, expression));
  2085. _this.line = lineExpression;
  2086. _this.column = columnExpression;
  2087. return _this;
  2088. }
  2089. return ArrayIndexAssign;
  2090. }(_assign.Assign);
  2091. /***/ }),
  2092. /***/ "./js/ast/commands/arrayDeclaration.js":
  2093. /*!*********************************************!*\
  2094. !*** ./js/ast/commands/arrayDeclaration.js ***!
  2095. \*********************************************/
  2096. /*! no static exports found */
  2097. /***/ (function(module, exports, __webpack_require__) {
  2098. "use strict";
  2099. Object.defineProperty(exports, "__esModule", {
  2100. value: true
  2101. });
  2102. exports.ArrayDeclaration = undefined;
  2103. var _declaration = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  2104. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2105. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2106. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2107. var ArrayDeclaration = exports.ArrayDeclaration = function (_Declaration) {
  2108. _inherits(ArrayDeclaration, _Declaration);
  2109. function ArrayDeclaration(id, type, lines, columns, initial, isConst) {
  2110. _classCallCheck(this, ArrayDeclaration);
  2111. var _this = _possibleConstructorReturn(this, (ArrayDeclaration.__proto__ || Object.getPrototypeOf(ArrayDeclaration)).call(this, id, type, initial, isConst));
  2112. _this.lines = lines;
  2113. _this.columns = columns;
  2114. return _this;
  2115. }
  2116. return ArrayDeclaration;
  2117. }(_declaration.Declaration);
  2118. /***/ }),
  2119. /***/ "./js/ast/commands/assign.js":
  2120. /*!***********************************!*\
  2121. !*** ./js/ast/commands/assign.js ***!
  2122. \***********************************/
  2123. /*! no static exports found */
  2124. /***/ (function(module, exports, __webpack_require__) {
  2125. "use strict";
  2126. Object.defineProperty(exports, "__esModule", {
  2127. value: true
  2128. });
  2129. exports.Assign = undefined;
  2130. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  2131. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2132. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2133. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2134. var Assign = exports.Assign = function (_Command) {
  2135. _inherits(Assign, _Command);
  2136. function Assign(id, expression) {
  2137. _classCallCheck(this, Assign);
  2138. var _this = _possibleConstructorReturn(this, (Assign.__proto__ || Object.getPrototypeOf(Assign)).call(this));
  2139. _this.id = id;
  2140. _this.expression = expression;
  2141. return _this;
  2142. }
  2143. return Assign;
  2144. }(_command.Command);
  2145. /***/ }),
  2146. /***/ "./js/ast/commands/break.js":
  2147. /*!**********************************!*\
  2148. !*** ./js/ast/commands/break.js ***!
  2149. \**********************************/
  2150. /*! no static exports found */
  2151. /***/ (function(module, exports, __webpack_require__) {
  2152. "use strict";
  2153. Object.defineProperty(exports, "__esModule", {
  2154. value: true
  2155. });
  2156. exports.Break = undefined;
  2157. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  2158. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2159. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2160. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2161. var Break = exports.Break = function (_Command) {
  2162. _inherits(Break, _Command);
  2163. function Break() {
  2164. _classCallCheck(this, Break);
  2165. return _possibleConstructorReturn(this, (Break.__proto__ || Object.getPrototypeOf(Break)).call(this));
  2166. }
  2167. return Break;
  2168. }(_command.Command);
  2169. /***/ }),
  2170. /***/ "./js/ast/commands/case.js":
  2171. /*!*********************************!*\
  2172. !*** ./js/ast/commands/case.js ***!
  2173. \*********************************/
  2174. /*! no static exports found */
  2175. /***/ (function(module, exports, __webpack_require__) {
  2176. "use strict";
  2177. Object.defineProperty(exports, "__esModule", {
  2178. value: true
  2179. });
  2180. exports.Case = undefined;
  2181. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2182. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  2183. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2184. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2185. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2186. var Case = exports.Case = function (_Command) {
  2187. _inherits(Case, _Command);
  2188. function Case(expression) {
  2189. _classCallCheck(this, Case);
  2190. var _this = _possibleConstructorReturn(this, (Case.__proto__ || Object.getPrototypeOf(Case)).call(this));
  2191. _this.expression = expression;
  2192. _this.commands = [];
  2193. return _this;
  2194. }
  2195. _createClass(Case, [{
  2196. key: 'setCommands',
  2197. value: function setCommands(commands) {
  2198. this.commands = commands;
  2199. }
  2200. }, {
  2201. key: 'isDefault',
  2202. get: function get() {
  2203. return this.expression === null;
  2204. }
  2205. }]);
  2206. return Case;
  2207. }(_command.Command);
  2208. /***/ }),
  2209. /***/ "./js/ast/commands/command.js":
  2210. /*!************************************!*\
  2211. !*** ./js/ast/commands/command.js ***!
  2212. \************************************/
  2213. /*! no static exports found */
  2214. /***/ (function(module, exports, __webpack_require__) {
  2215. "use strict";
  2216. Object.defineProperty(exports, "__esModule", {
  2217. value: true
  2218. });
  2219. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2220. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2221. var Command = exports.Command = function () {
  2222. function Command() {
  2223. _classCallCheck(this, Command);
  2224. this._sourceInfo = null;
  2225. }
  2226. _createClass(Command, [{
  2227. key: "sourceInfo",
  2228. set: function set(sourceInfo) {
  2229. this._sourceInfo = sourceInfo;
  2230. },
  2231. get: function get() {
  2232. return this._sourceInfo;
  2233. }
  2234. }]);
  2235. return Command;
  2236. }();
  2237. /***/ }),
  2238. /***/ "./js/ast/commands/commandBlock.js":
  2239. /*!*****************************************!*\
  2240. !*** ./js/ast/commands/commandBlock.js ***!
  2241. \*****************************************/
  2242. /*! no static exports found */
  2243. /***/ (function(module, exports, __webpack_require__) {
  2244. "use strict";
  2245. Object.defineProperty(exports, "__esModule", {
  2246. value: true
  2247. });
  2248. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2249. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2250. var CommandBlock = exports.CommandBlock = function () {
  2251. function CommandBlock(variables, commands) {
  2252. _classCallCheck(this, CommandBlock);
  2253. this.variables = variables;
  2254. this.commands = commands;
  2255. this._sourceInfo = null;
  2256. }
  2257. _createClass(CommandBlock, [{
  2258. key: "sourceInfo",
  2259. set: function set(sourceInfo) {
  2260. this._sourceInfo = sourceInfo;
  2261. },
  2262. get: function get() {
  2263. return this._sourceInfo;
  2264. }
  2265. }]);
  2266. return CommandBlock;
  2267. }();
  2268. /***/ }),
  2269. /***/ "./js/ast/commands/declaration.js":
  2270. /*!****************************************!*\
  2271. !*** ./js/ast/commands/declaration.js ***!
  2272. \****************************************/
  2273. /*! no static exports found */
  2274. /***/ (function(module, exports, __webpack_require__) {
  2275. "use strict";
  2276. Object.defineProperty(exports, "__esModule", {
  2277. value: true
  2278. });
  2279. exports.Declaration = undefined;
  2280. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  2281. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2282. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2283. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2284. var Declaration = exports.Declaration = function (_Command) {
  2285. _inherits(Declaration, _Command);
  2286. function Declaration(id, type, initial, isConst) {
  2287. _classCallCheck(this, Declaration);
  2288. var _this = _possibleConstructorReturn(this, (Declaration.__proto__ || Object.getPrototypeOf(Declaration)).call(this));
  2289. _this.id = id;
  2290. _this.type = type;
  2291. _this.initial = initial;
  2292. _this.isConst = isConst;
  2293. return _this;
  2294. }
  2295. return Declaration;
  2296. }(_command.Command);
  2297. /***/ }),
  2298. /***/ "./js/ast/commands/doWhile.js":
  2299. /*!************************************!*\
  2300. !*** ./js/ast/commands/doWhile.js ***!
  2301. \************************************/
  2302. /*! no static exports found */
  2303. /***/ (function(module, exports, __webpack_require__) {
  2304. "use strict";
  2305. Object.defineProperty(exports, "__esModule", {
  2306. value: true
  2307. });
  2308. exports.DoWhile = undefined;
  2309. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2310. var _while = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  2311. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2312. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2313. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2314. var DoWhile = exports.DoWhile = function (_While) {
  2315. _inherits(DoWhile, _While);
  2316. function DoWhile(condition, commandBlock) {
  2317. _classCallCheck(this, DoWhile);
  2318. return _possibleConstructorReturn(this, (DoWhile.__proto__ || Object.getPrototypeOf(DoWhile)).call(this, condition, commandBlock));
  2319. }
  2320. _createClass(DoWhile, [{
  2321. key: 'testFirst',
  2322. get: function get() {
  2323. return false;
  2324. }
  2325. }]);
  2326. return DoWhile;
  2327. }(_while.While);
  2328. /***/ }),
  2329. /***/ "./js/ast/commands/for.js":
  2330. /*!********************************!*\
  2331. !*** ./js/ast/commands/for.js ***!
  2332. \********************************/
  2333. /*! no static exports found */
  2334. /***/ (function(module, exports, __webpack_require__) {
  2335. "use strict";
  2336. Object.defineProperty(exports, "__esModule", {
  2337. value: true
  2338. });
  2339. exports.For = undefined;
  2340. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2341. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  2342. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2343. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2344. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2345. var For = exports.For = function (_Command) {
  2346. _inherits(For, _Command);
  2347. function For(assignment, condition, increment, commandBlock) {
  2348. _classCallCheck(this, For);
  2349. var _this = _possibleConstructorReturn(this, (For.__proto__ || Object.getPrototypeOf(For)).call(this));
  2350. _this.assignment = assignment;
  2351. _this.condition = condition;
  2352. _this.increment = increment;
  2353. _this.commandBlock = commandBlock;
  2354. return _this;
  2355. }
  2356. _createClass(For, [{
  2357. key: 'commands',
  2358. get: function get() {
  2359. return this.commandBlock.commands;
  2360. }
  2361. }]);
  2362. return For;
  2363. }(_command.Command);
  2364. /***/ }),
  2365. /***/ "./js/ast/commands/formalParameter.js":
  2366. /*!********************************************!*\
  2367. !*** ./js/ast/commands/formalParameter.js ***!
  2368. \********************************************/
  2369. /*! no static exports found */
  2370. /***/ (function(module, exports, __webpack_require__) {
  2371. "use strict";
  2372. Object.defineProperty(exports, "__esModule", {
  2373. value: true
  2374. });
  2375. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2376. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2377. var FormalParameter = exports.FormalParameter = function () {
  2378. function FormalParameter(type, id) {
  2379. var byRef = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  2380. _classCallCheck(this, FormalParameter);
  2381. this.type = type;
  2382. this.id = id;
  2383. this.byRef = byRef;
  2384. this._sourceInfo = null;
  2385. }
  2386. _createClass(FormalParameter, [{
  2387. key: "sourceInfo",
  2388. set: function set(sourceInfo) {
  2389. this._sourceInfo = sourceInfo;
  2390. },
  2391. get: function get() {
  2392. return this._sourceInfo;
  2393. }
  2394. }]);
  2395. return FormalParameter;
  2396. }();
  2397. /***/ }),
  2398. /***/ "./js/ast/commands/function.js":
  2399. /*!*************************************!*\
  2400. !*** ./js/ast/commands/function.js ***!
  2401. \*************************************/
  2402. /*! no static exports found */
  2403. /***/ (function(module, exports, __webpack_require__) {
  2404. "use strict";
  2405. Object.defineProperty(exports, "__esModule", {
  2406. value: true
  2407. });
  2408. exports.Function = undefined;
  2409. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2410. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  2411. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2412. var Function = exports.Function = function () {
  2413. function Function(name, returnType, formalParameters, commandBlock) {
  2414. _classCallCheck(this, Function);
  2415. this.name = name;
  2416. this.returnType = returnType;
  2417. this.formalParameters = formalParameters;
  2418. this.commandBlock = commandBlock;
  2419. this._sourceInfo = null;
  2420. }
  2421. _createClass(Function, [{
  2422. key: 'isMain',
  2423. get: function get() {
  2424. return this.name === null && this.returnType.isCompatible(_types.Types.VOID);
  2425. }
  2426. }, {
  2427. key: 'commands',
  2428. get: function get() {
  2429. return this.commandBlock.commands;
  2430. }
  2431. }, {
  2432. key: 'variablesDeclarations',
  2433. get: function get() {
  2434. return this.commandBlock.variables;
  2435. }
  2436. }, {
  2437. key: 'sourceInfo',
  2438. set: function set(sourceInfo) {
  2439. this._sourceInfo = sourceInfo;
  2440. },
  2441. get: function get() {
  2442. return this._sourceInfo;
  2443. }
  2444. }]);
  2445. return Function;
  2446. }();
  2447. /***/ }),
  2448. /***/ "./js/ast/commands/ifThenElse.js":
  2449. /*!***************************************!*\
  2450. !*** ./js/ast/commands/ifThenElse.js ***!
  2451. \***************************************/
  2452. /*! no static exports found */
  2453. /***/ (function(module, exports, __webpack_require__) {
  2454. "use strict";
  2455. Object.defineProperty(exports, "__esModule", {
  2456. value: true
  2457. });
  2458. exports.IfThenElse = undefined;
  2459. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  2460. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2461. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2462. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2463. var IfThenElse = exports.IfThenElse = function (_Command) {
  2464. _inherits(IfThenElse, _Command);
  2465. function IfThenElse(condition, ifTrue, ifFalse) {
  2466. _classCallCheck(this, IfThenElse);
  2467. var _this = _possibleConstructorReturn(this, (IfThenElse.__proto__ || Object.getPrototypeOf(IfThenElse)).call(this));
  2468. _this.condition = condition;
  2469. _this.ifTrue = ifTrue;
  2470. _this.ifFalse = ifFalse;
  2471. return _this;
  2472. }
  2473. return IfThenElse;
  2474. }(_command.Command);
  2475. /***/ }),
  2476. /***/ "./js/ast/commands/index.js":
  2477. /*!**********************************!*\
  2478. !*** ./js/ast/commands/index.js ***!
  2479. \**********************************/
  2480. /*! no static exports found */
  2481. /***/ (function(module, exports, __webpack_require__) {
  2482. "use strict";
  2483. Object.defineProperty(exports, "__esModule", {
  2484. value: true
  2485. });
  2486. exports.FunctionCall = exports.FormalParameter = exports.SysCall = exports.Case = exports.Switch = exports.DoWhile = exports.CommandBlock = exports.IfThenElse = exports.Function = exports.For = exports.While = exports.ArrayDeclaration = exports.Declaration = exports.ArrayIndexAssign = exports.Assign = exports.Return = exports.Break = undefined;
  2487. var _break = __webpack_require__(/*! ./break */ "./js/ast/commands/break.js");
  2488. var _return = __webpack_require__(/*! ./return */ "./js/ast/commands/return.js");
  2489. var _assign = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  2490. var _arrayAssign = __webpack_require__(/*! ./arrayAssign */ "./js/ast/commands/arrayAssign.js");
  2491. var _declaration = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  2492. var _arrayDeclaration = __webpack_require__(/*! ./arrayDeclaration */ "./js/ast/commands/arrayDeclaration.js");
  2493. var _while = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  2494. var _for = __webpack_require__(/*! ./for */ "./js/ast/commands/for.js");
  2495. var _function = __webpack_require__(/*! ./function */ "./js/ast/commands/function.js");
  2496. var _ifThenElse = __webpack_require__(/*! ./ifThenElse */ "./js/ast/commands/ifThenElse.js");
  2497. var _commandBlock = __webpack_require__(/*! ./commandBlock */ "./js/ast/commands/commandBlock.js");
  2498. var _doWhile = __webpack_require__(/*! ./doWhile */ "./js/ast/commands/doWhile.js");
  2499. var _switch = __webpack_require__(/*! ./switch */ "./js/ast/commands/switch.js");
  2500. var _case = __webpack_require__(/*! ./case */ "./js/ast/commands/case.js");
  2501. var _sysCall = __webpack_require__(/*! ./sysCall */ "./js/ast/commands/sysCall.js");
  2502. var _formalParameter = __webpack_require__(/*! ./formalParameter */ "./js/ast/commands/formalParameter.js");
  2503. var _functionCall = __webpack_require__(/*! ./../expressions/functionCall */ "./js/ast/expressions/functionCall.js");
  2504. //Proxy to expression since they do exatcly the same thing
  2505. exports.Break = _break.Break;
  2506. exports.Return = _return.Return;
  2507. exports.Assign = _assign.Assign;
  2508. exports.ArrayIndexAssign = _arrayAssign.ArrayIndexAssign;
  2509. exports.Declaration = _declaration.Declaration;
  2510. exports.ArrayDeclaration = _arrayDeclaration.ArrayDeclaration;
  2511. exports.While = _while.While;
  2512. exports.For = _for.For;
  2513. exports.Function = _function.Function;
  2514. exports.IfThenElse = _ifThenElse.IfThenElse;
  2515. exports.CommandBlock = _commandBlock.CommandBlock;
  2516. exports.DoWhile = _doWhile.DoWhile;
  2517. exports.Switch = _switch.Switch;
  2518. exports.Case = _case.Case;
  2519. exports.SysCall = _sysCall.SysCall;
  2520. exports.FormalParameter = _formalParameter.FormalParameter;
  2521. exports.FunctionCall = _functionCall.FunctionCall;
  2522. /***/ }),
  2523. /***/ "./js/ast/commands/return.js":
  2524. /*!***********************************!*\
  2525. !*** ./js/ast/commands/return.js ***!
  2526. \***********************************/
  2527. /*! no static exports found */
  2528. /***/ (function(module, exports, __webpack_require__) {
  2529. "use strict";
  2530. Object.defineProperty(exports, "__esModule", {
  2531. value: true
  2532. });
  2533. exports.Return = undefined;
  2534. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  2535. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2536. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2537. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2538. var Return = exports.Return = function (_Command) {
  2539. _inherits(Return, _Command);
  2540. function Return(expression) {
  2541. _classCallCheck(this, Return);
  2542. var _this = _possibleConstructorReturn(this, (Return.__proto__ || Object.getPrototypeOf(Return)).call(this));
  2543. _this.expression = expression;
  2544. return _this;
  2545. }
  2546. return Return;
  2547. }(_command.Command);
  2548. /***/ }),
  2549. /***/ "./js/ast/commands/switch.js":
  2550. /*!***********************************!*\
  2551. !*** ./js/ast/commands/switch.js ***!
  2552. \***********************************/
  2553. /*! no static exports found */
  2554. /***/ (function(module, exports, __webpack_require__) {
  2555. "use strict";
  2556. Object.defineProperty(exports, "__esModule", {
  2557. value: true
  2558. });
  2559. exports.Switch = undefined;
  2560. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  2561. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2562. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2563. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2564. var Switch = exports.Switch = function (_Command) {
  2565. _inherits(Switch, _Command);
  2566. function Switch(expression, cases) {
  2567. _classCallCheck(this, Switch);
  2568. var _this = _possibleConstructorReturn(this, (Switch.__proto__ || Object.getPrototypeOf(Switch)).call(this));
  2569. _this.expression = expression;
  2570. _this.cases = cases;
  2571. return _this;
  2572. }
  2573. return Switch;
  2574. }(_command.Command);
  2575. /***/ }),
  2576. /***/ "./js/ast/commands/sysCall.js":
  2577. /*!************************************!*\
  2578. !*** ./js/ast/commands/sysCall.js ***!
  2579. \************************************/
  2580. /*! no static exports found */
  2581. /***/ (function(module, exports, __webpack_require__) {
  2582. "use strict";
  2583. Object.defineProperty(exports, "__esModule", {
  2584. value: true
  2585. });
  2586. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2587. /**
  2588. * This class represents all the language defined functions.
  2589. * The language processor uses the id provided here to properly execute the desired function.
  2590. * The function is actually implemented inside the language processor.
  2591. * All the functions can be found at: js/processor/definedFunctions.js
  2592. */
  2593. var SysCall = exports.SysCall = function SysCall(langFunc) {
  2594. _classCallCheck(this, SysCall);
  2595. this.langFunc = langFunc;
  2596. };
  2597. /***/ }),
  2598. /***/ "./js/ast/commands/while.js":
  2599. /*!**********************************!*\
  2600. !*** ./js/ast/commands/while.js ***!
  2601. \**********************************/
  2602. /*! no static exports found */
  2603. /***/ (function(module, exports, __webpack_require__) {
  2604. "use strict";
  2605. Object.defineProperty(exports, "__esModule", {
  2606. value: true
  2607. });
  2608. exports.While = undefined;
  2609. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2610. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  2611. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2612. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2613. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2614. var While = exports.While = function (_Command) {
  2615. _inherits(While, _Command);
  2616. function While(expression, commandBlock) {
  2617. _classCallCheck(this, While);
  2618. var _this = _possibleConstructorReturn(this, (While.__proto__ || Object.getPrototypeOf(While)).call(this));
  2619. _this.expression = expression;
  2620. _this.commandBlock = commandBlock;
  2621. return _this;
  2622. }
  2623. _createClass(While, [{
  2624. key: 'commands',
  2625. get: function get() {
  2626. return this.commandBlock.commands;
  2627. }
  2628. }, {
  2629. key: 'testFirst',
  2630. get: function get() {
  2631. return true;
  2632. }
  2633. }]);
  2634. return While;
  2635. }(_command.Command);
  2636. /***/ }),
  2637. /***/ "./js/ast/error/syntaxError.js":
  2638. /*!*************************************!*\
  2639. !*** ./js/ast/error/syntaxError.js ***!
  2640. \*************************************/
  2641. /*! no static exports found */
  2642. /***/ (function(module, exports, __webpack_require__) {
  2643. "use strict";
  2644. Object.defineProperty(exports, "__esModule", {
  2645. value: true
  2646. });
  2647. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2648. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2649. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2650. var SyntaxError = exports.SyntaxError = function (_Error) {
  2651. _inherits(SyntaxError, _Error);
  2652. function SyntaxError() {
  2653. var _ref;
  2654. _classCallCheck(this, SyntaxError);
  2655. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  2656. msg[_key] = arguments[_key];
  2657. }
  2658. var _this = _possibleConstructorReturn(this, (_ref = SyntaxError.__proto__ || Object.getPrototypeOf(SyntaxError)).call.apply(_ref, [this].concat(msg)));
  2659. if (Error.captureStackTrace) Error.captureStackTrace(_this, SyntaxError);
  2660. return _this;
  2661. }
  2662. return SyntaxError;
  2663. }(Error);
  2664. /***/ }),
  2665. /***/ "./js/ast/error/syntaxErrorFactory.js":
  2666. /*!********************************************!*\
  2667. !*** ./js/ast/error/syntaxErrorFactory.js ***!
  2668. \********************************************/
  2669. /*! no static exports found */
  2670. /***/ (function(module, exports, __webpack_require__) {
  2671. "use strict";
  2672. Object.defineProperty(exports, "__esModule", {
  2673. value: true
  2674. });
  2675. exports.SyntaxErrorFactory = undefined;
  2676. var _localizedStringsService = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  2677. var _syntaxError = __webpack_require__(/*! ./syntaxError */ "./js/ast/error/syntaxError.js");
  2678. var SyntaxErrorFactory = exports.SyntaxErrorFactory = Object.freeze({
  2679. extra_lines: function extra_lines() {
  2680. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("extra_lines"));
  2681. },
  2682. token_missing_one: function token_missing_one(expected, token) {
  2683. var context = [expected, token.text, token.line, token.column];
  2684. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("token_missing_one", context));
  2685. },
  2686. token_missing_list: function token_missing_list(expectedList, token) {
  2687. var line = expectedList.join(_localizedStringsService.LocalizedStrings.getOR());
  2688. return SyntaxErrorFactory.token_missing_one(line, token);
  2689. },
  2690. id_missing: function id_missing(token) {
  2691. var context = [token.text, token.line, token.column];
  2692. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("id_missing", context));
  2693. },
  2694. eos_missing: function eos_missing(token) {
  2695. var context = [token.line, token.column];
  2696. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("eos_missing", context));
  2697. },
  2698. invalid_array_dimension: function invalid_array_dimension(typeName, token) {
  2699. var context = [token.line, token.column, typeName];
  2700. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_array_dimension", context));
  2701. },
  2702. invalid_array_size: function invalid_array_size(token) {
  2703. var context = [token.line];
  2704. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_array_size", context));
  2705. },
  2706. invalid_main_return: function invalid_main_return(name, typeName, token) {
  2707. var context = [name, typeName, token.line];
  2708. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_main_return", context));
  2709. },
  2710. invalid_var_declaration: function invalid_var_declaration(token) {
  2711. var context = [token.line];
  2712. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_var_declaration", context));
  2713. },
  2714. invalid_break_command: function invalid_break_command(cmdName, token) {
  2715. var context = [token.line, cmdName];
  2716. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_break_command", context));
  2717. },
  2718. invalid_terminal: function invalid_terminal() {
  2719. var context = [token.text, token.line, token.column];
  2720. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError('invalid_terminal', context));
  2721. },
  2722. invalid_type: function invalid_type(list, token) {
  2723. var line = list.join(_localizedStringsService.LocalizedStrings.getOR());
  2724. var context = [token.text, token.line, token.column, line];
  2725. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_type", context));
  2726. },
  2727. const_not_init: function const_not_init(token) {
  2728. var context = [token.line, token.column];
  2729. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("const_not_init", context));
  2730. },
  2731. invalid_id_format: function invalid_id_format(token) {
  2732. var context = [token.text, token.line, token.column];
  2733. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_id_format", context));
  2734. }
  2735. });
  2736. /***/ }),
  2737. /***/ "./js/ast/expressions/arrayAccess.js":
  2738. /*!*******************************************!*\
  2739. !*** ./js/ast/expressions/arrayAccess.js ***!
  2740. \*******************************************/
  2741. /*! no static exports found */
  2742. /***/ (function(module, exports, __webpack_require__) {
  2743. "use strict";
  2744. Object.defineProperty(exports, "__esModule", {
  2745. value: true
  2746. });
  2747. exports.ArrayAccess = undefined;
  2748. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  2749. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2750. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2751. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2752. var ArrayAccess = exports.ArrayAccess = function (_Expression) {
  2753. _inherits(ArrayAccess, _Expression);
  2754. function ArrayAccess(id, line, column) {
  2755. _classCallCheck(this, ArrayAccess);
  2756. var _this = _possibleConstructorReturn(this, (ArrayAccess.__proto__ || Object.getPrototypeOf(ArrayAccess)).call(this));
  2757. _this.id = id;
  2758. _this.line = line;
  2759. _this.column = column;
  2760. return _this;
  2761. }
  2762. return ArrayAccess;
  2763. }(_expression.Expression);
  2764. /***/ }),
  2765. /***/ "./js/ast/expressions/arrayLiteral.js":
  2766. /*!********************************************!*\
  2767. !*** ./js/ast/expressions/arrayLiteral.js ***!
  2768. \********************************************/
  2769. /*! no static exports found */
  2770. /***/ (function(module, exports, __webpack_require__) {
  2771. "use strict";
  2772. Object.defineProperty(exports, "__esModule", {
  2773. value: true
  2774. });
  2775. exports.ArrayLiteral = undefined;
  2776. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2777. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  2778. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2779. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2780. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2781. var ArrayLiteral = exports.ArrayLiteral = function (_Literal) {
  2782. _inherits(ArrayLiteral, _Literal);
  2783. function ArrayLiteral(type, value) {
  2784. _classCallCheck(this, ArrayLiteral);
  2785. var _this = _possibleConstructorReturn(this, (ArrayLiteral.__proto__ || Object.getPrototypeOf(ArrayLiteral)).call(this, type));
  2786. _this.value = value;
  2787. return _this;
  2788. }
  2789. _createClass(ArrayLiteral, [{
  2790. key: 'validateType',
  2791. value: function validateType() {
  2792. // let valid = true;
  2793. // if(this.columns !== null) {
  2794. // const len = this.columns;
  2795. // const len2 = this.lines;
  2796. // for (let i = len - 1; i >= 0; i--) {
  2797. // for (let j = len2 - 1; j >= 0; j--) {
  2798. // if(this.value[i].value[j].type !== this.subtype) {
  2799. // valid = false;
  2800. // break;
  2801. // }
  2802. // }
  2803. // }
  2804. // } else {
  2805. // const len = this.lines;
  2806. // for (var i = len - 1; i >= 0; i--) {
  2807. // if(this.value[i].type !== this.subtype) {
  2808. // valid = false;
  2809. // break;
  2810. // }
  2811. // }
  2812. // }
  2813. return true; //valid;
  2814. }
  2815. }, {
  2816. key: 'validateSize',
  2817. value: function validateSize() {
  2818. var valid = true;
  2819. if (this.columns !== null) {
  2820. var equalityTest = data.value.map(function (v) {
  2821. return v.length;
  2822. }).reduce(function (old, next) {
  2823. if (old === null) {
  2824. return next;
  2825. } else if (old === next) {
  2826. return old;
  2827. } else {
  2828. return -1;
  2829. }
  2830. }, null);
  2831. valid = equalityTest !== -1;
  2832. }
  2833. return valid;
  2834. }
  2835. }, {
  2836. key: 'subtype',
  2837. get: function get() {
  2838. var element = this.value[0];
  2839. if (element instanceof ArrayLiteral) {
  2840. return element.value[0].type;
  2841. } else {
  2842. return element.type;
  2843. }
  2844. }
  2845. }, {
  2846. key: 'lines',
  2847. get: function get() {
  2848. return this.value.length;
  2849. }
  2850. }, {
  2851. key: 'columns',
  2852. get: function get() {
  2853. var element = this.value[0];
  2854. if (!(element instanceof ArrayLiteral)) {
  2855. return null;
  2856. } else {
  2857. return element.value[0].value.length;
  2858. }
  2859. }
  2860. }, {
  2861. key: 'isVector',
  2862. get: function get() {
  2863. return this.columns === null;
  2864. }
  2865. }, {
  2866. key: 'isValid',
  2867. get: function get() {
  2868. return true; //this.validateType() && this.validateSize();
  2869. }
  2870. }]);
  2871. return ArrayLiteral;
  2872. }(_literal.Literal);
  2873. /***/ }),
  2874. /***/ "./js/ast/expressions/boolLiteral.js":
  2875. /*!*******************************************!*\
  2876. !*** ./js/ast/expressions/boolLiteral.js ***!
  2877. \*******************************************/
  2878. /*! no static exports found */
  2879. /***/ (function(module, exports, __webpack_require__) {
  2880. "use strict";
  2881. Object.defineProperty(exports, "__esModule", {
  2882. value: true
  2883. });
  2884. exports.BoolLiteral = undefined;
  2885. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  2886. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  2887. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2888. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2889. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2890. var BoolLiteral = exports.BoolLiteral = function (_Literal) {
  2891. _inherits(BoolLiteral, _Literal);
  2892. function BoolLiteral(value) {
  2893. _classCallCheck(this, BoolLiteral);
  2894. var _this = _possibleConstructorReturn(this, (BoolLiteral.__proto__ || Object.getPrototypeOf(BoolLiteral)).call(this, _types.Types.BOOLEAN));
  2895. _this.value = value;
  2896. return _this;
  2897. }
  2898. return BoolLiteral;
  2899. }(_literal.Literal);
  2900. /***/ }),
  2901. /***/ "./js/ast/expressions/expression.js":
  2902. /*!******************************************!*\
  2903. !*** ./js/ast/expressions/expression.js ***!
  2904. \******************************************/
  2905. /*! no static exports found */
  2906. /***/ (function(module, exports, __webpack_require__) {
  2907. "use strict";
  2908. Object.defineProperty(exports, "__esModule", {
  2909. value: true
  2910. });
  2911. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2912. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2913. var Expression = exports.Expression = function () {
  2914. function Expression() {
  2915. _classCallCheck(this, Expression);
  2916. this._sourceInfo = null;
  2917. }
  2918. _createClass(Expression, [{
  2919. key: "sourceInfo",
  2920. set: function set(sourceInfo) {
  2921. this._sourceInfo = sourceInfo;
  2922. },
  2923. get: function get() {
  2924. return this._sourceInfo;
  2925. }
  2926. }]);
  2927. return Expression;
  2928. }();
  2929. /***/ }),
  2930. /***/ "./js/ast/expressions/functionCall.js":
  2931. /*!********************************************!*\
  2932. !*** ./js/ast/expressions/functionCall.js ***!
  2933. \********************************************/
  2934. /*! no static exports found */
  2935. /***/ (function(module, exports, __webpack_require__) {
  2936. "use strict";
  2937. Object.defineProperty(exports, "__esModule", {
  2938. value: true
  2939. });
  2940. exports.FunctionCall = undefined;
  2941. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2942. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  2943. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2944. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2945. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2946. var FunctionCall = exports.FunctionCall = function (_Expression) {
  2947. _inherits(FunctionCall, _Expression);
  2948. function FunctionCall(id, actualParameters) {
  2949. _classCallCheck(this, FunctionCall);
  2950. var _this = _possibleConstructorReturn(this, (FunctionCall.__proto__ || Object.getPrototypeOf(FunctionCall)).call(this));
  2951. _this.id = id;
  2952. _this.actualParameters = actualParameters;
  2953. return _this;
  2954. }
  2955. _createClass(FunctionCall, [{
  2956. key: 'parametersSize',
  2957. get: function get() {
  2958. return this.actualParameters.length;
  2959. }
  2960. }]);
  2961. return FunctionCall;
  2962. }(_expression.Expression);
  2963. /***/ }),
  2964. /***/ "./js/ast/expressions/index.js":
  2965. /*!*************************************!*\
  2966. !*** ./js/ast/expressions/index.js ***!
  2967. \*************************************/
  2968. /*! no static exports found */
  2969. /***/ (function(module, exports, __webpack_require__) {
  2970. "use strict";
  2971. Object.defineProperty(exports, "__esModule", {
  2972. value: true
  2973. });
  2974. exports.UnaryApp = exports.InfixApp = exports.VariableLiteral = exports.ArrayLiteral = exports.StringLiteral = exports.BoolLiteral = exports.RealLiteral = exports.IntLiteral = exports.FunctionCall = exports.ArrayAccess = undefined;
  2975. var _arrayAccess = __webpack_require__(/*! ./arrayAccess */ "./js/ast/expressions/arrayAccess.js");
  2976. var _functionCall = __webpack_require__(/*! ./functionCall */ "./js/ast/expressions/functionCall.js");
  2977. var _intLiteral = __webpack_require__(/*! ./intLiteral */ "./js/ast/expressions/intLiteral.js");
  2978. var _realLiteral = __webpack_require__(/*! ./realLiteral */ "./js/ast/expressions/realLiteral.js");
  2979. var _boolLiteral = __webpack_require__(/*! ./boolLiteral */ "./js/ast/expressions/boolLiteral.js");
  2980. var _stringLiteral = __webpack_require__(/*! ./stringLiteral */ "./js/ast/expressions/stringLiteral.js");
  2981. var _arrayLiteral = __webpack_require__(/*! ./arrayLiteral */ "./js/ast/expressions/arrayLiteral.js");
  2982. var _variableLiteral = __webpack_require__(/*! ./variableLiteral */ "./js/ast/expressions/variableLiteral.js");
  2983. var _infixApp = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  2984. var _unaryApp = __webpack_require__(/*! ./unaryApp */ "./js/ast/expressions/unaryApp.js");
  2985. exports.ArrayAccess = _arrayAccess.ArrayAccess;
  2986. exports.FunctionCall = _functionCall.FunctionCall;
  2987. exports.IntLiteral = _intLiteral.IntLiteral;
  2988. exports.RealLiteral = _realLiteral.RealLiteral;
  2989. exports.BoolLiteral = _boolLiteral.BoolLiteral;
  2990. exports.StringLiteral = _stringLiteral.StringLiteral;
  2991. exports.ArrayLiteral = _arrayLiteral.ArrayLiteral;
  2992. exports.VariableLiteral = _variableLiteral.VariableLiteral;
  2993. exports.InfixApp = _infixApp.InfixApp;
  2994. exports.UnaryApp = _unaryApp.UnaryApp;
  2995. /***/ }),
  2996. /***/ "./js/ast/expressions/infixApp.js":
  2997. /*!****************************************!*\
  2998. !*** ./js/ast/expressions/infixApp.js ***!
  2999. \****************************************/
  3000. /*! no static exports found */
  3001. /***/ (function(module, exports, __webpack_require__) {
  3002. "use strict";
  3003. Object.defineProperty(exports, "__esModule", {
  3004. value: true
  3005. });
  3006. exports.InfixApp = undefined;
  3007. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  3008. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3009. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3010. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3011. var InfixApp = exports.InfixApp = function (_Expression) {
  3012. _inherits(InfixApp, _Expression);
  3013. function InfixApp(op, left, right) {
  3014. _classCallCheck(this, InfixApp);
  3015. var _this = _possibleConstructorReturn(this, (InfixApp.__proto__ || Object.getPrototypeOf(InfixApp)).call(this));
  3016. _this.op = op;
  3017. _this.left = left;
  3018. _this.right = right;
  3019. return _this;
  3020. }
  3021. return InfixApp;
  3022. }(_expression.Expression);
  3023. /***/ }),
  3024. /***/ "./js/ast/expressions/intLiteral.js":
  3025. /*!******************************************!*\
  3026. !*** ./js/ast/expressions/intLiteral.js ***!
  3027. \******************************************/
  3028. /*! no static exports found */
  3029. /***/ (function(module, exports, __webpack_require__) {
  3030. "use strict";
  3031. Object.defineProperty(exports, "__esModule", {
  3032. value: true
  3033. });
  3034. exports.IntLiteral = undefined;
  3035. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  3036. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  3037. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3038. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3039. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3040. var IntLiteral = exports.IntLiteral = function (_Literal) {
  3041. _inherits(IntLiteral, _Literal);
  3042. function IntLiteral(value) {
  3043. _classCallCheck(this, IntLiteral);
  3044. var _this = _possibleConstructorReturn(this, (IntLiteral.__proto__ || Object.getPrototypeOf(IntLiteral)).call(this, _types.Types.INTEGER));
  3045. _this.value = value;
  3046. return _this;
  3047. }
  3048. return IntLiteral;
  3049. }(_literal.Literal);
  3050. /***/ }),
  3051. /***/ "./js/ast/expressions/literal.js":
  3052. /*!***************************************!*\
  3053. !*** ./js/ast/expressions/literal.js ***!
  3054. \***************************************/
  3055. /*! no static exports found */
  3056. /***/ (function(module, exports, __webpack_require__) {
  3057. "use strict";
  3058. Object.defineProperty(exports, "__esModule", {
  3059. value: true
  3060. });
  3061. exports.Literal = undefined;
  3062. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  3063. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3064. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3065. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3066. var Literal = exports.Literal = function (_Expression) {
  3067. _inherits(Literal, _Expression);
  3068. function Literal(type) {
  3069. _classCallCheck(this, Literal);
  3070. var _this = _possibleConstructorReturn(this, (Literal.__proto__ || Object.getPrototypeOf(Literal)).call(this));
  3071. _this.type = type;
  3072. return _this;
  3073. }
  3074. return Literal;
  3075. }(_expression.Expression);
  3076. /***/ }),
  3077. /***/ "./js/ast/expressions/realLiteral.js":
  3078. /*!*******************************************!*\
  3079. !*** ./js/ast/expressions/realLiteral.js ***!
  3080. \*******************************************/
  3081. /*! no static exports found */
  3082. /***/ (function(module, exports, __webpack_require__) {
  3083. "use strict";
  3084. Object.defineProperty(exports, "__esModule", {
  3085. value: true
  3086. });
  3087. exports.RealLiteral = undefined;
  3088. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  3089. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  3090. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3091. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3092. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3093. var RealLiteral = exports.RealLiteral = function (_Literal) {
  3094. _inherits(RealLiteral, _Literal);
  3095. function RealLiteral(value) {
  3096. _classCallCheck(this, RealLiteral);
  3097. var _this = _possibleConstructorReturn(this, (RealLiteral.__proto__ || Object.getPrototypeOf(RealLiteral)).call(this, _types.Types.REAL));
  3098. _this.value = value;
  3099. return _this;
  3100. }
  3101. return RealLiteral;
  3102. }(_literal.Literal);
  3103. /***/ }),
  3104. /***/ "./js/ast/expressions/stringLiteral.js":
  3105. /*!*********************************************!*\
  3106. !*** ./js/ast/expressions/stringLiteral.js ***!
  3107. \*********************************************/
  3108. /*! no static exports found */
  3109. /***/ (function(module, exports, __webpack_require__) {
  3110. "use strict";
  3111. Object.defineProperty(exports, "__esModule", {
  3112. value: true
  3113. });
  3114. exports.StringLiteral = undefined;
  3115. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  3116. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  3117. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3118. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3119. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3120. var StringLiteral = exports.StringLiteral = function (_Literal) {
  3121. _inherits(StringLiteral, _Literal);
  3122. function StringLiteral(value) {
  3123. _classCallCheck(this, StringLiteral);
  3124. var _this = _possibleConstructorReturn(this, (StringLiteral.__proto__ || Object.getPrototypeOf(StringLiteral)).call(this, _types.Types.STRING));
  3125. _this.value = value;
  3126. return _this;
  3127. }
  3128. return StringLiteral;
  3129. }(_literal.Literal);
  3130. /***/ }),
  3131. /***/ "./js/ast/expressions/unaryApp.js":
  3132. /*!****************************************!*\
  3133. !*** ./js/ast/expressions/unaryApp.js ***!
  3134. \****************************************/
  3135. /*! no static exports found */
  3136. /***/ (function(module, exports, __webpack_require__) {
  3137. "use strict";
  3138. Object.defineProperty(exports, "__esModule", {
  3139. value: true
  3140. });
  3141. exports.UnaryApp = undefined;
  3142. var _infixApp = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  3143. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3144. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3145. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3146. var UnaryApp = exports.UnaryApp = function (_InfixApp) {
  3147. _inherits(UnaryApp, _InfixApp);
  3148. function UnaryApp(op, left) {
  3149. _classCallCheck(this, UnaryApp);
  3150. return _possibleConstructorReturn(this, (UnaryApp.__proto__ || Object.getPrototypeOf(UnaryApp)).call(this, op, left, null));
  3151. }
  3152. return UnaryApp;
  3153. }(_infixApp.InfixApp);
  3154. /***/ }),
  3155. /***/ "./js/ast/expressions/variableLiteral.js":
  3156. /*!***********************************************!*\
  3157. !*** ./js/ast/expressions/variableLiteral.js ***!
  3158. \***********************************************/
  3159. /*! no static exports found */
  3160. /***/ (function(module, exports, __webpack_require__) {
  3161. "use strict";
  3162. Object.defineProperty(exports, "__esModule", {
  3163. value: true
  3164. });
  3165. exports.VariableLiteral = undefined;
  3166. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  3167. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  3168. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3169. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3170. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3171. var VariableLiteral = exports.VariableLiteral = function (_Literal) {
  3172. _inherits(VariableLiteral, _Literal);
  3173. function VariableLiteral(id) {
  3174. _classCallCheck(this, VariableLiteral);
  3175. var _this = _possibleConstructorReturn(this, (VariableLiteral.__proto__ || Object.getPrototypeOf(VariableLiteral)).call(this, _types.Types.UNDEFINED));
  3176. _this.id = id;
  3177. return _this;
  3178. }
  3179. return VariableLiteral;
  3180. }(_literal.Literal);
  3181. /***/ }),
  3182. /***/ "./js/ast/ivprogParser.js":
  3183. /*!********************************!*\
  3184. !*** ./js/ast/ivprogParser.js ***!
  3185. \********************************/
  3186. /*! no static exports found */
  3187. /***/ (function(module, exports, __webpack_require__) {
  3188. "use strict";
  3189. Object.defineProperty(exports, "__esModule", {
  3190. value: true
  3191. });
  3192. exports.IVProgParser = undefined;
  3193. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3194. var _index = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  3195. var _expressions = __webpack_require__(/*! ./expressions/ */ "./js/ast/expressions/index.js");
  3196. var Expressions = _interopRequireWildcard(_expressions);
  3197. var _commands = __webpack_require__(/*! ./commands/ */ "./js/ast/commands/index.js");
  3198. var Commands = _interopRequireWildcard(_commands);
  3199. var _parsers = __webpack_require__(/*! ./../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  3200. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  3201. var _compoundType = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  3202. var _sourceInfo2 = __webpack_require__(/*! ./sourceInfo */ "./js/ast/sourceInfo.js");
  3203. var _operators = __webpack_require__(/*! ./operators */ "./js/ast/operators.js");
  3204. var _syntaxErrorFactory = __webpack_require__(/*! ./error/syntaxErrorFactory */ "./js/ast/error/syntaxErrorFactory.js");
  3205. var _definedFunctions = __webpack_require__(/*! ./../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  3206. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  3207. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  3208. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3209. var IVProgParser = exports.IVProgParser = function () {
  3210. _createClass(IVProgParser, null, [{
  3211. key: 'createParser',
  3212. value: function createParser(input) {
  3213. var lexerClass = _languageService.LanguageService.getCurrentLexer();
  3214. return new IVProgParser(input, lexerClass);
  3215. }
  3216. // <BEGIN scope consts>
  3217. }, {
  3218. key: 'BASE',
  3219. get: function get() {
  3220. return 0;
  3221. }
  3222. }, {
  3223. key: 'FUNCTION',
  3224. get: function get() {
  3225. return 1;
  3226. }
  3227. }, {
  3228. key: 'COMMAND',
  3229. get: function get() {
  3230. return 2;
  3231. }
  3232. }, {
  3233. key: 'BREAKABLE',
  3234. get: function get() {
  3235. return 4;
  3236. }
  3237. // </ END scope consts>
  3238. }]);
  3239. function IVProgParser(input, lexerClass) {
  3240. _classCallCheck(this, IVProgParser);
  3241. this.lexerClass = lexerClass;
  3242. this.lexer = new lexerClass(new _index.InputStream(input));
  3243. this.tokenStream = new _index.CommonTokenStream(this.lexer);
  3244. this.tokenStream.fill();
  3245. this.pos = 1;
  3246. this.variableTypes = [this.lexerClass.RK_INTEGER, this.lexerClass.RK_REAL, this.lexerClass.RK_BOOLEAN, this.lexerClass.RK_STRING];
  3247. this.functionTypes = this.variableTypes.concat(this.lexerClass.RK_VOID);
  3248. this.parsingArrayDimension = 0;
  3249. this.scope = [];
  3250. this.langFuncs = _languageService.LanguageService.getCurrentLangFuncs();
  3251. }
  3252. _createClass(IVProgParser, [{
  3253. key: 'parseTree',
  3254. value: function parseTree() {
  3255. return this.parseProgram();
  3256. }
  3257. }, {
  3258. key: 'getToken',
  3259. value: function getToken() {
  3260. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.pos;
  3261. // if(index === null)
  3262. // index = this.pos;
  3263. return this.tokenStream.LT(index);
  3264. }
  3265. }, {
  3266. key: 'insideScope',
  3267. value: function insideScope(scope) {
  3268. if (this.scope.length <= 0) {
  3269. return IVProgParser.BASE === scope;
  3270. } else {
  3271. return this.scope[this.scope.length - 1] === scope;
  3272. }
  3273. }
  3274. }, {
  3275. key: 'pushScope',
  3276. value: function pushScope(scope) {
  3277. this.scope.push(scope);
  3278. }
  3279. }, {
  3280. key: 'popScope',
  3281. value: function popScope() {
  3282. return this.scope.pop();
  3283. }
  3284. }, {
  3285. key: 'isEOF',
  3286. value: function isEOF() {
  3287. this.getToken(this.pos);
  3288. return this.tokenStream.fetchedEOF;
  3289. }
  3290. }, {
  3291. key: 'parseProgram',
  3292. value: function parseProgram() {
  3293. var token = this.getToken();
  3294. var globalVars = [];
  3295. var functions = [];
  3296. if (this.lexerClass.RK_PROGRAM === token.type) {
  3297. this.pos++;
  3298. this.consumeNewLines();
  3299. this.checkOpenCurly();
  3300. this.pos++;
  3301. while (true) {
  3302. this.consumeNewLines();
  3303. var _token = this.getToken();
  3304. if (_token.type === this.lexerClass.RK_CONST || this.isVariableType(_token)) {
  3305. globalVars = globalVars.concat(this.parseGlobalVariables());
  3306. } else if (_token.type === this.lexerClass.RK_FUNCTION) {
  3307. functions = functions.concat(this.parseFunction());
  3308. } else {
  3309. break;
  3310. }
  3311. }
  3312. this.consumeNewLines();
  3313. this.checkCloseCurly();
  3314. this.pos++;
  3315. this.consumeNewLines();
  3316. if (!this.isEOF()) {
  3317. throw _syntaxErrorFactory.SyntaxErrorFactory.extra_lines();
  3318. }
  3319. return { global: globalVars, functions: functions };
  3320. } else {
  3321. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_PROGRAM], token);
  3322. }
  3323. }
  3324. }, {
  3325. key: 'checkOpenCurly',
  3326. value: function checkOpenCurly() {
  3327. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  3328. var token = this.getToken();
  3329. if (this.lexerClass.OPEN_CURLY !== token.type) {
  3330. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('{', token);else return false;
  3331. }
  3332. return true;
  3333. }
  3334. }, {
  3335. key: 'checkCloseCurly',
  3336. value: function checkCloseCurly() {
  3337. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  3338. var token = this.getToken();
  3339. if (this.lexerClass.CLOSE_CURLY !== token.type) {
  3340. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('}', token);else return false;
  3341. }
  3342. return true;
  3343. }
  3344. /* It checks if the current token at position pos is a ']'.
  3345. * As a check function it doesn't increment pos.
  3346. *
  3347. * @params bool:attempt, indicates that the token is optional. Defaults: false
  3348. *
  3349. * @returns true if the attempt is true and current token is '[',
  3350. * false is attempt is true and current token is not '['
  3351. **/
  3352. }, {
  3353. key: 'checkOpenBrace',
  3354. value: function checkOpenBrace() {
  3355. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  3356. var token = this.getToken();
  3357. if (this.lexerClass.OPEN_BRACE !== token.type) {
  3358. if (!attempt) {
  3359. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('[', token);
  3360. } else {
  3361. return false;
  3362. }
  3363. }
  3364. return true;
  3365. }
  3366. }, {
  3367. key: 'checkCloseBrace',
  3368. value: function checkCloseBrace() {
  3369. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  3370. var token = this.getToken();
  3371. if (this.lexerClass.CLOSE_BRACE !== token.type) {
  3372. if (!attempt) {
  3373. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(']', token);
  3374. } else {
  3375. return false;
  3376. }
  3377. }
  3378. return true;
  3379. }
  3380. }, {
  3381. key: 'checkOpenParenthesis',
  3382. value: function checkOpenParenthesis() {
  3383. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  3384. var token = this.getToken();
  3385. if (this.lexerClass.OPEN_PARENTHESIS !== token.type) {
  3386. if (!attempt) {
  3387. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('(', token);
  3388. } else {
  3389. return false;
  3390. }
  3391. }
  3392. return true;
  3393. }
  3394. }, {
  3395. key: 'checkCloseParenthesis',
  3396. value: function checkCloseParenthesis() {
  3397. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  3398. var token = this.getToken();
  3399. if (this.lexerClass.CLOSE_PARENTHESIS !== token.type) {
  3400. if (!attempt) {
  3401. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(')', token);
  3402. } else {
  3403. return false;
  3404. }
  3405. }
  3406. return true;
  3407. }
  3408. }, {
  3409. key: 'checkEOS',
  3410. value: function checkEOS() {
  3411. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  3412. var eosToken = this.getToken();
  3413. if (eosToken.type !== this.lexerClass.EOS) {
  3414. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.eos_missing(eosToken);else return false;
  3415. }
  3416. return true;
  3417. }
  3418. }, {
  3419. key: 'consumeForSemiColon',
  3420. value: function consumeForSemiColon() {
  3421. var eosToken = this.getToken();
  3422. if (eosToken.type === this.lexerClass.EOS && eosToken.text.match(';')) {
  3423. this.pos++;
  3424. return;
  3425. }
  3426. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(';', eosToken);
  3427. }
  3428. }, {
  3429. key: 'parseGlobalVariables',
  3430. value: function parseGlobalVariables() {
  3431. var decl = this.parseMaybeConst();
  3432. this.checkEOS();
  3433. this.pos++;
  3434. return decl;
  3435. }
  3436. /*
  3437. * Checks if the next token is PR_CONST. It's only available
  3438. * at global variables declaration level
  3439. * @returns Declararion(const, type, id, initVal?)
  3440. **/
  3441. }, {
  3442. key: 'parseMaybeConst',
  3443. value: function parseMaybeConst() {
  3444. var constToken = this.getToken();
  3445. if (constToken.type === this.lexerClass.RK_CONST) {
  3446. this.pos++;
  3447. var typeString = this.parseType();
  3448. return this.parseDeclaration(typeString, true);
  3449. } else if (this.isVariableType(constToken)) {
  3450. var _typeString = this.parseType();
  3451. return this.parseDeclaration(_typeString);
  3452. } else {
  3453. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list([this.lexer.literalNames[this.lexerClass.RK_CONST]].concat(this.getTypeArray()), constToken);
  3454. }
  3455. }
  3456. /*
  3457. * Parses a declarion of the form: type --- id --- (= --- EAnd)?
  3458. * @returns a list of Declararion(const, type, id, initVal?)
  3459. **/
  3460. }, {
  3461. key: 'parseDeclaration',
  3462. value: function parseDeclaration(typeString) {
  3463. var isConst = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  3464. var initial = null;
  3465. var dim1 = null;
  3466. var dim2 = null;
  3467. var idToken = this.getToken();
  3468. var idString = this.parseID();
  3469. // Check for array or vector
  3470. // ID[int/IDi][int/IDj]
  3471. if (this.checkOpenBrace(true)) {
  3472. this.pos++;
  3473. this.consumeNewLines();
  3474. dim1 = this.parseArrayDimension();
  3475. this.consumeNewLines();
  3476. this.checkCloseBrace();
  3477. this.pos++;
  3478. if (this.checkOpenBrace(true)) {
  3479. this.pos++;
  3480. this.consumeNewLines();
  3481. dim2 = this.parseArrayDimension();
  3482. this.consumeNewLines();
  3483. this.checkCloseBrace();
  3484. this.pos++;
  3485. }
  3486. }
  3487. var equalsToken = this.getToken();
  3488. if (isConst && equalsToken.type !== this.lexerClass.EQUAL) {
  3489. throw _syntaxErrorFactory.SyntaxErrorFactory.const_not_init(idToken);
  3490. }
  3491. if (equalsToken.type === this.lexerClass.EQUAL) {
  3492. this.pos++;
  3493. initial = this.parseExpressionOR();
  3494. }
  3495. var declaration = null;
  3496. var dimensions = 0;
  3497. if (dim1 !== null) {
  3498. dimensions++;
  3499. if (dim2 !== null) {
  3500. dimensions++;
  3501. }
  3502. declaration = new Commands.ArrayDeclaration(idString, new _compoundType.CompoundType(typeString, dimensions), dim1, dim2, initial, isConst);
  3503. } else {
  3504. declaration = new Commands.Declaration(idString, typeString, initial, isConst);
  3505. }
  3506. declaration.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(idToken);
  3507. var commaToken = this.getToken();
  3508. if (commaToken.type === this.lexerClass.COMMA) {
  3509. this.pos++;
  3510. this.consumeNewLines();
  3511. return [declaration].concat(this.parseDeclaration(typeString, isConst));
  3512. } else {
  3513. return [declaration];
  3514. }
  3515. }
  3516. }, {
  3517. key: 'consumeNewLines',
  3518. value: function consumeNewLines() {
  3519. var token = this.getToken();
  3520. while (token.type === this.lexerClass.EOS && token.text.match('[\r\n]+')) {
  3521. this.pos++;
  3522. token = this.getToken();
  3523. }
  3524. }
  3525. }, {
  3526. key: 'isVariableType',
  3527. value: function isVariableType(token) {
  3528. return this.variableTypes.find(function (v) {
  3529. return v === token.type;
  3530. });
  3531. }
  3532. /*
  3533. * Reads the next token of the stream to check if it is a Integer or an ID.
  3534. * @returns Integer | ID
  3535. **/
  3536. }, {
  3537. key: 'parseArrayDimension',
  3538. value: function parseArrayDimension() {
  3539. var dimToken = this.getToken();
  3540. if (dimToken.type === this.lexerClass.INTEGER) {
  3541. //parse as int literal
  3542. this.pos++;
  3543. return this.getIntLiteral(dimToken);
  3544. } else if (dimToken.type === this.lexerClass.ID) {
  3545. //parse as variable
  3546. this.pos++;
  3547. return this.parseVariable(dimToken);
  3548. } else {
  3549. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_array_dimension(this.lexer.literalNames[this.lexerClass.RK_INTEGER], dimToken);
  3550. }
  3551. }
  3552. /*
  3553. * Returns an object {type: 'int', value: value}.
  3554. * It checks for binary and hexadecimal integers.
  3555. * @returns object with fields type and value
  3556. **/
  3557. }, {
  3558. key: 'getIntLiteral',
  3559. value: function getIntLiteral(token) {
  3560. var text = token.text;
  3561. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  3562. var exp = new Expressions.IntLiteral((0, _parsers.toInt)(text));
  3563. exp.sourceInfo = sourceInfo;
  3564. return exp;
  3565. }
  3566. }, {
  3567. key: 'getRealLiteral',
  3568. value: function getRealLiteral(token) {
  3569. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  3570. var exp = new Expressions.RealLiteral((0, _parsers.toReal)(token.text));
  3571. exp.sourceInfo = sourceInfo;
  3572. return exp;
  3573. }
  3574. }, {
  3575. key: 'getStringLiteral',
  3576. value: function getStringLiteral(token) {
  3577. var text = token.text;
  3578. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  3579. var exp = new Expressions.StringLiteral((0, _parsers.toString)(text));
  3580. exp.sourceInfo = sourceInfo;
  3581. return exp;
  3582. }
  3583. }, {
  3584. key: 'getBoolLiteral',
  3585. value: function getBoolLiteral(token) {
  3586. var val = (0, _parsers.toBool)(token.text);
  3587. var exp = new Expressions.BoolLiteral(val);
  3588. exp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);;
  3589. return exp;
  3590. }
  3591. }, {
  3592. key: 'parseArrayLiteral',
  3593. value: function parseArrayLiteral() {
  3594. this.checkOpenCurly();
  3595. var beginArray = this.getToken();
  3596. if (this.parsingArrayDimension >= 2) {
  3597. // TODO: better error message
  3598. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list('Array dimensions exceed maximum size of 2 at line ' + beginArray.line);
  3599. }
  3600. this.pos++;
  3601. this.parsingArrayDimension++;
  3602. this.consumeNewLines();
  3603. var data = this.parseExpressionList();
  3604. this.consumeNewLines();
  3605. this.checkCloseCurly();
  3606. var endArray = this.getToken();
  3607. this.pos++;
  3608. this.parsingArrayDimension--;
  3609. if (this.parsingArrayDimension === 0) {
  3610. // if (!data.isValid) {
  3611. // // TODO: better error message
  3612. // console.log('invalid array');
  3613. // throw new Error(`Invalid array at line ${beginArray.line}`);
  3614. // }
  3615. }
  3616. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(beginArray, endArray);
  3617. var dataDim = 1;
  3618. if (data[0] instanceof Expressions.ArrayLiteral) {
  3619. dataDim++;
  3620. }
  3621. var type = new _compoundType.CompoundType(_types.Types.UNDEFINED, dataDim);
  3622. var exp = new Expressions.ArrayLiteral(type, data);
  3623. exp.sourceInfo = sourceInfo;
  3624. return exp;
  3625. }
  3626. /*
  3627. * Returns an object {type: 'variable', value: value}.
  3628. * @returns object with fields type and value
  3629. **/
  3630. }, {
  3631. key: 'parseVariable',
  3632. value: function parseVariable(token) {
  3633. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  3634. var exp = new Expressions.VariableLiteral(token.text);
  3635. exp.sourceInfo = sourceInfo;
  3636. return exp;
  3637. }
  3638. /*
  3639. * Returns an object representing a function. It has
  3640. * four attributes: returnType, id, formalParams and block.
  3641. * The block object has two attributes: declarations and commands
  3642. **/
  3643. }, {
  3644. key: 'parseFunction',
  3645. value: function parseFunction() {
  3646. this.pushScope(IVProgParser.FUNCTION);
  3647. var formalParams = [];
  3648. var token = this.getToken();
  3649. if (token.type !== this.lexerClass.RK_FUNCTION) {
  3650. //throw SyntaxError.createError(this.lexer.literalNames[this.lexerClass.PR_FUNCAO], token);
  3651. return null;
  3652. }
  3653. this.pos++;
  3654. var funType = this.parseType();
  3655. var dimensions = 0;
  3656. if (this.checkOpenBrace(true)) {
  3657. this.pos++;
  3658. this.checkCloseBrace();
  3659. this.pos++;
  3660. dimensions++;
  3661. if (this.checkOpenBrace(true)) {
  3662. this.pos++;
  3663. this.checkCloseBrace();
  3664. this.pos++;
  3665. dimensions++;
  3666. }
  3667. }
  3668. var functionID = this.parseID();
  3669. this.checkOpenParenthesis();
  3670. this.pos++;
  3671. this.consumeNewLines();
  3672. if (!this.checkCloseParenthesis(true)) {
  3673. formalParams = this.parseFormalParameters(); // formal parameters
  3674. this.consumeNewLines();
  3675. this.checkCloseParenthesis();
  3676. this.pos++;
  3677. } else {
  3678. this.pos++;
  3679. }
  3680. this.consumeNewLines();
  3681. var commandsBlock = this.parseCommandBlock();
  3682. var returnType = funType;
  3683. if (dimensions > 0) {
  3684. returnType = new _compoundType.CompoundType(funType, dimensions);
  3685. }
  3686. var func = new Commands.Function(functionID, returnType, formalParams, commandsBlock);
  3687. if (functionID === null && !func.isMain) {
  3688. // TODO: better error message
  3689. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_main_return(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), this.lexer.literalNames[this.lexerClass.RK_VOID], token.line);
  3690. }
  3691. this.popScope();
  3692. return func;
  3693. }
  3694. /*
  3695. * Parse the formal parameters of a function.
  3696. * @returns a list of objects with the following attributes: type, id and dimensions.
  3697. **/
  3698. }, {
  3699. key: 'parseFormalParameters',
  3700. value: function parseFormalParameters() {
  3701. var list = [];
  3702. while (true) {
  3703. var dimensions = 0;
  3704. var typeString = this.parseType();
  3705. var idString = this.parseID();
  3706. if (this.checkOpenBrace(true)) {
  3707. this.pos++;
  3708. dimensions++;
  3709. this.checkCloseBrace();
  3710. this.pos++;
  3711. if (this.checkOpenBrace(true)) {
  3712. this.pos++;
  3713. dimensions++;
  3714. this.checkCloseBrace();
  3715. this.pos++;
  3716. }
  3717. }
  3718. var type = null;
  3719. if (dimensions > 0) {
  3720. type = new _compoundType.CompoundType(typeString, dimensions);
  3721. } else {
  3722. type = typeString;
  3723. }
  3724. list.push(new Commands.FormalParameter(type, idString));
  3725. var commaToken = this.getToken();
  3726. if (commaToken.type !== this.lexerClass.COMMA) break;
  3727. this.pos++;
  3728. this.consumeNewLines();
  3729. }
  3730. return list;
  3731. }
  3732. }, {
  3733. key: 'parseID',
  3734. value: function parseID() {
  3735. var token = this.getToken();
  3736. if (token.type !== this.lexerClass.ID) {
  3737. throw _syntaxErrorFactory.SyntaxErrorFactory.id_missing(token);
  3738. }
  3739. this.pos++;
  3740. if (this.insideScope(IVProgParser.FUNCTION)) {
  3741. if (token.text === _definedFunctions.LanguageDefinedFunction.getMainFunctionName()) {
  3742. return null;
  3743. }
  3744. }
  3745. return token.text;
  3746. }
  3747. }, {
  3748. key: 'parseMaybeLibID',
  3749. value: function parseMaybeLibID() {
  3750. var token = this.getToken();
  3751. if (token.type !== this.lexerClass.ID && token.type !== this.lexerClass.LIB_ID) {
  3752. throw _syntaxErrorFactory.SyntaxErrorFactory.id_missing(token);
  3753. }
  3754. this.pos++;
  3755. return token.text;
  3756. }
  3757. }, {
  3758. key: 'parseType',
  3759. value: function parseType() {
  3760. var token = this.getToken();
  3761. if (token.type === this.lexerClass.ID && this.insideScope(IVProgParser.FUNCTION)) {
  3762. return _types.Types.VOID;
  3763. } else if (token.type === this.lexerClass.RK_VOID && this.insideScope(IVProgParser.FUNCTION)) {
  3764. this.pos++;
  3765. return _types.Types.VOID;
  3766. } else if (this.isVariableType(token)) {
  3767. this.pos++;
  3768. switch (token.type) {
  3769. case this.lexerClass.RK_INTEGER:
  3770. return _types.Types.INTEGER;
  3771. case this.lexerClass.RK_BOOLEAN:
  3772. return _types.Types.BOOLEAN;
  3773. case this.lexerClass.RK_REAL:
  3774. return _types.Types.REAL;
  3775. case this.lexerClass.RK_STRING:
  3776. return _types.Types.STRING;
  3777. default:
  3778. break;
  3779. }
  3780. }
  3781. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_type(this.getTypeArray(), token);
  3782. }
  3783. }, {
  3784. key: 'parseCommandBlock',
  3785. value: function parseCommandBlock() {
  3786. var optionalCurly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  3787. var variablesDecl = [];
  3788. var commands = [];
  3789. var hasOpen = false;
  3790. if (this.checkOpenCurly(optionalCurly)) {
  3791. this.pos++;
  3792. hasOpen = true;
  3793. }
  3794. this.consumeNewLines();
  3795. while (true) {
  3796. var cmd = this.parseCommand();
  3797. if (cmd === null) break;
  3798. if (cmd !== -1) {
  3799. if (cmd instanceof Array) {
  3800. variablesDecl = variablesDecl.concat(cmd);
  3801. } else {
  3802. commands.push(cmd);
  3803. }
  3804. }
  3805. }
  3806. this.consumeNewLines();
  3807. if (hasOpen) {
  3808. this.checkCloseCurly();
  3809. this.pos++;
  3810. this.consumeNewLines();
  3811. }
  3812. return new Commands.CommandBlock(variablesDecl, commands);
  3813. }
  3814. }, {
  3815. key: 'parseCommand',
  3816. value: function parseCommand() {
  3817. var token = this.getToken();
  3818. if (this.isVariableType(token)) {
  3819. if (!this.insideScope(IVProgParser.FUNCTION)) {
  3820. // TODO better error message
  3821. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_var_declaration(token.line);
  3822. }
  3823. this.pushScope(IVProgParser.BASE);
  3824. var varType = this.parseType();
  3825. this.popScope();
  3826. var cmd = this.parseDeclaration(varType);
  3827. this.checkEOS();
  3828. this.pos++;
  3829. return cmd;
  3830. } else if (token.type === this.lexerClass.ID) {
  3831. return this.parseIDCommand();
  3832. } else if (token.type === this.lexerClass.LIB_ID) {
  3833. return this.parseIDCommand();
  3834. } else if (token.type === this.lexerClass.RK_RETURN) {
  3835. return this.parseReturn();
  3836. } else if (token.type === this.lexerClass.RK_WHILE) {
  3837. return this.parseWhile();
  3838. } else if (token.type === this.lexerClass.RK_FOR) {
  3839. return this.parseFor();
  3840. } else if (token.type === this.lexerClass.RK_BREAK) {
  3841. if (!this.insideScope(IVProgParser.BREAKABLE)) {
  3842. // TODO better error message
  3843. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_break_command(this.lexer.literalNames[this.lexerClass.RK_BREAK], token);
  3844. }
  3845. return this.parseBreak();
  3846. } else if (token.type === this.lexerClass.RK_SWITCH) {
  3847. return this.parseSwitchCase();
  3848. } else if (token.type === this.lexerClass.RK_DO) {
  3849. return this.parseDoWhile();
  3850. } else if (token.type === this.lexerClass.RK_IF) {
  3851. return this.parseIfThenElse();
  3852. } else if (this.checkEOS(true)) {
  3853. this.pos++;
  3854. return -1;
  3855. } else {
  3856. return null;
  3857. }
  3858. }
  3859. }, {
  3860. key: 'parseSwitchCase',
  3861. value: function parseSwitchCase() {
  3862. this.pushScope(IVProgParser.BREAKABLE);
  3863. this.pos++;
  3864. this.checkOpenParenthesis();
  3865. this.pos++;
  3866. this.consumeNewLines();
  3867. var exp = this.parseExpressionOR();
  3868. this.consumeNewLines();
  3869. this.checkCloseParenthesis();
  3870. this.pos++;
  3871. this.consumeNewLines();
  3872. this.checkOpenCurly();
  3873. this.pos++;
  3874. this.consumeNewLines();
  3875. var casesList = this.parseCases();
  3876. this.consumeNewLines();
  3877. this.checkCloseCurly();
  3878. this.pos++;
  3879. this.consumeNewLines();
  3880. this.popScope();
  3881. return new Commands.Switch(exp, casesList);
  3882. }
  3883. }, {
  3884. key: 'parseDoWhile',
  3885. value: function parseDoWhile() {
  3886. this.pos++;
  3887. this.consumeNewLines();
  3888. this.pushScope(IVProgParser.BREAKABLE);
  3889. var commandsBlock = this.parseCommandBlock();
  3890. this.consumeNewLines(); //Maybe not...
  3891. var whileToken = this.getToken();
  3892. if (whileToken.type !== this.lexerClass.RK_WHILE) {
  3893. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_WHILE], whileToken);
  3894. }
  3895. this.pos++;
  3896. this.checkOpenParenthesis();
  3897. this.pos++;
  3898. this.consumeNewLines();
  3899. var condition = this.parseExpressionOR();
  3900. this.consumeNewLines();
  3901. this.checkCloseParenthesis();
  3902. this.pos++;
  3903. this.checkEOS();
  3904. this.popScope();
  3905. return new Commands.DoWhile(condition, commandsBlock);
  3906. }
  3907. }, {
  3908. key: 'parseIfThenElse',
  3909. value: function parseIfThenElse() {
  3910. if (this.insideScope(IVProgParser.BREAKABLE)) {
  3911. this.pushScope(IVProgParser.BREAKABLE);
  3912. } else {
  3913. this.pushScope(IVProgParser.COMMAND);
  3914. }
  3915. this.pos++;
  3916. this.checkOpenParenthesis();
  3917. this.pos++;
  3918. this.consumeNewLines();
  3919. var logicalExpression = this.parseExpressionOR();
  3920. this.consumeNewLines();
  3921. this.checkCloseParenthesis();
  3922. this.pos++;
  3923. this.consumeNewLines();
  3924. var cmdBlocks = this.parseCommandBlock();
  3925. var maybeElse = this.getToken();
  3926. if (maybeElse.type === this.lexerClass.RK_ELSE) {
  3927. this.pos++;
  3928. this.consumeNewLines();
  3929. var maybeIf = this.getToken();
  3930. var elseBlock = null;
  3931. if (this.checkOpenCurly(true)) {
  3932. elseBlock = this.parseCommandBlock();
  3933. } else if (maybeIf.type === this.lexerClass.RK_IF) {
  3934. elseBlock = this.parseIfThenElse();
  3935. } else {
  3936. // TODO better error message
  3937. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list([this.lexer.literalNames[this.lexerClass.RK_IF], '{'], maybeIf);
  3938. }
  3939. return new Commands.IfThenElse(logicalExpression, cmdBlocks, elseBlock);
  3940. }
  3941. this.popScope();
  3942. return new Commands.IfThenElse(logicalExpression, cmdBlocks, null);
  3943. }
  3944. }, {
  3945. key: 'parseFor',
  3946. value: function parseFor() {
  3947. this.pushScope(IVProgParser.BREAKABLE);
  3948. this.pos++;
  3949. this.checkOpenParenthesis();
  3950. this.pos++;
  3951. this.consumeNewLines();
  3952. var attribution = this.parseForAssign();
  3953. this.consumeNewLines();
  3954. var condition = this.parseExpressionOR();
  3955. this.consumeForSemiColon();
  3956. var increment = this.parseForAssign(true);
  3957. this.checkCloseParenthesis();
  3958. this.pos++;
  3959. this.consumeNewLines();
  3960. var commandsBlock = this.parseCommandBlock();
  3961. this.popScope();
  3962. return new Commands.For(attribution, condition, increment, commandsBlock);
  3963. }
  3964. }, {
  3965. key: 'parseWhile',
  3966. value: function parseWhile() {
  3967. this.pushScope(IVProgParser.BREAKABLE);
  3968. this.pos++;
  3969. this.checkOpenParenthesis();
  3970. this.pos++;
  3971. this.consumeNewLines();
  3972. var logicalExpression = this.parseExpressionOR();
  3973. this.consumeNewLines();
  3974. this.checkCloseParenthesis();
  3975. this.pos++;
  3976. this.consumeNewLines();
  3977. var cmdBlocks = this.parseCommandBlock();
  3978. this.popScope();
  3979. return new Commands.While(logicalExpression, cmdBlocks);
  3980. }
  3981. }, {
  3982. key: 'parseBreak',
  3983. value: function parseBreak() {
  3984. this.pos++;
  3985. this.checkEOS();
  3986. this.pos++;
  3987. return new Commands.Break();
  3988. }
  3989. }, {
  3990. key: 'parseReturn',
  3991. value: function parseReturn() {
  3992. this.pos++;
  3993. var exp = null;
  3994. if (!this.checkEOS(true)) {
  3995. exp = this.parseExpressionOR();
  3996. this.checkEOS();
  3997. }
  3998. this.pos++;
  3999. return new Commands.Return(exp);
  4000. }
  4001. }, {
  4002. key: 'parseIDCommand',
  4003. value: function parseIDCommand() {
  4004. var refToken = this.getToken();
  4005. var isID = refToken.type === this.lexerClass.ID;
  4006. var id = this.parseMaybeLibID();
  4007. if (this.checkOpenBrace(true)) {
  4008. this.pos++;
  4009. var lineExpression = null;
  4010. var columnExpression = null;
  4011. this.consumeNewLines();
  4012. lineExpression = this.parseExpression();
  4013. this.consumeNewLines();
  4014. this.checkCloseBrace();
  4015. this.pos++;
  4016. if (this.checkOpenBrace(true)) {
  4017. this.pos++;
  4018. this.consumeNewLines();
  4019. columnExpression = this.parseExpression();
  4020. this.consumeNewLines();
  4021. this.checkCloseBrace();
  4022. this.pos++;
  4023. }
  4024. var equalToken = this.getToken();
  4025. if (equalToken.type !== this.lexerClass.EQUAL) {
  4026. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('=', equalToken);
  4027. }
  4028. this.pos++;
  4029. var exp = this.parseExpressionOR();
  4030. this.checkEOS();
  4031. this.pos++;
  4032. var cmd = new Commands.ArrayIndexAssign(id, lineExpression, columnExpression, exp);
  4033. cmd.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equalToken);
  4034. return cmd;
  4035. }
  4036. var equalOrParenthesis = this.getToken();
  4037. if (isID && equalOrParenthesis.type === this.lexerClass.EQUAL) {
  4038. this.pos++;
  4039. var _exp = this.parseExpressionOR();
  4040. this.checkEOS();
  4041. this.pos++;
  4042. var _cmd = new Commands.Assign(id, _exp);
  4043. _cmd.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equalOrParenthesis);
  4044. return _cmd;
  4045. } else if (equalOrParenthesis.type === this.lexerClass.OPEN_PARENTHESIS) {
  4046. var funcCall = this.parseFunctionCallCommand(id);
  4047. this.checkEOS();
  4048. this.pos++;
  4049. return funcCall;
  4050. } else if (isID) {
  4051. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list(['=', '('], equalOrParenthesis);
  4052. } else {
  4053. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_id_format(refToken);
  4054. }
  4055. }
  4056. }, {
  4057. key: 'parseForAssign',
  4058. value: function parseForAssign() {
  4059. var isLast = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4060. if (!isLast) this.consumeNewLines();
  4061. if (this.checkEOS(true)) {
  4062. return null;
  4063. }
  4064. var id = this.parseID();
  4065. var equal = this.getToken();
  4066. if (equal.type !== this.lexerClass.EQUAL) {
  4067. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('=', equal);
  4068. }
  4069. this.pos++;
  4070. var exp = this.parseExpressionOR();
  4071. if (!isLast) {
  4072. this.consumeForSemiColon();
  4073. }
  4074. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equal);
  4075. var cmd = new Commands.Assign(id, exp);
  4076. cmd.sourceInfo = sourceInfo;
  4077. return cmd;
  4078. }
  4079. }, {
  4080. key: 'parseCases',
  4081. value: function parseCases() {
  4082. var token = this.getToken();
  4083. if (token.type !== this.lexerClass.RK_CASE) {
  4084. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_CASE], token);
  4085. }
  4086. this.pos++;
  4087. var nextToken = this.getToken();
  4088. if (nextToken.type === this.lexerClass.RK_DEFAULT) {
  4089. this.pos++;
  4090. var colonToken = this.getToken();
  4091. if (colonToken.type !== this.lexerClass.COLON) {
  4092. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(':', colonToken);
  4093. }
  4094. this.pos++;
  4095. this.consumeNewLines();
  4096. var block = this.parseCommandBlock(true);
  4097. var defaultCase = new Commands.Case(null);
  4098. defaultCase.setCommands(block.commands);
  4099. return [defaultCase];
  4100. } else {
  4101. var exp = this.parseExpressionOR();
  4102. var _colonToken = this.getToken();
  4103. if (_colonToken.type !== this.lexerClass.COLON) {
  4104. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(':', _colonToken);
  4105. }
  4106. this.pos++;
  4107. this.consumeNewLines();
  4108. var _block = this.parseCommandBlock(true);
  4109. var aCase = new Commands.Case(exp);
  4110. aCase.setCommands(_block.commands);
  4111. var caseToken = this.getToken();
  4112. if (caseToken.type === this.lexerClass.RK_CASE) {
  4113. return [aCase].concat(this.parseCases());
  4114. } else {
  4115. return [aCase];
  4116. }
  4117. }
  4118. }
  4119. /*
  4120. * Parses an Expression following the structure:
  4121. *
  4122. * EOR => EAnd ( 'or' EOR)? #expression and
  4123. *
  4124. * EOR => ENot ('and' EOR)? #expression or
  4125. *
  4126. * ENot => 'not'? ER #expression not
  4127. *
  4128. * ER => E ((>=, <=, ==, >, <) E)? #expression relational
  4129. *
  4130. * E => factor ((+, -) E)? #expression
  4131. *
  4132. * factor=> term ((*, /, %) factor)?
  4133. *
  4134. * term => literal || arrayAccess || FuncCall || ID || '('EAnd')'
  4135. **/
  4136. }, {
  4137. key: 'parseExpressionOR',
  4138. value: function parseExpressionOR() {
  4139. var exp1 = this.parseExpressionAND();
  4140. while (this.getToken().type === this.lexerClass.OR_OPERATOR) {
  4141. var opToken = this.getToken();
  4142. this.pos++;
  4143. var or = (0, _operators.convertFromString)('or');
  4144. this.consumeNewLines();
  4145. var exp2 = this.parseExpressionAND();
  4146. var _finalExp = new Expressions.InfixApp(or, exp1, exp2);
  4147. _finalExp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  4148. exp1 = _finalExp;
  4149. }
  4150. return exp1;
  4151. }
  4152. }, {
  4153. key: 'parseExpressionAND',
  4154. value: function parseExpressionAND() {
  4155. var exp1 = this.parseExpressionNot();
  4156. while (this.getToken().type === this.lexerClass.AND_OPERATOR) {
  4157. var opToken = this.getToken();
  4158. this.pos++;
  4159. var and = (0, _operators.convertFromString)('and');
  4160. this.consumeNewLines();
  4161. var exp2 = this.parseExpressionNot();
  4162. var _finalExp2 = new Expressions.InfixApp(and, exp1, exp2);
  4163. _finalExp2.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  4164. exp1 = _finalExp2;
  4165. }
  4166. return exp1;
  4167. }
  4168. }, {
  4169. key: 'parseExpressionNot',
  4170. value: function parseExpressionNot() {
  4171. var maybeNotToken = this.getToken();
  4172. if (maybeNotToken.type === this.lexerClass.NOT_OPERATOR) {
  4173. var opToken = this.getToken();
  4174. this.pos++;
  4175. var not = (0, _operators.convertFromString)('not');
  4176. var exp1 = this.parseExpressionRel();
  4177. finalExp = new Expressions.UnaryApp(not, exp1);
  4178. finalExp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  4179. return finalExp;
  4180. } else {
  4181. return this.parseExpressionRel();
  4182. }
  4183. }
  4184. }, {
  4185. key: 'parseExpressionRel',
  4186. value: function parseExpressionRel() {
  4187. var exp1 = this.parseExpression();
  4188. while (this.getToken().type === this.lexerClass.RELATIONAL_OPERATOR) {
  4189. var relToken = this.getToken();
  4190. this.pos++;
  4191. var rel = (0, _operators.convertFromString)(relToken.text);
  4192. var exp2 = this.parseExpression();
  4193. var _finalExp3 = new Expressions.InfixApp(rel, exp1, exp2);
  4194. _finalExp3.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(relToken);
  4195. exp1 = _finalExp3;
  4196. }
  4197. return exp1;
  4198. }
  4199. }, {
  4200. key: 'parseExpression',
  4201. value: function parseExpression() {
  4202. var factor = this.parseFactor();
  4203. while (this.getToken().type === this.lexerClass.SUM_OP) {
  4204. var sumOpToken = this.getToken();
  4205. this.pos++;
  4206. var op = (0, _operators.convertFromString)(sumOpToken.text);
  4207. var factor2 = this.parseFactor();
  4208. var _finalExp4 = new Expressions.InfixApp(op, factor, factor2);
  4209. _finalExp4.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(sumOpToken);
  4210. factor = _finalExp4;
  4211. }
  4212. return factor;
  4213. }
  4214. }, {
  4215. key: 'parseFactor',
  4216. value: function parseFactor() {
  4217. var term = this.parseTerm();
  4218. while (this.getToken().type === this.lexerClass.MULTI_OP) {
  4219. var multOpToken = this.getToken();
  4220. this.pos++;
  4221. var op = (0, _operators.convertFromString)(multOpToken.text);
  4222. var term2 = this.parseTerm();
  4223. var _finalExp5 = new Expressions.InfixApp(op, term, term2);
  4224. _finalExp5.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(multOpToken);
  4225. term = _finalExp5;
  4226. }
  4227. return term;
  4228. }
  4229. }, {
  4230. key: 'parseTerm',
  4231. value: function parseTerm() {
  4232. var token = this.getToken();
  4233. var sourceInfo = null;
  4234. switch (token.type) {
  4235. case this.lexerClass.SUM_OP:
  4236. this.pos++;
  4237. sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4238. var exp = new Expressions.UnaryApp((0, _operators.convertFromString)(token.text), this.parseTerm());
  4239. exp.sourceInfo = sourceInfo;
  4240. return exp;
  4241. case this.lexerClass.INTEGER:
  4242. this.pos++;
  4243. return this.getIntLiteral(token);
  4244. case this.lexerClass.REAL:
  4245. this.pos++;
  4246. return this.getRealLiteral(token);
  4247. case this.lexerClass.STRING:
  4248. this.pos++;
  4249. return this.getStringLiteral(token);
  4250. case this.lexerClass.RK_TRUE:
  4251. case this.lexerClass.RK_FALSE:
  4252. this.pos++;
  4253. return this.getBoolLiteral(token);
  4254. case this.lexerClass.OPEN_CURLY:
  4255. return this.parseArrayLiteral();
  4256. case this.lexerClass.ID:
  4257. case this.lexerClass.LIB_ID:
  4258. return this.parseIDTerm();
  4259. case this.lexerClass.OPEN_PARENTHESIS:
  4260. return this.parseParenthesisExp();
  4261. default:
  4262. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_terminal(token);
  4263. }
  4264. }
  4265. }, {
  4266. key: 'parseIDTerm',
  4267. value: function parseIDTerm() {
  4268. var tokenA = this.getToken();
  4269. var id = this.parseMaybeLibID();
  4270. var isID = tokenA.type === this.lexerClass.ID;
  4271. if (isID && this.checkOpenBrace(true)) {
  4272. var tokenB = null;
  4273. this.pos++;
  4274. var firstIndex = this.parseExpression();
  4275. var secondIndex = null;
  4276. this.consumeNewLines();
  4277. this.checkCloseBrace();
  4278. tokenB = this.getToken();
  4279. this.pos++;
  4280. if (this.checkOpenBrace(true)) {
  4281. this.pos++;
  4282. secondIndex = this.parseExpression();
  4283. this.consumeNewLines();
  4284. this.checkCloseBrace();
  4285. tokenB = this.getToken();
  4286. this.pos++;
  4287. }
  4288. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  4289. var exp = new Expressions.ArrayAccess(id, firstIndex, secondIndex);
  4290. exp.sourceInfo = sourceInfo;
  4291. return exp;
  4292. } else if (this.checkOpenParenthesis(true)) {
  4293. return this.parseFunctionCallExpression(id);
  4294. } else if (isID) {
  4295. var _sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(tokenA);
  4296. var _exp2 = new Expressions.VariableLiteral(id);
  4297. _exp2.sourceInfo = _sourceInfo;
  4298. return _exp2;
  4299. } else {
  4300. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_id_format(tokenA);
  4301. }
  4302. }
  4303. }, {
  4304. key: 'getFunctionName',
  4305. value: function getFunctionName(id) {
  4306. var name = _definedFunctions.LanguageDefinedFunction.getInternalName(id);
  4307. if (name === null) {
  4308. return id;
  4309. } else {
  4310. return name;
  4311. }
  4312. }
  4313. }, {
  4314. key: 'parseFunctionCallExpression',
  4315. value: function parseFunctionCallExpression(id) {
  4316. var tokenA = this.getToken(this.pos - 1);
  4317. var actualParameters = this.parseActualParameters();
  4318. var tokenB = this.getToken(this.pos - 1);
  4319. var funcName = this.getFunctionName(id);
  4320. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  4321. var cmd = new Expressions.FunctionCall(funcName, actualParameters);
  4322. cmd.sourceInfo = sourceInfo;
  4323. return cmd;
  4324. }
  4325. }, {
  4326. key: 'parseFunctionCallCommand',
  4327. value: function parseFunctionCallCommand(id) {
  4328. return this.parseFunctionCallExpression(id);
  4329. }
  4330. }, {
  4331. key: 'parseParenthesisExp',
  4332. value: function parseParenthesisExp() {
  4333. this.checkOpenParenthesis();
  4334. var tokenA = this.getToken();
  4335. this.pos++;
  4336. this.consumeNewLines();
  4337. var exp = this.parseExpressionOR();
  4338. this.consumeNewLines();
  4339. this.checkCloseParenthesis();
  4340. var tokenB = this.getToken();
  4341. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  4342. this.pos++;
  4343. exp.sourceInfo = sourceInfo;
  4344. return exp;
  4345. }
  4346. }, {
  4347. key: 'parseActualParameters',
  4348. value: function parseActualParameters() {
  4349. this.checkOpenParenthesis();
  4350. this.pos++;
  4351. if (this.checkCloseParenthesis(true)) {
  4352. this.pos++;
  4353. return [];
  4354. }
  4355. this.consumeNewLines();
  4356. var list = this.parseExpressionList();
  4357. this.consumeNewLines();
  4358. this.checkCloseParenthesis();
  4359. this.pos++;
  4360. return list;
  4361. }
  4362. }, {
  4363. key: 'parseExpressionList',
  4364. value: function parseExpressionList() {
  4365. var list = [];
  4366. while (true) {
  4367. var exp = this.parseExpressionOR();
  4368. list.push(exp);
  4369. var maybeToken = this.getToken();
  4370. if (maybeToken.type !== this.lexerClass.COMMA) {
  4371. break;
  4372. } else {
  4373. this.pos++;
  4374. this.consumeNewLines();
  4375. }
  4376. }
  4377. return list;
  4378. }
  4379. }, {
  4380. key: 'getTypeArray',
  4381. value: function getTypeArray() {
  4382. var _this = this;
  4383. var types = this.insideScope(IVProgParser.FUNCTION) ? this.functionTypes : this.variableTypes;
  4384. return types.map(function (x) {
  4385. return _this.lexer.literalNames[x];
  4386. });
  4387. }
  4388. }]);
  4389. return IVProgParser;
  4390. }();
  4391. /***/ }),
  4392. /***/ "./js/ast/operators.js":
  4393. /*!*****************************!*\
  4394. !*** ./js/ast/operators.js ***!
  4395. \*****************************/
  4396. /*! no static exports found */
  4397. /***/ (function(module, exports, __webpack_require__) {
  4398. "use strict";
  4399. Object.defineProperty(exports, "__esModule", {
  4400. value: true
  4401. });
  4402. exports.convertFromString = convertFromString;
  4403. var Operators = exports.Operators = Object.freeze({
  4404. ADD: { ord: 0, value: "+" },
  4405. SUB: { ord: 1, value: "-" },
  4406. MULT: { ord: 2, value: '*' },
  4407. DIV: { ord: 3, value: '/' },
  4408. MOD: { ord: 4, value: '%' },
  4409. GT: { ord: 5, value: '>' },
  4410. GE: { ord: 6, value: '>=' },
  4411. LT: { ord: 7, value: '<' },
  4412. LE: { ord: 8, value: '<=' },
  4413. EQ: { ord: 9, value: '==' },
  4414. NEQ: { ord: 10, value: '!=' },
  4415. AND: { ord: 11, value: 'and' },
  4416. OR: { ord: 12, value: 'or' },
  4417. NOT: { ord: 13, value: 'not' }
  4418. });
  4419. function convertFromString(op) {
  4420. switch (op) {
  4421. case '+':
  4422. return Operators.ADD;
  4423. case '-':
  4424. return Operators.SUB;
  4425. case '*':
  4426. return Operators.MULT;
  4427. case '/':
  4428. return Operators.DIV;
  4429. case '%':
  4430. return Operators.MOD;
  4431. case '>':
  4432. return Operators.GT;
  4433. case '>=':
  4434. return Operators.GE;
  4435. case '<':
  4436. return Operators.LT;
  4437. case '<=':
  4438. return Operators.LE;
  4439. case '==':
  4440. return Operators.EQ;
  4441. case '!=':
  4442. return Operators.NEQ;
  4443. case 'and':
  4444. return Operators.AND;
  4445. case 'or':
  4446. return Operators.OR;
  4447. case 'not':
  4448. return Operators.NOT;
  4449. }
  4450. }
  4451. /***/ }),
  4452. /***/ "./js/ast/sourceInfo.js":
  4453. /*!******************************!*\
  4454. !*** ./js/ast/sourceInfo.js ***!
  4455. \******************************/
  4456. /*! no static exports found */
  4457. /***/ (function(module, exports, __webpack_require__) {
  4458. "use strict";
  4459. Object.defineProperty(exports, "__esModule", {
  4460. value: true
  4461. });
  4462. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4463. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4464. var SourceInfo = exports.SourceInfo = function () {
  4465. _createClass(SourceInfo, null, [{
  4466. key: "createSourceInfo",
  4467. value: function createSourceInfo(token) {
  4468. return new SourceInfo(token.line, token.column, token.text.length);
  4469. }
  4470. }, {
  4471. key: "createSourceInfoFromList",
  4472. value: function createSourceInfoFromList(tokenA, tokenB) {
  4473. var line = tokenA.line;
  4474. var column = tokenA.column;
  4475. // copied from https://github.com/UNIVALI-LITE/Portugol-Studio/blob/master/core/src/main/java/br/univali/portugol/nucleo/analise/sintatica/Portugol.g
  4476. // No idea why...
  4477. var size = tokenB.tokenIndex + 1 - tokenA.tokenIndex;
  4478. return new SourceInfo(line, column, size);
  4479. }
  4480. }]);
  4481. function SourceInfo(line, column, size) {
  4482. _classCallCheck(this, SourceInfo);
  4483. this.line = line;
  4484. this.column = column;
  4485. this.size = size;
  4486. }
  4487. return SourceInfo;
  4488. }();
  4489. /***/ }),
  4490. /***/ "./js/io/domConsole.js":
  4491. /*!*****************************!*\
  4492. !*** ./js/io/domConsole.js ***!
  4493. \*****************************/
  4494. /*! no static exports found */
  4495. /***/ (function(module, exports, __webpack_require__) {
  4496. "use strict";
  4497. Object.defineProperty(exports, "__esModule", {
  4498. value: true
  4499. });
  4500. exports.DOMConsole = undefined;
  4501. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4502. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  4503. var _jquery2 = _interopRequireDefault(_jquery);
  4504. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4505. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4506. var DOMConsole = exports.DOMConsole = function () {
  4507. _createClass(DOMConsole, null, [{
  4508. key: 'USER',
  4509. get: function get() {
  4510. return 0;
  4511. }
  4512. }, {
  4513. key: 'INFO',
  4514. get: function get() {
  4515. return 1;
  4516. }
  4517. }, {
  4518. key: 'ERR',
  4519. get: function get() {
  4520. return 2;
  4521. }
  4522. }]);
  4523. function DOMConsole(elementID) {
  4524. _classCallCheck(this, DOMConsole);
  4525. this.input = null;
  4526. this.needInput = false;
  4527. this.termDiv = null;
  4528. this.anyKey = false;
  4529. this.parent = (0, _jquery2.default)(elementID);
  4530. this.setup();
  4531. this.inputListeners = [];
  4532. }
  4533. _createClass(DOMConsole, [{
  4534. key: 'setup',
  4535. value: function setup() {
  4536. this._setupDom();
  4537. this._setupEvents();
  4538. }
  4539. }, {
  4540. key: '_setupEvents',
  4541. value: function _setupEvents() {
  4542. var _this = this;
  4543. this.input.on("keydown", function (event) {
  4544. if (!_this.needInput) {
  4545. event.preventDefault();
  4546. return;
  4547. }
  4548. var keyCode = event.which;
  4549. if (keyCode === 13 || _this.anyKey) {
  4550. var text = _this.input.val();
  4551. text = text.replace('[\n\r]+', '');
  4552. _this.notifyListeners(text);
  4553. _this.write(text);
  4554. _this.input.val("");
  4555. }
  4556. });
  4557. }
  4558. }, {
  4559. key: '_setupDom',
  4560. value: function _setupDom() {
  4561. this.termDiv = (0, _jquery2.default)("<div></div>");
  4562. this.termDiv.addClass("ivprog-term-div");
  4563. this.input = (0, _jquery2.default)('<input text="type">');
  4564. this.input.addClass("ivprog-term-input");
  4565. this.termDiv.append(this.input);
  4566. this.parent.append(this.termDiv);
  4567. }
  4568. }, {
  4569. key: 'notifyListeners',
  4570. value: function notifyListeners(text) {
  4571. this.inputListeners.forEach(function (resolve) {
  4572. return resolve(text);
  4573. });
  4574. this.inputListeners.splice(0, this.inputListeners.length);
  4575. this.hideInput();
  4576. this.anyKey = false;
  4577. }
  4578. }, {
  4579. key: 'write',
  4580. value: function write(text) {
  4581. this._appendText(text, DOMConsole.USER);
  4582. }
  4583. }, {
  4584. key: 'info',
  4585. value: function info(text) {
  4586. this._appendText(text, DOMConsole.INFO);
  4587. }
  4588. }, {
  4589. key: 'err',
  4590. value: function err(text) {
  4591. this._appendText(text, DOMConsole.ERR);
  4592. }
  4593. }, {
  4594. key: '_appendText',
  4595. value: function _appendText(text, type) {
  4596. var divClass = this.getClassForType(type);
  4597. var textDiv = (0, _jquery2.default)("<div></div>");
  4598. textDiv.addClass(divClass);
  4599. textDiv.append(text);
  4600. textDiv.insertBefore(this.input);
  4601. this.scrollTerm();
  4602. }
  4603. }, {
  4604. key: 'scrollTerm',
  4605. value: function scrollTerm() {
  4606. this.termDiv.animate({
  4607. scrollTop: this.termDiv.prop('scrollHeight')
  4608. }, 0);
  4609. }
  4610. }, {
  4611. key: 'getClassForType',
  4612. value: function getClassForType(type) {
  4613. switch (type) {
  4614. case DOMConsole.USER:
  4615. return "ivprog-term-userText";
  4616. case DOMConsole.INFO:
  4617. return "ivprog-term-info";
  4618. case DOMConsole.ERR:
  4619. return "ivprog-term-error";
  4620. }
  4621. }
  4622. }, {
  4623. key: 'dispose',
  4624. value: function dispose() {
  4625. this.parent.off();
  4626. this.input.off();
  4627. this.input = null;
  4628. this.parent.empty();
  4629. }
  4630. }, {
  4631. key: 'showInput',
  4632. value: function showInput() {
  4633. this.needInput = true;
  4634. this.input.show();
  4635. this.input.focus();
  4636. }
  4637. }, {
  4638. key: 'hideInput',
  4639. value: function hideInput() {
  4640. this.needInput = false;
  4641. this.input.hide();
  4642. }
  4643. }, {
  4644. key: 'requestInput',
  4645. value: function requestInput(callback) {
  4646. var anyKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  4647. this.inputListeners.push(callback);
  4648. this.anyKey = anyKey;
  4649. this.showInput();
  4650. }
  4651. }, {
  4652. key: 'sendOutput',
  4653. value: function sendOutput(text) {
  4654. var _this2 = this;
  4655. text.split("\n").forEach(function (t) {
  4656. t = t.replace(/\t/g, '&#9;');
  4657. _this2.write(t);
  4658. });
  4659. }
  4660. }, {
  4661. key: 'clear',
  4662. value: function clear() {
  4663. this.input.parent().children().not(this.input).remove();
  4664. this.input.val("");
  4665. }
  4666. }]);
  4667. return DOMConsole;
  4668. }();
  4669. /***/ }),
  4670. /***/ "./js/io/input.js":
  4671. /*!************************!*\
  4672. !*** ./js/io/input.js ***!
  4673. \************************/
  4674. /*! no static exports found */
  4675. /***/ (function(module, exports, __webpack_require__) {
  4676. "use strict";
  4677. Object.defineProperty(exports, "__esModule", {
  4678. value: true
  4679. });
  4680. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4681. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4682. var Input = exports.Input = function () {
  4683. function Input() {
  4684. _classCallCheck(this, Input);
  4685. }
  4686. _createClass(Input, [{
  4687. key: "requestInput",
  4688. value: function requestInput(callback) {
  4689. throw new Error("Must be implemented");
  4690. }
  4691. }]);
  4692. return Input;
  4693. }();
  4694. /***/ }),
  4695. /***/ "./js/io/output.js":
  4696. /*!*************************!*\
  4697. !*** ./js/io/output.js ***!
  4698. \*************************/
  4699. /*! no static exports found */
  4700. /***/ (function(module, exports, __webpack_require__) {
  4701. "use strict";
  4702. Object.defineProperty(exports, "__esModule", {
  4703. value: true
  4704. });
  4705. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4706. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4707. var Output = exports.Output = function () {
  4708. function Output() {
  4709. _classCallCheck(this, Output);
  4710. }
  4711. _createClass(Output, [{
  4712. key: "sendOutput",
  4713. value: function sendOutput(text) {
  4714. throw new Error("Must be implemented");
  4715. }
  4716. }]);
  4717. return Output;
  4718. }();
  4719. /***/ }),
  4720. /***/ "./js/main.js":
  4721. /*!********************!*\
  4722. !*** ./js/main.js ***!
  4723. \********************/
  4724. /*! no static exports found */
  4725. /***/ (function(module, exports, __webpack_require__) {
  4726. "use strict";
  4727. Object.defineProperty(exports, "__esModule", {
  4728. value: true
  4729. });
  4730. exports.StringTypes = exports.LocalizedStrings = exports.initVisualUI = exports.runner = undefined;
  4731. var _runner = __webpack_require__(/*! ./runner */ "./js/runner.js");
  4732. var _functions = __webpack_require__(/*! ./visualUI/functions */ "./js/visualUI/functions.js");
  4733. var _localizedStringsService = __webpack_require__(/*! ./services/localizedStringsService */ "./js/services/localizedStringsService.js");
  4734. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  4735. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  4736. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4737. var StringTypes = _lineI18n2.default.StringTypes;
  4738. exports.runner = _runner.runner;
  4739. exports.initVisualUI = _functions.initVisualUI;
  4740. exports.LocalizedStrings = _localizedStringsService.LocalizedStrings;
  4741. exports.StringTypes = StringTypes;
  4742. /***/ }),
  4743. /***/ "./js/processor/compatibilityTable.js":
  4744. /*!********************************************!*\
  4745. !*** ./js/processor/compatibilityTable.js ***!
  4746. \********************************************/
  4747. /*! no static exports found */
  4748. /***/ (function(module, exports, __webpack_require__) {
  4749. "use strict";
  4750. Object.defineProperty(exports, "__esModule", {
  4751. value: true
  4752. });
  4753. exports.resultTypeAfterInfixOp = resultTypeAfterInfixOp;
  4754. exports.resultTypeAfterUnaryOp = resultTypeAfterUnaryOp;
  4755. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  4756. var _operators = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  4757. var _multiType = __webpack_require__(/*! ../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  4758. function buildInfixAddTable() {
  4759. var table = [[], [], [], []];
  4760. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  4761. table[_types.Types.INTEGER.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  4762. table[_types.Types.INTEGER.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  4763. table[_types.Types.REAL.ord][_types.Types.INTEGER.ord] = _types.Types.REAL;
  4764. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  4765. table[_types.Types.REAL.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  4766. table[_types.Types.STRING.ord][_types.Types.INTEGER.ord] = _types.Types.STRING;
  4767. table[_types.Types.STRING.ord][_types.Types.REAL.ord] = _types.Types.STRING;
  4768. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  4769. table[_types.Types.STRING.ord][_types.Types.BOOLEAN.ord] = _types.Types.STRING;
  4770. return table;
  4771. }
  4772. function buildInfixMultiDivSubTable() {
  4773. var table = [[], [], [], []];
  4774. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  4775. table[_types.Types.INTEGER.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  4776. table[_types.Types.REAL.ord][_types.Types.INTEGER.ord] = _types.Types.REAL;
  4777. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  4778. return table;
  4779. }
  4780. function buildInfixEqualityInequalityTable() {
  4781. var table = [[], [], [], []];
  4782. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.BOOLEAN;
  4783. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.BOOLEAN;
  4784. table[_types.Types.BOOLEAN.ord][_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  4785. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.BOOLEAN;
  4786. return table;
  4787. }
  4788. function buildInfixRelationalTable() {
  4789. var table = [[], [], [], []];
  4790. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.BOOLEAN;
  4791. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.BOOLEAN;
  4792. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.BOOLEAN;
  4793. return table;
  4794. }
  4795. function buildInfixAndOrTable() {
  4796. var table = [[], [], [], []];
  4797. table[_types.Types.BOOLEAN.ord][_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  4798. return table;
  4799. }
  4800. function buildInfixModTable() {
  4801. var table = [[], [], [], []];
  4802. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  4803. return table;
  4804. }
  4805. function buildUnarySumSubList() {
  4806. var list = [];
  4807. list[_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  4808. list[_types.Types.REAL.ord] = _types.Types.REAL;
  4809. return list;
  4810. }
  4811. function buildUnaryNegList() {
  4812. var list = [];
  4813. list[_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  4814. return list;
  4815. }
  4816. function buildInfixCompatibilityTable() {
  4817. var compatibilityMap = new WeakMap();
  4818. compatibilityMap.set(_operators.Operators.ADD, buildInfixAddTable());
  4819. compatibilityMap.set(_operators.Operators.SUB, buildInfixMultiDivSubTable());
  4820. compatibilityMap.set(_operators.Operators.MULT, buildInfixMultiDivSubTable());
  4821. compatibilityMap.set(_operators.Operators.DIV, buildInfixMultiDivSubTable());
  4822. compatibilityMap.set(_operators.Operators.EQ, buildInfixEqualityInequalityTable());
  4823. compatibilityMap.set(_operators.Operators.NEQ, buildInfixEqualityInequalityTable());
  4824. compatibilityMap.set(_operators.Operators.GE, buildInfixRelationalTable());
  4825. compatibilityMap.set(_operators.Operators.GT, buildInfixRelationalTable());
  4826. compatibilityMap.set(_operators.Operators.LE, buildInfixRelationalTable());
  4827. compatibilityMap.set(_operators.Operators.LT, buildInfixRelationalTable());
  4828. compatibilityMap.set(_operators.Operators.OR, buildInfixAndOrTable());
  4829. compatibilityMap.set(_operators.Operators.AND, buildInfixAndOrTable());
  4830. compatibilityMap.set(_operators.Operators.MOD, buildInfixModTable());
  4831. return compatibilityMap;
  4832. }
  4833. function buildUnaryCompatibilityTable() {
  4834. var compatibilityMap = new WeakMap();
  4835. compatibilityMap.set(_operators.Operators.ADD, buildUnarySumSubList());
  4836. compatibilityMap.set(_operators.Operators.SUB, buildUnarySumSubList());
  4837. compatibilityMap.set(_operators.Operators.NOT, buildUnaryNegList());
  4838. return compatibilityMap;
  4839. }
  4840. var infixMap = buildInfixCompatibilityTable();
  4841. var unaryMap = buildUnaryCompatibilityTable();
  4842. function resultTypeAfterInfixOp(operator, leftExpressionType, rightExpressionType) {
  4843. try {
  4844. if (leftExpressionType instanceof _multiType.MultiType && rightExpressionType instanceof _multiType.MultiType) {
  4845. var newMulti = [];
  4846. for (var i = 0; i < leftExpressionType.types.length; i++) {
  4847. var element = leftExpressionType.types[i];
  4848. if (rightExpressionType.types.indexOf(element) !== -1) {
  4849. newMulti.push(element);
  4850. }
  4851. }
  4852. if (newMulti.length <= 0) {
  4853. return _types.Types.UNDEFINED;
  4854. } else {
  4855. return new _multiType.MultiType(newMulti);
  4856. }
  4857. } else if (leftExpressionType instanceof _multiType.MultiType) {
  4858. if (leftExpressionType.isCompatible(rightExpressionType)) {
  4859. return rightExpressionType;
  4860. } else {
  4861. return _types.Types.UNDEFINED;
  4862. }
  4863. } else if (rightExpressionType instanceof _multiType.MultiType) {
  4864. if (rightExpressionType.isCompatible(leftExpressionType)) {
  4865. return leftExpressionType;
  4866. } else {
  4867. return _types.Types.UNDEFINED;
  4868. }
  4869. }
  4870. var resultType = infixMap.get(operator)[leftExpressionType.ord][rightExpressionType.ord];
  4871. if (resultType === null || resultType === undefined) {
  4872. return _types.Types.UNDEFINED;
  4873. }
  4874. return resultType;
  4875. } catch (e) {
  4876. if (e instanceof TypeError) {
  4877. return _types.Types.UNDEFINED;
  4878. } else {
  4879. throw e;
  4880. }
  4881. }
  4882. }
  4883. function resultTypeAfterUnaryOp(operator, leftExpressionType) {
  4884. try {
  4885. if (leftExpressionType instanceof _multiType.MultiType) {
  4886. return leftExpressionType;
  4887. }
  4888. return unaryMap.get(operator)[leftExpressionType.ord];
  4889. } catch (e) {
  4890. if (e instanceof TypeError) {
  4891. return _types.Types.UNDEFINED;
  4892. } else {
  4893. throw e;
  4894. }
  4895. }
  4896. }
  4897. /***/ }),
  4898. /***/ "./js/processor/context.js":
  4899. /*!*********************************!*\
  4900. !*** ./js/processor/context.js ***!
  4901. \*********************************/
  4902. /*! no static exports found */
  4903. /***/ (function(module, exports, __webpack_require__) {
  4904. "use strict";
  4905. Object.defineProperty(exports, "__esModule", {
  4906. value: true
  4907. });
  4908. var Context = exports.Context = Object.freeze({
  4909. BASE: Symbol('context:base'),
  4910. BREAKABLE: Symbol('context:breakable'),
  4911. FUNCTION: Symbol('context:function')
  4912. });
  4913. /***/ }),
  4914. /***/ "./js/processor/definedFunctions.js":
  4915. /*!******************************************!*\
  4916. !*** ./js/processor/definedFunctions.js ***!
  4917. \******************************************/
  4918. /*! no static exports found */
  4919. /***/ (function(module, exports, __webpack_require__) {
  4920. "use strict";
  4921. Object.defineProperty(exports, "__esModule", {
  4922. value: true
  4923. });
  4924. exports.LanguageDefinedFunction = undefined;
  4925. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  4926. var _io = __webpack_require__(/*! ./lib/io */ "./js/processor/lib/io.js");
  4927. var _strings = __webpack_require__(/*! ./lib/strings */ "./js/processor/lib/strings.js");
  4928. var _arrays = __webpack_require__(/*! ./lib/arrays */ "./js/processor/lib/arrays.js");
  4929. var _lang = __webpack_require__(/*! ./lib/lang */ "./js/processor/lib/lang.js");
  4930. var _math = __webpack_require__(/*! ./lib/math */ "./js/processor/lib/math.js");
  4931. function valueToKey(value, object) {
  4932. for (var key in object) {
  4933. if (object.hasOwnProperty(key)) {
  4934. if (object[key] === value) {
  4935. return key;
  4936. }
  4937. }
  4938. }
  4939. return null;
  4940. }
  4941. function concatObjects() {
  4942. var result = {};
  4943. for (var _len = arguments.length, objs = Array(_len), _key = 0; _key < _len; _key++) {
  4944. objs[_key] = arguments[_key];
  4945. }
  4946. for (var i = 0; i < objs.length; i++) {
  4947. var obj = objs[i];
  4948. for (var key in obj) {
  4949. if (obj.hasOwnProperty(key)) {
  4950. result[key] = obj[key];
  4951. }
  4952. }
  4953. }
  4954. return result;
  4955. }
  4956. var libsObject = {
  4957. $mathLib: {
  4958. $sin: (0, _math.createSinFun)(),
  4959. $cos: (0, _math.createCosFun)(),
  4960. $tan: (0, _math.createTanFun)(),
  4961. $sqrt: (0, _math.createSqrtFun)(),
  4962. $pow: (0, _math.createPowFun)(),
  4963. $log: (0, _math.createLogFun)(),
  4964. $abs: (0, _math.createAbsFun)(),
  4965. $negate: (0, _math.createNegateFun)(),
  4966. $invert: (0, _math.createInvertFun)(),
  4967. $max: (0, _math.createMaxFun)(),
  4968. $min: (0, _math.createMinFun)()
  4969. },
  4970. $ioLib: {
  4971. $read: (0, _io.createInputFun)(),
  4972. $write: (0, _io.createOutputFun)()
  4973. },
  4974. $strLib: {
  4975. $substring: (0, _strings.createSubstringFun)(),
  4976. $length: (0, _strings.createLengthFun)(),
  4977. $uppercase: (0, _strings.createUppercaseFun)(),
  4978. $lowercase: (0, _strings.createLowercaseFun)(),
  4979. $charAt: (0, _strings.createrCharAtFun)()
  4980. },
  4981. $arrayLib: {
  4982. $numElements: (0, _arrays.createNumElementsFun)(),
  4983. $matrixLines: (0, _arrays.createMatrixLinesFun)(),
  4984. $matrixColumns: (0, _arrays.createMatrixColumnsFun)()
  4985. },
  4986. $langLib: {
  4987. $isReal: (0, _lang.createIsRealFun)(),
  4988. $isInt: (0, _lang.createIsIntFun)(),
  4989. $isBool: (0, _lang.createIsBoolFun)(),
  4990. $castReal: (0, _lang.createCastRealFun)(),
  4991. $castInt: (0, _lang.createCastIntFun)(),
  4992. $castBool: (0, _lang.createCastBoolFun)(),
  4993. $castString: (0, _lang.createCastStringFun)()
  4994. }
  4995. };
  4996. var funcsObject = concatObjects(libsObject.$ioLib, libsObject.$langLib, libsObject.$strLib, libsObject.$arrayLib);
  4997. var LanguageDefinedFunction = exports.LanguageDefinedFunction = Object.freeze({
  4998. getMainFunctionName: function getMainFunctionName() {
  4999. return _languageService.LanguageService.getCurrentLangFuncs().main_function;
  5000. },
  5001. getInternalName: function getInternalName(localName) {
  5002. if (localName.indexOf(".") !== -1) {
  5003. var names = localName.split(".");
  5004. var lib = valueToKey(names[0], _languageService.LanguageService.getCurrentLangLibs());
  5005. var internalName = valueToKey(names[1], _languageService.LanguageService.getCurrentLangFuncs());
  5006. if (lib === null || internalName === null) {
  5007. return null;
  5008. }
  5009. return lib + "." + internalName;
  5010. }
  5011. var funcName = valueToKey(localName, _languageService.LanguageService.getCurrentLangFuncs());
  5012. if (funcName !== null) {
  5013. if (funcsObject[funcName]) {
  5014. return funcName;
  5015. }
  5016. }
  5017. return null;
  5018. },
  5019. getFunction: function getFunction(internalName) {
  5020. if (internalName.indexOf(".") !== -1) {
  5021. var names = internalName.split(".");
  5022. var libName = names[0];
  5023. var funName = names[1];
  5024. return libsObject[libName][funName];
  5025. }
  5026. return funcsObject[internalName];
  5027. }
  5028. });
  5029. /***/ }),
  5030. /***/ "./js/processor/error/processorErrorFactory.js":
  5031. /*!*****************************************************!*\
  5032. !*** ./js/processor/error/processorErrorFactory.js ***!
  5033. \*****************************************************/
  5034. /*! no static exports found */
  5035. /***/ (function(module, exports, __webpack_require__) {
  5036. "use strict";
  5037. Object.defineProperty(exports, "__esModule", {
  5038. value: true
  5039. });
  5040. exports.ProcessorErrorFactory = undefined;
  5041. var _runtimeError = __webpack_require__(/*! ./runtimeError */ "./js/processor/error/runtimeError.js");
  5042. var _semanticError = __webpack_require__(/*! ./semanticError */ "./js/processor/error/semanticError.js");
  5043. var _localizedStringsService = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  5044. var ProcessorErrorFactory = exports.ProcessorErrorFactory = Object.freeze({});
  5045. /***/ }),
  5046. /***/ "./js/processor/error/runtimeError.js":
  5047. /*!********************************************!*\
  5048. !*** ./js/processor/error/runtimeError.js ***!
  5049. \********************************************/
  5050. /*! no static exports found */
  5051. /***/ (function(module, exports, __webpack_require__) {
  5052. "use strict";
  5053. Object.defineProperty(exports, "__esModule", {
  5054. value: true
  5055. });
  5056. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5057. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5058. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5059. var RuntimeError = exports.RuntimeError = function (_Error) {
  5060. _inherits(RuntimeError, _Error);
  5061. function RuntimeError() {
  5062. var _ref;
  5063. _classCallCheck(this, RuntimeError);
  5064. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  5065. msg[_key] = arguments[_key];
  5066. }
  5067. var _this = _possibleConstructorReturn(this, (_ref = RuntimeError.__proto__ || Object.getPrototypeOf(RuntimeError)).call.apply(_ref, [this].concat(msg)));
  5068. if (Error.captureStackTrace) Error.captureStackTrace(_this, RuntimeError);
  5069. return _this;
  5070. }
  5071. return RuntimeError;
  5072. }(Error);
  5073. /***/ }),
  5074. /***/ "./js/processor/error/semanticError.js":
  5075. /*!*********************************************!*\
  5076. !*** ./js/processor/error/semanticError.js ***!
  5077. \*********************************************/
  5078. /*! no static exports found */
  5079. /***/ (function(module, exports, __webpack_require__) {
  5080. "use strict";
  5081. Object.defineProperty(exports, "__esModule", {
  5082. value: true
  5083. });
  5084. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5085. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5086. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5087. var SemanticError = exports.SemanticError = function (_Error) {
  5088. _inherits(SemanticError, _Error);
  5089. function SemanticError() {
  5090. var _ref;
  5091. _classCallCheck(this, SemanticError);
  5092. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  5093. msg[_key] = arguments[_key];
  5094. }
  5095. var _this = _possibleConstructorReturn(this, (_ref = SemanticError.__proto__ || Object.getPrototypeOf(SemanticError)).call.apply(_ref, [this].concat(msg)));
  5096. if (Error.captureStackTrace) Error.captureStackTrace(_this, SemanticError);
  5097. return _this;
  5098. }
  5099. return SemanticError;
  5100. }(Error);
  5101. /***/ }),
  5102. /***/ "./js/processor/ivprogProcessor.js":
  5103. /*!*****************************************!*\
  5104. !*** ./js/processor/ivprogProcessor.js ***!
  5105. \*****************************************/
  5106. /*! no static exports found */
  5107. /***/ (function(module, exports, __webpack_require__) {
  5108. "use strict";
  5109. Object.defineProperty(exports, "__esModule", {
  5110. value: true
  5111. });
  5112. exports.IVProgProcessor = undefined;
  5113. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5114. var _store = __webpack_require__(/*! ./store/store */ "./js/processor/store/store.js");
  5115. var _storeObject = __webpack_require__(/*! ./store/storeObject */ "./js/processor/store/storeObject.js");
  5116. var _storeObjectArray = __webpack_require__(/*! ./store/storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  5117. var _storeObjectRef = __webpack_require__(/*! ./store/storeObjectRef */ "./js/processor/store/storeObjectRef.js");
  5118. var _modes = __webpack_require__(/*! ./modes */ "./js/processor/modes.js");
  5119. var _context = __webpack_require__(/*! ./context */ "./js/processor/context.js");
  5120. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  5121. var _operators = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  5122. var _definedFunctions = __webpack_require__(/*! ./definedFunctions */ "./js/processor/definedFunctions.js");
  5123. var _compatibilityTable = __webpack_require__(/*! ./compatibilityTable */ "./js/processor/compatibilityTable.js");
  5124. var _commands = __webpack_require__(/*! ./../ast/commands/ */ "./js/ast/commands/index.js");
  5125. var Commands = _interopRequireWildcard(_commands);
  5126. var _expressions = __webpack_require__(/*! ./../ast/expressions/ */ "./js/ast/expressions/index.js");
  5127. var Expressions = _interopRequireWildcard(_expressions);
  5128. var _storeObjectArrayAddress = __webpack_require__(/*! ./store/storeObjectArrayAddress */ "./js/processor/store/storeObjectArrayAddress.js");
  5129. var _storeObjectArrayAddressRef = __webpack_require__(/*! ./store/storeObjectArrayAddressRef */ "./js/processor/store/storeObjectArrayAddressRef.js");
  5130. var _compoundType = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  5131. var _parsers = __webpack_require__(/*! ../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  5132. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  5133. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5134. var loopTimeoutMs = 10000;
  5135. var IVProgProcessor = exports.IVProgProcessor = function () {
  5136. _createClass(IVProgProcessor, null, [{
  5137. key: 'LOOP_TIMEOUT',
  5138. get: function get() {
  5139. return loopTimeoutMs;
  5140. },
  5141. set: function set(ms) {
  5142. loopTimeoutMs = ms;
  5143. }
  5144. }]);
  5145. function IVProgProcessor(ast) {
  5146. _classCallCheck(this, IVProgProcessor);
  5147. this.ast = ast;
  5148. this.globalStore = null;
  5149. this.stores = null;
  5150. this.context = null;
  5151. this.input = null;
  5152. this.forceKill = false;
  5153. this.loopTimers = [];
  5154. this.output = null;
  5155. }
  5156. _createClass(IVProgProcessor, [{
  5157. key: 'registerInput',
  5158. value: function registerInput(input) {
  5159. if (this.input !== null) this.input = null;
  5160. this.input = input;
  5161. }
  5162. }, {
  5163. key: 'registerOutput',
  5164. value: function registerOutput(output) {
  5165. if (this.output !== null) this.output = null;
  5166. this.output = output;
  5167. }
  5168. }, {
  5169. key: 'checkContext',
  5170. value: function checkContext(context) {
  5171. return this.context[this.context.length - 1] === context;
  5172. }
  5173. }, {
  5174. key: 'ignoreSwitchCases',
  5175. value: function ignoreSwitchCases(store) {
  5176. if (store.mode === _modes.Modes.RETURN) {
  5177. return true;
  5178. } else if (store.mode === _modes.Modes.BREAK) {
  5179. return true;
  5180. } else {
  5181. return false;
  5182. }
  5183. }
  5184. }, {
  5185. key: 'prepareState',
  5186. value: function prepareState() {
  5187. if (this.stores !== null) {
  5188. for (var i = 0; i < this.stores.length; i++) {
  5189. delete this.stores[i];
  5190. }
  5191. this.stores = null;
  5192. }
  5193. if (this.globalStore !== null) this.globalStore = null;
  5194. this.globalStore = new _store.Store();
  5195. this.stores = [this.globalStore];
  5196. this.context = [_context.Context.BASE];
  5197. }
  5198. }, {
  5199. key: 'interpretAST',
  5200. value: function interpretAST() {
  5201. this.prepareState();
  5202. this.initGlobal();
  5203. var mainFunc = this.findMainFunction();
  5204. if (mainFunc === null) {
  5205. // TODO: Better error message
  5206. throw new Error("Missing main funciton.");
  5207. }
  5208. return this.runFunction(mainFunc, [], this.globalStore);
  5209. }
  5210. }, {
  5211. key: 'initGlobal',
  5212. value: function initGlobal() {
  5213. var _this = this;
  5214. if (!this.checkContext(_context.Context.BASE)) {
  5215. throw new Error("!!!CRITICAL: Invalid call to initGlobal outside BASE context!!!");
  5216. }
  5217. this.ast.global.forEach(function (decl) {
  5218. _this.executeCommand(_this.globalStore, decl).then(function (sto) {
  5219. return _this.globalStore = sto;
  5220. });
  5221. });
  5222. }
  5223. }, {
  5224. key: 'findMainFunction',
  5225. value: function findMainFunction() {
  5226. return this.ast.functions.find(function (v) {
  5227. return v.isMain;
  5228. });
  5229. }
  5230. }, {
  5231. key: 'findFunction',
  5232. value: function findFunction(name) {
  5233. if (name.match(/^\$.+$/)) {
  5234. var fun = _definedFunctions.LanguageDefinedFunction.getFunction(name);
  5235. if (!!!fun) {
  5236. throw new Error("!!!Internal Error. Language defined function not implemented -> " + name + "!!!");
  5237. }
  5238. return fun;
  5239. } else {
  5240. var val = this.ast.functions.find(function (v) {
  5241. return v.name === name;
  5242. });
  5243. if (!!!val) {
  5244. // TODO: better error message;
  5245. throw new Error('Function ' + name + ' is not defined.');
  5246. }
  5247. return val;
  5248. }
  5249. }
  5250. }, {
  5251. key: 'runFunction',
  5252. value: function runFunction(func, actualParameters, store) {
  5253. var _this2 = this;
  5254. var funcStore = new _store.Store();
  5255. funcStore.extendStore(this.globalStore);
  5256. var returnStoreObject = null;
  5257. if (func.returnType instanceof _compoundType.CompoundType) {
  5258. if (func.returnType.dimensions > 1) {
  5259. returnStoreObject = new _storeObjectArray.StoreObjectArray(func.returnType, -1, -1, [[]]);
  5260. } else {
  5261. returnStoreObject = new _storeObjectArray.StoreObjectArray(func.returnType, -1, null, []);
  5262. }
  5263. } else {
  5264. returnStoreObject = new _storeObject.StoreObject(func.returnType, null);
  5265. }
  5266. var funcName = func.isMain ? 'main' : func.name;
  5267. var funcNameStoreObject = new _storeObject.StoreObject(_types.Types.STRING, funcName, true);
  5268. funcStore.insertStore('$', returnStoreObject);
  5269. funcStore.insertStore('$name', funcNameStoreObject);
  5270. var newFuncStore$ = this.associateParameters(func.formalParameters, actualParameters, store, funcStore);
  5271. return newFuncStore$.then(function (sto) {
  5272. _this2.context.push(_context.Context.FUNCTION);
  5273. _this2.stores.push(sto);
  5274. return _this2.executeCommands(sto, func.variablesDeclarations).then(function (stoWithVars) {
  5275. return _this2.executeCommands(stoWithVars, func.commands);
  5276. }).then(function (finalSto) {
  5277. _this2.stores.pop();
  5278. _this2.context.pop();
  5279. return finalSto;
  5280. });
  5281. });
  5282. }
  5283. }, {
  5284. key: 'associateParameters',
  5285. value: function associateParameters(formalList, actualList, callerStore, calleeStore) {
  5286. var _this3 = this;
  5287. if (formalList.length != actualList.length) {
  5288. // TODO: Better error message
  5289. throw new Error("Numbers of parameters doesn't match");
  5290. }
  5291. var promises$ = actualList.map(function (actualParameter) {
  5292. return _this3.evaluateExpression(callerStore, actualParameter);
  5293. });
  5294. return Promise.all(promises$).then(function (values) {
  5295. for (var i = 0; i < values.length; i++) {
  5296. var stoObj = values[i];
  5297. var formalParameter = formalList[i];
  5298. if (formalParameter.type.isCompatible(stoObj.type)) {
  5299. if (formalParameter.byRef && !stoObj.inStore) {
  5300. throw new Error('You must inform a variable as parameter');
  5301. }
  5302. if (formalParameter.byRef) {
  5303. var ref = null;
  5304. if (stoObj instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  5305. ref = new _storeObjectArrayAddressRef.StoreObjectArrayAddressRef(stoObj);
  5306. } else {
  5307. ref = new _storeObjectRef.StoreObjectRef(stoObj.id, callerStore);
  5308. }
  5309. calleeStore.insertStore(formalParameter.id, ref);
  5310. } else {
  5311. var realValue = _this3.parseStoreObjectValue(stoObj);
  5312. calleeStore.insertStore(formalParameter.id, realValue);
  5313. }
  5314. } else {
  5315. throw new Error('Parameter ' + formalParameter.id + ' is not compatible with the value given.');
  5316. }
  5317. }
  5318. return calleeStore;
  5319. });
  5320. }
  5321. }, {
  5322. key: 'executeCommands',
  5323. value: function executeCommands(store, cmds) {
  5324. // helper to partially apply a function, in this case executeCommand
  5325. var outerRef = this;
  5326. var partial = function partial(fun, cmd) {
  5327. return function (sto) {
  5328. return fun(sto, cmd);
  5329. };
  5330. };
  5331. return cmds.reduce(function (lastCommand, next) {
  5332. var nextCommand = partial(outerRef.executeCommand.bind(outerRef), next);
  5333. return lastCommand.then(nextCommand);
  5334. }, Promise.resolve(store));
  5335. }
  5336. }, {
  5337. key: 'executeCommand',
  5338. value: function executeCommand(store, cmd) {
  5339. if (this.forceKill) {
  5340. return Promise.reject("Interrupção forçada do programa!");
  5341. } else if (store.mode === _modes.Modes.PAUSE) {
  5342. return Promise.resolve(this.executeCommand(store, cmd));
  5343. } else if (store.mode === _modes.Modes.RETURN) {
  5344. return Promise.resolve(store);
  5345. } else if (this.checkContext(_context.Context.BREAKABLE) && store.mode === _modes.Modes.BREAK) {
  5346. return Promise.resolve(store);
  5347. }
  5348. if (cmd instanceof Commands.Declaration) {
  5349. return this.executeDeclaration(store, cmd);
  5350. } else if (cmd instanceof Commands.ArrayIndexAssign) {
  5351. return this.executeArrayIndexAssign(store, cmd);
  5352. } else if (cmd instanceof Commands.Assign) {
  5353. return this.executeAssign(store, cmd);
  5354. } else if (cmd instanceof Commands.Break) {
  5355. return this.executeBreak(store, cmd);
  5356. } else if (cmd instanceof Commands.Return) {
  5357. return this.executeReturn(store, cmd);
  5358. } else if (cmd instanceof Commands.IfThenElse) {
  5359. return this.executeIfThenElse(store, cmd);
  5360. } else if (cmd instanceof Commands.While) {
  5361. return this.executeWhile(store, cmd);
  5362. } else if (cmd instanceof Commands.DoWhile) {
  5363. return this.executeDoWhile(store, cmd);
  5364. } else if (cmd instanceof Commands.For) {
  5365. return this.executeFor(store, cmd);
  5366. } else if (cmd instanceof Commands.Switch) {
  5367. return this.executeSwitch(store, cmd);
  5368. } else if (cmd instanceof Commands.FunctionCall) {
  5369. return this.executeFunctionCall(store, cmd);
  5370. } else if (cmd instanceof Commands.SysCall) {
  5371. return this.executeSysCall(store, cmd);
  5372. } else {
  5373. throw new Error("!!!CRITICAL A unknown command was found!!!\n" + cmd);
  5374. }
  5375. }
  5376. }, {
  5377. key: 'executeSysCall',
  5378. value: function executeSysCall(store, cmd) {
  5379. var func = cmd.langFunc.bind(this);
  5380. return func(store, cmd);
  5381. }
  5382. }, {
  5383. key: 'executeFunctionCall',
  5384. value: function executeFunctionCall(store, cmd) {
  5385. var func = this.findFunction(cmd.id);
  5386. return this.runFunction(func, cmd.actualParameters, store).then(function (sto) {
  5387. if (!_types.Types.VOID.isCompatible(func.returnType) && sto.mode !== _modes.Modes.RETURN) {
  5388. // TODO: better error message
  5389. return Promise.reject(new Error('Function ' + func.name + ' must have a return command'));
  5390. } else {
  5391. return store;
  5392. }
  5393. });
  5394. }
  5395. }, {
  5396. key: 'executeSwitch',
  5397. value: function executeSwitch(store, cmd) {
  5398. var _this4 = this;
  5399. this.context.push(_context.Context.BREAKABLE);
  5400. var auxCaseFun = function auxCaseFun(promise, switchExp, aCase) {
  5401. return promise.then(function (result) {
  5402. var sto = result.sto;
  5403. if (_this4.ignoreSwitchCases(sto)) {
  5404. return Promise.resolve(result);
  5405. } else if (result.wasTrue || aCase.isDefault) {
  5406. var $newSto = _this4.executeCommands(result.sto, aCase.commands);
  5407. return $newSto.then(function (nSto) {
  5408. return Promise.resolve({ wasTrue: true, sto: nSto });
  5409. });
  5410. } else {
  5411. var $value = _this4.evaluateExpression(sto, new Expressions.InfixApp(_operators.Operators.EQ, switchExp, aCase.expression));
  5412. return $value.then(function (vl) {
  5413. if (vl.value) {
  5414. var _$newSto = _this4.executeCommands(result.sto, aCase.commands);
  5415. return _$newSto.then(function (nSto) {
  5416. return Promise.resolve({ wasTrue: true, sto: nSto });
  5417. });
  5418. } else {
  5419. return Promise.resolve({ wasTrue: false, sto: sto });
  5420. }
  5421. });
  5422. }
  5423. });
  5424. };
  5425. try {
  5426. var breakLoop = false;
  5427. var $result = Promise.resolve({ wasTrue: false, sto: store });
  5428. for (var index = 0; index < cmd.cases.length && !breakLoop; index++) {
  5429. var aCase = cmd.cases[index];
  5430. $result = auxCaseFun($result, cmd.expression, aCase);
  5431. $result.then(function (r) {
  5432. return breakLoop = _this4.ignoreSwitchCases(r.sto);
  5433. });
  5434. }
  5435. return $result.then(function (r) {
  5436. _this4.context.pop();
  5437. if (r.sto.mode === _modes.Modes.BREAK) {
  5438. r.sto.mode = _modes.Modes.RUN;
  5439. }
  5440. return r.sto;
  5441. });
  5442. } catch (error) {
  5443. return Promise.reject(error);
  5444. }
  5445. }
  5446. }, {
  5447. key: 'executeFor',
  5448. value: function executeFor(store, cmd) {
  5449. try {
  5450. //BEGIN for -> while rewrite
  5451. var initCmd = cmd.assignment;
  5452. var condition = cmd.condition;
  5453. var increment = cmd.increment;
  5454. var whileBlock = new Commands.CommandBlock([], cmd.commands.concat(increment));
  5455. var forAsWhile = new Commands.While(condition, whileBlock);
  5456. //END for -> while rewrite
  5457. var newCmdList = [initCmd, forAsWhile];
  5458. return this.executeCommands(store, newCmdList);
  5459. } catch (error) {
  5460. return Promise.reject(error);
  5461. }
  5462. }
  5463. }, {
  5464. key: 'executeDoWhile',
  5465. value: function executeDoWhile(store, cmd) {
  5466. var outerRef = this;
  5467. try {
  5468. outerRef.loopTimers.push(Date.now());
  5469. outerRef.context.push(_context.Context.BREAKABLE);
  5470. var $newStore = outerRef.executeCommands(store, cmd.commands);
  5471. return $newStore.then(function (sto) {
  5472. if (sto.mode === _modes.Modes.BREAK) {
  5473. outerRef.context.pop();
  5474. sto.mode = _modes.Modes.RUN;
  5475. outerRef.loopTimers.pop();
  5476. return sto;
  5477. }
  5478. var $value = outerRef.evaluateExpression(sto, cmd.expression);
  5479. return $value.then(function (vl) {
  5480. if (!vl.type.isCompatible(_types.Types.BOOLEAN)) {
  5481. // TODO: Better error message -- Inform line and column from token!!!!
  5482. // THIS IF SHOULD BE IN A SEMANTIC ANALYSER
  5483. return Promise.reject(new Error('DoWhile expression must be of type boolean'));
  5484. }
  5485. if (vl.value) {
  5486. outerRef.context.pop();
  5487. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  5488. var time = outerRef.loopTimers[i];
  5489. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  5490. console.log("Kill by Timeout...");
  5491. outerRef.forceKill = true;
  5492. return Promise.reject(new Error("Potential endless loop detected."));
  5493. }
  5494. }
  5495. return outerRef.executeCommand(sto, cmd);
  5496. } else {
  5497. outerRef.context.pop();
  5498. outerRef.loopTimers.pop();
  5499. console.log("Clear Timeout...");
  5500. return sto;
  5501. }
  5502. });
  5503. });
  5504. } catch (error) {
  5505. return Promise.reject(error);
  5506. }
  5507. }
  5508. }, {
  5509. key: 'executeWhile',
  5510. value: function executeWhile(store, cmd) {
  5511. var outerRef = this;
  5512. try {
  5513. outerRef.loopTimers.push(Date.now());
  5514. outerRef.context.push(_context.Context.BREAKABLE);
  5515. var $value = outerRef.evaluateExpression(store, cmd.expression);
  5516. return $value.then(function (vl) {
  5517. if (vl.type.isCompatible(_types.Types.BOOLEAN)) {
  5518. if (vl.value) {
  5519. var $newStore = outerRef.executeCommands(store, cmd.commands);
  5520. return $newStore.then(function (sto) {
  5521. outerRef.context.pop();
  5522. if (sto.mode === _modes.Modes.BREAK) {
  5523. outerRef.loopTimers.pop();
  5524. sto.mode = _modes.Modes.RUN;
  5525. return sto;
  5526. }
  5527. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  5528. var time = outerRef.loopTimers[i];
  5529. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  5530. console.log("Kill by Timeout...");
  5531. outerRef.forceKill = true;
  5532. return Promise.reject(new Error("Potential endless loop detected."));
  5533. }
  5534. }
  5535. return outerRef.executeCommand(sto, cmd);
  5536. });
  5537. } else {
  5538. outerRef.context.pop();
  5539. outerRef.loopTimers.pop();
  5540. console.log("Clear Timeout...");
  5541. return store;
  5542. }
  5543. } else {
  5544. // TODO: Better error message -- Inform line and column from token!!!!
  5545. // THIS IF SHOULD BE IN A SEMANTIC ANALYSER
  5546. return Promise.reject(new Error('Loop condition must be of type boolean'));
  5547. }
  5548. });
  5549. } catch (error) {
  5550. return Promise.reject(error);
  5551. }
  5552. }
  5553. }, {
  5554. key: 'executeIfThenElse',
  5555. value: function executeIfThenElse(store, cmd) {
  5556. var _this5 = this;
  5557. try {
  5558. var $value = this.evaluateExpression(store, cmd.condition);
  5559. return $value.then(function (vl) {
  5560. if (vl.type.isCompatible(_types.Types.BOOLEAN)) {
  5561. if (vl.value) {
  5562. return _this5.executeCommands(store, cmd.ifTrue.commands);
  5563. } else if (cmd.ifFalse !== null) {
  5564. if (cmd.ifFalse instanceof Commands.IfThenElse) {
  5565. return _this5.executeCommand(store, cmd.ifFalse);
  5566. } else {
  5567. return _this5.executeCommands(store, cmd.ifFalse.commands);
  5568. }
  5569. } else {
  5570. return Promise.resolve(store);
  5571. }
  5572. } else {
  5573. // TODO: Better error message -- Inform line and column from token!!!!
  5574. // THIS IF SHOULD BE IN A SEMANTIC ANALYSER
  5575. return Promise.reject(new Error('If expression must be of type boolean'));
  5576. }
  5577. });
  5578. } catch (error) {
  5579. return Promise.reject(error);
  5580. }
  5581. }
  5582. }, {
  5583. key: 'executeReturn',
  5584. value: function executeReturn(store, cmd) {
  5585. var _this6 = this;
  5586. try {
  5587. var funcType = store.applyStore('$');
  5588. var $value = this.evaluateExpression(store, cmd.expression);
  5589. var funcName = store.applyStore('$name');
  5590. return $value.then(function (vl) {
  5591. if (vl === null && funcType.isCompatible(_types.Types.VOID)) {
  5592. return Promise.resolve(store);
  5593. }
  5594. if (vl === null || !funcType.type.isCompatible(vl.type)) {
  5595. // TODO: Better error message -- Inform line and column from token!!!!
  5596. // THIS IF SHOULD BE IN A SEMANTIC ANALYSER
  5597. return Promise.reject(new Error('Function ' + funcName.value + ' must return ' + funcType.type + ' instead of ' + vl.type + '.'));
  5598. } else {
  5599. var realValue = _this6.parseStoreObjectValue(vl);
  5600. store.updateStore('$', realValue);
  5601. store.mode = _modes.Modes.RETURN;
  5602. return Promise.resolve(store);
  5603. }
  5604. });
  5605. } catch (error) {
  5606. return Promise.reject(error);
  5607. }
  5608. }
  5609. }, {
  5610. key: 'executeBreak',
  5611. value: function executeBreak(store, _) {
  5612. if (this.checkContext(_context.Context.BREAKABLE)) {
  5613. store.mode = _modes.Modes.BREAK;
  5614. return Promise.resolve(store);
  5615. } else {
  5616. return Promise.reject(new Error("!!!CRITIAL: Break command outside Loop/Switch scope!!!"));
  5617. }
  5618. }
  5619. }, {
  5620. key: 'executeAssign',
  5621. value: function executeAssign(store, cmd) {
  5622. var _this7 = this;
  5623. try {
  5624. var $value = this.evaluateExpression(store, cmd.expression);
  5625. return $value.then(function (vl) {
  5626. var realValue = _this7.parseStoreObjectValue(vl);
  5627. store.updateStore(cmd.id, realValue);
  5628. return store;
  5629. });
  5630. } catch (error) {
  5631. return Promise.reject(error);
  5632. }
  5633. }
  5634. }, {
  5635. key: 'executeArrayIndexAssign',
  5636. value: function executeArrayIndexAssign(store, cmd) {
  5637. var _this8 = this;
  5638. var mustBeArray = store.applyStore(cmd.id);
  5639. if (!(mustBeArray.type instanceof _compoundType.CompoundType)) {
  5640. return Promise.reject(new Error(cmd.id + " is not a vector/matrix"));
  5641. }
  5642. var line$ = this.evaluateExpression(store, cmd.line);
  5643. var column$ = this.evaluateExpression(store, cmd.column);
  5644. var value$ = this.evaluateExpression(store, cmd.expression);
  5645. return Promise.all([line$, column$, value$]).then(function (results) {
  5646. var lineSO = results[0];
  5647. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  5648. // TODO: better error message
  5649. //SHOULD NOT BE HERE. IT MUST HAVE A SEMANTIC ANALYSIS
  5650. return Promise.reject(new Error("Array dimension must be of type int"));
  5651. }
  5652. var line = lineSO.number;
  5653. var columnSO = results[1];
  5654. var column = null;
  5655. if (columnSO !== null) {
  5656. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  5657. // TODO: better error message
  5658. //SHOULD NOT BE HERE. IT MUST HAVE A SEMANTIC ANALYSIS
  5659. return Promise.reject(new Error("Array dimension must be of type int"));
  5660. }
  5661. column = columnSO.number;
  5662. }
  5663. var value = _this8.parseStoreObjectValue(results[2]);
  5664. if (line >= mustBeArray.lines) {
  5665. // TODO: better error message
  5666. return Promise.reject(new Error(exp.id + ': index out of bounds: ' + lines));
  5667. }
  5668. if (column !== null && mustBeArray.columns === null) {
  5669. // TODO: better error message
  5670. return Promise.reject(new Error(exp.id + ': index out of bounds: ' + column));
  5671. }
  5672. if (column !== null && column >= mustBeArray.columns) {
  5673. // TODO: better error message
  5674. return Promise.reject(new Error(exp.id + ': index out of bounds: ' + column));
  5675. }
  5676. var newArray = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), mustBeArray);
  5677. if (column !== null) {
  5678. if (value.type instanceof _compoundType.CompoundType) {
  5679. return Promise.reject(new Error("Invalid operation. This must be a value: line " + cmd.sourceInfo.line));
  5680. }
  5681. newArray.value[line].value[column] = value;
  5682. store.updateStore(cmd.id, newArray);
  5683. } else {
  5684. if (mustBeArray.columns !== null && value.type instanceof _compoundType.CompoundType) {
  5685. return Promise.reject(new Error("Invalid operation. This must be a vector: line " + cmd.sourceInfo.line));
  5686. }
  5687. newArray.value[line] = value;
  5688. store.updateStore(cmd.id, newArray);
  5689. }
  5690. return store;
  5691. });
  5692. }
  5693. }, {
  5694. key: 'executeDeclaration',
  5695. value: function executeDeclaration(store, cmd) {
  5696. try {
  5697. var $value = this.evaluateExpression(store, cmd.initial);
  5698. if (cmd instanceof Commands.ArrayDeclaration) {
  5699. var $lines = this.evaluateExpression(store, cmd.lines);
  5700. var $columns = cmd.columns === null ? null : this.evaluateExpression(store, cmd.columns);
  5701. return Promise.all([$lines, $columns, $value]).then(function (values) {
  5702. var lineSO = values[0];
  5703. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  5704. // TODO: better error message
  5705. //SHOULD NOT BE HERE. IT MUST HAVE A SEMANTIC ANALYSIS
  5706. return Promise.reject(new Error("Array dimension must be of type int"));
  5707. }
  5708. var line = lineSO.number;
  5709. var columnSO = values[1];
  5710. var column = null;
  5711. if (columnSO !== null) {
  5712. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  5713. // TODO: better error message
  5714. //SHOULD NOT BE HERE. IT MUST HAVE A SEMANTIC ANALYSIS
  5715. return Promise.reject(new Error("Array dimension must be of type int"));
  5716. }
  5717. column = columnSO.number;
  5718. }
  5719. var value = values[2];
  5720. var temp = new _storeObjectArray.StoreObjectArray(cmd.type, line, column, null);
  5721. store.insertStore(cmd.id, temp);
  5722. var realValue = value;
  5723. if (value !== null) {
  5724. if (value instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  5725. if (value.type instanceof _compoundType.CompoundType) {
  5726. realValue = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), value.refValue);
  5727. } else {
  5728. realValue = Object.assign(new _storeObject.StoreObject(null, null), value.refValue);
  5729. }
  5730. }
  5731. } else {
  5732. realValue = new _storeObjectArray.StoreObjectArray(cmd.type, line, column, []);
  5733. if (column !== null) {
  5734. for (var i = 0; i < line; i++) {
  5735. realValue.value.push(new _storeObjectArray.StoreObjectArray(new _compoundType.CompoundType(cmd.type.innerType, 1), column, null, []));
  5736. }
  5737. }
  5738. }
  5739. realValue.readOnly = cmd.isConst;
  5740. store.updateStore(cmd.id, realValue);
  5741. return store;
  5742. });
  5743. } else {
  5744. var temp = new _storeObject.StoreObject(cmd.type, null);
  5745. store.insertStore(cmd.id, temp);
  5746. return $value.then(function (vl) {
  5747. var realValue = vl;
  5748. if (vl !== null) {
  5749. if (vl instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  5750. if (vl.type instanceof _compoundType.CompoundType) {
  5751. realValue = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), vl.refValue);
  5752. } else {
  5753. realValue = Object.assign(new _storeObject.StoreObject(null, null), vl.refValue);
  5754. }
  5755. }
  5756. } else {
  5757. realValue = new _storeObject.StoreObject(cmd.type, 0);
  5758. }
  5759. realValue.readOnly = cmd.isConst;
  5760. store.updateStore(cmd.id, realValue);
  5761. return store;
  5762. });
  5763. }
  5764. } catch (e) {
  5765. return Promise.reject(e);
  5766. }
  5767. }
  5768. }, {
  5769. key: 'evaluateExpression',
  5770. value: function evaluateExpression(store, exp) {
  5771. if (exp instanceof Expressions.UnaryApp) {
  5772. return this.evaluateUnaryApp(store, exp);
  5773. } else if (exp instanceof Expressions.InfixApp) {
  5774. return this.evaluateInfixApp(store, exp);
  5775. } else if (exp instanceof Expressions.ArrayAccess) {
  5776. return this.evaluateArrayAccess(store, exp);
  5777. } else if (exp instanceof Expressions.VariableLiteral) {
  5778. return this.evaluateVariableLiteral(store, exp);
  5779. } else if (exp instanceof Expressions.IntLiteral) {
  5780. return this.evaluateLiteral(store, exp);
  5781. } else if (exp instanceof Expressions.RealLiteral) {
  5782. return this.evaluateLiteral(store, exp);
  5783. } else if (exp instanceof Expressions.BoolLiteral) {
  5784. return this.evaluateLiteral(store, exp);
  5785. } else if (exp instanceof Expressions.StringLiteral) {
  5786. return this.evaluateLiteral(store, exp);
  5787. } else if (exp instanceof Expressions.ArrayLiteral) {
  5788. return this.evaluateArrayLiteral(store, exp);
  5789. } else if (exp instanceof Expressions.FunctionCall) {
  5790. return this.evaluateFunctionCall(store, exp);
  5791. }
  5792. return Promise.resolve(null);
  5793. }
  5794. }, {
  5795. key: 'evaluateFunctionCall',
  5796. value: function evaluateFunctionCall(store, exp) {
  5797. var func = this.findFunction(exp.id);
  5798. if (_types.Types.VOID.isCompatible(func.returnType)) {
  5799. // TODO: better error message
  5800. return Promise.reject(new Error('Function ' + exp.id + ' cannot be used inside an expression'));
  5801. }
  5802. var $newStore = this.runFunction(func, exp.actualParameters, store);
  5803. return $newStore.then(function (sto) {
  5804. if (sto.mode !== _modes.Modes.RETURN) {
  5805. return Promise.reject(new Error("The function that was called did not had a return command: " + exp.id));
  5806. }
  5807. var val = sto.applyStore('$');
  5808. if (val instanceof _storeObjectArray.StoreObjectArray) {
  5809. return Promise.resolve(Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null, null, null), val));
  5810. } else {
  5811. return Promise.resolve(Object.assign(new _storeObject.StoreObject(null, null), val));
  5812. }
  5813. });
  5814. }
  5815. }, {
  5816. key: 'evaluateArrayLiteral',
  5817. value: function evaluateArrayLiteral(store, exp) {
  5818. if (!exp.isVector) {
  5819. var $matrix = this.evaluateMatrix(store, exp.value);
  5820. return $matrix.then(function (list) {
  5821. var type = new _compoundType.CompoundType(list[0].type.innerType, 2);
  5822. var arr = new _storeObjectArray.StoreObjectArray(type, list.length, list[0].lines, list);
  5823. if (arr.isValid) return Promise.resolve(arr);else return Promise.reject(new Error('Invalid array'));
  5824. });
  5825. } else {
  5826. return this.evaluateVector(store, exp.value).then(function (list) {
  5827. var type = new _compoundType.CompoundType(list[0].type, 1);
  5828. var stoArray = new _storeObjectArray.StoreObjectArray(type, list.length, null, list);
  5829. if (stoArray.isValid) return Promise.resolve(stoArray);else return Promise.reject(new Error('Invalid array'));
  5830. });
  5831. }
  5832. }
  5833. }, {
  5834. key: 'evaluateVector',
  5835. value: function evaluateVector(store, exps) {
  5836. var _this9 = this;
  5837. return Promise.all(exps.map(function (exp) {
  5838. return _this9.evaluateExpression(store, exp);
  5839. }));
  5840. }
  5841. }, {
  5842. key: 'evaluateMatrix',
  5843. value: function evaluateMatrix(store, exps) {
  5844. var _this10 = this;
  5845. return Promise.all(exps.map(function (vector) {
  5846. var $vector = _this10.evaluateVector(store, vector.value);
  5847. return $vector.then(function (list) {
  5848. var type = new _compoundType.CompoundType(list[0].type, 1);
  5849. return new _storeObjectArray.StoreObjectArray(type, list.length, null, list);
  5850. });
  5851. }));
  5852. }
  5853. }, {
  5854. key: 'evaluateLiteral',
  5855. value: function evaluateLiteral(_, exp) {
  5856. return Promise.resolve(new _storeObject.StoreObject(exp.type, exp.value));
  5857. }
  5858. }, {
  5859. key: 'evaluateVariableLiteral',
  5860. value: function evaluateVariableLiteral(store, exp) {
  5861. try {
  5862. var val = store.applyStore(exp.id);
  5863. if (val instanceof _storeObjectArray.StoreObjectArray) {
  5864. return Promise.resolve(Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null, null), val));
  5865. } else {
  5866. return Promise.resolve(Object.assign(new _storeObject.StoreObject(null, null), val));
  5867. }
  5868. } catch (error) {
  5869. return Promise.reject(error);
  5870. }
  5871. }
  5872. }, {
  5873. key: 'evaluateArrayAccess',
  5874. value: function evaluateArrayAccess(store, exp) {
  5875. var mustBeArray = store.applyStore(exp.id);
  5876. if (!(mustBeArray.type instanceof _compoundType.CompoundType)) {
  5877. // TODO: better error message
  5878. console.log(mustBeArray.type);
  5879. return Promise.reject(new Error(exp.id + ' is not of type array'));
  5880. }
  5881. var $line = this.evaluateExpression(store, exp.line);
  5882. var $column = this.evaluateExpression(store, exp.column);
  5883. return Promise.all([$line, $column]).then(function (values) {
  5884. var lineSO = values[0];
  5885. var columnSO = values[1];
  5886. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  5887. // TODO: better error message
  5888. //SHOULD NOT BE HERE. IT MUST HAVE A SEMANTIC ANALYSIS
  5889. return Promise.reject(new Error("Array dimension must be of type int"));
  5890. }
  5891. var line = lineSO.number;
  5892. var column = null;
  5893. if (columnSO !== null) {
  5894. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  5895. // TODO: better error message
  5896. //SHOULD NOT BE HERE. IT MUST HAVE A SEMANTIC ANALYSIS
  5897. return Promise.reject(new Error("Array dimension must be of type int"));
  5898. }
  5899. column = columnSO.number;
  5900. }
  5901. if (line >= mustBeArray.lines) {
  5902. // TODO: better error message
  5903. return Promise.reject(new Error(exp.id + ': index out of bounds: ' + lines));
  5904. }
  5905. if (column !== null && mustBeArray.columns === null) {
  5906. // TODO: better error message
  5907. return Promise.reject(new Error(exp.id + ': index out of bounds: ' + column));
  5908. }
  5909. if (column !== null && column >= mustBeArray.columns) {
  5910. // TODO: better error message
  5911. return Promise.reject(new Error(exp.id + ': index out of bounds: ' + column));
  5912. }
  5913. return Promise.resolve(new _storeObjectArrayAddress.StoreObjectArrayAddress(mustBeArray.id, line, column, store));
  5914. });
  5915. }
  5916. }, {
  5917. key: 'evaluateUnaryApp',
  5918. value: function evaluateUnaryApp(store, unaryApp) {
  5919. var $left = this.evaluateExpression(store, unaryApp.left);
  5920. return $left.then(function (left) {
  5921. var resultType = (0, _compatibilityTable.resultTypeAfterUnaryOp)(unaryApp.op, left.type);
  5922. if (_types.Types.UNDEFINED.isCompatible(resultType)) {
  5923. // TODO: better urgent error message
  5924. return Promise.reject(new Error('Cannot use this op to ' + left.type));
  5925. }
  5926. switch (unaryApp.op.ord) {
  5927. case _operators.Operators.ADD.ord:
  5928. return new _storeObject.StoreObject(resultType, left.value);
  5929. case _operators.Operators.SUB.ord:
  5930. return new _storeObject.StoreObject(resultType, left.value.negated());
  5931. case _operators.Operators.NOT.ord:
  5932. return new _storeObject.StoreObject(resultType, !left.value);
  5933. default:
  5934. return Promise.reject(new Error('!!!Critical Invalid UnaryApp ' + unaryApp.op));
  5935. }
  5936. });
  5937. }
  5938. }, {
  5939. key: 'evaluateInfixApp',
  5940. value: function evaluateInfixApp(store, infixApp) {
  5941. var $left = this.evaluateExpression(store, infixApp.left);
  5942. var $right = this.evaluateExpression(store, infixApp.right);
  5943. return Promise.all([$left, $right]).then(function (values) {
  5944. var left = values[0];
  5945. var right = values[1];
  5946. var resultType = (0, _compatibilityTable.resultTypeAfterInfixOp)(infixApp.op, left.type, right.type);
  5947. if (_types.Types.UNDEFINED.isCompatible(resultType)) {
  5948. // TODO: better urgent error message
  5949. return Promise.reject(new Error('Cannot use this ' + infixApp.op + ' to ' + left.type + ' and ' + right.type));
  5950. }
  5951. var result = null;
  5952. switch (infixApp.op.ord) {
  5953. case _operators.Operators.ADD.ord:
  5954. {
  5955. if (_types.Types.STRING.isCompatible(left.type)) {
  5956. var rightStr = (0, _parsers.convertToString)(right.value, right.type);
  5957. return new _storeObject.StoreObject(resultType, left.value + rightStr);
  5958. } else if (_types.Types.STRING.isCompatible(right.type)) {
  5959. var leftStr = (0, _parsers.convertToString)(left.value, left.type);
  5960. return new _storeObject.StoreObject(resultType, leftStr + right.value);
  5961. } else {
  5962. return new _storeObject.StoreObject(resultType, left.value.plus(right.value));
  5963. }
  5964. }
  5965. case _operators.Operators.SUB.ord:
  5966. return new _storeObject.StoreObject(resultType, left.value.minus(right.value));
  5967. case _operators.Operators.MULT.ord:
  5968. return new _storeObject.StoreObject(resultType, left.value.times(right.value));
  5969. case _operators.Operators.DIV.ord:
  5970. {
  5971. result = left.value / right.value;
  5972. if (_types.Types.INTEGER.isCompatible(resultType)) result = left.value.divToInt(right.value);else result = left.value.div(right.value);
  5973. return new _storeObject.StoreObject(resultType, result);
  5974. }
  5975. case _operators.Operators.MOD.ord:
  5976. return new _storeObject.StoreObject(resultType, left.value.modulo(right.value));
  5977. case _operators.Operators.GT.ord:
  5978. {
  5979. if (_types.Types.STRING.isCompatible(left.type)) {
  5980. result = left.value.length > right.value.length;
  5981. } else {
  5982. result = left.value.gt(right.value);
  5983. }
  5984. return new _storeObject.StoreObject(resultType, result);
  5985. }
  5986. case _operators.Operators.GE.ord:
  5987. {
  5988. if (_types.Types.STRING.isCompatible(left.type)) {
  5989. result = left.value.length >= right.value.length;
  5990. } else {
  5991. result = left.value.gte(right.value);
  5992. }
  5993. return new _storeObject.StoreObject(resultType, result);
  5994. }
  5995. case _operators.Operators.LT.ord:
  5996. {
  5997. if (_types.Types.STRING.isCompatible(left.type)) {
  5998. result = left.value.length < right.value.length;
  5999. } else {
  6000. result = left.value.lt(right.value);
  6001. }
  6002. return new _storeObject.StoreObject(resultType, result);
  6003. }
  6004. case _operators.Operators.LE.ord:
  6005. {
  6006. if (_types.Types.STRING.isCompatible(left.type)) {
  6007. result = left.value.length <= right.value.length;
  6008. } else {
  6009. result = left.value.lte(right.value);
  6010. }
  6011. return new _storeObject.StoreObject(resultType, result);
  6012. }
  6013. case _operators.Operators.EQ.ord:
  6014. {
  6015. if (_types.Types.INTEGER.isCompatible(left.type) || _types.Types.REAL.isCompatible(left.type)) {
  6016. result = left.value.eq(right.value);
  6017. } else {
  6018. result = left.value === right.value;
  6019. }
  6020. return new _storeObject.StoreObject(resultType, result);
  6021. }
  6022. case _operators.Operators.NEQ.ord:
  6023. {
  6024. if (_types.Types.INTEGER.isCompatible(left.type) || _types.Types.REAL.isCompatible(left.type)) {
  6025. result = !left.value.eq(right.value);
  6026. } else {
  6027. result = left.value !== right.value;
  6028. }
  6029. return new _storeObject.StoreObject(resultType, result);
  6030. }
  6031. case _operators.Operators.AND.ord:
  6032. return new _storeObject.StoreObject(resultType, left.value && right.value);
  6033. case _operators.Operators.OR.ord:
  6034. return new _storeObject.StoreObject(resultType, left.value || right.value);
  6035. default:
  6036. return Promise.reject(new Error('!!!Critical Invalid InfixApp ' + infixApp.op));
  6037. }
  6038. });
  6039. }
  6040. }, {
  6041. key: 'parseStoreObjectValue',
  6042. value: function parseStoreObjectValue(vl) {
  6043. var realValue = vl;
  6044. if (vl instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  6045. if (vl.type instanceof _compoundType.CompoundType) {
  6046. switch (vl.type.dimensions) {
  6047. case 1:
  6048. {
  6049. realValue = new _storeObjectArray.StoreObjectArray(vl.type, vl.value);
  6050. break;
  6051. }
  6052. default:
  6053. {
  6054. throw new Error("Three dimensional array address...");
  6055. }
  6056. }
  6057. } else {
  6058. realValue = new _storeObject.StoreObject(vl.type, vl.value);
  6059. }
  6060. }
  6061. return realValue;
  6062. }
  6063. }]);
  6064. return IVProgProcessor;
  6065. }();
  6066. /***/ }),
  6067. /***/ "./js/processor/lib/arrays.js":
  6068. /*!************************************!*\
  6069. !*** ./js/processor/lib/arrays.js ***!
  6070. \************************************/
  6071. /*! no static exports found */
  6072. /***/ (function(module, exports, __webpack_require__) {
  6073. "use strict";
  6074. Object.defineProperty(exports, "__esModule", {
  6075. value: true
  6076. });
  6077. exports.createNumElementsFun = createNumElementsFun;
  6078. exports.createMatrixLinesFun = createMatrixLinesFun;
  6079. exports.createMatrixColumnsFun = createMatrixColumnsFun;
  6080. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  6081. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  6082. var Commands = _interopRequireWildcard(_commands);
  6083. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  6084. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  6085. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  6086. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  6087. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  6088. /**
  6089. * num_elements
  6090. * matrix_lines
  6091. * matrix_columns
  6092. */
  6093. function createNumElementsFun() {
  6094. var numElementsFun = function numElementsFun(sto, _) {
  6095. var vector = sto.applyStore("vector");
  6096. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(vector.lines));
  6097. sto.mode = _modes.Modes.RETURN;
  6098. return Promise.resolve(sto.updateStore("$", temp));
  6099. };
  6100. var block = new Commands.CommandBlock([], [new Commands.SysCall(numElementsFun)]);
  6101. var func = new Commands.Function('$numElements', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 1), 'vector', false)], block);
  6102. return func;
  6103. }
  6104. function createMatrixLinesFun() {
  6105. var matrixLinesFun = function matrixLinesFun(sto, _) {
  6106. var matrix = sto.applyStore("matrix");
  6107. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(matrix.lines));
  6108. sto.mode = _modes.Modes.RETURN;
  6109. return Promise.resolve(sto.updateStore("$", temp));
  6110. };
  6111. var block = new Commands.CommandBlock([], [new Commands.SysCall(matrixLinesFun)]);
  6112. var func = new Commands.Function('$matrixLines', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 2), 'matrix', false)], block);
  6113. return func;
  6114. }
  6115. function createMatrixColumnsFun() {
  6116. var matrixColumnsFun = function matrixColumnsFun(sto, _) {
  6117. var matrix = sto.applyStore("matrix");
  6118. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(matrix.columns));
  6119. sto.mode = _modes.Modes.RETURN;
  6120. return Promise.resolve(sto.updateStore("$", temp));
  6121. };
  6122. var block = new Commands.CommandBlock([], [new Commands.SysCall(matrixColumnsFun)]);
  6123. var func = new Commands.Function('$matrixColumns', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 2), 'matrix', false)], block);
  6124. return func;
  6125. }
  6126. /***/ }),
  6127. /***/ "./js/processor/lib/io.js":
  6128. /*!********************************!*\
  6129. !*** ./js/processor/lib/io.js ***!
  6130. \********************************/
  6131. /*! no static exports found */
  6132. /***/ (function(module, exports, __webpack_require__) {
  6133. "use strict";
  6134. Object.defineProperty(exports, "__esModule", {
  6135. value: true
  6136. });
  6137. exports.createOutputFun = createOutputFun;
  6138. exports.createInputFun = createInputFun;
  6139. var _storeObject = __webpack_require__(/*! ./../store/storeObject */ "./js/processor/store/storeObject.js");
  6140. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  6141. var Commands = _interopRequireWildcard(_commands);
  6142. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  6143. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  6144. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  6145. function createOutputFun() {
  6146. var writeFunction = function writeFunction(store, _) {
  6147. var val = store.applyStore('p1');
  6148. if (val.type.isCompatible(_types.Types.INTEGER)) {
  6149. this.output.sendOutput(val.value.toString());
  6150. } else if (val.type.isCompatible(_types.Types.REAL)) {
  6151. if (val.value.dp() <= 0) {
  6152. this.output.sendOutput(val.value.toFixed(1));
  6153. } else {
  6154. this.output.sendOutput(val.value.toString());
  6155. }
  6156. } else {
  6157. this.output.sendOutput(val.value);
  6158. }
  6159. return Promise.resolve(store);
  6160. };
  6161. var block = new Commands.CommandBlock([], [new Commands.SysCall(writeFunction)]);
  6162. var func = new Commands.Function('$write', _types.Types.VOID, [new Commands.FormalParameter(_types.Types.ALL, 'p1', false)], block);
  6163. return func;
  6164. }
  6165. function createInputFun() {
  6166. var readFunction = function readFunction(store, _) {
  6167. var _this = this;
  6168. var request = new Promise(function (resolve, _) {
  6169. _this.input.requestInput(resolve);
  6170. });
  6171. return request.then(function (text) {
  6172. var typeToConvert = store.applyStore('p1').type;
  6173. var stoObj = null;
  6174. if (typeToConvert.isCompatible(_types.Types.INTEGER)) {
  6175. var val = (0, _parsers.toInt)(text);
  6176. stoObj = new _storeObject.StoreObject(_types.Types.INTEGER, val);
  6177. } else if (typeToConvert.isCompatible(_types.Types.REAL)) {
  6178. stoObj = new _storeObject.StoreObject(_types.Types.REAL, (0, _parsers.toReal)(text));
  6179. } else if (typeToConvert.isCompatible(_types.Types.BOOLEAN)) {
  6180. stoObj = new _storeObject.StoreObject(_types.Types.BOOLEAN, (0, _parsers.toBool)(text));
  6181. } else if (typeToConvert.isCompatible(_types.Types.STRING)) {
  6182. stoObj = new _storeObject.StoreObject(_types.Types.STRING, (0, _parsers.toString)(text));
  6183. }
  6184. _this.loopTimers.splice(0, _this.loopTimers.length);
  6185. store.updateStore('p1', stoObj);
  6186. return Promise.resolve(store);
  6187. });
  6188. };
  6189. var block = new Commands.CommandBlock([], [new Commands.SysCall(readFunction)]);
  6190. var func = new Commands.Function('$read', _types.Types.VOID, [new Commands.FormalParameter(_types.Types.ALL, 'p1', true)], block);
  6191. return func;
  6192. }
  6193. /***/ }),
  6194. /***/ "./js/processor/lib/lang.js":
  6195. /*!**********************************!*\
  6196. !*** ./js/processor/lib/lang.js ***!
  6197. \**********************************/
  6198. /*! no static exports found */
  6199. /***/ (function(module, exports, __webpack_require__) {
  6200. "use strict";
  6201. Object.defineProperty(exports, "__esModule", {
  6202. value: true
  6203. });
  6204. exports.createIsRealFun = createIsRealFun;
  6205. exports.createIsIntFun = createIsIntFun;
  6206. exports.createIsBoolFun = createIsBoolFun;
  6207. exports.createCastRealFun = createCastRealFun;
  6208. exports.createCastIntFun = createCastIntFun;
  6209. exports.createCastBoolFun = createCastBoolFun;
  6210. exports.createCastStringFun = createCastStringFun;
  6211. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  6212. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  6213. var Commands = _interopRequireWildcard(_commands);
  6214. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  6215. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  6216. var _ivprogParser = __webpack_require__(/*! ../../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  6217. var _expressions = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  6218. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  6219. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  6220. /**
  6221. *
  6222. * is_real
  6223. * is_int
  6224. * is_bool
  6225. * cast_real
  6226. * cast_int
  6227. * cast_bool
  6228. * cast_string
  6229. */
  6230. function createIsRealFun() {
  6231. var isRealFun = function isRealFun(sto, _) {
  6232. var str = sto.applyStore("str");
  6233. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  6234. var result = false;
  6235. try {
  6236. var val = parser.parseTerm();
  6237. if (val instanceof _expressions.RealLiteral) {
  6238. result = true;
  6239. }
  6240. } catch (error) {}
  6241. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  6242. sto.mode = _modes.Modes.RETURN;
  6243. return Promise.resolve(sto.updateStore("$", temp));
  6244. };
  6245. var block = new Commands.CommandBlock([], [new Commands.SysCall(isRealFun)]);
  6246. var func = new Commands.Function('$isReal', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  6247. return func;
  6248. }
  6249. function createIsIntFun() {
  6250. var isIntFun = function isIntFun(sto, _) {
  6251. var str = sto.applyStore("str");
  6252. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  6253. var result = false;
  6254. try {
  6255. var val = parser.parseTerm();
  6256. if (val instanceof _expressions.IntLiteral) {
  6257. result = true;
  6258. }
  6259. } catch (error) {}
  6260. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  6261. sto.mode = _modes.Modes.RETURN;
  6262. return Promise.resolve(sto.updateStore("$", temp));
  6263. };
  6264. var block = new Commands.CommandBlock([], [new Commands.SysCall(isIntFun)]);
  6265. var func = new Commands.Function('$isInt', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  6266. return func;
  6267. }
  6268. function createIsBoolFun() {
  6269. var isBoolFun = function isBoolFun(sto, _) {
  6270. var str = sto.applyStore("str");
  6271. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  6272. var result = false;
  6273. try {
  6274. var val = parser.parseTerm();
  6275. if (val instanceof _expressions.BoolLiteral) {
  6276. result = true;
  6277. }
  6278. } catch (error) {}
  6279. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  6280. sto.mode = _modes.Modes.RETURN;
  6281. return Promise.resolve(sto.updateStore("$", temp));
  6282. };
  6283. var block = new Commands.CommandBlock([], [new Commands.SysCall(isBoolFun)]);
  6284. var func = new Commands.Function('$isBool', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  6285. return func;
  6286. }
  6287. function createCastRealFun() {
  6288. var castRealFun = function castRealFun(sto, _) {
  6289. var val = sto.applyStore("val");
  6290. switch (val.type.ord) {
  6291. case _types.Types.INTEGER.ord:
  6292. {
  6293. var temp = new _storeObject.StoreObject(_types.Types.REAL, (0, _parsers.toReal)(val.number));
  6294. sto.mode = _modes.Modes.RETURN;
  6295. return Promise.resolve(sto.updateStore("$", temp));
  6296. }
  6297. case _types.Types.STRING.ord:
  6298. {
  6299. var parser = _ivprogParser.IVProgParser.createParser(val.value);
  6300. try {
  6301. var result = parser.parseTerm();
  6302. if (result instanceof _expressions.RealLiteral) {
  6303. var _temp = new _storeObject.StoreObject(_types.Types.REAL, result.value);
  6304. sto.mode = _modes.Modes.RETURN;
  6305. return Promise.resolve(sto.updateStore("$", _temp));
  6306. }
  6307. } catch (error) {
  6308. return Promise.reject("cannot convert string to real");
  6309. }
  6310. }
  6311. }
  6312. };
  6313. var block = new Commands.CommandBlock([], [new Commands.SysCall(castRealFun)]);
  6314. var func = new Commands.Function('$castReal', _types.Types.REAL, [new Commands.FormalParameter(_types.Types.ALL, 'val', false)], block);
  6315. return func;
  6316. }
  6317. function createCastIntFun() {
  6318. var castIntFun = function castIntFun(sto, _) {
  6319. var val = sto.applyStore("val");
  6320. switch (val.type.ord) {
  6321. case _types.Types.REAL.ord:
  6322. {
  6323. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, Math.floor(val.number));
  6324. sto.mode = _modes.Modes.RETURN;
  6325. return Promise.resolve(sto.updateStore("$", temp));
  6326. }
  6327. case _types.Types.STRING.ord:
  6328. {
  6329. var parser = _ivprogParser.IVProgParser.createParser(val.value);
  6330. try {
  6331. var result = parser.parseTerm();
  6332. if (result instanceof _expressions.IntLiteral) {
  6333. var _temp2 = new _storeObject.StoreObject(_types.Types.INTEGER, result.value);
  6334. sto.mode = _modes.Modes.RETURN;
  6335. return Promise.resolve(sto.updateStore("$", _temp2));
  6336. }
  6337. } catch (error) {
  6338. return Promise.reject("cannot convert string to real");
  6339. }
  6340. }
  6341. }
  6342. };
  6343. var block = new Commands.CommandBlock([], [new Commands.SysCall(castIntFun)]);
  6344. var func = new Commands.Function('$castInt', _types.Types.INTEGER, [new Commands.FormalParameter(_types.Types.ALL, 'val', false)], block);
  6345. return func;
  6346. }
  6347. function createCastBoolFun() {
  6348. var castBoolFun = function castBoolFun(sto, _) {
  6349. var str = sto.applyStore("str");
  6350. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  6351. try {
  6352. var val = parser.parseTerm();
  6353. if (val instanceof _expressions.BoolLiteral) {
  6354. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, val.value);
  6355. sto.mode = _modes.Modes.RETURN;
  6356. return Promise.resolve(sto.updateStore("$", temp));
  6357. }
  6358. } catch (error) {}
  6359. return Promise.reject("cannot convert " + str.value + " to boolean");
  6360. };
  6361. var block = new Commands.CommandBlock([], [new Commands.SysCall(castBoolFun)]);
  6362. var func = new Commands.Function('$castBool', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  6363. return func;
  6364. }
  6365. function createCastStringFun() {
  6366. var castStringFun = function castStringFun(store, _) {
  6367. var val = store.applyStore('str');
  6368. var result = (0, _parsers.convertToString)(val);
  6369. var temp = new _storeObject.StoreObject(_types.Types.STRING, result);
  6370. sto.mode = _modes.Modes.RETURN;
  6371. return Promise.resolve(sto.updateStore("$", temp));
  6372. };
  6373. var block = new Commands.CommandBlock([], [new Commands.SysCall(castStringFun)]);
  6374. var func = new Commands.Function('$castString', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.ALL, 'str', false)], block);
  6375. return func;
  6376. }
  6377. /***/ }),
  6378. /***/ "./js/processor/lib/math.js":
  6379. /*!**********************************!*\
  6380. !*** ./js/processor/lib/math.js ***!
  6381. \**********************************/
  6382. /*! no static exports found */
  6383. /***/ (function(module, exports, __webpack_require__) {
  6384. "use strict";
  6385. Object.defineProperty(exports, "__esModule", {
  6386. value: true
  6387. });
  6388. exports.createSinFun = createSinFun;
  6389. exports.createCosFun = createCosFun;
  6390. exports.createTanFun = createTanFun;
  6391. exports.createSqrtFun = createSqrtFun;
  6392. exports.createPowFun = createPowFun;
  6393. exports.createLogFun = createLogFun;
  6394. exports.createAbsFun = createAbsFun;
  6395. exports.createNegateFun = createNegateFun;
  6396. exports.createInvertFun = createInvertFun;
  6397. exports.createMaxFun = createMaxFun;
  6398. exports.createMinFun = createMinFun;
  6399. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  6400. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  6401. var Commands = _interopRequireWildcard(_commands);
  6402. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  6403. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  6404. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  6405. var _multiType = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  6406. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  6407. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  6408. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  6409. function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  6410. /**
  6411. * sin
  6412. * cos
  6413. * tan
  6414. * sqrt
  6415. * pow
  6416. * log
  6417. * abs
  6418. * negate
  6419. * invert
  6420. * max
  6421. * min
  6422. */
  6423. function convertToRadians(degrees) {
  6424. return degrees.times(_decimal.Decimal.acos(-1)).div(180);
  6425. }
  6426. function createSinFun() {
  6427. var sinFun = function sinFun(sto, _) {
  6428. var x = sto.applyStore('x');
  6429. var result = _decimal.Decimal.sin(convertToRadians(x.value));
  6430. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  6431. sto.mode = _modes.Modes.RETURN;
  6432. return Promise.resolve(sto.updateStore('$', temp));
  6433. };
  6434. var block = new Commands.CommandBlock([], [new Commands.SysCall(sinFun)]);
  6435. var func = new Commands.Function('$sin', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  6436. return func;
  6437. }
  6438. function createCosFun() {
  6439. var cosFun = function cosFun(sto, _) {
  6440. var x = sto.applyStore('x');
  6441. var result = _decimal.Decimal.cos(convertToRadians(x.value));
  6442. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  6443. sto.mode = _modes.Modes.RETURN;
  6444. return Promise.resolve(sto.updateStore('$', temp));
  6445. };
  6446. var block = new Commands.CommandBlock([], [new Commands.SysCall(cosFun)]);
  6447. var func = new Commands.Function('$cos', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  6448. return func;
  6449. }
  6450. function createTanFun() {
  6451. var tanFun = function tanFun(sto, _) {
  6452. var x = sto.applyStore('x');
  6453. var result = _decimal.Decimal.tan(convertToRadians(x.value));
  6454. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  6455. sto.mode = _modes.Modes.RETURN;
  6456. return Promise.resolve(sto.updateStore('$', temp));
  6457. };
  6458. var block = new Commands.CommandBlock([], [new Commands.SysCall(tanFun)]);
  6459. var func = new Commands.Function('$tan', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  6460. return func;
  6461. }
  6462. function createSqrtFun() {
  6463. var sqrtFun = function sqrtFun(sto, _) {
  6464. var x = sto.applyStore('x');
  6465. var result = x.value.sqrt();
  6466. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  6467. sto.mode = _modes.Modes.RETURN;
  6468. return Promise.resolve(sto.updateStore('$', temp));
  6469. };
  6470. var block = new Commands.CommandBlock([], [new Commands.SysCall(sqrtFun)]);
  6471. var func = new Commands.Function('$sqrt', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  6472. return func;
  6473. }
  6474. function createPowFun() {
  6475. var powFun = function powFun(sto, _) {
  6476. var x = sto.applyStore('x');
  6477. var y = sto.applyStore('y');
  6478. var result = x.value.pow(y.value);
  6479. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  6480. sto.mode = _modes.Modes.RETURN;
  6481. return Promise.resolve(sto.updateStore('$', temp));
  6482. };
  6483. var block = new Commands.CommandBlock([], [new Commands.SysCall(powFun)]);
  6484. var func = new Commands.Function('$pow', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false), new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'y', false)], block);
  6485. return func;
  6486. }
  6487. function createLogFun() {
  6488. var logFun = function logFun(sto, _) {
  6489. var x = sto.applyStore('x');
  6490. if (x.value.isNegative()) {
  6491. return Promise.reject("the value passed to log function cannot be negative");
  6492. }
  6493. var result = _decimal.Decimal.log10(x.value);
  6494. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  6495. sto.mode = _modes.Modes.RETURN;
  6496. return Promise.resolve(sto.updateStore('$', temp));
  6497. };
  6498. var block = new Commands.CommandBlock([], [new Commands.SysCall(logFun)]);
  6499. var func = new Commands.Function('$log', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  6500. return func;
  6501. }
  6502. function createAbsFun() {
  6503. var absFun = function absFun(sto, _) {
  6504. var x = sto.applyStore('x');
  6505. var result = x.value.abs();
  6506. var temp = new _storeObject.StoreObject(x.type, result);
  6507. sto.mode = _modes.Modes.RETURN;
  6508. return Promise.resolve(sto.updateStore('$', temp));
  6509. };
  6510. var block = new Commands.CommandBlock([], [new Commands.SysCall(absFun)]);
  6511. var func = new Commands.Function('$abs', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  6512. return func;
  6513. }
  6514. function createNegateFun() {
  6515. var negateFun = function negateFun(sto, _) {
  6516. var x = sto.applyStore('x');
  6517. var result = x.value.negated();
  6518. var temp = new _storeObject.StoreObject(x.type, result);
  6519. sto.mode = _modes.Modes.RETURN;
  6520. return Promise.resolve(sto.updateStore('$', temp));
  6521. };
  6522. var block = new Commands.CommandBlock([], [new Commands.SysCall(negateFun)]);
  6523. var func = new Commands.Function('$negate', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  6524. return func;
  6525. }
  6526. function createInvertFun() {
  6527. var invertFun = function invertFun(sto, _) {
  6528. var x = sto.applyStore('x');
  6529. var result = (0, _parsers.toReal)(1).dividedBy(x.value);
  6530. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  6531. sto.mode = _modes.Modes.RETURN;
  6532. return Promise.resolve(sto.updateStore('$', temp));
  6533. };
  6534. var block = new Commands.CommandBlock([], [new Commands.SysCall(invertFun)]);
  6535. var func = new Commands.Function('$invert', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  6536. return func;
  6537. }
  6538. function createMaxFun() {
  6539. var maxFun = function maxFun(sto, _) {
  6540. var x = sto.applyStore('x');
  6541. var numbers = x.value.map(function (stoObj) {
  6542. return stoObj.value;
  6543. });
  6544. var result = _decimal.Decimal.max.apply(_decimal.Decimal, _toConsumableArray(numbers));
  6545. var temp = new _storeObject.StoreObject(x.type.innerType, result);
  6546. sto.mode = _modes.Modes.RETURN;
  6547. return Promise.resolve(sto.updateStore('$', temp));
  6548. };
  6549. var paramType = new _compoundType.CompoundType(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 1);
  6550. var block = new Commands.CommandBlock([], [new Commands.SysCall(maxFun)]);
  6551. var func = new Commands.Function('$max', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(paramType, 'x', false)], block);
  6552. return func;
  6553. }
  6554. function createMinFun() {
  6555. var minFun = function minFun(sto, _) {
  6556. var x = sto.applyStore('x');
  6557. var numbers = x.value.map(function (stoObj) {
  6558. return stoObj.value;
  6559. });
  6560. var result = _decimal.Decimal.min.apply(_decimal.Decimal, _toConsumableArray(numbers));
  6561. var temp = new _storeObject.StoreObject(x.type.innerType, result);
  6562. sto.mode = _modes.Modes.RETURN;
  6563. return Promise.resolve(sto.updateStore('$', temp));
  6564. };
  6565. var paramType = new _compoundType.CompoundType(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 1);
  6566. var block = new Commands.CommandBlock([], [new Commands.SysCall(minFun)]);
  6567. var func = new Commands.Function('$min', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(paramType, 'x', false)], block);
  6568. return func;
  6569. }
  6570. /***/ }),
  6571. /***/ "./js/processor/lib/strings.js":
  6572. /*!*************************************!*\
  6573. !*** ./js/processor/lib/strings.js ***!
  6574. \*************************************/
  6575. /*! no static exports found */
  6576. /***/ (function(module, exports, __webpack_require__) {
  6577. "use strict";
  6578. Object.defineProperty(exports, "__esModule", {
  6579. value: true
  6580. });
  6581. exports.createSubstringFun = createSubstringFun;
  6582. exports.createLengthFun = createLengthFun;
  6583. exports.createUppercaseFun = createUppercaseFun;
  6584. exports.createLowercaseFun = createLowercaseFun;
  6585. exports.createrCharAtFun = createrCharAtFun;
  6586. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  6587. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  6588. var Commands = _interopRequireWildcard(_commands);
  6589. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  6590. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  6591. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  6592. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  6593. /*
  6594. * substring
  6595. * length
  6596. * uppercase
  6597. * lowercase
  6598. * charAt
  6599. **/
  6600. function createSubstringFun() {
  6601. var substringFun = function substringFun(sto, _) {
  6602. var str = sto.applyStore("str");
  6603. var start = sto.applyStore("start");
  6604. var end = sto.applyStore("end");
  6605. var result = str.value.substring(start.value, end.value);
  6606. var temp = new _storeObject.StoreObject(_types.Types.STRING, result);
  6607. sto.mode = _modes.Modes.RETURN;
  6608. return Promise.resolve(sto.updateStore("$", temp));
  6609. };
  6610. var block = new Commands.CommandBlock([], [new Commands.SysCall(substringFun)]);
  6611. var func = new Commands.Function('$substring', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false), new Commands.FormalParameter(_types.Types.INTEGER, 'start', false), new Commands.FormalParameter(_types.Types.INTEGER, 'end', false)], block);
  6612. return func;
  6613. }
  6614. function createLengthFun() {
  6615. var lengthFun = function lengthFun(sto, _) {
  6616. var str = sto.applyStore("str");
  6617. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(str.value.length));
  6618. sto.mode = _modes.Modes.RETURN;
  6619. return Promise.resolve(sto.updateStore("$", temp));
  6620. };
  6621. var block = new Commands.CommandBlock([], [new Commands.SysCall(lengthFun)]);
  6622. var func = new Commands.Function('$length', _types.Types.INTEGER, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  6623. return func;
  6624. }
  6625. function createUppercaseFun() {
  6626. var uppercaseFun = function uppercaseFun(sto, _) {
  6627. var str = sto.applyStore("str");
  6628. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.toUpperCase());
  6629. sto.mode = _modes.Modes.RETURN;
  6630. return Promise.resolve(sto.updateStore("$", temp));
  6631. };
  6632. var block = new Commands.CommandBlock([], [new Commands.SysCall(uppercaseFun)]);
  6633. var func = new Commands.Function('$uppercase', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  6634. return func;
  6635. }
  6636. function createLowercaseFun() {
  6637. var lowercaseFun = function lowercaseFun(sto, _) {
  6638. var str = sto.applyStore("str");
  6639. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.toLowerCase());
  6640. sto.mode = _modes.Modes.RETURN;
  6641. return Promise.resolve(sto.updateStore("$", temp));
  6642. };
  6643. var block = new Commands.CommandBlock([], [new Commands.SysCall(lowercaseFun)]);
  6644. var func = new Commands.Function('$lowercase', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  6645. return func;
  6646. }
  6647. function createrCharAtFun() {
  6648. var charAtFun = function charAtFun(sto, _) {
  6649. var str = sto.applyStore("str");
  6650. var idx = sto.applyStore("index");
  6651. if (idx.value.toNumber() < 0 || idx.value.toNumber() >= str.value.length) {
  6652. return Promise.reject(new Error("invalid string position"));
  6653. }
  6654. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.charAt(idx.value.toNumber()));
  6655. sto.mode = _modes.Modes.RETURN;
  6656. return Promise.resolve(sto.updateStore("$", temp));
  6657. };
  6658. var block = new Commands.CommandBlock([], [new Commands.SysCall(charAtFun)]);
  6659. var func = new Commands.Function('$charAt', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false), new Commands.FormalParameter(_types.Types.INTEGER, 'index', false)], block);
  6660. return func;
  6661. }
  6662. /***/ }),
  6663. /***/ "./js/processor/modes.js":
  6664. /*!*******************************!*\
  6665. !*** ./js/processor/modes.js ***!
  6666. \*******************************/
  6667. /*! no static exports found */
  6668. /***/ (function(module, exports, __webpack_require__) {
  6669. "use strict";
  6670. Object.defineProperty(exports, "__esModule", {
  6671. value: true
  6672. });
  6673. var Modes = exports.Modes = Object.freeze({
  6674. RETURN: Symbol('mode:return'),
  6675. BREAK: Symbol('mode:break'),
  6676. PAUSE: Symbol('mode:pause'),
  6677. RUN: Symbol('mode:run')
  6678. });
  6679. /***/ }),
  6680. /***/ "./js/processor/semantic/semanticAnalyser.js":
  6681. /*!***************************************************!*\
  6682. !*** ./js/processor/semantic/semanticAnalyser.js ***!
  6683. \***************************************************/
  6684. /*! no static exports found */
  6685. /***/ (function(module, exports, __webpack_require__) {
  6686. "use strict";
  6687. Object.defineProperty(exports, "__esModule", {
  6688. value: true
  6689. });
  6690. exports.SemanticAnalyser = undefined;
  6691. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6692. var _processorErrorFactory = __webpack_require__(/*! ./../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  6693. var _definedFunctions = __webpack_require__(/*! ./../definedFunctions */ "./js/processor/definedFunctions.js");
  6694. var _languageService = __webpack_require__(/*! ./../../services/languageService */ "./js/services/languageService.js");
  6695. var _commands = __webpack_require__(/*! ../../ast/commands */ "./js/ast/commands/index.js");
  6696. var _expressions = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  6697. var _literal = __webpack_require__(/*! ../../ast/expressions/literal */ "./js/ast/expressions/literal.js");
  6698. var _compatibilityTable = __webpack_require__(/*! ../compatibilityTable */ "./js/processor/compatibilityTable.js");
  6699. var _types = __webpack_require__(/*! ../../typeSystem/types */ "./js/typeSystem/types.js");
  6700. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  6701. var _multiType = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  6702. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6703. var SemanticAnalyser = exports.SemanticAnalyser = function () {
  6704. function SemanticAnalyser(ast) {
  6705. _classCallCheck(this, SemanticAnalyser);
  6706. this.ast = ast;
  6707. this.lexerClass = _languageService.LanguageService.getCurrentLexer();
  6708. var lexer = new this.lexerClass(null);
  6709. this.literalNames = lexer.literalNames;
  6710. this.symbolMap = null;
  6711. }
  6712. _createClass(SemanticAnalyser, [{
  6713. key: 'pushMap',
  6714. value: function pushMap() {
  6715. if (this.symbolMap === null) {
  6716. this.symbolMap = { map: {}, next: null };
  6717. } else {
  6718. var n = { map: {}, next: this.symbolMap };
  6719. this.symbolMap = n;
  6720. }
  6721. }
  6722. }, {
  6723. key: 'popMap',
  6724. value: function popMap() {
  6725. if (this.symbolMap !== null) {
  6726. this.symbolMap = this.symbolMap.next;
  6727. }
  6728. }
  6729. }, {
  6730. key: 'insertSymbol',
  6731. value: function insertSymbol(id, typeInfo) {
  6732. this.symbolMap.map[id] = typeInfo;
  6733. }
  6734. }, {
  6735. key: 'findSymbol',
  6736. value: function findSymbol(id, symMap) {
  6737. if (!symMap.map[id]) {
  6738. if (symMap.next) {
  6739. return this.findSymbol(id, symMap.next);
  6740. }
  6741. throw new Error("variable not defined " + id);
  6742. } else {
  6743. return symMap.map[id];
  6744. }
  6745. }
  6746. }, {
  6747. key: 'findFunction',
  6748. value: function findFunction(name) {
  6749. if (name.match(/^\$.+$/)) {
  6750. var fun = _definedFunctions.LanguageDefinedFunction.getFunction(name);
  6751. if (!!!fun) {
  6752. throw new Error("!!!Internal Error. Language defined function not implemented -> " + name + "!!!");
  6753. }
  6754. return fun;
  6755. } else {
  6756. var val = this.ast.functions.find(function (v) {
  6757. return v.name === name;
  6758. });
  6759. if (!!!val) {
  6760. // TODO: better error message;
  6761. throw new Error('Function ' + name + ' is not defined.');
  6762. }
  6763. return val;
  6764. }
  6765. }
  6766. }, {
  6767. key: 'analyseTree',
  6768. value: function analyseTree() {
  6769. var globalVars = this.ast.global;
  6770. this.pushMap();
  6771. this.assertDeclarations(globalVars);
  6772. var functions = this.ast.functions;
  6773. var mainFunc = functions.filter(function (f) {
  6774. return f.name === null;
  6775. });
  6776. if (mainFunc.length <= 0) {
  6777. throw new Error("no main func...");
  6778. } else if (mainFunc.length > 1) {
  6779. throw new Error("only one main func...");
  6780. }
  6781. for (var i = 0; i < functions.length; i++) {
  6782. var fun = functions[i];
  6783. this.assertFunction(fun);
  6784. }
  6785. return this.ast;
  6786. }
  6787. }, {
  6788. key: 'assertDeclarations',
  6789. value: function assertDeclarations(list) {
  6790. for (var i = 0; i < list.length; i++) {
  6791. this.assertDeclaration(list[i]);
  6792. }
  6793. }
  6794. }, {
  6795. key: 'assertDeclaration',
  6796. value: function assertDeclaration(declaration) {
  6797. if (declaration instanceof _commands.ArrayDeclaration) {
  6798. if (declaration.initial === null) {
  6799. var lineType = this.evaluateExpressionType(declaration.lines);
  6800. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  6801. throw new Error("dim must be int");
  6802. }
  6803. if (declaration.columns !== null) {
  6804. var columnType = this.evaluateExpressionType(declaration.columns);
  6805. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  6806. throw new Error("dim must be int");
  6807. }
  6808. }
  6809. this.insertSymbol(declaration.id, { id: declaration.id, lines: declaration.lines, columns: declaration.columns, type: declaration.type });
  6810. return;
  6811. }
  6812. this.evaluateArrayLiteral(declaration.lines, declaration.columns, declaration.type, declaration.initial);
  6813. this.insertSymbol(declaration.id, { id: declaration.id, lines: declaration.lines, columns: declaration.columns, type: declaration.type });
  6814. } else {
  6815. if (declaration.initial === null) {
  6816. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  6817. return;
  6818. }
  6819. var resultType = this.evaluateExpressionType(declaration.initial);
  6820. if (resultType instanceof _multiType.MultiType) {
  6821. if (!resultType.isCompatible(declaration.type)) {
  6822. throw new Error('Invalid type');
  6823. }
  6824. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  6825. } else if (!declaration.type.isCompatible(resultType)) {
  6826. throw new Error('Invalid type');
  6827. } else {
  6828. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  6829. }
  6830. }
  6831. }
  6832. }, {
  6833. key: 'evaluateExpressionType',
  6834. value: function evaluateExpressionType(expression) {
  6835. if (expression instanceof _expressions.UnaryApp) {
  6836. var op = expression.op;
  6837. var resultType = this.evaluateExpressionType(expression.left);
  6838. return (0, _compatibilityTable.resultTypeAfterUnaryOp)(op, resultType);
  6839. } else if (expression instanceof _expressions.InfixApp) {
  6840. var _op = expression.op;
  6841. var resultTypeLeft = this.evaluateExpressionType(expression.left);
  6842. var resultTypeRight = this.evaluateExpressionType(expression.right);
  6843. return (0, _compatibilityTable.resultTypeAfterInfixOp)(_op, resultTypeLeft, resultTypeRight);
  6844. } else if (expression instanceof _literal.Literal) {
  6845. return this.evaluateLiteralType(expression);
  6846. } else if (expression instanceof _expressions.FunctionCall) {
  6847. var fun = this.findFunction(expression.id);
  6848. if (fun.returnType.isCompatible(_types.Types.VOID)) {
  6849. throw new Error("void return");
  6850. }
  6851. this.assertParameters(fun, expression.actualParameters);
  6852. return fun.returnType;
  6853. } else if (expression instanceof _expressions.ArrayAccess) {
  6854. var arrayTypeInfo = this.findSymbol(expression.id, this.symbolMap);
  6855. if (!(arrayTypeInfo.type instanceof _compoundType.CompoundType)) {
  6856. throw new Error("it's not an array");
  6857. }
  6858. var lineType = this.evaluateExpressionType(expression.line);
  6859. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  6860. throw new Error("line must be integer");
  6861. }
  6862. if (expression.column !== null) {
  6863. if (arrayTypeInfo.columns === null) {
  6864. throw new Error("it's not a matrix");
  6865. }
  6866. var columnType = this.evaluateExpressionType(expression.column);
  6867. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  6868. throw new Error("column must be integer");
  6869. }
  6870. }
  6871. var arrType = arrayTypeInfo.type;
  6872. if (expression.column !== null) {
  6873. // indexing matrix
  6874. return arrType.innerType;
  6875. } else {
  6876. if (arrayTypeInfo.columns === null) {
  6877. return arrType.innerType;
  6878. }
  6879. return new _compoundType.CompoundType(arrType.innerType, 1);
  6880. }
  6881. }
  6882. }
  6883. }, {
  6884. key: 'evaluateLiteralType',
  6885. value: function evaluateLiteralType(literal) {
  6886. if (literal instanceof _expressions.IntLiteral) {
  6887. return literal.type;
  6888. } else if (literal instanceof _expressions.RealLiteral) {
  6889. return literal.type;
  6890. } else if (literal instanceof _expressions.StringLiteral) {
  6891. return literal.type;
  6892. } else if (literal instanceof _expressions.BoolLiteral) {
  6893. return literal.type;
  6894. } else if (literal instanceof _expressions.VariableLiteral) {
  6895. var typeInfo = this.findSymbol(literal.id, this.symbolMap);
  6896. if (typeInfo.type instanceof _compoundType.CompoundType) {
  6897. return typeInfo.type;
  6898. }
  6899. return typeInfo.type;
  6900. } else {
  6901. console.warn("Evaluating type only for an array literal...");
  6902. var last = null;
  6903. if (literal.value.length === 1) {
  6904. last = this.evaluateExpressionType(literal.value[0]);
  6905. } else {
  6906. for (var i = 0; i < literal.value.length; i++) {
  6907. var e = this.evaluateExpressionType(literal.value[i]);
  6908. if (last === null) {
  6909. last = e;
  6910. } else if (!last.isCompatible(e)) {
  6911. throw new Error("invalid value type for array");
  6912. } else {
  6913. last = e;
  6914. }
  6915. }
  6916. }
  6917. if (last instanceof _compoundType.CompoundType) {
  6918. return new _compoundType.CompoundType(last.innerType, last.dimensions + 1);
  6919. }
  6920. return new _compoundType.CompoundType(last, 1);
  6921. }
  6922. }
  6923. }, {
  6924. key: 'evaluateArrayLiteral',
  6925. value: function evaluateArrayLiteral(lines, columns, type, literal) {
  6926. var _this = this;
  6927. if (literal instanceof _expressions.ArrayLiteral) {
  6928. if (columns === null) {
  6929. // it's a vector...
  6930. var dimType = this.evaluateExpressionType(lines);
  6931. if (!dimType.isCompatible(_types.Types.INTEGER)) {
  6932. throw new Error("dim must be int");
  6933. }
  6934. if (lines instanceof _expressions.IntLiteral && !lines.value.eq(literal.value.length)) {
  6935. throw new Error("invalid array size");
  6936. }
  6937. literal.value.reduce(function (last, next) {
  6938. var eType = _this.evaluateExpressionType(next);
  6939. if (!last.canAccept(eType)) {
  6940. throw new Error("invalid value type for array");
  6941. }
  6942. return last;
  6943. }, type);
  6944. return true;
  6945. } else {
  6946. var _dimType = this.evaluateExpressionType(columns);
  6947. if (!_dimType.isCompatible(_types.Types.INTEGER)) {
  6948. throw new Error("dim must be int");
  6949. }
  6950. if (columns instanceof _expressions.IntLiteral && !columns.value.eq(literal.value.length)) {
  6951. throw new Error("invalid array size");
  6952. }
  6953. for (var i = 0; i < columns; i++) {
  6954. var anotherArray = literal.value[i];
  6955. this.evaluateArrayLiteral(lines, null, type, anotherArray);
  6956. }
  6957. }
  6958. } else {
  6959. var resultType = this.evaluateExpressionType(literal);
  6960. if (!(resultType instanceof _compoundType.CompoundType)) {
  6961. throw new Error("initial must be of type array");
  6962. }
  6963. if (!type.isCompatible(resultType)) {
  6964. throw new Error("invalid array type");
  6965. }
  6966. return true;
  6967. }
  6968. }
  6969. }, {
  6970. key: 'assertFunction',
  6971. value: function assertFunction(fun) {
  6972. var _this2 = this;
  6973. this.pushMap();
  6974. fun.formalParameters.forEach(function (formalParam) {
  6975. if (formalParam.type instanceof _compoundType.CompoundType) {
  6976. if (formalParam.type.dimensions > 1) {
  6977. _this2.insertSymbol(formalParam.id, { id: formalParam.id, lines: -1, columns: -1, type: formalParam.type });
  6978. } else {
  6979. _this2.insertSymbol(formalParam.id, { id: formalParam.id, lines: -1, columns: null, type: formalParam.type });
  6980. }
  6981. } else {
  6982. _this2.insertSymbol(formalParam.id, { id: formalParam.id, type: formalParam.type });
  6983. }
  6984. });
  6985. this.assertDeclarations(fun.variablesDeclarations);
  6986. var optional = fun.returnType.isCompatible(_types.Types.VOID);
  6987. var valid = this.assertReturn(fun, optional);
  6988. if (!valid) {
  6989. throw new Error("function has no accessible return");
  6990. }
  6991. this.popMap();
  6992. }
  6993. }, {
  6994. key: 'assertReturn',
  6995. value: function assertReturn(fun, optional) {
  6996. var _this3 = this;
  6997. return fun.commands.reduce(function (last, next) {
  6998. return _this3.checkCommand(fun.returnType, next, optional) || last;
  6999. }, optional);
  7000. }
  7001. }, {
  7002. key: 'checkCommand',
  7003. value: function checkCommand(type, cmd, optional) {
  7004. if (cmd instanceof _commands.While) {
  7005. var resultType = this.evaluateExpressionType(cmd.expression);
  7006. if (!resultType.isCompatible(_types.Types.BOOLEAN)) {
  7007. throw new Error("condition not boolean");
  7008. }
  7009. this.checkCommands(type, cmd.commands, optional);
  7010. return false;
  7011. } else if (cmd instanceof _commands.For) {
  7012. this.checkCommand(type, cmd.assignment, optional);
  7013. var _resultType = this.evaluateExpressionType(cmd.condition);
  7014. if (!_resultType.isCompatible(_types.Types.BOOLEAN)) {
  7015. throw new Error("condition not boolean");
  7016. }
  7017. this.checkCommand(type, cmd.increment, optional);
  7018. this.checkCommands(type, cmd.commands, optional);
  7019. return false;
  7020. } else if (cmd instanceof _commands.Switch) {
  7021. var sType = this.evaluateExpressionType(cmd.expression);
  7022. var result = optional;
  7023. var hasDefault = false;
  7024. for (var i = 0; i < cmd.cases.length; i++) {
  7025. var aCase = cmd.cases[i];
  7026. if (aCase.expression !== null) {
  7027. var caseType = this.evaluateExpressionType(aCase.expression);
  7028. if (!sType.isCompatible(caseType)) {
  7029. throw new Error("invalid type in case");
  7030. }
  7031. } else {
  7032. hasDefault = true;
  7033. }
  7034. result = result && this.checkCommands(type, aCase.commands, result);
  7035. }
  7036. return result && hasDefault;
  7037. } else if (cmd instanceof _commands.ArrayIndexAssign) {
  7038. var typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  7039. if (!(typeInfo.type instanceof _compoundType.CompoundType)) {
  7040. throw new Error(cmd.id + " is not an array.");
  7041. }
  7042. var exp = cmd.expression;
  7043. var lineExp = cmd.line;
  7044. var lineType = this.evaluateExpressionType(lineExp);
  7045. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  7046. throw new Error("array dimension must be of type int");
  7047. }
  7048. var columnExp = cmd.column;
  7049. if (typeInfo.columns === null && columnExp !== null) {
  7050. throw new Error(cmd.id + " is not a matrix");
  7051. } else if (columnExp !== null) {
  7052. var columnType = this.evaluateExpressionType(columnExp);
  7053. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  7054. throw new Error("array dimension must be of type int");
  7055. }
  7056. }
  7057. // exp can be a arrayLiteral, a single value exp or an array access
  7058. if (exp instanceof _expressions.ArrayLiteral) {
  7059. this.evaluateArrayLiteral(typeInfo.lines, columnExp ? typeInfo.columns : null, typeInfo.type, exp);
  7060. } else {
  7061. // cannot properly evaluate since type system is poorly constructed
  7062. }
  7063. return optional;
  7064. } else if (cmd instanceof _commands.Assign) {
  7065. var _typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  7066. var _exp = cmd.expression;
  7067. if (_exp instanceof _expressions.ArrayLiteral) {
  7068. if (!(_typeInfo.type instanceof _compoundType.CompoundType)) {
  7069. throw new Error("type not compatible");
  7070. }
  7071. this.evaluateArrayLiteral(_typeInfo.lines, _typeInfo.columns, _typeInfo.type, _exp);
  7072. } else {
  7073. var _resultType2 = this.evaluateExpressionType(_exp);
  7074. if (!_resultType2.isCompatible(_typeInfo.type)) {
  7075. throw new Error("type not compatible");
  7076. }
  7077. }
  7078. return optional;
  7079. } else if (cmd instanceof _commands.Break) {
  7080. return optional;
  7081. } else if (cmd instanceof _commands.IfThenElse) {
  7082. var _resultType3 = this.evaluateExpressionType(cmd.condition);
  7083. if (!_resultType3.isCompatible(_types.Types.BOOLEAN)) {
  7084. throw new Error("condition not boolean");
  7085. }
  7086. if (cmd.ifFalse instanceof _commands.IfThenElse) {
  7087. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommand(type, cmd.ifFalse, optional);
  7088. } else {
  7089. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommands(type, cmd.ifFalse.commands, optional);
  7090. }
  7091. } else if (cmd instanceof _expressions.FunctionCall) {
  7092. var fun = this.findFunction(cmd.id);
  7093. this.assertParameters(fun, cmd.actualParameters);
  7094. return optional;
  7095. } else if (cmd instanceof _commands.Return) {
  7096. if (cmd.expression === null && !type.isCompatible(_types.Types.VOID)) {
  7097. throw new Error('invalid return type');
  7098. } else if (cmd.expression !== null) {
  7099. var _resultType4 = this.evaluateExpressionType(cmd.expression);
  7100. if (!type.isCompatible(_resultType4)) {
  7101. console.log(_resultType4);
  7102. throw new Error('invalid return type');
  7103. } else {
  7104. return true;
  7105. }
  7106. } else {
  7107. return true;
  7108. }
  7109. }
  7110. }
  7111. }, {
  7112. key: 'checkCommands',
  7113. value: function checkCommands(type, cmds, optional) {
  7114. var _this4 = this;
  7115. return cmds.reduce(function (last, next) {
  7116. return _this4.checkCommand(type, next, optional) || last;
  7117. }, optional);
  7118. }
  7119. }, {
  7120. key: 'assertParameters',
  7121. value: function assertParameters(fun, actualParametersList) {
  7122. if (fun.formalParameters.length !== actualParametersList.length) {
  7123. throw new Error("wrong number of parameters...");
  7124. }
  7125. for (var i = 0; i < actualParametersList.length; i++) {
  7126. var param = actualParametersList[i];
  7127. var formalParam = fun.formalParameters[i];
  7128. if (formalParam.byRef) {
  7129. if (!(param instanceof _expressions.VariableLiteral || param instanceof _expressions.ArrayAccess)) {
  7130. throw new Error("Invalid param type for ref");
  7131. }
  7132. }
  7133. var resultType = this.evaluateExpressionType(param);
  7134. if (resultType instanceof _multiType.MultiType && formalParam.type instanceof _multiType.MultiType) {
  7135. var shared = 0;
  7136. for (var j = 0; j < resultType.types.length; j++) {
  7137. var element = resultType.types[j];
  7138. if (formalParam.type.types.indexOf(element) !== -1) {
  7139. shared++;
  7140. }
  7141. }
  7142. if (shared <= 0) {
  7143. throw new Error('Parameter ' + formalParam.id + ' is not compatible with the value given.');
  7144. }
  7145. } else if (resultType instanceof _multiType.MultiType) {
  7146. if (!resultType.isCompatible(formalParam.type)) {
  7147. throw new Error('Parameter ' + formalParam.id + ' is not compatible with the value given.');
  7148. }
  7149. } else if (!formalParam.type.isCompatible(resultType)) {
  7150. console.log("####");
  7151. console.log(resultType);
  7152. console.log("####");
  7153. console.log(formalParam.type);
  7154. throw new Error('Parameter ' + formalParam.id + ' is not compatible with the value given.');
  7155. }
  7156. }
  7157. }
  7158. }]);
  7159. return SemanticAnalyser;
  7160. }();
  7161. /***/ }),
  7162. /***/ "./js/processor/store/store.js":
  7163. /*!*************************************!*\
  7164. !*** ./js/processor/store/store.js ***!
  7165. \*************************************/
  7166. /*! no static exports found */
  7167. /***/ (function(module, exports, __webpack_require__) {
  7168. "use strict";
  7169. Object.defineProperty(exports, "__esModule", {
  7170. value: true
  7171. });
  7172. exports.Store = undefined;
  7173. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7174. var _modes = __webpack_require__(/*! ./../modes */ "./js/processor/modes.js");
  7175. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7176. var Store = exports.Store = function () {
  7177. function Store() {
  7178. _classCallCheck(this, Store);
  7179. this.store = {};
  7180. this.nextStore = null;
  7181. this.mode = _modes.Modes.RUN;
  7182. }
  7183. _createClass(Store, [{
  7184. key: "extendStore",
  7185. value: function extendStore(nextStore) {
  7186. this.nextStore = nextStore;
  7187. }
  7188. }, {
  7189. key: "applyStore",
  7190. value: function applyStore(id) {
  7191. if (!this.store[id]) {
  7192. if (this.nextStore !== null) {
  7193. return this.nextStore.applyStore(id);
  7194. } else {
  7195. // TODO: better error message
  7196. throw new Error("Variable " + id + " not found.");
  7197. }
  7198. }
  7199. var val = this.store[id];
  7200. if (val.isRef) {
  7201. return val.getRefObj();
  7202. }
  7203. return this.store[id];
  7204. }
  7205. }, {
  7206. key: "updateStore",
  7207. value: function updateStore(id, stoObj) {
  7208. if (!this.store[id]) {
  7209. if (this.nextStore !== null) {
  7210. this.nextStore.updateStore(id, stoObj);
  7211. return this;
  7212. } else {
  7213. // TODO: better error message
  7214. throw new Error("Variable " + id + " not found.");
  7215. }
  7216. } else {
  7217. var oldObj = this.store[id];
  7218. if (oldObj.readOnly) {
  7219. // TODO: better error message
  7220. throw new Error("Cannot change value of a read only variable: " + id);
  7221. }
  7222. if (oldObj.isRef) {
  7223. oldObj.updateRef(stoObj);
  7224. return this;
  7225. } else if (oldObj.isCompatible(stoObj)) {
  7226. stoObj.setID(id);
  7227. this.store[id] = Object.freeze(stoObj);
  7228. return this;
  7229. } else {
  7230. var oldType = oldObj.type;
  7231. var stoType = stoObj.type;
  7232. // TODO: better error message
  7233. throw new Error(oldType + " is not compatible with type " + stoType + " given");
  7234. }
  7235. }
  7236. }
  7237. //In case of future use of ref, it needs to have a special function to update the storeRefObject
  7238. // and no the StoreObject refferenced by it
  7239. // updateStoreRef(id, stoObjAddress) {...}
  7240. }, {
  7241. key: "insertStore",
  7242. value: function insertStore(id, stoObj) {
  7243. if (this.store[id]) {
  7244. // TODO: better error message
  7245. throw new Error(id + " is already defined");
  7246. }
  7247. stoObj.setID(id);
  7248. this.store[id] = Object.freeze(stoObj);
  7249. return this;
  7250. }
  7251. }]);
  7252. return Store;
  7253. }();
  7254. /***/ }),
  7255. /***/ "./js/processor/store/storeObject.js":
  7256. /*!*******************************************!*\
  7257. !*** ./js/processor/store/storeObject.js ***!
  7258. \*******************************************/
  7259. /*! no static exports found */
  7260. /***/ (function(module, exports, __webpack_require__) {
  7261. "use strict";
  7262. Object.defineProperty(exports, "__esModule", {
  7263. value: true
  7264. });
  7265. exports.StoreObject = undefined;
  7266. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7267. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  7268. var _decimal2 = _interopRequireDefault(_decimal);
  7269. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7270. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7271. var StoreObject = exports.StoreObject = function () {
  7272. function StoreObject(type, value) {
  7273. var readOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  7274. _classCallCheck(this, StoreObject);
  7275. this._type = type;
  7276. this._value = value;
  7277. this._readOnly = readOnly;
  7278. this._id = null;
  7279. }
  7280. _createClass(StoreObject, [{
  7281. key: 'setID',
  7282. value: function setID(id) {
  7283. this._id = id;
  7284. }
  7285. }, {
  7286. key: 'isCompatible',
  7287. value: function isCompatible(another) {
  7288. if (another instanceof StoreObject) {
  7289. return this.type.isCompatible(another.type);
  7290. }
  7291. return false;
  7292. }
  7293. }, {
  7294. key: 'id',
  7295. get: function get() {
  7296. return this._id;
  7297. }
  7298. }, {
  7299. key: 'inStore',
  7300. get: function get() {
  7301. return this.id !== null;
  7302. }
  7303. }, {
  7304. key: 'type',
  7305. get: function get() {
  7306. return this._type;
  7307. }
  7308. }, {
  7309. key: 'value',
  7310. get: function get() {
  7311. return this._value;
  7312. }
  7313. }, {
  7314. key: 'number',
  7315. get: function get() {
  7316. if (this._value instanceof _decimal2.default) {
  7317. return this._value.toNumber();
  7318. } else {
  7319. return null;
  7320. }
  7321. }
  7322. }, {
  7323. key: 'readOnly',
  7324. get: function get() {
  7325. return this._readOnly;
  7326. },
  7327. set: function set(value) {
  7328. this._readOnly = value;
  7329. }
  7330. }]);
  7331. return StoreObject;
  7332. }();
  7333. /***/ }),
  7334. /***/ "./js/processor/store/storeObjectArray.js":
  7335. /*!************************************************!*\
  7336. !*** ./js/processor/store/storeObjectArray.js ***!
  7337. \************************************************/
  7338. /*! no static exports found */
  7339. /***/ (function(module, exports, __webpack_require__) {
  7340. "use strict";
  7341. Object.defineProperty(exports, "__esModule", {
  7342. value: true
  7343. });
  7344. exports.StoreObjectArray = undefined;
  7345. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7346. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  7347. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  7348. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7349. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  7350. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  7351. var StoreObjectArray = exports.StoreObjectArray = function (_StoreObject) {
  7352. _inherits(StoreObjectArray, _StoreObject);
  7353. function StoreObjectArray(type, lines, columns) {
  7354. var value = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  7355. var readOnly = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  7356. _classCallCheck(this, StoreObjectArray);
  7357. var _this = _possibleConstructorReturn(this, (StoreObjectArray.__proto__ || Object.getPrototypeOf(StoreObjectArray)).call(this, type, value, readOnly));
  7358. _this._lines = lines;
  7359. _this._columns = columns;
  7360. return _this;
  7361. }
  7362. _createClass(StoreObjectArray, [{
  7363. key: 'isCompatible',
  7364. value: function isCompatible(another) {
  7365. if (another instanceof _storeObject.StoreObject) {
  7366. if (this.lines === -1 && another.lines > 0 || this.lines === another.lines) {
  7367. if (this.columns === -1 && another.columns > 0 || this.columns === another.columns) {
  7368. return _get(StoreObjectArray.prototype.__proto__ || Object.getPrototypeOf(StoreObjectArray.prototype), 'isCompatible', this).call(this, another);
  7369. }
  7370. }
  7371. }
  7372. return false;
  7373. }
  7374. }, {
  7375. key: 'lines',
  7376. get: function get() {
  7377. return this._lines;
  7378. }
  7379. }, {
  7380. key: 'columns',
  7381. get: function get() {
  7382. return this._columns;
  7383. }
  7384. }, {
  7385. key: 'isVector',
  7386. get: function get() {
  7387. return this.type.dimensions === 1;
  7388. }
  7389. }, {
  7390. key: 'isValid',
  7391. get: function get() {
  7392. var _this2 = this;
  7393. if (this.value !== null) {
  7394. if (this.isVector) {
  7395. if (this.value.length !== this.lines) {
  7396. return false;
  7397. }
  7398. var mustBeNull = this.value.find(function (v) {
  7399. return !_this2.type.canAccept(v.type);
  7400. });
  7401. if (!!mustBeNull) {
  7402. return false;
  7403. }
  7404. }
  7405. return true;
  7406. } else {
  7407. if (this.lines !== this.value.length) {
  7408. return false;
  7409. }
  7410. for (var i = 0; i < this.lines; i++) {
  7411. for (var j = 0; j < this.columns; j++) {
  7412. var arr = this.value[i];
  7413. if (arr.length !== this.columns) {
  7414. return false;
  7415. }
  7416. var _mustBeNull = arr.find(function (v) {
  7417. return !_this2.type.canAccept(v.type);
  7418. });
  7419. if (!!_mustBeNull) {
  7420. return false;
  7421. }
  7422. }
  7423. }
  7424. return true;
  7425. }
  7426. }
  7427. }]);
  7428. return StoreObjectArray;
  7429. }(_storeObject.StoreObject);
  7430. /***/ }),
  7431. /***/ "./js/processor/store/storeObjectArrayAddress.js":
  7432. /*!*******************************************************!*\
  7433. !*** ./js/processor/store/storeObjectArrayAddress.js ***!
  7434. \*******************************************************/
  7435. /*! no static exports found */
  7436. /***/ (function(module, exports, __webpack_require__) {
  7437. "use strict";
  7438. Object.defineProperty(exports, "__esModule", {
  7439. value: true
  7440. });
  7441. exports.StoreObjectArrayAddress = undefined;
  7442. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7443. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  7444. var _storeObjectArray = __webpack_require__(/*! ./storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  7445. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  7446. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7447. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  7448. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  7449. var StoreObjectArrayAddress = exports.StoreObjectArrayAddress = function (_StoreObject) {
  7450. _inherits(StoreObjectArrayAddress, _StoreObject);
  7451. function StoreObjectArrayAddress(refID, line, column, store) {
  7452. _classCallCheck(this, StoreObjectArrayAddress);
  7453. var _this = _possibleConstructorReturn(this, (StoreObjectArrayAddress.__proto__ || Object.getPrototypeOf(StoreObjectArrayAddress)).call(this, null, null, false));
  7454. _this.refID = refID;
  7455. _this.store = store;
  7456. _this.line = line;
  7457. _this.column = column;
  7458. return _this;
  7459. }
  7460. _createClass(StoreObjectArrayAddress, [{
  7461. key: 'getArrayObject',
  7462. value: function getArrayObject() {
  7463. return this.store.applyStore(this.refID);
  7464. }
  7465. }, {
  7466. key: 'updateArrayObject',
  7467. value: function updateArrayObject(stoObj) {
  7468. var anArray = this.getArrayObject();
  7469. var newArray = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), anArray);
  7470. if (!stoObj.type.isCompatible(this.type)) {
  7471. throw new Error('Invalid operation: cannot assign the value given to ' + this.refID);
  7472. } else if (this.type instanceof _compoundType.CompoundType && this.type.canAccept(stoObj.type)) {
  7473. throw new Error('Invalid operation: cannot assign the value given to ' + this.refID);
  7474. }
  7475. if (this.column !== null) {
  7476. newArray.value[this.line].value[this.column] = stoObj;
  7477. return newArray;
  7478. } else {
  7479. newArray.value[this.line] = stoObj;
  7480. return newArray;
  7481. }
  7482. }
  7483. }, {
  7484. key: 'isCompatible',
  7485. value: function isCompatible(another) {
  7486. if (this.type.isCompatible(another.type)) {
  7487. if (another.type instanceof _compoundType.CompoundType) {
  7488. return this.lines === another.lines && this.columns === another.columns;
  7489. } else {
  7490. this.refValue.isCompatible(another);
  7491. }
  7492. }
  7493. }
  7494. }, {
  7495. key: 'isRef',
  7496. get: function get() {
  7497. return false;
  7498. }
  7499. }, {
  7500. key: 'inStore',
  7501. get: function get() {
  7502. return true;
  7503. }
  7504. }, {
  7505. key: 'refValue',
  7506. get: function get() {
  7507. var refLine = this.store.applyStore(this.refID).value[this.line];
  7508. if (this.column !== null) {
  7509. var refColumn = refLine.value[this.column];
  7510. return refColumn;
  7511. }
  7512. return refLine;
  7513. }
  7514. }, {
  7515. key: 'value',
  7516. get: function get() {
  7517. return this.refValue.value;
  7518. }
  7519. }, {
  7520. key: 'type',
  7521. get: function get() {
  7522. return this.refValue.type;
  7523. }
  7524. }, {
  7525. key: 'lines',
  7526. get: function get() {
  7527. if (!(this.type instanceof _compoundType.CompoundType)) {
  7528. return null;
  7529. }
  7530. return this.refValue.value.length;
  7531. }
  7532. }, {
  7533. key: 'columns',
  7534. get: function get() {
  7535. switch (this.type.dimensions) {
  7536. case 2:
  7537. return this.refValue.value[0].value.length;
  7538. default:
  7539. return null;
  7540. }
  7541. }
  7542. }]);
  7543. return StoreObjectArrayAddress;
  7544. }(_storeObject.StoreObject);
  7545. /***/ }),
  7546. /***/ "./js/processor/store/storeObjectArrayAddressRef.js":
  7547. /*!**********************************************************!*\
  7548. !*** ./js/processor/store/storeObjectArrayAddressRef.js ***!
  7549. \**********************************************************/
  7550. /*! no static exports found */
  7551. /***/ (function(module, exports, __webpack_require__) {
  7552. "use strict";
  7553. Object.defineProperty(exports, "__esModule", {
  7554. value: true
  7555. });
  7556. exports.StoreObjectArrayAddressRef = undefined;
  7557. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7558. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  7559. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  7560. var _decimal2 = _interopRequireDefault(_decimal);
  7561. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7562. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7563. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  7564. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  7565. var StoreObjectArrayAddressRef = exports.StoreObjectArrayAddressRef = function (_StoreObject) {
  7566. _inherits(StoreObjectArrayAddressRef, _StoreObject);
  7567. function StoreObjectArrayAddressRef(address) {
  7568. _classCallCheck(this, StoreObjectArrayAddressRef);
  7569. var _this = _possibleConstructorReturn(this, (StoreObjectArrayAddressRef.__proto__ || Object.getPrototypeOf(StoreObjectArrayAddressRef)).call(this, null, null, false));
  7570. _this.address = address;
  7571. return _this;
  7572. }
  7573. _createClass(StoreObjectArrayAddressRef, [{
  7574. key: 'getRefObj',
  7575. value: function getRefObj() {
  7576. return this.address.refValue;
  7577. }
  7578. }, {
  7579. key: 'updateRef',
  7580. value: function updateRef(stoObj) {
  7581. var newArray = this.address.updateArrayObject(stoObj);
  7582. this.address.store.updateStore(this.address.refID, newArray);
  7583. }
  7584. }, {
  7585. key: 'isCompatible',
  7586. value: function isCompatible(another) {
  7587. return this.address.isCompatible(another);
  7588. }
  7589. }, {
  7590. key: 'isRef',
  7591. get: function get() {
  7592. return true;
  7593. }
  7594. }, {
  7595. key: 'type',
  7596. get: function get() {
  7597. return this.address.type;
  7598. }
  7599. }, {
  7600. key: 'value',
  7601. get: function get() {
  7602. return this.address.value;
  7603. }
  7604. }, {
  7605. key: 'number',
  7606. get: function get() {
  7607. if (this.value instanceof _decimal2.default) {
  7608. return this.value.toNumber();
  7609. } else {
  7610. return null;
  7611. }
  7612. }
  7613. }]);
  7614. return StoreObjectArrayAddressRef;
  7615. }(_storeObject.StoreObject);
  7616. /***/ }),
  7617. /***/ "./js/processor/store/storeObjectRef.js":
  7618. /*!**********************************************!*\
  7619. !*** ./js/processor/store/storeObjectRef.js ***!
  7620. \**********************************************/
  7621. /*! no static exports found */
  7622. /***/ (function(module, exports, __webpack_require__) {
  7623. "use strict";
  7624. Object.defineProperty(exports, "__esModule", {
  7625. value: true
  7626. });
  7627. exports.StoreObjectRef = undefined;
  7628. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7629. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  7630. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  7631. var _decimal2 = _interopRequireDefault(_decimal);
  7632. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7633. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7634. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  7635. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  7636. var StoreObjectRef = exports.StoreObjectRef = function (_StoreObject) {
  7637. _inherits(StoreObjectRef, _StoreObject);
  7638. function StoreObjectRef(refID, store) {
  7639. _classCallCheck(this, StoreObjectRef);
  7640. var _this = _possibleConstructorReturn(this, (StoreObjectRef.__proto__ || Object.getPrototypeOf(StoreObjectRef)).call(this, null, null, false));
  7641. _this.refID = refID;
  7642. _this.store = store;
  7643. return _this;
  7644. }
  7645. _createClass(StoreObjectRef, [{
  7646. key: 'getRefObj',
  7647. value: function getRefObj() {
  7648. return this.store.applyStore(this.refID);
  7649. }
  7650. }, {
  7651. key: 'updateRef',
  7652. value: function updateRef(stoObj) {
  7653. this.store.updateStore(this.refID, stoObj);
  7654. }
  7655. }, {
  7656. key: 'isCompatible',
  7657. value: function isCompatible(another) {
  7658. return this.store.applyStore(this.refID).isCompatible(another);
  7659. }
  7660. }, {
  7661. key: 'isRef',
  7662. get: function get() {
  7663. return true;
  7664. }
  7665. }, {
  7666. key: 'type',
  7667. get: function get() {
  7668. return this.store.applyStore(this.refID).type;
  7669. }
  7670. }, {
  7671. key: 'value',
  7672. get: function get() {
  7673. return this.store.applyStore(this.refID).value;
  7674. }
  7675. }, {
  7676. key: 'number',
  7677. get: function get() {
  7678. if (this.value instanceof _decimal2.default) {
  7679. return this.value.toNumber();
  7680. } else {
  7681. return null;
  7682. }
  7683. }
  7684. }]);
  7685. return StoreObjectRef;
  7686. }(_storeObject.StoreObject);
  7687. /***/ }),
  7688. /***/ "./js/runner.js":
  7689. /*!**********************!*\
  7690. !*** ./js/runner.js ***!
  7691. \**********************/
  7692. /*! no static exports found */
  7693. /***/ (function(module, exports, __webpack_require__) {
  7694. "use strict";
  7695. Object.defineProperty(exports, "__esModule", {
  7696. value: true
  7697. });
  7698. exports.runner = runner;
  7699. var _ivprogParser = __webpack_require__(/*! ./ast/ivprogParser */ "./js/ast/ivprogParser.js");
  7700. var _ivprogProcessor = __webpack_require__(/*! ./processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  7701. var _domConsole = __webpack_require__(/*! ./io/domConsole */ "./js/io/domConsole.js");
  7702. var _languageService = __webpack_require__(/*! ./services/languageService */ "./js/services/languageService.js");
  7703. var _semanticAnalyser = __webpack_require__(/*! ./processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  7704. function runner() {
  7705. var ivprogLexer = _languageService.LanguageService.getCurrentLexer();
  7706. // const lexer = new ivprogLexer(new InputStream(input));
  7707. // const stream = new CommonTokenStream(lexer);
  7708. // stream.fill();
  7709. // let i = 1;
  7710. // let token = null;
  7711. // while ((token = stream.LT(i)).type !== ivprogLexer.EOF && token.type !== ivprogLexer.WHITESPACE) {
  7712. // console.log(`${token.type}-${token.text}`);
  7713. // console.log('\n')
  7714. // i++;
  7715. // }
  7716. // const anaSin = new IVProgParser(input, ivprogLexer);
  7717. var editor = new JsonEditor('#json-renderer', {});
  7718. var domConsole = new _domConsole.DOMConsole("#console");
  7719. // proc.interpretAST().then( sto => {
  7720. // console.log(sto.applyStore('a'));
  7721. // }).catch(e => console.log(e));
  7722. try {
  7723. $('#btn').click(function () {
  7724. var input = $('#input').val();
  7725. var analiser = new _ivprogParser.IVProgParser(input, ivprogLexer);
  7726. try {
  7727. var data = analiser.parseTree();
  7728. var semAna = new _semanticAnalyser.SemanticAnalyser(data);
  7729. var proc = new _ivprogProcessor.IVProgProcessor(semAna.analyseTree());
  7730. proc.registerInput(domConsole);
  7731. domConsole.clear();
  7732. proc.registerOutput(domConsole);
  7733. proc.interpretAST().then(function (sto) {
  7734. return editor.load(sto.store);
  7735. }).catch(function (e) {
  7736. alert(e);console.log(e);
  7737. });
  7738. } catch (error) {
  7739. alert(error);
  7740. console.log(error);
  7741. }
  7742. });
  7743. } catch (a) {
  7744. console.log(a);
  7745. }
  7746. }
  7747. /***/ }),
  7748. /***/ "./js/semantic/semantic.min.js":
  7749. /*!*************************************!*\
  7750. !*** ./js/semantic/semantic.min.js ***!
  7751. \*************************************/
  7752. /*! no static exports found */
  7753. /***/ (function(module, exports, __webpack_require__) {
  7754. "use strict";
  7755. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  7756. /*
  7757. * # Semantic UI - 2.3.3
  7758. * https://github.com/Semantic-Org/Semantic-UI
  7759. * http://www.semantic-ui.com/
  7760. *
  7761. * Copyright 2014 Contributors
  7762. * Released under the MIT license
  7763. * http://opensource.org/licenses/MIT
  7764. *
  7765. */
  7766. !function (e, t, n, i) {
  7767. e.site = e.fn.site = function (o) {
  7768. var a,
  7769. r,
  7770. s = new Date().getTime(),
  7771. l = [],
  7772. c = arguments[0],
  7773. u = "string" == typeof c,
  7774. d = [].slice.call(arguments, 1),
  7775. f = e.isPlainObject(o) ? e.extend(!0, {}, e.site.settings, o) : e.extend({}, e.site.settings),
  7776. m = f.namespace,
  7777. g = f.error,
  7778. p = "module-" + m,
  7779. h = e(n),
  7780. v = this,
  7781. b = h.data(p);return a = { initialize: function initialize() {
  7782. a.instantiate();
  7783. }, instantiate: function instantiate() {
  7784. a.verbose("Storing instance of site", a), b = a, h.data(p, a);
  7785. }, normalize: function normalize() {
  7786. a.fix.console(), a.fix.requestAnimationFrame();
  7787. }, fix: { console: function (_console) {
  7788. function console() {
  7789. return _console.apply(this, arguments);
  7790. }
  7791. console.toString = function () {
  7792. return _console.toString();
  7793. };
  7794. return console;
  7795. }(function () {
  7796. a.debug("Normalizing window.console"), console !== i && console.log !== i || (a.verbose("Console not available, normalizing events"), a.disable.console()), void 0 !== console.group && void 0 !== console.groupEnd && void 0 !== console.groupCollapsed || (a.verbose("Console group not available, normalizing events"), t.console.group = function () {}, t.console.groupEnd = function () {}, t.console.groupCollapsed = function () {}), void 0 === console.markTimeline && (a.verbose("Mark timeline not available, normalizing events"), t.console.markTimeline = function () {});
  7797. }), consoleClear: function consoleClear() {
  7798. a.debug("Disabling programmatic console clearing"), t.console.clear = function () {};
  7799. }, requestAnimationFrame: function requestAnimationFrame() {
  7800. a.debug("Normalizing requestAnimationFrame"), t.requestAnimationFrame === i && (a.debug("RequestAnimationFrame not available, normalizing event"), t.requestAnimationFrame = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  7801. setTimeout(e, 0);
  7802. });
  7803. } }, moduleExists: function moduleExists(t) {
  7804. return e.fn[t] !== i && e.fn[t].settings !== i;
  7805. }, enabled: { modules: function modules(t) {
  7806. var n = [];return t = t || f.modules, e.each(t, function (e, t) {
  7807. a.moduleExists(t) && n.push(t);
  7808. }), n;
  7809. } }, disabled: { modules: function modules(t) {
  7810. var n = [];return t = t || f.modules, e.each(t, function (e, t) {
  7811. a.moduleExists(t) || n.push(t);
  7812. }), n;
  7813. } }, change: { setting: function setting(t, n, o, r) {
  7814. o = "string" == typeof o ? "all" === o ? f.modules : [o] : o || f.modules, r = r === i || r, e.each(o, function (i, o) {
  7815. var s,
  7816. l = !a.moduleExists(o) || e.fn[o].settings.namespace || !1;a.moduleExists(o) && (a.verbose("Changing default setting", t, n, o), e.fn[o].settings[t] = n, r && l && (s = e(":data(module-" + l + ")")).length > 0 && (a.verbose("Modifying existing settings", s), s[o]("setting", t, n)));
  7817. });
  7818. }, settings: function settings(t, n, o) {
  7819. n = "string" == typeof n ? [n] : n || f.modules, o = o === i || o, e.each(n, function (n, i) {
  7820. var r;a.moduleExists(i) && (a.verbose("Changing default setting", t, i), e.extend(!0, e.fn[i].settings, t), o && m && (r = e(":data(module-" + m + ")")).length > 0 && (a.verbose("Modifying existing settings", r), r[i]("setting", t)));
  7821. });
  7822. } }, enable: { console: function console() {
  7823. a.console(!0);
  7824. }, debug: function debug(e, t) {
  7825. e = e || f.modules, a.debug("Enabling debug for modules", e), a.change.setting("debug", !0, e, t);
  7826. }, verbose: function verbose(e, t) {
  7827. e = e || f.modules, a.debug("Enabling verbose debug for modules", e), a.change.setting("verbose", !0, e, t);
  7828. } }, disable: { console: function console() {
  7829. a.console(!1);
  7830. }, debug: function debug(e, t) {
  7831. e = e || f.modules, a.debug("Disabling debug for modules", e), a.change.setting("debug", !1, e, t);
  7832. }, verbose: function verbose(e, t) {
  7833. e = e || f.modules, a.debug("Disabling verbose debug for modules", e), a.change.setting("verbose", !1, e, t);
  7834. } }, console: function console(e) {
  7835. if (e) {
  7836. if (b.cache.console === i) return void a.error(g.console);a.debug("Restoring console function"), t.console = b.cache.console;
  7837. } else a.debug("Disabling console function"), b.cache.console = t.console, t.console = { clear: function clear() {}, error: function error() {}, group: function group() {}, groupCollapsed: function groupCollapsed() {}, groupEnd: function groupEnd() {}, info: function info() {}, log: function log() {}, markTimeline: function markTimeline() {}, warn: function warn() {} };
  7838. }, destroy: function destroy() {
  7839. a.verbose("Destroying previous site for", h), h.removeData(p);
  7840. }, cache: {}, setting: function setting(t, n) {
  7841. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  7842. if (n === i) return f[t];f[t] = n;
  7843. }
  7844. }, internal: function internal(t, n) {
  7845. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  7846. if (n === i) return a[t];a[t] = n;
  7847. }
  7848. }, debug: function debug() {
  7849. f.debug && (f.performance ? a.performance.log(arguments) : (a.debug = Function.prototype.bind.call(console.info, console, f.name + ":"), a.debug.apply(console, arguments)));
  7850. }, verbose: function verbose() {
  7851. f.verbose && f.debug && (f.performance ? a.performance.log(arguments) : (a.verbose = Function.prototype.bind.call(console.info, console, f.name + ":"), a.verbose.apply(console, arguments)));
  7852. }, error: function error() {
  7853. a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments);
  7854. }, performance: { log: function log(e) {
  7855. var t, n;f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Element: v, Name: e[0], Arguments: [].slice.call(e, 1) || "", "Execution Time": n })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500);
  7856. }, display: function display() {
  7857. var t = f.name + ":",
  7858. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  7859. n += t["Execution Time"];
  7860. }), t += " " + n + "ms", (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  7861. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  7862. }), console.groupEnd()), l = [];
  7863. } }, invoke: function invoke(t, n, o) {
  7864. var s,
  7865. l,
  7866. c,
  7867. u = b;return n = n || d, o = v || o, "string" == typeof t && u !== i && (t = t.split(/[\. ]/), s = t.length - 1, e.each(t, function (n, o) {
  7868. var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(u[r]) && n != s) u = u[r];else {
  7869. if (u[r] !== i) return l = u[r], !1;if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(g.method, t), !1);u = u[o];
  7870. }
  7871. })), e.isFunction(l) ? c = l.apply(o, n) : l !== i && (c = l), e.isArray(r) ? r.push(c) : r !== i ? r = [r, c] : c !== i && (r = c), l;
  7872. } }, u ? (b === i && a.initialize(), a.invoke(c)) : (b !== i && a.destroy(), a.initialize()), r !== i ? r : this;
  7873. }, e.site.settings = { name: "Site", namespace: "site", error: { console: "Console cannot be restored, most likely it was overwritten outside of module", method: "The method you called is not defined." }, debug: !1, verbose: !1, performance: !0, modules: ["accordion", "api", "checkbox", "dimmer", "dropdown", "embed", "form", "modal", "nag", "popup", "rating", "shape", "sidebar", "state", "sticky", "tab", "transition", "visit", "visibility"], siteNamespace: "site", namespaceStub: { cache: {}, config: {}, sections: {}, section: {}, utilities: {} } }, e.extend(e.expr[":"], { data: e.expr.createPseudo ? e.expr.createPseudo(function (t) {
  7874. return function (n) {
  7875. return !!e.data(n, t);
  7876. };
  7877. }) : function (t, n, i) {
  7878. return !!e.data(t, i[3]);
  7879. } });
  7880. }(jQuery, window, document), function (e, t, n, i) {
  7881. "use strict";
  7882. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.form = function (t) {
  7883. var o,
  7884. a = e(this),
  7885. r = a.selector || "",
  7886. s = new Date().getTime(),
  7887. l = [],
  7888. c = arguments[0],
  7889. u = arguments[1],
  7890. d = "string" == typeof c,
  7891. f = [].slice.call(arguments, 1);return a.each(function () {
  7892. var m,
  7893. g,
  7894. p,
  7895. h,
  7896. v,
  7897. b,
  7898. y,
  7899. x,
  7900. C,
  7901. w,
  7902. S,
  7903. k,
  7904. T,
  7905. A,
  7906. R,
  7907. P,
  7908. E = e(this),
  7909. F = this,
  7910. O = [],
  7911. D = !1;(P = { initialize: function initialize() {
  7912. P.get.settings(), d ? (R === i && P.instantiate(), P.invoke(c)) : (R !== i && R.invoke("destroy"), P.verbose("Initializing form validation", E, v), P.bindEvents(), P.set.defaults(), P.instantiate());
  7913. }, instantiate: function instantiate() {
  7914. P.verbose("Storing instance of module", P), R = P, E.data(T, P);
  7915. }, destroy: function destroy() {
  7916. P.verbose("Destroying previous module", R), P.removeEvents(), E.removeData(T);
  7917. }, refresh: function refresh() {
  7918. P.verbose("Refreshing selector cache"), m = E.find(x.field), g = E.find(x.group), p = E.find(x.message), E.find(x.prompt), h = E.find(x.submit), E.find(x.clear), E.find(x.reset);
  7919. }, submit: function submit() {
  7920. P.verbose("Submitting form", E), E.submit();
  7921. }, attachEvents: function attachEvents(t, n) {
  7922. n = n || "submit", e(t).on("click" + A, function (e) {
  7923. P[n](), e.preventDefault();
  7924. });
  7925. }, bindEvents: function bindEvents() {
  7926. P.verbose("Attaching form events"), E.on("submit" + A, P.validate.form).on("blur" + A, x.field, P.event.field.blur).on("click" + A, x.submit, P.submit).on("click" + A, x.reset, P.reset).on("click" + A, x.clear, P.clear), v.keyboardShortcuts && E.on("keydown" + A, x.field, P.event.field.keydown), m.each(function () {
  7927. var t = e(this),
  7928. n = t.prop("type"),
  7929. i = P.get.changeEvent(n, t);e(this).on(i + A, P.event.field.change);
  7930. });
  7931. }, clear: function clear() {
  7932. m.each(function () {
  7933. var t = e(this),
  7934. n = t.parent(),
  7935. i = t.closest(g),
  7936. o = i.find(x.prompt),
  7937. a = t.data(y.defaultValue) || "",
  7938. r = n.is(x.uiCheckbox),
  7939. s = n.is(x.uiDropdown);i.hasClass(C.error) && (P.verbose("Resetting error on field", i), i.removeClass(C.error), o.remove()), s ? (P.verbose("Resetting dropdown value", n, a), n.dropdown("clear")) : r ? t.prop("checked", !1) : (P.verbose("Resetting field value", t, a), t.val(""));
  7940. });
  7941. }, reset: function reset() {
  7942. m.each(function () {
  7943. var t = e(this),
  7944. n = t.parent(),
  7945. o = t.closest(g),
  7946. a = o.find(x.prompt),
  7947. r = t.data(y.defaultValue),
  7948. s = n.is(x.uiCheckbox),
  7949. l = n.is(x.uiDropdown),
  7950. c = o.hasClass(C.error);r !== i && (c && (P.verbose("Resetting error on field", o), o.removeClass(C.error), a.remove()), l ? (P.verbose("Resetting dropdown value", n, r), n.dropdown("restore defaults")) : s ? (P.verbose("Resetting checkbox value", n, r), t.prop("checked", r)) : (P.verbose("Resetting field value", t, r), t.val(r)));
  7951. });
  7952. }, determine: { isValid: function isValid() {
  7953. var t = !0;return e.each(b, function (e, n) {
  7954. P.validate.field(n, e, !0) || (t = !1);
  7955. }), t;
  7956. } }, is: { bracketedRule: function bracketedRule(e) {
  7957. return e.type && e.type.match(v.regExp.bracket);
  7958. }, shorthandFields: function shorthandFields(e) {
  7959. var t = e[Object.keys(e)[0]];return P.is.shorthandRules(t);
  7960. }, shorthandRules: function shorthandRules(t) {
  7961. return "string" == typeof t || e.isArray(t);
  7962. }, empty: function empty(e) {
  7963. return !e || 0 === e.length || (e.is('input[type="checkbox"]') ? !e.is(":checked") : P.is.blank(e));
  7964. }, blank: function blank(t) {
  7965. return "" === e.trim(t.val());
  7966. }, valid: function valid(t) {
  7967. var n = !0;return t ? (P.verbose("Checking if field is valid", t), P.validate.field(b[t], t, !1)) : (P.verbose("Checking if form is valid"), e.each(b, function (e, t) {
  7968. P.is.valid(e) || (n = !1);
  7969. }), n);
  7970. } }, removeEvents: function removeEvents() {
  7971. E.off(A), m.off(A), h.off(A), m.off(A);
  7972. }, event: { field: { keydown: function keydown(t) {
  7973. var n = e(this),
  7974. i = t.which,
  7975. o = n.is(x.input),
  7976. a = n.is(x.checkbox),
  7977. r = n.closest(x.uiDropdown).length > 0,
  7978. s = 13;i == 27 && (P.verbose("Escape key pressed blurring field"), n.blur()), t.ctrlKey || i != s || !o || r || a || (D || (n.one("keyup" + A, P.event.field.keyup), P.submit(), P.debug("Enter pressed on input submitting form")), D = !0);
  7979. }, keyup: function keyup() {
  7980. D = !1;
  7981. }, blur: function blur(t) {
  7982. var n = e(this),
  7983. i = n.closest(g),
  7984. o = P.get.validation(n);i.hasClass(C.error) ? (P.debug("Revalidating field", n, o), o && P.validate.field(o)) : "blur" == v.on && o && P.validate.field(o);
  7985. }, change: function change(t) {
  7986. var n = e(this),
  7987. i = n.closest(g),
  7988. o = P.get.validation(n);o && ("change" == v.on || i.hasClass(C.error) && v.revalidate) && (clearTimeout(P.timer), P.timer = setTimeout(function () {
  7989. P.debug("Revalidating field", n, P.get.validation(n)), P.validate.field(o);
  7990. }, v.delay));
  7991. } } }, get: { ancillaryValue: function ancillaryValue(e) {
  7992. return !(!e.type || !e.value && !P.is.bracketedRule(e)) && (e.value !== i ? e.value : e.type.match(v.regExp.bracket)[1] + "");
  7993. }, ruleName: function ruleName(e) {
  7994. return P.is.bracketedRule(e) ? e.type.replace(e.type.match(v.regExp.bracket)[0], "") : e.type;
  7995. }, changeEvent: function changeEvent(e, t) {
  7996. return "checkbox" == e || "radio" == e || "hidden" == e || t.is("select") ? "change" : P.get.inputEvent();
  7997. }, inputEvent: function inputEvent() {
  7998. return n.createElement("input").oninput !== i ? "input" : n.createElement("input").onpropertychange !== i ? "propertychange" : "keyup";
  7999. }, fieldsFromShorthand: function fieldsFromShorthand(t) {
  8000. var n = {};return e.each(t, function (t, i) {
  8001. "string" == typeof i && (i = [i]), n[t] = { rules: [] }, e.each(i, function (e, i) {
  8002. n[t].rules.push({ type: i });
  8003. });
  8004. }), n;
  8005. }, prompt: function prompt(t, n) {
  8006. var i,
  8007. o,
  8008. a = P.get.ruleName(t),
  8009. r = P.get.ancillaryValue(t),
  8010. s = P.get.field(n.identifier),
  8011. l = s.val(),
  8012. c = e.isFunction(t.prompt) ? t.prompt(l) : t.prompt || v.prompt[a] || v.text.unspecifiedRule,
  8013. u = -1 !== c.search("{value}"),
  8014. d = -1 !== c.search("{name}");return u && (c = c.replace("{value}", s.val())), d && (o = 1 == (i = s.closest(x.group).find("label").eq(0)).length ? i.text() : s.prop("placeholder") || v.text.unspecifiedField, c = c.replace("{name}", o)), c = (c = c.replace("{identifier}", n.identifier)).replace("{ruleValue}", r), t.prompt || P.verbose("Using default validation prompt for type", c, a), c;
  8015. }, settings: function settings() {
  8016. if (e.isPlainObject(t)) {
  8017. var n = Object.keys(t);n.length > 0 && t[n[0]].identifier !== i && t[n[0]].rules !== i ? (v = e.extend(!0, {}, e.fn.form.settings, u), b = e.extend({}, e.fn.form.settings.defaults, t), P.error(v.error.oldSyntax, F), P.verbose("Extending settings from legacy parameters", b, v)) : (t.fields && P.is.shorthandFields(t.fields) && (t.fields = P.get.fieldsFromShorthand(t.fields)), v = e.extend(!0, {}, e.fn.form.settings, t), b = e.extend({}, e.fn.form.settings.defaults, v.fields), P.verbose("Extending settings", b, v));
  8018. } else v = e.fn.form.settings, b = e.fn.form.settings.defaults, P.verbose("Using default form validation", b, v);k = v.namespace, y = v.metadata, x = v.selector, C = v.className, w = v.regExp, S = v.error, T = "module-" + k, A = "." + k, R = E.data(T), P.refresh();
  8019. }, field: function field(t) {
  8020. return P.verbose("Finding field with identifier", t), t = P.escape.string(t), m.filter("#" + t).length > 0 ? m.filter("#" + t) : m.filter('[name="' + t + '"]').length > 0 ? m.filter('[name="' + t + '"]') : m.filter('[name="' + t + '[]"]').length > 0 ? m.filter('[name="' + t + '[]"]') : m.filter("[data-" + y.validate + '="' + t + '"]').length > 0 ? m.filter("[data-" + y.validate + '="' + t + '"]') : e("<input/>");
  8021. }, fields: function fields(t) {
  8022. var n = e();return e.each(t, function (e, t) {
  8023. n = n.add(P.get.field(t));
  8024. }), n;
  8025. }, validation: function validation(t) {
  8026. var n, i;return !!b && (e.each(b, function (e, o) {
  8027. i = o.identifier || e, P.get.field(i)[0] == t[0] && (o.identifier = i, n = o);
  8028. }), n || !1);
  8029. }, value: function value(e) {
  8030. var t = [];return t.push(e), P.get.values.call(F, t)[e];
  8031. }, values: function values(t) {
  8032. var n = {};return (e.isArray(t) ? P.get.fields(t) : m).each(function (t, o) {
  8033. var a = e(o),
  8034. r = (a.prop("type"), a.prop("name")),
  8035. s = a.val(),
  8036. l = a.is(x.checkbox),
  8037. c = a.is(x.radio),
  8038. u = -1 !== r.indexOf("[]"),
  8039. d = !!l && a.is(":checked");r && (u ? (r = r.replace("[]", ""), n[r] || (n[r] = []), l ? d ? n[r].push(s || !0) : n[r].push(!1) : n[r].push(s)) : c ? n[r] !== i && 0 != n[r] || (n[r] = !!d && (s || !0)) : n[r] = l ? !!d && (s || !0) : s);
  8040. }), n;
  8041. } }, has: { field: function field(e) {
  8042. return P.verbose("Checking for existence of a field with identifier", e), "string" != typeof (e = P.escape.string(e)) && P.error(S.identifier, e), m.filter("#" + e).length > 0 || m.filter('[name="' + e + '"]').length > 0 || m.filter("[data-" + y.validate + '="' + e + '"]').length > 0;
  8043. } }, escape: { string: function string(e) {
  8044. return (e = String(e)).replace(w.escape, "\\$&");
  8045. } }, add: { rule: function rule(e, t) {
  8046. P.add.field(e, t);
  8047. }, field: function field(t, n) {
  8048. var i = {};P.is.shorthandRules(n) ? (n = e.isArray(n) ? n : [n], i[t] = { rules: [] }, e.each(n, function (e, n) {
  8049. i[t].rules.push({ type: n });
  8050. })) : i[t] = n, b = e.extend({}, b, i), P.debug("Adding rules", i, b);
  8051. }, fields: function fields(t) {
  8052. var n;n = t && P.is.shorthandFields(t) ? P.get.fieldsFromShorthand(t) : t, b = e.extend({}, b, n);
  8053. }, prompt: function prompt(t, n) {
  8054. var o = P.get.field(t).closest(g),
  8055. a = o.children(x.prompt),
  8056. r = 0 !== a.length;n = "string" == typeof n ? [n] : n, P.verbose("Adding field error state", t), o.addClass(C.error), v.inline && (r || (a = v.templates.prompt(n)).appendTo(o), a.html(n[0]), r ? P.verbose("Inline errors are disabled, no inline error added", t) : v.transition && e.fn.transition !== i && E.transition("is supported") ? (P.verbose("Displaying error with css transition", v.transition), a.transition(v.transition + " in", v.duration)) : (P.verbose("Displaying error with fallback javascript animation"), a.fadeIn(v.duration)));
  8057. }, errors: function errors(e) {
  8058. P.debug("Adding form error messages", e), P.set.error(), p.html(v.templates.error(e));
  8059. } }, remove: { rule: function rule(t, n) {
  8060. var o = e.isArray(n) ? n : [n];if (n == i) return P.debug("Removed all rules"), void (b[t].rules = []);b[t] != i && e.isArray(b[t].rules) && e.each(b[t].rules, function (e, n) {
  8061. -1 !== o.indexOf(n.type) && (P.debug("Removed rule", n.type), b[t].rules.splice(e, 1));
  8062. });
  8063. }, field: function field(t) {
  8064. var n = e.isArray(t) ? t : [t];e.each(n, function (e, t) {
  8065. P.remove.rule(t);
  8066. });
  8067. }, rules: function rules(t, n) {
  8068. e.isArray(t) ? e.each(fields, function (e, t) {
  8069. P.remove.rule(t, n);
  8070. }) : P.remove.rule(t, n);
  8071. }, fields: function fields(e) {
  8072. P.remove.field(e);
  8073. }, prompt: function prompt(t) {
  8074. var n = P.get.field(t).closest(g),
  8075. o = n.children(x.prompt);n.removeClass(C.error), v.inline && o.is(":visible") && (P.verbose("Removing prompt for field", t), v.transition && e.fn.transition !== i && E.transition("is supported") ? o.transition(v.transition + " out", v.duration, function () {
  8076. o.remove();
  8077. }) : o.fadeOut(v.duration, function () {
  8078. o.remove();
  8079. }));
  8080. } }, set: { success: function success() {
  8081. E.removeClass(C.error).addClass(C.success);
  8082. }, defaults: function defaults() {
  8083. m.each(function () {
  8084. var t = e(this),
  8085. n = t.filter(x.checkbox).length > 0 ? t.is(":checked") : t.val();t.data(y.defaultValue, n);
  8086. });
  8087. }, error: function error() {
  8088. E.removeClass(C.success).addClass(C.error);
  8089. }, value: function value(e, t) {
  8090. var n = {};return n[e] = t, P.set.values.call(F, n);
  8091. }, values: function values(t) {
  8092. e.isEmptyObject(t) || e.each(t, function (t, n) {
  8093. var i,
  8094. o = P.get.field(t),
  8095. a = o.parent(),
  8096. r = e.isArray(n),
  8097. s = a.is(x.uiCheckbox),
  8098. l = a.is(x.uiDropdown),
  8099. c = o.is(x.radio) && s;o.length > 0 && (r && s ? (P.verbose("Selecting multiple", n, o), a.checkbox("uncheck"), e.each(n, function (e, t) {
  8100. i = o.filter('[value="' + t + '"]'), a = i.parent(), i.length > 0 && a.checkbox("check");
  8101. })) : c ? (P.verbose("Selecting radio value", n, o), o.filter('[value="' + n + '"]').parent(x.uiCheckbox).checkbox("check")) : s ? (P.verbose("Setting checkbox value", n, a), !0 === n ? a.checkbox("check") : a.checkbox("uncheck")) : l ? (P.verbose("Setting dropdown value", n, a), a.dropdown("set selected", n)) : (P.verbose("Setting field value", n, o), o.val(n)));
  8102. });
  8103. } }, validate: { form: function form(e, t) {
  8104. var n = P.get.values();if (D) return !1;if (O = [], P.determine.isValid()) {
  8105. if (P.debug("Form has no validation errors, submitting"), P.set.success(), !0 !== t) return v.onSuccess.call(F, e, n);
  8106. } else if (P.debug("Form has errors"), P.set.error(), v.inline || P.add.errors(O), E.data("moduleApi") !== i && e.stopImmediatePropagation(), !0 !== t) return v.onFailure.call(F, O, n);
  8107. }, field: function field(t, n, o) {
  8108. o = o === i || o, "string" == typeof t && (P.verbose("Validating field", t), n = t, t = b[t]);var a = t.identifier || n,
  8109. r = P.get.field(a),
  8110. s = !!t.depends && P.get.field(t.depends),
  8111. l = !0,
  8112. c = [];return t.identifier || (P.debug("Using field name as identifier", a), t.identifier = a), r.prop("disabled") ? (P.debug("Field is disabled. Skipping", a), l = !0) : t.optional && P.is.blank(r) ? (P.debug("Field is optional and blank. Skipping", a), l = !0) : t.depends && P.is.empty(s) ? (P.debug("Field depends on another value that is not present or empty. Skipping", s), l = !0) : t.rules !== i && e.each(t.rules, function (e, n) {
  8113. P.has.field(a) && !P.validate.rule(t, n) && (P.debug("Field is invalid", a, n.type), c.push(P.get.prompt(n, t)), l = !1);
  8114. }), l ? (o && (P.remove.prompt(a, c), v.onValid.call(r)), !0) : (o && (O = O.concat(c), P.add.prompt(a, c), v.onInvalid.call(r, c)), !1);
  8115. }, rule: function rule(t, n) {
  8116. var o = P.get.field(t.identifier),
  8117. a = (n.type, o.val()),
  8118. r = P.get.ancillaryValue(n),
  8119. s = P.get.ruleName(n),
  8120. l = v.rules[s];if (e.isFunction(l)) return a = a === i || "" === a || null === a ? "" : e.trim(a + ""), l.call(o, a, r);P.error(S.noRule, s);
  8121. } }, setting: function setting(t, n) {
  8122. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  8123. if (n === i) return v[t];v[t] = n;
  8124. }
  8125. }, internal: function internal(t, n) {
  8126. if (e.isPlainObject(t)) e.extend(!0, P, t);else {
  8127. if (n === i) return P[t];P[t] = n;
  8128. }
  8129. }, debug: function debug() {
  8130. !v.silent && v.debug && (v.performance ? P.performance.log(arguments) : (P.debug = Function.prototype.bind.call(console.info, console, v.name + ":"), P.debug.apply(console, arguments)));
  8131. }, verbose: function verbose() {
  8132. !v.silent && v.verbose && v.debug && (v.performance ? P.performance.log(arguments) : (P.verbose = Function.prototype.bind.call(console.info, console, v.name + ":"), P.verbose.apply(console, arguments)));
  8133. }, error: function error() {
  8134. v.silent || (P.error = Function.prototype.bind.call(console.error, console, v.name + ":"), P.error.apply(console, arguments));
  8135. }, performance: { log: function log(e) {
  8136. var t, n;v.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: F, "Execution Time": n })), clearTimeout(P.performance.timer), P.performance.timer = setTimeout(P.performance.display, 500);
  8137. }, display: function display() {
  8138. var t = v.name + ":",
  8139. n = 0;s = !1, clearTimeout(P.performance.timer), e.each(l, function (e, t) {
  8140. n += t["Execution Time"];
  8141. }), t += " " + n + "ms", r && (t += " '" + r + "'"), a.length > 1 && (t += " (" + a.length + ")"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  8142. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  8143. }), console.groupEnd()), l = [];
  8144. } }, invoke: function invoke(t, n, a) {
  8145. var r,
  8146. s,
  8147. l,
  8148. c = R;return n = n || f, a = F || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  8149. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  8150. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  8151. }
  8152. })), e.isFunction(s) ? l = s.apply(a, n) : s !== i && (l = s), e.isArray(o) ? o.push(l) : o !== i ? o = [o, l] : l !== i && (o = l), s;
  8153. } }).initialize();
  8154. }), o !== i ? o : this;
  8155. }, e.fn.form.settings = { name: "Form", namespace: "form", debug: !1, verbose: !1, performance: !0, fields: !1, keyboardShortcuts: !0, on: "submit", inline: !1, delay: 200, revalidate: !0, transition: "scale", duration: 200, onValid: function onValid() {}, onInvalid: function onInvalid() {}, onSuccess: function onSuccess() {
  8156. return !0;
  8157. }, onFailure: function onFailure() {
  8158. return !1;
  8159. }, metadata: { defaultValue: "default", validate: "validate" }, regExp: { htmlID: /^[a-zA-Z][\w:.-]*$/g, bracket: /\[(.*)\]/i, decimal: /^\d+\.?\d*$/, email: /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i, escape: /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, flags: /^\/(.*)\/(.*)?/, integer: /^\-?\d+$/, number: /^\-?\d*(\.\d+)?$/, url: /(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/i }, text: { unspecifiedRule: "Please enter a valid value", unspecifiedField: "This field" }, prompt: { empty: "{name} must have a value", checked: "{name} must be checked", email: "{name} must be a valid e-mail", url: "{name} must be a valid url", regExp: "{name} is not formatted correctly", integer: "{name} must be an integer", decimal: "{name} must be a decimal number", number: "{name} must be set to a number", is: '{name} must be "{ruleValue}"', isExactly: '{name} must be exactly "{ruleValue}"', not: '{name} cannot be set to "{ruleValue}"', notExactly: '{name} cannot be set to exactly "{ruleValue}"', contain: '{name} must contain "{ruleValue}"', containExactly: '{name} must contain exactly "{ruleValue}"', doesntContain: '{name} cannot contain "{ruleValue}"', doesntContainExactly: '{name} cannot contain exactly "{ruleValue}"', minLength: "{name} must be at least {ruleValue} characters", length: "{name} must be at least {ruleValue} characters", exactLength: "{name} must be exactly {ruleValue} characters", maxLength: "{name} cannot be longer than {ruleValue} characters", match: "{name} must match {ruleValue} field", different: "{name} must have a different value than {ruleValue} field", creditCard: "{name} must be a valid credit card number", minCount: "{name} must have at least {ruleValue} choices", exactCount: "{name} must have exactly {ruleValue} choices", maxCount: "{name} must have {ruleValue} or less choices" }, selector: { checkbox: 'input[type="checkbox"], input[type="radio"]', clear: ".clear", field: "input, textarea, select", group: ".field", input: "input", message: ".error.message", prompt: ".prompt.label", radio: 'input[type="radio"]', reset: '.reset:not([type="reset"])', submit: '.submit:not([type="submit"])', uiCheckbox: ".ui.checkbox", uiDropdown: ".ui.dropdown" }, className: { error: "error", label: "ui prompt label", pressed: "down", success: "success" }, error: { identifier: "You must specify a string identifier for each field", method: "The method you called is not defined.", noRule: "There is no rule matching the one you specified", oldSyntax: "Starting in 2.0 forms now only take a single settings object. Validation settings converted to new syntax automatically." }, templates: { error: function error(t) {
  8160. var n = '<ul class="list">';return e.each(t, function (e, t) {
  8161. n += "<li>" + t + "</li>";
  8162. }), e(n += "</ul>");
  8163. }, prompt: function prompt(t) {
  8164. return e("<div/>").addClass("ui basic red pointing prompt label").html(t[0]);
  8165. } }, rules: { empty: function empty(t) {
  8166. return !(t === i || "" === t || e.isArray(t) && 0 === t.length);
  8167. }, checked: function checked() {
  8168. return e(this).filter(":checked").length > 0;
  8169. }, email: function email(t) {
  8170. return e.fn.form.settings.regExp.email.test(t);
  8171. }, url: function url(t) {
  8172. return e.fn.form.settings.regExp.url.test(t);
  8173. }, regExp: function regExp(t, n) {
  8174. if (n instanceof RegExp) return t.match(n);var i,
  8175. o = n.match(e.fn.form.settings.regExp.flags);return o && (n = o.length >= 2 ? o[1] : n, i = o.length >= 3 ? o[2] : ""), t.match(new RegExp(n, i));
  8176. }, integer: function integer(t, n) {
  8177. var o,
  8178. a,
  8179. r,
  8180. s = e.fn.form.settings.regExp.integer;return n && -1 === ["", ".."].indexOf(n) && (-1 == n.indexOf("..") ? s.test(n) && (o = a = n - 0) : (r = n.split("..", 2), s.test(r[0]) && (o = r[0] - 0), s.test(r[1]) && (a = r[1] - 0))), s.test(t) && (o === i || t >= o) && (a === i || t <= a);
  8181. }, decimal: function decimal(t) {
  8182. return e.fn.form.settings.regExp.decimal.test(t);
  8183. }, number: function number(t) {
  8184. return e.fn.form.settings.regExp.number.test(t);
  8185. }, is: function is(e, t) {
  8186. return t = "string" == typeof t ? t.toLowerCase() : t, (e = "string" == typeof e ? e.toLowerCase() : e) == t;
  8187. }, isExactly: function isExactly(e, t) {
  8188. return e == t;
  8189. }, not: function not(e, t) {
  8190. return (e = "string" == typeof e ? e.toLowerCase() : e) != (t = "string" == typeof t ? t.toLowerCase() : t);
  8191. }, notExactly: function notExactly(e, t) {
  8192. return e != t;
  8193. }, contains: function contains(t, n) {
  8194. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n, "i"));
  8195. }, containsExactly: function containsExactly(t, n) {
  8196. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n));
  8197. }, doesntContain: function doesntContain(t, n) {
  8198. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n, "i"));
  8199. }, doesntContainExactly: function doesntContainExactly(t, n) {
  8200. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n));
  8201. }, minLength: function minLength(e, t) {
  8202. return e !== i && e.length >= t;
  8203. }, length: function length(e, t) {
  8204. return e !== i && e.length >= t;
  8205. }, exactLength: function exactLength(e, t) {
  8206. return e !== i && e.length == t;
  8207. }, maxLength: function maxLength(e, t) {
  8208. return e !== i && e.length <= t;
  8209. }, match: function match(t, n) {
  8210. var o;e(this);return e('[data-validate="' + n + '"]').length > 0 ? o = e('[data-validate="' + n + '"]').val() : e("#" + n).length > 0 ? o = e("#" + n).val() : e('[name="' + n + '"]').length > 0 ? o = e('[name="' + n + '"]').val() : e('[name="' + n + '[]"]').length > 0 && (o = e('[name="' + n + '[]"]')), o !== i && t.toString() == o.toString();
  8211. }, different: function different(t, n) {
  8212. var o;e(this);return e('[data-validate="' + n + '"]').length > 0 ? o = e('[data-validate="' + n + '"]').val() : e("#" + n).length > 0 ? o = e("#" + n).val() : e('[name="' + n + '"]').length > 0 ? o = e('[name="' + n + '"]').val() : e('[name="' + n + '[]"]').length > 0 && (o = e('[name="' + n + '[]"]')), o !== i && t.toString() !== o.toString();
  8213. }, creditCard: function creditCard(t, n) {
  8214. var i,
  8215. o,
  8216. a = { visa: { pattern: /^4/, length: [16] }, amex: { pattern: /^3[47]/, length: [15] }, mastercard: { pattern: /^5[1-5]/, length: [16] }, discover: { pattern: /^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)/, length: [16] }, unionPay: { pattern: /^(62|88)/, length: [16, 17, 18, 19] }, jcb: { pattern: /^35(2[89]|[3-8][0-9])/, length: [16] }, maestro: { pattern: /^(5018|5020|5038|6304|6759|676[1-3])/, length: [12, 13, 14, 15, 16, 17, 18, 19] }, dinersClub: { pattern: /^(30[0-5]|^36)/, length: [14] }, laser: { pattern: /^(6304|670[69]|6771)/, length: [16, 17, 18, 19] }, visaElectron: { pattern: /^(4026|417500|4508|4844|491(3|7))/, length: [16] } },
  8217. r = {},
  8218. s = !1,
  8219. l = "string" == typeof n && n.split(",");if ("string" == typeof t && 0 !== t.length) {
  8220. if (t = t.replace(/[\-]/g, ""), l && (e.each(l, function (n, i) {
  8221. (o = a[i]) && (r = { length: -1 !== e.inArray(t.length, o.length), pattern: -1 !== t.search(o.pattern) }).length && r.pattern && (s = !0);
  8222. }), !s)) return !1;if ((i = { number: -1 !== e.inArray(t.length, a.unionPay.length), pattern: -1 !== t.search(a.unionPay.pattern) }).number && i.pattern) return !0;for (var c = t.length, u = 0, d = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 2, 4, 6, 8, 1, 3, 5, 7, 9]], f = 0; c--;) {
  8223. f += d[u][parseInt(t.charAt(c), 10)], u ^= 1;
  8224. }return f % 10 == 0 && f > 0;
  8225. }
  8226. }, minCount: function minCount(e, t) {
  8227. return 0 == t || (1 == t ? "" !== e : e.split(",").length >= t);
  8228. }, exactCount: function exactCount(e, t) {
  8229. return 0 == t ? "" === e : 1 == t ? "" !== e && -1 === e.search(",") : e.split(",").length == t;
  8230. }, maxCount: function maxCount(e, t) {
  8231. return 0 != t && (1 == t ? -1 === e.search(",") : e.split(",").length <= t);
  8232. } } };
  8233. }(jQuery, window, document), function (e, t, n, i) {
  8234. "use strict";
  8235. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.accordion = function (n) {
  8236. var o,
  8237. a = e(this),
  8238. r = new Date().getTime(),
  8239. s = [],
  8240. l = arguments[0],
  8241. c = "string" == typeof l,
  8242. u = [].slice.call(arguments, 1);t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;return a.each(function () {
  8243. var d,
  8244. f,
  8245. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.accordion.settings, n) : e.extend({}, e.fn.accordion.settings),
  8246. g = m.className,
  8247. p = m.namespace,
  8248. h = m.selector,
  8249. v = m.error,
  8250. b = "." + p,
  8251. y = "module-" + p,
  8252. x = a.selector || "",
  8253. C = e(this),
  8254. w = C.find(h.title),
  8255. S = C.find(h.content),
  8256. k = this,
  8257. T = C.data(y);f = { initialize: function initialize() {
  8258. f.debug("Initializing", C), f.bind.events(), m.observeChanges && f.observeChanges(), f.instantiate();
  8259. }, instantiate: function instantiate() {
  8260. T = f, C.data(y, f);
  8261. }, destroy: function destroy() {
  8262. f.debug("Destroying previous instance", C), C.off(b).removeData(y);
  8263. }, refresh: function refresh() {
  8264. w = C.find(h.title), S = C.find(h.content);
  8265. }, observeChanges: function observeChanges() {
  8266. "MutationObserver" in t && ((d = new MutationObserver(function (e) {
  8267. f.debug("DOM tree modified, updating selector cache"), f.refresh();
  8268. })).observe(k, { childList: !0, subtree: !0 }), f.debug("Setting up mutation observer", d));
  8269. }, bind: { events: function events() {
  8270. f.debug("Binding delegated events"), C.on(m.on + b, h.trigger, f.event.click);
  8271. } }, event: { click: function click() {
  8272. f.toggle.call(this);
  8273. } }, toggle: function toggle(t) {
  8274. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  8275. o = n.next(S),
  8276. a = o.hasClass(g.animating),
  8277. r = o.hasClass(g.active),
  8278. s = r && !a,
  8279. l = !r && a;f.debug("Toggling visibility of content", n), s || l ? m.collapsible ? f.close.call(n) : f.debug("Cannot close accordion content collapsing is disabled") : f.open.call(n);
  8280. }, open: function open(t) {
  8281. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  8282. o = n.next(S),
  8283. a = o.hasClass(g.animating);o.hasClass(g.active) || a ? f.debug("Accordion already open, skipping", o) : (f.debug("Opening accordion content", n), m.onOpening.call(o), m.onChanging.call(o), m.exclusive && f.closeOthers.call(n), n.addClass(g.active), o.stop(!0, !0).addClass(g.animating), m.animateChildren && (e.fn.transition !== i && C.transition("is supported") ? o.children().transition({ animation: "fade in", queue: !1, useFailSafe: !0, debug: m.debug, verbose: m.verbose, duration: m.duration }) : o.children().stop(!0, !0).animate({ opacity: 1 }, m.duration, f.resetOpacity)), o.slideDown(m.duration, m.easing, function () {
  8284. o.removeClass(g.animating).addClass(g.active), f.reset.display.call(this), m.onOpen.call(this), m.onChange.call(this);
  8285. }));
  8286. }, close: function close(t) {
  8287. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  8288. o = n.next(S),
  8289. a = o.hasClass(g.animating),
  8290. r = o.hasClass(g.active);!r && !(!r && a) || r && a || (f.debug("Closing accordion content", o), m.onClosing.call(o), m.onChanging.call(o), n.removeClass(g.active), o.stop(!0, !0).addClass(g.animating), m.animateChildren && (e.fn.transition !== i && C.transition("is supported") ? o.children().transition({ animation: "fade out", queue: !1, useFailSafe: !0, debug: m.debug, verbose: m.verbose, duration: m.duration }) : o.children().stop(!0, !0).animate({ opacity: 0 }, m.duration, f.resetOpacity)), o.slideUp(m.duration, m.easing, function () {
  8291. o.removeClass(g.animating).removeClass(g.active), f.reset.display.call(this), m.onClose.call(this), m.onChange.call(this);
  8292. }));
  8293. }, closeOthers: function closeOthers(t) {
  8294. var n,
  8295. o,
  8296. a,
  8297. r = t !== i ? w.eq(t) : e(this).closest(h.title),
  8298. s = r.parents(h.content).prev(h.title),
  8299. l = r.closest(h.accordion),
  8300. c = h.title + "." + g.active + ":visible",
  8301. u = h.content + "." + g.active + ":visible";m.closeNested ? a = (n = l.find(c).not(s)).next(S) : (n = l.find(c).not(s), o = l.find(u).find(c).not(s), a = (n = n.not(o)).next(S)), n.length > 0 && (f.debug("Exclusive enabled, closing other content", n), n.removeClass(g.active), a.removeClass(g.animating).stop(!0, !0), m.animateChildren && (e.fn.transition !== i && C.transition("is supported") ? a.children().transition({ animation: "fade out", useFailSafe: !0, debug: m.debug, verbose: m.verbose, duration: m.duration }) : a.children().stop(!0, !0).animate({ opacity: 0 }, m.duration, f.resetOpacity)), a.slideUp(m.duration, m.easing, function () {
  8302. e(this).removeClass(g.active), f.reset.display.call(this);
  8303. }));
  8304. }, reset: { display: function display() {
  8305. f.verbose("Removing inline display from element", this), e(this).css("display", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  8306. }, opacity: function opacity() {
  8307. f.verbose("Removing inline opacity from element", this), e(this).css("opacity", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  8308. } }, setting: function setting(t, n) {
  8309. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  8310. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  8311. }
  8312. }, internal: function internal(t, n) {
  8313. if (f.debug("Changing internal", t, n), n === i) return f[t];e.isPlainObject(t) ? e.extend(!0, f, t) : f[t] = n;
  8314. }, debug: function debug() {
  8315. !m.silent && m.debug && (m.performance ? f.performance.log(arguments) : (f.debug = Function.prototype.bind.call(console.info, console, m.name + ":"), f.debug.apply(console, arguments)));
  8316. }, verbose: function verbose() {
  8317. !m.silent && m.verbose && m.debug && (m.performance ? f.performance.log(arguments) : (f.verbose = Function.prototype.bind.call(console.info, console, m.name + ":"), f.verbose.apply(console, arguments)));
  8318. }, error: function error() {
  8319. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  8320. }, performance: { log: function log(e) {
  8321. var t, n;m.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: k, "Execution Time": n })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500);
  8322. }, display: function display() {
  8323. var t = m.name + ":",
  8324. n = 0;r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  8325. n += t["Execution Time"];
  8326. }), t += " " + n + "ms", x && (t += " '" + x + "'"), (console.group !== i || console.table !== i) && s.length > 0 && (console.groupCollapsed(t), console.table ? console.table(s) : e.each(s, function (e, t) {
  8327. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  8328. }), console.groupEnd()), s = [];
  8329. } }, invoke: function invoke(t, n, a) {
  8330. var r,
  8331. s,
  8332. l,
  8333. c = T;return n = n || u, a = k || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  8334. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  8335. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (f.error(v.method, t), !1);c = c[o];
  8336. }
  8337. })), e.isFunction(s) ? l = s.apply(a, n) : s !== i && (l = s), e.isArray(o) ? o.push(l) : o !== i ? o = [o, l] : l !== i && (o = l), s;
  8338. } }, c ? (T === i && f.initialize(), f.invoke(l)) : (T !== i && T.invoke("destroy"), f.initialize());
  8339. }), o !== i ? o : this;
  8340. }, e.fn.accordion.settings = { name: "Accordion", namespace: "accordion", silent: !1, debug: !1, verbose: !1, performance: !0, on: "click", observeChanges: !0, exclusive: !0, collapsible: !0, closeNested: !1, animateChildren: !0, duration: 350, easing: "easeOutQuad", onOpening: function onOpening() {}, onClosing: function onClosing() {}, onChanging: function onChanging() {}, onOpen: function onOpen() {}, onClose: function onClose() {}, onChange: function onChange() {}, error: { method: "The method you called is not defined" }, className: { active: "active", animating: "animating" }, selector: { accordion: ".accordion", title: ".title", trigger: ".title", content: ".content" } }, e.extend(e.easing, { easeOutQuad: function easeOutQuad(e, t, n, i, o) {
  8341. return -i * (t /= o) * (t - 2) + n;
  8342. } });
  8343. }(jQuery, window, document), function (e, t, n, i) {
  8344. "use strict";
  8345. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.checkbox = function (o) {
  8346. var a,
  8347. r = e(this),
  8348. s = r.selector || "",
  8349. l = new Date().getTime(),
  8350. c = [],
  8351. u = arguments[0],
  8352. d = "string" == typeof u,
  8353. f = [].slice.call(arguments, 1);return r.each(function () {
  8354. var r,
  8355. m,
  8356. g = e.extend(!0, {}, e.fn.checkbox.settings, o),
  8357. p = g.className,
  8358. h = g.namespace,
  8359. v = g.selector,
  8360. b = g.error,
  8361. y = "." + h,
  8362. x = "module-" + h,
  8363. C = e(this),
  8364. w = e(this).children(v.label),
  8365. S = e(this).children(v.input),
  8366. k = S[0],
  8367. T = !1,
  8368. A = !1,
  8369. R = C.data(x),
  8370. P = this;m = { initialize: function initialize() {
  8371. m.verbose("Initializing checkbox", g), m.create.label(), m.bind.events(), m.set.tabbable(), m.hide.input(), m.observeChanges(), m.instantiate(), m.setup();
  8372. }, instantiate: function instantiate() {
  8373. m.verbose("Storing instance of module", m), R = m, C.data(x, m);
  8374. }, destroy: function destroy() {
  8375. m.verbose("Destroying module"), m.unbind.events(), m.show.input(), C.removeData(x);
  8376. }, fix: { reference: function reference() {
  8377. C.is(v.input) && (m.debug("Behavior called on <input> adjusting invoked element"), C = C.closest(v.checkbox), m.refresh());
  8378. } }, setup: function setup() {
  8379. m.set.initialLoad(), m.is.indeterminate() ? (m.debug("Initial value is indeterminate"), m.indeterminate()) : m.is.checked() ? (m.debug("Initial value is checked"), m.check()) : (m.debug("Initial value is unchecked"), m.uncheck()), m.remove.initialLoad();
  8380. }, refresh: function refresh() {
  8381. w = C.children(v.label), S = C.children(v.input), k = S[0];
  8382. }, hide: { input: function input() {
  8383. m.verbose("Modifying <input> z-index to be unselectable"), S.addClass(p.hidden);
  8384. } }, show: { input: function input() {
  8385. m.verbose("Modifying <input> z-index to be selectable"), S.removeClass(p.hidden);
  8386. } }, observeChanges: function observeChanges() {
  8387. "MutationObserver" in t && ((r = new MutationObserver(function (e) {
  8388. m.debug("DOM tree modified, updating selector cache"), m.refresh();
  8389. })).observe(P, { childList: !0, subtree: !0 }), m.debug("Setting up mutation observer", r));
  8390. }, attachEvents: function attachEvents(t, n) {
  8391. var i = e(t);n = e.isFunction(m[n]) ? m[n] : m.toggle, i.length > 0 ? (m.debug("Attaching checkbox events to element", t, n), i.on("click" + y, n)) : m.error(b.notFound);
  8392. }, event: { click: function click(t) {
  8393. var n = e(t.target);n.is(v.input) ? m.verbose("Using default check action on initialized checkbox") : n.is(v.link) ? m.debug("Clicking link inside checkbox, skipping toggle") : (m.toggle(), S.focus(), t.preventDefault());
  8394. }, keydown: function keydown(e) {
  8395. var t = e.which,
  8396. n = 13,
  8397. i = 32;t == 27 ? (m.verbose("Escape key pressed blurring field"), S.blur(), A = !0) : e.ctrlKey || t != i && t != n ? A = !1 : (m.verbose("Enter/space key pressed, toggling checkbox"), m.toggle(), A = !0);
  8398. }, keyup: function keyup(e) {
  8399. A && e.preventDefault();
  8400. } }, check: function check() {
  8401. m.should.allowCheck() && (m.debug("Checking checkbox", S), m.set.checked(), m.should.ignoreCallbacks() || (g.onChecked.call(k), g.onChange.call(k)));
  8402. }, uncheck: function uncheck() {
  8403. m.should.allowUncheck() && (m.debug("Unchecking checkbox"), m.set.unchecked(), m.should.ignoreCallbacks() || (g.onUnchecked.call(k), g.onChange.call(k)));
  8404. }, indeterminate: function indeterminate() {
  8405. m.should.allowIndeterminate() ? m.debug("Checkbox is already indeterminate") : (m.debug("Making checkbox indeterminate"), m.set.indeterminate(), m.should.ignoreCallbacks() || (g.onIndeterminate.call(k), g.onChange.call(k)));
  8406. }, determinate: function determinate() {
  8407. m.should.allowDeterminate() ? m.debug("Checkbox is already determinate") : (m.debug("Making checkbox determinate"), m.set.determinate(), m.should.ignoreCallbacks() || (g.onDeterminate.call(k), g.onChange.call(k)));
  8408. }, enable: function enable() {
  8409. m.is.enabled() ? m.debug("Checkbox is already enabled") : (m.debug("Enabling checkbox"), m.set.enabled(), g.onEnable.call(k), g.onEnabled.call(k));
  8410. }, disable: function disable() {
  8411. m.is.disabled() ? m.debug("Checkbox is already disabled") : (m.debug("Disabling checkbox"), m.set.disabled(), g.onDisable.call(k), g.onDisabled.call(k));
  8412. }, get: { radios: function radios() {
  8413. var t = m.get.name();return e('input[name="' + t + '"]').closest(v.checkbox);
  8414. }, otherRadios: function otherRadios() {
  8415. return m.get.radios().not(C);
  8416. }, name: function name() {
  8417. return S.attr("name");
  8418. } }, is: { initialLoad: function initialLoad() {
  8419. return T;
  8420. }, radio: function radio() {
  8421. return S.hasClass(p.radio) || "radio" == S.attr("type");
  8422. }, indeterminate: function indeterminate() {
  8423. return S.prop("indeterminate") !== i && S.prop("indeterminate");
  8424. }, checked: function checked() {
  8425. return S.prop("checked") !== i && S.prop("checked");
  8426. }, disabled: function disabled() {
  8427. return S.prop("disabled") !== i && S.prop("disabled");
  8428. }, enabled: function enabled() {
  8429. return !m.is.disabled();
  8430. }, determinate: function determinate() {
  8431. return !m.is.indeterminate();
  8432. }, unchecked: function unchecked() {
  8433. return !m.is.checked();
  8434. } }, should: { allowCheck: function allowCheck() {
  8435. return m.is.determinate() && m.is.checked() && !m.should.forceCallbacks() ? (m.debug("Should not allow check, checkbox is already checked"), !1) : !1 !== g.beforeChecked.apply(k) || (m.debug("Should not allow check, beforeChecked cancelled"), !1);
  8436. }, allowUncheck: function allowUncheck() {
  8437. return m.is.determinate() && m.is.unchecked() && !m.should.forceCallbacks() ? (m.debug("Should not allow uncheck, checkbox is already unchecked"), !1) : !1 !== g.beforeUnchecked.apply(k) || (m.debug("Should not allow uncheck, beforeUnchecked cancelled"), !1);
  8438. }, allowIndeterminate: function allowIndeterminate() {
  8439. return m.is.indeterminate() && !m.should.forceCallbacks() ? (m.debug("Should not allow indeterminate, checkbox is already indeterminate"), !1) : !1 !== g.beforeIndeterminate.apply(k) || (m.debug("Should not allow indeterminate, beforeIndeterminate cancelled"), !1);
  8440. }, allowDeterminate: function allowDeterminate() {
  8441. return m.is.determinate() && !m.should.forceCallbacks() ? (m.debug("Should not allow determinate, checkbox is already determinate"), !1) : !1 !== g.beforeDeterminate.apply(k) || (m.debug("Should not allow determinate, beforeDeterminate cancelled"), !1);
  8442. }, forceCallbacks: function forceCallbacks() {
  8443. return m.is.initialLoad() && g.fireOnInit;
  8444. }, ignoreCallbacks: function ignoreCallbacks() {
  8445. return T && !g.fireOnInit;
  8446. } }, can: { change: function change() {
  8447. return !(C.hasClass(p.disabled) || C.hasClass(p.readOnly) || S.prop("disabled") || S.prop("readonly"));
  8448. }, uncheck: function uncheck() {
  8449. return "boolean" == typeof g.uncheckable ? g.uncheckable : !m.is.radio();
  8450. } }, set: { initialLoad: function initialLoad() {
  8451. T = !0;
  8452. }, checked: function checked() {
  8453. m.verbose("Setting class to checked"), C.removeClass(p.indeterminate).addClass(p.checked), m.is.radio() && m.uncheckOthers(), m.is.indeterminate() || !m.is.checked() ? (m.verbose("Setting state to checked", k), S.prop("indeterminate", !1).prop("checked", !0), m.trigger.change()) : m.debug("Input is already checked, skipping input property change");
  8454. }, unchecked: function unchecked() {
  8455. m.verbose("Removing checked class"), C.removeClass(p.indeterminate).removeClass(p.checked), m.is.indeterminate() || !m.is.unchecked() ? (m.debug("Setting state to unchecked"), S.prop("indeterminate", !1).prop("checked", !1), m.trigger.change()) : m.debug("Input is already unchecked");
  8456. }, indeterminate: function indeterminate() {
  8457. m.verbose("Setting class to indeterminate"), C.addClass(p.indeterminate), m.is.indeterminate() ? m.debug("Input is already indeterminate, skipping input property change") : (m.debug("Setting state to indeterminate"), S.prop("indeterminate", !0), m.trigger.change());
  8458. }, determinate: function determinate() {
  8459. m.verbose("Removing indeterminate class"), C.removeClass(p.indeterminate), m.is.determinate() ? m.debug("Input is already determinate, skipping input property change") : (m.debug("Setting state to determinate"), S.prop("indeterminate", !1));
  8460. }, disabled: function disabled() {
  8461. m.verbose("Setting class to disabled"), C.addClass(p.disabled), m.is.disabled() ? m.debug("Input is already disabled, skipping input property change") : (m.debug("Setting state to disabled"), S.prop("disabled", "disabled"), m.trigger.change());
  8462. }, enabled: function enabled() {
  8463. m.verbose("Removing disabled class"), C.removeClass(p.disabled), m.is.enabled() ? m.debug("Input is already enabled, skipping input property change") : (m.debug("Setting state to enabled"), S.prop("disabled", !1), m.trigger.change());
  8464. }, tabbable: function tabbable() {
  8465. m.verbose("Adding tabindex to checkbox"), S.attr("tabindex") === i && S.attr("tabindex", 0);
  8466. } }, remove: { initialLoad: function initialLoad() {
  8467. T = !1;
  8468. } }, trigger: { change: function change() {
  8469. var e = n.createEvent("HTMLEvents"),
  8470. t = S[0];t && (m.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  8471. } }, create: { label: function label() {
  8472. S.prevAll(v.label).length > 0 ? (S.prev(v.label).detach().insertAfter(S), m.debug("Moving existing label", w)) : m.has.label() || (w = e("<label>").insertAfter(S), m.debug("Creating label", w));
  8473. } }, has: { label: function label() {
  8474. return w.length > 0;
  8475. } }, bind: { events: function events() {
  8476. m.verbose("Attaching checkbox events"), C.on("click" + y, m.event.click).on("keydown" + y, v.input, m.event.keydown).on("keyup" + y, v.input, m.event.keyup);
  8477. } }, unbind: { events: function events() {
  8478. m.debug("Removing events"), C.off(y);
  8479. } }, uncheckOthers: function uncheckOthers() {
  8480. var e = m.get.otherRadios();m.debug("Unchecking other radios", e), e.removeClass(p.checked);
  8481. }, toggle: function toggle() {
  8482. m.can.change() ? m.is.indeterminate() || m.is.unchecked() ? (m.debug("Currently unchecked"), m.check()) : m.is.checked() && m.can.uncheck() && (m.debug("Currently checked"), m.uncheck()) : m.is.radio() || m.debug("Checkbox is read-only or disabled, ignoring toggle");
  8483. }, setting: function setting(t, n) {
  8484. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  8485. if (n === i) return g[t];e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  8486. }
  8487. }, internal: function internal(t, n) {
  8488. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  8489. if (n === i) return m[t];m[t] = n;
  8490. }
  8491. }, debug: function debug() {
  8492. !g.silent && g.debug && (g.performance ? m.performance.log(arguments) : (m.debug = Function.prototype.bind.call(console.info, console, g.name + ":"), m.debug.apply(console, arguments)));
  8493. }, verbose: function verbose() {
  8494. !g.silent && g.verbose && g.debug && (g.performance ? m.performance.log(arguments) : (m.verbose = Function.prototype.bind.call(console.info, console, g.name + ":"), m.verbose.apply(console, arguments)));
  8495. }, error: function error() {
  8496. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  8497. }, performance: { log: function log(e) {
  8498. var t, n;g.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: P, "Execution Time": n })), clearTimeout(m.performance.timer), m.performance.timer = setTimeout(m.performance.display, 500);
  8499. }, display: function display() {
  8500. var t = g.name + ":",
  8501. n = 0;l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  8502. n += t["Execution Time"];
  8503. }), t += " " + n + "ms", s && (t += " '" + s + "'"), (console.group !== i || console.table !== i) && c.length > 0 && (console.groupCollapsed(t), console.table ? console.table(c) : e.each(c, function (e, t) {
  8504. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  8505. }), console.groupEnd()), c = [];
  8506. } }, invoke: function invoke(t, n, o) {
  8507. var r,
  8508. s,
  8509. l,
  8510. c = R;return n = n || f, o = P || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  8511. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  8512. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (m.error(b.method, t), !1);c = c[o];
  8513. }
  8514. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  8515. } }, d ? (R === i && m.initialize(), m.invoke(u)) : (R !== i && R.invoke("destroy"), m.initialize());
  8516. }), a !== i ? a : this;
  8517. }, e.fn.checkbox.settings = { name: "Checkbox", namespace: "checkbox", silent: !1, debug: !1, verbose: !0, performance: !0, uncheckable: "auto", fireOnInit: !1, onChange: function onChange() {}, beforeChecked: function beforeChecked() {}, beforeUnchecked: function beforeUnchecked() {}, beforeDeterminate: function beforeDeterminate() {}, beforeIndeterminate: function beforeIndeterminate() {}, onChecked: function onChecked() {}, onUnchecked: function onUnchecked() {}, onDeterminate: function onDeterminate() {}, onIndeterminate: function onIndeterminate() {}, onEnable: function onEnable() {}, onDisable: function onDisable() {}, onEnabled: function onEnabled() {}, onDisabled: function onDisabled() {}, className: { checked: "checked", indeterminate: "indeterminate", disabled: "disabled", hidden: "hidden", radio: "radio", readOnly: "read-only" }, error: { method: "The method you called is not defined" }, selector: { checkbox: ".ui.checkbox", label: "label, .box", input: 'input[type="checkbox"], input[type="radio"]', link: "a[href]" } };
  8518. }(jQuery, window, document), function (e, t, n, i) {
  8519. "use strict";
  8520. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dimmer = function (t) {
  8521. var o,
  8522. a = e(this),
  8523. r = new Date().getTime(),
  8524. s = [],
  8525. l = arguments[0],
  8526. c = "string" == typeof l,
  8527. u = [].slice.call(arguments, 1);return a.each(function () {
  8528. var d,
  8529. f,
  8530. m,
  8531. g = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.dimmer.settings, t) : e.extend({}, e.fn.dimmer.settings),
  8532. p = g.selector,
  8533. h = g.namespace,
  8534. v = g.className,
  8535. b = g.error,
  8536. y = "." + h,
  8537. x = "module-" + h,
  8538. C = a.selector || "",
  8539. w = "ontouchstart" in n.documentElement ? "touchstart" : "click",
  8540. S = e(this),
  8541. k = this,
  8542. T = S.data(x);(m = { preinitialize: function preinitialize() {
  8543. m.is.dimmer() ? (f = S.parent(), d = S) : (f = S, d = m.has.dimmer() ? g.dimmerName ? f.find(p.dimmer).filter("." + g.dimmerName) : f.find(p.dimmer) : m.create(), m.set.variation());
  8544. }, initialize: function initialize() {
  8545. m.debug("Initializing dimmer", g), m.bind.events(), m.set.dimmable(), m.instantiate();
  8546. }, instantiate: function instantiate() {
  8547. m.verbose("Storing instance of module", m), T = m, S.data(x, T);
  8548. }, destroy: function destroy() {
  8549. m.verbose("Destroying previous module", d), m.unbind.events(), m.remove.variation(), f.off(y);
  8550. }, bind: { events: function events() {
  8551. m.is.page() && f.get(0).addEventListener("touchmove", m.event.preventScroll, { passive: !1 }), "hover" == g.on ? f.on("mouseenter" + y, m.show).on("mouseleave" + y, m.hide) : "click" == g.on && f.on(w + y, m.toggle), m.is.page() && (m.debug("Setting as a page dimmer", f), m.set.pageDimmer()), m.is.closable() && (m.verbose("Adding dimmer close event", d), f.on(w + y, p.dimmer, m.event.click));
  8552. } }, unbind: { events: function events() {
  8553. m.is.page() && f.get(0).removeEventListener("touchmove", m.event.preventScroll, { passive: !1 }), S.removeData(x), f.off(y);
  8554. } }, event: { click: function click(t) {
  8555. m.verbose("Determining if event occured on dimmer", t), (0 === d.find(t.target).length || e(t.target).is(p.content)) && (m.hide(), t.stopImmediatePropagation());
  8556. }, preventScroll: function preventScroll(e) {
  8557. e.preventDefault();
  8558. } }, addContent: function addContent(t) {
  8559. var n = e(t);m.debug("Add content to dimmer", n), n.parent()[0] !== d[0] && n.detach().appendTo(d);
  8560. }, create: function create() {
  8561. var t = e(g.template.dimmer());return g.dimmerName && (m.debug("Creating named dimmer", g.dimmerName), t.addClass(g.dimmerName)), t.appendTo(f), t;
  8562. }, show: function show(t) {
  8563. t = e.isFunction(t) ? t : function () {}, m.debug("Showing dimmer", d, g), m.is.dimmed() && !m.is.animating() || !m.is.enabled() ? m.debug("Dimmer is already shown or disabled") : (m.animate.show(t), g.onShow.call(k), g.onChange.call(k));
  8564. }, hide: function hide(t) {
  8565. t = e.isFunction(t) ? t : function () {}, m.is.dimmed() || m.is.animating() ? (m.debug("Hiding dimmer", d), m.animate.hide(t), g.onHide.call(k), g.onChange.call(k)) : m.debug("Dimmer is not visible");
  8566. }, toggle: function toggle() {
  8567. m.verbose("Toggling dimmer visibility", d), m.is.dimmed() ? m.hide() : m.show();
  8568. }, animate: { show: function show(t) {
  8569. t = e.isFunction(t) ? t : function () {}, g.useCSS && e.fn.transition !== i && d.transition("is supported") ? ("auto" !== g.opacity && m.set.opacity(), d.transition({ displayType: "flex", animation: g.transition + " in", queue: !1, duration: m.get.duration(), useFailSafe: !0, onStart: function onStart() {
  8570. m.set.dimmed();
  8571. }, onComplete: function onComplete() {
  8572. m.set.active(), t();
  8573. } })) : (m.verbose("Showing dimmer animation with javascript"), m.set.dimmed(), "auto" == g.opacity && (g.opacity = .8), d.stop().css({ opacity: 0, width: "100%", height: "100%" }).fadeTo(m.get.duration(), g.opacity, function () {
  8574. d.removeAttr("style"), m.set.active(), t();
  8575. }));
  8576. }, hide: function hide(t) {
  8577. t = e.isFunction(t) ? t : function () {}, g.useCSS && e.fn.transition !== i && d.transition("is supported") ? (m.verbose("Hiding dimmer with css"), d.transition({ displayType: "flex", animation: g.transition + " out", queue: !1, duration: m.get.duration(), useFailSafe: !0, onStart: function onStart() {
  8578. m.remove.dimmed();
  8579. }, onComplete: function onComplete() {
  8580. m.remove.active(), t();
  8581. } })) : (m.verbose("Hiding dimmer with javascript"), m.remove.dimmed(), d.stop().fadeOut(m.get.duration(), function () {
  8582. m.remove.active(), d.removeAttr("style"), t();
  8583. }));
  8584. } }, get: { dimmer: function dimmer() {
  8585. return d;
  8586. }, duration: function duration() {
  8587. return "object" == _typeof(g.duration) ? m.is.active() ? g.duration.hide : g.duration.show : g.duration;
  8588. } }, has: { dimmer: function dimmer() {
  8589. return g.dimmerName ? S.find(p.dimmer).filter("." + g.dimmerName).length > 0 : S.find(p.dimmer).length > 0;
  8590. } }, is: { active: function active() {
  8591. return d.hasClass(v.active);
  8592. }, animating: function animating() {
  8593. return d.is(":animated") || d.hasClass(v.animating);
  8594. }, closable: function closable() {
  8595. return "auto" == g.closable ? "hover" != g.on : g.closable;
  8596. }, dimmer: function dimmer() {
  8597. return S.hasClass(v.dimmer);
  8598. }, dimmable: function dimmable() {
  8599. return S.hasClass(v.dimmable);
  8600. }, dimmed: function dimmed() {
  8601. return f.hasClass(v.dimmed);
  8602. }, disabled: function disabled() {
  8603. return f.hasClass(v.disabled);
  8604. }, enabled: function enabled() {
  8605. return !m.is.disabled();
  8606. }, page: function page() {
  8607. return f.is("body");
  8608. }, pageDimmer: function pageDimmer() {
  8609. return d.hasClass(v.pageDimmer);
  8610. } }, can: { show: function show() {
  8611. return !d.hasClass(v.disabled);
  8612. } }, set: { opacity: function opacity(e) {
  8613. var t = d.css("background-color"),
  8614. n = t.split(","),
  8615. i = n && 3 == n.length,
  8616. o = n && 4 == n.length;e = 0 === g.opacity ? 0 : g.opacity || e, i || o ? (n[3] = e + ")", t = n.join(",")) : t = "rgba(0, 0, 0, " + e + ")", m.debug("Setting opacity to", e), d.css("background-color", t);
  8617. }, active: function active() {
  8618. d.addClass(v.active);
  8619. }, dimmable: function dimmable() {
  8620. f.addClass(v.dimmable);
  8621. }, dimmed: function dimmed() {
  8622. f.addClass(v.dimmed);
  8623. }, pageDimmer: function pageDimmer() {
  8624. d.addClass(v.pageDimmer);
  8625. }, disabled: function disabled() {
  8626. d.addClass(v.disabled);
  8627. }, variation: function variation(e) {
  8628. (e = e || g.variation) && d.addClass(e);
  8629. } }, remove: { active: function active() {
  8630. d.removeClass(v.active);
  8631. }, dimmed: function dimmed() {
  8632. f.removeClass(v.dimmed);
  8633. }, disabled: function disabled() {
  8634. d.removeClass(v.disabled);
  8635. }, variation: function variation(e) {
  8636. (e = e || g.variation) && d.removeClass(e);
  8637. } }, setting: function setting(t, n) {
  8638. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  8639. if (n === i) return g[t];e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  8640. }
  8641. }, internal: function internal(t, n) {
  8642. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  8643. if (n === i) return m[t];m[t] = n;
  8644. }
  8645. }, debug: function debug() {
  8646. !g.silent && g.debug && (g.performance ? m.performance.log(arguments) : (m.debug = Function.prototype.bind.call(console.info, console, g.name + ":"), m.debug.apply(console, arguments)));
  8647. }, verbose: function verbose() {
  8648. !g.silent && g.verbose && g.debug && (g.performance ? m.performance.log(arguments) : (m.verbose = Function.prototype.bind.call(console.info, console, g.name + ":"), m.verbose.apply(console, arguments)));
  8649. }, error: function error() {
  8650. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  8651. }, performance: { log: function log(e) {
  8652. var t, n;g.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: k, "Execution Time": n })), clearTimeout(m.performance.timer), m.performance.timer = setTimeout(m.performance.display, 500);
  8653. }, display: function display() {
  8654. var t = g.name + ":",
  8655. n = 0;r = !1, clearTimeout(m.performance.timer), e.each(s, function (e, t) {
  8656. n += t["Execution Time"];
  8657. }), t += " " + n + "ms", C && (t += " '" + C + "'"), a.length > 1 && (t += " (" + a.length + ")"), (console.group !== i || console.table !== i) && s.length > 0 && (console.groupCollapsed(t), console.table ? console.table(s) : e.each(s, function (e, t) {
  8658. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  8659. }), console.groupEnd()), s = [];
  8660. } }, invoke: function invoke(t, n, a) {
  8661. var r,
  8662. s,
  8663. l,
  8664. c = T;return n = n || u, a = k || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  8665. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  8666. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (m.error(b.method, t), !1);c = c[o];
  8667. }
  8668. })), e.isFunction(s) ? l = s.apply(a, n) : s !== i && (l = s), e.isArray(o) ? o.push(l) : o !== i ? o = [o, l] : l !== i && (o = l), s;
  8669. } }).preinitialize(), c ? (T === i && m.initialize(), m.invoke(l)) : (T !== i && T.invoke("destroy"), m.initialize());
  8670. }), o !== i ? o : this;
  8671. }, e.fn.dimmer.settings = { name: "Dimmer", namespace: "dimmer", silent: !1, debug: !1, verbose: !1, performance: !0, dimmerName: !1, variation: !1, closable: "auto", useCSS: !0, transition: "fade", on: !1, opacity: "auto", duration: { show: 500, hide: 500 }, onChange: function onChange() {}, onShow: function onShow() {}, onHide: function onHide() {}, error: { method: "The method you called is not defined." }, className: { active: "active", animating: "animating", dimmable: "dimmable", dimmed: "dimmed", dimmer: "dimmer", disabled: "disabled", hide: "hide", pageDimmer: "page", show: "show" }, selector: { dimmer: "> .ui.dimmer", content: ".ui.dimmer > .content, .ui.dimmer > .content > .center" }, template: { dimmer: function dimmer() {
  8672. return e("<div />").attr("class", "ui dimmer");
  8673. } } };
  8674. }(jQuery, window, document), function (e, t, n, i) {
  8675. "use strict";
  8676. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dropdown = function (o) {
  8677. var a,
  8678. r = e(this),
  8679. s = e(n),
  8680. l = r.selector || "",
  8681. c = "ontouchstart" in n.documentElement,
  8682. u = new Date().getTime(),
  8683. d = [],
  8684. f = arguments[0],
  8685. m = "string" == typeof f,
  8686. g = [].slice.call(arguments, 1);return r.each(function (p) {
  8687. var h,
  8688. v,
  8689. b,
  8690. y,
  8691. x,
  8692. C,
  8693. w,
  8694. S,
  8695. k = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.dropdown.settings, o) : e.extend({}, e.fn.dropdown.settings),
  8696. T = k.className,
  8697. A = k.message,
  8698. R = k.fields,
  8699. P = k.keys,
  8700. E = k.metadata,
  8701. F = k.namespace,
  8702. O = k.regExp,
  8703. D = k.selector,
  8704. q = k.error,
  8705. j = k.templates,
  8706. z = "." + F,
  8707. I = "module-" + F,
  8708. M = e(this),
  8709. L = e(k.context),
  8710. V = M.find(D.text),
  8711. N = M.find(D.search),
  8712. H = M.find(D.sizer),
  8713. U = M.find(D.input),
  8714. W = M.find(D.icon),
  8715. B = M.prev().find(D.text).length > 0 ? M.prev().find(D.text) : M.prev(),
  8716. Q = M.children(D.menu),
  8717. X = Q.find(D.item),
  8718. $ = !1,
  8719. Y = !1,
  8720. Z = !1,
  8721. K = this,
  8722. J = M.data(I);S = { initialize: function initialize() {
  8723. S.debug("Initializing dropdown", k), S.is.alreadySetup() ? S.setup.reference() : (S.setup.layout(), k.values && S.change.values(k.values), S.refreshData(), S.save.defaults(), S.restore.selected(), S.create.id(), S.bind.events(), S.observeChanges(), S.instantiate());
  8724. }, instantiate: function instantiate() {
  8725. S.verbose("Storing instance of dropdown", S), J = S, M.data(I, S);
  8726. }, destroy: function destroy() {
  8727. S.verbose("Destroying previous dropdown", M), S.remove.tabbable(), M.off(z).removeData(I), Q.off(z), s.off(y), S.disconnect.menuObserver(), S.disconnect.selectObserver();
  8728. }, observeChanges: function observeChanges() {
  8729. "MutationObserver" in t && (C = new MutationObserver(S.event.select.mutation), w = new MutationObserver(S.event.menu.mutation), S.debug("Setting up mutation observer", C, w), S.observe.select(), S.observe.menu());
  8730. }, disconnect: { menuObserver: function menuObserver() {
  8731. w && w.disconnect();
  8732. }, selectObserver: function selectObserver() {
  8733. C && C.disconnect();
  8734. } }, observe: { select: function select() {
  8735. S.has.input() && C.observe(M[0], { childList: !0, subtree: !0 });
  8736. }, menu: function menu() {
  8737. S.has.menu() && w.observe(Q[0], { childList: !0, subtree: !0 });
  8738. } }, create: { id: function id() {
  8739. x = (Math.random().toString(16) + "000000000").substr(2, 8), y = "." + x, S.verbose("Creating unique id for element", x);
  8740. }, userChoice: function userChoice(t) {
  8741. var n, o, a;return !!(t = t || S.get.userValues()) && (t = e.isArray(t) ? t : [t], e.each(t, function (t, r) {
  8742. !1 === S.get.item(r) && (a = k.templates.addition(S.add.variables(A.addResult, r)), o = e("<div />").html(a).attr("data-" + E.value, r).attr("data-" + E.text, r).addClass(T.addition).addClass(T.item), k.hideAdditions && o.addClass(T.hidden), n = n === i ? o : n.add(o), S.verbose("Creating user choices for value", r, o));
  8743. }), n);
  8744. }, userLabels: function userLabels(t) {
  8745. var n = S.get.userValues();n && (S.debug("Adding user labels", n), e.each(n, function (e, t) {
  8746. S.verbose("Adding custom user value"), S.add.label(t, t);
  8747. }));
  8748. }, menu: function menu() {
  8749. Q = e("<div />").addClass(T.menu).appendTo(M);
  8750. }, sizer: function sizer() {
  8751. H = e("<span />").addClass(T.sizer).insertAfter(N);
  8752. } }, search: function search(e) {
  8753. e = e !== i ? e : S.get.query(), S.verbose("Searching for query", e), S.has.minCharacters(e) ? S.filter(e) : S.hide();
  8754. }, select: { firstUnfiltered: function firstUnfiltered() {
  8755. S.verbose("Selecting first non-filtered element"), S.remove.selectedItem(), X.not(D.unselectable).not(D.addition + D.hidden).eq(0).addClass(T.selected);
  8756. }, nextAvailable: function nextAvailable(e) {
  8757. var t = (e = e.eq(0)).nextAll(D.item).not(D.unselectable).eq(0),
  8758. n = e.prevAll(D.item).not(D.unselectable).eq(0);t.length > 0 ? (S.verbose("Moving selection to", t), t.addClass(T.selected)) : (S.verbose("Moving selection to", n), n.addClass(T.selected));
  8759. } }, setup: { api: function api() {
  8760. var e = { debug: k.debug, urlData: { value: S.get.value(), query: S.get.query() }, on: !1 };S.verbose("First request, initializing API"), M.api(e);
  8761. }, layout: function layout() {
  8762. M.is("select") && (S.setup.select(), S.setup.returnedObject()), S.has.menu() || S.create.menu(), S.is.search() && !S.has.search() && (S.verbose("Adding search input"), N = e("<input />").addClass(T.search).prop("autocomplete", "off").insertBefore(V)), S.is.multiple() && S.is.searchSelection() && !S.has.sizer() && S.create.sizer(), k.allowTab && S.set.tabbable();
  8763. }, select: function select() {
  8764. var t = S.get.selectValues();S.debug("Dropdown initialized on a select", t), M.is("select") && (U = M), U.parent(D.dropdown).length > 0 ? (S.debug("UI dropdown already exists. Creating dropdown menu only"), M = U.closest(D.dropdown), S.has.menu() || S.create.menu(), Q = M.children(D.menu), S.setup.menu(t)) : (S.debug("Creating entire dropdown from select"), M = e("<div />").attr("class", U.attr("class")).addClass(T.selection).addClass(T.dropdown).html(j.dropdown(t)).insertBefore(U), U.hasClass(T.multiple) && !1 === U.prop("multiple") && (S.error(q.missingMultiple), U.prop("multiple", !0)), U.is("[multiple]") && S.set.multiple(), U.prop("disabled") && (S.debug("Disabling dropdown"), M.addClass(T.disabled)), U.removeAttr("class").detach().prependTo(M)), S.refresh();
  8765. }, menu: function menu(e) {
  8766. Q.html(j.menu(e, R)), X = Q.find(D.item);
  8767. }, reference: function reference() {
  8768. S.debug("Dropdown behavior was called on select, replacing with closest dropdown"), M = M.parent(D.dropdown), J = M.data(I), K = M.get(0), S.refresh(), S.setup.returnedObject();
  8769. }, returnedObject: function returnedObject() {
  8770. var e = r.slice(0, p),
  8771. t = r.slice(p + 1);r = e.add(M).add(t);
  8772. } }, refresh: function refresh() {
  8773. S.refreshSelectors(), S.refreshData();
  8774. }, refreshItems: function refreshItems() {
  8775. X = Q.find(D.item);
  8776. }, refreshSelectors: function refreshSelectors() {
  8777. S.verbose("Refreshing selector cache"), V = M.find(D.text), N = M.find(D.search), U = M.find(D.input), W = M.find(D.icon), B = M.prev().find(D.text).length > 0 ? M.prev().find(D.text) : M.prev(), Q = M.children(D.menu), X = Q.find(D.item);
  8778. }, refreshData: function refreshData() {
  8779. S.verbose("Refreshing cached metadata"), X.removeData(E.text).removeData(E.value);
  8780. }, clearData: function clearData() {
  8781. S.verbose("Clearing metadata"), X.removeData(E.text).removeData(E.value), M.removeData(E.defaultText).removeData(E.defaultValue).removeData(E.placeholderText);
  8782. }, toggle: function toggle() {
  8783. S.verbose("Toggling menu visibility"), S.is.active() ? S.hide() : S.show();
  8784. }, show: function show(t) {
  8785. if (t = e.isFunction(t) ? t : function () {}, !S.can.show() && S.is.remote() && (S.debug("No API results retrieved, searching before show"), S.queryRemote(S.get.query(), S.show)), S.can.show() && !S.is.active()) {
  8786. if (S.debug("Showing dropdown"), !S.has.message() || S.has.maxSelections() || S.has.allResultsFiltered() || S.remove.message(), S.is.allFiltered()) return !0;!1 !== k.onShow.call(K) && S.animate.show(function () {
  8787. S.can.click() && S.bind.intent(), S.has.menuSearch() && S.focusSearch(), S.set.visible(), t.call(K);
  8788. });
  8789. }
  8790. }, hide: function hide(t) {
  8791. t = e.isFunction(t) ? t : function () {}, S.is.active() && !S.is.animatingOutward() && (S.debug("Hiding dropdown"), !1 !== k.onHide.call(K) && S.animate.hide(function () {
  8792. S.remove.visible(), t.call(K);
  8793. }));
  8794. }, hideOthers: function hideOthers() {
  8795. S.verbose("Finding other dropdowns to hide"), r.not(M).has(D.menu + "." + T.visible).dropdown("hide");
  8796. }, hideMenu: function hideMenu() {
  8797. S.verbose("Hiding menu instantaneously"), S.remove.active(), S.remove.visible(), Q.transition("hide");
  8798. }, hideSubMenus: function hideSubMenus() {
  8799. var e = Q.children(D.item).find(D.menu);S.verbose("Hiding sub menus", e), e.transition("hide");
  8800. }, bind: { events: function events() {
  8801. c && S.bind.touchEvents(), S.bind.keyboardEvents(), S.bind.inputEvents(), S.bind.mouseEvents();
  8802. }, touchEvents: function touchEvents() {
  8803. S.debug("Touch device detected binding additional touch events"), S.is.searchSelection() || S.is.single() && M.on("touchstart" + z, S.event.test.toggle), Q.on("touchstart" + z, D.item, S.event.item.mouseenter);
  8804. }, keyboardEvents: function keyboardEvents() {
  8805. S.verbose("Binding keyboard events"), M.on("keydown" + z, S.event.keydown), S.has.search() && M.on(S.get.inputEvent() + z, D.search, S.event.input), S.is.multiple() && s.on("keydown" + y, S.event.document.keydown);
  8806. }, inputEvents: function inputEvents() {
  8807. S.verbose("Binding input change events"), M.on("change" + z, D.input, S.event.change);
  8808. }, mouseEvents: function mouseEvents() {
  8809. S.verbose("Binding mouse events"), S.is.multiple() && M.on("click" + z, D.label, S.event.label.click).on("click" + z, D.remove, S.event.remove.click), S.is.searchSelection() ? (M.on("mousedown" + z, S.event.mousedown).on("mouseup" + z, S.event.mouseup).on("mousedown" + z, D.menu, S.event.menu.mousedown).on("mouseup" + z, D.menu, S.event.menu.mouseup).on("click" + z, D.icon, S.event.icon.click).on("focus" + z, D.search, S.event.search.focus).on("click" + z, D.search, S.event.search.focus).on("blur" + z, D.search, S.event.search.blur).on("click" + z, D.text, S.event.text.focus), S.is.multiple() && M.on("click" + z, S.event.click)) : ("click" == k.on ? M.on("click" + z, D.icon, S.event.icon.click).on("click" + z, S.event.test.toggle) : "hover" == k.on ? M.on("mouseenter" + z, S.delay.show).on("mouseleave" + z, S.delay.hide) : M.on(k.on + z, S.toggle), M.on("mousedown" + z, S.event.mousedown).on("mouseup" + z, S.event.mouseup).on("focus" + z, S.event.focus), S.has.menuSearch() ? M.on("blur" + z, D.search, S.event.search.blur) : M.on("blur" + z, S.event.blur)), Q.on("mouseenter" + z, D.item, S.event.item.mouseenter).on("mouseleave" + z, D.item, S.event.item.mouseleave).on("click" + z, D.item, S.event.item.click);
  8810. }, intent: function intent() {
  8811. S.verbose("Binding hide intent event to document"), c && s.on("touchstart" + y, S.event.test.touch).on("touchmove" + y, S.event.test.touch), s.on("click" + y, S.event.test.hide);
  8812. } }, unbind: { intent: function intent() {
  8813. S.verbose("Removing hide intent event from document"), c && s.off("touchstart" + y).off("touchmove" + y), s.off("click" + y);
  8814. } }, filter: function filter(e) {
  8815. var t = e !== i ? e : S.get.query(),
  8816. n = function n() {
  8817. S.is.multiple() && S.filterActive(), (e || !e && 0 == S.get.activeItem().length) && S.select.firstUnfiltered(), S.has.allResultsFiltered() ? k.onNoResults.call(K, t) ? k.allowAdditions ? k.hideAdditions && (S.verbose("User addition with no menu, setting empty style"), S.set.empty(), S.hideMenu()) : (S.verbose("All items filtered, showing message", t), S.add.message(A.noResults)) : (S.verbose("All items filtered, hiding dropdown", t), S.hideMenu()) : (S.remove.empty(), S.remove.message()), k.allowAdditions && S.add.userSuggestion(e), S.is.searchSelection() && S.can.show() && S.is.focusedOnSearch() && S.show();
  8818. };k.useLabels && S.has.maxSelections() || (k.apiSettings ? S.can.useAPI() ? S.queryRemote(t, function () {
  8819. k.filterRemoteData && S.filterItems(t), n();
  8820. }) : S.error(q.noAPI) : (S.filterItems(t), n()));
  8821. }, queryRemote: function queryRemote(t, n) {
  8822. var i = { errorDuration: !1, cache: "local", throttle: k.throttle, urlData: { query: t }, onError: function onError() {
  8823. S.add.message(A.serverError), n();
  8824. }, onFailure: function onFailure() {
  8825. S.add.message(A.serverError), n();
  8826. }, onSuccess: function onSuccess(t) {
  8827. var i = t[R.remoteValues];e.isArray(i) && i.length > 0 ? (S.remove.message(), S.setup.menu({ values: t[R.remoteValues] })) : S.add.message(A.noResults), n();
  8828. } };M.api("get request") || S.setup.api(), i = e.extend(!0, {}, i, k.apiSettings), M.api("setting", i).api("query");
  8829. }, filterItems: function filterItems(t) {
  8830. var n = t !== i ? t : S.get.query(),
  8831. o = null,
  8832. a = S.escape.string(n),
  8833. r = new RegExp("^" + a, "igm");S.has.query() && (o = [], S.verbose("Searching for matching values", n), X.each(function () {
  8834. var t,
  8835. i,
  8836. a = e(this);if ("both" == k.match || "text" == k.match) {
  8837. if (-1 !== (t = String(S.get.choiceText(a, !1))).search(r)) return o.push(this), !0;if ("exact" === k.fullTextSearch && S.exactSearch(n, t)) return o.push(this), !0;if (!0 === k.fullTextSearch && S.fuzzySearch(n, t)) return o.push(this), !0;
  8838. }if ("both" == k.match || "value" == k.match) {
  8839. if (-1 !== (i = String(S.get.choiceValue(a, t))).search(r)) return o.push(this), !0;if ("exact" === k.fullTextSearch && S.exactSearch(n, i)) return o.push(this), !0;if (!0 === k.fullTextSearch && S.fuzzySearch(n, i)) return o.push(this), !0;
  8840. }
  8841. })), S.debug("Showing only matched items", n), S.remove.filteredItem(), o && X.not(o).addClass(T.filtered);
  8842. }, fuzzySearch: function fuzzySearch(e, t) {
  8843. var n = t.length,
  8844. i = e.length;if (e = e.toLowerCase(), t = t.toLowerCase(), i > n) return !1;if (i === n) return e === t;e: for (var o = 0, a = 0; o < i; o++) {
  8845. for (var r = e.charCodeAt(o); a < n;) {
  8846. if (t.charCodeAt(a++) === r) continue e;
  8847. }return !1;
  8848. }return !0;
  8849. }, exactSearch: function exactSearch(e, t) {
  8850. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  8851. }, filterActive: function filterActive() {
  8852. k.useLabels && X.filter("." + T.active).addClass(T.filtered);
  8853. }, focusSearch: function focusSearch(e) {
  8854. S.has.search() && !S.is.focusedOnSearch() && (e ? (M.off("focus" + z, D.search), N.focus(), M.on("focus" + z, D.search, S.event.search.focus)) : N.focus());
  8855. }, forceSelection: function forceSelection() {
  8856. var e = X.not(T.filtered).filter("." + T.selected).eq(0),
  8857. t = X.not(T.filtered).filter("." + T.active).eq(0),
  8858. n = e.length > 0 ? e : t;if (n.length > 0 && !S.is.multiple()) return S.debug("Forcing partial selection to selected item", n), void S.event.item.click.call(n, {}, !0);k.allowAdditions ? (S.set.selected(S.get.query()), S.remove.searchTerm()) : S.remove.searchTerm();
  8859. }, change: { values: function values(t) {
  8860. k.allowAdditions || S.clear(), S.debug("Creating dropdown with specified values", t), S.setup.menu({ values: t }), e.each(t, function (e, t) {
  8861. if (1 == t.selected) return S.debug("Setting initial selection to", t.value), S.set.selected(t.value), !0;
  8862. });
  8863. } }, event: { change: function change() {
  8864. Z || (S.debug("Input changed, updating selection"), S.set.selected());
  8865. }, focus: function focus() {
  8866. k.showOnFocus && !$ && S.is.hidden() && !v && S.show();
  8867. }, blur: function blur(e) {
  8868. v = n.activeElement === this, $ || v || (S.remove.activeLabel(), S.hide());
  8869. }, mousedown: function mousedown() {
  8870. S.is.searchSelection() ? b = !0 : $ = !0;
  8871. }, mouseup: function mouseup() {
  8872. S.is.searchSelection() ? b = !1 : $ = !1;
  8873. }, click: function click(t) {
  8874. e(t.target).is(M) && (S.is.focusedOnSearch() ? S.show() : S.focusSearch());
  8875. }, search: { focus: function focus() {
  8876. $ = !0, S.is.multiple() && S.remove.activeLabel(), k.showOnFocus && S.search();
  8877. }, blur: function blur(e) {
  8878. v = n.activeElement === this, S.is.searchSelection() && !b && (Y || v || (k.forceSelection && S.forceSelection(), S.hide())), b = !1;
  8879. } }, icon: { click: function click(e) {
  8880. S.toggle();
  8881. } }, text: { focus: function focus(e) {
  8882. $ = !0, S.focusSearch();
  8883. } }, input: function input(e) {
  8884. (S.is.multiple() || S.is.searchSelection()) && S.set.filtered(), clearTimeout(S.timer), S.timer = setTimeout(S.search, k.delay.search);
  8885. }, label: { click: function click(t) {
  8886. var n = e(this),
  8887. i = M.find(D.label),
  8888. o = i.filter("." + T.active),
  8889. a = n.nextAll("." + T.active),
  8890. r = n.prevAll("." + T.active),
  8891. s = a.length > 0 ? n.nextUntil(a).add(o).add(n) : n.prevUntil(r).add(o).add(n);t.shiftKey ? (o.removeClass(T.active), s.addClass(T.active)) : t.ctrlKey ? n.toggleClass(T.active) : (o.removeClass(T.active), n.addClass(T.active)), k.onLabelSelect.apply(this, i.filter("." + T.active));
  8892. } }, remove: { click: function click() {
  8893. var t = e(this).parent();t.hasClass(T.active) ? S.remove.activeLabels() : S.remove.activeLabels(t);
  8894. } }, test: { toggle: function toggle(e) {
  8895. var t = S.is.multiple() ? S.show : S.toggle;S.is.bubbledLabelClick(e) || S.is.bubbledIconClick(e) || S.determine.eventOnElement(e, t) && e.preventDefault();
  8896. }, touch: function touch(e) {
  8897. S.determine.eventOnElement(e, function () {
  8898. "touchstart" == e.type ? S.timer = setTimeout(function () {
  8899. S.hide();
  8900. }, k.delay.touch) : "touchmove" == e.type && clearTimeout(S.timer);
  8901. }), e.stopPropagation();
  8902. }, hide: function hide(e) {
  8903. S.determine.eventInModule(e, S.hide);
  8904. } }, select: { mutation: function mutation(t) {
  8905. S.debug("<select> modified, recreating menu");var n = !1;e.each(t, function (t, i) {
  8906. if (e(i.target).is("select") || e(i.addedNodes).is("select")) return n = !0, !0;
  8907. }), n && (S.disconnect.selectObserver(), S.refresh(), S.setup.select(), S.set.selected(), S.observe.select());
  8908. } }, menu: { mutation: function mutation(t) {
  8909. var n = t[0],
  8910. i = n.addedNodes ? e(n.addedNodes[0]) : e(!1),
  8911. o = n.removedNodes ? e(n.removedNodes[0]) : e(!1),
  8912. a = i.add(o),
  8913. r = a.is(D.addition) || a.closest(D.addition).length > 0,
  8914. s = a.is(D.message) || a.closest(D.message).length > 0;r || s ? (S.debug("Updating item selector cache"), S.refreshItems()) : (S.debug("Menu modified, updating selector cache"), S.refresh());
  8915. }, mousedown: function mousedown() {
  8916. Y = !0;
  8917. }, mouseup: function mouseup() {
  8918. Y = !1;
  8919. } }, item: { mouseenter: function mouseenter(t) {
  8920. var n = e(t.target),
  8921. i = e(this),
  8922. o = i.children(D.menu),
  8923. a = i.siblings(D.item).children(D.menu),
  8924. r = o.length > 0;!(o.find(n).length > 0) && r && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  8925. S.verbose("Showing sub-menu", o), e.each(a, function () {
  8926. S.animate.hide(!1, e(this));
  8927. }), S.animate.show(!1, o);
  8928. }, k.delay.show), t.preventDefault());
  8929. }, mouseleave: function mouseleave(t) {
  8930. var n = e(this).children(D.menu);n.length > 0 && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  8931. S.verbose("Hiding sub-menu", n), S.animate.hide(!1, n);
  8932. }, k.delay.hide));
  8933. }, click: function click(t, i) {
  8934. var o = e(this),
  8935. a = e(t ? t.target : ""),
  8936. r = o.find(D.menu),
  8937. s = S.get.choiceText(o),
  8938. l = S.get.choiceValue(o, s),
  8939. c = r.length > 0,
  8940. u = r.find(a).length > 0;S.has.menuSearch() && e(n.activeElement).blur(), u || c && !k.allowCategorySelection || (S.is.searchSelection() && (k.allowAdditions && S.remove.userAddition(), S.remove.searchTerm(), S.is.focusedOnSearch() || 1 == i || S.focusSearch(!0)), k.useLabels || (S.remove.filteredItem(), S.set.scrollPosition(o)), S.determine.selectAction.call(this, s, l));
  8941. } }, document: { keydown: function keydown(e) {
  8942. var t = e.which;if (S.is.inObject(t, P)) {
  8943. var n = M.find(D.label),
  8944. i = n.filter("." + T.active),
  8945. o = (i.data(E.value), n.index(i)),
  8946. a = n.length,
  8947. r = i.length > 0,
  8948. s = i.length > 1,
  8949. l = 0 === o,
  8950. c = o + 1 == a,
  8951. u = S.is.searchSelection(),
  8952. d = S.is.focusedOnSearch(),
  8953. f = S.is.focused(),
  8954. m = d && 0 === S.get.caretPosition();if (u && !r && !d) return;t == P.leftArrow ? !f && !m || r ? r && (e.shiftKey ? S.verbose("Adding previous label to selection") : (S.verbose("Selecting previous label"), n.removeClass(T.active)), l && !s ? i.addClass(T.active) : i.prev(D.siblingLabel).addClass(T.active).end(), e.preventDefault()) : (S.verbose("Selecting previous label"), n.last().addClass(T.active)) : t == P.rightArrow ? (f && !r && n.first().addClass(T.active), r && (e.shiftKey ? S.verbose("Adding next label to selection") : (S.verbose("Selecting next label"), n.removeClass(T.active)), c ? u ? d ? n.removeClass(T.active) : S.focusSearch() : s ? i.next(D.siblingLabel).addClass(T.active) : i.addClass(T.active) : i.next(D.siblingLabel).addClass(T.active), e.preventDefault())) : t == P.deleteKey || t == P.backspace ? r ? (S.verbose("Removing active labels"), c && u && !d && S.focusSearch(), i.last().next(D.siblingLabel).addClass(T.active), S.remove.activeLabels(i), e.preventDefault()) : m && !r && t == P.backspace && (S.verbose("Removing last label on input backspace"), i = n.last().addClass(T.active), S.remove.activeLabels(i)) : i.removeClass(T.active);
  8955. }
  8956. } }, keydown: function keydown(e) {
  8957. var t = e.which;if (S.is.inObject(t, P)) {
  8958. var n,
  8959. i = X.not(D.unselectable).filter("." + T.selected).eq(0),
  8960. o = Q.children("." + T.active).eq(0),
  8961. a = i.length > 0 ? i : o,
  8962. r = a.length > 0 ? a.siblings(":not(." + T.filtered + ")").addBack() : Q.children(":not(." + T.filtered + ")"),
  8963. s = a.children(D.menu),
  8964. l = a.closest(D.menu),
  8965. c = l.hasClass(T.visible) || l.hasClass(T.animating) || l.parent(D.menu).length > 0,
  8966. u = s.length > 0,
  8967. d = a.length > 0,
  8968. f = a.not(D.unselectable).length > 0,
  8969. m = t == P.delimiter && k.allowAdditions && S.is.multiple();if (k.allowAdditions && k.hideAdditions && (t == P.enter || m) && f && (S.verbose("Selecting item from keyboard shortcut", a), S.event.item.click.call(a, e), S.is.searchSelection() && S.remove.searchTerm()), S.is.visible()) {
  8970. if ((t == P.enter || m) && (t == P.enter && d && u && !k.allowCategorySelection ? (S.verbose("Pressed enter on unselectable category, opening sub menu"), t = P.rightArrow) : f && (S.verbose("Selecting item from keyboard shortcut", a), S.event.item.click.call(a, e), S.is.searchSelection() && S.remove.searchTerm()), e.preventDefault()), d && (t == P.leftArrow && l[0] !== Q[0] && (S.verbose("Left key pressed, closing sub-menu"), S.animate.hide(!1, l), a.removeClass(T.selected), l.closest(D.item).addClass(T.selected), e.preventDefault()), t == P.rightArrow && u && (S.verbose("Right key pressed, opening sub-menu"), S.animate.show(!1, s), a.removeClass(T.selected), s.find(D.item).eq(0).addClass(T.selected), e.preventDefault())), t == P.upArrow) {
  8971. if (n = d && c ? a.prevAll(D.item + ":not(" + D.unselectable + ")").eq(0) : X.eq(0), r.index(n) < 0) return S.verbose("Up key pressed but reached top of current menu"), void e.preventDefault();S.verbose("Up key pressed, changing active item"), a.removeClass(T.selected), n.addClass(T.selected), S.set.scrollPosition(n), k.selectOnKeydown && S.is.single() && S.set.selectedItem(n), e.preventDefault();
  8972. }if (t == P.downArrow) {
  8973. if (0 === (n = d && c ? n = a.nextAll(D.item + ":not(" + D.unselectable + ")").eq(0) : X.eq(0)).length) return S.verbose("Down key pressed but reached bottom of current menu"), void e.preventDefault();S.verbose("Down key pressed, changing active item"), X.removeClass(T.selected), n.addClass(T.selected), S.set.scrollPosition(n), k.selectOnKeydown && S.is.single() && S.set.selectedItem(n), e.preventDefault();
  8974. }t == P.pageUp && (S.scrollPage("up"), e.preventDefault()), t == P.pageDown && (S.scrollPage("down"), e.preventDefault()), t == P.escape && (S.verbose("Escape key pressed, closing dropdown"), S.hide());
  8975. } else m && e.preventDefault(), t != P.downArrow || S.is.visible() || (S.verbose("Down key pressed, showing dropdown"), S.show(), e.preventDefault());
  8976. } else S.has.search() || S.set.selectedLetter(String.fromCharCode(t));
  8977. } }, trigger: { change: function change() {
  8978. var e = n.createEvent("HTMLEvents"),
  8979. t = U[0];t && (S.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  8980. } }, determine: { selectAction: function selectAction(t, n) {
  8981. S.verbose("Determining action", k.action), e.isFunction(S.action[k.action]) ? (S.verbose("Triggering preset action", k.action, t, n), S.action[k.action].call(K, t, n, this)) : e.isFunction(k.action) ? (S.verbose("Triggering user action", k.action, t, n), k.action.call(K, t, n, this)) : S.error(q.action, k.action);
  8982. }, eventInModule: function eventInModule(t, i) {
  8983. var o = e(t.target),
  8984. a = o.closest(n.documentElement).length > 0,
  8985. r = o.closest(M).length > 0;return i = e.isFunction(i) ? i : function () {}, a && !r ? (S.verbose("Triggering event", i), i(), !0) : (S.verbose("Event occurred in dropdown, canceling callback"), !1);
  8986. }, eventOnElement: function eventOnElement(t, i) {
  8987. var o = e(t.target),
  8988. a = o.closest(D.siblingLabel),
  8989. r = n.body.contains(t.target),
  8990. s = 0 === M.find(a).length,
  8991. l = 0 === o.closest(Q).length;return i = e.isFunction(i) ? i : function () {}, r && s && l ? (S.verbose("Triggering event", i), i(), !0) : (S.verbose("Event occurred in dropdown menu, canceling callback"), !1);
  8992. } }, action: { nothing: function nothing() {}, activate: function activate(t, n, o) {
  8993. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  8994. if (S.set.selected(n, e(o)), S.is.multiple() && !S.is.allFiltered()) return;S.hideAndClear();
  8995. }
  8996. }, select: function select(t, n, o) {
  8997. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  8998. if (S.set.value(n, t, e(o)), S.is.multiple() && !S.is.allFiltered()) return;S.hideAndClear();
  8999. }
  9000. }, combo: function combo(t, n, o) {
  9001. n = n !== i ? n : t, S.set.selected(n, e(o)), S.hideAndClear();
  9002. }, hide: function hide(e, t, n) {
  9003. S.set.value(t, e), S.hideAndClear();
  9004. } }, get: { id: function id() {
  9005. return x;
  9006. }, defaultText: function defaultText() {
  9007. return M.data(E.defaultText);
  9008. }, defaultValue: function defaultValue() {
  9009. return M.data(E.defaultValue);
  9010. }, placeholderText: function placeholderText() {
  9011. return "auto" != k.placeholder && "string" == typeof k.placeholder ? k.placeholder : M.data(E.placeholderText) || "";
  9012. }, text: function text() {
  9013. return V.text();
  9014. }, query: function query() {
  9015. return e.trim(N.val());
  9016. }, searchWidth: function searchWidth(e) {
  9017. return e = e !== i ? e : N.val(), H.text(e), Math.ceil(H.width() + 1);
  9018. }, selectionCount: function selectionCount() {
  9019. var t = S.get.values();return S.is.multiple() ? e.isArray(t) ? t.length : 0 : "" !== S.get.value() ? 1 : 0;
  9020. }, transition: function transition(e) {
  9021. return "auto" == k.transition ? S.is.upward(e) ? "slide up" : "slide down" : k.transition;
  9022. }, userValues: function userValues() {
  9023. var t = S.get.values();return !!t && (t = e.isArray(t) ? t : [t], e.grep(t, function (e) {
  9024. return !1 === S.get.item(e);
  9025. }));
  9026. }, uniqueArray: function uniqueArray(t) {
  9027. return e.grep(t, function (n, i) {
  9028. return e.inArray(n, t) === i;
  9029. });
  9030. }, caretPosition: function caretPosition() {
  9031. var e,
  9032. t,
  9033. i = N.get(0);return "selectionStart" in i ? i.selectionStart : n.selection ? (i.focus(), t = (e = n.selection.createRange()).text.length, e.moveStart("character", -i.value.length), e.text.length - t) : void 0;
  9034. }, value: function value() {
  9035. var t = U.length > 0 ? U.val() : M.data(E.value),
  9036. n = e.isArray(t) && 1 === t.length && "" === t[0];return t === i || n ? "" : t;
  9037. }, values: function values() {
  9038. var e = S.get.value();return "" === e ? "" : !S.has.selectInput() && S.is.multiple() ? "string" == typeof e ? e.split(k.delimiter) : "" : e;
  9039. }, remoteValues: function remoteValues() {
  9040. var t = S.get.values(),
  9041. n = !1;return t && ("string" == typeof t && (t = [t]), e.each(t, function (e, t) {
  9042. var i = S.read.remoteData(t);S.verbose("Restoring value from session data", i, t), i && (n || (n = {}), n[t] = i);
  9043. })), n;
  9044. }, choiceText: function choiceText(t, n) {
  9045. if (n = n !== i ? n : k.preserveHTML, t) return t.find(D.menu).length > 0 && (S.verbose("Retrieving text of element with sub-menu"), (t = t.clone()).find(D.menu).remove(), t.find(D.menuIcon).remove()), t.data(E.text) !== i ? t.data(E.text) : n ? e.trim(t.html()) : e.trim(t.text());
  9046. }, choiceValue: function choiceValue(t, n) {
  9047. return n = n || S.get.choiceText(t), !!t && (t.data(E.value) !== i ? String(t.data(E.value)) : "string" == typeof n ? e.trim(n.toLowerCase()) : String(n));
  9048. }, inputEvent: function inputEvent() {
  9049. var e = N[0];return !!e && (e.oninput !== i ? "input" : e.onpropertychange !== i ? "propertychange" : "keyup");
  9050. }, selectValues: function selectValues() {
  9051. var t = { values: [] };return M.find("option").each(function () {
  9052. var n = e(this),
  9053. o = n.html(),
  9054. a = n.attr("disabled"),
  9055. r = n.attr("value") !== i ? n.attr("value") : o;"auto" === k.placeholder && "" === r ? t.placeholder = o : t.values.push({ name: o, value: r, disabled: a });
  9056. }), k.placeholder && "auto" !== k.placeholder && (S.debug("Setting placeholder value to", k.placeholder), t.placeholder = k.placeholder), k.sortSelect ? (t.values.sort(function (e, t) {
  9057. return e.name > t.name ? 1 : -1;
  9058. }), S.debug("Retrieved and sorted values from select", t)) : S.debug("Retrieved values from select", t), t;
  9059. }, activeItem: function activeItem() {
  9060. return X.filter("." + T.active);
  9061. }, selectedItem: function selectedItem() {
  9062. var e = X.not(D.unselectable).filter("." + T.selected);return e.length > 0 ? e : X.eq(0);
  9063. }, itemWithAdditions: function itemWithAdditions(e) {
  9064. var t = S.get.item(e),
  9065. n = S.create.userChoice(e);return n && n.length > 0 && (t = t.length > 0 ? t.add(n) : n), t;
  9066. }, item: function item(t, n) {
  9067. var o,
  9068. a,
  9069. r = !1;return t = t !== i ? t : S.get.values() !== i ? S.get.values() : S.get.text(), o = a ? t.length > 0 : t !== i && null !== t, a = S.is.multiple() && e.isArray(t), n = "" === t || 0 === t || n || !1, o && X.each(function () {
  9070. var o = e(this),
  9071. s = S.get.choiceText(o),
  9072. l = S.get.choiceValue(o, s);if (null !== l && l !== i) if (a) -1 === e.inArray(String(l), t) && -1 === e.inArray(s, t) || (r = r ? r.add(o) : o);else if (n) {
  9073. if (S.verbose("Ambiguous dropdown value using strict type check", o, t), l === t || s === t) return r = o, !0;
  9074. } else if (String(l) == String(t) || s == t) return S.verbose("Found select item by value", l, t), r = o, !0;
  9075. }), r;
  9076. } }, check: { maxSelections: function maxSelections(e) {
  9077. return !k.maxSelections || ((e = e !== i ? e : S.get.selectionCount()) >= k.maxSelections ? (S.debug("Maximum selection count reached"), k.useLabels && (X.addClass(T.filtered), S.add.message(A.maxSelections)), !0) : (S.verbose("No longer at maximum selection count"), S.remove.message(), S.remove.filteredItem(), S.is.searchSelection() && S.filterItems(), !1));
  9078. } }, restore: { defaults: function defaults() {
  9079. S.clear(), S.restore.defaultText(), S.restore.defaultValue();
  9080. }, defaultText: function defaultText() {
  9081. var e = S.get.defaultText();e === S.get.placeholderText ? (S.debug("Restoring default placeholder text", e), S.set.placeholderText(e)) : (S.debug("Restoring default text", e), S.set.text(e));
  9082. }, placeholderText: function placeholderText() {
  9083. S.set.placeholderText();
  9084. }, defaultValue: function defaultValue() {
  9085. var e = S.get.defaultValue();e !== i && (S.debug("Restoring default value", e), "" !== e ? (S.set.value(e), S.set.selected()) : (S.remove.activeItem(), S.remove.selectedItem()));
  9086. }, labels: function labels() {
  9087. k.allowAdditions && (k.useLabels || (S.error(q.labels), k.useLabels = !0), S.debug("Restoring selected values"), S.create.userLabels()), S.check.maxSelections();
  9088. }, selected: function selected() {
  9089. S.restore.values(), S.is.multiple() ? (S.debug("Restoring previously selected values and labels"), S.restore.labels()) : S.debug("Restoring previously selected values");
  9090. }, values: function values() {
  9091. S.set.initialLoad(), k.apiSettings && k.saveRemoteData && S.get.remoteValues() ? S.restore.remoteValues() : S.set.selected(), S.remove.initialLoad();
  9092. }, remoteValues: function remoteValues() {
  9093. var t = S.get.remoteValues();S.debug("Recreating selected from session data", t), t && (S.is.single() ? e.each(t, function (e, t) {
  9094. S.set.text(t);
  9095. }) : e.each(t, function (e, t) {
  9096. S.add.label(e, t);
  9097. }));
  9098. } }, read: { remoteData: function remoteData(e) {
  9099. var n;if (t.Storage !== i) return (n = sessionStorage.getItem(e)) !== i && n;S.error(q.noStorage);
  9100. } }, save: { defaults: function defaults() {
  9101. S.save.defaultText(), S.save.placeholderText(), S.save.defaultValue();
  9102. }, defaultValue: function defaultValue() {
  9103. var e = S.get.value();S.verbose("Saving default value as", e), M.data(E.defaultValue, e);
  9104. }, defaultText: function defaultText() {
  9105. var e = S.get.text();S.verbose("Saving default text as", e), M.data(E.defaultText, e);
  9106. }, placeholderText: function placeholderText() {
  9107. var e;!1 !== k.placeholder && V.hasClass(T.placeholder) && (e = S.get.text(), S.verbose("Saving placeholder text as", e), M.data(E.placeholderText, e));
  9108. }, remoteData: function remoteData(e, n) {
  9109. t.Storage !== i ? (S.verbose("Saving remote data to session storage", n, e), sessionStorage.setItem(n, e)) : S.error(q.noStorage);
  9110. } }, clear: function clear() {
  9111. S.is.multiple() && k.useLabels ? S.remove.labels() : (S.remove.activeItem(), S.remove.selectedItem()), S.set.placeholderText(), S.clearValue();
  9112. }, clearValue: function clearValue() {
  9113. S.set.value("");
  9114. }, scrollPage: function scrollPage(e, t) {
  9115. var n,
  9116. i,
  9117. o = t || S.get.selectedItem(),
  9118. a = o.closest(D.menu),
  9119. r = a.outerHeight(),
  9120. s = a.scrollTop(),
  9121. l = X.eq(0).outerHeight(),
  9122. c = Math.floor(r / l),
  9123. u = (a.prop("scrollHeight"), "up" == e ? s - l * c : s + l * c),
  9124. d = X.not(D.unselectable);i = "up" == e ? d.index(o) - c : d.index(o) + c, (n = ("up" == e ? i >= 0 : i < d.length) ? d.eq(i) : "up" == e ? d.first() : d.last()).length > 0 && (S.debug("Scrolling page", e, n), o.removeClass(T.selected), n.addClass(T.selected), k.selectOnKeydown && S.is.single() && S.set.selectedItem(n), a.scrollTop(u));
  9125. }, set: { filtered: function filtered() {
  9126. var e = S.is.multiple(),
  9127. t = S.is.searchSelection(),
  9128. n = e && t,
  9129. i = t ? S.get.query() : "",
  9130. o = "string" == typeof i && i.length > 0,
  9131. a = S.get.searchWidth(),
  9132. r = "" !== i;e && o && (S.verbose("Adjusting input width", a, k.glyphWidth), N.css("width", a)), o || n && r ? (S.verbose("Hiding placeholder text"), V.addClass(T.filtered)) : (!e || n && !r) && (S.verbose("Showing placeholder text"), V.removeClass(T.filtered));
  9133. }, empty: function empty() {
  9134. M.addClass(T.empty);
  9135. }, loading: function loading() {
  9136. M.addClass(T.loading);
  9137. }, placeholderText: function placeholderText(e) {
  9138. e = e || S.get.placeholderText(), S.debug("Setting placeholder text", e), S.set.text(e), V.addClass(T.placeholder);
  9139. }, tabbable: function tabbable() {
  9140. S.is.searchSelection() ? (S.debug("Added tabindex to searchable dropdown"), N.val("").attr("tabindex", 0), Q.attr("tabindex", -1)) : (S.debug("Added tabindex to dropdown"), M.attr("tabindex") === i && (M.attr("tabindex", 0), Q.attr("tabindex", -1)));
  9141. }, initialLoad: function initialLoad() {
  9142. S.verbose("Setting initial load"), h = !0;
  9143. }, activeItem: function activeItem(e) {
  9144. k.allowAdditions && e.filter(D.addition).length > 0 ? e.addClass(T.filtered) : e.addClass(T.active);
  9145. }, partialSearch: function partialSearch(e) {
  9146. var t = S.get.query().length;N.val(e.substr(0, t));
  9147. }, scrollPosition: function scrollPosition(e, t) {
  9148. var n, o, a, r, s, l;n = (e = e || S.get.selectedItem()).closest(D.menu), o = e && e.length > 0, t = t !== i && t, e && n.length > 0 && o && (e.position().top, n.addClass(T.loading), a = (r = n.scrollTop()) - n.offset().top + e.offset().top, t || (l = r + n.height() < a + 5, s = a - 5 < r), S.debug("Scrolling to active item", a), (t || s || l) && n.scrollTop(a), n.removeClass(T.loading));
  9149. }, text: function text(e) {
  9150. "select" !== k.action && ("combo" == k.action ? (S.debug("Changing combo button text", e, B), k.preserveHTML ? B.html(e) : B.text(e)) : (e !== S.get.placeholderText() && V.removeClass(T.placeholder), S.debug("Changing text", e, V), V.removeClass(T.filtered), k.preserveHTML ? V.html(e) : V.text(e)));
  9151. }, selectedItem: function selectedItem(e) {
  9152. var t = S.get.choiceValue(e),
  9153. n = S.get.choiceText(e, !1),
  9154. i = S.get.choiceText(e, !0);S.debug("Setting user selection to item", e), S.remove.activeItem(), S.set.partialSearch(n), S.set.activeItem(e), S.set.selected(t, e), S.set.text(i);
  9155. }, selectedLetter: function selectedLetter(t) {
  9156. var n,
  9157. i = X.filter("." + T.selected),
  9158. o = !1;i.length > 0 && S.has.firstLetter(i, t) && (n = i.nextAll(X).eq(0), S.has.firstLetter(n, t) && (o = n)), o || X.each(function () {
  9159. if (S.has.firstLetter(e(this), t)) return o = e(this), !1;
  9160. }), o && (S.verbose("Scrolling to next value with letter", t), S.set.scrollPosition(o), i.removeClass(T.selected), o.addClass(T.selected), k.selectOnKeydown && S.is.single() && S.set.selectedItem(o));
  9161. }, direction: function direction(e) {
  9162. "auto" == k.direction ? (S.remove.upward(), S.can.openDownward(e) ? S.remove.upward(e) : S.set.upward(e), S.is.leftward(e) || S.can.openRightward(e) || S.set.leftward(e)) : "upward" == k.direction && S.set.upward(e);
  9163. }, upward: function upward(e) {
  9164. (e || M).addClass(T.upward);
  9165. }, leftward: function leftward(e) {
  9166. (e || Q).addClass(T.leftward);
  9167. }, value: function value(e, t, n) {
  9168. var o = S.escape.value(e),
  9169. a = U.length > 0,
  9170. r = S.get.values(),
  9171. s = e !== i ? String(e) : e;if (a) {
  9172. if (!k.allowReselection && s == r && (S.verbose("Skipping value update already same value", e, r), !S.is.initialLoad())) return;S.is.single() && S.has.selectInput() && S.can.extendSelect() && (S.debug("Adding user option", e), S.add.optionValue(e)), S.debug("Updating input value", o, r), Z = !0, U.val(o), !1 === k.fireOnInit && S.is.initialLoad() ? S.debug("Input native change event ignored on initial load") : S.trigger.change(), Z = !1;
  9173. } else S.verbose("Storing value in metadata", o, U), o !== r && M.data(E.value, s);!1 === k.fireOnInit && S.is.initialLoad() ? S.verbose("No callback on initial load", k.onChange) : k.onChange.call(K, e, t, n);
  9174. }, active: function active() {
  9175. M.addClass(T.active);
  9176. }, multiple: function multiple() {
  9177. M.addClass(T.multiple);
  9178. }, visible: function visible() {
  9179. M.addClass(T.visible);
  9180. }, exactly: function exactly(e, t) {
  9181. S.debug("Setting selected to exact values"), S.clear(), S.set.selected(e, t);
  9182. }, selected: function selected(t, n) {
  9183. var i = S.is.multiple();(n = k.allowAdditions ? n || S.get.itemWithAdditions(t) : n || S.get.item(t)) && (S.debug("Setting selected menu item to", n), S.is.multiple() && S.remove.searchWidth(), S.is.single() ? (S.remove.activeItem(), S.remove.selectedItem()) : k.useLabels && S.remove.selectedItem(), n.each(function () {
  9184. var t = e(this),
  9185. o = S.get.choiceText(t),
  9186. a = S.get.choiceValue(t, o),
  9187. r = t.hasClass(T.filtered),
  9188. s = t.hasClass(T.active),
  9189. l = t.hasClass(T.addition),
  9190. c = i && 1 == n.length;i ? !s || l ? (k.apiSettings && k.saveRemoteData && S.save.remoteData(o, a), k.useLabels ? (S.add.label(a, o, c), S.add.value(a, o, t), S.set.activeItem(t), S.filterActive(), S.select.nextAvailable(n)) : (S.add.value(a, o, t), S.set.text(S.add.variables(A.count)), S.set.activeItem(t))) : r || (S.debug("Selected active value, removing label"), S.remove.selected(a)) : (k.apiSettings && k.saveRemoteData && S.save.remoteData(o, a), S.set.text(o), S.set.value(a, o, t), t.addClass(T.active).addClass(T.selected));
  9191. }));
  9192. } }, add: { label: function label(t, n, i) {
  9193. var o,
  9194. a = S.is.searchSelection() ? N : V,
  9195. r = S.escape.value(t);k.ignoreCase && (r = r.toLowerCase()), o = e("<a />").addClass(T.label).attr("data-" + E.value, r).html(j.label(r, n)), o = k.onLabelCreate.call(o, r, n), S.has.label(t) ? S.debug("User selection already exists, skipping", r) : (k.label.variation && o.addClass(k.label.variation), !0 === i ? (S.debug("Animating in label", o), o.addClass(T.hidden).insertBefore(a).transition(k.label.transition, k.label.duration)) : (S.debug("Adding selection label", o), o.insertBefore(a)));
  9196. }, message: function message(t) {
  9197. var n = Q.children(D.message),
  9198. i = k.templates.message(S.add.variables(t));n.length > 0 ? n.html(i) : n = e("<div/>").html(i).addClass(T.message).appendTo(Q);
  9199. }, optionValue: function optionValue(t) {
  9200. var n = S.escape.value(t);U.find('option[value="' + S.escape.string(n) + '"]').length > 0 || (S.disconnect.selectObserver(), S.is.single() && (S.verbose("Removing previous user addition"), U.find("option." + T.addition).remove()), e("<option/>").prop("value", n).addClass(T.addition).html(t).appendTo(U), S.verbose("Adding user addition as an <option>", t), S.observe.select());
  9201. }, userSuggestion: function userSuggestion(e) {
  9202. var t,
  9203. n = Q.children(D.addition),
  9204. i = S.get.item(e),
  9205. o = i && i.not(D.addition).length,
  9206. a = n.length > 0;k.useLabels && S.has.maxSelections() || ("" === e || o ? n.remove() : (a ? (n.data(E.value, e).data(E.text, e).attr("data-" + E.value, e).attr("data-" + E.text, e).removeClass(T.filtered), k.hideAdditions || (t = k.templates.addition(S.add.variables(A.addResult, e)), n.html(t)), S.verbose("Replacing user suggestion with new value", n)) : ((n = S.create.userChoice(e)).prependTo(Q), S.verbose("Adding item choice to menu corresponding with user choice addition", n)), k.hideAdditions && !S.is.allFiltered() || n.addClass(T.selected).siblings().removeClass(T.selected), S.refreshItems()));
  9207. }, variables: function variables(e, t) {
  9208. var n,
  9209. i,
  9210. o = -1 !== e.search("{count}"),
  9211. a = -1 !== e.search("{maxCount}"),
  9212. r = -1 !== e.search("{term}");return S.verbose("Adding templated variables to message", e), o && (n = S.get.selectionCount(), e = e.replace("{count}", n)), a && (n = S.get.selectionCount(), e = e.replace("{maxCount}", k.maxSelections)), r && (i = t || S.get.query(), e = e.replace("{term}", i)), e;
  9213. }, value: function value(t, n, i) {
  9214. var o,
  9215. a = S.get.values();S.has.value(t) ? S.debug("Value already selected") : "" !== t ? (e.isArray(a) ? (o = a.concat([t]), o = S.get.uniqueArray(o)) : o = [t], S.has.selectInput() ? S.can.extendSelect() && (S.debug("Adding value to select", t, o, U), S.add.optionValue(t)) : (o = o.join(k.delimiter), S.debug("Setting hidden input to delimited value", o, U)), !1 === k.fireOnInit && S.is.initialLoad() ? S.verbose("Skipping onadd callback on initial load", k.onAdd) : k.onAdd.call(K, t, n, i), S.set.value(o, t, n, i), S.check.maxSelections()) : S.debug("Cannot select blank values from multiselect");
  9216. } }, remove: { active: function active() {
  9217. M.removeClass(T.active);
  9218. }, activeLabel: function activeLabel() {
  9219. M.find(D.label).removeClass(T.active);
  9220. }, empty: function empty() {
  9221. M.removeClass(T.empty);
  9222. }, loading: function loading() {
  9223. M.removeClass(T.loading);
  9224. }, initialLoad: function initialLoad() {
  9225. h = !1;
  9226. }, upward: function upward(e) {
  9227. (e || M).removeClass(T.upward);
  9228. }, leftward: function leftward(e) {
  9229. (e || Q).removeClass(T.leftward);
  9230. }, visible: function visible() {
  9231. M.removeClass(T.visible);
  9232. }, activeItem: function activeItem() {
  9233. X.removeClass(T.active);
  9234. }, filteredItem: function filteredItem() {
  9235. k.useLabels && S.has.maxSelections() || (k.useLabels && S.is.multiple() ? X.not("." + T.active).removeClass(T.filtered) : X.removeClass(T.filtered), S.remove.empty());
  9236. }, optionValue: function optionValue(e) {
  9237. var t = S.escape.value(e),
  9238. n = U.find('option[value="' + S.escape.string(t) + '"]');n.length > 0 && n.hasClass(T.addition) && (C && (C.disconnect(), S.verbose("Temporarily disconnecting mutation observer")), n.remove(), S.verbose("Removing user addition as an <option>", t), C && C.observe(U[0], { childList: !0, subtree: !0 }));
  9239. }, message: function message() {
  9240. Q.children(D.message).remove();
  9241. }, searchWidth: function searchWidth() {
  9242. N.css("width", "");
  9243. }, searchTerm: function searchTerm() {
  9244. S.verbose("Cleared search term"), N.val(""), S.set.filtered();
  9245. }, userAddition: function userAddition() {
  9246. X.filter(D.addition).remove();
  9247. }, selected: function selected(t, n) {
  9248. if (!(n = k.allowAdditions ? n || S.get.itemWithAdditions(t) : n || S.get.item(t))) return !1;n.each(function () {
  9249. var t = e(this),
  9250. n = S.get.choiceText(t),
  9251. i = S.get.choiceValue(t, n);S.is.multiple() ? k.useLabels ? (S.remove.value(i, n, t), S.remove.label(i)) : (S.remove.value(i, n, t), 0 === S.get.selectionCount() ? S.set.placeholderText() : S.set.text(S.add.variables(A.count))) : S.remove.value(i, n, t), t.removeClass(T.filtered).removeClass(T.active), k.useLabels && t.removeClass(T.selected);
  9252. });
  9253. }, selectedItem: function selectedItem() {
  9254. X.removeClass(T.selected);
  9255. }, value: function value(e, t, n) {
  9256. var i,
  9257. o = S.get.values();S.has.selectInput() ? (S.verbose("Input is <select> removing selected option", e), i = S.remove.arrayValue(e, o), S.remove.optionValue(e)) : (S.verbose("Removing from delimited values", e), i = (i = S.remove.arrayValue(e, o)).join(k.delimiter)), !1 === k.fireOnInit && S.is.initialLoad() ? S.verbose("No callback on initial load", k.onRemove) : k.onRemove.call(K, e, t, n), S.set.value(i, t, n), S.check.maxSelections();
  9258. }, arrayValue: function arrayValue(t, n) {
  9259. return e.isArray(n) || (n = [n]), n = e.grep(n, function (e) {
  9260. return t != e;
  9261. }), S.verbose("Removed value from delimited string", t, n), n;
  9262. }, label: function label(e, t) {
  9263. var n = M.find(D.label).filter("[data-" + E.value + '="' + S.escape.string(e) + '"]');S.verbose("Removing label", n), n.remove();
  9264. }, activeLabels: function activeLabels(e) {
  9265. e = e || M.find(D.label).filter("." + T.active), S.verbose("Removing active label selections", e), S.remove.labels(e);
  9266. }, labels: function labels(t) {
  9267. t = t || M.find(D.label), S.verbose("Removing labels", t), t.each(function () {
  9268. var t = e(this),
  9269. n = t.data(E.value),
  9270. o = n !== i ? String(n) : n,
  9271. a = S.is.userValue(o);!1 !== k.onLabelRemove.call(t, n) ? (S.remove.message(), a ? (S.remove.value(o), S.remove.label(o)) : S.remove.selected(o)) : S.debug("Label remove callback cancelled removal");
  9272. });
  9273. }, tabbable: function tabbable() {
  9274. S.is.searchSelection() ? (S.debug("Searchable dropdown initialized"), N.removeAttr("tabindex"), Q.removeAttr("tabindex")) : (S.debug("Simple selection dropdown initialized"), M.removeAttr("tabindex"), Q.removeAttr("tabindex"));
  9275. } }, has: { menuSearch: function menuSearch() {
  9276. return S.has.search() && N.closest(Q).length > 0;
  9277. }, search: function search() {
  9278. return N.length > 0;
  9279. }, sizer: function sizer() {
  9280. return H.length > 0;
  9281. }, selectInput: function selectInput() {
  9282. return U.is("select");
  9283. }, minCharacters: function minCharacters(e) {
  9284. return !k.minCharacters || (e = e !== i ? String(e) : String(S.get.query())).length >= k.minCharacters;
  9285. }, firstLetter: function firstLetter(e, t) {
  9286. var n;return !(!e || 0 === e.length || "string" != typeof t) && (n = S.get.choiceText(e, !1), (t = t.toLowerCase()) == String(n).charAt(0).toLowerCase());
  9287. }, input: function input() {
  9288. return U.length > 0;
  9289. }, items: function items() {
  9290. return X.length > 0;
  9291. }, menu: function menu() {
  9292. return Q.length > 0;
  9293. }, message: function message() {
  9294. return 0 !== Q.children(D.message).length;
  9295. }, label: function label(e) {
  9296. var t = S.escape.value(e),
  9297. n = M.find(D.label);return k.ignoreCase && (t = t.toLowerCase()), n.filter("[data-" + E.value + '="' + S.escape.string(t) + '"]').length > 0;
  9298. }, maxSelections: function maxSelections() {
  9299. return k.maxSelections && S.get.selectionCount() >= k.maxSelections;
  9300. }, allResultsFiltered: function allResultsFiltered() {
  9301. var e = X.not(D.addition);return e.filter(D.unselectable).length === e.length;
  9302. }, userSuggestion: function userSuggestion() {
  9303. return Q.children(D.addition).length > 0;
  9304. }, query: function query() {
  9305. return "" !== S.get.query();
  9306. }, value: function value(e) {
  9307. return k.ignoreCase ? S.has.valueIgnoringCase(e) : S.has.valueMatchingCase(e);
  9308. }, valueMatchingCase: function valueMatchingCase(t) {
  9309. var n = S.get.values();return !!(e.isArray(n) ? n && -1 !== e.inArray(t, n) : n == t);
  9310. }, valueIgnoringCase: function valueIgnoringCase(t) {
  9311. var n = S.get.values(),
  9312. i = !1;return e.isArray(n) || (n = [n]), e.each(n, function (e, n) {
  9313. if (String(t).toLowerCase() == String(n).toLowerCase()) return i = !0, !1;
  9314. }), i;
  9315. } }, is: { active: function active() {
  9316. return M.hasClass(T.active);
  9317. }, animatingInward: function animatingInward() {
  9318. return Q.transition("is inward");
  9319. }, animatingOutward: function animatingOutward() {
  9320. return Q.transition("is outward");
  9321. }, bubbledLabelClick: function bubbledLabelClick(t) {
  9322. return e(t.target).is("select, input") && M.closest("label").length > 0;
  9323. }, bubbledIconClick: function bubbledIconClick(t) {
  9324. return e(t.target).closest(W).length > 0;
  9325. }, alreadySetup: function alreadySetup() {
  9326. return M.is("select") && M.parent(D.dropdown).data(I) !== i && 0 === M.prev().length;
  9327. }, animating: function animating(e) {
  9328. return e ? e.transition && e.transition("is animating") : Q.transition && Q.transition("is animating");
  9329. }, leftward: function leftward(e) {
  9330. return (e || Q).hasClass(T.leftward);
  9331. }, disabled: function disabled() {
  9332. return M.hasClass(T.disabled);
  9333. }, focused: function focused() {
  9334. return n.activeElement === M[0];
  9335. }, focusedOnSearch: function focusedOnSearch() {
  9336. return n.activeElement === N[0];
  9337. }, allFiltered: function allFiltered() {
  9338. return (S.is.multiple() || S.has.search()) && !(0 == k.hideAdditions && S.has.userSuggestion()) && !S.has.message() && S.has.allResultsFiltered();
  9339. }, hidden: function hidden(e) {
  9340. return !S.is.visible(e);
  9341. }, initialLoad: function initialLoad() {
  9342. return h;
  9343. }, inObject: function inObject(t, n) {
  9344. var i = !1;return e.each(n, function (e, n) {
  9345. if (n == t) return i = !0, !0;
  9346. }), i;
  9347. }, multiple: function multiple() {
  9348. return M.hasClass(T.multiple);
  9349. }, remote: function remote() {
  9350. return k.apiSettings && S.can.useAPI();
  9351. }, single: function single() {
  9352. return !S.is.multiple();
  9353. }, selectMutation: function selectMutation(t) {
  9354. var n = !1;return e.each(t, function (t, i) {
  9355. if (i.target && e(i.target).is("select")) return n = !0, !0;
  9356. }), n;
  9357. }, search: function search() {
  9358. return M.hasClass(T.search);
  9359. }, searchSelection: function searchSelection() {
  9360. return S.has.search() && 1 === N.parent(D.dropdown).length;
  9361. }, selection: function selection() {
  9362. return M.hasClass(T.selection);
  9363. }, userValue: function userValue(t) {
  9364. return -1 !== e.inArray(t, S.get.userValues());
  9365. }, upward: function upward(e) {
  9366. return (e || M).hasClass(T.upward);
  9367. }, visible: function visible(e) {
  9368. return e ? e.hasClass(T.visible) : Q.hasClass(T.visible);
  9369. }, verticallyScrollableContext: function verticallyScrollableContext() {
  9370. var e = L.get(0) !== t && L.css("overflow-y");return "auto" == e || "scroll" == e;
  9371. }, horizontallyScrollableContext: function horizontallyScrollableContext() {
  9372. var e = L.get(0) !== t && L.css("overflow-X");return "auto" == e || "scroll" == e;
  9373. } }, can: { activate: function activate(e) {
  9374. return !!k.useLabels || !S.has.maxSelections() || !(!S.has.maxSelections() || !e.hasClass(T.active));
  9375. }, openDownward: function openDownward(e) {
  9376. var n,
  9377. i,
  9378. o = e || Q,
  9379. a = !0;return o.addClass(T.loading), i = { context: { offset: L.get(0) === t ? { top: 0, left: 0 } : L.offset(), scrollTop: L.scrollTop(), height: L.outerHeight() }, menu: { offset: o.offset(), height: o.outerHeight() } }, S.is.verticallyScrollableContext() && (i.menu.offset.top += i.context.scrollTop), (n = { above: i.context.scrollTop <= i.menu.offset.top - i.context.offset.top - i.menu.height, below: i.context.scrollTop + i.context.height >= i.menu.offset.top - i.context.offset.top + i.menu.height }).below ? (S.verbose("Dropdown can fit in context downward", n), a = !0) : n.below || n.above ? (S.verbose("Dropdown cannot fit below, opening upward", n), a = !1) : (S.verbose("Dropdown cannot fit in either direction, favoring downward", n), a = !0), o.removeClass(T.loading), a;
  9380. }, openRightward: function openRightward(e) {
  9381. var n,
  9382. i,
  9383. o = e || Q,
  9384. a = !0;return o.addClass(T.loading), i = { context: { offset: L.get(0) === t ? { top: 0, left: 0 } : L.offset(), scrollLeft: L.scrollLeft(), width: L.outerWidth() }, menu: { offset: o.offset(), width: o.outerWidth() } }, S.is.horizontallyScrollableContext() && (i.menu.offset.left += i.context.scrollLeft), (n = i.menu.offset.left - i.context.offset.left + i.menu.width >= i.context.scrollLeft + i.context.width) && (S.verbose("Dropdown cannot fit in context rightward", n), a = !1), o.removeClass(T.loading), a;
  9385. }, click: function click() {
  9386. return c || "click" == k.on;
  9387. }, extendSelect: function extendSelect() {
  9388. return k.allowAdditions || k.apiSettings;
  9389. }, show: function show() {
  9390. return !S.is.disabled() && (S.has.items() || S.has.message());
  9391. }, useAPI: function useAPI() {
  9392. return e.fn.api !== i;
  9393. } }, animate: { show: function show(t, n) {
  9394. var o,
  9395. a = n || Q,
  9396. r = n ? function () {} : function () {
  9397. S.hideSubMenus(), S.hideOthers(), S.set.active();
  9398. };t = e.isFunction(t) ? t : function () {}, S.verbose("Doing menu show animation", a), S.set.direction(n), o = S.get.transition(n), S.is.selection() && S.set.scrollPosition(S.get.selectedItem(), !0), (S.is.hidden(a) || S.is.animating(a)) && ("none" == o ? (r(), a.transition("show"), t.call(K)) : e.fn.transition !== i && M.transition("is supported") ? a.transition({ animation: o + " in", debug: k.debug, verbose: k.verbose, duration: k.duration, queue: !0, onStart: r, onComplete: function onComplete() {
  9399. t.call(K);
  9400. } }) : S.error(q.noTransition, o));
  9401. }, hide: function hide(t, n) {
  9402. var o = n || Q,
  9403. a = (n ? k.duration : k.duration, n ? function () {} : function () {
  9404. S.can.click() && S.unbind.intent(), S.remove.active();
  9405. }),
  9406. r = S.get.transition(n);t = e.isFunction(t) ? t : function () {}, (S.is.visible(o) || S.is.animating(o)) && (S.verbose("Doing menu hide animation", o), "none" == r ? (a(), o.transition("hide"), t.call(K)) : e.fn.transition !== i && M.transition("is supported") ? o.transition({ animation: r + " out", duration: k.duration, debug: k.debug, verbose: k.verbose, queue: !1, onStart: a, onComplete: function onComplete() {
  9407. t.call(K);
  9408. } }) : S.error(q.transition));
  9409. } }, hideAndClear: function hideAndClear() {
  9410. S.remove.searchTerm(), S.has.maxSelections() || (S.has.search() ? S.hide(function () {
  9411. S.remove.filteredItem();
  9412. }) : S.hide());
  9413. }, delay: { show: function show() {
  9414. S.verbose("Delaying show event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.show, k.delay.show);
  9415. }, hide: function hide() {
  9416. S.verbose("Delaying hide event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.hide, k.delay.hide);
  9417. } }, escape: { value: function value(t) {
  9418. var n = e.isArray(t),
  9419. i = "string" == typeof t,
  9420. o = !i && !n,
  9421. a = i && -1 !== t.search(O.quote),
  9422. r = [];return o || !a ? t : (S.debug("Encoding quote values for use in select", t), n ? (e.each(t, function (e, t) {
  9423. r.push(t.replace(O.quote, "&quot;"));
  9424. }), r) : t.replace(O.quote, "&quot;"));
  9425. }, string: function string(e) {
  9426. return (e = String(e)).replace(O.escape, "\\$&");
  9427. } }, setting: function setting(t, n) {
  9428. if (S.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, k, t);else {
  9429. if (n === i) return k[t];e.isPlainObject(k[t]) ? e.extend(!0, k[t], n) : k[t] = n;
  9430. }
  9431. }, internal: function internal(t, n) {
  9432. if (e.isPlainObject(t)) e.extend(!0, S, t);else {
  9433. if (n === i) return S[t];S[t] = n;
  9434. }
  9435. }, debug: function debug() {
  9436. !k.silent && k.debug && (k.performance ? S.performance.log(arguments) : (S.debug = Function.prototype.bind.call(console.info, console, k.name + ":"), S.debug.apply(console, arguments)));
  9437. }, verbose: function verbose() {
  9438. !k.silent && k.verbose && k.debug && (k.performance ? S.performance.log(arguments) : (S.verbose = Function.prototype.bind.call(console.info, console, k.name + ":"), S.verbose.apply(console, arguments)));
  9439. }, error: function error() {
  9440. k.silent || (S.error = Function.prototype.bind.call(console.error, console, k.name + ":"), S.error.apply(console, arguments));
  9441. }, performance: { log: function log(e) {
  9442. var t, n;k.performance && (n = (t = new Date().getTime()) - (u || t), u = t, d.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: K, "Execution Time": n })), clearTimeout(S.performance.timer), S.performance.timer = setTimeout(S.performance.display, 500);
  9443. }, display: function display() {
  9444. var t = k.name + ":",
  9445. n = 0;u = !1, clearTimeout(S.performance.timer), e.each(d, function (e, t) {
  9446. n += t["Execution Time"];
  9447. }), t += " " + n + "ms", l && (t += " '" + l + "'"), (console.group !== i || console.table !== i) && d.length > 0 && (console.groupCollapsed(t), console.table ? console.table(d) : e.each(d, function (e, t) {
  9448. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  9449. }), console.groupEnd()), d = [];
  9450. } }, invoke: function invoke(t, n, o) {
  9451. var r,
  9452. s,
  9453. l,
  9454. c = J;return n = n || g, o = K || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  9455. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  9456. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (S.error(q.method, t), !1);c = c[o];
  9457. }
  9458. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  9459. } }, m ? (J === i && S.initialize(), S.invoke(f)) : (J !== i && J.invoke("destroy"), S.initialize());
  9460. }), a !== i ? a : r;
  9461. }, e.fn.dropdown.settings = { silent: !1, debug: !1, verbose: !1, performance: !0, on: "click", action: "activate", values: !1, apiSettings: !1, selectOnKeydown: !0, minCharacters: 0, filterRemoteData: !1, saveRemoteData: !0, throttle: 200, context: t, direction: "auto", keepOnScreen: !0, match: "both", fullTextSearch: !1, placeholder: "auto", preserveHTML: !0, sortSelect: !1, forceSelection: !0, allowAdditions: !1, ignoreCase: !1, hideAdditions: !0, maxSelections: !1, useLabels: !0, delimiter: ",", showOnFocus: !0, allowReselection: !1, allowTab: !0, allowCategorySelection: !1, fireOnInit: !1, transition: "auto", duration: 200, glyphWidth: 1.037, label: { transition: "scale", duration: 200, variation: !1 }, delay: { hide: 300, show: 200, search: 20, touch: 50 }, onChange: function onChange(e, t, n) {}, onAdd: function onAdd(e, t, n) {}, onRemove: function onRemove(e, t, n) {}, onLabelSelect: function onLabelSelect(e) {}, onLabelCreate: function onLabelCreate(t, n) {
  9462. return e(this);
  9463. }, onLabelRemove: function onLabelRemove(e) {
  9464. return !0;
  9465. }, onNoResults: function onNoResults(e) {
  9466. return !0;
  9467. }, onShow: function onShow() {}, onHide: function onHide() {}, name: "Dropdown", namespace: "dropdown", message: { addResult: "Add <b>{term}</b>", count: "{count} selected", maxSelections: "Max {maxCount} selections", noResults: "No results found.", serverError: "There was an error contacting the server" }, error: { action: "You called a dropdown action that was not defined", alreadySetup: "Once a select has been initialized behaviors must be called on the created ui dropdown", labels: "Allowing user additions currently requires the use of labels.", missingMultiple: "<select> requires multiple property to be set to correctly preserve multiple values", method: "The method you called is not defined.", noAPI: "The API module is required to load resources remotely", noStorage: "Saving remote data requires session storage", noTransition: "This module requires ui transitions <https://github.com/Semantic-Org/UI-Transition>" }, regExp: { escape: /[-[\]{}()*+?.,\\^$|#\s]/g, quote: /"/g }, metadata: { defaultText: "defaultText", defaultValue: "defaultValue", placeholderText: "placeholder", text: "text", value: "value" }, fields: { remoteValues: "results", values: "values", disabled: "disabled", name: "name", value: "value", text: "text" }, keys: { backspace: 8, delimiter: 188, deleteKey: 46, enter: 13, escape: 27, pageUp: 33, pageDown: 34, leftArrow: 37, upArrow: 38, rightArrow: 39, downArrow: 40 }, selector: { addition: ".addition", dropdown: ".ui.dropdown", hidden: ".hidden", icon: "> .dropdown.icon", input: '> input[type="hidden"], > select', item: ".item", label: "> .label", remove: "> .label > .delete.icon", siblingLabel: ".label", menu: ".menu", message: ".message", menuIcon: ".dropdown.icon", search: "input.search, .menu > .search > input, .menu input.search", sizer: "> input.sizer", text: "> .text:not(.icon)", unselectable: ".disabled, .filtered" }, className: { active: "active", addition: "addition", animating: "animating", disabled: "disabled", empty: "empty", dropdown: "ui dropdown", filtered: "filtered", hidden: "hidden transition", item: "item", label: "ui label", loading: "loading", menu: "menu", message: "message", multiple: "multiple", placeholder: "default", sizer: "sizer", search: "search", selected: "selected", selection: "selection", upward: "upward", leftward: "left", visible: "visible" } }, e.fn.dropdown.settings.templates = { dropdown: function dropdown(t) {
  9468. var n = t.placeholder || !1,
  9469. i = (t.values, "");return i += '<i class="dropdown icon"></i>', t.placeholder ? i += '<div class="default text">' + n + "</div>" : i += '<div class="text"></div>', i += '<div class="menu">', e.each(t.values, function (e, t) {
  9470. i += t.disabled ? '<div class="disabled item" data-value="' + t.value + '">' + t.name + "</div>" : '<div class="item" data-value="' + t.value + '">' + t.name + "</div>";
  9471. }), i += "</div>";
  9472. }, menu: function menu(t, n) {
  9473. var i = t[n.values] || {},
  9474. o = "";return e.each(i, function (e, t) {
  9475. var i = t[n.text] ? 'data-text="' + t[n.text] + '"' : "",
  9476. a = t[n.disabled] ? "disabled " : "";o += '<div class="' + a + 'item" data-value="' + t[n.value] + '"' + i + ">", o += t[n.name], o += "</div>";
  9477. }), o;
  9478. }, label: function label(e, t) {
  9479. return t + '<i class="delete icon"></i>';
  9480. }, message: function message(e) {
  9481. return e;
  9482. }, addition: function addition(e) {
  9483. return e;
  9484. } };
  9485. }(jQuery, window, document), function (e, t, n, i) {
  9486. "use strict";
  9487. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.embed = function (n) {
  9488. var o,
  9489. a = e(this),
  9490. r = a.selector || "",
  9491. s = new Date().getTime(),
  9492. l = [],
  9493. c = arguments[0],
  9494. u = "string" == typeof c,
  9495. d = [].slice.call(arguments, 1);return a.each(function () {
  9496. var f,
  9497. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.embed.settings, n) : e.extend({}, e.fn.embed.settings),
  9498. g = m.selector,
  9499. p = m.className,
  9500. h = m.sources,
  9501. v = m.error,
  9502. b = m.metadata,
  9503. y = m.namespace,
  9504. x = m.templates,
  9505. C = "." + y,
  9506. w = "module-" + y,
  9507. S = (e(t), e(this)),
  9508. k = (S.find(g.placeholder), S.find(g.icon), S.find(g.embed)),
  9509. T = this,
  9510. A = S.data(w);f = { initialize: function initialize() {
  9511. f.debug("Initializing embed"), f.determine.autoplay(), f.create(), f.bind.events(), f.instantiate();
  9512. }, instantiate: function instantiate() {
  9513. f.verbose("Storing instance of module", f), A = f, S.data(w, f);
  9514. }, destroy: function destroy() {
  9515. f.verbose("Destroying previous instance of embed"), f.reset(), S.removeData(w).off(C);
  9516. }, refresh: function refresh() {
  9517. f.verbose("Refreshing selector cache"), S.find(g.placeholder), S.find(g.icon), k = S.find(g.embed);
  9518. }, bind: { events: function events() {
  9519. f.has.placeholder() && (f.debug("Adding placeholder events"), S.on("click" + C, g.placeholder, f.createAndShow).on("click" + C, g.icon, f.createAndShow));
  9520. } }, create: function create() {
  9521. f.get.placeholder() ? f.createPlaceholder() : f.createAndShow();
  9522. }, createPlaceholder: function createPlaceholder(e) {
  9523. var t = f.get.icon(),
  9524. n = f.get.url();f.generate.embed(n);e = e || f.get.placeholder(), S.html(x.placeholder(e, t)), f.debug("Creating placeholder for embed", e, t);
  9525. }, createEmbed: function createEmbed(t) {
  9526. f.refresh(), t = t || f.get.url(), k = e("<div/>").addClass(p.embed).html(f.generate.embed(t)).appendTo(S), m.onCreate.call(T, t), f.debug("Creating embed object", k);
  9527. }, changeEmbed: function changeEmbed(e) {
  9528. k.html(f.generate.embed(e));
  9529. }, createAndShow: function createAndShow() {
  9530. f.createEmbed(), f.show();
  9531. }, change: function change(e, t, n) {
  9532. f.debug("Changing video to ", e, t, n), S.data(b.source, e).data(b.id, t), n ? S.data(b.url, n) : S.removeData(b.url), f.has.embed() ? f.changeEmbed() : f.create();
  9533. }, reset: function reset() {
  9534. f.debug("Clearing embed and showing placeholder"), f.remove.active(), f.remove.embed(), f.showPlaceholder(), m.onReset.call(T);
  9535. }, show: function show() {
  9536. f.debug("Showing embed"), f.set.active(), m.onDisplay.call(T);
  9537. }, hide: function hide() {
  9538. f.debug("Hiding embed"), f.showPlaceholder();
  9539. }, showPlaceholder: function showPlaceholder() {
  9540. f.debug("Showing placeholder image"), f.remove.active(), m.onPlaceholderDisplay.call(T);
  9541. }, get: { id: function id() {
  9542. return m.id || S.data(b.id);
  9543. }, placeholder: function placeholder() {
  9544. return m.placeholder || S.data(b.placeholder);
  9545. }, icon: function icon() {
  9546. return m.icon ? m.icon : S.data(b.icon) !== i ? S.data(b.icon) : f.determine.icon();
  9547. }, source: function source(e) {
  9548. return m.source ? m.source : S.data(b.source) !== i ? S.data(b.source) : f.determine.source();
  9549. }, type: function type() {
  9550. var e = f.get.source();return h[e] !== i && h[e].type;
  9551. }, url: function url() {
  9552. return m.url ? m.url : S.data(b.url) !== i ? S.data(b.url) : f.determine.url();
  9553. } }, determine: { autoplay: function autoplay() {
  9554. f.should.autoplay() && (m.autoplay = !0);
  9555. }, source: function source(t) {
  9556. var n = !1;return (t = t || f.get.url()) && e.each(h, function (e, i) {
  9557. if (-1 !== t.search(i.domain)) return n = e, !1;
  9558. }), n;
  9559. }, icon: function icon() {
  9560. var e = f.get.source();return h[e] !== i && h[e].icon;
  9561. }, url: function url() {
  9562. var e,
  9563. t = m.id || S.data(b.id),
  9564. n = m.source || S.data(b.source);return (e = h[n] !== i && h[n].url.replace("{id}", t)) && S.data(b.url, e), e;
  9565. } }, set: { active: function active() {
  9566. S.addClass(p.active);
  9567. } }, remove: { active: function active() {
  9568. S.removeClass(p.active);
  9569. }, embed: function embed() {
  9570. k.empty();
  9571. } }, encode: { parameters: function parameters(e) {
  9572. var t,
  9573. n = [];for (t in e) {
  9574. n.push(encodeURIComponent(t) + "=" + encodeURIComponent(e[t]));
  9575. }return n.join("&amp;");
  9576. } }, generate: { embed: function embed(e) {
  9577. f.debug("Generating embed html");var t,
  9578. n,
  9579. i = f.get.source();return (e = f.get.url(e)) ? (n = f.generate.parameters(i), t = x.iframe(e, n)) : f.error(v.noURL, S), t;
  9580. }, parameters: function parameters(t, n) {
  9581. var o = h[t] && h[t].parameters !== i ? h[t].parameters(m) : {};return (n = n || m.parameters) && (o = e.extend({}, o, n)), o = m.onEmbed(o), f.encode.parameters(o);
  9582. } }, has: { embed: function embed() {
  9583. return k.length > 0;
  9584. }, placeholder: function placeholder() {
  9585. return m.placeholder || S.data(b.placeholder);
  9586. } }, should: { autoplay: function autoplay() {
  9587. return "auto" === m.autoplay ? m.placeholder || S.data(b.placeholder) !== i : m.autoplay;
  9588. } }, is: { video: function video() {
  9589. return "video" == f.get.type();
  9590. } }, setting: function setting(t, n) {
  9591. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  9592. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  9593. }
  9594. }, internal: function internal(t, n) {
  9595. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  9596. if (n === i) return f[t];f[t] = n;
  9597. }
  9598. }, debug: function debug() {
  9599. !m.silent && m.debug && (m.performance ? f.performance.log(arguments) : (f.debug = Function.prototype.bind.call(console.info, console, m.name + ":"), f.debug.apply(console, arguments)));
  9600. }, verbose: function verbose() {
  9601. !m.silent && m.verbose && m.debug && (m.performance ? f.performance.log(arguments) : (f.verbose = Function.prototype.bind.call(console.info, console, m.name + ":"), f.verbose.apply(console, arguments)));
  9602. }, error: function error() {
  9603. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  9604. }, performance: { log: function log(e) {
  9605. var t, n;m.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: T, "Execution Time": n })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500);
  9606. }, display: function display() {
  9607. var t = m.name + ":",
  9608. n = 0;s = !1, clearTimeout(f.performance.timer), e.each(l, function (e, t) {
  9609. n += t["Execution Time"];
  9610. }), t += " " + n + "ms", r && (t += " '" + r + "'"), a.length > 1 && (t += " (" + a.length + ")"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  9611. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  9612. }), console.groupEnd()), l = [];
  9613. } }, invoke: function invoke(t, n, a) {
  9614. var r,
  9615. s,
  9616. l,
  9617. c = A;return n = n || d, a = T || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  9618. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  9619. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (f.error(v.method, t), !1);c = c[o];
  9620. }
  9621. })), e.isFunction(s) ? l = s.apply(a, n) : s !== i && (l = s), e.isArray(o) ? o.push(l) : o !== i ? o = [o, l] : l !== i && (o = l), s;
  9622. } }, u ? (A === i && f.initialize(), f.invoke(c)) : (A !== i && A.invoke("destroy"), f.initialize());
  9623. }), o !== i ? o : this;
  9624. }, e.fn.embed.settings = { name: "Embed", namespace: "embed", silent: !1, debug: !1, verbose: !1, performance: !0, icon: !1, source: !1, url: !1, id: !1, autoplay: "auto", color: "#444444", hd: !0, brandedUI: !1, parameters: !1, onDisplay: function onDisplay() {}, onPlaceholderDisplay: function onPlaceholderDisplay() {}, onReset: function onReset() {}, onCreate: function onCreate(e) {}, onEmbed: function onEmbed(e) {
  9625. return e;
  9626. }, metadata: { id: "id", icon: "icon", placeholder: "placeholder", source: "source", url: "url" }, error: { noURL: "No URL specified", method: "The method you called is not defined" }, className: { active: "active", embed: "embed" }, selector: { embed: ".embed", placeholder: ".placeholder", icon: ".icon" }, sources: { youtube: { name: "youtube", type: "video", icon: "video play", domain: "youtube.com", url: "//www.youtube.com/embed/{id}", parameters: function parameters(e) {
  9627. return { autohide: !e.brandedUI, autoplay: e.autoplay, color: e.color || i, hq: e.hd, jsapi: e.api, modestbranding: !e.brandedUI };
  9628. } }, vimeo: { name: "vimeo", type: "video", icon: "video play", domain: "vimeo.com", url: "//player.vimeo.com/video/{id}", parameters: function parameters(e) {
  9629. return { api: e.api, autoplay: e.autoplay, byline: e.brandedUI, color: e.color || i, portrait: e.brandedUI, title: e.brandedUI };
  9630. } } }, templates: { iframe: function iframe(e, t) {
  9631. var n = e;return t && (n += "?" + t), '<iframe src="' + n + '" width="100%" height="100%" frameborder="0" scrolling="no" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
  9632. }, placeholder: function placeholder(e, t) {
  9633. var n = ""; return t && (n += '<i class="' + t + ' icon"></i>'), e && (n += '<img src="' + e + '" class="placeholder">'), n;
  9634. } }, api: !1, onPause: function onPause() {}, onPlay: function onPlay() {}, onStop: function onStop() {} };
  9635. }(jQuery, window, document), function (e, t, n, i) {
  9636. "use strict";
  9637. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.modal = function (o) {
  9638. var a,
  9639. r = e(this),
  9640. s = e(t),
  9641. l = e(n),
  9642. c = e("body"),
  9643. u = r.selector || "",
  9644. d = new Date().getTime(),
  9645. f = [],
  9646. m = arguments[0],
  9647. g = "string" == typeof m,
  9648. p = [].slice.call(arguments, 1),
  9649. h = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  9650. setTimeout(e, 0);
  9651. };return r.each(function () {
  9652. var r,
  9653. v,
  9654. b,
  9655. y,
  9656. x,
  9657. C,
  9658. w,
  9659. S,
  9660. k,
  9661. T = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.modal.settings, o) : e.extend({}, e.fn.modal.settings),
  9662. A = T.selector,
  9663. R = T.className,
  9664. P = T.namespace,
  9665. E = T.error,
  9666. F = "." + P,
  9667. O = "module-" + P,
  9668. D = e(this),
  9669. q = e(T.context),
  9670. j = D.find(A.close),
  9671. z = this,
  9672. I = D.data(O),
  9673. M = !1;k = { initialize: function initialize() {
  9674. k.verbose("Initializing dimmer", q), k.create.id(), k.create.dimmer(), k.refreshModals(), k.bind.events(), T.observeChanges && k.observeChanges(), k.instantiate();
  9675. }, instantiate: function instantiate() {
  9676. k.verbose("Storing instance of modal"), I = k, D.data(O, I);
  9677. }, create: { dimmer: function dimmer() {
  9678. var t = { debug: T.debug, variation: !T.centered && "top aligned", dimmerName: "modals" },
  9679. n = e.extend(!0, t, T.dimmerSettings);e.fn.dimmer !== i ? (k.debug("Creating dimmer"), y = q.dimmer(n), T.detachable ? (k.verbose("Modal is detachable, moving content into dimmer"), y.dimmer("add content", D)) : k.set.undetached(), x = y.dimmer("get dimmer")) : k.error(E.dimmer);
  9680. }, id: function id() {
  9681. w = (Math.random().toString(16) + "000000000").substr(2, 8), C = "." + w, k.verbose("Creating unique id for element", w);
  9682. } }, destroy: function destroy() {
  9683. k.verbose("Destroying previous modal"), D.removeData(O).off(F), s.off(C), x.off(C), j.off(F), q.dimmer("destroy");
  9684. }, observeChanges: function observeChanges() {
  9685. "MutationObserver" in t && ((S = new MutationObserver(function (e) {
  9686. k.debug("DOM tree modified, refreshing"), k.refresh();
  9687. })).observe(z, { childList: !0, subtree: !0 }), k.debug("Setting up mutation observer", S));
  9688. }, refresh: function refresh() {
  9689. k.remove.scrolling(), k.cacheSizes(), k.set.screenHeight(), k.set.type();
  9690. }, refreshModals: function refreshModals() {
  9691. v = D.siblings(A.modal), r = v.add(D);
  9692. }, attachEvents: function attachEvents(t, n) {
  9693. var i = e(t);n = e.isFunction(k[n]) ? k[n] : k.toggle, i.length > 0 ? (k.debug("Attaching modal events to element", t, n), i.off(F).on("click" + F, n)) : k.error(E.notFound, t);
  9694. }, bind: { events: function events() {
  9695. k.verbose("Attaching events"), D.on("click" + F, A.close, k.event.close).on("click" + F, A.approve, k.event.approve).on("click" + F, A.deny, k.event.deny), s.on("resize" + C, k.event.resize);
  9696. } }, get: { id: function id() {
  9697. return (Math.random().toString(16) + "000000000").substr(2, 8);
  9698. } }, event: { approve: function approve() {
  9699. M || !1 === T.onApprove.call(z, e(this)) ? k.verbose("Approve callback returned false cancelling hide") : (M = !0, k.hide(function () {
  9700. M = !1;
  9701. }));
  9702. }, deny: function deny() {
  9703. M || !1 === T.onDeny.call(z, e(this)) ? k.verbose("Deny callback returned false cancelling hide") : (M = !0, k.hide(function () {
  9704. M = !1;
  9705. }));
  9706. }, close: function close() {
  9707. k.hide();
  9708. }, click: function click(t) {
  9709. if (T.closable) {
  9710. var i = e(t.target).closest(A.modal).length > 0,
  9711. o = e.contains(n.documentElement, t.target);!i && o && k.is.active() && (k.debug("Dimmer clicked, hiding all modals"), k.remove.clickaway(), T.allowMultiple ? k.hide() : k.hideAll());
  9712. } else k.verbose("Dimmer clicked but closable setting is disabled");
  9713. }, debounce: function debounce(e, t) {
  9714. clearTimeout(k.timer), k.timer = setTimeout(e, t);
  9715. }, keyboard: function keyboard(e) {
  9716. 27 == e.which && (T.closable ? (k.debug("Escape key pressed hiding modal"), k.hide()) : k.debug("Escape key pressed, but closable is set to false"), e.preventDefault());
  9717. }, resize: function resize() {
  9718. y.dimmer("is active") && (k.is.animating() || k.is.active()) && h(k.refresh);
  9719. } }, toggle: function toggle() {
  9720. k.is.active() || k.is.animating() ? k.hide() : k.show();
  9721. }, show: function show(t) {
  9722. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.set.dimmerSettings(), k.showModal(t);
  9723. }, hide: function hide(t) {
  9724. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.hideModal(t);
  9725. }, showModal: function showModal(t) {
  9726. t = e.isFunction(t) ? t : function () {}, k.is.animating() || !k.is.active() ? (k.showDimmer(), k.cacheSizes(), k.set.screenHeight(), k.set.type(), k.set.clickaway(), !T.allowMultiple && k.others.active() ? k.hideOthers(k.showModal) : (T.allowMultiple && T.detachable && D.detach().appendTo(x), T.onShow.call(z), T.transition && e.fn.transition !== i && D.transition("is supported") ? (k.debug("Showing modal with css animations"), D.transition({ debug: T.debug, animation: T.transition + " in", queue: T.queue, duration: T.duration, useFailSafe: !0, onComplete: function onComplete() {
  9727. T.onVisible.apply(z), T.keyboardShortcuts && k.add.keyboardShortcuts(), k.save.focus(), k.set.active(), T.autofocus && k.set.autofocus(), t();
  9728. } })) : k.error(E.noTransition))) : k.debug("Modal is already visible");
  9729. }, hideModal: function hideModal(t, n) {
  9730. t = e.isFunction(t) ? t : function () {}, k.debug("Hiding modal"), !1 !== T.onHide.call(z, e(this)) ? (k.is.animating() || k.is.active()) && (T.transition && e.fn.transition !== i && D.transition("is supported") ? (k.remove.active(), D.transition({ debug: T.debug, animation: T.transition + " out", queue: T.queue, duration: T.duration, useFailSafe: !0, onStart: function onStart() {
  9731. k.others.active() || n || k.hideDimmer(), T.keyboardShortcuts && k.remove.keyboardShortcuts();
  9732. }, onComplete: function onComplete() {
  9733. T.onHidden.call(z), k.restore.focus(), t();
  9734. } })) : k.error(E.noTransition)) : k.verbose("Hide callback returned false cancelling hide");
  9735. }, showDimmer: function showDimmer() {
  9736. y.dimmer("is animating") || !y.dimmer("is active") ? (k.debug("Showing dimmer"), y.dimmer("show")) : k.debug("Dimmer already visible");
  9737. }, hideDimmer: function hideDimmer() {
  9738. y.dimmer("is animating") || y.dimmer("is active") ? y.dimmer("hide", function () {
  9739. k.remove.clickaway(), k.remove.screenHeight();
  9740. }) : k.debug("Dimmer is not visible cannot hide");
  9741. }, hideAll: function hideAll(t) {
  9742. var n = r.filter("." + R.active + ", ." + R.animating);t = e.isFunction(t) ? t : function () {}, n.length > 0 && (k.debug("Hiding all visible modals"), k.hideDimmer(), n.modal("hide modal", t));
  9743. }, hideOthers: function hideOthers(t) {
  9744. var n = v.filter("." + R.active + ", ." + R.animating);t = e.isFunction(t) ? t : function () {}, n.length > 0 && (k.debug("Hiding other modals", v), n.modal("hide modal", t, !0));
  9745. }, others: { active: function active() {
  9746. return v.filter("." + R.active).length > 0;
  9747. }, animating: function animating() {
  9748. return v.filter("." + R.animating).length > 0;
  9749. } }, add: { keyboardShortcuts: function keyboardShortcuts() {
  9750. k.verbose("Adding keyboard shortcuts"), l.on("keyup" + F, k.event.keyboard);
  9751. } }, save: { focus: function focus() {
  9752. e(n.activeElement).closest(D).length > 0 || (b = e(n.activeElement).blur());
  9753. } }, restore: { focus: function focus() {
  9754. b && b.length > 0 && b.focus();
  9755. } }, remove: { active: function active() {
  9756. D.removeClass(R.active);
  9757. }, clickaway: function clickaway() {
  9758. x.off("click" + C);
  9759. }, bodyStyle: function bodyStyle() {
  9760. "" === c.attr("style") && (k.verbose("Removing style attribute"), c.removeAttr("style"));
  9761. }, screenHeight: function screenHeight() {
  9762. k.debug("Removing page height"), c.css("height", "");
  9763. }, keyboardShortcuts: function keyboardShortcuts() {
  9764. k.verbose("Removing keyboard shortcuts"), l.off("keyup" + F);
  9765. }, scrolling: function scrolling() {
  9766. y.removeClass(R.scrolling), D.removeClass(R.scrolling);
  9767. } }, cacheSizes: function cacheSizes() {
  9768. D.addClass(R.loading);var o = D.prop("scrollHeight"),
  9769. a = D.outerHeight();k.cache !== i && 0 === a || (k.cache = { pageHeight: e(n).outerHeight(), height: a + T.offset, scrollHeight: o + T.offset, contextHeight: "body" == T.context ? e(t).height() : y.height() }, k.cache.topOffset = -k.cache.height / 2), D.removeClass(R.loading), k.debug("Caching modal and container sizes", k.cache);
  9770. }, can: { fit: function fit() {
  9771. var e = k.cache.contextHeight,
  9772. t = k.cache.contextHeight / 2,
  9773. n = k.cache.topOffset,
  9774. i = k.cache.scrollHeight,
  9775. o = k.cache.height,
  9776. a = T.padding;return i > o ? t + n + i + a < e : o + 2 * a < e;
  9777. } }, is: { active: function active() {
  9778. return D.hasClass(R.active);
  9779. }, animating: function animating() {
  9780. return D.transition("is supported") ? D.transition("is animating") : D.is(":visible");
  9781. }, scrolling: function scrolling() {
  9782. return y.hasClass(R.scrolling);
  9783. }, modernBrowser: function modernBrowser() {
  9784. return !(t.ActiveXObject || "ActiveXObject" in t);
  9785. } }, set: { autofocus: function autofocus() {
  9786. var e = D.find("[tabindex], :input").filter(":visible"),
  9787. t = e.filter("[autofocus]"),
  9788. n = t.length > 0 ? t.first() : e.first();n.length > 0 && n.focus();
  9789. }, clickaway: function clickaway() {
  9790. x.on("click" + C, k.event.click);
  9791. }, dimmerSettings: function dimmerSettings() {
  9792. if (e.fn.dimmer !== i) {
  9793. var t = { debug: T.debug, dimmerName: "modals", closable: "auto", variation: !T.centered && "top aligned", duration: { show: T.duration, hide: T.duration } },
  9794. n = e.extend(!0, t, T.dimmerSettings);T.inverted ? (n.variation = n.variation !== i ? n.variation + " inverted" : "inverted", x.addClass(R.inverted)) : x.removeClass(R.inverted), T.blurring ? y.addClass(R.blurring) : y.removeClass(R.blurring), q.dimmer("setting", n);
  9795. } else k.error(E.dimmer);
  9796. }, screenHeight: function screenHeight() {
  9797. k.can.fit() ? c.css("height", "") : (k.debug("Modal is taller than page content, resizing page height"), c.css("height", k.cache.height + 2 * T.padding));
  9798. }, active: function active() {
  9799. D.addClass(R.active);
  9800. }, scrolling: function scrolling() {
  9801. y.addClass(R.scrolling), D.addClass(R.scrolling);
  9802. }, type: function type() {
  9803. k.can.fit() ? (k.verbose("Modal fits on screen"), k.others.active() || k.others.animating() || k.remove.scrolling()) : (k.verbose("Modal cannot fit on screen setting to scrolling"), k.set.scrolling());
  9804. }, undetached: function undetached() {
  9805. y.addClass(R.undetached);
  9806. } }, setting: function setting(t, n) {
  9807. if (k.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, T, t);else {
  9808. if (n === i) return T[t];e.isPlainObject(T[t]) ? e.extend(!0, T[t], n) : T[t] = n;
  9809. }
  9810. }, internal: function internal(t, n) {
  9811. if (e.isPlainObject(t)) e.extend(!0, k, t);else {
  9812. if (n === i) return k[t];k[t] = n;
  9813. }
  9814. }, debug: function debug() {
  9815. !T.silent && T.debug && (T.performance ? k.performance.log(arguments) : (k.debug = Function.prototype.bind.call(console.info, console, T.name + ":"), k.debug.apply(console, arguments)));
  9816. }, verbose: function verbose() {
  9817. !T.silent && T.verbose && T.debug && (T.performance ? k.performance.log(arguments) : (k.verbose = Function.prototype.bind.call(console.info, console, T.name + ":"), k.verbose.apply(console, arguments)));
  9818. }, error: function error() {
  9819. T.silent || (k.error = Function.prototype.bind.call(console.error, console, T.name + ":"), k.error.apply(console, arguments));
  9820. }, performance: { log: function log(e) {
  9821. var t, n;T.performance && (n = (t = new Date().getTime()) - (d || t), d = t, f.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: z, "Execution Time": n })), clearTimeout(k.performance.timer), k.performance.timer = setTimeout(k.performance.display, 500);
  9822. }, display: function display() {
  9823. var t = T.name + ":",
  9824. n = 0;d = !1, clearTimeout(k.performance.timer), e.each(f, function (e, t) {
  9825. n += t["Execution Time"];
  9826. }), t += " " + n + "ms", u && (t += " '" + u + "'"), (console.group !== i || console.table !== i) && f.length > 0 && (console.groupCollapsed(t), console.table ? console.table(f) : e.each(f, function (e, t) {
  9827. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  9828. }), console.groupEnd()), f = [];
  9829. } }, invoke: function invoke(t, n, o) {
  9830. var r,
  9831. s,
  9832. l,
  9833. c = I;return n = n || p, o = z || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  9834. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  9835. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  9836. }
  9837. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  9838. } }, g ? (I === i && k.initialize(), k.invoke(m)) : (I !== i && I.invoke("destroy"), k.initialize());
  9839. }), a !== i ? a : this;
  9840. }, e.fn.modal.settings = { name: "Modal", namespace: "modal", silent: !1, debug: !1, verbose: !1, performance: !0, observeChanges: !1, allowMultiple: !1, detachable: !0, closable: !0, autofocus: !0, inverted: !1, blurring: !1, centered: !0, dimmerSettings: { closable: !1, useCSS: !0 }, keyboardShortcuts: !0, context: "body", queue: !1, duration: 500, offset: 0, transition: "scale", padding: 50, onShow: function onShow() {}, onVisible: function onVisible() {}, onHide: function onHide() {
  9841. return !0;
  9842. }, onHidden: function onHidden() {}, onApprove: function onApprove() {
  9843. return !0;
  9844. }, onDeny: function onDeny() {
  9845. return !0;
  9846. }, selector: { close: "> .close", approve: ".actions .positive, .actions .approve, .actions .ok", deny: ".actions .negative, .actions .deny, .actions .cancel", modal: ".ui.modal" }, error: { dimmer: "UI Dimmer, a required component is not included in this page", method: "The method you called is not defined.", notFound: "The element you specified could not be found" }, className: { active: "active", animating: "animating", blurring: "blurring", inverted: "inverted", loading: "loading", scrolling: "scrolling", undetached: "undetached" } };
  9847. }(jQuery, window, document), function (e, t, n, i) {
  9848. "use strict";
  9849. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.nag = function (n) {
  9850. var o,
  9851. a = e(this),
  9852. r = a.selector || "",
  9853. s = new Date().getTime(),
  9854. l = [],
  9855. c = arguments[0],
  9856. u = "string" == typeof c,
  9857. d = [].slice.call(arguments, 1);return a.each(function () {
  9858. var a,
  9859. f = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.nag.settings, n) : e.extend({}, e.fn.nag.settings),
  9860. m = (f.className, f.selector),
  9861. g = f.error,
  9862. p = f.namespace,
  9863. h = "." + p,
  9864. v = p + "-module",
  9865. b = e(this),
  9866. y = (b.find(m.close), f.context ? e(f.context) : e("body")),
  9867. x = this,
  9868. C = b.data(v);t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;a = { initialize: function initialize() {
  9869. a.verbose("Initializing element"), b.on("click" + h, m.close, a.dismiss).data(v, a), f.detachable && b.parent()[0] !== y[0] && b.detach().prependTo(y), f.displayTime > 0 && setTimeout(a.hide, f.displayTime), a.show();
  9870. }, destroy: function destroy() {
  9871. a.verbose("Destroying instance"), b.removeData(v).off(h);
  9872. }, show: function show() {
  9873. a.should.show() && !b.is(":visible") && (a.debug("Showing nag", f.animation.show), "fade" == f.animation.show ? b.fadeIn(f.duration, f.easing) : b.slideDown(f.duration, f.easing));
  9874. }, hide: function hide() {
  9875. a.debug("Showing nag", f.animation.hide), "fade" == f.animation.show ? b.fadeIn(f.duration, f.easing) : b.slideUp(f.duration, f.easing);
  9876. }, onHide: function onHide() {
  9877. a.debug("Removing nag", f.animation.hide), b.remove(), f.onHide && f.onHide();
  9878. }, dismiss: function dismiss(e) {
  9879. f.storageMethod && a.storage.set(f.key, f.value), a.hide(), e.stopImmediatePropagation(), e.preventDefault();
  9880. }, should: { show: function show() {
  9881. return f.persist ? (a.debug("Persistent nag is set, can show nag"), !0) : a.storage.get(f.key) != f.value.toString() ? (a.debug("Stored value is not set, can show nag", a.storage.get(f.key)), !0) : (a.debug("Stored value is set, cannot show nag", a.storage.get(f.key)), !1);
  9882. } }, get: { storageOptions: function storageOptions() {
  9883. var e = {};return f.expires && (e.expires = f.expires), f.domain && (e.domain = f.domain), f.path && (e.path = f.path), e;
  9884. } }, clear: function clear() {
  9885. a.storage.remove(f.key);
  9886. }, storage: { set: function set(n, o) {
  9887. var r = a.get.storageOptions();if ("localstorage" == f.storageMethod && t.localStorage !== i) t.localStorage.setItem(n, o), a.debug("Value stored using local storage", n, o);else if ("sessionstorage" == f.storageMethod && t.sessionStorage !== i) t.sessionStorage.setItem(n, o), a.debug("Value stored using session storage", n, o);else {
  9888. if (e.cookie === i) return void a.error(g.noCookieStorage);e.cookie(n, o, r), a.debug("Value stored using cookie", n, o, r);
  9889. }
  9890. }, get: function get(n, o) {
  9891. var r;return "localstorage" == f.storageMethod && t.localStorage !== i ? r = t.localStorage.getItem(n) : "sessionstorage" == f.storageMethod && t.sessionStorage !== i ? r = t.sessionStorage.getItem(n) : e.cookie !== i ? r = e.cookie(n) : a.error(g.noCookieStorage), "undefined" != r && "null" != r && r !== i && null !== r || (r = i), r;
  9892. }, remove: function remove(n) {
  9893. var o = a.get.storageOptions();"localstorage" == f.storageMethod && t.localStorage !== i ? t.localStorage.removeItem(n) : "sessionstorage" == f.storageMethod && t.sessionStorage !== i ? t.sessionStorage.removeItem(n) : e.cookie !== i ? e.removeCookie(n, o) : a.error(g.noStorage);
  9894. } }, setting: function setting(t, n) {
  9895. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  9896. if (n === i) return f[t];e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  9897. }
  9898. }, internal: function internal(t, n) {
  9899. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  9900. if (n === i) return a[t];a[t] = n;
  9901. }
  9902. }, debug: function debug() {
  9903. !f.silent && f.debug && (f.performance ? a.performance.log(arguments) : (a.debug = Function.prototype.bind.call(console.info, console, f.name + ":"), a.debug.apply(console, arguments)));
  9904. }, verbose: function verbose() {
  9905. !f.silent && f.verbose && f.debug && (f.performance ? a.performance.log(arguments) : (a.verbose = Function.prototype.bind.call(console.info, console, f.name + ":"), a.verbose.apply(console, arguments)));
  9906. }, error: function error() {
  9907. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  9908. }, performance: { log: function log(e) {
  9909. var t, n;f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: x, "Execution Time": n })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500);
  9910. }, display: function display() {
  9911. var t = f.name + ":",
  9912. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  9913. n += t["Execution Time"];
  9914. }), t += " " + n + "ms", r && (t += " '" + r + "'"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  9915. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  9916. }), console.groupEnd()), l = [];
  9917. } }, invoke: function invoke(t, n, r) {
  9918. var s,
  9919. l,
  9920. c,
  9921. u = C;return n = n || d, r = x || r, "string" == typeof t && u !== i && (t = t.split(/[\. ]/), s = t.length - 1, e.each(t, function (n, o) {
  9922. var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(u[r]) && n != s) u = u[r];else {
  9923. if (u[r] !== i) return l = u[r], !1;if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(g.method, t), !1);u = u[o];
  9924. }
  9925. })), e.isFunction(l) ? c = l.apply(r, n) : l !== i && (c = l), e.isArray(o) ? o.push(c) : o !== i ? o = [o, c] : c !== i && (o = c), l;
  9926. } }, u ? (C === i && a.initialize(), a.invoke(c)) : (C !== i && C.invoke("destroy"), a.initialize());
  9927. }), o !== i ? o : this;
  9928. }, e.fn.nag.settings = { name: "Nag", silent: !1, debug: !1, verbose: !1, performance: !0, namespace: "Nag", persist: !1, displayTime: 0, animation: { show: "slide", hide: "slide" }, context: !1, detachable: !1, expires: 30, domain: !1, path: "/", storageMethod: "cookie", key: "nag", value: "dismiss", error: { noCookieStorage: "$.cookie is not included. A storage solution is required.", noStorage: "Neither $.cookie or store is defined. A storage solution is required for storing state", method: "The method you called is not defined." }, className: { bottom: "bottom", fixed: "fixed" }, selector: { close: ".close.icon" }, speed: 500, easing: "easeOutQuad", onHide: function onHide() {} }, e.extend(e.easing, { easeOutQuad: function easeOutQuad(e, t, n, i, o) {
  9929. return -i * (t /= o) * (t - 2) + n;
  9930. } });
  9931. }(jQuery, window, document), function (e, t, n, i) {
  9932. "use strict";
  9933. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.popup = function (o) {
  9934. var a,
  9935. r = e(this),
  9936. s = e(n),
  9937. l = e(t),
  9938. c = e("body"),
  9939. u = r.selector || "",
  9940. d = new Date().getTime(),
  9941. f = [],
  9942. m = arguments[0],
  9943. g = "string" == typeof m,
  9944. p = [].slice.call(arguments, 1);return r.each(function () {
  9945. var r,
  9946. h,
  9947. v,
  9948. b,
  9949. y,
  9950. x,
  9951. C = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.popup.settings, o) : e.extend({}, e.fn.popup.settings),
  9952. w = C.selector,
  9953. S = C.className,
  9954. k = C.error,
  9955. T = C.metadata,
  9956. A = C.namespace,
  9957. R = "." + C.namespace,
  9958. P = "module-" + A,
  9959. E = e(this),
  9960. F = e(C.context),
  9961. O = e(C.scrollContext),
  9962. D = e(C.boundary),
  9963. q = C.target ? e(C.target) : E,
  9964. j = 0,
  9965. z = !1,
  9966. I = !1,
  9967. M = this,
  9968. L = E.data(P);x = { initialize: function initialize() {
  9969. x.debug("Initializing", E), x.createID(), x.bind.events(), !x.exists() && C.preserve && x.create(), C.observeChanges && x.observeChanges(), x.instantiate();
  9970. }, instantiate: function instantiate() {
  9971. x.verbose("Storing instance", x), L = x, E.data(P, L);
  9972. }, observeChanges: function observeChanges() {
  9973. "MutationObserver" in t && ((v = new MutationObserver(x.event.documentChanged)).observe(n, { childList: !0, subtree: !0 }), x.debug("Setting up mutation observer", v));
  9974. }, refresh: function refresh() {
  9975. C.popup ? r = e(C.popup).eq(0) : C.inline && (r = q.nextAll(w.popup).eq(0), C.popup = r), C.popup ? (r.addClass(S.loading), h = x.get.offsetParent(), r.removeClass(S.loading), C.movePopup && x.has.popup() && x.get.offsetParent(r)[0] !== h[0] && (x.debug("Moving popup to the same offset parent as target"), r.detach().appendTo(h))) : h = C.inline ? x.get.offsetParent(q) : x.has.popup() ? x.get.offsetParent(r) : c, h.is("html") && h[0] !== c[0] && (x.debug("Setting page as offset parent"), h = c), x.get.variation() && x.set.variation();
  9976. }, reposition: function reposition() {
  9977. x.refresh(), x.set.position();
  9978. }, destroy: function destroy() {
  9979. x.debug("Destroying previous module"), v && v.disconnect(), r && !C.preserve && x.removePopup(), clearTimeout(x.hideTimer), clearTimeout(x.showTimer), x.unbind.close(), x.unbind.events(), E.removeData(P);
  9980. }, event: { start: function start(t) {
  9981. var n = e.isPlainObject(C.delay) ? C.delay.show : C.delay;clearTimeout(x.hideTimer), I || (x.showTimer = setTimeout(x.show, n));
  9982. }, end: function end() {
  9983. var t = e.isPlainObject(C.delay) ? C.delay.hide : C.delay;clearTimeout(x.showTimer), x.hideTimer = setTimeout(x.hide, t);
  9984. }, touchstart: function touchstart(e) {
  9985. I = !0, x.show();
  9986. }, resize: function resize() {
  9987. x.is.visible() && x.set.position();
  9988. }, documentChanged: function documentChanged(t) {
  9989. [].forEach.call(t, function (t) {
  9990. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  9991. (t == M || e(t).find(M).length > 0) && (x.debug("Element removed from DOM, tearing down events"), x.destroy());
  9992. });
  9993. });
  9994. }, hideGracefully: function hideGracefully(t) {
  9995. var i = e(t.target),
  9996. o = e.contains(n.documentElement, t.target),
  9997. a = i.closest(w.popup).length > 0;t && !a && o ? (x.debug("Click occurred outside popup hiding popup"), x.hide()) : x.debug("Click was inside popup, keeping popup open");
  9998. } }, create: function create() {
  9999. var t = x.get.html(),
  10000. n = x.get.title(),
  10001. i = x.get.content();t || i || n ? (x.debug("Creating pop-up html"), t || (t = C.templates.popup({ title: n, content: i })), r = e("<div/>").addClass(S.popup).data(T.activator, E).html(t), C.inline ? (x.verbose("Inserting popup element inline", r), r.insertAfter(E)) : (x.verbose("Appending popup element to body", r), r.appendTo(F)), x.refresh(), x.set.variation(), C.hoverable && x.bind.popup(), C.onCreate.call(r, M)) : 0 !== q.next(w.popup).length ? (x.verbose("Pre-existing popup found"), C.inline = !0, C.popup = q.next(w.popup).data(T.activator, E), x.refresh(), C.hoverable && x.bind.popup()) : C.popup ? (e(C.popup).data(T.activator, E), x.verbose("Used popup specified in settings"), x.refresh(), C.hoverable && x.bind.popup()) : x.debug("No content specified skipping display", M);
  10002. }, createID: function createID() {
  10003. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, x.verbose("Creating unique id for element", y);
  10004. }, toggle: function toggle() {
  10005. x.debug("Toggling pop-up"), x.is.hidden() ? (x.debug("Popup is hidden, showing pop-up"), x.unbind.close(), x.show()) : (x.debug("Popup is visible, hiding pop-up"), x.hide());
  10006. }, show: function show(e) {
  10007. if (e = e || function () {}, x.debug("Showing pop-up", C.transition), x.is.hidden() && (!x.is.active() || !x.is.dropdown())) {
  10008. if (x.exists() || x.create(), !1 === C.onShow.call(r, M)) return void x.debug("onShow callback returned false, cancelling popup animation");C.preserve || C.popup || x.refresh(), r && x.set.position() && (x.save.conditions(), C.exclusive && x.hideAll(), x.animate.show(e));
  10009. }
  10010. }, hide: function hide(e) {
  10011. if (e = e || function () {}, x.is.visible() || x.is.animating()) {
  10012. if (!1 === C.onHide.call(r, M)) return void x.debug("onHide callback returned false, cancelling popup animation");x.remove.visible(), x.unbind.close(), x.restore.conditions(), x.animate.hide(e);
  10013. }
  10014. }, hideAll: function hideAll() {
  10015. e(w.popup).filter("." + S.popupVisible).each(function () {
  10016. e(this).data(T.activator).popup("hide");
  10017. });
  10018. }, exists: function exists() {
  10019. return !!r && (C.inline || C.popup ? x.has.popup() : r.closest(F).length >= 1);
  10020. }, removePopup: function removePopup() {
  10021. x.has.popup() && !C.popup && (x.debug("Removing popup", r), r.remove(), r = i, C.onRemove.call(r, M));
  10022. }, save: { conditions: function conditions() {
  10023. x.cache = { title: E.attr("title") }, x.cache.title && E.removeAttr("title"), x.verbose("Saving original attributes", x.cache.title);
  10024. } }, restore: { conditions: function conditions() {
  10025. return x.cache && x.cache.title && (E.attr("title", x.cache.title), x.verbose("Restoring original attributes", x.cache.title)), !0;
  10026. } }, supports: { svg: function svg() {
  10027. return "undefined" == typeof SVGGraphicsElement;
  10028. } }, animate: { show: function show(t) {
  10029. t = e.isFunction(t) ? t : function () {}, C.transition && e.fn.transition !== i && E.transition("is supported") ? (x.set.visible(), r.transition({ animation: C.transition + " in", queue: !1, debug: C.debug, verbose: C.verbose, duration: C.duration, onComplete: function onComplete() {
  10030. x.bind.close(), t.call(r, M), C.onVisible.call(r, M);
  10031. } })) : x.error(k.noTransition);
  10032. }, hide: function hide(t) {
  10033. t = e.isFunction(t) ? t : function () {}, x.debug("Hiding pop-up"), !1 !== C.onHide.call(r, M) ? C.transition && e.fn.transition !== i && E.transition("is supported") ? r.transition({ animation: C.transition + " out", queue: !1, duration: C.duration, debug: C.debug, verbose: C.verbose, onComplete: function onComplete() {
  10034. x.reset(), t.call(r, M), C.onHidden.call(r, M);
  10035. } }) : x.error(k.noTransition) : x.debug("onHide callback returned false, cancelling popup animation");
  10036. } }, change: { content: function content(e) {
  10037. r.html(e);
  10038. } }, get: { html: function html() {
  10039. return E.removeData(T.html), E.data(T.html) || C.html;
  10040. }, title: function title() {
  10041. return E.removeData(T.title), E.data(T.title) || C.title;
  10042. }, content: function content() {
  10043. return E.removeData(T.content), E.data(T.content) || C.content || E.attr("title");
  10044. }, variation: function variation() {
  10045. return E.removeData(T.variation), E.data(T.variation) || C.variation;
  10046. }, popup: function popup() {
  10047. return r;
  10048. }, popupOffset: function popupOffset() {
  10049. return r.offset();
  10050. }, calculations: function calculations() {
  10051. var e,
  10052. n = x.get.offsetParent(r),
  10053. i = q[0],
  10054. o = D[0] == t,
  10055. a = C.inline || C.popup && C.movePopup ? q.position() : q.offset(),
  10056. s = o ? { top: 0, left: 0 } : D.offset(),
  10057. c = {},
  10058. u = o ? { top: l.scrollTop(), left: l.scrollLeft() } : { top: 0, left: 0 };if (c = { target: { element: q[0], width: q.outerWidth(), height: q.outerHeight(), top: a.top, left: a.left, margin: {} }, popup: { width: r.outerWidth(), height: r.outerHeight() }, parent: { width: h.outerWidth(), height: h.outerHeight() }, screen: { top: s.top, left: s.left, scroll: { top: u.top, left: u.left }, width: D.width(), height: D.height() } }, n.get(0) !== h.get(0)) {
  10059. var d = n.offset();c.target.top -= d.top, c.target.left -= d.left, c.parent.width = n.outerWidth(), c.parent.height = n.outerHeight();
  10060. }return C.setFluidWidth && x.is.fluid() && (c.container = { width: r.parent().outerWidth() }, c.popup.width = c.container.width), c.target.margin.top = C.inline ? parseInt(t.getComputedStyle(i).getPropertyValue("margin-top"), 10) : 0, c.target.margin.left = C.inline ? x.is.rtl() ? parseInt(t.getComputedStyle(i).getPropertyValue("margin-right"), 10) : parseInt(t.getComputedStyle(i).getPropertyValue("margin-left"), 10) : 0, e = c.screen, c.boundary = { top: e.top + e.scroll.top, bottom: e.top + e.scroll.top + e.height, left: e.left + e.scroll.left, right: e.left + e.scroll.left + e.width }, c;
  10061. }, id: function id() {
  10062. return y;
  10063. }, startEvent: function startEvent() {
  10064. return "hover" == C.on ? "mouseenter" : "focus" == C.on && "focus";
  10065. }, scrollEvent: function scrollEvent() {
  10066. return "scroll";
  10067. }, endEvent: function endEvent() {
  10068. return "hover" == C.on ? "mouseleave" : "focus" == C.on && "blur";
  10069. }, distanceFromBoundary: function distanceFromBoundary(e, t) {
  10070. var n,
  10071. i,
  10072. o = {};return n = (t = t || x.get.calculations()).popup, i = t.boundary, e && (o = { top: e.top - i.top, left: e.left - i.left, right: i.right - (e.left + n.width), bottom: i.bottom - (e.top + n.height) }, x.verbose("Distance from boundaries determined", e, o)), o;
  10073. }, offsetParent: function offsetParent(t) {
  10074. var n = (t !== i ? t[0] : q[0]).parentNode,
  10075. o = e(n);if (n) for (var a = "none" === o.css("transform"), r = "static" === o.css("position"), s = o.is("body"); n && !s && r && a;) {
  10076. n = n.parentNode, a = "none" === (o = e(n)).css("transform"), r = "static" === o.css("position"), s = o.is("body");
  10077. }return o && o.length > 0 ? o : e();
  10078. }, positions: function positions() {
  10079. return { "top left": !1, "top center": !1, "top right": !1, "bottom left": !1, "bottom center": !1, "bottom right": !1, "left center": !1, "right center": !1 };
  10080. }, nextPosition: function nextPosition(e) {
  10081. var t = e.split(" "),
  10082. n = t[0],
  10083. i = t[1],
  10084. o = "top" == n || "bottom" == n,
  10085. a = !1,
  10086. r = !1,
  10087. s = !1;return z || (x.verbose("All available positions available"), z = x.get.positions()), x.debug("Recording last position tried", e), z[e] = !0, "opposite" === C.prefer && (s = (s = [{ top: "bottom", bottom: "top", left: "right", right: "left" }[n], i]).join(" "), a = !0 === z[s], x.debug("Trying opposite strategy", s)), "adjacent" === C.prefer && o && (s = (s = [n, { left: "center", center: "right", right: "left" }[i]]).join(" "), r = !0 === z[s], x.debug("Trying adjacent strategy", s)), (r || a) && (x.debug("Using backup position", s), s = { "top left": "top center", "top center": "top right", "top right": "right center", "right center": "bottom right", "bottom right": "bottom center", "bottom center": "bottom left", "bottom left": "left center", "left center": "top left" }[e]), s;
  10088. } }, set: { position: function position(e, t) {
  10089. if (0 !== q.length && 0 !== r.length) {
  10090. var n, o, a, s, l, c, u, d;if (t = t || x.get.calculations(), e = e || E.data(T.position) || C.position, n = E.data(T.offset) || C.offset, o = C.distanceAway, a = t.target, s = t.popup, l = t.parent, x.should.centerArrow(t) && (x.verbose("Adjusting offset to center arrow on small target element"), "top left" != e && "bottom left" != e || (n += a.width / 2, n -= C.arrowPixelsFromEdge), "top right" != e && "bottom right" != e || (n -= a.width / 2, n += C.arrowPixelsFromEdge)), 0 === a.width && 0 === a.height && !x.is.svg(a.element)) return x.debug("Popup target is hidden, no action taken"), !1;switch (C.inline && (x.debug("Adding margin to calculation", a.margin), "left center" == e || "right center" == e ? (n += a.margin.top, o += -a.margin.left) : "top left" == e || "top center" == e || "top right" == e ? (n += a.margin.left, o -= a.margin.top) : (n += a.margin.left, o += a.margin.top)), x.debug("Determining popup position from calculations", e, t), x.is.rtl() && (e = e.replace(/left|right/g, function (e) {
  10091. return "left" == e ? "right" : "left";
  10092. }), x.debug("RTL: Popup position updated", e)), j == C.maxSearchDepth && "string" == typeof C.lastResort && (e = C.lastResort), e) {case "top left":
  10093. c = { top: "auto", bottom: l.height - a.top + o, left: a.left + n, right: "auto" };break;case "top center":
  10094. c = { bottom: l.height - a.top + o, left: a.left + a.width / 2 - s.width / 2 + n, top: "auto", right: "auto" };break;case "top right":
  10095. c = { bottom: l.height - a.top + o, right: l.width - a.left - a.width - n, top: "auto", left: "auto" };break;case "left center":
  10096. c = { top: a.top + a.height / 2 - s.height / 2 + n, right: l.width - a.left + o, left: "auto", bottom: "auto" };break;case "right center":
  10097. c = { top: a.top + a.height / 2 - s.height / 2 + n, left: a.left + a.width + o, bottom: "auto", right: "auto" };break;case "bottom left":
  10098. c = { top: a.top + a.height + o, left: a.left + n, bottom: "auto", right: "auto" };break;case "bottom center":
  10099. c = { top: a.top + a.height + o, left: a.left + a.width / 2 - s.width / 2 + n, bottom: "auto", right: "auto" };break;case "bottom right":
  10100. c = { top: a.top + a.height + o, right: l.width - a.left - a.width - n, left: "auto", bottom: "auto" };}if (c === i && x.error(k.invalidPosition, e), x.debug("Calculated popup positioning values", c), r.css(c).removeClass(S.position).addClass(e).addClass(S.loading), u = x.get.popupOffset(), d = x.get.distanceFromBoundary(u, t), x.is.offstage(d, e)) {
  10101. if (x.debug("Position is outside viewport", e), j < C.maxSearchDepth) return j++, e = x.get.nextPosition(e), x.debug("Trying new position", e), !!r && x.set.position(e, t);if (!C.lastResort) return x.debug("Popup could not find a position to display", r), x.error(k.cannotPlace, M), x.remove.attempts(), x.remove.loading(), x.reset(), C.onUnplaceable.call(r, M), !1;x.debug("No position found, showing with last position");
  10102. }return x.debug("Position is on stage", e), x.remove.attempts(), x.remove.loading(), C.setFluidWidth && x.is.fluid() && x.set.fluidWidth(t), !0;
  10103. }x.error(k.notFound);
  10104. }, fluidWidth: function fluidWidth(e) {
  10105. e = e || x.get.calculations(), x.debug("Automatically setting element width to parent width", e.parent.width), r.css("width", e.container.width);
  10106. }, variation: function variation(e) {
  10107. (e = e || x.get.variation()) && x.has.popup() && (x.verbose("Adding variation to popup", e), r.addClass(e));
  10108. }, visible: function visible() {
  10109. E.addClass(S.visible);
  10110. } }, remove: { loading: function loading() {
  10111. r.removeClass(S.loading);
  10112. }, variation: function variation(e) {
  10113. (e = e || x.get.variation()) && (x.verbose("Removing variation", e), r.removeClass(e));
  10114. }, visible: function visible() {
  10115. E.removeClass(S.visible);
  10116. }, attempts: function attempts() {
  10117. x.verbose("Resetting all searched positions"), j = 0, z = !1;
  10118. } }, bind: { events: function events() {
  10119. x.debug("Binding popup events to module"), "click" == C.on && E.on("click" + R, x.toggle), "hover" == C.on && E.on("touchstart" + R, x.event.touchstart), x.get.startEvent() && E.on(x.get.startEvent() + R, x.event.start).on(x.get.endEvent() + R, x.event.end), C.target && x.debug("Target set to element", q), l.on("resize" + b, x.event.resize);
  10120. }, popup: function popup() {
  10121. x.verbose("Allowing hover events on popup to prevent closing"), r && x.has.popup() && r.on("mouseenter" + R, x.event.start).on("mouseleave" + R, x.event.end);
  10122. }, close: function close() {
  10123. (!0 === C.hideOnScroll || "auto" == C.hideOnScroll && "click" != C.on) && x.bind.closeOnScroll(), "hover" == C.on && I && x.bind.touchClose(), "click" == C.on && C.closable && x.bind.clickaway();
  10124. }, closeOnScroll: function closeOnScroll() {
  10125. x.verbose("Binding scroll close event to document"), O.one(x.get.scrollEvent() + b, x.event.hideGracefully);
  10126. }, touchClose: function touchClose() {
  10127. x.verbose("Binding popup touchclose event to document"), s.on("touchstart" + b, function (e) {
  10128. x.verbose("Touched away from popup"), x.event.hideGracefully.call(M, e);
  10129. });
  10130. }, clickaway: function clickaway() {
  10131. x.verbose("Binding popup close event to document"), s.on("click" + b, function (e) {
  10132. x.verbose("Clicked away from popup"), x.event.hideGracefully.call(M, e);
  10133. });
  10134. } }, unbind: { events: function events() {
  10135. l.off(b), E.off(R);
  10136. }, close: function close() {
  10137. s.off(b), O.off(b);
  10138. } }, has: { popup: function popup() {
  10139. return r && r.length > 0;
  10140. } }, should: { centerArrow: function centerArrow(e) {
  10141. return !x.is.basic() && e.target.width <= 2 * C.arrowPixelsFromEdge;
  10142. } }, is: { offstage: function offstage(t, n) {
  10143. var i = [];return e.each(t, function (e, t) {
  10144. t < -C.jitter && (x.debug("Position exceeds allowable distance from edge", e, t, n), i.push(e));
  10145. }), i.length > 0;
  10146. }, svg: function svg(e) {
  10147. return x.supports.svg() && e instanceof SVGGraphicsElement;
  10148. }, basic: function basic() {
  10149. return E.hasClass(S.basic);
  10150. }, active: function active() {
  10151. return E.hasClass(S.active);
  10152. }, animating: function animating() {
  10153. return r !== i && r.hasClass(S.animating);
  10154. }, fluid: function fluid() {
  10155. return r !== i && r.hasClass(S.fluid);
  10156. }, visible: function visible() {
  10157. return r !== i && r.hasClass(S.popupVisible);
  10158. }, dropdown: function dropdown() {
  10159. return E.hasClass(S.dropdown);
  10160. }, hidden: function hidden() {
  10161. return !x.is.visible();
  10162. }, rtl: function rtl() {
  10163. return "rtl" == E.css("direction");
  10164. } }, reset: function reset() {
  10165. x.remove.visible(), C.preserve ? e.fn.transition !== i && r.transition("remove transition") : x.removePopup();
  10166. }, setting: function setting(t, n) {
  10167. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  10168. if (n === i) return C[t];C[t] = n;
  10169. }
  10170. }, internal: function internal(t, n) {
  10171. if (e.isPlainObject(t)) e.extend(!0, x, t);else {
  10172. if (n === i) return x[t];x[t] = n;
  10173. }
  10174. }, debug: function debug() {
  10175. !C.silent && C.debug && (C.performance ? x.performance.log(arguments) : (x.debug = Function.prototype.bind.call(console.info, console, C.name + ":"), x.debug.apply(console, arguments)));
  10176. }, verbose: function verbose() {
  10177. !C.silent && C.verbose && C.debug && (C.performance ? x.performance.log(arguments) : (x.verbose = Function.prototype.bind.call(console.info, console, C.name + ":"), x.verbose.apply(console, arguments)));
  10178. }, error: function error() {
  10179. C.silent || (x.error = Function.prototype.bind.call(console.error, console, C.name + ":"), x.error.apply(console, arguments));
  10180. }, performance: { log: function log(e) {
  10181. var t, n;C.performance && (n = (t = new Date().getTime()) - (d || t), d = t, f.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: M, "Execution Time": n })), clearTimeout(x.performance.timer), x.performance.timer = setTimeout(x.performance.display, 500);
  10182. }, display: function display() {
  10183. var t = C.name + ":",
  10184. n = 0;d = !1, clearTimeout(x.performance.timer), e.each(f, function (e, t) {
  10185. n += t["Execution Time"];
  10186. }), t += " " + n + "ms", u && (t += " '" + u + "'"), (console.group !== i || console.table !== i) && f.length > 0 && (console.groupCollapsed(t), console.table ? console.table(f) : e.each(f, function (e, t) {
  10187. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10188. }), console.groupEnd()), f = [];
  10189. } }, invoke: function invoke(t, n, o) {
  10190. var r,
  10191. s,
  10192. l,
  10193. c = L;return n = n || p, o = M || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  10194. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  10195. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  10196. }
  10197. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  10198. } }, g ? (L === i && x.initialize(), x.invoke(m)) : (L !== i && L.invoke("destroy"), x.initialize());
  10199. }), a !== i ? a : this;
  10200. }, e.fn.popup.settings = { name: "Popup", silent: !1, debug: !1, verbose: !1, performance: !0, namespace: "popup", observeChanges: !0, onCreate: function onCreate() {}, onRemove: function onRemove() {}, onShow: function onShow() {}, onVisible: function onVisible() {}, onHide: function onHide() {}, onUnplaceable: function onUnplaceable() {}, onHidden: function onHidden() {}, on: "hover", boundary: t, addTouchEvents: !0, position: "top left", variation: "", movePopup: !0, target: !1, popup: !1, inline: !1, preserve: !1, hoverable: !1, content: !1, html: !1, title: !1, closable: !0, hideOnScroll: "auto", exclusive: !1, context: "body", scrollContext: t, prefer: "opposite", lastResort: !1, arrowPixelsFromEdge: 20, delay: { show: 50, hide: 70 }, setFluidWidth: !0, duration: 200, transition: "scale", distanceAway: 0, jitter: 2, offset: 0, maxSearchDepth: 15, error: { invalidPosition: "The position you specified is not a valid position", cannotPlace: "Popup does not fit within the boundaries of the viewport", method: "The method you called is not defined.", noTransition: "This module requires ui transitions <https://github.com/Semantic-Org/UI-Transition>", notFound: "The target or popup you specified does not exist on the page" }, metadata: { activator: "activator", content: "content", html: "html", offset: "offset", position: "position", title: "title", variation: "variation" }, className: { active: "active", basic: "basic", animating: "animating", dropdown: "dropdown", fluid: "fluid", loading: "loading", popup: "ui popup", position: "top left center bottom right", visible: "visible", popupVisible: "visible" }, selector: { popup: ".ui.popup" }, templates: { escape: function escape(e) {
  10201. var t = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#x27;", "`": "&#x60;" };return (/[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  10202. return t[e];
  10203. }) : e
  10204. );
  10205. }, popup: function popup(t) {
  10206. var n = "",
  10207. o = e.fn.popup.settings.templates.escape;return (typeof t === "undefined" ? "undefined" : _typeof(t)) !== i && (_typeof(t.title) !== i && t.title && (t.title = o(t.title), n += '<div class="header">' + t.title + "</div>"), _typeof(t.content) !== i && t.content && (t.content = o(t.content), n += '<div class="content">' + t.content + "</div>")), n;
  10208. } } };
  10209. }(jQuery, window, document), function (e, t, n, i) {
  10210. "use strict";
  10211. void 0 !== (t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")()) && t.Math == Math || ("undefined" != typeof self && self.Math == Math ? self : Function("return this")());e.fn.progress = function (t) {
  10212. var o,
  10213. a = e(this),
  10214. r = a.selector || "",
  10215. s = new Date().getTime(),
  10216. l = [],
  10217. c = arguments[0],
  10218. u = "string" == typeof c,
  10219. d = [].slice.call(arguments, 1);return a.each(function () {
  10220. var a,
  10221. f = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.progress.settings, t) : e.extend({}, e.fn.progress.settings),
  10222. m = f.className,
  10223. g = f.metadata,
  10224. p = f.namespace,
  10225. h = f.selector,
  10226. v = f.error,
  10227. b = "." + p,
  10228. y = "module-" + p,
  10229. x = e(this),
  10230. C = e(this).find(h.bar),
  10231. w = e(this).find(h.progress),
  10232. S = e(this).find(h.label),
  10233. k = this,
  10234. T = x.data(y),
  10235. A = !1;a = { initialize: function initialize() {
  10236. a.debug("Initializing progress bar", f), a.set.duration(), a.set.transitionEvent(), a.read.metadata(), a.read.settings(), a.instantiate();
  10237. }, instantiate: function instantiate() {
  10238. a.verbose("Storing instance of progress", a), T = a, x.data(y, a);
  10239. }, destroy: function destroy() {
  10240. a.verbose("Destroying previous progress for", x), clearInterval(T.interval), a.remove.state(), x.removeData(y), T = i;
  10241. }, reset: function reset() {
  10242. a.remove.nextValue(), a.update.progress(0);
  10243. }, complete: function complete() {
  10244. (a.percent === i || a.percent < 100) && (a.remove.progressPoll(), a.set.percent(100));
  10245. }, read: { metadata: function metadata() {
  10246. var e = { percent: x.data(g.percent), total: x.data(g.total), value: x.data(g.value) };e.percent && (a.debug("Current percent value set from metadata", e.percent), a.set.percent(e.percent)), e.total && (a.debug("Total value set from metadata", e.total), a.set.total(e.total)), e.value && (a.debug("Current value set from metadata", e.value), a.set.value(e.value), a.set.progress(e.value));
  10247. }, settings: function settings() {
  10248. !1 !== f.total && (a.debug("Current total set in settings", f.total), a.set.total(f.total)), !1 !== f.value && (a.debug("Current value set in settings", f.value), a.set.value(f.value), a.set.progress(a.value)), !1 !== f.percent && (a.debug("Current percent set in settings", f.percent), a.set.percent(f.percent));
  10249. } }, bind: { transitionEnd: function transitionEnd(e) {
  10250. var t = a.get.transitionEnd();C.one(t + b, function (t) {
  10251. clearTimeout(a.failSafeTimer), e.call(this, t);
  10252. }), a.failSafeTimer = setTimeout(function () {
  10253. C.triggerHandler(t);
  10254. }, f.duration + f.failSafeDelay), a.verbose("Adding fail safe timer", a.timer);
  10255. } }, increment: function increment(e) {
  10256. var t, n;a.has.total() ? n = (t = a.get.value()) + (e = e || 1) : (n = (t = a.get.percent()) + (e = e || a.get.randomValue()), 100, a.debug("Incrementing percentage by", t, n)), n = a.get.normalizedValue(n), a.set.progress(n);
  10257. }, decrement: function decrement(e) {
  10258. var t, n;a.get.total() ? (n = (t = a.get.value()) - (e = e || 1), a.debug("Decrementing value by", e, t)) : (n = (t = a.get.percent()) - (e = e || a.get.randomValue()), a.debug("Decrementing percentage by", e, t)), n = a.get.normalizedValue(n), a.set.progress(n);
  10259. }, has: { progressPoll: function progressPoll() {
  10260. return a.progressPoll;
  10261. }, total: function total() {
  10262. return !1 !== a.get.total();
  10263. } }, get: { text: function text(e) {
  10264. var t = a.value || 0,
  10265. n = a.total || 0,
  10266. i = A ? a.get.displayPercent() : a.percent || 0,
  10267. o = a.total > 0 ? n - t : 100 - i;return e = (e = e || "").replace("{value}", t).replace("{total}", n).replace("{left}", o).replace("{percent}", i), a.verbose("Adding variables to progress bar text", e), e;
  10268. }, normalizedValue: function normalizedValue(e) {
  10269. if (e < 0) return a.debug("Value cannot decrement below 0"), 0;if (a.has.total()) {
  10270. if (e > a.total) return a.debug("Value cannot increment above total", a.total), a.total;
  10271. } else if (e > 100) return a.debug("Value cannot increment above 100 percent"), 100;return e;
  10272. }, updateInterval: function updateInterval() {
  10273. return "auto" == f.updateInterval ? f.duration : f.updateInterval;
  10274. }, randomValue: function randomValue() {
  10275. return a.debug("Generating random increment percentage"), Math.floor(Math.random() * f.random.max + f.random.min);
  10276. }, numericValue: function numericValue(e) {
  10277. return "string" == typeof e ? "" !== e.replace(/[^\d.]/g, "") && +e.replace(/[^\d.]/g, "") : e;
  10278. }, transitionEnd: function transitionEnd() {
  10279. var e,
  10280. t = n.createElement("element"),
  10281. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  10282. if (t.style[e] !== i) return o[e];
  10283. }
  10284. }, displayPercent: function displayPercent() {
  10285. var e = C.width(),
  10286. t = x.width(),
  10287. n = e > parseInt(C.css("min-width"), 10) ? e / t * 100 : a.percent;return f.precision > 0 ? Math.round(n * (10 * f.precision)) / (10 * f.precision) : Math.round(n);
  10288. }, percent: function percent() {
  10289. return a.percent || 0;
  10290. }, value: function value() {
  10291. return a.nextValue || a.value || 0;
  10292. }, total: function total() {
  10293. return a.total || !1;
  10294. } }, create: { progressPoll: function progressPoll() {
  10295. a.progressPoll = setTimeout(function () {
  10296. a.update.toNextValue(), a.remove.progressPoll();
  10297. }, a.get.updateInterval());
  10298. } }, is: { complete: function complete() {
  10299. return a.is.success() || a.is.warning() || a.is.error();
  10300. }, success: function success() {
  10301. return x.hasClass(m.success);
  10302. }, warning: function warning() {
  10303. return x.hasClass(m.warning);
  10304. }, error: function error() {
  10305. return x.hasClass(m.error);
  10306. }, active: function active() {
  10307. return x.hasClass(m.active);
  10308. }, visible: function visible() {
  10309. return x.is(":visible");
  10310. } }, remove: { progressPoll: function progressPoll() {
  10311. a.verbose("Removing progress poll timer"), a.progressPoll && (clearTimeout(a.progressPoll), delete a.progressPoll);
  10312. }, nextValue: function nextValue() {
  10313. a.verbose("Removing progress value stored for next update"), delete a.nextValue;
  10314. }, state: function state() {
  10315. a.verbose("Removing stored state"), delete a.total, delete a.percent, delete a.value;
  10316. }, active: function active() {
  10317. a.verbose("Removing active state"), x.removeClass(m.active);
  10318. }, success: function success() {
  10319. a.verbose("Removing success state"), x.removeClass(m.success);
  10320. }, warning: function warning() {
  10321. a.verbose("Removing warning state"), x.removeClass(m.warning);
  10322. }, error: function error() {
  10323. a.verbose("Removing error state"), x.removeClass(m.error);
  10324. } }, set: { barWidth: function barWidth(e) {
  10325. e > 100 ? a.error(v.tooHigh, e) : e < 0 ? a.error(v.tooLow, e) : (C.css("width", e + "%"), x.attr("data-percent", parseInt(e, 10)));
  10326. }, duration: function duration(e) {
  10327. e = "number" == typeof (e = e || f.duration) ? e + "ms" : e, a.verbose("Setting progress bar transition duration", e), C.css({ "transition-duration": e });
  10328. }, percent: function percent(e) {
  10329. e = "string" == typeof e ? +e.replace("%", "") : e, e = f.precision > 0 ? Math.round(e * (10 * f.precision)) / (10 * f.precision) : Math.round(e), a.percent = e, a.has.total() || (a.value = f.precision > 0 ? Math.round(e / 100 * a.total * (10 * f.precision)) / (10 * f.precision) : Math.round(e / 100 * a.total * 10) / 10, f.limitValues && (a.value = a.value > 100 ? 100 : a.value < 0 ? 0 : a.value)), a.set.barWidth(e), a.set.labelInterval(), a.set.labels(), f.onChange.call(k, e, a.value, a.total);
  10330. }, labelInterval: function labelInterval() {
  10331. clearInterval(a.interval), a.bind.transitionEnd(function () {
  10332. a.verbose("Bar finished animating, removing continuous label updates"), clearInterval(a.interval), A = !1, a.set.labels();
  10333. }), A = !0, a.interval = setInterval(function () {
  10334. e.contains(n.documentElement, k) || (clearInterval(a.interval), A = !1), a.set.labels();
  10335. }, f.framerate);
  10336. }, labels: function labels() {
  10337. a.verbose("Setting both bar progress and outer label text"), a.set.barLabel(), a.set.state();
  10338. }, label: function label(e) {
  10339. (e = e || "") && (e = a.get.text(e), a.verbose("Setting label to text", e), S.text(e));
  10340. }, state: function state(e) {
  10341. 100 === (e = e !== i ? e : a.percent) ? f.autoSuccess && !(a.is.warning() || a.is.error() || a.is.success()) ? (a.set.success(), a.debug("Automatically triggering success at 100%")) : (a.verbose("Reached 100% removing active state"), a.remove.active(), a.remove.progressPoll()) : e > 0 ? (a.verbose("Adjusting active progress bar label", e), a.set.active()) : (a.remove.active(), a.set.label(f.text.active));
  10342. }, barLabel: function barLabel(e) {
  10343. e !== i ? w.text(a.get.text(e)) : "ratio" == f.label && a.total ? (a.verbose("Adding ratio to bar label"), w.text(a.get.text(f.text.ratio))) : "percent" == f.label && (a.verbose("Adding percentage to bar label"), w.text(a.get.text(f.text.percent)));
  10344. }, active: function active(e) {
  10345. e = e || f.text.active, a.debug("Setting active state"), f.showActivity && !a.is.active() && x.addClass(m.active), a.remove.warning(), a.remove.error(), a.remove.success(), (e = f.onLabelUpdate("active", e, a.value, a.total)) && a.set.label(e), a.bind.transitionEnd(function () {
  10346. f.onActive.call(k, a.value, a.total);
  10347. });
  10348. }, success: function success(e) {
  10349. e = e || f.text.success || f.text.active, a.debug("Setting success state"), x.addClass(m.success), a.remove.active(), a.remove.warning(), a.remove.error(), a.complete(), f.text.success ? (e = f.onLabelUpdate("success", e, a.value, a.total), a.set.label(e)) : (e = f.onLabelUpdate("active", e, a.value, a.total), a.set.label(e)), a.bind.transitionEnd(function () {
  10350. f.onSuccess.call(k, a.total);
  10351. });
  10352. }, warning: function warning(e) {
  10353. e = e || f.text.warning, a.debug("Setting warning state"), x.addClass(m.warning), a.remove.active(), a.remove.success(), a.remove.error(), a.complete(), (e = f.onLabelUpdate("warning", e, a.value, a.total)) && a.set.label(e), a.bind.transitionEnd(function () {
  10354. f.onWarning.call(k, a.value, a.total);
  10355. });
  10356. }, error: function error(e) {
  10357. e = e || f.text.error, a.debug("Setting error state"), x.addClass(m.error), a.remove.active(), a.remove.success(), a.remove.warning(), a.complete(), (e = f.onLabelUpdate("error", e, a.value, a.total)) && a.set.label(e), a.bind.transitionEnd(function () {
  10358. f.onError.call(k, a.value, a.total);
  10359. });
  10360. }, transitionEvent: function transitionEvent() {
  10361. a.get.transitionEnd();
  10362. }, total: function total(e) {
  10363. a.total = e;
  10364. }, value: function value(e) {
  10365. a.value = e;
  10366. }, progress: function progress(e) {
  10367. a.has.progressPoll() ? (a.debug("Updated within interval, setting next update to use new value", e), a.set.nextValue(e)) : (a.debug("First update in progress update interval, immediately updating", e), a.update.progress(e), a.create.progressPoll());
  10368. }, nextValue: function nextValue(e) {
  10369. a.nextValue = e;
  10370. } }, update: { toNextValue: function toNextValue() {
  10371. var e = a.nextValue;e && (a.debug("Update interval complete using last updated value", e), a.update.progress(e), a.remove.nextValue());
  10372. }, progress: function progress(e) {
  10373. var t;!1 === (e = a.get.numericValue(e)) && a.error(v.nonNumeric, e), e = a.get.normalizedValue(e), a.has.total() ? (a.set.value(e), t = e / a.total * 100, a.debug("Calculating percent complete from total", t), a.set.percent(t)) : (t = e, a.debug("Setting value to exact percentage value", t), a.set.percent(t));
  10374. } }, setting: function setting(t, n) {
  10375. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  10376. if (n === i) return f[t];e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  10377. }
  10378. }, internal: function internal(t, n) {
  10379. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  10380. if (n === i) return a[t];a[t] = n;
  10381. }
  10382. }, debug: function debug() {
  10383. !f.silent && f.debug && (f.performance ? a.performance.log(arguments) : (a.debug = Function.prototype.bind.call(console.info, console, f.name + ":"), a.debug.apply(console, arguments)));
  10384. }, verbose: function verbose() {
  10385. !f.silent && f.verbose && f.debug && (f.performance ? a.performance.log(arguments) : (a.verbose = Function.prototype.bind.call(console.info, console, f.name + ":"), a.verbose.apply(console, arguments)));
  10386. }, error: function error() {
  10387. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  10388. }, performance: { log: function log(e) {
  10389. var t, n;f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: k, "Execution Time": n })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500);
  10390. }, display: function display() {
  10391. var t = f.name + ":",
  10392. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  10393. n += t["Execution Time"];
  10394. }), t += " " + n + "ms", r && (t += " '" + r + "'"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  10395. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10396. }), console.groupEnd()), l = [];
  10397. } }, invoke: function invoke(t, n, r) {
  10398. var s,
  10399. l,
  10400. c,
  10401. u = T;return n = n || d, r = k || r, "string" == typeof t && u !== i && (t = t.split(/[\. ]/), s = t.length - 1, e.each(t, function (n, o) {
  10402. var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(u[r]) && n != s) u = u[r];else {
  10403. if (u[r] !== i) return l = u[r], !1;if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(v.method, t), !1);u = u[o];
  10404. }
  10405. })), e.isFunction(l) ? c = l.apply(r, n) : l !== i && (c = l), e.isArray(o) ? o.push(c) : o !== i ? o = [o, c] : c !== i && (o = c), l;
  10406. } }, u ? (T === i && a.initialize(), a.invoke(c)) : (T !== i && T.invoke("destroy"), a.initialize());
  10407. }), o !== i ? o : this;
  10408. }, e.fn.progress.settings = { name: "Progress", namespace: "progress", silent: !1, debug: !1, verbose: !1, performance: !0, random: { min: 2, max: 5 }, duration: 300, updateInterval: "auto", autoSuccess: !0, showActivity: !0, limitValues: !0, label: "percent", precision: 0, framerate: 1e3 / 30, percent: !1, total: !1, value: !1, failSafeDelay: 100, onLabelUpdate: function onLabelUpdate(e, t, n, i) {
  10409. return t;
  10410. }, onChange: function onChange(e, t, n) {}, onSuccess: function onSuccess(e) {}, onActive: function onActive(e, t) {}, onError: function onError(e, t) {}, onWarning: function onWarning(e, t) {}, error: { method: "The method you called is not defined.", nonNumeric: "Progress value is non numeric", tooHigh: "Value specified is above 100%", tooLow: "Value specified is below 0%" }, regExp: { variable: /\{\$*[A-z0-9]+\}/g }, metadata: { percent: "percent", total: "total", value: "value" }, selector: { bar: "> .bar", label: "> .label", progress: ".bar > .progress" }, text: { active: !1, error: !1, success: !1, warning: !1, percent: "{percent}%", ratio: "{value} of {total}" }, className: { active: "active", error: "error", success: "success", warning: "warning" } };
  10411. }(jQuery, window, document), function (e, t, n, i) {
  10412. "use strict";
  10413. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.rating = function (t) {
  10414. var n,
  10415. o = e(this),
  10416. a = o.selector || "",
  10417. r = new Date().getTime(),
  10418. s = [],
  10419. l = arguments[0],
  10420. c = "string" == typeof l,
  10421. u = [].slice.call(arguments, 1);return o.each(function () {
  10422. var d,
  10423. f,
  10424. m = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.rating.settings, t) : e.extend({}, e.fn.rating.settings),
  10425. g = m.namespace,
  10426. p = m.className,
  10427. h = m.metadata,
  10428. v = m.selector,
  10429. b = (m.error, "." + g),
  10430. y = "module-" + g,
  10431. x = this,
  10432. C = e(this).data(y),
  10433. w = e(this),
  10434. S = w.find(v.icon);f = { initialize: function initialize() {
  10435. f.verbose("Initializing rating module", m), 0 === S.length && f.setup.layout(), m.interactive ? f.enable() : f.disable(), f.set.initialLoad(), f.set.rating(f.get.initialRating()), f.remove.initialLoad(), f.instantiate();
  10436. }, instantiate: function instantiate() {
  10437. f.verbose("Instantiating module", m), C = f, w.data(y, f);
  10438. }, destroy: function destroy() {
  10439. f.verbose("Destroying previous instance", C), f.remove.events(), w.removeData(y);
  10440. }, refresh: function refresh() {
  10441. S = w.find(v.icon);
  10442. }, setup: { layout: function layout() {
  10443. var t = f.get.maxRating(),
  10444. n = e.fn.rating.settings.templates.icon(t);f.debug("Generating icon html dynamically"), w.html(n), f.refresh();
  10445. } }, event: { mouseenter: function mouseenter() {
  10446. var t = e(this);t.nextAll().removeClass(p.selected), w.addClass(p.selected), t.addClass(p.selected).prevAll().addClass(p.selected);
  10447. }, mouseleave: function mouseleave() {
  10448. w.removeClass(p.selected), S.removeClass(p.selected);
  10449. }, click: function click() {
  10450. var t = e(this),
  10451. n = f.get.rating(),
  10452. i = S.index(t) + 1;("auto" == m.clearable ? 1 === S.length : m.clearable) && n == i ? f.clearRating() : f.set.rating(i);
  10453. } }, clearRating: function clearRating() {
  10454. f.debug("Clearing current rating"), f.set.rating(0);
  10455. }, bind: { events: function events() {
  10456. f.verbose("Binding events"), w.on("mouseenter" + b, v.icon, f.event.mouseenter).on("mouseleave" + b, v.icon, f.event.mouseleave).on("click" + b, v.icon, f.event.click);
  10457. } }, remove: { events: function events() {
  10458. f.verbose("Removing events"), w.off(b);
  10459. }, initialLoad: function initialLoad() {
  10460. d = !1;
  10461. } }, enable: function enable() {
  10462. f.debug("Setting rating to interactive mode"), f.bind.events(), w.removeClass(p.disabled);
  10463. }, disable: function disable() {
  10464. f.debug("Setting rating to read-only mode"), f.remove.events(), w.addClass(p.disabled);
  10465. }, is: { initialLoad: function initialLoad() {
  10466. return d;
  10467. } }, get: { initialRating: function initialRating() {
  10468. return w.data(h.rating) !== i ? (w.removeData(h.rating), w.data(h.rating)) : m.initialRating;
  10469. }, maxRating: function maxRating() {
  10470. return w.data(h.maxRating) !== i ? (w.removeData(h.maxRating), w.data(h.maxRating)) : m.maxRating;
  10471. }, rating: function rating() {
  10472. var e = S.filter("." + p.active).length;return f.verbose("Current rating retrieved", e), e;
  10473. } }, set: { rating: function rating(e) {
  10474. var t = e - 1 >= 0 ? e - 1 : 0,
  10475. n = S.eq(t);w.removeClass(p.selected), S.removeClass(p.selected).removeClass(p.active), e > 0 && (f.verbose("Setting current rating to", e), n.prevAll().addBack().addClass(p.active)), f.is.initialLoad() || m.onRate.call(x, e);
  10476. }, initialLoad: function initialLoad() {
  10477. d = !0;
  10478. } }, setting: function setting(t, n) {
  10479. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  10480. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  10481. }
  10482. }, internal: function internal(t, n) {
  10483. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  10484. if (n === i) return f[t];f[t] = n;
  10485. }
  10486. }, debug: function debug() {
  10487. !m.silent && m.debug && (m.performance ? f.performance.log(arguments) : (f.debug = Function.prototype.bind.call(console.info, console, m.name + ":"), f.debug.apply(console, arguments)));
  10488. }, verbose: function verbose() {
  10489. !m.silent && m.verbose && m.debug && (m.performance ? f.performance.log(arguments) : (f.verbose = Function.prototype.bind.call(console.info, console, m.name + ":"), f.verbose.apply(console, arguments)));
  10490. }, error: function error() {
  10491. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  10492. }, performance: { log: function log(e) {
  10493. var t, n;m.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: x, "Execution Time": n })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500);
  10494. }, display: function display() {
  10495. var t = m.name + ":",
  10496. n = 0;r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  10497. n += t["Execution Time"];
  10498. }), t += " " + n + "ms", a && (t += " '" + a + "'"), o.length > 1 && (t += " (" + o.length + ")"), (console.group !== i || console.table !== i) && s.length > 0 && (console.groupCollapsed(t), console.table ? console.table(s) : e.each(s, function (e, t) {
  10499. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10500. }), console.groupEnd()), s = [];
  10501. } }, invoke: function invoke(t, o, a) {
  10502. var r,
  10503. s,
  10504. l,
  10505. c = C;return o = o || u, a = x || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  10506. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  10507. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  10508. }
  10509. })), e.isFunction(s) ? l = s.apply(a, o) : s !== i && (l = s), e.isArray(n) ? n.push(l) : n !== i ? n = [n, l] : l !== i && (n = l), s;
  10510. } }, c ? (C === i && f.initialize(), f.invoke(l)) : (C !== i && C.invoke("destroy"), f.initialize());
  10511. }), n !== i ? n : this;
  10512. }, e.fn.rating.settings = { name: "Rating", namespace: "rating", slent: !1, debug: !1, verbose: !1, performance: !0, initialRating: 0, interactive: !0, maxRating: 4, clearable: "auto", fireOnInit: !1, onRate: function onRate(e) {}, error: { method: "The method you called is not defined", noMaximum: "No maximum rating specified. Cannot generate HTML automatically" }, metadata: { rating: "rating", maxRating: "maxRating" }, className: { active: "active", disabled: "disabled", selected: "selected", loading: "loading" }, selector: { icon: ".icon" }, templates: { icon: function icon(e) {
  10513. for (var t = 1, n = ""; t <= e;) {
  10514. n += '<i class="icon"></i>', t++;
  10515. }return n;
  10516. } } };
  10517. }(jQuery, window, document), function (e, t, n, i) {
  10518. "use strict";
  10519. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.search = function (o) {
  10520. var a,
  10521. r = e(this),
  10522. s = r.selector || "",
  10523. l = new Date().getTime(),
  10524. c = [],
  10525. u = arguments[0],
  10526. d = "string" == typeof u,
  10527. f = [].slice.call(arguments, 1);return e(this).each(function () {
  10528. var m,
  10529. g = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.search.settings, o) : e.extend({}, e.fn.search.settings),
  10530. p = g.className,
  10531. h = g.metadata,
  10532. v = g.regExp,
  10533. b = g.fields,
  10534. y = g.selector,
  10535. x = g.error,
  10536. C = g.namespace,
  10537. w = "." + C,
  10538. S = C + "-module",
  10539. k = e(this),
  10540. T = k.find(y.prompt),
  10541. A = k.find(y.searchButton),
  10542. R = k.find(y.results),
  10543. P = k.find(y.result),
  10544. E = (k.find(y.category), this),
  10545. F = k.data(S),
  10546. O = !1,
  10547. D = !1;m = { initialize: function initialize() {
  10548. m.verbose("Initializing module"), m.get.settings(), m.determine.searchFields(), m.bind.events(), m.set.type(), m.create.results(), m.instantiate();
  10549. }, instantiate: function instantiate() {
  10550. m.verbose("Storing instance of module", m), F = m, k.data(S, m);
  10551. }, destroy: function destroy() {
  10552. m.verbose("Destroying instance"), k.off(w).removeData(S);
  10553. }, refresh: function refresh() {
  10554. m.debug("Refreshing selector cache"), T = k.find(y.prompt), A = k.find(y.searchButton), k.find(y.category), R = k.find(y.results), P = k.find(y.result);
  10555. }, refreshResults: function refreshResults() {
  10556. R = k.find(y.results), P = k.find(y.result);
  10557. }, bind: { events: function events() {
  10558. m.verbose("Binding events to search"), g.automatic && (k.on(m.get.inputEvent() + w, y.prompt, m.event.input), T.attr("autocomplete", "off")), k.on("focus" + w, y.prompt, m.event.focus).on("blur" + w, y.prompt, m.event.blur).on("keydown" + w, y.prompt, m.handleKeyboard).on("click" + w, y.searchButton, m.query).on("mousedown" + w, y.results, m.event.result.mousedown).on("mouseup" + w, y.results, m.event.result.mouseup).on("click" + w, y.result, m.event.result.click);
  10559. } }, determine: { searchFields: function searchFields() {
  10560. o && o.searchFields !== i && (g.searchFields = o.searchFields);
  10561. } }, event: { input: function input() {
  10562. g.searchDelay ? (clearTimeout(m.timer), m.timer = setTimeout(function () {
  10563. m.is.focused() && m.query();
  10564. }, g.searchDelay)) : m.query();
  10565. }, focus: function focus() {
  10566. m.set.focus(), g.searchOnFocus && m.has.minimumCharacters() && m.query(function () {
  10567. m.can.show() && m.showResults();
  10568. });
  10569. }, blur: function blur(e) {
  10570. var t = function t() {
  10571. m.cancel.query(), m.remove.focus(), m.timer = setTimeout(m.hideResults, g.hideDelay);
  10572. };n.activeElement === this || (D = !1, m.resultsClicked ? (m.debug("Determining if user action caused search to close"), k.one("click.close" + w, y.results, function (e) {
  10573. m.is.inMessage(e) || O ? T.focus() : (O = !1, m.is.animating() || m.is.hidden() || t());
  10574. })) : (m.debug("Input blurred without user action, closing results"), t()));
  10575. }, result: { mousedown: function mousedown() {
  10576. m.resultsClicked = !0;
  10577. }, mouseup: function mouseup() {
  10578. m.resultsClicked = !1;
  10579. }, click: function click(n) {
  10580. m.debug("Search result selected");var i = e(this),
  10581. o = i.find(y.title).eq(0),
  10582. a = i.is("a[href]") ? i : i.find("a[href]").eq(0),
  10583. r = a.attr("href") || !1,
  10584. s = a.attr("target") || !1,
  10585. l = (o.html(), o.length > 0 && o.text()),
  10586. c = m.get.results(),
  10587. u = i.data(h.result) || m.get.result(l, c);if (e.isFunction(g.onSelect) && !1 === g.onSelect.call(E, u, c)) return m.debug("Custom onSelect callback cancelled default select action"), void (O = !0);m.hideResults(), l && m.set.value(l), r && (m.verbose("Opening search link found in result", a), "_blank" == s || n.ctrlKey ? t.open(r) : t.location.href = r);
  10588. } } }, handleKeyboard: function handleKeyboard(e) {
  10589. var t,
  10590. n = k.find(y.result),
  10591. i = k.find(y.category),
  10592. o = n.filter("." + p.active),
  10593. a = n.index(o),
  10594. r = n.length,
  10595. s = o.length > 0,
  10596. l = e.which,
  10597. c = 13,
  10598. u = 38,
  10599. d = 40;if (l == 27 && (m.verbose("Escape key pressed, blurring search field"), m.hideResults(), D = !0), m.is.visible()) {
  10600. if (l == c) {
  10601. if (m.verbose("Enter key pressed, selecting active result"), n.filter("." + p.active).length > 0) return m.event.result.click.call(n.filter("." + p.active), e), e.preventDefault(), !1;
  10602. } else l == u && s ? (m.verbose("Up key pressed, changing active result"), t = a - 1 < 0 ? a : a - 1, i.removeClass(p.active), n.removeClass(p.active).eq(t).addClass(p.active).closest(i).addClass(p.active), e.preventDefault()) : l == d && (m.verbose("Down key pressed, changing active result"), t = a + 1 >= r ? a : a + 1, i.removeClass(p.active), n.removeClass(p.active).eq(t).addClass(p.active).closest(i).addClass(p.active), e.preventDefault());
  10603. } else l == c && (m.verbose("Enter key pressed, executing query"), m.query(), m.set.buttonPressed(), T.one("keyup", m.remove.buttonFocus));
  10604. }, setup: { api: function api(t, n) {
  10605. var i = { debug: g.debug, on: !1, cache: g.cache, action: "search", urlData: { query: t }, onSuccess: function onSuccess(e) {
  10606. m.parse.response.call(E, e, t), n();
  10607. }, onFailure: function onFailure() {
  10608. m.displayMessage(x.serverError), n();
  10609. }, onAbort: function onAbort(e) {}, onError: m.error };e.extend(!0, i, g.apiSettings), m.verbose("Setting up API request", i), k.api(i);
  10610. } }, can: { useAPI: function useAPI() {
  10611. return e.fn.api !== i;
  10612. }, show: function show() {
  10613. return m.is.focused() && !m.is.visible() && !m.is.empty();
  10614. }, transition: function transition() {
  10615. return g.transition && e.fn.transition !== i && k.transition("is supported");
  10616. } }, is: { animating: function animating() {
  10617. return R.hasClass(p.animating);
  10618. }, hidden: function hidden() {
  10619. return R.hasClass(p.hidden);
  10620. }, inMessage: function inMessage(t) {
  10621. if (t.target) {
  10622. var i = e(t.target);return e.contains(n.documentElement, t.target) && i.closest(y.message).length > 0;
  10623. }
  10624. }, empty: function empty() {
  10625. return "" === R.html();
  10626. }, visible: function visible() {
  10627. return R.filter(":visible").length > 0;
  10628. }, focused: function focused() {
  10629. return T.filter(":focus").length > 0;
  10630. } }, get: { settings: function settings() {
  10631. e.isPlainObject(o) && o.searchFullText && (g.fullTextSearch = o.searchFullText, m.error(g.error.oldSearchSyntax, E));
  10632. }, inputEvent: function inputEvent() {
  10633. var e = T[0];return e !== i && e.oninput !== i ? "input" : e !== i && e.onpropertychange !== i ? "propertychange" : "keyup";
  10634. }, value: function value() {
  10635. return T.val();
  10636. }, results: function results() {
  10637. return k.data(h.results);
  10638. }, result: function result(t, n) {
  10639. var o = ["title", "id"],
  10640. a = !1;return t = t !== i ? t : m.get.value(), n = n !== i ? n : m.get.results(), "category" === g.type ? (m.debug("Finding result that matches", t), e.each(n, function (n, i) {
  10641. if (e.isArray(i.results) && (a = m.search.object(t, i.results, o)[0])) return !1;
  10642. })) : (m.debug("Finding result in results object", t), a = m.search.object(t, n, o)[0]), a || !1;
  10643. } }, select: { firstResult: function firstResult() {
  10644. m.verbose("Selecting first result"), P.first().addClass(p.active);
  10645. } }, set: { focus: function focus() {
  10646. k.addClass(p.focus);
  10647. }, loading: function loading() {
  10648. k.addClass(p.loading);
  10649. }, value: function value(e) {
  10650. m.verbose("Setting search input value", e), T.val(e);
  10651. }, type: function type(e) {
  10652. e = e || g.type, "category" == g.type && k.addClass(g.type);
  10653. }, buttonPressed: function buttonPressed() {
  10654. A.addClass(p.pressed);
  10655. } }, remove: { loading: function loading() {
  10656. k.removeClass(p.loading);
  10657. }, focus: function focus() {
  10658. k.removeClass(p.focus);
  10659. }, buttonPressed: function buttonPressed() {
  10660. A.removeClass(p.pressed);
  10661. } }, query: function query(t) {
  10662. t = e.isFunction(t) ? t : function () {};var n = m.get.value(),
  10663. i = m.read.cache(n);t = t || function () {}, m.has.minimumCharacters() ? (i ? (m.debug("Reading result from cache", n), m.save.results(i.results), m.addResults(i.html), m.inject.id(i.results), t()) : (m.debug("Querying for", n), e.isPlainObject(g.source) || e.isArray(g.source) ? (m.search.local(n), t()) : m.can.useAPI() ? m.search.remote(n, t) : (m.error(x.source), t())), g.onSearchQuery.call(E, n)) : m.hideResults();
  10664. }, search: { local: function local(e) {
  10665. var t,
  10666. n = m.search.object(e, g.content);m.set.loading(), m.save.results(n), m.debug("Returned full local search results", n), g.maxResults > 0 && (m.debug("Using specified max results", n), n = n.slice(0, g.maxResults)), "category" == g.type && (n = m.create.categoryResults(n)), t = m.generateResults({ results: n }), m.remove.loading(), m.addResults(t), m.inject.id(n), m.write.cache(e, { html: t, results: n });
  10667. }, remote: function remote(t, n) {
  10668. n = e.isFunction(n) ? n : function () {}, k.api("is loading") && k.api("abort"), m.setup.api(t, n), k.api("query");
  10669. }, object: function object(t, n, o) {
  10670. var a = [],
  10671. r = [],
  10672. s = [],
  10673. l = t.toString().replace(v.escape, "\\$&"),
  10674. c = new RegExp(v.beginsWith + l, "i"),
  10675. u = function u(t, n) {
  10676. var i = -1 == e.inArray(n, a),
  10677. o = -1 == e.inArray(n, s),
  10678. l = -1 == e.inArray(n, r);i && o && l && t.push(n);
  10679. };return n = n || g.source, o = o !== i ? o : g.searchFields, e.isArray(o) || (o = [o]), n === i || !1 === n ? (m.error(x.source), []) : (e.each(o, function (i, o) {
  10680. e.each(n, function (e, n) {
  10681. "string" == typeof n[o] && (-1 !== n[o].search(c) ? u(a, n) : "exact" === g.fullTextSearch && m.exactSearch(t, n[o]) ? u(r, n) : 1 == g.fullTextSearch && m.fuzzySearch(t, n[o]) && u(s, n));
  10682. });
  10683. }), e.merge(r, s), e.merge(a, r), a);
  10684. } }, exactSearch: function exactSearch(e, t) {
  10685. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  10686. }, fuzzySearch: function fuzzySearch(e, t) {
  10687. var n = t.length,
  10688. i = e.length;if ("string" != typeof e) return !1;if (e = e.toLowerCase(), t = t.toLowerCase(), i > n) return !1;if (i === n) return e === t;e: for (var o = 0, a = 0; o < i; o++) {
  10689. for (var r = e.charCodeAt(o); a < n;) {
  10690. if (t.charCodeAt(a++) === r) continue e;
  10691. }return !1;
  10692. }return !0;
  10693. }, parse: { response: function response(e, t) {
  10694. var n = m.generateResults(e);m.verbose("Parsing server response", e), e !== i && t !== i && e[b.results] !== i && (m.addResults(n), m.inject.id(e[b.results]), m.write.cache(t, { html: n, results: e[b.results] }), m.save.results(e[b.results]));
  10695. } }, cancel: { query: function query() {
  10696. m.can.useAPI() && k.api("abort");
  10697. } }, has: { minimumCharacters: function minimumCharacters() {
  10698. return m.get.value().length >= g.minCharacters;
  10699. }, results: function results() {
  10700. return 0 !== R.length && "" != R.html();
  10701. } }, clear: { cache: function cache(e) {
  10702. var t = k.data(h.cache);e ? e && t && t[e] && (m.debug("Removing value from cache", e), delete t[e], k.data(h.cache, t)) : (m.debug("Clearing cache", e), k.removeData(h.cache));
  10703. } }, read: { cache: function cache(e) {
  10704. var t = k.data(h.cache);return !!g.cache && (m.verbose("Checking cache for generated html for query", e), "object" == (typeof t === "undefined" ? "undefined" : _typeof(t)) && t[e] !== i && t[e]);
  10705. } }, create: { categoryResults: function categoryResults(t) {
  10706. var n = {};return e.each(t, function (e, t) {
  10707. t.category && (n[t.category] === i ? (m.verbose("Creating new category of results", t.category), n[t.category] = { name: t.category, results: [t] }) : n[t.category].results.push(t));
  10708. }), n;
  10709. }, id: function id(e, t) {
  10710. var n,
  10711. o = e + 1;return t !== i ? (n = String.fromCharCode(97 + t) + o, m.verbose("Creating category result id", n)) : (n = o, m.verbose("Creating result id", n)), n;
  10712. }, results: function results() {
  10713. 0 === R.length && (R = e("<div />").addClass(p.results).appendTo(k));
  10714. } }, inject: { result: function result(e, t, n) {
  10715. m.verbose("Injecting result into results");var o = n !== i ? R.children().eq(n).children(y.results).first().children(y.result).eq(t) : R.children(y.result).eq(t);m.verbose("Injecting results metadata", o), o.data(h.result, e);
  10716. }, id: function id(t) {
  10717. m.debug("Injecting unique ids into results");var n = 0,
  10718. o = 0;return "category" === g.type ? e.each(t, function (t, a) {
  10719. o = 0, e.each(a.results, function (e, t) {
  10720. var r = a.results[e];r.id === i && (r.id = m.create.id(o, n)), m.inject.result(r, o, n), o++;
  10721. }), n++;
  10722. }) : e.each(t, function (e, n) {
  10723. var a = t[e];a.id === i && (a.id = m.create.id(o)), m.inject.result(a, o), o++;
  10724. }), t;
  10725. } }, save: { results: function results(e) {
  10726. m.verbose("Saving current search results to metadata", e), k.data(h.results, e);
  10727. } }, write: { cache: function cache(e, t) {
  10728. var n = k.data(h.cache) !== i ? k.data(h.cache) : {};g.cache && (m.verbose("Writing generated html to cache", e, t), n[e] = t, k.data(h.cache, n));
  10729. } }, addResults: function addResults(t) {
  10730. if (e.isFunction(g.onResultsAdd) && !1 === g.onResultsAdd.call(R, t)) return m.debug("onResultsAdd callback cancelled default action"), !1;t ? (R.html(t), m.refreshResults(), g.selectFirstResult && m.select.firstResult(), m.showResults()) : m.hideResults(function () {
  10731. R.empty();
  10732. });
  10733. }, showResults: function showResults(t) {
  10734. t = e.isFunction(t) ? t : function () {}, D || !m.is.visible() && m.has.results() && (m.can.transition() ? (m.debug("Showing results with css animations"), R.transition({ animation: g.transition + " in", debug: g.debug, verbose: g.verbose, duration: g.duration, onComplete: function onComplete() {
  10735. t();
  10736. }, queue: !0 })) : (m.debug("Showing results with javascript"), R.stop().fadeIn(g.duration, g.easing)), g.onResultsOpen.call(R));
  10737. }, hideResults: function hideResults(t) {
  10738. t = e.isFunction(t) ? t : function () {}, m.is.visible() && (m.can.transition() ? (m.debug("Hiding results with css animations"), R.transition({ animation: g.transition + " out", debug: g.debug, verbose: g.verbose, duration: g.duration, onComplete: function onComplete() {
  10739. t();
  10740. }, queue: !0 })) : (m.debug("Hiding results with javascript"), R.stop().fadeOut(g.duration, g.easing)), g.onResultsClose.call(R));
  10741. }, generateResults: function generateResults(t) {
  10742. m.debug("Generating html from response", t);var n = g.templates[g.type],
  10743. i = e.isPlainObject(t[b.results]) && !e.isEmptyObject(t[b.results]),
  10744. o = e.isArray(t[b.results]) && t[b.results].length > 0,
  10745. a = "";return i || o ? (g.maxResults > 0 && (i ? "standard" == g.type && m.error(x.maxResults) : t[b.results] = t[b.results].slice(0, g.maxResults)), e.isFunction(n) ? a = n(t, b) : m.error(x.noTemplate, !1)) : g.showNoResults && (a = m.displayMessage(x.noResults, "empty")), g.onResults.call(E, t), a;
  10746. }, displayMessage: function displayMessage(e, t) {
  10747. return t = t || "standard", m.debug("Displaying message", e, t), m.addResults(g.templates.message(e, t)), g.templates.message(e, t);
  10748. }, setting: function setting(t, n) {
  10749. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  10750. if (n === i) return g[t];g[t] = n;
  10751. }
  10752. }, internal: function internal(t, n) {
  10753. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  10754. if (n === i) return m[t];m[t] = n;
  10755. }
  10756. }, debug: function debug() {
  10757. !g.silent && g.debug && (g.performance ? m.performance.log(arguments) : (m.debug = Function.prototype.bind.call(console.info, console, g.name + ":"), m.debug.apply(console, arguments)));
  10758. }, verbose: function verbose() {
  10759. !g.silent && g.verbose && g.debug && (g.performance ? m.performance.log(arguments) : (m.verbose = Function.prototype.bind.call(console.info, console, g.name + ":"), m.verbose.apply(console, arguments)));
  10760. }, error: function error() {
  10761. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  10762. }, performance: { log: function log(e) {
  10763. var t, n;g.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: E, "Execution Time": n })), clearTimeout(m.performance.timer), m.performance.timer = setTimeout(m.performance.display, 500);
  10764. }, display: function display() {
  10765. var t = g.name + ":",
  10766. n = 0;l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  10767. n += t["Execution Time"];
  10768. }), t += " " + n + "ms", s && (t += " '" + s + "'"), r.length > 1 && (t += " (" + r.length + ")"), (console.group !== i || console.table !== i) && c.length > 0 && (console.groupCollapsed(t), console.table ? console.table(c) : e.each(c, function (e, t) {
  10769. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10770. }), console.groupEnd()), c = [];
  10771. } }, invoke: function invoke(t, n, o) {
  10772. var r,
  10773. s,
  10774. l,
  10775. c = F;return n = n || f, o = E || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  10776. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  10777. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  10778. }
  10779. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  10780. } }, d ? (F === i && m.initialize(), m.invoke(u)) : (F !== i && F.invoke("destroy"), m.initialize());
  10781. }), a !== i ? a : this;
  10782. }, e.fn.search.settings = { name: "Search", namespace: "search", silent: !1, debug: !1, verbose: !1, performance: !0, type: "standard", minCharacters: 1, selectFirstResult: !1, apiSettings: !1, source: !1, searchOnFocus: !0, searchFields: ["title", "description"], displayField: "", fullTextSearch: "exact", automatic: !0, hideDelay: 0, searchDelay: 200, maxResults: 7, cache: !0, showNoResults: !0, transition: "scale", duration: 200, easing: "easeOutExpo", onSelect: !1, onResultsAdd: !1, onSearchQuery: function onSearchQuery(e) {}, onResults: function onResults(e) {}, onResultsOpen: function onResultsOpen() {}, onResultsClose: function onResultsClose() {}, className: { animating: "animating", active: "active", empty: "empty", focus: "focus", hidden: "hidden", loading: "loading", results: "results", pressed: "down" }, error: { source: "Cannot search. No source used, and Semantic API module was not included", noResults: "Your search returned no results", logging: "Error in debug logging, exiting.", noEndpoint: "No search endpoint was specified", noTemplate: "A valid template name was not specified.", oldSearchSyntax: "searchFullText setting has been renamed fullTextSearch for consistency, please adjust your settings.", serverError: "There was an issue querying the server.", maxResults: "Results must be an array to use maxResults setting", method: "The method you called is not defined." }, metadata: { cache: "cache", results: "results", result: "result" }, regExp: { escape: /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, beginsWith: "(?:s|^)" }, fields: { categories: "results", categoryName: "name", categoryResults: "results", description: "description", image: "image", price: "price", results: "results", title: "title", url: "url", action: "action", actionText: "text", actionURL: "url" }, selector: { prompt: ".prompt", searchButton: ".search.button", results: ".results", message: ".results > .message", category: ".category", result: ".result", title: ".title, .name" }, templates: { escape: function escape(e) {
  10783. var t = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#x27;", "`": "&#x60;" };return (/[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  10784. return t[e];
  10785. }) : e
  10786. );
  10787. }, message: function message(e, t) {
  10788. var n = "";return e !== i && t !== i && (n += '<div class="message ' + t + '">', n += "empty" == t ? '<div class="header">No Results</div class="header"><div class="description">' + e + '</div class="description">' : ' <div class="description">' + e + "</div>", n += "</div>"), n;
  10789. }, category: function category(t, n) {
  10790. var o = "";e.fn.search.settings.templates.escape;return t[n.categoryResults] !== i && (e.each(t[n.categoryResults], function (t, a) {
  10791. a[n.results] !== i && a.results.length > 0 && (o += '<div class="category">', a[n.categoryName] !== i && (o += '<div class="name">' + a[n.categoryName] + "</div>"), o += '<div class="results">', e.each(a.results, function (e, t) {
  10792. t[n.url] ? o += '<a class="result" href="' + t[n.url] + '">' : o += '<a class="result">', t[n.image] !== i && (o += '<div class="image"> <img src="' + t[n.image] + '"></div>'), o += '<div class="content">', t[n.price] !== i && (o += '<div class="price">' + t[n.price] + "</div>"), t[n.title] !== i && (o += '<div class="title">' + t[n.title] + "</div>"), t[n.description] !== i && (o += '<div class="description">' + t[n.description] + "</div>"), o += "</div>", o += "</a>";
  10793. }), o += "</div>", o += "</div>");
  10794. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  10795. }, standard: function standard(t, n) {
  10796. alert('t[]='+n.image); //t[n.image]
  10797. var o = "";return t[n.results] !== i && (e.each(t[n.results], function (e, t) {
  10798. t[n.url] ? o += '<a class="result" href="' + t[n.url] + '">' : o += '<a class="result">', t[n.image] !== i && (o += '<div class="image"> <img src="' + t[n.image] + '"></div>'), o += '<div class="content">', t[n.price] !== i && (o += '<div class="price">' + t[n.price] + "</div>"), t[n.title] !== i && (o += '<div class="title">' + t[n.title] + "</div>"), t[n.description] !== i && (o += '<div class="description">' + t[n.description] + "</div>"), o += "</div>", o += "</a>";
  10799. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  10800. } } };
  10801. }(jQuery, window, document), function (e, t, n, i) {
  10802. "use strict";
  10803. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.shape = function (o) {
  10804. var a,
  10805. r = e(this),
  10806. s = (e("body"), new Date().getTime()),
  10807. l = [],
  10808. c = arguments[0],
  10809. u = "string" == typeof c,
  10810. d = [].slice.call(arguments, 1),
  10811. f = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  10812. setTimeout(e, 0);
  10813. };return r.each(function () {
  10814. var t,
  10815. m,
  10816. g,
  10817. p = r.selector || "",
  10818. h = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.shape.settings, o) : e.extend({}, e.fn.shape.settings),
  10819. v = h.namespace,
  10820. b = h.selector,
  10821. y = h.error,
  10822. x = h.className,
  10823. C = "." + v,
  10824. w = "module-" + v,
  10825. S = e(this),
  10826. k = S.find(b.sides),
  10827. T = S.find(b.side),
  10828. A = !1,
  10829. R = this,
  10830. P = S.data(w);g = { initialize: function initialize() {
  10831. g.verbose("Initializing module for", R), g.set.defaultSide(), g.instantiate();
  10832. }, instantiate: function instantiate() {
  10833. g.verbose("Storing instance of module", g), P = g, S.data(w, P);
  10834. }, destroy: function destroy() {
  10835. g.verbose("Destroying previous module for", R), S.removeData(w).off(C);
  10836. }, refresh: function refresh() {
  10837. g.verbose("Refreshing selector cache for", R), S = e(R), k = e(this).find(b.shape), T = e(this).find(b.side);
  10838. }, repaint: function repaint() {
  10839. g.verbose("Forcing repaint event");(k[0] || n.createElement("div")).offsetWidth;
  10840. }, animate: function animate(e, n) {
  10841. g.verbose("Animating box with properties", e), n = n || function (e) {
  10842. g.verbose("Executing animation callback"), e !== i && e.stopPropagation(), g.reset(), g.set.active();
  10843. }, h.beforeChange.call(m[0]), g.get.transitionEvent() ? (g.verbose("Starting CSS animation"), S.addClass(x.animating), k.css(e).one(g.get.transitionEvent(), n), g.set.duration(h.duration), f(function () {
  10844. S.addClass(x.animating), t.addClass(x.hidden);
  10845. })) : n();
  10846. }, queue: function queue(e) {
  10847. g.debug("Queueing animation of", e), k.one(g.get.transitionEvent(), function () {
  10848. g.debug("Executing queued animation"), setTimeout(function () {
  10849. S.shape(e);
  10850. }, 0);
  10851. });
  10852. }, reset: function reset() {
  10853. g.verbose("Animating states reset"), S.removeClass(x.animating).attr("style", "").removeAttr("style"), k.attr("style", "").removeAttr("style"), T.attr("style", "").removeAttr("style").removeClass(x.hidden), m.removeClass(x.animating).attr("style", "").removeAttr("style");
  10854. }, is: { complete: function complete() {
  10855. return T.filter("." + x.active)[0] == m[0];
  10856. }, animating: function animating() {
  10857. return S.hasClass(x.animating);
  10858. } }, set: { defaultSide: function defaultSide() {
  10859. t = S.find("." + h.className.active), m = t.next(b.side).length > 0 ? t.next(b.side) : S.find(b.side).first(), A = !1, g.verbose("Active side set to", t), g.verbose("Next side set to", m);
  10860. }, duration: function duration(e) {
  10861. e = "number" == typeof (e = e || h.duration) ? e + "ms" : e, g.verbose("Setting animation duration", e), (h.duration || 0 === h.duration) && k.add(T).css({ "-webkit-transition-duration": e, "-moz-transition-duration": e, "-ms-transition-duration": e, "-o-transition-duration": e, "transition-duration": e });
  10862. }, currentStageSize: function currentStageSize() {
  10863. var e = S.find("." + h.className.active),
  10864. t = e.outerWidth(!0),
  10865. n = e.outerHeight(!0);S.css({ width: t, height: n });
  10866. }, stageSize: function stageSize() {
  10867. var e = S.clone().addClass(x.loading),
  10868. t = e.find("." + h.className.active),
  10869. n = A ? e.find(b.side).eq(A) : t.next(b.side).length > 0 ? t.next(b.side) : e.find(b.side).first(),
  10870. i = "next" == h.width ? n.outerWidth(!0) : "initial" == h.width ? S.width() : h.width,
  10871. o = "next" == h.height ? n.outerHeight(!0) : "initial" == h.height ? S.height() : h.height;t.removeClass(x.active), n.addClass(x.active), e.insertAfter(S), e.remove(), "auto" != h.width && (S.css("width", i + h.jitter), g.verbose("Specifying width during animation", i)), "auto" != h.height && (S.css("height", o + h.jitter), g.verbose("Specifying height during animation", o));
  10872. }, nextSide: function nextSide(e) {
  10873. A = e, m = T.filter(e), A = T.index(m), 0 === m.length && (g.set.defaultSide(), g.error(y.side)), g.verbose("Next side manually set to", m);
  10874. }, active: function active() {
  10875. g.verbose("Setting new side to active", m), T.removeClass(x.active), m.addClass(x.active), h.onChange.call(m[0]), g.set.defaultSide();
  10876. } }, flip: { up: function up() {
  10877. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  10878. if (g.is.animating()) g.queue("flip up");else {
  10879. g.debug("Flipping up", m);var e = g.get.transform.up();g.set.stageSize(), g.stage.above(), g.animate(e);
  10880. }
  10881. } else g.debug("Side already visible", m);
  10882. }, down: function down() {
  10883. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  10884. if (g.is.animating()) g.queue("flip down");else {
  10885. g.debug("Flipping down", m);var e = g.get.transform.down();g.set.stageSize(), g.stage.below(), g.animate(e);
  10886. }
  10887. } else g.debug("Side already visible", m);
  10888. }, left: function left() {
  10889. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  10890. if (g.is.animating()) g.queue("flip left");else {
  10891. g.debug("Flipping left", m);var e = g.get.transform.left();g.set.stageSize(), g.stage.left(), g.animate(e);
  10892. }
  10893. } else g.debug("Side already visible", m);
  10894. }, right: function right() {
  10895. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  10896. if (g.is.animating()) g.queue("flip right");else {
  10897. g.debug("Flipping right", m);var e = g.get.transform.right();g.set.stageSize(), g.stage.right(), g.animate(e);
  10898. }
  10899. } else g.debug("Side already visible", m);
  10900. }, over: function over() {
  10901. !g.is.complete() || g.is.animating() || h.allowRepeats ? g.is.animating() ? g.queue("flip over") : (g.debug("Flipping over", m), g.set.stageSize(), g.stage.behind(), g.animate(g.get.transform.over())) : g.debug("Side already visible", m);
  10902. }, back: function back() {
  10903. !g.is.complete() || g.is.animating() || h.allowRepeats ? g.is.animating() ? g.queue("flip back") : (g.debug("Flipping back", m), g.set.stageSize(), g.stage.behind(), g.animate(g.get.transform.back())) : g.debug("Side already visible", m);
  10904. } }, get: { transform: { up: function up() {
  10905. return { transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(-90deg)" };
  10906. }, down: function down() {
  10907. return { transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(90deg)" };
  10908. }, left: function left() {
  10909. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(90deg)" };
  10910. }, right: function right() {
  10911. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(-90deg)" };
  10912. }, over: function over() {
  10913. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(180deg)" };
  10914. }, back: function back() {
  10915. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(-180deg)" };
  10916. } }, transitionEvent: function transitionEvent() {
  10917. var e,
  10918. t = n.createElement("element"),
  10919. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  10920. if (t.style[e] !== i) return o[e];
  10921. }
  10922. }, nextSide: function nextSide() {
  10923. return t.next(b.side).length > 0 ? t.next(b.side) : S.find(b.side).first();
  10924. } }, stage: { above: function above() {
  10925. var e = { origin: (t.outerHeight(!0) - m.outerHeight(!0)) / 2, depth: { active: m.outerHeight(!0) / 2, next: t.outerHeight(!0) / 2 } };g.verbose("Setting the initial animation position as above", m, e), k.css({ transform: "translateZ(-" + e.depth.active + "px)" }), t.css({ transform: "rotateY(0deg) translateZ(" + e.depth.active + "px)" }), m.addClass(x.animating).css({ top: e.origin + "px", transform: "rotateX(90deg) translateZ(" + e.depth.next + "px)" });
  10926. }, below: function below() {
  10927. var e = { origin: (t.outerHeight(!0) - m.outerHeight(!0)) / 2, depth: { active: m.outerHeight(!0) / 2, next: t.outerHeight(!0) / 2 } };g.verbose("Setting the initial animation position as below", m, e), k.css({ transform: "translateZ(-" + e.depth.active + "px)" }), t.css({ transform: "rotateY(0deg) translateZ(" + e.depth.active + "px)" }), m.addClass(x.animating).css({ top: e.origin + "px", transform: "rotateX(-90deg) translateZ(" + e.depth.next + "px)" });
  10928. }, left: function left() {
  10929. var e = t.outerWidth(!0),
  10930. n = m.outerWidth(!0),
  10931. i = { origin: (e - n) / 2, depth: { active: n / 2, next: e / 2 } };g.verbose("Setting the initial animation position as left", m, i), k.css({ transform: "translateZ(-" + i.depth.active + "px)" }), t.css({ transform: "rotateY(0deg) translateZ(" + i.depth.active + "px)" }), m.addClass(x.animating).css({ left: i.origin + "px", transform: "rotateY(-90deg) translateZ(" + i.depth.next + "px)" });
  10932. }, right: function right() {
  10933. var e = t.outerWidth(!0),
  10934. n = m.outerWidth(!0),
  10935. i = { origin: (e - n) / 2, depth: { active: n / 2, next: e / 2 } };g.verbose("Setting the initial animation position as left", m, i), k.css({ transform: "translateZ(-" + i.depth.active + "px)" }), t.css({ transform: "rotateY(0deg) translateZ(" + i.depth.active + "px)" }), m.addClass(x.animating).css({ left: i.origin + "px", transform: "rotateY(90deg) translateZ(" + i.depth.next + "px)" });
  10936. }, behind: function behind() {
  10937. var e = t.outerWidth(!0),
  10938. n = m.outerWidth(!0),
  10939. i = { origin: (e - n) / 2, depth: { active: n / 2, next: e / 2 } };g.verbose("Setting the initial animation position as behind", m, i), t.css({ transform: "rotateY(0deg)" }), m.addClass(x.animating).css({ left: i.origin + "px", transform: "rotateY(-180deg)" });
  10940. } }, setting: function setting(t, n) {
  10941. if (g.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, h, t);else {
  10942. if (n === i) return h[t];e.isPlainObject(h[t]) ? e.extend(!0, h[t], n) : h[t] = n;
  10943. }
  10944. }, internal: function internal(t, n) {
  10945. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  10946. if (n === i) return g[t];g[t] = n;
  10947. }
  10948. }, debug: function debug() {
  10949. !h.silent && h.debug && (h.performance ? g.performance.log(arguments) : (g.debug = Function.prototype.bind.call(console.info, console, h.name + ":"), g.debug.apply(console, arguments)));
  10950. }, verbose: function verbose() {
  10951. !h.silent && h.verbose && h.debug && (h.performance ? g.performance.log(arguments) : (g.verbose = Function.prototype.bind.call(console.info, console, h.name + ":"), g.verbose.apply(console, arguments)));
  10952. }, error: function error() {
  10953. h.silent || (g.error = Function.prototype.bind.call(console.error, console, h.name + ":"), g.error.apply(console, arguments));
  10954. }, performance: { log: function log(e) {
  10955. var t, n;h.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: R, "Execution Time": n })), clearTimeout(g.performance.timer), g.performance.timer = setTimeout(g.performance.display, 500);
  10956. }, display: function display() {
  10957. var t = h.name + ":",
  10958. n = 0;s = !1, clearTimeout(g.performance.timer), e.each(l, function (e, t) {
  10959. n += t["Execution Time"];
  10960. }), t += " " + n + "ms", p && (t += " '" + p + "'"), r.length > 1 && (t += " (" + r.length + ")"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  10961. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10962. }), console.groupEnd()), l = [];
  10963. } }, invoke: function invoke(t, n, o) {
  10964. var r,
  10965. s,
  10966. l,
  10967. c = P;return n = n || d, o = R || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  10968. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  10969. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  10970. }
  10971. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  10972. } }, u ? (P === i && g.initialize(), g.invoke(c)) : (P !== i && P.invoke("destroy"), g.initialize());
  10973. }), a !== i ? a : this;
  10974. }, e.fn.shape.settings = { name: "Shape", silent: !1, debug: !1, verbose: !1, jitter: 0, performance: !0, namespace: "shape", width: "initial", height: "initial", beforeChange: function beforeChange() {}, onChange: function onChange() {}, allowRepeats: !1, duration: !1, error: { side: "You tried to switch to a side that does not exist.", method: "The method you called is not defined" }, className: { animating: "animating", hidden: "hidden", loading: "loading", active: "active" }, selector: { sides: ".sides", side: ".side" } };
  10975. }(jQuery, window, document), function (e, t, n, i) {
  10976. "use strict";
  10977. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sidebar = function (o) {
  10978. var a,
  10979. r = e(this),
  10980. s = e(t),
  10981. l = e(n),
  10982. c = e("html"),
  10983. u = e("head"),
  10984. d = r.selector || "",
  10985. f = new Date().getTime(),
  10986. m = [],
  10987. g = arguments[0],
  10988. p = "string" == typeof g,
  10989. h = [].slice.call(arguments, 1),
  10990. v = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  10991. setTimeout(e, 0);
  10992. };return r.each(function () {
  10993. var r,
  10994. b,
  10995. y,
  10996. x,
  10997. C,
  10998. w,
  10999. S = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sidebar.settings, o) : e.extend({}, e.fn.sidebar.settings),
  11000. k = S.selector,
  11001. T = S.className,
  11002. A = S.namespace,
  11003. R = S.regExp,
  11004. P = S.error,
  11005. E = "." + A,
  11006. F = "module-" + A,
  11007. O = e(this),
  11008. D = e(S.context),
  11009. q = O.children(k.sidebar),
  11010. j = (D.children(k.fixed), D.children(k.pusher)),
  11011. z = this,
  11012. I = O.data(F);w = { initialize: function initialize() {
  11013. w.debug("Initializing sidebar", o), w.create.id(), C = w.get.transitionEvent(), S.delaySetup ? v(w.setup.layout) : w.setup.layout(), v(function () {
  11014. w.setup.cache();
  11015. }), w.instantiate();
  11016. }, instantiate: function instantiate() {
  11017. w.verbose("Storing instance of module", w), I = w, O.data(F, w);
  11018. }, create: { id: function id() {
  11019. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, w.verbose("Creating unique id for element", y);
  11020. } }, destroy: function destroy() {
  11021. w.verbose("Destroying previous module for", O), O.off(E).removeData(F), w.is.ios() && w.remove.ios(), D.off(b), s.off(b), l.off(b);
  11022. }, event: { clickaway: function clickaway(e) {
  11023. var t = j.find(e.target).length > 0 || j.is(e.target),
  11024. n = D.is(e.target);t && (w.verbose("User clicked on dimmed page"), w.hide()), n && (w.verbose("User clicked on dimmable context (scaled out page)"), w.hide());
  11025. }, touch: function touch(e) {}, containScroll: function containScroll(e) {
  11026. z.scrollTop <= 0 && (z.scrollTop = 1), z.scrollTop + z.offsetHeight >= z.scrollHeight && (z.scrollTop = z.scrollHeight - z.offsetHeight - 1);
  11027. }, scroll: function scroll(t) {
  11028. 0 === e(t.target).closest(k.sidebar).length && t.preventDefault();
  11029. } }, bind: { clickaway: function clickaway() {
  11030. w.verbose("Adding clickaway events to context", D), S.closable && D.on("click" + b, w.event.clickaway).on("touchend" + b, w.event.clickaway);
  11031. }, scrollLock: function scrollLock() {
  11032. S.scrollLock && (w.debug("Disabling page scroll"), s.on("DOMMouseScroll" + b, w.event.scroll)), w.verbose("Adding events to contain sidebar scroll"), l.on("touchmove" + b, w.event.touch), O.on("scroll" + E, w.event.containScroll);
  11033. } }, unbind: { clickaway: function clickaway() {
  11034. w.verbose("Removing clickaway events from context", D), D.off(b);
  11035. }, scrollLock: function scrollLock() {
  11036. w.verbose("Removing scroll lock from page"), l.off(b), s.off(b), O.off("scroll" + E);
  11037. } }, add: { inlineCSS: function inlineCSS() {
  11038. var t,
  11039. n = w.cache.width || O.outerWidth(),
  11040. i = w.cache.height || O.outerHeight(),
  11041. o = w.is.rtl(),
  11042. a = w.get.direction(),
  11043. s = { left: n, right: -n, top: i, bottom: -i };o && (w.verbose("RTL detected, flipping widths"), s.left = -n, s.right = n), t = "<style>", "left" === a || "right" === a ? (w.debug("Adding CSS rules for animation distance", n), t += " .ui.visible." + a + ".sidebar ~ .fixed, .ui.visible." + a + ".sidebar ~ .pusher { -webkit-transform: translate3d(" + s[a] + "px, 0, 0); transform: translate3d(" + s[a] + "px, 0, 0); }") : "top" !== a && "bottom" != a || (t += " .ui.visible." + a + ".sidebar ~ .fixed, .ui.visible." + a + ".sidebar ~ .pusher { -webkit-transform: translate3d(0, " + s[a] + "px, 0); transform: translate3d(0, " + s[a] + "px, 0); }"), w.is.ie() && ("left" === a || "right" === a ? (w.debug("Adding CSS rules for animation distance", n), t += " body.pushable > .ui.visible." + a + ".sidebar ~ .pusher:after { -webkit-transform: translate3d(" + s[a] + "px, 0, 0); transform: translate3d(" + s[a] + "px, 0, 0); }") : "top" !== a && "bottom" != a || (t += " body.pushable > .ui.visible." + a + ".sidebar ~ .pusher:after { -webkit-transform: translate3d(0, " + s[a] + "px, 0); transform: translate3d(0, " + s[a] + "px, 0); }"), t += " body.pushable > .ui.visible.left.sidebar ~ .ui.visible.right.sidebar ~ .pusher:after, body.pushable > .ui.visible.right.sidebar ~ .ui.visible.left.sidebar ~ .pusher:after { -webkit-transform: translate3d(0px, 0, 0); transform: translate3d(0px, 0, 0); }"), r = e(t += "</style>").appendTo(u), w.debug("Adding sizing css to head", r);
  11044. } }, refresh: function refresh() {
  11045. w.verbose("Refreshing selector cache"), D = e(S.context), q = D.children(k.sidebar), j = D.children(k.pusher), D.children(k.fixed), w.clear.cache();
  11046. }, refreshSidebars: function refreshSidebars() {
  11047. w.verbose("Refreshing other sidebars"), q = D.children(k.sidebar);
  11048. }, repaint: function repaint() {
  11049. w.verbose("Forcing repaint event"), z.style.display = "none";z.offsetHeight;z.scrollTop = z.scrollTop, z.style.display = "";
  11050. }, setup: { cache: function cache() {
  11051. w.cache = { width: O.outerWidth(), height: O.outerHeight(), rtl: "rtl" == O.css("direction") };
  11052. }, layout: function layout() {
  11053. 0 === D.children(k.pusher).length && (w.debug("Adding wrapper element for sidebar"), w.error(P.pusher), j = e('<div class="pusher" />'), D.children().not(k.omitted).not(q).wrapAll(j), w.refresh()), 0 !== O.nextAll(k.pusher).length && O.nextAll(k.pusher)[0] === j[0] || (w.debug("Moved sidebar to correct parent element"), w.error(P.movedSidebar, z), O.detach().prependTo(D), w.refresh()), w.clear.cache(), w.set.pushable(), w.set.direction();
  11054. } }, attachEvents: function attachEvents(t, n) {
  11055. var i = e(t);n = e.isFunction(w[n]) ? w[n] : w.toggle, i.length > 0 ? (w.debug("Attaching sidebar events to element", t, n), i.on("click" + E, n)) : w.error(P.notFound, t);
  11056. }, show: function show(t) {
  11057. if (t = e.isFunction(t) ? t : function () {}, w.is.hidden()) {
  11058. if (w.refreshSidebars(), S.overlay && (w.error(P.overlay), S.transition = "overlay"), w.refresh(), w.othersActive()) if (w.debug("Other sidebars currently visible"), S.exclusive) {
  11059. if ("overlay" != S.transition) return void w.hideOthers(w.show);w.hideOthers();
  11060. } else S.transition = "overlay";w.pushPage(function () {
  11061. t.call(z), S.onShow.call(z);
  11062. }), S.onChange.call(z), S.onVisible.call(z);
  11063. } else w.debug("Sidebar is already visible");
  11064. }, hide: function hide(t) {
  11065. t = e.isFunction(t) ? t : function () {}, (w.is.visible() || w.is.animating()) && (w.debug("Hiding sidebar", t), w.refreshSidebars(), w.pullPage(function () {
  11066. t.call(z), S.onHidden.call(z);
  11067. }), S.onChange.call(z), S.onHide.call(z));
  11068. }, othersAnimating: function othersAnimating() {
  11069. return q.not(O).filter("." + T.animating).length > 0;
  11070. }, othersVisible: function othersVisible() {
  11071. return q.not(O).filter("." + T.visible).length > 0;
  11072. }, othersActive: function othersActive() {
  11073. return w.othersVisible() || w.othersAnimating();
  11074. }, hideOthers: function hideOthers(e) {
  11075. var t = q.not(O).filter("." + T.visible),
  11076. n = t.length,
  11077. i = 0;e = e || function () {}, t.sidebar("hide", function () {
  11078. ++i == n && e();
  11079. });
  11080. }, toggle: function toggle() {
  11081. w.verbose("Determining toggled direction"), w.is.hidden() ? w.show() : w.hide();
  11082. }, pushPage: function pushPage(t) {
  11083. var n,
  11084. i,
  11085. _o,
  11086. a = w.get.transition(),
  11087. r = "overlay" === a || w.othersActive() ? O : j;t = e.isFunction(t) ? t : function () {}, "scale down" == S.transition && w.scrollToTop(), w.set.transition(a), w.repaint(), n = function n() {
  11088. w.bind.clickaway(), w.add.inlineCSS(), w.set.animating(), w.set.visible();
  11089. }, i = function i() {
  11090. w.set.dimmed();
  11091. }, _o = function o(e) {
  11092. e.target == r[0] && (r.off(C + b, _o), w.remove.animating(), w.bind.scrollLock(), t.call(z));
  11093. }, r.off(C + b), r.on(C + b, _o), v(n), S.dimPage && !w.othersVisible() && v(i);
  11094. }, pullPage: function pullPage(t) {
  11095. var n,
  11096. _i,
  11097. o = w.get.transition(),
  11098. a = "overlay" == o || w.othersActive() ? O : j;t = e.isFunction(t) ? t : function () {}, w.verbose("Removing context push state", w.get.direction()), w.unbind.clickaway(), w.unbind.scrollLock(), n = function n() {
  11099. w.set.transition(o), w.set.animating(), w.remove.visible(), S.dimPage && !w.othersVisible() && j.removeClass(T.dimmed);
  11100. }, _i = function i(e) {
  11101. e.target == a[0] && (a.off(C + b, _i), w.remove.animating(), w.remove.transition(), w.remove.inlineCSS(), ("scale down" == o || S.returnScroll && w.is.mobile()) && w.scrollBack(), t.call(z));
  11102. }, a.off(C + b), a.on(C + b, _i), v(n);
  11103. }, scrollToTop: function scrollToTop() {
  11104. w.verbose("Scrolling to top of page to avoid animation issues"), x = e(t).scrollTop(), O.scrollTop(0), t.scrollTo(0, 0);
  11105. }, scrollBack: function scrollBack() {
  11106. w.verbose("Scrolling back to original page position"), t.scrollTo(0, x);
  11107. }, clear: { cache: function cache() {
  11108. w.verbose("Clearing cached dimensions"), w.cache = {};
  11109. } }, set: { ios: function ios() {
  11110. c.addClass(T.ios);
  11111. }, pushed: function pushed() {
  11112. D.addClass(T.pushed);
  11113. }, pushable: function pushable() {
  11114. D.addClass(T.pushable);
  11115. }, dimmed: function dimmed() {
  11116. j.addClass(T.dimmed);
  11117. }, active: function active() {
  11118. O.addClass(T.active);
  11119. }, animating: function animating() {
  11120. O.addClass(T.animating);
  11121. }, transition: function transition(e) {
  11122. e = e || w.get.transition(), O.addClass(e);
  11123. }, direction: function direction(e) {
  11124. e = e || w.get.direction(), O.addClass(T[e]);
  11125. }, visible: function visible() {
  11126. O.addClass(T.visible);
  11127. }, overlay: function overlay() {
  11128. O.addClass(T.overlay);
  11129. } }, remove: { inlineCSS: function inlineCSS() {
  11130. w.debug("Removing inline css styles", r), r && r.length > 0 && r.remove();
  11131. }, ios: function ios() {
  11132. c.removeClass(T.ios);
  11133. }, pushed: function pushed() {
  11134. D.removeClass(T.pushed);
  11135. }, pushable: function pushable() {
  11136. D.removeClass(T.pushable);
  11137. }, active: function active() {
  11138. O.removeClass(T.active);
  11139. }, animating: function animating() {
  11140. O.removeClass(T.animating);
  11141. }, transition: function transition(e) {
  11142. e = e || w.get.transition(), O.removeClass(e);
  11143. }, direction: function direction(e) {
  11144. e = e || w.get.direction(), O.removeClass(T[e]);
  11145. }, visible: function visible() {
  11146. O.removeClass(T.visible);
  11147. }, overlay: function overlay() {
  11148. O.removeClass(T.overlay);
  11149. } }, get: { direction: function direction() {
  11150. return O.hasClass(T.top) ? T.top : O.hasClass(T.right) ? T.right : O.hasClass(T.bottom) ? T.bottom : T.left;
  11151. }, transition: function transition() {
  11152. var e,
  11153. t = w.get.direction();return e = w.is.mobile() ? "auto" == S.mobileTransition ? S.defaultTransition.mobile[t] : S.mobileTransition : "auto" == S.transition ? S.defaultTransition.computer[t] : S.transition, w.verbose("Determined transition", e), e;
  11154. }, transitionEvent: function transitionEvent() {
  11155. var e,
  11156. t = n.createElement("element"),
  11157. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  11158. if (t.style[e] !== i) return o[e];
  11159. }
  11160. } }, is: { ie: function ie() {
  11161. return !t.ActiveXObject && "ActiveXObject" in t || "ActiveXObject" in t;
  11162. }, ios: function ios() {
  11163. var e = navigator.userAgent,
  11164. t = e.match(R.ios),
  11165. n = e.match(R.mobileChrome);return !(!t || n) && (w.verbose("Browser was found to be iOS", e), !0);
  11166. }, mobile: function mobile() {
  11167. var e = navigator.userAgent;return e.match(R.mobile) ? (w.verbose("Browser was found to be mobile", e), !0) : (w.verbose("Browser is not mobile, using regular transition", e), !1);
  11168. }, hidden: function hidden() {
  11169. return !w.is.visible();
  11170. }, visible: function visible() {
  11171. return O.hasClass(T.visible);
  11172. }, open: function open() {
  11173. return w.is.visible();
  11174. }, closed: function closed() {
  11175. return w.is.hidden();
  11176. }, vertical: function vertical() {
  11177. return O.hasClass(T.top);
  11178. }, animating: function animating() {
  11179. return D.hasClass(T.animating);
  11180. }, rtl: function rtl() {
  11181. return w.cache.rtl === i && (w.cache.rtl = "rtl" == O.css("direction")), w.cache.rtl;
  11182. } }, setting: function setting(t, n) {
  11183. if (w.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, S, t);else {
  11184. if (n === i) return S[t];e.isPlainObject(S[t]) ? e.extend(!0, S[t], n) : S[t] = n;
  11185. }
  11186. }, internal: function internal(t, n) {
  11187. if (e.isPlainObject(t)) e.extend(!0, w, t);else {
  11188. if (n === i) return w[t];w[t] = n;
  11189. }
  11190. }, debug: function debug() {
  11191. !S.silent && S.debug && (S.performance ? w.performance.log(arguments) : (w.debug = Function.prototype.bind.call(console.info, console, S.name + ":"), w.debug.apply(console, arguments)));
  11192. }, verbose: function verbose() {
  11193. !S.silent && S.verbose && S.debug && (S.performance ? w.performance.log(arguments) : (w.verbose = Function.prototype.bind.call(console.info, console, S.name + ":"), w.verbose.apply(console, arguments)));
  11194. }, error: function error() {
  11195. S.silent || (w.error = Function.prototype.bind.call(console.error, console, S.name + ":"), w.error.apply(console, arguments));
  11196. }, performance: { log: function log(e) {
  11197. var t, n;S.performance && (n = (t = new Date().getTime()) - (f || t), f = t, m.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: z, "Execution Time": n })), clearTimeout(w.performance.timer), w.performance.timer = setTimeout(w.performance.display, 500);
  11198. }, display: function display() {
  11199. var t = S.name + ":",
  11200. n = 0;f = !1, clearTimeout(w.performance.timer), e.each(m, function (e, t) {
  11201. n += t["Execution Time"];
  11202. }), t += " " + n + "ms", d && (t += " '" + d + "'"), (console.group !== i || console.table !== i) && m.length > 0 && (console.groupCollapsed(t), console.table ? console.table(m) : e.each(m, function (e, t) {
  11203. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11204. }), console.groupEnd()), m = [];
  11205. } }, invoke: function invoke(t, n, o) {
  11206. var r,
  11207. s,
  11208. l,
  11209. c = I;return n = n || h, o = z || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  11210. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11211. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (w.error(P.method, t), !1);c = c[o];
  11212. }
  11213. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  11214. } }, p ? (I === i && w.initialize(), w.invoke(g)) : (I !== i && w.invoke("destroy"), w.initialize());
  11215. }), a !== i ? a : this;
  11216. }, e.fn.sidebar.settings = { name: "Sidebar", namespace: "sidebar", silent: !1, debug: !1, verbose: !1, performance: !0, transition: "auto", mobileTransition: "auto", defaultTransition: { computer: { left: "uncover", right: "uncover", top: "overlay", bottom: "overlay" }, mobile: { left: "uncover", right: "uncover", top: "overlay", bottom: "overlay" } }, context: "body", exclusive: !1, closable: !0, dimPage: !0, scrollLock: !1, returnScroll: !1, delaySetup: !1, duration: 500, onChange: function onChange() {}, onShow: function onShow() {}, onHide: function onHide() {}, onHidden: function onHidden() {}, onVisible: function onVisible() {}, className: { active: "active", animating: "animating", dimmed: "dimmed", ios: "ios", pushable: "pushable", pushed: "pushed", right: "right", top: "top", left: "left", bottom: "bottom", visible: "visible" }, selector: { fixed: ".fixed", omitted: "script, link, style, .ui.modal, .ui.dimmer, .ui.nag, .ui.fixed", pusher: ".pusher", sidebar: ".ui.sidebar" }, regExp: { ios: /(iPad|iPhone|iPod)/g, mobileChrome: /(CriOS)/g, mobile: /Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/g }, error: { method: "The method you called is not defined.", pusher: "Had to add pusher element. For optimal performance make sure body content is inside a pusher element", movedSidebar: "Had to move sidebar. For optimal performance make sure sidebar and pusher are direct children of your body tag", overlay: "The overlay setting is no longer supported, use animation: overlay", notFound: "There were no elements that matched the specified selector" } };
  11217. }(jQuery, window, document), function (e, t, n, i) {
  11218. "use strict";
  11219. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sticky = function (o) {
  11220. var a,
  11221. r = e(this),
  11222. s = r.selector || "",
  11223. l = new Date().getTime(),
  11224. c = [],
  11225. u = arguments[0],
  11226. d = "string" == typeof u,
  11227. f = [].slice.call(arguments, 1);return r.each(function () {
  11228. var r,
  11229. m,
  11230. g,
  11231. p,
  11232. h,
  11233. v = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sticky.settings, o) : e.extend({}, e.fn.sticky.settings),
  11234. b = v.className,
  11235. y = v.namespace,
  11236. x = v.error,
  11237. C = "." + y,
  11238. w = "module-" + y,
  11239. S = e(this),
  11240. k = e(t),
  11241. T = e(v.scrollContext),
  11242. A = (S.selector, S.data(w)),
  11243. R = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  11244. setTimeout(e, 0);
  11245. },
  11246. P = this;h = { initialize: function initialize() {
  11247. h.determineContainer(), h.determineContext(), h.verbose("Initializing sticky", v, r), h.save.positions(), h.checkErrors(), h.bind.events(), v.observeChanges && h.observeChanges(), h.instantiate();
  11248. }, instantiate: function instantiate() {
  11249. h.verbose("Storing instance of module", h), A = h, S.data(w, h);
  11250. }, destroy: function destroy() {
  11251. h.verbose("Destroying previous instance"), h.reset(), g && g.disconnect(), p && p.disconnect(), k.off("load" + C, h.event.load).off("resize" + C, h.event.resize), T.off("scrollchange" + C, h.event.scrollchange), S.removeData(w);
  11252. }, observeChanges: function observeChanges() {
  11253. "MutationObserver" in t && (g = new MutationObserver(h.event.documentChanged), p = new MutationObserver(h.event.changed), g.observe(n, { childList: !0, subtree: !0 }), p.observe(P, { childList: !0, subtree: !0 }), p.observe(m[0], { childList: !0, subtree: !0 }), h.debug("Setting up mutation observer", p));
  11254. }, determineContainer: function determineContainer() {
  11255. r = v.container ? e(v.container) : S.offsetParent();
  11256. }, determineContext: function determineContext() {
  11257. 0 !== (m = v.context ? e(v.context) : r).length || h.error(x.invalidContext, v.context, S);
  11258. }, checkErrors: function checkErrors() {
  11259. if (h.is.hidden() && h.error(x.visible, S), h.cache.element.height > h.cache.context.height) return h.reset(), void h.error(x.elementSize, S);
  11260. }, bind: { events: function events() {
  11261. k.on("load" + C, h.event.load).on("resize" + C, h.event.resize), T.off("scroll" + C).on("scroll" + C, h.event.scroll).on("scrollchange" + C, h.event.scrollchange);
  11262. } }, event: { changed: function changed(e) {
  11263. clearTimeout(h.timer), h.timer = setTimeout(function () {
  11264. h.verbose("DOM tree modified, updating sticky menu", e), h.refresh();
  11265. }, 100);
  11266. }, documentChanged: function documentChanged(t) {
  11267. [].forEach.call(t, function (t) {
  11268. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  11269. (t == P || e(t).find(P).length > 0) && (h.debug("Element removed from DOM, tearing down events"), h.destroy());
  11270. });
  11271. });
  11272. }, load: function load() {
  11273. h.verbose("Page contents finished loading"), R(h.refresh);
  11274. }, resize: function resize() {
  11275. h.verbose("Window resized"), R(h.refresh);
  11276. }, scroll: function scroll() {
  11277. R(function () {
  11278. T.triggerHandler("scrollchange" + C, T.scrollTop());
  11279. });
  11280. }, scrollchange: function scrollchange(e, t) {
  11281. h.stick(t), v.onScroll.call(P);
  11282. } }, refresh: function refresh(e) {
  11283. h.reset(), v.context || h.determineContext(), e && h.determineContainer(), h.save.positions(), h.stick(), v.onReposition.call(P);
  11284. }, supports: { sticky: function sticky() {
  11285. var t = e("<div/>");t[0];return t.addClass(b.supported), t.css("position").match("sticky");
  11286. } }, save: { lastScroll: function lastScroll(e) {
  11287. h.lastScroll = e;
  11288. }, elementScroll: function elementScroll(e) {
  11289. h.elementScroll = e;
  11290. }, positions: function positions() {
  11291. var e = { height: T.height() },
  11292. t = { margin: { top: parseInt(S.css("margin-top"), 10), bottom: parseInt(S.css("margin-bottom"), 10) }, offset: S.offset(), width: S.outerWidth(), height: S.outerHeight() },
  11293. n = { offset: m.offset(), height: m.outerHeight() };r.outerHeight();h.is.standardScroll() || (h.debug("Non-standard scroll. Removing scroll offset from element offset"), e.top = T.scrollTop(), e.left = T.scrollLeft(), t.offset.top += e.top, n.offset.top += e.top, t.offset.left += e.left, n.offset.left += e.left), h.cache = { fits: t.height + v.offset <= e.height, sameHeight: t.height == n.height, scrollContext: { height: e.height }, element: { margin: t.margin, top: t.offset.top - t.margin.top, left: t.offset.left, width: t.width, height: t.height, bottom: t.offset.top + t.height }, context: { top: n.offset.top, height: n.height, bottom: n.offset.top + n.height } }, h.set.containerSize(), h.stick(), h.debug("Caching element positions", h.cache);
  11294. } }, get: { direction: function direction(e) {
  11295. var t = "down";return e = e || T.scrollTop(), h.lastScroll !== i && (h.lastScroll < e ? t = "down" : h.lastScroll > e && (t = "up")), t;
  11296. }, scrollChange: function scrollChange(e) {
  11297. return e = e || T.scrollTop(), h.lastScroll ? e - h.lastScroll : 0;
  11298. }, currentElementScroll: function currentElementScroll() {
  11299. return h.elementScroll ? h.elementScroll : h.is.top() ? Math.abs(parseInt(S.css("top"), 10)) || 0 : Math.abs(parseInt(S.css("bottom"), 10)) || 0;
  11300. }, elementScroll: function elementScroll(e) {
  11301. e = e || T.scrollTop();var t = h.cache.element,
  11302. n = h.cache.scrollContext,
  11303. i = h.get.scrollChange(e),
  11304. o = t.height - n.height + v.offset,
  11305. a = h.get.currentElementScroll(),
  11306. r = a + i;return a = h.cache.fits || r < 0 ? 0 : r > o ? o : r;
  11307. } }, remove: { lastScroll: function lastScroll() {
  11308. delete h.lastScroll;
  11309. }, elementScroll: function elementScroll(e) {
  11310. delete h.elementScroll;
  11311. }, minimumSize: function minimumSize() {
  11312. r.css("min-height", "");
  11313. }, offset: function offset() {
  11314. S.css("margin-top", "");
  11315. } }, set: { offset: function offset() {
  11316. h.verbose("Setting offset on element", v.offset), S.css("margin-top", v.offset);
  11317. }, containerSize: function containerSize() {
  11318. var e = r.get(0).tagName;"HTML" === e || "body" == e ? h.determineContainer() : Math.abs(r.outerHeight() - h.cache.context.height) > v.jitter && (h.debug("Context has padding, specifying exact height for container", h.cache.context.height), r.css({ height: h.cache.context.height }));
  11319. }, minimumSize: function minimumSize() {
  11320. var e = h.cache.element;r.css("min-height", e.height);
  11321. }, scroll: function scroll(e) {
  11322. h.debug("Setting scroll on element", e), h.elementScroll != e && (h.is.top() && S.css("bottom", "").css("top", -e), h.is.bottom() && S.css("top", "").css("bottom", e));
  11323. }, size: function size() {
  11324. 0 !== h.cache.element.height && 0 !== h.cache.element.width && (P.style.setProperty("width", h.cache.element.width + "px", "important"), P.style.setProperty("height", h.cache.element.height + "px", "important"));
  11325. } }, is: { standardScroll: function standardScroll() {
  11326. return T[0] == t;
  11327. }, top: function top() {
  11328. return S.hasClass(b.top);
  11329. }, bottom: function bottom() {
  11330. return S.hasClass(b.bottom);
  11331. }, initialPosition: function initialPosition() {
  11332. return !h.is.fixed() && !h.is.bound();
  11333. }, hidden: function hidden() {
  11334. return !S.is(":visible");
  11335. }, bound: function bound() {
  11336. return S.hasClass(b.bound);
  11337. }, fixed: function fixed() {
  11338. return S.hasClass(b.fixed);
  11339. } }, stick: function stick(e) {
  11340. var t = e || T.scrollTop(),
  11341. n = h.cache,
  11342. i = n.fits,
  11343. o = n.sameHeight,
  11344. a = n.element,
  11345. r = n.scrollContext,
  11346. s = n.context,
  11347. l = h.is.bottom() && v.pushing ? v.bottomOffset : v.offset,
  11348. c = (e = { top: t + l, bottom: t + l + r.height }, h.get.direction(e.top), i ? 0 : h.get.elementScroll(e.top)),
  11349. u = !i;0 !== a.height && !o && (h.is.initialPosition() ? e.top >= s.bottom ? (h.debug("Initial element position is bottom of container"), h.bindBottom()) : e.top > a.top && (a.height + e.top - c >= s.bottom ? (h.debug("Initial element position is bottom of container"), h.bindBottom()) : (h.debug("Initial element position is fixed"), h.fixTop())) : h.is.fixed() ? h.is.top() ? e.top <= a.top ? (h.debug("Fixed element reached top of container"), h.setInitialPosition()) : a.height + e.top - c >= s.bottom ? (h.debug("Fixed element reached bottom of container"), h.bindBottom()) : u && (h.set.scroll(c), h.save.lastScroll(e.top), h.save.elementScroll(c)) : h.is.bottom() && (e.bottom - a.height <= a.top ? (h.debug("Bottom fixed rail has reached top of container"), h.setInitialPosition()) : e.bottom >= s.bottom ? (h.debug("Bottom fixed rail has reached bottom of container"), h.bindBottom()) : u && (h.set.scroll(c), h.save.lastScroll(e.top), h.save.elementScroll(c))) : h.is.bottom() && (e.top <= a.top ? (h.debug("Jumped from bottom fixed to top fixed, most likely used home/end button"), h.setInitialPosition()) : v.pushing ? h.is.bound() && e.bottom <= s.bottom && (h.debug("Fixing bottom attached element to bottom of browser."), h.fixBottom()) : h.is.bound() && e.top <= s.bottom - a.height && (h.debug("Fixing bottom attached element to top of browser."), h.fixTop())));
  11350. }, bindTop: function bindTop() {
  11351. h.debug("Binding element to top of parent container"), h.remove.offset(), S.css({ left: "", top: "", marginBottom: "" }).removeClass(b.fixed).removeClass(b.bottom).addClass(b.bound).addClass(b.top), v.onTop.call(P), v.onUnstick.call(P);
  11352. }, bindBottom: function bindBottom() {
  11353. h.debug("Binding element to bottom of parent container"), h.remove.offset(), S.css({ left: "", top: "" }).removeClass(b.fixed).removeClass(b.top).addClass(b.bound).addClass(b.bottom), v.onBottom.call(P), v.onUnstick.call(P);
  11354. }, setInitialPosition: function setInitialPosition() {
  11355. h.debug("Returning to initial position"), h.unfix(), h.unbind();
  11356. }, fixTop: function fixTop() {
  11357. h.debug("Fixing element to top of page"), v.setSize && h.set.size(), h.set.minimumSize(), h.set.offset(), S.css({ left: h.cache.element.left, bottom: "", marginBottom: "" }).removeClass(b.bound).removeClass(b.bottom).addClass(b.fixed).addClass(b.top), v.onStick.call(P);
  11358. }, fixBottom: function fixBottom() {
  11359. h.debug("Sticking element to bottom of page"), v.setSize && h.set.size(), h.set.minimumSize(), h.set.offset(), S.css({ left: h.cache.element.left, bottom: "", marginBottom: "" }).removeClass(b.bound).removeClass(b.top).addClass(b.fixed).addClass(b.bottom), v.onStick.call(P);
  11360. }, unbind: function unbind() {
  11361. h.is.bound() && (h.debug("Removing container bound position on element"), h.remove.offset(), S.removeClass(b.bound).removeClass(b.top).removeClass(b.bottom));
  11362. }, unfix: function unfix() {
  11363. h.is.fixed() && (h.debug("Removing fixed position on element"), h.remove.minimumSize(), h.remove.offset(), S.removeClass(b.fixed).removeClass(b.top).removeClass(b.bottom), v.onUnstick.call(P));
  11364. }, reset: function reset() {
  11365. h.debug("Resetting elements position"), h.unbind(), h.unfix(), h.resetCSS(), h.remove.offset(), h.remove.lastScroll();
  11366. }, resetCSS: function resetCSS() {
  11367. S.css({ width: "", height: "" }), r.css({ height: "" });
  11368. }, setting: function setting(t, n) {
  11369. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  11370. if (n === i) return v[t];v[t] = n;
  11371. }
  11372. }, internal: function internal(t, n) {
  11373. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  11374. if (n === i) return h[t];h[t] = n;
  11375. }
  11376. }, debug: function debug() {
  11377. !v.silent && v.debug && (v.performance ? h.performance.log(arguments) : (h.debug = Function.prototype.bind.call(console.info, console, v.name + ":"), h.debug.apply(console, arguments)));
  11378. }, verbose: function verbose() {
  11379. !v.silent && v.verbose && v.debug && (v.performance ? h.performance.log(arguments) : (h.verbose = Function.prototype.bind.call(console.info, console, v.name + ":"), h.verbose.apply(console, arguments)));
  11380. }, error: function error() {
  11381. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  11382. }, performance: { log: function log(e) {
  11383. var t, n;v.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: P, "Execution Time": n })), clearTimeout(h.performance.timer), h.performance.timer = setTimeout(h.performance.display, 0);
  11384. }, display: function display() {
  11385. var t = v.name + ":",
  11386. n = 0;l = !1, clearTimeout(h.performance.timer), e.each(c, function (e, t) {
  11387. n += t["Execution Time"];
  11388. }), t += " " + n + "ms", s && (t += " '" + s + "'"), (console.group !== i || console.table !== i) && c.length > 0 && (console.groupCollapsed(t), console.table ? console.table(c) : e.each(c, function (e, t) {
  11389. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11390. }), console.groupEnd()), c = [];
  11391. } }, invoke: function invoke(t, n, o) {
  11392. var r,
  11393. s,
  11394. l,
  11395. c = A;return n = n || f, o = P || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  11396. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11397. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  11398. }
  11399. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  11400. } }, d ? (A === i && h.initialize(), h.invoke(u)) : (A !== i && A.invoke("destroy"), h.initialize());
  11401. }), a !== i ? a : this;
  11402. }, e.fn.sticky.settings = { name: "Sticky", namespace: "sticky", silent: !1, debug: !1, verbose: !0, performance: !0, pushing: !1, context: !1, container: !1, scrollContext: t, offset: 0, bottomOffset: 0, jitter: 5, setSize: !0, observeChanges: !1, onReposition: function onReposition() {}, onScroll: function onScroll() {}, onStick: function onStick() {}, onUnstick: function onUnstick() {}, onTop: function onTop() {}, onBottom: function onBottom() {}, error: { container: "Sticky element must be inside a relative container", visible: "Element is hidden, you must call refresh after element becomes visible. Use silent setting to surpress this warning in production.", method: "The method you called is not defined.", invalidContext: "Context specified does not exist", elementSize: "Sticky element is larger than its container, cannot create sticky." }, className: { bound: "bound", fixed: "fixed", supported: "native", top: "top", bottom: "bottom" } };
  11403. }(jQuery, window, document), function (e, t, n, i) {
  11404. "use strict";
  11405. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.tab = function (o) {
  11406. var a,
  11407. r = e.isFunction(this) ? e(t) : e(this),
  11408. s = r.selector || "",
  11409. l = new Date().getTime(),
  11410. c = [],
  11411. u = arguments[0],
  11412. d = "string" == typeof u,
  11413. f = [].slice.call(arguments, 1),
  11414. m = !1;return r.each(function () {
  11415. var g,
  11416. p,
  11417. h,
  11418. v,
  11419. b,
  11420. y,
  11421. x = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.tab.settings, o) : e.extend({}, e.fn.tab.settings),
  11422. C = x.className,
  11423. w = x.metadata,
  11424. S = x.selector,
  11425. k = x.error,
  11426. T = "." + x.namespace,
  11427. A = "module-" + x.namespace,
  11428. R = e(this),
  11429. P = {},
  11430. E = !0,
  11431. F = 0,
  11432. O = this,
  11433. D = R.data(A);b = { initialize: function initialize() {
  11434. b.debug("Initializing tab menu item", R), b.fix.callbacks(), b.determineTabs(), b.debug("Determining tabs", x.context, p), x.auto && b.set.auto(), b.bind.events(), x.history && !m && (b.initializeHistory(), m = !0), b.instantiate();
  11435. }, instantiate: function instantiate() {
  11436. b.verbose("Storing instance of module", b), D = b, R.data(A, b);
  11437. }, destroy: function destroy() {
  11438. b.debug("Destroying tabs", R), R.removeData(A).off(T);
  11439. }, bind: { events: function events() {
  11440. e.isWindow(O) || (b.debug("Attaching tab activation events to element", R), R.on("click" + T, b.event.click));
  11441. } }, determineTabs: function determineTabs() {
  11442. var t;"parent" === x.context ? (R.closest(S.ui).length > 0 ? (t = R.closest(S.ui), b.verbose("Using closest UI element as parent", t)) : t = R, g = t.parent(), b.verbose("Determined parent element for creating context", g)) : x.context ? (g = e(x.context), b.verbose("Using selector for tab context", x.context, g)) : g = e("body"), x.childrenOnly ? (p = g.children(S.tabs), b.debug("Searching tab context children for tabs", g, p)) : (p = g.find(S.tabs), b.debug("Searching tab context for tabs", g, p));
  11443. }, fix: { callbacks: function callbacks() {
  11444. e.isPlainObject(o) && (o.onTabLoad || o.onTabInit) && (o.onTabLoad && (o.onLoad = o.onTabLoad, delete o.onTabLoad, b.error(k.legacyLoad, o.onLoad)), o.onTabInit && (o.onFirstLoad = o.onTabInit, delete o.onTabInit, b.error(k.legacyInit, o.onFirstLoad)), x = e.extend(!0, {}, e.fn.tab.settings, o));
  11445. } }, initializeHistory: function initializeHistory() {
  11446. if (b.debug("Initializing page state"), e.address === i) return b.error(k.state), !1;if ("state" == x.historyType) {
  11447. if (b.debug("Using HTML5 to manage state"), !1 === x.path) return b.error(k.path), !1;e.address.history(!0).state(x.path);
  11448. }e.address.bind("change", b.event.history.change);
  11449. }, event: { click: function click(t) {
  11450. var n = e(this).data(w.tab);n !== i ? (x.history ? (b.verbose("Updating page state", t), e.address.value(n)) : (b.verbose("Changing tab", t), b.changeTab(n)), t.preventDefault()) : b.debug("No tab specified");
  11451. }, history: { change: function change(t) {
  11452. var n = t.pathNames.join("/") || b.get.initialPath(),
  11453. o = x.templates.determineTitle(n) || !1;b.performance.display(), b.debug("History change event", n, t), y = t, n !== i && b.changeTab(n), o && e.address.title(o);
  11454. } } }, refresh: function refresh() {
  11455. h && (b.debug("Refreshing tab", h), b.changeTab(h));
  11456. }, cache: { read: function read(e) {
  11457. return e !== i && P[e];
  11458. }, add: function add(e, t) {
  11459. e = e || h, b.debug("Adding cached content for", e), P[e] = t;
  11460. }, remove: function remove(e) {
  11461. e = e || h, b.debug("Removing cached content for", e), delete P[e];
  11462. } }, set: { auto: function auto() {
  11463. var t = "string" == typeof x.path ? x.path.replace(/\/$/, "") + "/{$tab}" : "/{$tab}";b.verbose("Setting up automatic tab retrieval from server", t), e.isPlainObject(x.apiSettings) ? x.apiSettings.url = t : x.apiSettings = { url: t };
  11464. }, loading: function loading(e) {
  11465. var t = b.get.tabElement(e);t.hasClass(C.loading) || (b.verbose("Setting loading state for", t), t.addClass(C.loading).siblings(p).removeClass(C.active + " " + C.loading), t.length > 0 && x.onRequest.call(t[0], e));
  11466. }, state: function state(t) {
  11467. e.address.value(t);
  11468. } }, changeTab: function changeTab(n) {
  11469. var i = t.history && t.history.pushState && x.ignoreFirstLoad && E,
  11470. o = x.auto || e.isPlainObject(x.apiSettings),
  11471. a = o && !i ? b.utilities.pathToArray(n) : b.get.defaultPathArray(n);n = b.utilities.arrayToPath(a), e.each(a, function (t, r) {
  11472. var s,
  11473. l,
  11474. c,
  11475. u,
  11476. d = a.slice(0, t + 1),
  11477. f = b.utilities.arrayToPath(d),
  11478. m = b.is.tab(f),
  11479. p = t + 1 == a.length,
  11480. S = b.get.tabElement(f);if (b.verbose("Looking for tab", r), m) {
  11481. if (b.verbose("Tab was found", r), h = f, v = b.utilities.filterArray(a, d), p ? u = !0 : (l = a.slice(0, t + 2), c = b.utilities.arrayToPath(l), (u = !b.is.tab(c)) && b.verbose("Tab parameters found", l)), u && o) return i ? (b.debug("Ignoring remote content on first tab load", f), E = !1, b.cache.add(n, S.html()), b.activate.all(f), x.onFirstLoad.call(S[0], f, v, y), x.onLoad.call(S[0], f, v, y)) : (b.activate.navigation(f), b.fetch.content(f, n)), !1;b.debug("Opened local tab", f), b.activate.all(f), b.cache.read(f) || (b.cache.add(f, !0), b.debug("First time tab loaded calling tab init"), x.onFirstLoad.call(S[0], f, v, y)), x.onLoad.call(S[0], f, v, y);
  11482. } else {
  11483. if (-1 != n.search("/") || "" === n) return b.error(k.missingTab, R, g, f), !1;if (f = (s = e("#" + n + ', a[name="' + n + '"]')).closest("[data-tab]").data(w.tab), S = b.get.tabElement(f), s && s.length > 0 && f) return b.debug("Anchor link used, opening parent tab", S, s), S.hasClass(C.active) || setTimeout(function () {
  11484. b.scrollTo(s);
  11485. }, 0), b.activate.all(f), b.cache.read(f) || (b.cache.add(f, !0), b.debug("First time tab loaded calling tab init"), x.onFirstLoad.call(S[0], f, v, y)), x.onLoad.call(S[0], f, v, y), !1;
  11486. }
  11487. });
  11488. }, scrollTo: function scrollTo(t) {
  11489. var i = !!(t && t.length > 0) && t.offset().top;!1 !== i && (b.debug("Forcing scroll to an in-page link in a hidden tab", i, t), e(n).scrollTop(i));
  11490. }, update: { content: function content(t, n, o) {
  11491. var a = b.get.tabElement(t),
  11492. r = a[0];o = o !== i ? o : x.evaluateScripts, "string" == typeof x.cacheType && "dom" == x.cacheType.toLowerCase() && "string" != typeof n ? a.empty().append(e(n).clone(!0)) : o ? (b.debug("Updating HTML and evaluating inline scripts", t, n), a.html(n)) : (b.debug("Updating HTML", t, n), r.innerHTML = n);
  11493. } }, fetch: { content: function content(t, n) {
  11494. var o,
  11495. a,
  11496. r = b.get.tabElement(t),
  11497. s = { dataType: "html", encodeParameters: !1, on: "now", cache: x.alwaysRefresh, headers: { "X-Remote": !0 }, onSuccess: function onSuccess(e) {
  11498. "response" == x.cacheType && b.cache.add(n, e), b.update.content(t, e), t == h ? (b.debug("Content loaded", t), b.activate.tab(t)) : b.debug("Content loaded in background", t), x.onFirstLoad.call(r[0], t, v, y), x.onLoad.call(r[0], t, v, y), x.loadOnce ? b.cache.add(n, !0) : "string" == typeof x.cacheType && "dom" == x.cacheType.toLowerCase() && r.children().length > 0 ? setTimeout(function () {
  11499. var e = r.children().clone(!0);e = e.not("script"), b.cache.add(n, e);
  11500. }, 0) : b.cache.add(n, r.html());
  11501. }, urlData: { tab: n } },
  11502. l = r.api("get request") || !1,
  11503. c = l && "pending" === l.state();n = n || t, a = b.cache.read(n), x.cache && a ? (b.activate.tab(t), b.debug("Adding cached content", n), x.loadOnce || ("once" == x.evaluateScripts ? b.update.content(t, a, !1) : b.update.content(t, a)), x.onLoad.call(r[0], t, v, y)) : c ? (b.set.loading(t), b.debug("Content is already loading", n)) : e.api !== i ? (o = e.extend(!0, {}, x.apiSettings, s), b.debug("Retrieving remote content", n, o), b.set.loading(t), r.api(o)) : b.error(k.api);
  11504. } }, activate: { all: function all(e) {
  11505. b.activate.tab(e), b.activate.navigation(e);
  11506. }, tab: function tab(e) {
  11507. var t = b.get.tabElement(e),
  11508. n = "siblings" == x.deactivate ? t.siblings(p) : p.not(t),
  11509. i = t.hasClass(C.active);b.verbose("Showing tab content for", t), i || (t.addClass(C.active), n.removeClass(C.active + " " + C.loading), t.length > 0 && x.onVisible.call(t[0], e));
  11510. }, navigation: function navigation(e) {
  11511. var t = b.get.navElement(e),
  11512. n = "siblings" == x.deactivate ? t.siblings(r) : r.not(t),
  11513. i = t.hasClass(C.active);b.verbose("Activating tab navigation for", t, e), i || (t.addClass(C.active), n.removeClass(C.active + " " + C.loading));
  11514. } }, deactivate: { all: function all() {
  11515. b.deactivate.navigation(), b.deactivate.tabs();
  11516. }, navigation: function navigation() {
  11517. r.removeClass(C.active);
  11518. }, tabs: function tabs() {
  11519. p.removeClass(C.active + " " + C.loading);
  11520. } }, is: { tab: function tab(e) {
  11521. return e !== i && b.get.tabElement(e).length > 0;
  11522. } }, get: { initialPath: function initialPath() {
  11523. return r.eq(0).data(w.tab) || p.eq(0).data(w.tab);
  11524. }, path: function path() {
  11525. return e.address.value();
  11526. }, defaultPathArray: function defaultPathArray(e) {
  11527. return b.utilities.pathToArray(b.get.defaultPath(e));
  11528. }, defaultPath: function defaultPath(e) {
  11529. var t = r.filter("[data-" + w.tab + '^="' + e + '/"]').eq(0).data(w.tab) || !1;if (t) {
  11530. if (b.debug("Found default tab", t), F < x.maxDepth) return F++, b.get.defaultPath(t);b.error(k.recursion);
  11531. } else b.debug("No default tabs found for", e, p);return F = 0, e;
  11532. }, navElement: function navElement(e) {
  11533. return e = e || h, r.filter("[data-" + w.tab + '="' + e + '"]');
  11534. }, tabElement: function tabElement(e) {
  11535. var t, n, i, o;return e = e || h, i = b.utilities.pathToArray(e), o = b.utilities.last(i), t = p.filter("[data-" + w.tab + '="' + e + '"]'), n = p.filter("[data-" + w.tab + '="' + o + '"]'), t.length > 0 ? t : n;
  11536. }, tab: function tab() {
  11537. return h;
  11538. } }, utilities: { filterArray: function filterArray(t, n) {
  11539. return e.grep(t, function (t) {
  11540. return -1 == e.inArray(t, n);
  11541. });
  11542. }, last: function last(t) {
  11543. return !!e.isArray(t) && t[t.length - 1];
  11544. }, pathToArray: function pathToArray(e) {
  11545. return e === i && (e = h), "string" == typeof e ? e.split("/") : [e];
  11546. }, arrayToPath: function arrayToPath(t) {
  11547. return !!e.isArray(t) && t.join("/");
  11548. } }, setting: function setting(t, n) {
  11549. if (b.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, x, t);else {
  11550. if (n === i) return x[t];e.isPlainObject(x[t]) ? e.extend(!0, x[t], n) : x[t] = n;
  11551. }
  11552. }, internal: function internal(t, n) {
  11553. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  11554. if (n === i) return b[t];b[t] = n;
  11555. }
  11556. }, debug: function debug() {
  11557. !x.silent && x.debug && (x.performance ? b.performance.log(arguments) : (b.debug = Function.prototype.bind.call(console.info, console, x.name + ":"), b.debug.apply(console, arguments)));
  11558. }, verbose: function verbose() {
  11559. !x.silent && x.verbose && x.debug && (x.performance ? b.performance.log(arguments) : (b.verbose = Function.prototype.bind.call(console.info, console, x.name + ":"), b.verbose.apply(console, arguments)));
  11560. }, error: function error() {
  11561. x.silent || (b.error = Function.prototype.bind.call(console.error, console, x.name + ":"), b.error.apply(console, arguments));
  11562. }, performance: { log: function log(e) {
  11563. var t, n;x.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: O, "Execution Time": n })), clearTimeout(b.performance.timer), b.performance.timer = setTimeout(b.performance.display, 500);
  11564. }, display: function display() {
  11565. var t = x.name + ":",
  11566. n = 0;l = !1, clearTimeout(b.performance.timer), e.each(c, function (e, t) {
  11567. n += t["Execution Time"];
  11568. }), t += " " + n + "ms", s && (t += " '" + s + "'"), (console.group !== i || console.table !== i) && c.length > 0 && (console.groupCollapsed(t), console.table ? console.table(c) : e.each(c, function (e, t) {
  11569. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11570. }), console.groupEnd()), c = [];
  11571. } }, invoke: function invoke(t, n, o) {
  11572. var r,
  11573. s,
  11574. l,
  11575. c = D;return n = n || f, o = O || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  11576. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11577. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (b.error(k.method, t), !1);c = c[o];
  11578. }
  11579. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  11580. } }, d ? (D === i && b.initialize(), b.invoke(u)) : (D !== i && D.invoke("destroy"), b.initialize());
  11581. }), a !== i ? a : this;
  11582. }, e.tab = function () {
  11583. e(t).tab.apply(this, arguments);
  11584. }, e.fn.tab.settings = { name: "Tab", namespace: "tab", silent: !1, debug: !1, verbose: !1, performance: !0, auto: !1, history: !1, historyType: "hash", path: !1, context: !1, childrenOnly: !1, maxDepth: 25, deactivate: "siblings", alwaysRefresh: !1, cache: !0, loadOnce: !1, cacheType: "response", ignoreFirstLoad: !1, apiSettings: !1, evaluateScripts: "once", onFirstLoad: function onFirstLoad(e, t, n) {}, onLoad: function onLoad(e, t, n) {}, onVisible: function onVisible(e, t, n) {}, onRequest: function onRequest(e, t, n) {}, templates: { determineTitle: function determineTitle(e) {} }, error: { api: "You attempted to load content without API module", method: "The method you called is not defined", missingTab: "Activated tab cannot be found. Tabs are case-sensitive.", noContent: "The tab you specified is missing a content url.", path: "History enabled, but no path was specified", recursion: "Max recursive depth reached", legacyInit: "onTabInit has been renamed to onFirstLoad in 2.0, please adjust your code.", legacyLoad: "onTabLoad has been renamed to onLoad in 2.0. Please adjust your code", state: "History requires Asual's Address library <https://github.com/asual/jquery-address>" }, metadata: { tab: "tab", loaded: "loaded", promise: "promise" }, className: { loading: "loading", active: "active" }, selector: { tabs: ".ui.tab", ui: ".ui" } };
  11585. }(jQuery, window, document), function (e, t, n, i) {
  11586. "use strict";
  11587. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.transition = function () {
  11588. var o,
  11589. a = e(this),
  11590. r = a.selector || "",
  11591. s = new Date().getTime(),
  11592. l = [],
  11593. c = arguments,
  11594. u = c[0],
  11595. d = [].slice.call(arguments, 1),
  11596. f = "string" == typeof u;t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;return a.each(function (t) {
  11597. var m,
  11598. g,
  11599. p,
  11600. h,
  11601. v,
  11602. b,
  11603. y,
  11604. x,
  11605. C,
  11606. w = e(this),
  11607. S = this;(C = { initialize: function initialize() {
  11608. m = C.get.settings.apply(S, c), h = m.className, p = m.error, v = m.metadata, x = "." + m.namespace, y = "module-" + m.namespace, g = w.data(y) || C, b = C.get.animationEndEvent(), f && (f = C.invoke(u)), !1 === f && (C.verbose("Converted arguments into settings object", m), m.interval ? C.delay(m.animate) : C.animate(), C.instantiate());
  11609. }, instantiate: function instantiate() {
  11610. C.verbose("Storing instance of module", C), g = C, w.data(y, g);
  11611. }, destroy: function destroy() {
  11612. C.verbose("Destroying previous module for", S), w.removeData(y);
  11613. }, refresh: function refresh() {
  11614. C.verbose("Refreshing display type on next animation"), delete C.displayType;
  11615. }, forceRepaint: function forceRepaint() {
  11616. C.verbose("Forcing element repaint");var e = w.parent(),
  11617. t = w.next();0 === t.length ? w.detach().appendTo(e) : w.detach().insertBefore(t);
  11618. }, repaint: function repaint() {
  11619. C.verbose("Repainting element");S.offsetWidth;
  11620. }, delay: function delay(e) {
  11621. var n,
  11622. o = C.get.animationDirection();o || (o = C.can.transition() ? C.get.direction() : "static"), e = e !== i ? e : m.interval, n = "auto" == m.reverse && o == h.outward || 1 == m.reverse ? (a.length - t) * m.interval : t * m.interval, C.debug("Delaying animation by", n), setTimeout(C.animate, n);
  11623. }, animate: function animate(e) {
  11624. if (m = e || m, !C.is.supported()) return C.error(p.support), !1;if (C.debug("Preparing animation", m.animation), C.is.animating()) {
  11625. if (m.queue) return !m.allowRepeats && C.has.direction() && C.is.occurring() && !0 !== C.queuing ? C.debug("Animation is currently occurring, preventing queueing same animation", m.animation) : C.queue(m.animation), !1;if (!m.allowRepeats && C.is.occurring()) return C.debug("Animation is already occurring, will not execute repeated animation", m.animation), !1;C.debug("New animation started, completing previous early", m.animation), g.complete();
  11626. }C.can.animate() ? C.set.animating(m.animation) : C.error(p.noAnimation, m.animation, S);
  11627. }, reset: function reset() {
  11628. C.debug("Resetting animation to beginning conditions"), C.remove.animationCallbacks(), C.restore.conditions(), C.remove.animating();
  11629. }, queue: function queue(e) {
  11630. C.debug("Queueing animation of", e), C.queuing = !0, w.one(b + ".queue" + x, function () {
  11631. C.queuing = !1, C.repaint(), C.animate.apply(this, m);
  11632. });
  11633. }, complete: function complete(e) {
  11634. C.debug("Animation complete", m.animation), C.remove.completeCallback(), C.remove.failSafe(), C.is.looping() || (C.is.outward() ? (C.verbose("Animation is outward, hiding element"), C.restore.conditions(), C.hide()) : C.is.inward() ? (C.verbose("Animation is outward, showing element"), C.restore.conditions(), C.show()) : (C.verbose("Static animation completed"), C.restore.conditions(), m.onComplete.call(S)));
  11635. }, force: { visible: function visible() {
  11636. var e = w.attr("style"),
  11637. t = C.get.userStyle(),
  11638. n = C.get.displayType(),
  11639. o = t + "display: " + n + " !important;",
  11640. a = w.css("display"),
  11641. r = e === i || "" === e;a !== n ? (C.verbose("Overriding default display to show element", n), w.attr("style", o)) : r && w.removeAttr("style");
  11642. }, hidden: function hidden() {
  11643. var e = w.attr("style"),
  11644. t = w.css("display"),
  11645. n = e === i || "" === e;"none" === t || C.is.hidden() ? n && w.removeAttr("style") : (C.verbose("Overriding default display to hide element"), w.css("display", "none"));
  11646. } }, has: { direction: function direction(t) {
  11647. var n = !1;return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  11648. t !== h.inward && t !== h.outward || (n = !0);
  11649. })), n;
  11650. }, inlineDisplay: function inlineDisplay() {
  11651. var t = w.attr("style") || "";return e.isArray(t.match(/display.*?;/, ""));
  11652. } }, set: { animating: function animating(e) {
  11653. var t;C.remove.completeCallback(), e = e || m.animation, t = C.get.animationClass(e), C.save.animation(t), C.force.visible(), C.remove.hidden(), C.remove.direction(), C.start.animation(t);
  11654. }, duration: function duration(e, t) {
  11655. ((t = "number" == typeof (t = t || m.duration) ? t + "ms" : t) || 0 === t) && (C.verbose("Setting animation duration", t), w.css({ "animation-duration": t }));
  11656. }, direction: function direction(e) {
  11657. (e = e || C.get.direction()) == h.inward ? C.set.inward() : C.set.outward();
  11658. }, looping: function looping() {
  11659. C.debug("Transition set to loop"), w.addClass(h.looping);
  11660. }, hidden: function hidden() {
  11661. w.addClass(h.transition).addClass(h.hidden);
  11662. }, inward: function inward() {
  11663. C.debug("Setting direction to inward"), w.removeClass(h.outward).addClass(h.inward);
  11664. }, outward: function outward() {
  11665. C.debug("Setting direction to outward"), w.removeClass(h.inward).addClass(h.outward);
  11666. }, visible: function visible() {
  11667. w.addClass(h.transition).addClass(h.visible);
  11668. } }, start: { animation: function animation(e) {
  11669. e = e || C.get.animationClass(), C.debug("Starting tween", e), w.addClass(e).one(b + ".complete" + x, C.complete), m.useFailSafe && C.add.failSafe(), C.set.duration(m.duration), m.onStart.call(S);
  11670. } }, save: { animation: function animation(e) {
  11671. C.cache || (C.cache = {}), C.cache.animation = e;
  11672. }, displayType: function displayType(e) {
  11673. "none" !== e && w.data(v.displayType, e);
  11674. }, transitionExists: function transitionExists(t, n) {
  11675. e.fn.transition.exists[t] = n, C.verbose("Saving existence of transition", t, n);
  11676. } }, restore: { conditions: function conditions() {
  11677. var e = C.get.currentAnimation();e && (w.removeClass(e), C.verbose("Removing animation class", C.cache)), C.remove.duration();
  11678. } }, add: { failSafe: function failSafe() {
  11679. var e = C.get.duration();C.timer = setTimeout(function () {
  11680. w.triggerHandler(b);
  11681. }, e + m.failSafeDelay), C.verbose("Adding fail safe timer", C.timer);
  11682. } }, remove: { animating: function animating() {
  11683. w.removeClass(h.animating);
  11684. }, animationCallbacks: function animationCallbacks() {
  11685. C.remove.queueCallback(), C.remove.completeCallback();
  11686. }, queueCallback: function queueCallback() {
  11687. w.off(".queue" + x);
  11688. }, completeCallback: function completeCallback() {
  11689. w.off(".complete" + x);
  11690. }, display: function display() {
  11691. w.css("display", "");
  11692. }, direction: function direction() {
  11693. w.removeClass(h.inward).removeClass(h.outward);
  11694. }, duration: function duration() {
  11695. w.css("animation-duration", "");
  11696. }, failSafe: function failSafe() {
  11697. C.verbose("Removing fail safe timer", C.timer), C.timer && clearTimeout(C.timer);
  11698. }, hidden: function hidden() {
  11699. w.removeClass(h.hidden);
  11700. }, visible: function visible() {
  11701. w.removeClass(h.visible);
  11702. }, looping: function looping() {
  11703. C.debug("Transitions are no longer looping"), C.is.looping() && (C.reset(), w.removeClass(h.looping));
  11704. }, transition: function transition() {
  11705. w.removeClass(h.visible).removeClass(h.hidden);
  11706. } }, get: { settings: function settings(t, n, i) {
  11707. return "object" == (typeof t === "undefined" ? "undefined" : _typeof(t)) ? e.extend(!0, {}, e.fn.transition.settings, t) : "function" == typeof i ? e.extend({}, e.fn.transition.settings, { animation: t, onComplete: i, duration: n }) : "string" == typeof n || "number" == typeof n ? e.extend({}, e.fn.transition.settings, { animation: t, duration: n }) : "object" == (typeof n === "undefined" ? "undefined" : _typeof(n)) ? e.extend({}, e.fn.transition.settings, n, { animation: t }) : "function" == typeof n ? e.extend({}, e.fn.transition.settings, { animation: t, onComplete: n }) : e.extend({}, e.fn.transition.settings, { animation: t });
  11708. }, animationClass: function animationClass(e) {
  11709. var t = e || m.animation,
  11710. n = C.can.transition() && !C.has.direction() ? C.get.direction() + " " : "";return h.animating + " " + h.transition + " " + n + t;
  11711. }, currentAnimation: function currentAnimation() {
  11712. return !(!C.cache || C.cache.animation === i) && C.cache.animation;
  11713. }, currentDirection: function currentDirection() {
  11714. return C.is.inward() ? h.inward : h.outward;
  11715. }, direction: function direction() {
  11716. return C.is.hidden() || !C.is.visible() ? h.inward : h.outward;
  11717. }, animationDirection: function animationDirection(t) {
  11718. var n;return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  11719. t === h.inward ? n = h.inward : t === h.outward && (n = h.outward);
  11720. })), n || !1;
  11721. }, duration: function duration(e) {
  11722. return !1 === (e = e || m.duration) && (e = w.css("animation-duration") || 0), "string" == typeof e ? e.indexOf("ms") > -1 ? parseFloat(e) : 1e3 * parseFloat(e) : e;
  11723. }, displayType: function displayType(e) {
  11724. return e = e === i || e, m.displayType ? m.displayType : (e && w.data(v.displayType) === i && C.can.transition(!0), w.data(v.displayType));
  11725. }, userStyle: function userStyle(e) {
  11726. return (e = e || w.attr("style") || "").replace(/display.*?;/, "");
  11727. }, transitionExists: function transitionExists(t) {
  11728. return e.fn.transition.exists[t];
  11729. }, animationStartEvent: function animationStartEvent() {
  11730. var e,
  11731. t = n.createElement("div"),
  11732. o = { animation: "animationstart", OAnimation: "oAnimationStart", MozAnimation: "mozAnimationStart", WebkitAnimation: "webkitAnimationStart" };for (e in o) {
  11733. if (t.style[e] !== i) return o[e];
  11734. }return !1;
  11735. }, animationEndEvent: function animationEndEvent() {
  11736. var e,
  11737. t = n.createElement("div"),
  11738. o = { animation: "animationend", OAnimation: "oAnimationEnd", MozAnimation: "mozAnimationEnd", WebkitAnimation: "webkitAnimationEnd" };for (e in o) {
  11739. if (t.style[e] !== i) return o[e];
  11740. }return !1;
  11741. } }, can: { transition: function transition(t) {
  11742. var n,
  11743. o,
  11744. a,
  11745. r,
  11746. s,
  11747. l,
  11748. c = m.animation,
  11749. u = C.get.transitionExists(c),
  11750. d = C.get.displayType(!1);if (u === i || t) {
  11751. if (C.verbose("Determining whether animation exists"), n = w.attr("class"), o = w.prop("tagName"), r = (a = e("<" + o + " />").addClass(n).insertAfter(w)).addClass(c).removeClass(h.inward).removeClass(h.outward).addClass(h.animating).addClass(h.transition).css("animationName"), s = a.addClass(h.inward).css("animationName"), d || (d = a.attr("class", n).removeAttr("style").removeClass(h.hidden).removeClass(h.visible).show().css("display"), C.verbose("Determining final display state", d), C.save.displayType(d)), a.remove(), r != s) C.debug("Direction exists for animation", c), l = !0;else {
  11752. if ("none" == r || !r) return void C.debug("No animation defined in css", c);C.debug("Static animation found", c, d), l = !1;
  11753. }C.save.transitionExists(c, l);
  11754. }return u !== i ? u : l;
  11755. }, animate: function animate() {
  11756. return C.can.transition() !== i;
  11757. } }, is: { animating: function animating() {
  11758. return w.hasClass(h.animating);
  11759. }, inward: function inward() {
  11760. return w.hasClass(h.inward);
  11761. }, outward: function outward() {
  11762. return w.hasClass(h.outward);
  11763. }, looping: function looping() {
  11764. return w.hasClass(h.looping);
  11765. }, occurring: function occurring(e) {
  11766. return e = "." + (e = e || m.animation).replace(" ", "."), w.filter(e).length > 0;
  11767. }, visible: function visible() {
  11768. return w.is(":visible");
  11769. }, hidden: function hidden() {
  11770. return "hidden" === w.css("visibility");
  11771. }, supported: function supported() {
  11772. return !1 !== b;
  11773. } }, hide: function hide() {
  11774. C.verbose("Hiding element"), C.is.animating() && C.reset(), S.blur(), C.remove.display(), C.remove.visible(), C.set.hidden(), C.force.hidden(), m.onHide.call(S), m.onComplete.call(S);
  11775. }, show: function show(e) {
  11776. C.verbose("Showing element", e), C.remove.hidden(), C.set.visible(), C.force.visible(), m.onShow.call(S), m.onComplete.call(S);
  11777. }, toggle: function toggle() {
  11778. C.is.visible() ? C.hide() : C.show();
  11779. }, stop: function stop() {
  11780. C.debug("Stopping current animation"), w.triggerHandler(b);
  11781. }, stopAll: function stopAll() {
  11782. C.debug("Stopping all animation"), C.remove.queueCallback(), w.triggerHandler(b);
  11783. }, clear: { queue: function queue() {
  11784. C.debug("Clearing animation queue"), C.remove.queueCallback();
  11785. } }, enable: function enable() {
  11786. C.verbose("Starting animation"), w.removeClass(h.disabled);
  11787. }, disable: function disable() {
  11788. C.debug("Stopping animation"), w.addClass(h.disabled);
  11789. }, setting: function setting(t, n) {
  11790. if (C.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  11791. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  11792. }
  11793. }, internal: function internal(t, n) {
  11794. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  11795. if (n === i) return C[t];C[t] = n;
  11796. }
  11797. }, debug: function debug() {
  11798. !m.silent && m.debug && (m.performance ? C.performance.log(arguments) : (C.debug = Function.prototype.bind.call(console.info, console, m.name + ":"), C.debug.apply(console, arguments)));
  11799. }, verbose: function verbose() {
  11800. !m.silent && m.verbose && m.debug && (m.performance ? C.performance.log(arguments) : (C.verbose = Function.prototype.bind.call(console.info, console, m.name + ":"), C.verbose.apply(console, arguments)));
  11801. }, error: function error() {
  11802. m.silent || (C.error = Function.prototype.bind.call(console.error, console, m.name + ":"), C.error.apply(console, arguments));
  11803. }, performance: { log: function log(e) {
  11804. var t, n;m.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: S, "Execution Time": n })), clearTimeout(C.performance.timer), C.performance.timer = setTimeout(C.performance.display, 500);
  11805. }, display: function display() {
  11806. var t = m.name + ":",
  11807. n = 0;s = !1, clearTimeout(C.performance.timer), e.each(l, function (e, t) {
  11808. n += t["Execution Time"];
  11809. }), t += " " + n + "ms", r && (t += " '" + r + "'"), a.length > 1 && (t += " (" + a.length + ")"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  11810. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11811. }), console.groupEnd()), l = [];
  11812. } }, invoke: function invoke(t, n, a) {
  11813. var r,
  11814. s,
  11815. l,
  11816. c = g;return n = n || d, a = S || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  11817. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11818. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  11819. }
  11820. })), e.isFunction(s) ? l = s.apply(a, n) : s !== i && (l = s), e.isArray(o) ? o.push(l) : o !== i ? o = [o, l] : l !== i && (o = l), s !== i && s;
  11821. } }).initialize();
  11822. }), o !== i ? o : this;
  11823. }, e.fn.transition.exists = {}, e.fn.transition.settings = { name: "Transition", silent: !1, debug: !1, verbose: !1, performance: !0, namespace: "transition", interval: 0, reverse: "auto", onStart: function onStart() {}, onComplete: function onComplete() {}, onShow: function onShow() {}, onHide: function onHide() {}, useFailSafe: !0, failSafeDelay: 100, allowRepeats: !1, displayType: !1, animation: "fade", duration: !1, queue: !0, metadata: { displayType: "display" }, className: { animating: "animating", disabled: "disabled", hidden: "hidden", inward: "in", loading: "loading", looping: "looping", outward: "out", transition: "transition", visible: "visible" }, error: { noAnimation: "Element is no longer attached to DOM. Unable to animate. Use silent setting to surpress this warning in production.", repeated: "That animation is already occurring, cancelling repeated animation", method: "The method you called is not defined", support: "This browser does not support CSS animations" } };
  11824. }(jQuery, window, document), function (e, t, n, i) {
  11825. "use strict";
  11826. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")();e.api = e.fn.api = function (n) {
  11827. var o,
  11828. a = e.isFunction(this) ? e(t) : e(this),
  11829. r = a.selector || "",
  11830. s = new Date().getTime(),
  11831. l = [],
  11832. c = arguments[0],
  11833. u = "string" == typeof c,
  11834. d = [].slice.call(arguments, 1);return a.each(function () {
  11835. var a,
  11836. f,
  11837. m,
  11838. g,
  11839. p,
  11840. h,
  11841. v = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.api.settings, n) : e.extend({}, e.fn.api.settings),
  11842. b = v.namespace,
  11843. y = v.metadata,
  11844. x = v.selector,
  11845. C = v.error,
  11846. w = v.className,
  11847. S = "." + b,
  11848. k = "module-" + b,
  11849. T = e(this),
  11850. A = T.closest(x.form),
  11851. R = v.stateContext ? e(v.stateContext) : T,
  11852. P = this,
  11853. E = R[0],
  11854. F = T.data(k);h = { initialize: function initialize() {
  11855. u || h.bind.events(), h.instantiate();
  11856. }, instantiate: function instantiate() {
  11857. h.verbose("Storing instance of module", h), F = h, T.data(k, F);
  11858. }, destroy: function destroy() {
  11859. h.verbose("Destroying previous module for", P), T.removeData(k).off(S);
  11860. }, bind: { events: function events() {
  11861. var e = h.get.event();e ? (h.verbose("Attaching API events to element", e), T.on(e + S, h.event.trigger)) : "now" == v.on && (h.debug("Querying API endpoint immediately"), h.query());
  11862. } }, decode: { json: function json(e) {
  11863. if (e !== i && "string" == typeof e) try {
  11864. e = JSON.parse(e);
  11865. } catch (e) {}return e;
  11866. } }, read: { cachedResponse: function cachedResponse(e) {
  11867. var n;if (t.Storage !== i) return n = sessionStorage.getItem(e), h.debug("Using cached response", e, n), n = h.decode.json(n);h.error(C.noStorage);
  11868. } }, write: { cachedResponse: function cachedResponse(n, o) {
  11869. o && "" === o ? h.debug("Response empty, not caching", o) : t.Storage !== i ? (e.isPlainObject(o) && (o = JSON.stringify(o)), sessionStorage.setItem(n, o), h.verbose("Storing cached response for url", n, o)) : h.error(C.noStorage);
  11870. } }, query: function query() {
  11871. if (h.is.disabled()) h.debug("Element is disabled API request aborted");else {
  11872. if (h.is.loading()) {
  11873. if (!v.interruptRequests) return void h.debug("Cancelling request, previous request is still pending");h.debug("Interrupting previous request"), h.abort();
  11874. }if (v.defaultData && e.extend(!0, v.urlData, h.get.defaultData()), v.serializeForm && (v.data = h.add.formData(v.data)), !1 === (f = h.get.settings())) return h.cancelled = !0, void h.error(C.beforeSend);if (h.cancelled = !1, (m = h.get.templatedURL()) || h.is.mocked()) {
  11875. if ((m = h.add.urlData(m)) || h.is.mocked()) {
  11876. if (f.url = v.base + m, a = e.extend(!0, {}, v, { type: v.method || v.type, data: g, url: v.base + m, beforeSend: v.beforeXHR, success: function success() {}, failure: function failure() {}, complete: function complete() {} }), h.debug("Querying URL", a.url), h.verbose("Using AJAX settings", a), "local" === v.cache && h.read.cachedResponse(m)) return h.debug("Response returned from local cache"), h.request = h.create.request(), void h.request.resolveWith(E, [h.read.cachedResponse(m)]);v.throttle ? v.throttleFirstRequest || h.timer ? (h.debug("Throttling request", v.throttle), clearTimeout(h.timer), h.timer = setTimeout(function () {
  11877. h.timer && delete h.timer, h.debug("Sending throttled request", g, a.method), h.send.request();
  11878. }, v.throttle)) : (h.debug("Sending request", g, a.method), h.send.request(), h.timer = setTimeout(function () {}, v.throttle)) : (h.debug("Sending request", g, a.method), h.send.request());
  11879. }
  11880. } else h.error(C.missingURL);
  11881. }
  11882. }, should: { removeError: function removeError() {
  11883. return !0 === v.hideError || "auto" === v.hideError && !h.is.form();
  11884. } }, is: { disabled: function disabled() {
  11885. return T.filter(x.disabled).length > 0;
  11886. }, expectingJSON: function expectingJSON() {
  11887. return "json" === v.dataType || "jsonp" === v.dataType;
  11888. }, form: function form() {
  11889. return T.is("form") || R.is("form");
  11890. }, mocked: function mocked() {
  11891. return v.mockResponse || v.mockResponseAsync || v.response || v.responseAsync;
  11892. }, input: function input() {
  11893. return T.is("input");
  11894. }, loading: function loading() {
  11895. return !!h.request && "pending" == h.request.state();
  11896. }, abortedRequest: function abortedRequest(e) {
  11897. return e && e.readyState !== i && 0 === e.readyState ? (h.verbose("XHR request determined to be aborted"), !0) : (h.verbose("XHR request was not aborted"), !1);
  11898. }, validResponse: function validResponse(t) {
  11899. return h.is.expectingJSON() && e.isFunction(v.successTest) ? (h.debug("Checking JSON returned success", v.successTest, t), v.successTest(t) ? (h.debug("Response passed success test", t), !0) : (h.debug("Response failed success test", t), !1)) : (h.verbose("Response is not JSON, skipping validation", v.successTest, t), !0);
  11900. } }, was: { cancelled: function cancelled() {
  11901. return h.cancelled || !1;
  11902. }, succesful: function succesful() {
  11903. return h.request && "resolved" == h.request.state();
  11904. }, failure: function failure() {
  11905. return h.request && "rejected" == h.request.state();
  11906. }, complete: function complete() {
  11907. return h.request && ("resolved" == h.request.state() || "rejected" == h.request.state());
  11908. } }, add: { urlData: function urlData(t, n) {
  11909. var o, a;return t && (o = t.match(v.regExp.required), a = t.match(v.regExp.optional), n = n || v.urlData, o && (h.debug("Looking for required URL variables", o), e.each(o, function (o, a) {
  11910. var r = -1 !== a.indexOf("$") ? a.substr(2, a.length - 3) : a.substr(1, a.length - 2),
  11911. s = e.isPlainObject(n) && n[r] !== i ? n[r] : T.data(r) !== i ? T.data(r) : R.data(r) !== i ? R.data(r) : n[r];if (s === i) return h.error(C.requiredParameter, r, t), t = !1, !1;h.verbose("Found required variable", r, s), s = v.encodeParameters ? h.get.urlEncodedValue(s) : s, t = t.replace(a, s);
  11912. })), a && (h.debug("Looking for optional URL variables", o), e.each(a, function (o, a) {
  11913. var r = -1 !== a.indexOf("$") ? a.substr(3, a.length - 4) : a.substr(2, a.length - 3),
  11914. s = e.isPlainObject(n) && n[r] !== i ? n[r] : T.data(r) !== i ? T.data(r) : R.data(r) !== i ? R.data(r) : n[r];s !== i ? (h.verbose("Optional variable Found", r, s), t = t.replace(a, s)) : (h.verbose("Optional variable not found", r), t = -1 !== t.indexOf("/" + a) ? t.replace("/" + a, "") : t.replace(a, ""));
  11915. }))), t;
  11916. }, formData: function formData(t) {
  11917. var n = e.fn.serializeObject !== i,
  11918. o = n ? A.serializeObject() : A.serialize();return t = t || v.data, e.isPlainObject(t) ? n ? (h.debug("Extending existing data with form data", t, o), t = e.extend(!0, {}, t, o)) : (h.error(C.missingSerialize), h.debug("Cant extend data. Replacing data with form data", t, o), t = o) : (h.debug("Adding form data", o), t = o), t;
  11919. } }, send: { request: function request() {
  11920. h.set.loading(), h.request = h.create.request(), h.is.mocked() ? h.mockedXHR = h.create.mockedXHR() : h.xhr = h.create.xhr(), v.onRequest.call(E, h.request, h.xhr);
  11921. } }, event: { trigger: function trigger(e) {
  11922. h.query(), "submit" != e.type && "click" != e.type || e.preventDefault();
  11923. }, xhr: { always: function always() {}, done: function done(t, n, i) {
  11924. var o = this,
  11925. a = new Date().getTime() - p,
  11926. r = v.loadingDuration - a,
  11927. s = !!e.isFunction(v.onResponse) && (h.is.expectingJSON() ? v.onResponse.call(o, e.extend(!0, {}, t)) : v.onResponse.call(o, t));r = r > 0 ? r : 0, s && (h.debug("Modified API response in onResponse callback", v.onResponse, s, t), t = s), r > 0 && h.debug("Response completed early delaying state change by", r), setTimeout(function () {
  11928. h.is.validResponse(t) ? h.request.resolveWith(o, [t, i]) : h.request.rejectWith(o, [i, "invalid"]);
  11929. }, r);
  11930. }, fail: function fail(e, t, n) {
  11931. var i = this,
  11932. o = new Date().getTime() - p,
  11933. a = v.loadingDuration - o;(a = a > 0 ? a : 0) > 0 && h.debug("Response completed early delaying state change by", a), setTimeout(function () {
  11934. h.is.abortedRequest(e) ? h.request.rejectWith(i, [e, "aborted", n]) : h.request.rejectWith(i, [e, "error", t, n]);
  11935. }, a);
  11936. } }, request: { done: function done(e, t) {
  11937. h.debug("Successful API Response", e), "local" === v.cache && m && (h.write.cachedResponse(m, e), h.debug("Saving server response locally", h.cache)), v.onSuccess.call(E, e, T, t);
  11938. }, complete: function complete(e, t) {
  11939. var n, i;h.was.succesful() ? (i = e, n = t) : (n = e, i = h.get.responseFromXHR(n)), h.remove.loading(), v.onComplete.call(E, i, T, n);
  11940. }, fail: function fail(e, t, n) {
  11941. var o = h.get.responseFromXHR(e),
  11942. r = h.get.errorFromRequest(o, t, n);if ("aborted" == t) return h.debug("XHR Aborted (Most likely caused by page navigation or CORS Policy)", t, n), v.onAbort.call(E, t, T, e), !0;"invalid" == t ? h.debug("JSON did not pass success test. A server-side error has most likely occurred", o) : "error" == t && e !== i && (h.debug("XHR produced a server error", t, n), 200 != e.status && n !== i && "" !== n && h.error(C.statusMessage + n, a.url), v.onError.call(E, r, T, e)), v.errorDuration && "aborted" !== t && (h.debug("Adding error state"), h.set.error(), h.should.removeError() && setTimeout(h.remove.error, v.errorDuration)), h.debug("API Request failed", r, e), v.onFailure.call(E, o, T, e);
  11943. } } }, create: { request: function request() {
  11944. return e.Deferred().always(h.event.request.complete).done(h.event.request.done).fail(h.event.request.fail);
  11945. }, mockedXHR: function mockedXHR() {
  11946. var t,
  11947. n,
  11948. i,
  11949. o = v.mockResponse || v.response,
  11950. a = v.mockResponseAsync || v.responseAsync;return i = e.Deferred().always(h.event.xhr.complete).done(h.event.xhr.done).fail(h.event.xhr.fail), o ? (e.isFunction(o) ? (h.debug("Using specified synchronous callback", o), n = o.call(E, f)) : (h.debug("Using settings specified response", o), n = o), i.resolveWith(E, [n, !1, { responseText: n }])) : e.isFunction(a) && (t = function t(e) {
  11951. h.debug("Async callback returned response", e), e ? i.resolveWith(E, [e, !1, { responseText: e }]) : i.rejectWith(E, [{ responseText: e }, !1, !1]);
  11952. }, h.debug("Using specified async response callback", a), a.call(E, f, t)), i;
  11953. }, xhr: function xhr() {
  11954. var t;return t = e.ajax(a).always(h.event.xhr.always).done(h.event.xhr.done).fail(h.event.xhr.fail), h.verbose("Created server request", t, a), t;
  11955. } }, set: { error: function error() {
  11956. h.verbose("Adding error state to element", R), R.addClass(w.error);
  11957. }, loading: function loading() {
  11958. h.verbose("Adding loading state to element", R), R.addClass(w.loading), p = new Date().getTime();
  11959. } }, remove: { error: function error() {
  11960. h.verbose("Removing error state from element", R), R.removeClass(w.error);
  11961. }, loading: function loading() {
  11962. h.verbose("Removing loading state from element", R), R.removeClass(w.loading);
  11963. } }, get: { responseFromXHR: function responseFromXHR(t) {
  11964. return !!e.isPlainObject(t) && (h.is.expectingJSON() ? h.decode.json(t.responseText) : t.responseText);
  11965. }, errorFromRequest: function errorFromRequest(t, n, o) {
  11966. return e.isPlainObject(t) && t.error !== i ? t.error : v.error[n] !== i ? v.error[n] : o;
  11967. }, request: function request() {
  11968. return h.request || !1;
  11969. }, xhr: function xhr() {
  11970. return h.xhr || !1;
  11971. }, settings: function settings() {
  11972. var t;return (t = v.beforeSend.call(E, v)) && (t.success !== i && (h.debug("Legacy success callback detected", t), h.error(C.legacyParameters, t.success), t.onSuccess = t.success), t.failure !== i && (h.debug("Legacy failure callback detected", t), h.error(C.legacyParameters, t.failure), t.onFailure = t.failure), t.complete !== i && (h.debug("Legacy complete callback detected", t), h.error(C.legacyParameters, t.complete), t.onComplete = t.complete)), t === i && h.error(C.noReturnedValue), !1 === t ? t : t !== i ? e.extend(!0, {}, t) : e.extend(!0, {}, v);
  11973. }, urlEncodedValue: function urlEncodedValue(e) {
  11974. var n = t.decodeURIComponent(e),
  11975. i = t.encodeURIComponent(e);return n !== e ? (h.debug("URL value is already encoded, avoiding double encoding", e), e) : (h.verbose("Encoding value using encodeURIComponent", e, i), i);
  11976. }, defaultData: function defaultData() {
  11977. var t = {};return e.isWindow(P) || (h.is.input() ? t.value = T.val() : h.is.form() || (t.text = T.text())), t;
  11978. }, event: function event() {
  11979. return e.isWindow(P) || "now" == v.on ? (h.debug("API called without element, no events attached"), !1) : "auto" == v.on ? T.is("input") ? P.oninput !== i ? "input" : P.onpropertychange !== i ? "propertychange" : "keyup" : T.is("form") ? "submit" : "click" : v.on;
  11980. }, templatedURL: function templatedURL(e) {
  11981. if (e = e || T.data(y.action) || v.action || !1, m = T.data(y.url) || v.url || !1) return h.debug("Using specified url", m), m;if (e) {
  11982. if (h.debug("Looking up url for action", e, v.api), v.api[e] === i && !h.is.mocked()) return void h.error(C.missingAction, v.action, v.api);m = v.api[e];
  11983. } else h.is.form() && (m = T.attr("action") || R.attr("action") || !1, h.debug("No url or action specified, defaulting to form action", m));return m;
  11984. } }, abort: function abort() {
  11985. var e = h.get.xhr();e && "resolved" !== e.state() && (h.debug("Cancelling API request"), e.abort());
  11986. }, reset: function reset() {
  11987. h.remove.error(), h.remove.loading();
  11988. }, setting: function setting(t, n) {
  11989. if (h.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, v, t);else {
  11990. if (n === i) return v[t];e.isPlainObject(v[t]) ? e.extend(!0, v[t], n) : v[t] = n;
  11991. }
  11992. }, internal: function internal(t, n) {
  11993. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  11994. if (n === i) return h[t];h[t] = n;
  11995. }
  11996. }, debug: function debug() {
  11997. !v.silent && v.debug && (v.performance ? h.performance.log(arguments) : (h.debug = Function.prototype.bind.call(console.info, console, v.name + ":"), h.debug.apply(console, arguments)));
  11998. }, verbose: function verbose() {
  11999. !v.silent && v.verbose && v.debug && (v.performance ? h.performance.log(arguments) : (h.verbose = Function.prototype.bind.call(console.info, console, v.name + ":"), h.verbose.apply(console, arguments)));
  12000. }, error: function error() {
  12001. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  12002. }, performance: { log: function log(e) {
  12003. var t, n;v.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", "Execution Time": n })), clearTimeout(h.performance.timer), h.performance.timer = setTimeout(h.performance.display, 500);
  12004. }, display: function display() {
  12005. var t = v.name + ":",
  12006. n = 0;s = !1, clearTimeout(h.performance.timer), e.each(l, function (e, t) {
  12007. n += t["Execution Time"];
  12008. }), t += " " + n + "ms", r && (t += " '" + r + "'"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  12009. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12010. }), console.groupEnd()), l = [];
  12011. } }, invoke: function invoke(t, n, a) {
  12012. var r,
  12013. s,
  12014. l,
  12015. c = F;return n = n || d, a = P || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  12016. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  12017. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (h.error(C.method, t), !1);c = c[o];
  12018. }
  12019. })), e.isFunction(s) ? l = s.apply(a, n) : s !== i && (l = s), e.isArray(o) ? o.push(l) : o !== i ? o = [o, l] : l !== i && (o = l), s;
  12020. } }, u ? (F === i && h.initialize(), h.invoke(c)) : (F !== i && F.invoke("destroy"), h.initialize());
  12021. }), o !== i ? o : this;
  12022. }, e.api.settings = { name: "API", namespace: "api", debug: !1, verbose: !1, performance: !0, api: {}, cache: !0, interruptRequests: !0, on: "auto", stateContext: !1, loadingDuration: 0, hideError: "auto", errorDuration: 2e3, encodeParameters: !0, action: !1, url: !1, base: "", urlData: {}, defaultData: !0, serializeForm: !1, throttle: 0, throttleFirstRequest: !0, method: "get", data: {}, dataType: "json", mockResponse: !1, mockResponseAsync: !1, response: !1, responseAsync: !1, beforeSend: function beforeSend(e) {
  12023. return e;
  12024. }, beforeXHR: function beforeXHR(e) {}, onRequest: function onRequest(e, t) {}, onResponse: !1, onSuccess: function onSuccess(e, t) {}, onComplete: function onComplete(e, t) {}, onFailure: function onFailure(e, t) {}, onError: function onError(e, t) {}, onAbort: function onAbort(e, t) {}, successTest: !1, error: { beforeSend: "The before send function has aborted the request", error: "There was an error with your request", exitConditions: "API Request Aborted. Exit conditions met", JSONParse: "JSON could not be parsed during error handling", legacyParameters: "You are using legacy API success callback names", method: "The method you called is not defined", missingAction: "API action used but no url was defined", missingSerialize: "jquery-serialize-object is required to add form data to an existing data object", missingURL: "No URL specified for api event", noReturnedValue: "The beforeSend callback must return a settings object, beforeSend ignored.", noStorage: "Caching responses locally requires session storage", parseError: "There was an error parsing your request", requiredParameter: "Missing a required URL parameter: ", statusMessage: "Server gave an error: ", timeout: "Your request timed out" }, regExp: { required: /\{\$*[A-z0-9]+\}/g, optional: /\{\/\$*[A-z0-9]+\}/g }, className: { loading: "loading", error: "error" }, selector: { disabled: ".disabled", form: "form" }, metadata: { action: "action", url: "url" } };
  12025. }(jQuery, window, document), function (e, t, n, i) {
  12026. "use strict";
  12027. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.visibility = function (o) {
  12028. var a,
  12029. r = e(this),
  12030. s = r.selector || "",
  12031. l = new Date().getTime(),
  12032. c = [],
  12033. u = arguments[0],
  12034. d = "string" == typeof u,
  12035. f = [].slice.call(arguments, 1),
  12036. m = r.length,
  12037. g = 0;return r.each(function () {
  12038. var r,
  12039. p,
  12040. h,
  12041. v,
  12042. b = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.visibility.settings, o) : e.extend({}, e.fn.visibility.settings),
  12043. y = b.className,
  12044. x = b.namespace,
  12045. C = b.error,
  12046. w = b.metadata,
  12047. S = "." + x,
  12048. k = "module-" + x,
  12049. T = e(t),
  12050. A = e(this),
  12051. R = e(b.context),
  12052. P = (A.selector, A.data(k)),
  12053. E = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  12054. setTimeout(e, 0);
  12055. },
  12056. F = this,
  12057. O = !1;v = { initialize: function initialize() {
  12058. v.debug("Initializing", b), v.setup.cache(), v.should.trackChanges() && ("image" == b.type && v.setup.image(), "fixed" == b.type && v.setup.fixed(), b.observeChanges && v.observeChanges(), v.bind.events()), v.save.position(), v.is.visible() || v.error(C.visible, A), b.initialCheck && v.checkVisibility(), v.instantiate();
  12059. }, instantiate: function instantiate() {
  12060. v.debug("Storing instance", v), A.data(k, v), P = v;
  12061. }, destroy: function destroy() {
  12062. v.verbose("Destroying previous module"), h && h.disconnect(), p && p.disconnect(), T.off("load" + S, v.event.load).off("resize" + S, v.event.resize), R.off("scroll" + S, v.event.scroll).off("scrollchange" + S, v.event.scrollchange), "fixed" == b.type && (v.resetFixed(), v.remove.placeholder()), A.off(S).removeData(k);
  12063. }, observeChanges: function observeChanges() {
  12064. "MutationObserver" in t && (p = new MutationObserver(v.event.contextChanged), h = new MutationObserver(v.event.changed), p.observe(n, { childList: !0, subtree: !0 }), h.observe(F, { childList: !0, subtree: !0 }), v.debug("Setting up mutation observer", h));
  12065. }, bind: { events: function events() {
  12066. v.verbose("Binding visibility events to scroll and resize"), b.refreshOnLoad && T.on("load" + S, v.event.load), T.on("resize" + S, v.event.resize), R.off("scroll" + S).on("scroll" + S, v.event.scroll).on("scrollchange" + S, v.event.scrollchange);
  12067. } }, event: { changed: function changed(e) {
  12068. v.verbose("DOM tree modified, updating visibility calculations"), v.timer = setTimeout(function () {
  12069. v.verbose("DOM tree modified, updating sticky menu"), v.refresh();
  12070. }, 100);
  12071. }, contextChanged: function contextChanged(t) {
  12072. [].forEach.call(t, function (t) {
  12073. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  12074. (t == F || e(t).find(F).length > 0) && (v.debug("Element removed from DOM, tearing down events"), v.destroy());
  12075. });
  12076. });
  12077. }, resize: function resize() {
  12078. v.debug("Window resized"), b.refreshOnResize && E(v.refresh);
  12079. }, load: function load() {
  12080. v.debug("Page finished loading"), E(v.refresh);
  12081. }, scroll: function scroll() {
  12082. b.throttle ? (clearTimeout(v.timer), v.timer = setTimeout(function () {
  12083. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  12084. }, b.throttle)) : E(function () {
  12085. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  12086. });
  12087. }, scrollchange: function scrollchange(e, t) {
  12088. v.checkVisibility(t);
  12089. } }, precache: function precache(t, i) {
  12090. t instanceof Array || (t = [t]);for (var o = t.length, a = 0, r = [], s = n.createElement("img"), l = function l() {
  12091. ++a >= t.length && e.isFunction(i) && i();
  12092. }; o--;) {
  12093. (s = n.createElement("img")).onload = l, s.onerror = l, s.src = t[o], r.push(s);
  12094. }
  12095. }, enableCallbacks: function enableCallbacks() {
  12096. v.debug("Allowing callbacks to occur"), O = !1;
  12097. }, disableCallbacks: function disableCallbacks() {
  12098. v.debug("Disabling all callbacks temporarily"), O = !0;
  12099. }, should: { trackChanges: function trackChanges() {
  12100. return d ? (v.debug("One time query, no need to bind events"), !1) : (v.debug("Callbacks being attached"), !0);
  12101. } }, setup: { cache: function cache() {
  12102. v.cache = { occurred: {}, screen: {}, element: {} };
  12103. }, image: function image() {
  12104. var e = A.data(w.src);e && (v.verbose("Lazy loading image", e), b.once = !0, b.observeChanges = !1, b.onOnScreen = function () {
  12105. v.debug("Image on screen", F), v.precache(e, function () {
  12106. v.set.image(e, function () {
  12107. ++g == m && b.onAllLoaded.call(this), b.onLoad.call(this);
  12108. });
  12109. });
  12110. });
  12111. }, fixed: function fixed() {
  12112. v.debug("Setting up fixed"), b.once = !1, b.observeChanges = !1, b.initialCheck = !0, b.refreshOnLoad = !0, o.transition || (b.transition = !1), v.create.placeholder(), v.debug("Added placeholder", r), b.onTopPassed = function () {
  12113. v.debug("Element passed, adding fixed position", A), v.show.placeholder(), v.set.fixed(), b.transition && e.fn.transition !== i && A.transition(b.transition, b.duration);
  12114. }, b.onTopPassedReverse = function () {
  12115. v.debug("Element returned to position, removing fixed", A), v.hide.placeholder(), v.remove.fixed();
  12116. };
  12117. } }, create: { placeholder: function placeholder() {
  12118. v.verbose("Creating fixed position placeholder"), r = A.clone(!1).css("display", "none").addClass(y.placeholder).insertAfter(A);
  12119. } }, show: { placeholder: function placeholder() {
  12120. v.verbose("Showing placeholder"), r.css("display", "block").css("visibility", "hidden");
  12121. } }, hide: { placeholder: function placeholder() {
  12122. v.verbose("Hiding placeholder"), r.css("display", "none").css("visibility", "");
  12123. } }, set: { fixed: function fixed() {
  12124. v.verbose("Setting element to fixed position"), A.addClass(y.fixed).css({ position: "fixed", top: b.offset + "px", left: "auto", zIndex: b.zIndex }), b.onFixed.call(F);
  12125. }, image: function image(t, n) {
  12126. if (A.attr("src", t), b.transition) {
  12127. if (e.fn.transition !== i) {
  12128. if (A.hasClass(y.visible)) return void v.debug("Transition already occurred on this image, skipping animation");A.transition(b.transition, b.duration, n);
  12129. } else A.fadeIn(b.duration, n);
  12130. } else A.show();
  12131. } }, is: { onScreen: function onScreen() {
  12132. return v.get.elementCalculations().onScreen;
  12133. }, offScreen: function offScreen() {
  12134. return v.get.elementCalculations().offScreen;
  12135. }, visible: function visible() {
  12136. return !(!v.cache || !v.cache.element) && !(0 === v.cache.element.width && 0 === v.cache.element.offset.top);
  12137. }, verticallyScrollableContext: function verticallyScrollableContext() {
  12138. var e = R.get(0) !== t && R.css("overflow-y");return "auto" == e || "scroll" == e;
  12139. }, horizontallyScrollableContext: function horizontallyScrollableContext() {
  12140. var e = R.get(0) !== t && R.css("overflow-x");return "auto" == e || "scroll" == e;
  12141. } }, refresh: function refresh() {
  12142. v.debug("Refreshing constants (width/height)"), "fixed" == b.type && v.resetFixed(), v.reset(), v.save.position(), b.checkOnRefresh && v.checkVisibility(), b.onRefresh.call(F);
  12143. }, resetFixed: function resetFixed() {
  12144. v.remove.fixed(), v.remove.occurred();
  12145. }, reset: function reset() {
  12146. v.verbose("Resetting all cached values"), e.isPlainObject(v.cache) && (v.cache.screen = {}, v.cache.element = {});
  12147. }, checkVisibility: function checkVisibility(e) {
  12148. v.verbose("Checking visibility of element", v.cache.element), !O && v.is.visible() && (v.save.scroll(e), v.save.calculations(), v.passed(), v.passingReverse(), v.topVisibleReverse(), v.bottomVisibleReverse(), v.topPassedReverse(), v.bottomPassedReverse(), v.onScreen(), v.offScreen(), v.passing(), v.topVisible(), v.bottomVisible(), v.topPassed(), v.bottomPassed(), b.onUpdate && b.onUpdate.call(F, v.get.elementCalculations()));
  12149. }, passed: function passed(t, n) {
  12150. var o = v.get.elementCalculations();if (t && n) b.onPassed[t] = n;else {
  12151. if (t !== i) return v.get.pixelsPassed(t) > o.pixelsPassed;o.passing && e.each(b.onPassed, function (e, t) {
  12152. o.bottomVisible || o.pixelsPassed > v.get.pixelsPassed(e) ? v.execute(t, e) : b.once || v.remove.occurred(t);
  12153. });
  12154. }
  12155. }, onScreen: function onScreen(e) {
  12156. var t = v.get.elementCalculations(),
  12157. n = e || b.onOnScreen,
  12158. o = "onScreen";if (e && (v.debug("Adding callback for onScreen", e), b.onOnScreen = e), t.onScreen ? v.execute(n, o) : b.once || v.remove.occurred(o), e !== i) return t.onOnScreen;
  12159. }, offScreen: function offScreen(e) {
  12160. var t = v.get.elementCalculations(),
  12161. n = e || b.onOffScreen,
  12162. o = "offScreen";if (e && (v.debug("Adding callback for offScreen", e), b.onOffScreen = e), t.offScreen ? v.execute(n, o) : b.once || v.remove.occurred(o), e !== i) return t.onOffScreen;
  12163. }, passing: function passing(e) {
  12164. var t = v.get.elementCalculations(),
  12165. n = e || b.onPassing,
  12166. o = "passing";if (e && (v.debug("Adding callback for passing", e), b.onPassing = e), t.passing ? v.execute(n, o) : b.once || v.remove.occurred(o), e !== i) return t.passing;
  12167. }, topVisible: function topVisible(e) {
  12168. var t = v.get.elementCalculations(),
  12169. n = e || b.onTopVisible,
  12170. o = "topVisible";if (e && (v.debug("Adding callback for top visible", e), b.onTopVisible = e), t.topVisible ? v.execute(n, o) : b.once || v.remove.occurred(o), e === i) return t.topVisible;
  12171. }, bottomVisible: function bottomVisible(e) {
  12172. var t = v.get.elementCalculations(),
  12173. n = e || b.onBottomVisible,
  12174. o = "bottomVisible";if (e && (v.debug("Adding callback for bottom visible", e), b.onBottomVisible = e), t.bottomVisible ? v.execute(n, o) : b.once || v.remove.occurred(o), e === i) return t.bottomVisible;
  12175. }, topPassed: function topPassed(e) {
  12176. var t = v.get.elementCalculations(),
  12177. n = e || b.onTopPassed,
  12178. o = "topPassed";if (e && (v.debug("Adding callback for top passed", e), b.onTopPassed = e), t.topPassed ? v.execute(n, o) : b.once || v.remove.occurred(o), e === i) return t.topPassed;
  12179. }, bottomPassed: function bottomPassed(e) {
  12180. var t = v.get.elementCalculations(),
  12181. n = e || b.onBottomPassed,
  12182. o = "bottomPassed";if (e && (v.debug("Adding callback for bottom passed", e), b.onBottomPassed = e), t.bottomPassed ? v.execute(n, o) : b.once || v.remove.occurred(o), e === i) return t.bottomPassed;
  12183. }, passingReverse: function passingReverse(e) {
  12184. var t = v.get.elementCalculations(),
  12185. n = e || b.onPassingReverse,
  12186. o = "passingReverse";if (e && (v.debug("Adding callback for passing reverse", e), b.onPassingReverse = e), t.passing ? b.once || v.remove.occurred(o) : v.get.occurred("passing") && v.execute(n, o), e !== i) return !t.passing;
  12187. }, topVisibleReverse: function topVisibleReverse(e) {
  12188. var t = v.get.elementCalculations(),
  12189. n = e || b.onTopVisibleReverse,
  12190. o = "topVisibleReverse";if (e && (v.debug("Adding callback for top visible reverse", e), b.onTopVisibleReverse = e), t.topVisible ? b.once || v.remove.occurred(o) : v.get.occurred("topVisible") && v.execute(n, o), e === i) return !t.topVisible;
  12191. }, bottomVisibleReverse: function bottomVisibleReverse(e) {
  12192. var t = v.get.elementCalculations(),
  12193. n = e || b.onBottomVisibleReverse,
  12194. o = "bottomVisibleReverse";if (e && (v.debug("Adding callback for bottom visible reverse", e), b.onBottomVisibleReverse = e), t.bottomVisible ? b.once || v.remove.occurred(o) : v.get.occurred("bottomVisible") && v.execute(n, o), e === i) return !t.bottomVisible;
  12195. }, topPassedReverse: function topPassedReverse(e) {
  12196. var t = v.get.elementCalculations(),
  12197. n = e || b.onTopPassedReverse,
  12198. o = "topPassedReverse";if (e && (v.debug("Adding callback for top passed reverse", e), b.onTopPassedReverse = e), t.topPassed ? b.once || v.remove.occurred(o) : v.get.occurred("topPassed") && v.execute(n, o), e === i) return !t.onTopPassed;
  12199. }, bottomPassedReverse: function bottomPassedReverse(e) {
  12200. var t = v.get.elementCalculations(),
  12201. n = e || b.onBottomPassedReverse,
  12202. o = "bottomPassedReverse";if (e && (v.debug("Adding callback for bottom passed reverse", e), b.onBottomPassedReverse = e), t.bottomPassed ? b.once || v.remove.occurred(o) : v.get.occurred("bottomPassed") && v.execute(n, o), e === i) return !t.bottomPassed;
  12203. }, execute: function execute(e, t) {
  12204. var n = v.get.elementCalculations(),
  12205. i = v.get.screenCalculations();(e = e || !1) && (b.continuous ? (v.debug("Callback being called continuously", t, n), e.call(F, n, i)) : v.get.occurred(t) || (v.debug("Conditions met", t, n), e.call(F, n, i))), v.save.occurred(t);
  12206. }, remove: { fixed: function fixed() {
  12207. v.debug("Removing fixed position"), A.removeClass(y.fixed).css({ position: "", top: "", left: "", zIndex: "" }), b.onUnfixed.call(F);
  12208. }, placeholder: function placeholder() {
  12209. v.debug("Removing placeholder content"), r && r.remove();
  12210. }, occurred: function occurred(e) {
  12211. if (e) {
  12212. var t = v.cache.occurred;t[e] !== i && !0 === t[e] && (v.debug("Callback can now be called again", e), v.cache.occurred[e] = !1);
  12213. } else v.cache.occurred = {};
  12214. } }, save: { calculations: function calculations() {
  12215. v.verbose("Saving all calculations necessary to determine positioning"), v.save.direction(), v.save.screenCalculations(), v.save.elementCalculations();
  12216. }, occurred: function occurred(e) {
  12217. e && (v.cache.occurred[e] !== i && !0 === v.cache.occurred[e] || (v.verbose("Saving callback occurred", e), v.cache.occurred[e] = !0));
  12218. }, scroll: function scroll(e) {
  12219. e = e + b.offset || R.scrollTop() + b.offset, v.cache.scroll = e;
  12220. }, direction: function direction() {
  12221. var e,
  12222. t = v.get.scroll(),
  12223. n = v.get.lastScroll();return e = t > n && n ? "down" : t < n && n ? "up" : "static", v.cache.direction = e, v.cache.direction;
  12224. }, elementPosition: function elementPosition() {
  12225. var e = v.cache.element,
  12226. t = v.get.screenSize();return v.verbose("Saving element position"), e.fits = e.height < t.height, e.offset = A.offset(), e.width = A.outerWidth(), e.height = A.outerHeight(), v.is.verticallyScrollableContext() && (e.offset.top += R.scrollTop() - R.offset().top), v.is.horizontallyScrollableContext() && (e.offset.left += R.scrollLeft - R.offset().left), v.cache.element = e, e;
  12227. }, elementCalculations: function elementCalculations() {
  12228. var e = v.get.screenCalculations(),
  12229. t = v.get.elementPosition();return b.includeMargin ? (t.margin = {}, t.margin.top = parseInt(A.css("margin-top"), 10), t.margin.bottom = parseInt(A.css("margin-bottom"), 10), t.top = t.offset.top - t.margin.top, t.bottom = t.offset.top + t.height + t.margin.bottom) : (t.top = t.offset.top, t.bottom = t.offset.top + t.height), t.topPassed = e.top >= t.top, t.bottomPassed = e.top >= t.bottom, t.topVisible = e.bottom >= t.top && !t.topPassed, t.bottomVisible = e.bottom >= t.bottom && !t.bottomPassed, t.pixelsPassed = 0, t.percentagePassed = 0, t.onScreen = (t.topVisible || t.passing) && !t.bottomPassed, t.passing = t.topPassed && !t.bottomPassed, t.offScreen = !t.onScreen, t.passing && (t.pixelsPassed = e.top - t.top, t.percentagePassed = (e.top - t.top) / t.height), v.cache.element = t, v.verbose("Updated element calculations", t), t;
  12230. }, screenCalculations: function screenCalculations() {
  12231. var e = v.get.scroll();return v.save.direction(), v.cache.screen.top = e, v.cache.screen.bottom = e + v.cache.screen.height, v.cache.screen;
  12232. }, screenSize: function screenSize() {
  12233. v.verbose("Saving window position"), v.cache.screen = { height: R.height() };
  12234. }, position: function position() {
  12235. v.save.screenSize(), v.save.elementPosition();
  12236. } }, get: { pixelsPassed: function pixelsPassed(e) {
  12237. var t = v.get.elementCalculations();return e.search("%") > -1 ? t.height * (parseInt(e, 10) / 100) : parseInt(e, 10);
  12238. }, occurred: function occurred(e) {
  12239. return v.cache.occurred !== i && v.cache.occurred[e] || !1;
  12240. }, direction: function direction() {
  12241. return v.cache.direction === i && v.save.direction(), v.cache.direction;
  12242. }, elementPosition: function elementPosition() {
  12243. return v.cache.element === i && v.save.elementPosition(), v.cache.element;
  12244. }, elementCalculations: function elementCalculations() {
  12245. return v.cache.element === i && v.save.elementCalculations(), v.cache.element;
  12246. }, screenCalculations: function screenCalculations() {
  12247. return v.cache.screen === i && v.save.screenCalculations(), v.cache.screen;
  12248. }, screenSize: function screenSize() {
  12249. return v.cache.screen === i && v.save.screenSize(), v.cache.screen;
  12250. }, scroll: function scroll() {
  12251. return v.cache.scroll === i && v.save.scroll(), v.cache.scroll;
  12252. }, lastScroll: function lastScroll() {
  12253. return v.cache.screen === i ? (v.debug("First scroll event, no last scroll could be found"), !1) : v.cache.screen.top;
  12254. } }, setting: function setting(t, n) {
  12255. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  12256. if (n === i) return b[t];b[t] = n;
  12257. }
  12258. }, internal: function internal(t, n) {
  12259. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  12260. if (n === i) return v[t];v[t] = n;
  12261. }
  12262. }, debug: function debug() {
  12263. !b.silent && b.debug && (b.performance ? v.performance.log(arguments) : (v.debug = Function.prototype.bind.call(console.info, console, b.name + ":"), v.debug.apply(console, arguments)));
  12264. }, verbose: function verbose() {
  12265. !b.silent && b.verbose && b.debug && (b.performance ? v.performance.log(arguments) : (v.verbose = Function.prototype.bind.call(console.info, console, b.name + ":"), v.verbose.apply(console, arguments)));
  12266. }, error: function error() {
  12267. b.silent || (v.error = Function.prototype.bind.call(console.error, console, b.name + ":"), v.error.apply(console, arguments));
  12268. }, performance: { log: function log(e) {
  12269. var t, n;b.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: F, "Execution Time": n })), clearTimeout(v.performance.timer), v.performance.timer = setTimeout(v.performance.display, 500);
  12270. }, display: function display() {
  12271. var t = b.name + ":",
  12272. n = 0;l = !1, clearTimeout(v.performance.timer), e.each(c, function (e, t) {
  12273. n += t["Execution Time"];
  12274. }), t += " " + n + "ms", s && (t += " '" + s + "'"), (console.group !== i || console.table !== i) && c.length > 0 && (console.groupCollapsed(t), console.table ? console.table(c) : e.each(c, function (e, t) {
  12275. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12276. }), console.groupEnd()), c = [];
  12277. } }, invoke: function invoke(t, n, o) {
  12278. var r,
  12279. s,
  12280. l,
  12281. c = P;return n = n || f, o = F || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  12282. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  12283. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (v.error(C.method, t), !1);c = c[o];
  12284. }
  12285. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  12286. } }, d ? (P === i && v.initialize(), P.save.scroll(), P.save.calculations(), v.invoke(u)) : (P !== i && P.invoke("destroy"), v.initialize());
  12287. }), a !== i ? a : this;
  12288. }, e.fn.visibility.settings = { name: "Visibility", namespace: "visibility", debug: !1, verbose: !1, performance: !0, observeChanges: !0, initialCheck: !0, refreshOnLoad: !0, refreshOnResize: !0, checkOnRefresh: !0, once: !0, continuous: !1, offset: 0, includeMargin: !1, context: t, throttle: !1, type: !1, zIndex: "10", transition: "fade in", duration: 1e3, onPassed: {}, onOnScreen: !1, onOffScreen: !1, onPassing: !1, onTopVisible: !1, onBottomVisible: !1, onTopPassed: !1, onBottomPassed: !1, onPassingReverse: !1, onTopVisibleReverse: !1, onBottomVisibleReverse: !1, onTopPassedReverse: !1, onBottomPassedReverse: !1, onLoad: function onLoad() {}, onAllLoaded: function onAllLoaded() {}, onFixed: function onFixed() {}, onUnfixed: function onUnfixed() {}, onUpdate: !1, onRefresh: function onRefresh() {}, metadata: { src: "src" }, className: { fixed: "fixed", placeholder: "placeholder", visible: "visible" }, error: { method: "The method you called is not defined.", visible: "Element is hidden, you must call refresh after element becomes visible" } };
  12289. }(jQuery, window, document);
  12290. /***/ }),
  12291. /***/ "./js/services/languageService.js":
  12292. /*!****************************************!*\
  12293. !*** ./js/services/languageService.js ***!
  12294. \****************************************/
  12295. /*! no static exports found */
  12296. /***/ (function(module, exports, __webpack_require__) {
  12297. "use strict";
  12298. Object.defineProperty(exports, "__esModule", {
  12299. value: true
  12300. });
  12301. exports.LanguageService = undefined;
  12302. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  12303. var _grammar = __webpack_require__(/*! ./../../grammar/ */ "./grammar/index.js");
  12304. var _grammar2 = _interopRequireDefault(_grammar);
  12305. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  12306. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  12307. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12308. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  12309. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  12310. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  12311. var DEFAULT_LANG = "pt";
  12312. var LanguageServiceExtended = function (_line_i18n$LanguageSe) {
  12313. _inherits(LanguageServiceExtended, _line_i18n$LanguageSe);
  12314. function LanguageServiceExtended() {
  12315. _classCallCheck(this, LanguageServiceExtended);
  12316. return _possibleConstructorReturn(this, (LanguageServiceExtended.__proto__ || Object.getPrototypeOf(LanguageServiceExtended)).call(this, "ivprog.lang", DEFAULT_LANG));
  12317. }
  12318. _createClass(LanguageServiceExtended, [{
  12319. key: 'getCurrentLexer',
  12320. value: function getCurrentLexer() {
  12321. var langInfo = _grammar2.default[this.getLang()];
  12322. if (langInfo === null || langInfo === undefined) {
  12323. return _grammar2.default[this.getDefaultLang()].lexer;
  12324. } else {
  12325. return langInfo.lexer;
  12326. }
  12327. }
  12328. }, {
  12329. key: 'getCurrentLangFuncs',
  12330. value: function getCurrentLangFuncs() {
  12331. var langInfo = _grammar2.default[this.getLang()];
  12332. if (langInfo === null || langInfo === undefined) {
  12333. return _grammar2.default[this.getDefaultLang()].langFuncs;
  12334. } else {
  12335. return langInfo.langFuncs;
  12336. }
  12337. }
  12338. }, {
  12339. key: 'getCurrentLangLibs',
  12340. value: function getCurrentLangLibs() {
  12341. var langInfo = _grammar2.default[this.getLang()];
  12342. if (langInfo === null || langInfo === undefined) {
  12343. return _grammar2.default[this.getDefaultLang()].langLibs;
  12344. }
  12345. return langInfo.langLibs;
  12346. }
  12347. }]);
  12348. return LanguageServiceExtended;
  12349. }(_lineI18n2.default.LanguageService);
  12350. var LanguageService = exports.LanguageService = Object.freeze(new LanguageServiceExtended());
  12351. /***/ }),
  12352. /***/ "./js/services/localizedStringsService.js":
  12353. /*!************************************************!*\
  12354. !*** ./js/services/localizedStringsService.js ***!
  12355. \************************************************/
  12356. /*! no static exports found */
  12357. /***/ (function(module, exports, __webpack_require__) {
  12358. "use strict";
  12359. Object.defineProperty(exports, "__esModule", {
  12360. value: true
  12361. });
  12362. exports.LocalizedStrings = undefined;
  12363. var _languageService = __webpack_require__(/*! ./languageService */ "./js/services/languageService.js");
  12364. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  12365. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  12366. var _i18n = __webpack_require__(/*! ./../../i18n */ "./i18n/index.js");
  12367. var _i18n2 = _interopRequireDefault(_i18n);
  12368. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12369. var LocalizedStrings = exports.LocalizedStrings = Object.freeze(new _lineI18n2.default.LocalizedStrings(_languageService.LanguageService, _i18n2.default, true));
  12370. /***/ }),
  12371. /***/ "./js/typeSystem/baseTypes.js":
  12372. /*!************************************!*\
  12373. !*** ./js/typeSystem/baseTypes.js ***!
  12374. \************************************/
  12375. /*! no static exports found */
  12376. /***/ (function(module, exports, __webpack_require__) {
  12377. "use strict";
  12378. Object.defineProperty(exports, "__esModule", {
  12379. value: true
  12380. });
  12381. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  12382. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  12383. var BaseType = function () {
  12384. function BaseType(name, ord) {
  12385. _classCallCheck(this, BaseType);
  12386. this.name = name;
  12387. this.ord = ord;
  12388. }
  12389. _createClass(BaseType, [{
  12390. key: "isCompatible",
  12391. value: function isCompatible(another) {
  12392. if (another instanceof BaseType) {
  12393. return this.name === another.name && this.ord === another.ord;
  12394. }
  12395. return false;
  12396. }
  12397. }, {
  12398. key: "value",
  12399. get: function get() {
  12400. return this.name;
  12401. }
  12402. }]);
  12403. return BaseType;
  12404. }();
  12405. var BaseTypes = exports.BaseTypes = Object.freeze({
  12406. INTEGER: new BaseType("int", 0),
  12407. REAL: new BaseType("real", 1),
  12408. STRING: new BaseType("string", 2),
  12409. BOOLEAN: new BaseType("bool", 3),
  12410. VOID: new BaseType("void", 4),
  12411. UNDEFINED: new BaseType("undefined", 5)
  12412. });
  12413. /***/ }),
  12414. /***/ "./js/typeSystem/compoundType.js":
  12415. /*!***************************************!*\
  12416. !*** ./js/typeSystem/compoundType.js ***!
  12417. \***************************************/
  12418. /*! no static exports found */
  12419. /***/ (function(module, exports, __webpack_require__) {
  12420. "use strict";
  12421. Object.defineProperty(exports, "__esModule", {
  12422. value: true
  12423. });
  12424. exports.CompoundType = undefined;
  12425. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  12426. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  12427. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  12428. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  12429. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  12430. var CompoundType = exports.CompoundType = function (_Type) {
  12431. _inherits(CompoundType, _Type);
  12432. function CompoundType(type, dimensions) {
  12433. _classCallCheck(this, CompoundType);
  12434. var _this = _possibleConstructorReturn(this, (CompoundType.__proto__ || Object.getPrototypeOf(CompoundType)).call(this, null));
  12435. _this.innerType = type;
  12436. _this.dimensions = dimensions;
  12437. return _this;
  12438. }
  12439. _createClass(CompoundType, [{
  12440. key: "isCompatible",
  12441. value: function isCompatible(another) {
  12442. if (another instanceof CompoundType) {
  12443. if (this.dimensions !== another.dimensions) {
  12444. return false;
  12445. }
  12446. return this.innerType.isCompatible(another.innerType);
  12447. }
  12448. return false;
  12449. }
  12450. }, {
  12451. key: "canAccept",
  12452. value: function canAccept(another) {
  12453. if (another instanceof CompoundType) {
  12454. return this.dimensions > another.dimensions && this.innerType.isCompatible(another.innerType);
  12455. } else {
  12456. return this.innerType.isCompatible(another);
  12457. }
  12458. }
  12459. }]);
  12460. return CompoundType;
  12461. }(_type.Type);
  12462. /***/ }),
  12463. /***/ "./js/typeSystem/multiType.js":
  12464. /*!************************************!*\
  12465. !*** ./js/typeSystem/multiType.js ***!
  12466. \************************************/
  12467. /*! no static exports found */
  12468. /***/ (function(module, exports, __webpack_require__) {
  12469. "use strict";
  12470. Object.defineProperty(exports, "__esModule", {
  12471. value: true
  12472. });
  12473. exports.MultiType = undefined;
  12474. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  12475. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  12476. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  12477. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  12478. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  12479. var MultiType = exports.MultiType = function (_Type) {
  12480. _inherits(MultiType, _Type);
  12481. function MultiType(types) {
  12482. _classCallCheck(this, MultiType);
  12483. var _this = _possibleConstructorReturn(this, (MultiType.__proto__ || Object.getPrototypeOf(MultiType)).call(this, null));
  12484. _this.types = types;
  12485. return _this;
  12486. }
  12487. _createClass(MultiType, [{
  12488. key: "isCompatible",
  12489. value: function isCompatible(another) {
  12490. if (another instanceof _type.Type) {
  12491. for (var i = 0; i < this.types.length; i++) {
  12492. var t = this.types[i];
  12493. if (t.isCompatible(another)) {
  12494. return true;
  12495. }
  12496. }
  12497. }
  12498. return false;
  12499. }
  12500. }, {
  12501. key: "value",
  12502. get: function get() {
  12503. return null;
  12504. }
  12505. }, {
  12506. key: "ord",
  12507. get: function get() {
  12508. return null;
  12509. }
  12510. }]);
  12511. return MultiType;
  12512. }(_type.Type);
  12513. /***/ }),
  12514. /***/ "./js/typeSystem/parsers.js":
  12515. /*!**********************************!*\
  12516. !*** ./js/typeSystem/parsers.js ***!
  12517. \**********************************/
  12518. /*! no static exports found */
  12519. /***/ (function(module, exports, __webpack_require__) {
  12520. "use strict";
  12521. Object.defineProperty(exports, "__esModule", {
  12522. value: true
  12523. });
  12524. exports.toInt = toInt;
  12525. exports.toString = toString;
  12526. exports.toReal = toReal;
  12527. exports.toBool = toBool;
  12528. exports.convertToString = convertToString;
  12529. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  12530. var _types = __webpack_require__(/*! ./types */ "./js/typeSystem/types.js");
  12531. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  12532. var _decimal2 = _interopRequireDefault(_decimal);
  12533. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12534. function toInt(str) {
  12535. return new _decimal2.default(str);
  12536. }
  12537. function toString(str) {
  12538. var value = str.replace(/^"/, '');
  12539. value = value.replace(/"$/, '');
  12540. value = value.replace(/\\b/g, "\b");
  12541. value = value.replace(/\\t/g, "\t");
  12542. value = value.replace(/\\n/g, "\n");
  12543. value = value.replace(/\\r/g, "\r");
  12544. value = value.replace(/\\\"/g, "\"");
  12545. value = value.replace(/\\\'/g, "\'");
  12546. value = value.replace(/\\\\/g, "\\");
  12547. return value;
  12548. }
  12549. function toReal(value) {
  12550. return new _decimal2.default(value);
  12551. }
  12552. function toBool(str) {
  12553. var val = "'" + str + "'";
  12554. var lexer = _languageService.LanguageService.getCurrentLexer();
  12555. var instance = new lexer(null);
  12556. if (instance.literalNames[lexer.RK_TRUE] === val) {
  12557. return true;
  12558. } else if (instance.literalNames[lexer.RK_FALSE] === val) {
  12559. return false;
  12560. } else {
  12561. // TODO: better error message
  12562. throw new Error(str + "not a valid boolean");
  12563. }
  12564. }
  12565. function convertBoolToString(bool) {
  12566. var lexer = _languageService.LanguageService.getCurrentLexer();
  12567. var instance = new lexer(null);
  12568. if (bool) {
  12569. return instance.literalNames[lexer.RK_TRUE];
  12570. } else {
  12571. return instance.literalNames[lexer.RK_FALSE];
  12572. }
  12573. }
  12574. function convertToString(stoObj, type) {
  12575. switch (type.ord) {
  12576. case _types.Types.INTEGER.ord:
  12577. return stoObj.toString();
  12578. case _types.Types.REAL.ord:
  12579. {
  12580. if (stoObj.dp() <= 0) {
  12581. return stoObj.toFixed(1);
  12582. } else {
  12583. return stoObj.toNumber();
  12584. }
  12585. }
  12586. case _types.Types.BOOLEAN.ord:
  12587. return convertBoolToString(stoObj);
  12588. default:
  12589. return stoObj;
  12590. }
  12591. }
  12592. /***/ }),
  12593. /***/ "./js/typeSystem/type.js":
  12594. /*!*******************************!*\
  12595. !*** ./js/typeSystem/type.js ***!
  12596. \*******************************/
  12597. /*! no static exports found */
  12598. /***/ (function(module, exports, __webpack_require__) {
  12599. "use strict";
  12600. Object.defineProperty(exports, "__esModule", {
  12601. value: true
  12602. });
  12603. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  12604. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  12605. var Type = exports.Type = function () {
  12606. function Type(baseType) {
  12607. _classCallCheck(this, Type);
  12608. this.baseType = baseType;
  12609. }
  12610. _createClass(Type, [{
  12611. key: "isCompatible",
  12612. value: function isCompatible(another) {
  12613. if (another instanceof Type) {
  12614. return this.baseType.isCompatible(another.baseType);
  12615. }
  12616. return false;
  12617. }
  12618. }, {
  12619. key: "value",
  12620. get: function get() {
  12621. return this.baseType.value;
  12622. }
  12623. }, {
  12624. key: "ord",
  12625. get: function get() {
  12626. return this.baseType.ord;
  12627. }
  12628. }]);
  12629. return Type;
  12630. }();
  12631. /***/ }),
  12632. /***/ "./js/typeSystem/types.js":
  12633. /*!********************************!*\
  12634. !*** ./js/typeSystem/types.js ***!
  12635. \********************************/
  12636. /*! no static exports found */
  12637. /***/ (function(module, exports, __webpack_require__) {
  12638. "use strict";
  12639. Object.defineProperty(exports, "__esModule", {
  12640. value: true
  12641. });
  12642. exports.Types = undefined;
  12643. var _baseTypes = __webpack_require__(/*! ./baseTypes */ "./js/typeSystem/baseTypes.js");
  12644. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  12645. var _multiType = __webpack_require__(/*! ./multiType */ "./js/typeSystem/multiType.js");
  12646. var INTEGER = new _type.Type(_baseTypes.BaseTypes.INTEGER);
  12647. var REAL = new _type.Type(_baseTypes.BaseTypes.REAL);
  12648. var STRING = new _type.Type(_baseTypes.BaseTypes.STRING);
  12649. var BOOLEAN = new _type.Type(_baseTypes.BaseTypes.BOOLEAN);
  12650. var VOID = new _type.Type(_baseTypes.BaseTypes.VOID);
  12651. var UNDEFINED = new _type.Type(_baseTypes.BaseTypes.UNDEFINED);
  12652. var ALL = new _multiType.MultiType([INTEGER, REAL, STRING, BOOLEAN]);
  12653. var Types = exports.Types = Object.freeze({
  12654. INTEGER: INTEGER,
  12655. REAL: REAL,
  12656. STRING: STRING,
  12657. BOOLEAN: BOOLEAN,
  12658. VOID: VOID,
  12659. UNDEFINED: UNDEFINED,
  12660. ALL: ALL
  12661. });
  12662. /***/ }),
  12663. /***/ "./js/util/inputTest.js":
  12664. /*!******************************!*\
  12665. !*** ./js/util/inputTest.js ***!
  12666. \******************************/
  12667. /*! no static exports found */
  12668. /***/ (function(module, exports, __webpack_require__) {
  12669. "use strict";
  12670. Object.defineProperty(exports, "__esModule", {
  12671. value: true
  12672. });
  12673. exports.InputTest = undefined;
  12674. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  12675. var _input = __webpack_require__(/*! ./../io/input */ "./js/io/input.js");
  12676. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  12677. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  12678. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  12679. var InputTest = exports.InputTest = function (_Input) {
  12680. _inherits(InputTest, _Input);
  12681. function InputTest(inputList) {
  12682. _classCallCheck(this, InputTest);
  12683. var _this = _possibleConstructorReturn(this, (InputTest.__proto__ || Object.getPrototypeOf(InputTest)).call(this));
  12684. _this.index = 0;
  12685. _this.inputList = inputList;
  12686. return _this;
  12687. }
  12688. _createClass(InputTest, [{
  12689. key: 'requestInput',
  12690. value: function requestInput(callback) {
  12691. if (this.index < this.inputList.length) {
  12692. callback(this.inputList[this.index]);
  12693. this.index++;
  12694. } else {
  12695. throw new Error('The amount of requests exceeded the amount of available inputs');
  12696. }
  12697. }
  12698. }]);
  12699. return InputTest;
  12700. }(_input.Input);
  12701. /***/ }),
  12702. /***/ "./js/util/outputTest.js":
  12703. /*!*******************************!*\
  12704. !*** ./js/util/outputTest.js ***!
  12705. \*******************************/
  12706. /*! no static exports found */
  12707. /***/ (function(module, exports, __webpack_require__) {
  12708. "use strict";
  12709. Object.defineProperty(exports, "__esModule", {
  12710. value: true
  12711. });
  12712. exports.OutputTest = undefined;
  12713. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  12714. var _output = __webpack_require__(/*! ./../io/output */ "./js/io/output.js");
  12715. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  12716. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  12717. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  12718. var OutputTest = exports.OutputTest = function (_Output) {
  12719. _inherits(OutputTest, _Output);
  12720. function OutputTest() {
  12721. _classCallCheck(this, OutputTest);
  12722. var _this = _possibleConstructorReturn(this, (OutputTest.__proto__ || Object.getPrototypeOf(OutputTest)).call(this));
  12723. _this.list = [];
  12724. return _this;
  12725. }
  12726. _createClass(OutputTest, [{
  12727. key: 'sendOutput',
  12728. value: function sendOutput(text) {
  12729. this.list.push(text);
  12730. }
  12731. }]);
  12732. return OutputTest;
  12733. }(_output.Output);
  12734. /***/ }),
  12735. /***/ "./js/visualUI/algorithm.js":
  12736. /*!**********************************!*\
  12737. !*** ./js/visualUI/algorithm.js ***!
  12738. \**********************************/
  12739. /*! no static exports found */
  12740. /***/ (function(module, exports, __webpack_require__) {
  12741. "use strict";
  12742. Object.defineProperty(exports, "__esModule", {
  12743. value: true
  12744. });
  12745. exports.renderAlgorithm = renderAlgorithm;
  12746. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  12747. var _jquery2 = _interopRequireDefault(_jquery);
  12748. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  12749. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  12750. var Models = _interopRequireWildcard(_ivprog_elements);
  12751. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  12752. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  12753. var GlobalsManagement = _interopRequireWildcard(_globals);
  12754. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  12755. var VariablesManagement = _interopRequireWildcard(_variables);
  12756. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  12757. var CommandsManagement = _interopRequireWildcard(_commands);
  12758. var _code_generator = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  12759. var CodeManagement = _interopRequireWildcard(_code_generator);
  12760. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  12761. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  12762. var _functions = __webpack_require__(/*! ./functions */ "./js/visualUI/functions.js");
  12763. var FunctionsManagement = _interopRequireWildcard(_functions);
  12764. var _domConsole = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  12765. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  12766. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  12767. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  12768. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  12769. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12770. var block_render = false;
  12771. function renderAlgorithm() {
  12772. if (block_render) {
  12773. return;
  12774. }
  12775. block_render = true;
  12776. (0, _jquery2.default)('.all_functions').children().off();
  12777. (0, _jquery2.default)('.all_functions').empty();
  12778. (0, _jquery2.default)('.list_globals').children().off();
  12779. (0, _jquery2.default)('.list_globals').empty();
  12780. for (var i = 0; i < window.program_obj.functions.length; i++) {
  12781. FunctionsManagement.renderFunction(window.program_obj.functions[i]);
  12782. }
  12783. for (var i = 0; i < window.program_obj.globals.length; i++) {
  12784. GlobalsManagement.renderGlobal(window.program_obj.globals[i]);
  12785. }
  12786. setTimeout(function () {
  12787. block_render = false;
  12788. }, 500);
  12789. }
  12790. /***/ }),
  12791. /***/ "./js/visualUI/code_generator.js":
  12792. /*!***************************************!*\
  12793. !*** ./js/visualUI/code_generator.js ***!
  12794. \***************************************/
  12795. /*! no static exports found */
  12796. /***/ (function(module, exports, __webpack_require__) {
  12797. "use strict";
  12798. Object.defineProperty(exports, "__esModule", {
  12799. value: true
  12800. });
  12801. exports.generate = generate;
  12802. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  12803. var _jquery2 = _interopRequireDefault(_jquery);
  12804. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  12805. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  12806. var Models = _interopRequireWildcard(_ivprog_elements);
  12807. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  12808. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  12809. var GlobalsManagement = _interopRequireWildcard(_globals);
  12810. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  12811. var VariablesManagement = _interopRequireWildcard(_variables);
  12812. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  12813. var CommandsManagement = _interopRequireWildcard(_commands);
  12814. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  12815. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12816. function generate() {
  12817. (0, _jquery2.default)('.ivprog_visual_panel').find('.error_icon').remove();
  12818. var code = _localizedStringsService.LocalizedStrings.getUI('program') + ' { ';
  12819. code += globalsCode();
  12820. code += '\n';
  12821. var has_error = false;
  12822. for (var i = 0; i < window.program_obj.functions.length; i++) {
  12823. var n_code = functionsCode(window.program_obj.functions[i]);
  12824. if (n_code == null) {
  12825. has_error = true;
  12826. }
  12827. code += n_code;
  12828. code += '\n';
  12829. }
  12830. code += '\n}';
  12831. if (has_error) {
  12832. return null;
  12833. } else {
  12834. return code;
  12835. }
  12836. }
  12837. function functionsCode(function_obj) {
  12838. var ret = '\n\t' + _localizedStringsService.LocalizedStrings.getUI('function') + ' ';
  12839. var has_error = false;
  12840. switch (function_obj.return_type) {
  12841. case _types.Types.INTEGER:
  12842. ret += _localizedStringsService.LocalizedStrings.getUI('integer');
  12843. break;
  12844. case _types.Types.REAL:
  12845. ret += _localizedStringsService.LocalizedStrings.getUI('real');
  12846. break;
  12847. case _types.Types.TEXT:
  12848. ret += _localizedStringsService.LocalizedStrings.getUI('text');
  12849. break;
  12850. case _types.Types.BOOLEAN:
  12851. ret += _localizedStringsService.LocalizedStrings.getUI('boolean');
  12852. break;
  12853. case _types.Types.VOID:
  12854. ret += _localizedStringsService.LocalizedStrings.getUI('void');
  12855. break;
  12856. }
  12857. ret += ' ';
  12858. if (function_obj.return_dimensions == 1) {
  12859. ret += '[] ';
  12860. } else if (function_obj.return_dimensions == 2) {
  12861. ret += '[][] ';
  12862. }
  12863. ret += function_obj.name + ' ( ';
  12864. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  12865. ret += parametersCode(function_obj.parameters_list[j]);
  12866. if (j + 1 < function_obj.parameters_list.length) {
  12867. ret += ',';
  12868. }
  12869. }
  12870. ret += ' ) {';
  12871. for (var j = 0; j < function_obj.variables_list.length; j++) {
  12872. ret += variablesCode(function_obj.variables_list[j]);
  12873. }
  12874. for (var j = 0; j < function_obj.commands.length; j++) {
  12875. //try {
  12876. ret += commandsCode(function_obj.commands[j]);
  12877. /*} catch (err) {
  12878. has_error = true;
  12879. console.error(err.message);
  12880. var todos = $('body').find('.command_container');
  12881. for (var i = 0; i < todos.length; i++) {
  12882. if ($(todos[i]).data('command') == function_obj.commands[j]) {
  12883. $( todos[i] ).prepend( ' <i class="ui icon red exclamation triangle error_icon"></i> ' );
  12884. break;
  12885. }
  12886. }
  12887. }*/
  12888. }
  12889. ret += '\n\t}';
  12890. if (has_error) {
  12891. return null;
  12892. } else {
  12893. return ret;
  12894. }
  12895. }
  12896. function commandsCode(command_obj) {
  12897. var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
  12898. switch (command_obj.type) {
  12899. case Models.COMMAND_TYPES.break:
  12900. return breaksCode(command_obj, indentation);
  12901. case Models.COMMAND_TYPES.comment:
  12902. return commentsCode(command_obj, indentation);
  12903. case Models.COMMAND_TYPES.reader:
  12904. return readersCode(command_obj, indentation);
  12905. case Models.COMMAND_TYPES.writer:
  12906. return writersCode(command_obj, indentation);
  12907. case Models.COMMAND_TYPES.functioncall:
  12908. return functioncallsCode(command_obj, indentation);
  12909. case Models.COMMAND_TYPES.attribution:
  12910. return attributionsCode(command_obj, indentation);
  12911. case Models.COMMAND_TYPES.whiletrue:
  12912. return whiletruesCode(command_obj, indentation);
  12913. case Models.COMMAND_TYPES.dowhiletrue:
  12914. return doWhilesCode(command_obj, indentation);
  12915. case Models.COMMAND_TYPES.iftrue:
  12916. return iftruesCode(command_obj, indentation);
  12917. case Models.COMMAND_TYPES.repeatNtimes:
  12918. return repeatNtimesCode(command_obj, indentation);
  12919. case Models.COMMAND_TYPES.switch:
  12920. return switchsCode(command_obj, indentation);
  12921. case Models.COMMAND_TYPES.return:
  12922. return returnsCode(command_obj, indentation);
  12923. }
  12924. }
  12925. function returnsCode(command_obj, indentation) {
  12926. var ret = '\n';
  12927. for (var i = 0; i < indentation; i++) {
  12928. ret += '\t';
  12929. }
  12930. ret += _localizedStringsService.LocalizedStrings.getUI('text_return');
  12931. if (command_obj.variable_value_menu) {
  12932. try {
  12933. ret += ' ' + variableValueMenuCode(command_obj.variable_value_menu);
  12934. } catch (err) {}
  12935. }
  12936. return ret;
  12937. }
  12938. function breaksCode(command_obj, indentation) {
  12939. var ret = '\n';
  12940. for (var i = 0; i < indentation; i++) {
  12941. ret += '\t';
  12942. }
  12943. ret += _localizedStringsService.LocalizedStrings.getUI('text_break');
  12944. return ret;
  12945. }
  12946. function switchsCode(command_obj, indentation) {
  12947. var ret = '\n';
  12948. for (var i = 0; i < indentation; i++) {
  12949. ret += '\t';
  12950. }
  12951. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_switch') + ' ( ';
  12952. ret += variableValueMenuCode(command_obj.variable);
  12953. ret += ' ) { ';
  12954. if (command_obj.cases) {
  12955. for (var i = 0; i < command_obj.cases.length; i++) {
  12956. ret += switchcasesCode(command_obj.cases[i], indentation + 1);
  12957. }
  12958. }
  12959. ret += '\n';
  12960. for (var i = 0; i < indentation; i++) {
  12961. ret += '\t';
  12962. }
  12963. ret += '} ';
  12964. return ret;
  12965. }
  12966. function switchcasesCode(switchcase, indentation) {
  12967. var ret = '\n';
  12968. for (var i = 0; i < indentation; i++) {
  12969. ret += '\t';
  12970. }
  12971. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_case') + ' ';
  12972. ret += variableValueMenuCode(switchcase.variable_value_menu);
  12973. ret += ' :';
  12974. if (switchcase.commands_block) {
  12975. for (var i = 0; i < switchcase.commands_block.length; i++) {
  12976. ret += commandsCode(switchcase.commands_block[i], indentation + 1);
  12977. }
  12978. }
  12979. return ret;
  12980. }
  12981. function repeatNtimesCode(command_obj, indentation) {
  12982. var ret = '\n';
  12983. for (var i = 0; i < indentation; i++) {
  12984. ret += '\t';
  12985. }
  12986. ret += _localizedStringsService.LocalizedStrings.getUI('text_for') + ' ( ';
  12987. if (command_obj.var_attribution) {
  12988. ret += variableValueMenuCode(command_obj.var_attribution);
  12989. ret += ' = ';
  12990. ret += variableValueMenuCode(command_obj.expression1);
  12991. }
  12992. ret += ' ; ';
  12993. if (command_obj.expression2) {
  12994. switch (command_obj.expression2.expression.type) {
  12995. case Models.EXPRESSION_TYPES.exp_logic:
  12996. ret += logicExpressionCode(command_obj.expression2.expression);
  12997. break;
  12998. case Models.EXPRESSION_TYPES.exp_arithmetic:
  12999. ret += arithmeticExpressionCode(command_obj.expression2.expression);
  13000. break;
  13001. }
  13002. }
  13003. ret += ' ; ';
  13004. if (command_obj.var_incrementation) {
  13005. ret += variableValueMenuCode(command_obj.var_incrementation);
  13006. ret += ' = ';
  13007. ret += variableValueMenuCode(command_obj.expression3.itens[0]);
  13008. switch (command_obj.expression3.itens[1]) {
  13009. case Models.ARITHMETIC_TYPES.plus:
  13010. ret += ' + ';
  13011. break;
  13012. case Models.ARITHMETIC_TYPES.minus:
  13013. ret += ' - ';
  13014. break;
  13015. case Models.ARITHMETIC_TYPES.multiplication:
  13016. ret += ' * ';
  13017. break;
  13018. case Models.ARITHMETIC_TYPES.division:
  13019. ret += ' / ';
  13020. break;
  13021. case Models.ARITHMETIC_TYPES.module:
  13022. ret += ' % ';
  13023. break;
  13024. }
  13025. ret += variableValueMenuCode(command_obj.expression3.itens[2]);
  13026. }
  13027. ret += ' ) { ';
  13028. if (command_obj.commands_block) {
  13029. for (var i = 0; i < command_obj.commands_block.length; i++) {
  13030. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  13031. }
  13032. }
  13033. ret += '\n';
  13034. for (var i = 0; i < indentation; i++) {
  13035. ret += '\t';
  13036. }
  13037. ret += '}';
  13038. return ret;
  13039. }
  13040. function iftruesCode(command_obj, indentation) {
  13041. var ret = '\n';
  13042. for (var i = 0; i < indentation; i++) {
  13043. ret += '\t';
  13044. }
  13045. ret += _localizedStringsService.LocalizedStrings.getUI('text_if');
  13046. switch (command_obj.expression.expression.type) {
  13047. case Models.EXPRESSION_TYPES.exp_logic:
  13048. ret += logicExpressionCode(command_obj.expression.expression);
  13049. break;
  13050. case Models.EXPRESSION_TYPES.exp_arithmetic:
  13051. ret += arithmeticExpressionCode(command_obj.expression.expression);
  13052. break;
  13053. }
  13054. ret += ' { ';
  13055. if (command_obj.commands_block) {
  13056. for (var i = 0; i < command_obj.commands_block.length; i++) {
  13057. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  13058. }
  13059. }
  13060. ret += '\n';
  13061. for (var i = 0; i < indentation; i++) {
  13062. ret += '\t';
  13063. }
  13064. ret += '} ' + _localizedStringsService.LocalizedStrings.getUI('text_else') + ' {';
  13065. if (command_obj.commands_else) {
  13066. for (var i = 0; i < command_obj.commands_else.length; i++) {
  13067. ret += commandsCode(command_obj.commands_else[i], indentation + 1);
  13068. }
  13069. }
  13070. ret += '\n';
  13071. for (var i = 0; i < indentation; i++) {
  13072. ret += '\t';
  13073. }
  13074. ret += '}';
  13075. return ret;
  13076. }
  13077. function doWhilesCode(command_obj, indentation) {
  13078. var ret = '\n';
  13079. for (var i = 0; i < indentation; i++) {
  13080. ret += '\t';
  13081. }
  13082. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_do') + ' { ';
  13083. if (command_obj.commands_block) {
  13084. for (var i = 0; i < command_obj.commands_block.length; i++) {
  13085. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  13086. }
  13087. }
  13088. ret += '\n';
  13089. for (var i = 0; i < indentation; i++) {
  13090. ret += '\t';
  13091. }
  13092. ret += '} ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while');
  13093. switch (command_obj.expression.expression.type) {
  13094. case Models.EXPRESSION_TYPES.exp_logic:
  13095. ret += logicExpressionCode(command_obj.expression.expression);
  13096. break;
  13097. case Models.EXPRESSION_TYPES.exp_arithmetic:
  13098. ret += arithmeticExpressionCode(command_obj.expression.expression);
  13099. break;
  13100. }
  13101. return ret;
  13102. }
  13103. function whiletruesCode(command_obj, indentation) {
  13104. var ret = '\n';
  13105. for (var i = 0; i < indentation; i++) {
  13106. ret += '\t';
  13107. }
  13108. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_while');
  13109. switch (command_obj.expression.expression.type) {
  13110. case Models.EXPRESSION_TYPES.exp_logic:
  13111. ret += logicExpressionCode(command_obj.expression.expression);
  13112. break;
  13113. case Models.EXPRESSION_TYPES.exp_arithmetic:
  13114. ret += arithmeticExpressionCode(command_obj.expression.expression);
  13115. break;
  13116. }
  13117. ret += ' { ';
  13118. if (command_obj.commands_block) {
  13119. for (var i = 0; i < command_obj.commands_block.length; i++) {
  13120. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  13121. }
  13122. }
  13123. ret += '\n';
  13124. for (var i = 0; i < indentation; i++) {
  13125. ret += '\t';
  13126. }
  13127. ret += '}';
  13128. return ret;
  13129. }
  13130. function logicExpressionCode(expression) {
  13131. var ret = ' ( ';
  13132. if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  13133. ret += logicExpressionCode(expression.first_operand);
  13134. } else if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  13135. ret += arithmeticExpressionCode(expression.first_operand);
  13136. } else {
  13137. ret += variableValueMenuCode(expression.first_operand);
  13138. }
  13139. if (expression.operator) {
  13140. switch (expression.operator) {
  13141. case Models.LOGIC_COMPARISON.equals_to:
  13142. ret += ' == ';
  13143. break;
  13144. case Models.LOGIC_COMPARISON.not_equals_to:
  13145. ret += ' != ';
  13146. break;
  13147. case Models.LOGIC_COMPARISON.and:
  13148. ret += ' && ';
  13149. break;
  13150. case Models.LOGIC_COMPARISON.or:
  13151. ret += ' || ';
  13152. break;
  13153. }
  13154. if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  13155. ret += logicExpressionCode(expression.second_operand);
  13156. } else if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  13157. ret += arithmeticExpressionCode(expression.second_operand);
  13158. } else {
  13159. ret += variableValueMenuCode(expression.second_operand);
  13160. }
  13161. }
  13162. ret += ' ) ';
  13163. return ret;
  13164. }
  13165. function arithmeticExpressionCode(expression) {
  13166. var ret = ' ( ';
  13167. if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  13168. ret += logicExpressionCode(expression.first_operand);
  13169. } else if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  13170. ret += arithmeticExpressionCode(expression.first_operand);
  13171. } else {
  13172. ret += variableValueMenuCode(expression.first_operand);
  13173. }
  13174. switch (expression.operator) {
  13175. case Models.ARITHMETIC_COMPARISON.greater_than:
  13176. ret += ' > ';
  13177. break;
  13178. case Models.ARITHMETIC_COMPARISON.less_than:
  13179. ret += ' < ';
  13180. break;
  13181. case Models.ARITHMETIC_COMPARISON.equals_to:
  13182. ret += ' == ';
  13183. break;
  13184. case Models.ARITHMETIC_COMPARISON.not_equals_to:
  13185. ret += ' != ';
  13186. break;
  13187. case Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to:
  13188. ret += ' >= ';
  13189. break;
  13190. case Models.ARITHMETIC_COMPARISON.less_than_or_equals_to:
  13191. ret += ' <= ';
  13192. break;
  13193. }
  13194. if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  13195. ret += logicExpressionCode(expression.second_operand);
  13196. } else if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  13197. ret += arithmeticExpressionCode(expression.second_operand);
  13198. } else {
  13199. ret += variableValueMenuCode(expression.second_operand);
  13200. }
  13201. ret += ' ) ';
  13202. return ret;
  13203. }
  13204. function attributionsCode(command_obj, indentation) {
  13205. var ret = '\n';
  13206. for (var i = 0; i < indentation; i++) {
  13207. ret += '\t';
  13208. }
  13209. ret += variableValueMenuCode(command_obj.variable) + ' = ';
  13210. for (var i = 0; i < command_obj.expression.length; i++) {
  13211. ret += elementExpressionCode(command_obj.expression[i]);
  13212. }
  13213. return ret;
  13214. }
  13215. function elementExpressionCode(expression_obj) {
  13216. var ret = '';
  13217. for (var i = 0; i < expression_obj.itens.length; i++) {
  13218. if (expression_obj.itens[i].type) {
  13219. ret += variableValueMenuCode(expression_obj.itens[i]);
  13220. } else if (expression_obj.itens[i].type_exp) {
  13221. if (expression_obj.itens[i].type_exp == Models.EXPRESSION_ELEMENTS.par_exp_par) {
  13222. ret += ' ( ';
  13223. }
  13224. ret += elementExpressionCode(expression_obj.itens[i]);
  13225. if (expression_obj.itens[i].type_exp == Models.EXPRESSION_ELEMENTS.par_exp_par) {
  13226. ret += ' ) ';
  13227. }
  13228. } else {
  13229. switch (expression_obj.itens[i]) {
  13230. case Models.ARITHMETIC_TYPES.plus:
  13231. ret += ' + ';
  13232. break;
  13233. case Models.ARITHMETIC_TYPES.minus:
  13234. ret += ' - ';
  13235. break;
  13236. case Models.ARITHMETIC_TYPES.multiplication:
  13237. ret += ' * ';
  13238. break;
  13239. case Models.ARITHMETIC_TYPES.division:
  13240. ret += ' / ';
  13241. break;
  13242. case Models.ARITHMETIC_TYPES.module:
  13243. ret += ' % ';
  13244. break;
  13245. }
  13246. }
  13247. }
  13248. return ret;
  13249. }
  13250. function functioncallsCode(command_obj, indentation) {
  13251. var ret = '\n';
  13252. for (var i = 0; i < indentation; i++) {
  13253. ret += '\t';
  13254. }
  13255. ret += variableValueMenuCode(command_obj.function_called);
  13256. return ret;
  13257. }
  13258. function readersCode(command_obj, indentation) {
  13259. var ret = '\n';
  13260. for (var i = 0; i < indentation; i++) {
  13261. ret += '\t';
  13262. }
  13263. ret += _localizedStringsService.LocalizedStrings.getUI('text_command_read') + ' ( ';
  13264. ret += variableValueMenuCode(command_obj.variable_value_menu);
  13265. ret += ' ) ';
  13266. return ret;
  13267. }
  13268. function variableValueMenuCode(variable_obj) {
  13269. var ret = '';
  13270. if (variable_obj.function_called) {
  13271. ret += variable_obj.function_called.name + ' ( ';
  13272. if (variable_obj.parameters_list) {
  13273. for (var i = 0; i < variable_obj.parameters_list.length; i++) {
  13274. ret += variableValueMenuCode(variable_obj.parameters_list[i]);
  13275. if (i + 1 < variable_obj.parameters_list.length) {
  13276. ret += ', ';
  13277. }
  13278. }
  13279. }
  13280. ret += ' )';
  13281. } else if (variable_obj.content.type) {
  13282. ret += variable_obj.content.name;
  13283. if (variable_obj.content.dimensions == 1) {
  13284. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  13285. }
  13286. if (variable_obj.content.dimensions == 2) {
  13287. ret += ' [ ' + variableValueMenuCode(variable_obj.row) + ' ] ';
  13288. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  13289. }
  13290. } else {
  13291. if (isNaN(variable_obj.content)) {
  13292. ret += '"' + variable_obj.content + '"';
  13293. } else {
  13294. ret += variable_obj.content;
  13295. }
  13296. }
  13297. return ret;
  13298. }
  13299. function writersCode(command_obj, indentation) {
  13300. var ret = '\n';
  13301. for (var i = 0; i < indentation; i++) {
  13302. ret += '\t';
  13303. }
  13304. ret += _localizedStringsService.LocalizedStrings.getUI('text_command_write') + ' ( ';
  13305. for (var i = 0; i < command_obj.content.length; i++) {
  13306. ret += variableValueMenuCode(command_obj.content[i]);
  13307. if (i + 1 < command_obj.content.length) {
  13308. ret += ' + ';
  13309. }
  13310. }
  13311. ret += ' ) ';
  13312. return ret;
  13313. }
  13314. function commentsCode(command_obj, indentation) {
  13315. var ret = '\n';
  13316. for (var i = 0; i < indentation; i++) {
  13317. ret += '\t';
  13318. }
  13319. ret += '// ';
  13320. ret += command_obj.comment_text.content;
  13321. return ret;
  13322. }
  13323. function parametersCode(parameter_obj) {
  13324. var ret = '';
  13325. switch (parameter_obj.type) {
  13326. case _types.Types.INTEGER:
  13327. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('integer') + ' ';
  13328. break;
  13329. case _types.Types.REAL:
  13330. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('real') + ' ';
  13331. break;
  13332. case _types.Types.TEXT:
  13333. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('text') + ' ';
  13334. break;
  13335. case _types.Types.BOOLEAN:
  13336. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('boolean') + ' ';
  13337. break;
  13338. }
  13339. ret += parameter_obj.name + '';
  13340. if (parameter_obj.dimensions == 1) {
  13341. ret += ' []';
  13342. } else if (parameter_obj.dimensions == 2) {
  13343. ret += ' [][]';
  13344. }
  13345. return ret;
  13346. }
  13347. function variablesCode(variable_obj) {
  13348. var ret = '';
  13349. var temp = variable_obj;
  13350. ret += '\n\t\t';
  13351. if (temp.is_constant) {
  13352. ret += 'const ';
  13353. }
  13354. switch (temp.type) {
  13355. case _types.Types.INTEGER:
  13356. ret += _localizedStringsService.LocalizedStrings.getUI('integer') + ' ';
  13357. break;
  13358. case _types.Types.REAL:
  13359. ret += _localizedStringsService.LocalizedStrings.getUI('real') + ' ';
  13360. break;
  13361. case _types.Types.TEXT:
  13362. ret += _localizedStringsService.LocalizedStrings.getUI('text') + ' ';
  13363. break;
  13364. case _types.Types.BOOLEAN:
  13365. ret += _localizedStringsService.LocalizedStrings.getUI('boolean') + ' ';
  13366. break;
  13367. }
  13368. ret += temp.name + ' ';
  13369. if (temp.dimensions == 1) {
  13370. ret += '[' + temp.columns + '] ';
  13371. switch (temp.type) {
  13372. case _types.Types.INTEGER:
  13373. case _types.Types.REAL:
  13374. ret += '= {' + temp.value + '}';
  13375. break;
  13376. case _types.Types.TEXT:
  13377. ret += '= {';
  13378. for (var j = 0; j < temp.value.length; j++) {
  13379. ret += '"' + temp.value[j] + '"';
  13380. if (j + 1 < temp.value.length) {
  13381. ret += ',';
  13382. }
  13383. }
  13384. ret += '}';
  13385. break;
  13386. case _types.Types.BOOLEAN:
  13387. ret += '= {';
  13388. for (var j = 0; j < temp.value.length; j++) {
  13389. if (temp.value[j]) {
  13390. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  13391. } else {
  13392. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  13393. }
  13394. if (j + 1 < temp.value.length) {
  13395. ret += ',';
  13396. }
  13397. }
  13398. ret += '}';
  13399. break;
  13400. }
  13401. } else if (temp.dimensions == 2) {
  13402. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  13403. switch (temp.type) {
  13404. case _types.Types.INTEGER:
  13405. case _types.Types.REAL:
  13406. ret += '= {';
  13407. for (var j = 0; j < temp.rows; j++) {
  13408. ret += '{' + temp.value[j] + '}';
  13409. if (j + 1 < temp.rows) {
  13410. ret += ',';
  13411. }
  13412. }
  13413. ret += '}';
  13414. break;
  13415. case _types.Types.TEXT:
  13416. ret += '= {';
  13417. for (var j = 0; j < temp.rows; j++) {
  13418. ret += '{';
  13419. for (var k = 0; k < temp.columns; k++) {
  13420. ret += '"' + temp.value[j][k] + '"';
  13421. if (k + 1 < temp.columns) {
  13422. ret += ',';
  13423. }
  13424. }
  13425. ret += '}';
  13426. if (j + 1 < temp.rows) {
  13427. ret += ',';
  13428. }
  13429. }
  13430. ret += '}';
  13431. break;
  13432. case _types.Types.BOOLEAN:
  13433. ret += '= {';
  13434. for (var j = 0; j < temp.rows; j++) {
  13435. ret += '{';
  13436. for (var k = 0; k < temp.columns; k++) {
  13437. if (temp.value[j][k]) {
  13438. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  13439. } else {
  13440. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  13441. }
  13442. if (k + 1 < temp.columns) {
  13443. ret += ',';
  13444. }
  13445. }
  13446. ret += '}';
  13447. if (j + 1 < temp.rows) {
  13448. ret += ',';
  13449. }
  13450. }
  13451. ret += '}';
  13452. break;
  13453. }
  13454. } else {
  13455. switch (temp.type) {
  13456. case _types.Types.INTEGER:
  13457. case _types.Types.REAL:
  13458. ret += '= ' + temp.value;
  13459. break;
  13460. case _types.Types.TEXT:
  13461. ret += '= "' + temp.value + '"';
  13462. break;
  13463. case _types.Types.BOOLEAN:
  13464. ret += '= ';
  13465. if (temp.value) {
  13466. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  13467. } else {
  13468. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  13469. }
  13470. break;
  13471. }
  13472. }
  13473. return ret;
  13474. }
  13475. function globalsCode() {
  13476. var ret = '';
  13477. if (window.program_obj.globals) {
  13478. for (var i = 0; i < window.program_obj.globals.length; i++) {
  13479. var temp = window.program_obj.globals[i];
  13480. ret += '\n\t';
  13481. if (temp.is_constant) {
  13482. ret += 'const ';
  13483. }
  13484. switch (temp.type) {
  13485. case _types.Types.INTEGER:
  13486. ret += _localizedStringsService.LocalizedStrings.getUI('integer');
  13487. break;
  13488. case _types.Types.REAL:
  13489. ret += _localizedStringsService.LocalizedStrings.getUI('real');
  13490. break;
  13491. case _types.Types.TEXT:
  13492. ret += _localizedStringsService.LocalizedStrings.getUI('text');
  13493. break;
  13494. case _types.Types.BOOLEAN:
  13495. ret += _localizedStringsService.LocalizedStrings.getUI('boolean');
  13496. break;
  13497. }
  13498. ret += ' ' + temp.name + ' ';
  13499. if (temp.dimensions == 1) {
  13500. ret += '[' + temp.columns + '] ';
  13501. switch (temp.type) {
  13502. case _types.Types.INTEGER:
  13503. case _types.Types.REAL:
  13504. ret += '= {' + temp.value + '}';
  13505. break;
  13506. case _types.Types.TEXT:
  13507. ret += '= {';
  13508. for (var j = 0; j < temp.value.length; j++) {
  13509. ret += '"' + temp.value[j] + '"';
  13510. if (j + 1 < temp.value.length) {
  13511. ret += ',';
  13512. }
  13513. }
  13514. ret += '}';
  13515. break;
  13516. case _types.Types.BOOLEAN:
  13517. ret += '= {';
  13518. for (var j = 0; j < temp.value.length; j++) {
  13519. if (temp.value[j]) {
  13520. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  13521. } else {
  13522. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  13523. }
  13524. if (j + 1 < temp.value.length) {
  13525. ret += ',';
  13526. }
  13527. }
  13528. ret += '}';
  13529. break;
  13530. }
  13531. } else if (temp.dimensions == 2) {
  13532. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  13533. switch (temp.type) {
  13534. case _types.Types.INTEGER:
  13535. case _types.Types.REAL:
  13536. ret += '= {';
  13537. for (var j = 0; j < temp.rows; j++) {
  13538. ret += '{' + temp.value[j] + '}';
  13539. if (j + 1 < temp.rows) {
  13540. ret += ',';
  13541. }
  13542. }
  13543. ret += '}';
  13544. break;
  13545. case _types.Types.TEXT:
  13546. ret += '= {';
  13547. for (var j = 0; j < temp.rows; j++) {
  13548. ret += '{';
  13549. for (var k = 0; k < temp.columns; k++) {
  13550. ret += '"' + temp.value[j][k] + '"';
  13551. if (k + 1 < temp.columns) {
  13552. ret += ',';
  13553. }
  13554. }
  13555. ret += '}';
  13556. if (j + 1 < temp.rows) {
  13557. ret += ',';
  13558. }
  13559. }
  13560. ret += '}';
  13561. break;
  13562. case _types.Types.BOOLEAN:
  13563. ret += '= {';
  13564. for (var j = 0; j < temp.rows; j++) {
  13565. ret += '{';
  13566. for (var k = 0; k < temp.columns; k++) {
  13567. if (temp.value[j][k]) {
  13568. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  13569. } else {
  13570. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  13571. }
  13572. if (k + 1 < temp.columns) {
  13573. ret += ',';
  13574. }
  13575. }
  13576. ret += '}';
  13577. if (j + 1 < temp.rows) {
  13578. ret += ',';
  13579. }
  13580. }
  13581. ret += '}';
  13582. break;
  13583. }
  13584. } else {
  13585. switch (temp.type) {
  13586. case _types.Types.INTEGER:
  13587. case _types.Types.REAL:
  13588. ret += '= ' + temp.value;
  13589. break;
  13590. case _types.Types.TEXT:
  13591. ret += '= "' + temp.value + '"';
  13592. break;
  13593. case _types.Types.BOOLEAN:
  13594. ret += '= ';
  13595. if (temp.value) {
  13596. ret += _localizedStringsService.LocalizedStrings.getUI("true");;
  13597. } else {
  13598. ret += _localizedStringsService.LocalizedStrings.getUI("false");;
  13599. }
  13600. break;
  13601. }
  13602. }
  13603. }
  13604. }
  13605. return ret;
  13606. }
  13607. /***/ }),
  13608. /***/ "./js/visualUI/commands.js":
  13609. /*!*********************************!*\
  13610. !*** ./js/visualUI/commands.js ***!
  13611. \*********************************/
  13612. /*! no static exports found */
  13613. /***/ (function(module, exports, __webpack_require__) {
  13614. "use strict";
  13615. Object.defineProperty(exports, "__esModule", {
  13616. value: true
  13617. });
  13618. exports.removeCommand = removeCommand;
  13619. exports.createFloatingCommand = createFloatingCommand;
  13620. exports.renderCommand = renderCommand;
  13621. exports.genericCreateCommand = genericCreateCommand;
  13622. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  13623. var _jquery2 = _interopRequireDefault(_jquery);
  13624. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  13625. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  13626. var Models = _interopRequireWildcard(_ivprog_elements);
  13627. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  13628. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  13629. var GlobalsManagement = _interopRequireWildcard(_globals);
  13630. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  13631. var VariablesManagement = _interopRequireWildcard(_variables);
  13632. var _comment = __webpack_require__(/*! ./commands/comment */ "./js/visualUI/commands/comment.js");
  13633. var CommentsManagement = _interopRequireWildcard(_comment);
  13634. var _reader = __webpack_require__(/*! ./commands/reader */ "./js/visualUI/commands/reader.js");
  13635. var ReadersManagement = _interopRequireWildcard(_reader);
  13636. var _writer = __webpack_require__(/*! ./commands/writer */ "./js/visualUI/commands/writer.js");
  13637. var WritersManagement = _interopRequireWildcard(_writer);
  13638. var _attribution = __webpack_require__(/*! ./commands/attribution */ "./js/visualUI/commands/attribution.js");
  13639. var AttributionsManagement = _interopRequireWildcard(_attribution);
  13640. var _iftrue = __webpack_require__(/*! ./commands/iftrue */ "./js/visualUI/commands/iftrue.js");
  13641. var IftruesManagement = _interopRequireWildcard(_iftrue);
  13642. var _repeatNtimes = __webpack_require__(/*! ./commands/repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  13643. var RepeatNtimesManagement = _interopRequireWildcard(_repeatNtimes);
  13644. var _whiletrue = __webpack_require__(/*! ./commands/whiletrue */ "./js/visualUI/commands/whiletrue.js");
  13645. var WhiletruesManagement = _interopRequireWildcard(_whiletrue);
  13646. var _dowhiletrue = __webpack_require__(/*! ./commands/dowhiletrue */ "./js/visualUI/commands/dowhiletrue.js");
  13647. var DowhiletruesManagement = _interopRequireWildcard(_dowhiletrue);
  13648. var _switch = __webpack_require__(/*! ./commands/switch */ "./js/visualUI/commands/switch.js");
  13649. var SwitchesManagement = _interopRequireWildcard(_switch);
  13650. var _functioncall = __webpack_require__(/*! ./commands/functioncall */ "./js/visualUI/commands/functioncall.js");
  13651. var FunctioncallsManagement = _interopRequireWildcard(_functioncall);
  13652. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  13653. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  13654. var _break = __webpack_require__(/*! ./commands/break */ "./js/visualUI/commands/break.js");
  13655. var BreaksManagement = _interopRequireWildcard(_break);
  13656. var _return = __webpack_require__(/*! ./commands/return */ "./js/visualUI/commands/return.js");
  13657. var ReturnsManagement = _interopRequireWildcard(_return);
  13658. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  13659. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  13660. var has_element_created_draged = false;
  13661. var which_element_is_draged = null;
  13662. function removeCommand(command, function_obj, dom_obj) {
  13663. console.log('debugging removeCommand');
  13664. console.log('command');
  13665. console.log(command);
  13666. console.log('function_obj');
  13667. console.log(function_obj);
  13668. console.log('dom_obj');
  13669. console.log(dom_obj);
  13670. if (function_obj.commands.indexOf(command) > -1) {
  13671. function_obj.commands.splice(function_obj.commands.indexOf(command), 1);
  13672. return true;
  13673. }
  13674. // Utilize dois parantNode, pois o primeiro é o div de comandos
  13675. try {
  13676. if (dom_obj.parent().parent().data('command').commands_block.indexOf(command) > -1) {
  13677. dom_obj.parent().parent().data('command').commands_block.splice(dom_obj.parent().parent().data('command').commands_block.indexOf(command), 1);
  13678. return true;
  13679. }
  13680. } catch (err) {}
  13681. try {
  13682. if (dom_obj.parent().parent().data('command').type == Models.COMMAND_TYPES.iftrue) {
  13683. if (dom_obj.parent().parent().data('command').commands_else.indexOf(command) > -1) {
  13684. dom_obj.parent().parent().data('command').commands_else.splice(dom_obj.parent().parent().data('command').commands_else.indexOf(command), 1);
  13685. return true;
  13686. }
  13687. }
  13688. } catch (err) {}
  13689. console.log('veja: ');
  13690. console.log(dom_obj.parent());
  13691. if (dom_obj.parent().data('switchcase')) {
  13692. console.log("o que encontrei: ");
  13693. console.log(dom_obj.parent().data('switchcase'));
  13694. dom_obj.parent().data('switchcase').commands_block.splice(dom_obj.parent().data('switchcase').commands_block.indexOf(command), 1);
  13695. return true;
  13696. }
  13697. return false;
  13698. }
  13699. function createFloatingCommand(function_obj, function_container, command_type, mouse_event) {
  13700. var floatingObject;
  13701. switch (command_type) {
  13702. case Models.COMMAND_TYPES.break:
  13703. floatingObject = BreaksManagement.createFloatingCommand();
  13704. break;
  13705. case Models.COMMAND_TYPES.comment:
  13706. floatingObject = CommentsManagement.createFloatingCommand();
  13707. break;
  13708. case Models.COMMAND_TYPES.reader:
  13709. floatingObject = ReadersManagement.createFloatingCommand();
  13710. break;
  13711. case Models.COMMAND_TYPES.writer:
  13712. floatingObject = WritersManagement.createFloatingCommand();
  13713. break;
  13714. case Models.COMMAND_TYPES.attribution:
  13715. floatingObject = AttributionsManagement.createFloatingCommand();
  13716. break;
  13717. case Models.COMMAND_TYPES.iftrue:
  13718. floatingObject = IftruesManagement.createFloatingCommand();
  13719. break;
  13720. case Models.COMMAND_TYPES.repeatNtimes:
  13721. floatingObject = RepeatNtimesManagement.createFloatingCommand();
  13722. break;
  13723. case Models.COMMAND_TYPES.whiletrue:
  13724. floatingObject = WhiletruesManagement.createFloatingCommand();
  13725. break;
  13726. case Models.COMMAND_TYPES.dowhiletrue:
  13727. floatingObject = DowhiletruesManagement.createFloatingCommand();
  13728. break;
  13729. case Models.COMMAND_TYPES.switch:
  13730. floatingObject = SwitchesManagement.createFloatingCommand();
  13731. break;
  13732. case Models.COMMAND_TYPES.functioncall:
  13733. floatingObject = FunctioncallsManagement.createFloatingCommand();
  13734. break;
  13735. case Models.COMMAND_TYPES.return:
  13736. floatingObject = ReturnsManagement.createFloatingCommand();
  13737. break;
  13738. }
  13739. floatingObject.draggable().appendTo("body");
  13740. floatingObject.mouseup(function (evt) {
  13741. manageCommand(function_obj, function_container, evt, command_type);
  13742. });
  13743. floatingObject.css("position", "absolute");
  13744. mouse_event.type = "mousedown.draggable";
  13745. mouse_event.target = floatingObject[0];
  13746. floatingObject.css("left", mouse_event.pageX - 15);
  13747. floatingObject.css("top", mouse_event.pageY - 15);
  13748. floatingObject.trigger(mouse_event);
  13749. }
  13750. // before_after_inside: 1 -> before, 2 -> after, 3 -> inside
  13751. function renderCommand(command, element_reference, before_after_inside, function_obj) {
  13752. var createdElement;
  13753. switch (command.type) {
  13754. case Models.COMMAND_TYPES.comment:
  13755. createdElement = CommentsManagement.renderCommand(command, function_obj);
  13756. break;
  13757. case Models.COMMAND_TYPES.break:
  13758. createdElement = BreaksManagement.renderCommand(command, function_obj);
  13759. break;
  13760. case Models.COMMAND_TYPES.reader:
  13761. createdElement = ReadersManagement.renderCommand(command, function_obj);
  13762. break;
  13763. case Models.COMMAND_TYPES.writer:
  13764. createdElement = WritersManagement.renderCommand(command, function_obj);
  13765. break;
  13766. case Models.COMMAND_TYPES.attribution:
  13767. createdElement = AttributionsManagement.renderCommand(command, function_obj);
  13768. break;
  13769. case Models.COMMAND_TYPES.functioncall:
  13770. createdElement = FunctioncallsManagement.renderCommand(command, function_obj);
  13771. break;
  13772. case Models.COMMAND_TYPES.iftrue:
  13773. createdElement = IftruesManagement.renderCommand(command, function_obj);
  13774. break;
  13775. case Models.COMMAND_TYPES.repeatNtimes:
  13776. createdElement = RepeatNtimesManagement.renderCommand(command, function_obj);
  13777. break;
  13778. case Models.COMMAND_TYPES.whiletrue:
  13779. createdElement = WhiletruesManagement.renderCommand(command, function_obj);
  13780. break;
  13781. case Models.COMMAND_TYPES.dowhiletrue:
  13782. createdElement = DowhiletruesManagement.renderCommand(command, function_obj);
  13783. break;
  13784. case Models.COMMAND_TYPES.switch:
  13785. createdElement = SwitchesManagement.renderCommand(command, function_obj);
  13786. break;
  13787. case Models.COMMAND_TYPES.return:
  13788. createdElement = ReturnsManagement.renderCommand(command, function_obj);
  13789. break;
  13790. }
  13791. switch (before_after_inside) {
  13792. case 1:
  13793. createdElement.insertBefore(element_reference);
  13794. break;
  13795. case 2:
  13796. createdElement.insertAfter(element_reference);
  13797. break;
  13798. case 3:
  13799. element_reference.append(createdElement);
  13800. break;
  13801. }
  13802. }
  13803. function genericCreateCommand(command_type) {
  13804. switch (command_type) {
  13805. case Models.COMMAND_TYPES.break:
  13806. return new Models.Break();
  13807. case Models.COMMAND_TYPES.comment:
  13808. return new Models.Comment(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_value, _localizedStringsService.LocalizedStrings.getUI('text_comment'), null, null, false));
  13809. case Models.COMMAND_TYPES.reader:
  13810. return new Models.Reader(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false));
  13811. case Models.COMMAND_TYPES.writer:
  13812. return new Models.Writer([new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  13813. case Models.COMMAND_TYPES.attribution:
  13814. return new Models.Attribution(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), []);
  13815. case Models.COMMAND_TYPES.functioncall:
  13816. return new Models.FunctionCall(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_function, null, null, null, false), null);
  13817. case Models.COMMAND_TYPES.iftrue:
  13818. return new Models.IfTrue(new Models.ConditionalExpression(null), null, null);
  13819. case Models.COMMAND_TYPES.repeatNtimes:
  13820. return new Models.RepeatNTimes(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), null, new Models.ConditionalExpression(null), null, null);
  13821. case Models.COMMAND_TYPES.whiletrue:
  13822. return new Models.WhileTrue(new Models.ConditionalExpression(null), null);
  13823. case Models.COMMAND_TYPES.dowhiletrue:
  13824. return new Models.DoWhileTrue(new Models.ConditionalExpression(null), null);
  13825. case Models.COMMAND_TYPES.switch:
  13826. var sc = [new Models.SwitchCase(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true))];
  13827. return new Models.Switch(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true), sc);
  13828. case Models.COMMAND_TYPES.return:
  13829. return new Models.Return(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  13830. }
  13831. }
  13832. function manageCommand(function_obj, function_container, event, command_type) {
  13833. (0, _jquery2.default)(".created_element").each(function (index) {
  13834. (0, _jquery2.default)(this).remove();
  13835. });
  13836. var el = (0, _jquery2.default)(document.elementFromPoint(event.clientX, event.clientY));
  13837. console.log('soltou no: ');
  13838. console.log(el);
  13839. console.log(el.data('fun'));
  13840. // Primeiro verificar se ele soltou no espaço da função correta:
  13841. var hier = el.parentsUntil(".all_functions");
  13842. var esta_correto = false;
  13843. var esta_na_div_correta = false;
  13844. if (el.hasClass("commands_list_div")) {
  13845. esta_na_div_correta = true;
  13846. }
  13847. for (var i = 0; i < hier.length; i++) {
  13848. var temp = (0, _jquery2.default)(hier[i]);
  13849. if (temp.hasClass("commands_list_div")) {
  13850. esta_na_div_correta = true;
  13851. }
  13852. if (temp.data('fun') == function_obj) {
  13853. esta_correto = true;
  13854. break;
  13855. }
  13856. }
  13857. if (!esta_correto) {
  13858. has_element_created_draged = false;
  13859. which_element_is_draged = null;
  13860. return;
  13861. } else {
  13862. if (!esta_na_div_correta) {
  13863. has_element_created_draged = false;
  13864. which_element_is_draged = null;
  13865. return;
  13866. }
  13867. }
  13868. // Agora é descobrir qual o escopo para adicionar o comando:
  13869. // Se o elemento clicado possuir o atributo "fun", então, é direto na div dos comandos:
  13870. if (typeof el.data('fun') !== 'undefined') {
  13871. // Se a lista de comandos estiver vazia, então é o primeiro.
  13872. // Portanto, ele deve soltar o elemento obrigatoriamente no objeto vazio
  13873. if (el.data('fun').commands == null || el.data('fun').commands.length == 0) {
  13874. // pode adicionar
  13875. el.data('fun').commands = [];
  13876. var new_cmd = genericCreateCommand(command_type);
  13877. el.data('fun').commands.push(new_cmd);
  13878. renderCommand(new_cmd, (0, _jquery2.default)(function_container).find('.commands_list_div'), 3, function_obj);
  13879. } else {
  13880. // Entra nesse else, caso já existam outros comandos no bloco:
  13881. findNearbyCommandToAddInFunctionScope(el, event, (0, _jquery2.default)(function_container).find('.commands_list_div'), function_obj, command_type);
  13882. }
  13883. } else {
  13884. console.log("soltou em um comando");
  13885. // descobrir em qual comando ele soltou:
  13886. var hier_find = el.parentsUntil(".commands_list_div");
  13887. var hierarquia_bottom_up = [];
  13888. if (typeof el.data('command') !== 'undefined') {
  13889. hierarquia_bottom_up.push(el.data('command'));
  13890. }
  13891. for (var i = 0; i < hier_find.length; i++) {
  13892. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  13893. hierarquia_bottom_up.push((0, _jquery2.default)(hier_find[i]).data('command'));
  13894. }
  13895. }
  13896. console.log("comando em que soltou: ");
  13897. console.log(hierarquia_bottom_up[0]);
  13898. console.log("hierarquia de baixo para cima na árvore, de onde ele soltou: ");
  13899. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  13900. console.log(hierarquia_bottom_up[i]);
  13901. }
  13902. // Se for do tipo break, verificar se está no contexto correto:
  13903. // Caso não esteja no contexto, apenas retorna sem dar continuidade:
  13904. var is_correct_context = false;
  13905. if (command_type == Models.COMMAND_TYPES.break) {
  13906. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  13907. if (hierarquia_bottom_up[i].type == Models.COMMAND_TYPES.repeatNtimes || hierarquia_bottom_up[i].type == Models.COMMAND_TYPES.whiletrue || hierarquia_bottom_up[i].type == Models.COMMAND_TYPES.dowhiletrue || hierarquia_bottom_up[i].type == Models.COMMAND_TYPES.switch) {
  13908. is_correct_context = true;
  13909. break;
  13910. }
  13911. }
  13912. if (!is_correct_context) {
  13913. console.error("Context not allowed to insert BREAK COMMAND!");
  13914. return;
  13915. }
  13916. }
  13917. // se a hierarquia possuir apenas um elemento, então está na raiz dos comandos:
  13918. if (hierarquia_bottom_up.length == 1) {
  13919. console.log('QQ1');
  13920. var sub_elemento = false;
  13921. for (var i = 0; i < hier_find.length; i++) {
  13922. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  13923. console.log('QQ2');
  13924. findBeforeOrAfterCommandToAdd(hier_find[i], event, function_obj, command_type);
  13925. sub_elemento = true;
  13926. break;
  13927. }
  13928. }
  13929. if (!sub_elemento) {
  13930. console.log('QQ3');
  13931. findBeforeOrAfterCommandToAdd(el[0], event, function_obj, command_type);
  13932. }
  13933. } else {
  13934. console.log('QQ4');
  13935. // caso exista mais de um elemento na hierarquia:
  13936. if (typeof (0, _jquery2.default)(el).data('command') !== 'undefined') {
  13937. console.log('QQ5');
  13938. console.log("PPP1");
  13939. insertCommandInBlockHierar(el[0], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  13940. } else {
  13941. console.log('QQ6');
  13942. var sub_elemento = false;
  13943. for (var i = 0; i < hier_find.length; i++) {
  13944. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  13945. console.log('QQ7');
  13946. insertCommandInBlockHierar(hier_find[i], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  13947. sub_elemento = true;
  13948. break;
  13949. }
  13950. }
  13951. }
  13952. }
  13953. }
  13954. has_element_created_draged = false;
  13955. which_element_is_draged = null;
  13956. }
  13957. function insertCommandInBlockHierar(el, event, function_obj, command_type, hier_dom, hier_obj) {
  13958. var el_jq = (0, _jquery2.default)(el);
  13959. var command_parent = el_jq.data('command');
  13960. if (el_jq.data('command').type == Models.COMMAND_TYPES.repeatNtimes || el_jq.data('command').type == Models.COMMAND_TYPES.whiletrue || el_jq.data('command').type == Models.COMMAND_TYPES.dowhiletrue || el_jq.data('command').type == Models.COMMAND_TYPES.switch) {
  13961. console.log('QQ17');
  13962. if (el_jq.data('command').type == Models.COMMAND_TYPES.repeatNtimes || el_jq.data('command').type == Models.COMMAND_TYPES.whiletrue || el_jq.data('command').type == Models.COMMAND_TYPES.dowhiletrue) {
  13963. console.log('QQ18');
  13964. // Se não tiver outro comando ainda no bloco, só adiciona:
  13965. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  13966. command_parent.commands_block = [];
  13967. var recentComand = genericCreateCommand(command_type);
  13968. command_parent.commands_block.push(recentComand);
  13969. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  13970. } else {
  13971. // Se já tem algum comando no bloco:
  13972. findNearbyCommandToAddInBlockScope(el, event, el, function_obj, command_type, command_parent);
  13973. }
  13974. } else {
  13975. // QUANDO FOR BLOCO DO TIPO IF OU SWITCH/CASE:
  13976. addCommandToSwitchCase(event, function_obj, command_type);
  13977. }
  13978. } else {
  13979. console.log('QQ19');
  13980. // entra neste bloco, se soltou o comando sobre outro comando dentro de um subbloco:
  13981. findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type);
  13982. }
  13983. }
  13984. function findNearbyCommandToAddInBlockScope(el, event, node_list_commands, function_obj, command_type, command_parent) {
  13985. var all_sub = (0, _jquery2.default)(node_list_commands).find('div.command_container');
  13986. var menor_distancia = 999999999;
  13987. var elemento_menor_distancia = null;
  13988. var antes = true;
  13989. var t_bot;
  13990. var t_top;
  13991. // Descobrindo o elemento mais próximo:
  13992. for (var i = 0; i < all_sub.length; i++) {
  13993. t_top = all_sub[i].getBoundingClientRect().top;
  13994. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  13995. if (t_top - event.clientY < menor_distancia) {
  13996. menor_distancia = event.clientY - t_top;
  13997. elemento_menor_distancia = all_sub[i];
  13998. }
  13999. }
  14000. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  14001. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  14002. if (borda_inferior - event.clientY < menor_distancia) {
  14003. var recentComand = genericCreateCommand(command_type);
  14004. command_parent.commands_block.push(recentComand);
  14005. //
  14006. renderCommand(recentComand, node_list_commands, 3, function_obj);
  14007. } else {
  14008. var recentComand = genericCreateCommand(command_type);
  14009. var index = command_parent.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  14010. if (index > -1) {
  14011. command_parent.commands_block.splice(index, 0, recentComand);
  14012. }
  14013. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  14014. }
  14015. }
  14016. function findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type) {
  14017. var el_jq = (0, _jquery2.default)(el);
  14018. var command_parent = (0, _jquery2.default)(el.parentNode.parentNode).data('command');
  14019. var command_target = el_jq.data('command');
  14020. var temp_parent = (0, _jquery2.default)(el.parentNode.parentNode);
  14021. var is_in_else = false;
  14022. if (!command_parent) {
  14023. command_parent = el_jq.data('command');
  14024. temp_parent = el_jq;
  14025. var hier = el_jq.parentsUntil(".command_container");
  14026. for (var i = 0; i < hier.length; i++) {
  14027. var temp = (0, _jquery2.default)(hier[i]);
  14028. if (typeof temp.data('else') != 'undefined') {
  14029. is_in_else = true;
  14030. }
  14031. if (typeof temp.data('command') != 'undefined') {
  14032. command_parent = temp.data('command');
  14033. temp_parent = temp;
  14034. }
  14035. }
  14036. }
  14037. var hier = el_jq.parentsUntil(".command_container");
  14038. for (var i = 0; i < hier.length; i++) {
  14039. var temp = (0, _jquery2.default)(hier[i]);
  14040. if (typeof temp.data('else') != 'undefined') {
  14041. is_in_else = true;
  14042. }
  14043. }
  14044. if (command_parent == command_target) {
  14045. var hier = el_jq.parentsUntil(".command_container");
  14046. for (var i = 0; i < hier.length; i++) {
  14047. var temp = (0, _jquery2.default)(hier[i]);
  14048. if (typeof temp.data('else') !== 'undefined') {
  14049. is_in_else = true;
  14050. break;
  14051. }
  14052. }
  14053. }
  14054. if (command_parent.type != Models.COMMAND_TYPES.iftrue && command_parent.type != Models.COMMAND_TYPES.switch) {
  14055. var hier = temp_parent.parentsUntil(".all_cases_div");
  14056. console.log("vou procurar!!");
  14057. for (var i = 0; i < hier.length; i++) {
  14058. console.log("estou vasculhando...");
  14059. var temp = (0, _jquery2.default)(hier[i]);
  14060. if (typeof temp.data('switchcase') !== 'undefined') {
  14061. console.log("encontrei");
  14062. command_parent = temp.data('switchcase');
  14063. is_in_else = false;
  14064. break;
  14065. }
  14066. }
  14067. }
  14068. console.log('debugging:');
  14069. console.log('el_jq');
  14070. console.log(el_jq);
  14071. console.log('command_parent');
  14072. console.log(command_parent);
  14073. console.log('command_target');
  14074. console.log(command_target);
  14075. var menor_distancia = 999999999;
  14076. var antes = true;
  14077. var t_bot;
  14078. var t_top;
  14079. t_top = el.getBoundingClientRect().top;
  14080. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  14081. var d_top = event.clientY - t_top; // distancia topo
  14082. var d_bot = t_bot - event.clientY; // distancia baixo
  14083. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  14084. if (d_top < d_bot) {
  14085. var recentComand = genericCreateCommand(command_type);
  14086. console.log('MMM1');
  14087. if (is_in_else) {
  14088. console.log('MMM2');
  14089. if (command_parent == command_target) {
  14090. console.log('MMM3');
  14091. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  14092. command_parent.commands_else = [];
  14093. var recentComand = genericCreateCommand(command_type);
  14094. command_parent.commands_else.push(recentComand);
  14095. renderCommand(recentComand, el_jq, 3, function_obj);
  14096. } else {
  14097. // Se já tem algum comando no bloco:
  14098. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  14099. }
  14100. return;
  14101. }
  14102. console.log('MMM7');
  14103. var index = command_parent.commands_else.indexOf(command_target);
  14104. if (index > -1) {
  14105. command_parent.commands_else.splice(index, 0, recentComand);
  14106. }
  14107. renderCommand(recentComand, el, 1, function_obj);
  14108. } else {
  14109. console.log('MMM4');
  14110. if (command_parent == command_target) {
  14111. console.log('Nxxxx5');
  14112. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  14113. command_parent.commands_block = [];
  14114. console.log('SSS4');
  14115. var recentComand = genericCreateCommand(command_type);
  14116. command_parent.commands_block.push(recentComand);
  14117. renderCommand(recentComand, el_jq, 3, function_obj);
  14118. } else {
  14119. console.log('SSS5');
  14120. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  14121. }
  14122. return;
  14123. }
  14124. console.log('MMM6');
  14125. var index = command_parent.commands_block.indexOf(command_target);
  14126. if (index > -1) {
  14127. command_parent.commands_block.splice(index, 0, recentComand);
  14128. }
  14129. renderCommand(recentComand, el, 1, function_obj);
  14130. }
  14131. } else {
  14132. console.log('XXX1');
  14133. var recentComand = genericCreateCommand(command_type);
  14134. if (is_in_else) {
  14135. if (command_parent == command_target) {
  14136. console.log('MMM3');
  14137. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  14138. command_parent.commands_else = [];
  14139. console.log('SSS1');
  14140. var recentComand = genericCreateCommand(command_type);
  14141. command_parent.commands_else.push(recentComand);
  14142. renderCommand(recentComand, el_jq, 3, function_obj);
  14143. } else {
  14144. // Se já tem algum comando no bloco:
  14145. console.log('SSS2');
  14146. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  14147. }
  14148. return;
  14149. }
  14150. console.log('XXX2');
  14151. var index = command_parent.commands_else.indexOf(command_target);
  14152. if (index > -1) {
  14153. command_parent.commands_else.splice(index + 1, 0, recentComand);
  14154. }
  14155. renderCommand(recentComand, el, 2, function_obj);
  14156. } else {
  14157. if (command_parent == command_target) {
  14158. console.log('Nxxxx78');
  14159. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  14160. command_parent.commands_block = [];
  14161. var recentComand = genericCreateCommand(command_type);
  14162. command_parent.commands_block.push(recentComand);
  14163. console.log('SSS6');
  14164. renderCommand(recentComand, el_jq, 3, function_obj);
  14165. } else {
  14166. console.log('SSS7');
  14167. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  14168. }
  14169. return;
  14170. }
  14171. console.log('XXX3');
  14172. var index = command_parent.commands_block.indexOf(command_target);
  14173. if (index > -1) {
  14174. command_parent.commands_block.splice(index + 1, 0, recentComand);
  14175. }
  14176. renderCommand(recentComand, el, 2, function_obj);
  14177. }
  14178. }
  14179. }
  14180. function insertCommandInBlock(el, event, function_obj, command_type) {
  14181. var el_jq = (0, _jquery2.default)(el);
  14182. var command_parent = el_jq.data('command');
  14183. if (el_jq.data('command').type == Models.COMMAND_TYPES.repeatNtimes || el_jq.data('command').type == Models.COMMAND_TYPES.whiletrue || el_jq.data('command').type == Models.COMMAND_TYPES.dowhiletrue) {
  14184. // Se não tiver outro comando ainda no bloco, só adiciona:
  14185. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  14186. command_parent.commands_block = [];
  14187. var recentComand = genericCreateCommand(command_type);
  14188. command_parent.commands_block.push(recentComand);
  14189. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  14190. } else {
  14191. // Se já tem algum comando no bloco:
  14192. findInBlockCorrectPlace(el, event, function_obj, command_type);
  14193. }
  14194. } else if (el_jq.data('command').type == Models.COMMAND_TYPES.iftrue) {
  14195. console.log('QQ9');
  14196. // no if ou no else?
  14197. var correct_div = (0, _jquery2.default)(document.elementFromPoint(event.pageX, event.pageY));
  14198. var is_in_if = true;
  14199. if (correct_div.data('if')) {
  14200. is_in_if = true;
  14201. } else if (correct_div.data('else')) {
  14202. is_in_if = false;
  14203. } else {
  14204. var hier = correct_div.parentsUntil(".command_container");
  14205. for (var i = 0; i < hier.length; i++) {
  14206. var temp = (0, _jquery2.default)(hier[i]);
  14207. if (typeof temp.data('if') !== 'undefined') {
  14208. is_in_if = true;
  14209. break;
  14210. }
  14211. if (typeof temp.data('else') !== 'undefined') {
  14212. is_in_if = false;
  14213. break;
  14214. }
  14215. }
  14216. }
  14217. if (is_in_if) {
  14218. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  14219. command_parent.commands_block = [];
  14220. var recentComand = genericCreateCommand(command_type);
  14221. command_parent.commands_block.push(recentComand);
  14222. renderCommand(recentComand, el_jq.find('.commands_if'), 3, function_obj);
  14223. } else {
  14224. // Se já tem algum comando no bloco:
  14225. findInBlockCorrectPlace(el_jq.find('.commands_if'), event, function_obj, command_type);
  14226. }
  14227. } else {
  14228. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  14229. command_parent.commands_else = [];
  14230. var recentComand = genericCreateCommand(command_type);
  14231. command_parent.commands_else.push(recentComand);
  14232. renderCommand(recentComand, el_jq.find('.commands_else'), 3, function_obj);
  14233. } else {
  14234. // Se já tem algum comando no bloco:
  14235. findInBlockCorrectPlace(el_jq.find('.commands_else'), event, function_obj, command_type, true);
  14236. }
  14237. }
  14238. } else {
  14239. // é do tipo switch
  14240. console.log("está tentando inserir em um switch que está na raiz!");
  14241. addCommandToSwitchCase(event, function_obj, command_type);
  14242. }
  14243. }
  14244. function addCommandToSwitchCase(event, function_obj, command_type) {
  14245. var el = (0, _jquery2.default)(document.elementFromPoint(event.clientX, event.clientY));
  14246. var which_case = el.data('switchcase');
  14247. var case_div = el;
  14248. if (!which_case) {
  14249. var hier_find = el.parentsUntil(".all_cases_div");
  14250. for (var i = 0; i < hier_find.length; i++) {
  14251. if (typeof (0, _jquery2.default)(hier_find[i]).data('switchcase') !== 'undefined') {
  14252. which_case = (0, _jquery2.default)(hier_find[i]).data('switchcase');
  14253. case_div = (0, _jquery2.default)(hier_find[i]);
  14254. break;
  14255. }
  14256. }
  14257. }
  14258. if (which_case.commands_block == null || which_case.commands_block.length < 1) {
  14259. which_case.commands_block = [];
  14260. var recentComand = genericCreateCommand(command_type);
  14261. which_case.commands_block.push(recentComand);
  14262. renderCommand(recentComand, case_div.find('.case_commands_block'), 3, function_obj);
  14263. } else {
  14264. findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type);
  14265. }
  14266. }
  14267. function findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type) {
  14268. var all_sub = case_div.find('div.command_container');
  14269. var menor_distancia = 999999999;
  14270. var elemento_menor_distancia = null;
  14271. var antes = true;
  14272. var t_bot;
  14273. var t_top;
  14274. // Descobrindo o elemento mais próximo:
  14275. for (var i = 0; i < all_sub.length; i++) {
  14276. t_top = all_sub[i].getBoundingClientRect().top;
  14277. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  14278. if (t_top - event.clientY < menor_distancia) {
  14279. menor_distancia = event.clientY - t_top;
  14280. elemento_menor_distancia = all_sub[i];
  14281. }
  14282. }
  14283. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  14284. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  14285. if (borda_inferior - event.clientY < menor_distancia) {
  14286. var recentComand = genericCreateCommand(command_type);
  14287. which_case.commands_block.push(recentComand);
  14288. renderCommand(recentComand, (0, _jquery2.default)(case_div.find('.case_commands_block')[0]), 3, function_obj);
  14289. } else {
  14290. var recentComand = genericCreateCommand(command_type);
  14291. var index = which_case.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  14292. if (index > -1) {
  14293. which_case.commands_block.splice(index, 0, recentComand);
  14294. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  14295. }
  14296. }
  14297. }
  14298. function findInBlockCorrectPlace(el, event, function_obj, command_type) {
  14299. var is_in_else = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  14300. var el_jq = (0, _jquery2.default)(el);
  14301. var all_sub = el_jq.find('div.command_container');
  14302. var menor_distancia = 999999999;
  14303. var elemento_menor_distancia = null;
  14304. var antes = true;
  14305. var t_bot;
  14306. var t_top;
  14307. // Descobrindo o elemento mais próximo:
  14308. for (var i = 0; i < all_sub.length; i++) {
  14309. t_top = all_sub[i].getBoundingClientRect().top;
  14310. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  14311. if (t_top - event.clientY < menor_distancia) {
  14312. menor_distancia = event.clientY - t_top;
  14313. elemento_menor_distancia = all_sub[i];
  14314. }
  14315. }
  14316. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  14317. console.log("menor_distancia: ");
  14318. console.log(elemento_menor_distancia);
  14319. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  14320. if (borda_inferior - event.clientY < menor_distancia) {
  14321. console.log('QQ11');
  14322. var recentComand = genericCreateCommand(command_type);
  14323. var command_parent = el_jq.data('command');
  14324. if (is_in_else) {
  14325. console.log('QQ15');
  14326. command_parent.commands_else.push(recentComand);
  14327. console.log('el_jq');
  14328. console.log(el_jq);
  14329. console.log("$(el_jq.find('.commands_else')[0]):: ");
  14330. console.log((0, _jquery2.default)(el_jq.find('.commands_else')[0]));
  14331. renderCommand(recentComand, el_jq, 3, function_obj);
  14332. } else {
  14333. console.log('QQ16');
  14334. command_parent.commands_block.push(recentComand);
  14335. renderCommand(recentComand, (0, _jquery2.default)(el_jq.find('.block_commands')[0]), 3, function_obj);
  14336. }
  14337. } else {
  14338. console.log('QQ12');
  14339. var recentComand = genericCreateCommand(command_type);
  14340. var command_parent = el_jq.data('command');
  14341. if (is_in_else) {
  14342. var index = command_parent.commands_else.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  14343. if (index > -1) {
  14344. command_parent.commands_else.splice(index, 0, recentComand);
  14345. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  14346. }
  14347. } else {
  14348. var index = command_parent.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  14349. if (index > -1) {
  14350. command_parent.commands_block.splice(index, 0, recentComand);
  14351. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  14352. }
  14353. }
  14354. }
  14355. }
  14356. function findBeforeOrAfterCommandToAdd(el, event, function_obj, command_type) {
  14357. switch ((0, _jquery2.default)(el).data('command').type) {
  14358. case Models.COMMAND_TYPES.iftrue:
  14359. case Models.COMMAND_TYPES.switch:
  14360. case Models.COMMAND_TYPES.repeatNtimes:
  14361. case Models.COMMAND_TYPES.whiletrue:
  14362. case Models.COMMAND_TYPES.dowhiletrue:
  14363. insertCommandInBlock(el, event, function_obj, command_type);
  14364. return;
  14365. }
  14366. var menor_distancia = 999999999;
  14367. var antes = true;
  14368. var t_bot;
  14369. var t_top;
  14370. t_top = el.getBoundingClientRect().top;
  14371. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  14372. var d_top = event.clientY - t_top; // distancia topo
  14373. var d_bot = t_bot - event.clientY; // distancia baixo
  14374. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  14375. if (d_top < d_bot) {
  14376. var recentComand = genericCreateCommand(command_type);
  14377. var index = function_obj.commands.indexOf((0, _jquery2.default)(el).data('command'));
  14378. if (index > -1) {
  14379. function_obj.commands.splice(index, 0, recentComand);
  14380. }
  14381. renderCommand(recentComand, el, 1, function_obj);
  14382. } else {
  14383. var recentComand = genericCreateCommand(command_type);
  14384. var index = function_obj.commands.indexOf((0, _jquery2.default)(el).data('command'));
  14385. if (index > -1) {
  14386. function_obj.commands.splice(index + 1, 0, recentComand);
  14387. }
  14388. renderCommand(recentComand, el, 2, function_obj);
  14389. }
  14390. }
  14391. function findNearbyCommandToAddInFunctionScope(el, event, node_list_commands, function_obj, command_type) {
  14392. var all_sub = (0, _jquery2.default)(node_list_commands).find('div.command_container');
  14393. var menor_distancia = 999999999;
  14394. var elemento_menor_distancia = null;
  14395. var antes = true;
  14396. var t_bot;
  14397. var t_top;
  14398. // Descobrindo o elemento mais próximo:
  14399. for (var i = 0; i < all_sub.length; i++) {
  14400. t_top = all_sub[i].getBoundingClientRect().top;
  14401. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  14402. if (t_top - event.clientY < menor_distancia) {
  14403. menor_distancia = event.clientY - t_top;
  14404. elemento_menor_distancia = all_sub[i];
  14405. }
  14406. }
  14407. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  14408. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  14409. if (borda_inferior - event.clientY < menor_distancia) {
  14410. var recentComand = genericCreateCommand(command_type);
  14411. function_obj.commands.push(recentComand);
  14412. //
  14413. renderCommand(recentComand, node_list_commands, 3, function_obj);
  14414. } else {
  14415. var recentComand = genericCreateCommand(command_type);
  14416. var index = function_obj.commands.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  14417. if (index > -1) {
  14418. function_obj.commands.splice(index, 0, recentComand);
  14419. }
  14420. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  14421. }
  14422. }
  14423. /***/ }),
  14424. /***/ "./js/visualUI/commands/attribution.js":
  14425. /*!*********************************************!*\
  14426. !*** ./js/visualUI/commands/attribution.js ***!
  14427. \*********************************************/
  14428. /*! no static exports found */
  14429. /***/ (function(module, exports, __webpack_require__) {
  14430. "use strict";
  14431. Object.defineProperty(exports, "__esModule", {
  14432. value: true
  14433. });
  14434. exports.createFloatingCommand = createFloatingCommand;
  14435. exports.renderCommand = renderCommand;
  14436. exports.manageExpressionElements = manageExpressionElements;
  14437. exports.renderMenuOperations = renderMenuOperations;
  14438. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  14439. var _jquery2 = _interopRequireDefault(_jquery);
  14440. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  14441. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  14442. var Models = _interopRequireWildcard(_ivprog_elements);
  14443. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  14444. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  14445. var GlobalsManagement = _interopRequireWildcard(_globals);
  14446. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  14447. var VariablesManagement = _interopRequireWildcard(_variables);
  14448. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  14449. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  14450. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  14451. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  14452. var CommandsManagement = _interopRequireWildcard(_commands);
  14453. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  14454. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14455. function createFloatingCommand() {
  14456. return (0, _jquery2.default)('<div class="ui attribution created_element"> <i class="ui icon small arrow left"></i> <span> x = 1 + 1 </span></div>');
  14457. }
  14458. function renderCommand(command, function_obj) {
  14459. var el = (0, _jquery2.default)('<div class="ui attribution command_container"><i class="ui icon small arrow left command_drag"></i> <i class="ui icon times red button_remove_command"></i> <i class="ui icon redo alternate blue button_refresh_attribution"></i> <div class="var_attributed"></div> <span class="text_attr_receives">' + _localizedStringsService.LocalizedStrings.getUI('text_receives') + '</span> ' + '<div class="expression_elements"></div> </div>');
  14460. el.data('command', command);
  14461. VariableValueMenu.renderMenu(command, command.variable, el.find('.var_attributed'), function_obj);
  14462. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.none, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  14463. command.expression.push(exp);
  14464. addHandlers(command, function_obj, el);
  14465. renderExpressionElements(command, function_obj, el);
  14466. return el;
  14467. }
  14468. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, selectedItem, expression_element) {
  14469. var index_to_move = expression_element.itens.indexOf(ref_object);
  14470. switch (selectedItem.data('exp')) {
  14471. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  14472. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.exp_op_exp, [expression_element.itens[index_to_move], Models.ARITHMETIC_TYPES.plus, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  14473. expression_element.itens[index_to_move] = exp;
  14474. break;
  14475. case Models.EXPRESSION_ELEMENTS.op_exp:
  14476. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.plus, expression_element.itens[index_to_move]]);
  14477. expression_element.itens[index_to_move] = exp;
  14478. break;
  14479. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  14480. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.par_exp_par, [expression_element.itens[index_to_move]]);
  14481. expression_element.itens[index_to_move] = exp;
  14482. break;
  14483. }
  14484. renderExpressionElements(command, function_obj, dom_object);
  14485. }
  14486. function renderExpressionElements(command, function_obj, el) {
  14487. var expression_div = el.find('.expression_elements');
  14488. var command_container;
  14489. if (el.hasClass("command_container") == false) {
  14490. var hier = el.parentsUntil(".command_container");
  14491. for (var i = 0; i < hier.length; i++) {
  14492. if ((0, _jquery2.default)(hier[i]).hasClass("command_container")) {
  14493. command_container = (0, _jquery2.default)(hier[i]);
  14494. break;
  14495. }
  14496. if ((0, _jquery2.default)(hier[i]).hasClass("expression_elements")) {
  14497. expression_div = (0, _jquery2.default)(hier[i]);
  14498. break;
  14499. }
  14500. }
  14501. }
  14502. if (command_container) {
  14503. expression_div = command_container.find('.expression_elements');
  14504. }
  14505. expression_div.text('');
  14506. for (var i = 0; i < command.expression.length; i++) {
  14507. var temp = (0, _jquery2.default)('<div class="expression_element"></div>');
  14508. temp.data('ref_element', command.expression[i]);
  14509. temp.data('ref_index', i);
  14510. expression_div.append(temp);
  14511. renderElement(command, function_obj, temp, command.expression[i]);
  14512. }
  14513. }
  14514. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  14515. var context_menu = '<div class="ui dropdown"><div class="text">';
  14516. switch (expression_element.itens[index_op]) {
  14517. case Models.ARITHMETIC_TYPES.plus:
  14518. context_menu += '+';
  14519. break;
  14520. case Models.ARITHMETIC_TYPES.minus:
  14521. context_menu += '-';
  14522. break;
  14523. case Models.ARITHMETIC_TYPES.multiplication:
  14524. context_menu += '*';
  14525. break;
  14526. case Models.ARITHMETIC_TYPES.division:
  14527. context_menu += '/';
  14528. break;
  14529. case Models.ARITHMETIC_TYPES.module:
  14530. context_menu += '%';
  14531. break;
  14532. case Models.ARITHMETIC_TYPES.none:
  14533. context_menu += '...';
  14534. break;
  14535. }
  14536. context_menu += '</div><div class="menu">';
  14537. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.plus + '">+</div>';
  14538. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.minus + '">-</div>';
  14539. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.multiplication + '">*</div>';
  14540. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.division + '">/</div>';
  14541. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.module + '">%</div>';
  14542. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.none + '" data-text="...">Nenhum</div>';
  14543. context_menu += '</div></div>';
  14544. context_menu = (0, _jquery2.default)(context_menu);
  14545. temp_op.append(context_menu);
  14546. context_menu.dropdown({
  14547. onChange: function onChange(value, text, $selectedItem) {
  14548. expression_element.itens[index_op] = value;
  14549. }
  14550. });
  14551. }
  14552. function renderMenuAddExpression(command, function_obj, el, dom_append_menu, expression_append_new_expression) {
  14553. if (el.hasClass("command_container") == false) {
  14554. var hier = el.parentsUntil(".commands_list_div");
  14555. for (var i = 0; i < hier.length; i++) {
  14556. if ((0, _jquery2.default)(hier[i]).hasClass("command_container")) {
  14557. el = (0, _jquery2.default)(hier[i]);
  14558. break;
  14559. }
  14560. }
  14561. }
  14562. if (dom_append_menu.hasClass("expression_elements") == false) {
  14563. var hier = el.parentsUntil(".commands_list_div");
  14564. for (var i = 0; i < hier.length; i++) {
  14565. if ((0, _jquery2.default)(hier[i]).hasClass("expression_elements")) {
  14566. dom_append_menu = (0, _jquery2.default)(hier[i]);
  14567. break;
  14568. }
  14569. }
  14570. }
  14571. var context_menu = '<div class="ui dropdown"><div class="text"></div><i class="ui icon arrow alternate circle right outline"></i><div class="menu">';
  14572. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  14573. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  14574. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  14575. context_menu += '</div></div>';
  14576. context_menu = (0, _jquery2.default)(context_menu);
  14577. dom_append_menu.append(context_menu);
  14578. context_menu.dropdown({
  14579. onChange: function onChange(value, text, $selectedItem) {
  14580. switch (value) {
  14581. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  14582. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.exp_op_exp, [new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), Models.ARITHMETIC_TYPES.plus, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  14583. expression_append_new_expression.push(exp);
  14584. break;
  14585. case Models.EXPRESSION_ELEMENTS.op_exp:
  14586. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.plus, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  14587. expression_append_new_expression.push(exp);
  14588. break;
  14589. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  14590. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.par_exp_par, [new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  14591. expression_append_new_expression.push(exp);
  14592. break;
  14593. }
  14594. renderExpressionElements(command, function_obj, el);
  14595. }
  14596. });
  14597. }
  14598. function renderElement(command, function_obj, el, expression_element) {
  14599. switch (expression_element.type_exp) {
  14600. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  14601. var temp_op = (0, _jquery2.default)('<div class="component_element"></div>');
  14602. var temp_exp_1 = (0, _jquery2.default)('<div class="component_element"></div>');
  14603. var temp_exp_2 = (0, _jquery2.default)('<div class="component_element"></div>');
  14604. el.append(temp_exp_1);
  14605. el.append(temp_op);
  14606. el.append(temp_exp_2);
  14607. if (expression_element.itens[0].type) {
  14608. VariableValueMenu.renderMenu(command, expression_element.itens[0], temp_exp_1, function_obj, 2, expression_element);
  14609. } else {
  14610. renderElement(command, function_obj, temp_exp_1, expression_element.itens[0]);
  14611. }
  14612. renderOperator(command, function_obj, temp_op, expression_element, 1);
  14613. if (expression_element.itens[2].type) {
  14614. VariableValueMenu.renderMenu(command, expression_element.itens[2], temp_exp_2, function_obj, 2, expression_element);
  14615. } else {
  14616. renderElement(command, function_obj, temp_exp_2, expression_element.itens[2]);
  14617. }
  14618. break;
  14619. case Models.EXPRESSION_ELEMENTS.op_exp:
  14620. var temp_op = (0, _jquery2.default)('<div class="component_element"></div>');
  14621. var temp_exp = (0, _jquery2.default)('<div class="component_element"></div>');
  14622. el.append(temp_op);
  14623. el.append(temp_exp);
  14624. renderOperator(command, function_obj, temp_op, expression_element, 0);
  14625. if (expression_element.itens[1].type) {
  14626. VariableValueMenu.renderMenu(command, expression_element.itens[1], temp_exp, function_obj, 2, expression_element);
  14627. } else {
  14628. renderElement(command, function_obj, temp_exp, expression_element.itens[1]);
  14629. }
  14630. break;
  14631. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  14632. var temp_par_1 = (0, _jquery2.default)('<div class="component_element"> ( </div>');
  14633. var temp_exp = (0, _jquery2.default)('<div class="component_element"></div>');
  14634. var temp_par_2 = (0, _jquery2.default)('<div class="component_element"> ) </div>');
  14635. el.append(temp_par_1);
  14636. el.append(temp_exp);
  14637. for (var j = 0; j < expression_element.itens.length; j++) {
  14638. if (expression_element.itens[j].type) {
  14639. VariableValueMenu.renderMenu(command, expression_element.itens[j], temp_exp, function_obj, 2, expression_element);
  14640. } else {
  14641. renderElement(command, function_obj, temp_exp, expression_element.itens[j]);
  14642. }
  14643. }
  14644. //renderMenuAddExpression(command, function_obj, el, el, expression_element.itens);
  14645. el.append(temp_par_2);
  14646. break;
  14647. }
  14648. }
  14649. function renderExpression(command, function_obj, el) {
  14650. var expression_div = el.find('.expression_elements');
  14651. expression_div.text('');
  14652. var menu_add_item = (0, _jquery2.default)('<div class="menu_add_item"></div>');
  14653. menu_add_item.data('index_add', 0);
  14654. expression_div.append(menu_add_item);
  14655. for (var i = 0; i < command.expression.length; i++) {
  14656. if (command.expression[i].type) {
  14657. var temp = (0, _jquery2.default)('<div class="expression_element"></div>');
  14658. temp.data('ref_element', command.expression[i]);
  14659. temp.data('ref_index', i);
  14660. expression_div.append(temp);
  14661. VariableValueMenu.renderMenu(command, command.expression[i], temp, function_obj);
  14662. } else if (command.expression[i] == "(" || command.expression[i] == ")") {
  14663. var temp = (0, _jquery2.default)('<div class="expression_element">' + command.expression[i] + '</div>');
  14664. temp.data('ref_element', command.expression[i]);
  14665. temp.data('ref_index', i);
  14666. expression_div.append(temp);
  14667. } else {
  14668. var temp = '<div class="expression_element">';
  14669. switch (command.expression[i]) {
  14670. case Models.ARITHMETIC_TYPES.plus:
  14671. temp += '+';
  14672. break;
  14673. case Models.ARITHMETIC_TYPES.minus:
  14674. temp += '-';
  14675. break;
  14676. case Models.ARITHMETIC_TYPES.multiplication:
  14677. temp += '*';
  14678. break;
  14679. case Models.ARITHMETIC_TYPES.division:
  14680. temp += '/';
  14681. break;
  14682. case Models.ARITHMETIC_TYPES.module:
  14683. temp += '%';
  14684. break;
  14685. }
  14686. temp += '</div>';
  14687. temp = (0, _jquery2.default)(temp);
  14688. temp.data('ref_element', command.expression[i]);
  14689. temp.data('ref_index', i);
  14690. expression_div.append(temp);
  14691. }
  14692. var menu_add_item_seq = (0, _jquery2.default)('<div class="menu_add_item"></div>');
  14693. var index_temp = i + 1;
  14694. menu_add_item_seq.data('index_add', index_temp);
  14695. expression_div.append(menu_add_item_seq);
  14696. }
  14697. addMenuItens(command, function_obj, el);
  14698. }
  14699. function addMenuItens(command, function_obj, expression_div) {
  14700. var divs_expression = expression_div.find('.menu_add_item');
  14701. for (var i = 0; i < divs_expression.length; i++) {
  14702. var temp = (0, _jquery2.default)(divs_expression[i]).data('index_add');
  14703. var context_menu = '<div class="ui dropdown context_menu_clear"><i class="ui icon plus square outline"></i><div class="menu">';
  14704. context_menu += '<div class="item" data-option="value" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_value') + '</div>';
  14705. context_menu += '<div class="item" data-option="operator" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_operator') + '</div>';
  14706. context_menu += '<div class="item" data-option="parentheses" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_parentheses') + '</div>';
  14707. context_menu += '</div></div>';
  14708. context_menu = (0, _jquery2.default)(context_menu);
  14709. (0, _jquery2.default)(divs_expression[i]).append(context_menu);
  14710. context_menu.dropdown({
  14711. on: 'hover',
  14712. onChange: function onChange(value, text, $selectedItem) {
  14713. switch ($selectedItem.data('option')) {
  14714. case "value":
  14715. command.expression.splice($selectedItem.data('index'), 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  14716. renderExpression(command, function_obj, expression_div);
  14717. break;
  14718. case "operator":
  14719. command.expression.splice($selectedItem.data('index'), 0, Models.ARITHMETIC_TYPES.plus);
  14720. renderExpression(command, function_obj, expression_div);
  14721. break;
  14722. case "parentheses":
  14723. command.expression.splice($selectedItem.data('index'), 0, "(");
  14724. command.expression.splice($selectedItem.data('index') + 1, 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  14725. command.expression.splice($selectedItem.data('index') + 2, 0, ")");
  14726. renderExpression(command, function_obj, expression_div);
  14727. break;
  14728. }
  14729. }
  14730. });
  14731. }
  14732. }
  14733. function addHandlers(command, function_obj, attribution_dom) {
  14734. attribution_dom.find('.button_remove_command').on('click', function () {
  14735. if (CommandsManagement.removeCommand(command, function_obj, attribution_dom)) {
  14736. attribution_dom.remove();
  14737. }
  14738. });
  14739. attribution_dom.find('.button_refresh_attribution').on('click', function () {
  14740. renderExpressionElements(command, function_obj, attribution_dom);
  14741. });
  14742. }
  14743. function renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected) {
  14744. /*console.log("recebido o seguinte DOM: ");
  14745. console.log(dom_object);
  14746. if (dom_object.hasClass('var_attributed')) {
  14747. return;
  14748. } else {
  14749. var hier = dom_object.parentsUntil(".command_container");
  14750. for (var i = 0; i < hier.length; i++) {
  14751. if ($(hier[i]).hasClass('var_attributed') || $(hier[i]).hasClass('parameters_function_called')) {
  14752. return;
  14753. }
  14754. }
  14755. }
  14756. dom_object.find('.context_menu_clear').remove();
  14757. var menu_operations = '<div class="ui dropdown menu_operations"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  14758. for (var tm in Models.ARITHMETIC_TYPES) {
  14759. menu_operations += '<div class="item" data-option="'+tm+'">'+LocalizedStrings.getUI('btn_arithmetic_' + tm)+'</div>';
  14760. }
  14761. menu_operations += '<div class="item" data-option="clear">'+LocalizedStrings.getUI('btn_clear')+'</div>';
  14762. menu_operations += '</div></div>';
  14763. menu_operations = $(menu_operations);
  14764. dom_object.append(menu_operations);
  14765. menu_operations.dropdown({
  14766. onChange: function(value, text, $selectedItem) {
  14767. switch ($($selectedItem).data('option')) {
  14768. case "clear":
  14769. $(dom_object).text('');
  14770. VariableValueMenu.renderMenu(command, ref_object, dom_object, function_obj);
  14771. break;
  14772. default:
  14773. createExpressionAround(command, ref_object, dom_object, function_obj);
  14774. menu_operations.find('.text').text('');
  14775. }
  14776. }
  14777. });*/
  14778. }
  14779. function createExpressionAround(command, ref_object, dom_object, function_obj) {
  14780. (0, _jquery2.default)('<span> ( </span>').insertBefore(dom_object);
  14781. (0, _jquery2.default)('<span> ) </span>').insertAfter(dom_object);
  14782. VariableValueMenu.renderMenu(command, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), dom_object, function_obj);
  14783. }
  14784. /***/ }),
  14785. /***/ "./js/visualUI/commands/break.js":
  14786. /*!***************************************!*\
  14787. !*** ./js/visualUI/commands/break.js ***!
  14788. \***************************************/
  14789. /*! no static exports found */
  14790. /***/ (function(module, exports, __webpack_require__) {
  14791. "use strict";
  14792. Object.defineProperty(exports, "__esModule", {
  14793. value: true
  14794. });
  14795. exports.createFloatingCommand = createFloatingCommand;
  14796. exports.renderCommand = renderCommand;
  14797. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  14798. var _jquery2 = _interopRequireDefault(_jquery);
  14799. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  14800. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  14801. var Models = _interopRequireWildcard(_ivprog_elements);
  14802. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  14803. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  14804. var CommandsManagement = _interopRequireWildcard(_commands);
  14805. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  14806. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14807. function createFloatingCommand() {
  14808. return (0, _jquery2.default)('<div class="ui comment created_element"> <i class="ui icon small quote left"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_break') + ' </span></div>');
  14809. }
  14810. function renderCommand(command, function_obj) {
  14811. var el = (0, _jquery2.default)('<div class="ui comment command_container"> <i class="ui icon small quote left"></i> <i class="ui icon times red button_remove_command"></i> <span>' + _localizedStringsService.LocalizedStrings.getUI('text_break') + '</span> </div>');
  14812. el.data('command', command);
  14813. addHandlers(command, function_obj, el);
  14814. return el;
  14815. }
  14816. function addHandlers(command, function_obj, break_dom) {
  14817. break_dom.find('.button_remove_command').on('click', function () {
  14818. if (CommandsManagement.removeCommand(command, function_obj, break_dom)) {
  14819. break_dom.remove();
  14820. }
  14821. });
  14822. }
  14823. /***/ }),
  14824. /***/ "./js/visualUI/commands/comment.js":
  14825. /*!*****************************************!*\
  14826. !*** ./js/visualUI/commands/comment.js ***!
  14827. \*****************************************/
  14828. /*! no static exports found */
  14829. /***/ (function(module, exports, __webpack_require__) {
  14830. "use strict";
  14831. Object.defineProperty(exports, "__esModule", {
  14832. value: true
  14833. });
  14834. exports.createFloatingCommand = createFloatingCommand;
  14835. exports.renderCommand = renderCommand;
  14836. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  14837. var _jquery2 = _interopRequireDefault(_jquery);
  14838. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  14839. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  14840. var Models = _interopRequireWildcard(_ivprog_elements);
  14841. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  14842. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  14843. var GlobalsManagement = _interopRequireWildcard(_globals);
  14844. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  14845. var VariablesManagement = _interopRequireWildcard(_variables);
  14846. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  14847. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  14848. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  14849. var CommandsManagement = _interopRequireWildcard(_commands);
  14850. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  14851. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14852. function createFloatingCommand() {
  14853. return (0, _jquery2.default)('<div class="ui comment created_element"> <i class="ui icon small quote left"></i> <span class="span_comment_text" "> ' + _localizedStringsService.LocalizedStrings.getUI('text_comment') + ' </span></div>');
  14854. }
  14855. function renderCommand(command, function_obj) {
  14856. var el = (0, _jquery2.default)('<div class="ui comment command_container"> <i class="ui icon small quote left"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_value_menu_div"></div> <div class="div_comment_text">' + '</div> </div>');
  14857. el.data('command', command);
  14858. addHandlers(command, function_obj, el);
  14859. renderTextComment(command, function_obj, el);
  14860. return el;
  14861. }
  14862. function renderTextComment(command, function_obj, el) {
  14863. VariableValueMenu.renderMenu(command, command.comment_text, el.find('.var_value_menu_div'), function_obj, 20);
  14864. }
  14865. function addHandlers(command, function_obj, comment_dom) {
  14866. comment_dom.find('.button_remove_command').on('click', function () {
  14867. if (CommandsManagement.removeCommand(command, function_obj, comment_dom)) {
  14868. comment_dom.remove();
  14869. }
  14870. });
  14871. }
  14872. /***/ }),
  14873. /***/ "./js/visualUI/commands/conditional_expression.js":
  14874. /*!********************************************************!*\
  14875. !*** ./js/visualUI/commands/conditional_expression.js ***!
  14876. \********************************************************/
  14877. /*! no static exports found */
  14878. /***/ (function(module, exports, __webpack_require__) {
  14879. "use strict";
  14880. Object.defineProperty(exports, "__esModule", {
  14881. value: true
  14882. });
  14883. exports.renderExpression = renderExpression;
  14884. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  14885. var _jquery2 = _interopRequireDefault(_jquery);
  14886. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  14887. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  14888. var Models = _interopRequireWildcard(_ivprog_elements);
  14889. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  14890. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  14891. var GlobalsManagement = _interopRequireWildcard(_globals);
  14892. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  14893. var VariablesManagement = _interopRequireWildcard(_variables);
  14894. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  14895. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  14896. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  14897. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14898. function renderExpression(command, expression, function_obj, initial_el_to_render) {
  14899. if (expression.expression == null || expression.expression.length < 1) {
  14900. renderStartMenu(command, expression, function_obj, initial_el_to_render);
  14901. } else {
  14902. var main_div = (0, _jquery2.default)('<div class="expression_elements"></div>');
  14903. switch (expression.expression.type) {
  14904. case Models.EXPRESSION_TYPES.exp_logic:
  14905. renderLogicExpression(command, expression, expression.expression, function_obj, main_div, initial_el_to_render);
  14906. break;
  14907. case Models.EXPRESSION_TYPES.exp_arithmetic:
  14908. renderArithmeticExpression(command, expression, expression.expression, function_obj, main_div);
  14909. break;
  14910. }
  14911. initial_el_to_render.append(main_div);
  14912. }
  14913. }
  14914. function renderArithmeticOperator(command, all_expression, expression_arithmetic, arithmetic_operator, function_obj, element_to_append) {
  14915. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  14916. menu_operator.dropdown({
  14917. values: [{
  14918. name: '>',
  14919. value: Models.ARITHMETIC_COMPARISON.greater_than,
  14920. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.greater_than
  14921. }, {
  14922. name: '<',
  14923. value: Models.ARITHMETIC_COMPARISON.less_than,
  14924. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.less_than
  14925. }, {
  14926. name: '==',
  14927. value: Models.ARITHMETIC_COMPARISON.equals_to,
  14928. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.equals_to
  14929. }, {
  14930. name: '!=',
  14931. value: Models.ARITHMETIC_COMPARISON.not_equals_to,
  14932. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.not_equals_to
  14933. }, {
  14934. name: '>=',
  14935. value: Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to,
  14936. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to
  14937. }, {
  14938. name: '<=',
  14939. value: Models.ARITHMETIC_COMPARISON.less_than_or_equals_to,
  14940. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.less_than_or_equals_to
  14941. }],
  14942. onChange: function onChange(value, text, $selectedItem) {
  14943. expression_arithmetic.operator = value;
  14944. }
  14945. });
  14946. element_to_append.append(menu_operator);
  14947. }
  14948. function renderLogicOperator(command, all_expression, expression_logic, logic_operator, function_obj, element_to_append, initial_el_to_render) {
  14949. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  14950. menu_operator.dropdown({
  14951. values: [{
  14952. name: '==',
  14953. value: Models.LOGIC_COMPARISON.equals_to,
  14954. selected: logic_operator == Models.LOGIC_COMPARISON.equals_to
  14955. }, {
  14956. name: '!=',
  14957. value: Models.LOGIC_COMPARISON.not_equals_to,
  14958. selected: logic_operator == Models.LOGIC_COMPARISON.not_equals_to
  14959. }, {
  14960. name: '&&',
  14961. value: Models.LOGIC_COMPARISON.and,
  14962. selected: logic_operator == Models.LOGIC_COMPARISON.and
  14963. }, {
  14964. name: '||',
  14965. value: Models.LOGIC_COMPARISON.or,
  14966. selected: logic_operator == Models.LOGIC_COMPARISON.or
  14967. }],
  14968. onChange: function onChange(value, text, $selectedItem) {
  14969. if ($selectedItem) {
  14970. expression_logic.operator = value;
  14971. if (expression_logic.second_operand == null) {
  14972. expression_logic.second_operand = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  14973. initial_el_to_render.empty();
  14974. renderExpression(command, all_expression, function_obj, initial_el_to_render);
  14975. }
  14976. }
  14977. }
  14978. });
  14979. element_to_append.append(menu_operator);
  14980. }
  14981. function renderLogicExpression(command, all_expression, expression_logic, function_obj, element_to_append, initial_el_to_render) {
  14982. var exp_el_par_1 = (0, _jquery2.default)('<div class="expression_element"> ( </div>');
  14983. var exp_el_expr_el_1 = (0, _jquery2.default)('<div class="expression_element"></div>');
  14984. var exp_el_expr_operand = (0, _jquery2.default)('<div class="expression_element"></div>');
  14985. var exp_el_expr_el_2 = (0, _jquery2.default)('<div class="expression_element"></div>');
  14986. var exp_el_par_2 = (0, _jquery2.default)('<div class="expression_element"> ) </div>');
  14987. if (expression_logic.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  14988. renderLogicExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  14989. } else if (expression_logic.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  14990. renderArithmeticExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  14991. } else {
  14992. VariableValueMenuManagement.renderMenu(command, expression_logic.first_operand, exp_el_expr_el_1, function_obj);
  14993. }
  14994. element_to_append.append(exp_el_par_1);
  14995. element_to_append.append(exp_el_expr_el_1);
  14996. renderLogicOperator(command, all_expression, expression_logic, expression_logic.operator, function_obj, exp_el_expr_operand, initial_el_to_render);
  14997. element_to_append.append(exp_el_expr_operand);
  14998. if (expression_logic.second_operand) {
  14999. if (expression_logic.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15000. renderLogicExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  15001. } else if (expression_logic.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15002. renderArithmeticExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  15003. } else {
  15004. VariableValueMenuManagement.renderMenu(command, expression_logic.second_operand, exp_el_expr_el_2, function_obj);
  15005. }
  15006. element_to_append.append(exp_el_expr_el_2);
  15007. }
  15008. element_to_append.append(exp_el_par_2);
  15009. }
  15010. function renderArithmeticExpression(command, all_expression, expression_arithmetic, function_obj, element_to_append) {
  15011. var exp_el_par_1 = (0, _jquery2.default)('<div class="expression_element"> ( </div>');
  15012. var exp_el_expr_el_1 = (0, _jquery2.default)('<div class="expression_element"></div>');
  15013. var exp_el_expr_operand = (0, _jquery2.default)('<div class="expression_element"></div>');
  15014. var exp_el_expr_el_2 = (0, _jquery2.default)('<div class="expression_element"></div>');
  15015. var exp_el_par_2 = (0, _jquery2.default)('<div class="expression_element"> ) </div>');
  15016. if (expression_arithmetic.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15017. renderLogicExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  15018. } else if (expression_arithmetic.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15019. renderArithmeticExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  15020. } else {
  15021. VariableValueMenuManagement.renderMenu(command, expression_arithmetic.first_operand, exp_el_expr_el_1, function_obj);
  15022. }
  15023. if (expression_arithmetic.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15024. renderLogicExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  15025. } else if (expression_arithmetic.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15026. renderArithmeticExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  15027. } else {
  15028. VariableValueMenuManagement.renderMenu(command, expression_arithmetic.second_operand, exp_el_expr_el_2, function_obj);
  15029. }
  15030. renderArithmeticOperator(command, all_expression, expression_arithmetic, expression_arithmetic.operator, function_obj, exp_el_expr_operand);
  15031. element_to_append.append(exp_el_par_1);
  15032. element_to_append.append(exp_el_expr_el_1);
  15033. element_to_append.append(exp_el_expr_operand);
  15034. element_to_append.append(exp_el_expr_el_2);
  15035. element_to_append.append(exp_el_par_2);
  15036. }
  15037. function renderStartMenu(command, expression, function_obj, initial_el_to_render) {
  15038. var start_menu = '';
  15039. start_menu += '<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  15040. start_menu += '<div class="item" data-exp="' + Models.EXPRESSION_TYPES.exp_logic + '">' + _localizedStringsService.LocalizedStrings.getUI('text_logic_expression') + '</div>';
  15041. start_menu += '<div class="item" data-exp="' + Models.EXPRESSION_TYPES.exp_arithmetic + '">' + _localizedStringsService.LocalizedStrings.getUI('text_arithmetic_expression') + '</div>';
  15042. start_menu += '</div></div>';
  15043. start_menu = (0, _jquery2.default)(start_menu);
  15044. start_menu.dropdown({
  15045. onChange: function onChange(value, text, $selectedItem) {
  15046. switch ($selectedItem.data('exp')) {
  15047. case Models.EXPRESSION_TYPES.exp_logic:
  15048. expression.expression = new Models.LogicExpression(false, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  15049. break;
  15050. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15051. expression.expression = new Models.ArithmeticExpression(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), Models.ARITHMETIC_COMPARISON.less_than);
  15052. break;
  15053. }
  15054. initial_el_to_render.html('');
  15055. renderExpression(command, expression, function_obj, initial_el_to_render);
  15056. }
  15057. });
  15058. initial_el_to_render.append('<div class="expression_element"> ( </div>');
  15059. initial_el_to_render.append(start_menu);
  15060. initial_el_to_render.append('<div class="expression_element"> ) </div>');
  15061. }
  15062. /***/ }),
  15063. /***/ "./js/visualUI/commands/contextualized_menu.js":
  15064. /*!*****************************************************!*\
  15065. !*** ./js/visualUI/commands/contextualized_menu.js ***!
  15066. \*****************************************************/
  15067. /*! no static exports found */
  15068. /***/ (function(module, exports, __webpack_require__) {
  15069. "use strict";
  15070. Object.defineProperty(exports, "__esModule", {
  15071. value: true
  15072. });
  15073. exports.renderMenu = renderMenu;
  15074. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  15075. var _jquery2 = _interopRequireDefault(_jquery);
  15076. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  15077. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15078. var Models = _interopRequireWildcard(_ivprog_elements);
  15079. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15080. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  15081. var CommandsManagement = _interopRequireWildcard(_commands);
  15082. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  15083. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  15084. var _switch = __webpack_require__(/*! ./switch */ "./js/visualUI/commands/switch.js");
  15085. var SwitchManagement = _interopRequireWildcard(_switch);
  15086. var _repeatNtimes = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  15087. var RepeatNTimesManagement = _interopRequireWildcard(_repeatNtimes);
  15088. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  15089. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15090. function renderMenu(command, dom_where_render, function_obj, dom_command) {
  15091. var menu_div = '<div class="ui dropdown menu_commands" ><i class="icon code"></i> <div class="menu"> ';
  15092. if (command.type == Models.COMMAND_TYPES.repeatNtimes || command.type == Models.COMMAND_TYPES.whiletrue || command.type == Models.COMMAND_TYPES.dowhiletrue) {
  15093. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.break + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_break') + ' </a>';
  15094. } else {
  15095. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.break + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_break') + ' </a>';
  15096. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.switchcase + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_case') + ' </a>';
  15097. }
  15098. menu_div += '</div></div>';
  15099. menu_div = (0, _jquery2.default)(menu_div);
  15100. dom_where_render.append(menu_div);
  15101. addHandlers(command, dom_where_render, function_obj, dom_command);
  15102. }
  15103. function addHandlers(command, dom_where_render, function_obj, dom_command) {
  15104. dom_where_render.find('.menu_commands').dropdown({
  15105. on: 'hover'
  15106. });
  15107. dom_where_render.find('.menu_commands a').on('click', function (evt) {
  15108. if (command.type == Models.COMMAND_TYPES.repeatNtimes || command.type == Models.COMMAND_TYPES.whiletrue || command.type == Models.COMMAND_TYPES.dowhiletrue) {
  15109. if (command.commands_block == null || command.commands_block.length == 0) {
  15110. command.commands_block = [];
  15111. var new_cmd = CommandsManagement.genericCreateCommand((0, _jquery2.default)(this).data('command'));
  15112. command.commands_block.push(new_cmd);
  15113. CommandsManagement.renderCommand(new_cmd, dom_command.find('.block_commands'), 3, function_obj);
  15114. } else {
  15115. CommandsManagement.createFloatingCommand(function_obj, dom_command.find('.block_commands'), (0, _jquery2.default)(this).data('command'), evt);
  15116. }
  15117. } else {
  15118. switch ((0, _jquery2.default)(this).data('command')) {
  15119. case Models.COMMAND_TYPES.break:
  15120. CommandsManagement.createFloatingCommand(function_obj, null, (0, _jquery2.default)(this).data('command'), evt);
  15121. break;
  15122. case Models.COMMAND_TYPES.switchcase:
  15123. addCaseToSwitch(command, dom_where_render, function_obj, dom_command);
  15124. break;
  15125. }
  15126. }
  15127. });
  15128. }
  15129. function addCaseToSwitch(command, dom_where_render, function_obj, dom_command) {
  15130. if (command.cases == null) {
  15131. command.cases = [];
  15132. }
  15133. var sc = new Models.SwitchCase(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  15134. command.cases.push(sc);
  15135. SwitchManagement.renderCase(sc, command, function_obj, dom_command.find('.all_cases_div'));
  15136. }
  15137. /***/ }),
  15138. /***/ "./js/visualUI/commands/dowhiletrue.js":
  15139. /*!*********************************************!*\
  15140. !*** ./js/visualUI/commands/dowhiletrue.js ***!
  15141. \*********************************************/
  15142. /*! no static exports found */
  15143. /***/ (function(module, exports, __webpack_require__) {
  15144. "use strict";
  15145. Object.defineProperty(exports, "__esModule", {
  15146. value: true
  15147. });
  15148. exports.createFloatingCommand = createFloatingCommand;
  15149. exports.renderCommand = renderCommand;
  15150. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  15151. var _jquery2 = _interopRequireDefault(_jquery);
  15152. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  15153. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15154. var Models = _interopRequireWildcard(_ivprog_elements);
  15155. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15156. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  15157. var GlobalsManagement = _interopRequireWildcard(_globals);
  15158. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  15159. var VariablesManagement = _interopRequireWildcard(_variables);
  15160. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  15161. var CommandsManagement = _interopRequireWildcard(_commands);
  15162. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  15163. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  15164. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  15165. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  15166. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  15167. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15168. function createFloatingCommand() {
  15169. return (0, _jquery2.default)('<div class="ui dowhiletrue created_element"> <i class="ui icon small sync"></i> <span> faça {<br>} enquanto(x < 10) </span></div>');
  15170. }
  15171. function renderCommand(command, function_obj) {
  15172. var ret = '';
  15173. ret += '<div class="ui dowhiletrue command_container"> <i class="ui icon small random command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_do') + ' </span>';
  15174. ret += '<div class="ui block_commands" data-subblock="" data-idcommand="">';
  15175. ret += '</div>';
  15176. ret += '<span> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while') + ' </span> <div class="conditional_expression"></div>';
  15177. ret += '</div>';
  15178. var el = (0, _jquery2.default)(ret);
  15179. el.data('command', command);
  15180. addHandlers(command, function_obj, el);
  15181. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  15182. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  15183. return el;
  15184. }
  15185. function addHandlers(command, function_obj, dowhiletrue_dom) {
  15186. dowhiletrue_dom.find('.button_remove_command').on('click', function () {
  15187. if (CommandsManagement.removeCommand(command, function_obj, dowhiletrue_dom)) {
  15188. dowhiletrue_dom.remove();
  15189. }
  15190. });
  15191. }
  15192. /***/ }),
  15193. /***/ "./js/visualUI/commands/functioncall.js":
  15194. /*!**********************************************!*\
  15195. !*** ./js/visualUI/commands/functioncall.js ***!
  15196. \**********************************************/
  15197. /*! no static exports found */
  15198. /***/ (function(module, exports, __webpack_require__) {
  15199. "use strict";
  15200. Object.defineProperty(exports, "__esModule", {
  15201. value: true
  15202. });
  15203. exports.createFloatingCommand = createFloatingCommand;
  15204. exports.renderCommand = renderCommand;
  15205. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  15206. var _jquery2 = _interopRequireDefault(_jquery);
  15207. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  15208. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15209. var Models = _interopRequireWildcard(_ivprog_elements);
  15210. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15211. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  15212. var GlobalsManagement = _interopRequireWildcard(_globals);
  15213. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  15214. var VariablesManagement = _interopRequireWildcard(_variables);
  15215. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  15216. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  15217. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  15218. var CommandsManagement = _interopRequireWildcard(_commands);
  15219. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  15220. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15221. function createFloatingCommand() {
  15222. return (0, _jquery2.default)('<div class="ui functioncall created_element"> <i class="hand point right icon"></i> <span> funcao() </span></div>');
  15223. }
  15224. function renderCommand(command, function_obj) {
  15225. var el = (0, _jquery2.default)('<div class="ui functioncall command_container"> <i class="hand point right icon command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_value_menu_div"></div> </div>');
  15226. el.data('command', command);
  15227. VariableValueMenu.renderMenu(command, command.function_called, el.find('.var_value_menu_div'), function_obj);
  15228. addHandlers(command, function_obj, el);
  15229. return el;
  15230. }
  15231. function addHandlers(command, function_obj, functioncall_dom) {
  15232. functioncall_dom.find('.button_remove_command').on('click', function () {
  15233. if (CommandsManagement.removeCommand(command, function_obj, functioncall_dom)) {
  15234. functioncall_dom.remove();
  15235. }
  15236. });
  15237. }
  15238. /***/ }),
  15239. /***/ "./js/visualUI/commands/iftrue.js":
  15240. /*!****************************************!*\
  15241. !*** ./js/visualUI/commands/iftrue.js ***!
  15242. \****************************************/
  15243. /*! no static exports found */
  15244. /***/ (function(module, exports, __webpack_require__) {
  15245. "use strict";
  15246. Object.defineProperty(exports, "__esModule", {
  15247. value: true
  15248. });
  15249. exports.createFloatingCommand = createFloatingCommand;
  15250. exports.renderCommand = renderCommand;
  15251. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  15252. var _jquery2 = _interopRequireDefault(_jquery);
  15253. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  15254. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15255. var Models = _interopRequireWildcard(_ivprog_elements);
  15256. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15257. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  15258. var GlobalsManagement = _interopRequireWildcard(_globals);
  15259. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  15260. var VariablesManagement = _interopRequireWildcard(_variables);
  15261. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  15262. var CommandsManagement = _interopRequireWildcard(_commands);
  15263. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  15264. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  15265. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  15266. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15267. function createFloatingCommand() {
  15268. return (0, _jquery2.default)('<div class="ui iftrue created_element"> <i class="ui icon small random"></i> <span> if (x < 1) { } </span></div>');
  15269. }
  15270. function renderCommand(command, function_obj) {
  15271. var ret = '';
  15272. ret += '<div class="ui iftrue command_container"><div class="ui data_block_if" data-if="true"> <i class="ui icon small random command_drag"></i> <i class="ui icon times red button_remove_command"></i> <i class="ui icon redo alternate blue button_refresh_attribution"></i>';
  15273. ret += '<span> ' + _localizedStringsService.LocalizedStrings.getUI('text_if') + '</span>';
  15274. ret += ' <div class="conditional_expression"></div>';
  15275. ret += '<span> </span> ';
  15276. ret += '<div class="ui block_commands commands_if conditional_comands_block" data-if="true">';
  15277. /*if ((writer_obj.commands_block == null)
  15278. || (writer_obj.commands_block.length == 0)) {
  15279. } else {
  15280. for (ki = 0; ki < writer_obj.commands_block.length; ki ++) {
  15281. ret += renderElementCommandGeneric(writer_obj.commands_block[ki], function_index, ki, iftrue_index, (fullpath + ',' + ki));
  15282. }
  15283. }*/
  15284. ret += '</div></div>';
  15285. ret += '<div class="ui data_block_else" data-else="true"> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_else') + ' </span>';
  15286. ret += '<div class="ui block_commands commands_else conditional_comands_block" data-else="true">';
  15287. /*if ((writer_obj.commands_else == null)
  15288. || (writer_obj.commands_else.length == 0)) {
  15289. } else {
  15290. for (ki = 0; ki < writer_obj.commands_else.length; ki ++) {
  15291. ret += renderElementCommandGeneric(writer_obj.commands_else[ki], function_index, ki, iftrue_index, (fullpath + ',' + ki));
  15292. }
  15293. }*/
  15294. ret += '</div>';
  15295. ret += '<span></span></div>';
  15296. ret += '</div>';
  15297. var el = (0, _jquery2.default)(ret);
  15298. el.data('command', command);
  15299. el.find('.block_commands').data('command', command);
  15300. el.find('.data_block_if').data('command', command);
  15301. el.find('.data_block_else').data('command', command);
  15302. //data_block_if
  15303. addHandlers(command, function_obj, el);
  15304. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  15305. el.find('.button_refresh_attribution').on('click', function () {
  15306. el.find('.conditional_expression').empty();
  15307. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  15308. });
  15309. return el;
  15310. }
  15311. function addHandlers(command, function_obj, iftrue_dom) {
  15312. iftrue_dom.find('.button_remove_command').on('click', function () {
  15313. if (CommandsManagement.removeCommand(command, function_obj, iftrue_dom)) {
  15314. iftrue_dom.remove();
  15315. }
  15316. });
  15317. }
  15318. /***/ }),
  15319. /***/ "./js/visualUI/commands/reader.js":
  15320. /*!****************************************!*\
  15321. !*** ./js/visualUI/commands/reader.js ***!
  15322. \****************************************/
  15323. /*! no static exports found */
  15324. /***/ (function(module, exports, __webpack_require__) {
  15325. "use strict";
  15326. Object.defineProperty(exports, "__esModule", {
  15327. value: true
  15328. });
  15329. exports.createFloatingCommand = createFloatingCommand;
  15330. exports.renderCommand = renderCommand;
  15331. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  15332. var _jquery2 = _interopRequireDefault(_jquery);
  15333. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  15334. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15335. var Models = _interopRequireWildcard(_ivprog_elements);
  15336. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15337. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  15338. var GlobalsManagement = _interopRequireWildcard(_globals);
  15339. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  15340. var VariablesManagement = _interopRequireWildcard(_variables);
  15341. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  15342. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  15343. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  15344. var CommandsManagement = _interopRequireWildcard(_commands);
  15345. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  15346. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15347. function createFloatingCommand() {
  15348. return (0, _jquery2.default)('<div class="ui reader created_element"> <i class="ui icon small download"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_command_read') + ' var </span></div>');
  15349. }
  15350. function renderCommand(command, function_obj) {
  15351. var el = '<div class="ui reader command_container"> <i class="ui icon small download command_drag"></i> <i class="ui icon times red button_remove_command"></i> <span>' + _localizedStringsService.LocalizedStrings.getUI('text_command_read') + ' ( </span> <div class="var_value_menu_div"></div> <span class="close_parentheses">)</span> </div>';
  15352. el = (0, _jquery2.default)(el);
  15353. el.data('command', command);
  15354. VariableValueMenu.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  15355. addHandlers(command, function_obj, el);
  15356. return el;
  15357. }
  15358. function addHandlers(command, function_obj, reader_dom) {
  15359. reader_dom.find('.button_remove_command').on('click', function () {
  15360. if (CommandsManagement.removeCommand(command, function_obj, reader_dom)) {
  15361. reader_dom.remove();
  15362. }
  15363. });
  15364. }
  15365. /***/ }),
  15366. /***/ "./js/visualUI/commands/repeatNtimes.js":
  15367. /*!**********************************************!*\
  15368. !*** ./js/visualUI/commands/repeatNtimes.js ***!
  15369. \**********************************************/
  15370. /*! no static exports found */
  15371. /***/ (function(module, exports, __webpack_require__) {
  15372. "use strict";
  15373. Object.defineProperty(exports, "__esModule", {
  15374. value: true
  15375. });
  15376. exports.createFloatingCommand = createFloatingCommand;
  15377. exports.renderCommand = renderCommand;
  15378. exports.manageExpressionElements = manageExpressionElements;
  15379. exports.manageClearExpressionElements = manageClearExpressionElements;
  15380. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  15381. var _jquery2 = _interopRequireDefault(_jquery);
  15382. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  15383. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15384. var Models = _interopRequireWildcard(_ivprog_elements);
  15385. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15386. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  15387. var GlobalsManagement = _interopRequireWildcard(_globals);
  15388. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  15389. var VariablesManagement = _interopRequireWildcard(_variables);
  15390. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  15391. var CommandsManagement = _interopRequireWildcard(_commands);
  15392. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  15393. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  15394. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  15395. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  15396. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  15397. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  15398. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  15399. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15400. function createFloatingCommand() {
  15401. return (0, _jquery2.default)('<div class="ui repeatNtimes created_element"> <i class="ui icon small sync"></i> <span> para (x = 0; x < 10; x ++) { } </span></div>');
  15402. }
  15403. function renderCommand(command, function_obj) {
  15404. var ret = '<div class="ui repeatNtimes command_container"> <i class="ui icon small random command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_for') + ' ( </span> <div class="ui attribution_expression"><div class="ui variable_attribution"></div> <span class="text_receives"></span> <div class="ui var_value_expression"></div> </div> ; <div class="conditional_expression"></div> ; <div class="ui incrementation_field"><div class="ui incrementation_variable"></div> <span class="text_inc_receives"></span> <div class="ui first_operand"></div><div class="ui operator"></div><div class="ui second_operand"></div></div> ) </span>';
  15405. ret += '<div class="ui block_commands">';
  15406. ret += '</div>';
  15407. ret += '<span> </span>';
  15408. ret += '</div>';
  15409. var el = (0, _jquery2.default)(ret);
  15410. el.data('command', command);
  15411. addHandlers(command, function_obj, el);
  15412. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  15413. VariableValueMenu.renderMenu(command, command.var_attribution, el.find('.variable_attribution'), function_obj);
  15414. ConditionalExpressionManagement.renderExpression(command, command.expression2, function_obj, el.find('.conditional_expression'));
  15415. VariableValueMenu.renderMenu(command, command.var_incrementation, el.find('.incrementation_variable'), function_obj);
  15416. return el;
  15417. }
  15418. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  15419. if (dom_object.hasClass('variable_attribution')) {
  15420. (0, _jquery2.default)(dom_object).parent().find('.text_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  15421. command.expression1 = new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  15422. (0, _jquery2.default)(dom_object).parent().find('.var_value_expression').empty();
  15423. VariableValueMenu.renderMenu(command, command.expression1, (0, _jquery2.default)(dom_object).parent().find('.var_value_expression'), function_obj);
  15424. }
  15425. if (dom_object.hasClass('incrementation_variable')) {
  15426. (0, _jquery2.default)(dom_object).parent().find('.text_inc_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  15427. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.exp_op_exp, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), Models.ARITHMETIC_TYPES.plus, new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  15428. command.expression3 = exp;
  15429. VariableValueMenu.renderMenu(command, command.expression3.itens[0], (0, _jquery2.default)(dom_object).parent().find('.first_operand'), function_obj);
  15430. renderOperator(command, function_obj, (0, _jquery2.default)(dom_object).parent().find('.operator'), command.expression3, 1);
  15431. VariableValueMenu.renderMenu(command, command.expression3.itens[2], (0, _jquery2.default)(dom_object).parent().find('.second_operand'), function_obj);
  15432. }
  15433. }
  15434. function manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  15435. if (dom_object.hasClass('variable_attribution')) {
  15436. (0, _jquery2.default)(dom_object).parent().find('.text_receives').text('');
  15437. command.expression1 = null;
  15438. (0, _jquery2.default)(dom_object).parent().find('.var_value_expression').empty();
  15439. }
  15440. if (dom_object.hasClass('incrementation_variable')) {
  15441. (0, _jquery2.default)(dom_object).parent().find('.text_inc_receives').text('');
  15442. command.expression3 = null;
  15443. (0, _jquery2.default)(dom_object).parent().find('.first_operand').empty();
  15444. (0, _jquery2.default)(dom_object).parent().find('.operator').empty();
  15445. (0, _jquery2.default)(dom_object).parent().find('.second_operand').empty();
  15446. }
  15447. }
  15448. function addHandlers(command, function_obj, repeatNtimes_dom) {
  15449. repeatNtimes_dom.find('.button_remove_command').on('click', function () {
  15450. if (CommandsManagement.removeCommand(command, function_obj, repeatNtimes_dom)) {
  15451. repeatNtimes_dom.remove();
  15452. }
  15453. });
  15454. }
  15455. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  15456. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div></div>');
  15457. menu_operator.dropdown({
  15458. values: [{
  15459. name: '+',
  15460. value: Models.ARITHMETIC_TYPES.plus,
  15461. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.plus
  15462. }, {
  15463. name: '-',
  15464. value: Models.ARITHMETIC_TYPES.minus,
  15465. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.minus
  15466. }, {
  15467. name: '*',
  15468. value: Models.ARITHMETIC_TYPES.multiplication,
  15469. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.multiplication
  15470. }, {
  15471. name: '/',
  15472. value: Models.ARITHMETIC_TYPES.division,
  15473. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.division
  15474. }, {
  15475. name: '%',
  15476. value: Models.ARITHMETIC_TYPES.module,
  15477. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.module
  15478. }],
  15479. onChange: function onChange(value, text, $selectedItem) {
  15480. expression_element.itens[index_op] = value;
  15481. }
  15482. });
  15483. temp_op.append(menu_operator);
  15484. }
  15485. /***/ }),
  15486. /***/ "./js/visualUI/commands/return.js":
  15487. /*!****************************************!*\
  15488. !*** ./js/visualUI/commands/return.js ***!
  15489. \****************************************/
  15490. /*! no static exports found */
  15491. /***/ (function(module, exports, __webpack_require__) {
  15492. "use strict";
  15493. Object.defineProperty(exports, "__esModule", {
  15494. value: true
  15495. });
  15496. exports.createFloatingCommand = createFloatingCommand;
  15497. exports.renderCommand = renderCommand;
  15498. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  15499. var _jquery2 = _interopRequireDefault(_jquery);
  15500. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  15501. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15502. var Models = _interopRequireWildcard(_ivprog_elements);
  15503. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15504. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  15505. var GlobalsManagement = _interopRequireWildcard(_globals);
  15506. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  15507. var VariablesManagement = _interopRequireWildcard(_variables);
  15508. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  15509. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  15510. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  15511. var CommandsManagement = _interopRequireWildcard(_commands);
  15512. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  15513. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15514. function createFloatingCommand() {
  15515. return (0, _jquery2.default)('<div class="ui return created_element"> <i class="ui icon small reply"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_return') + ' </span></div>');
  15516. }
  15517. function renderCommand(command, function_obj) {
  15518. var el = (0, _jquery2.default)('<div class="ui return command_container"> <i class="ui icon small reply"></i> <i class="ui icon times red button_remove_command"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_return') + ' </span> <div class="var_value_menu_div"></div></div>');
  15519. el.data('command', command);
  15520. addHandlers(command, function_obj, el);
  15521. VariableValueMenu.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  15522. return el;
  15523. }
  15524. function addHandlers(command, function_obj, return_dom) {
  15525. return_dom.find('.button_remove_command').on('click', function () {
  15526. if (CommandsManagement.removeCommand(command, function_obj, return_dom)) {
  15527. return_dom.remove();
  15528. }
  15529. });
  15530. }
  15531. /***/ }),
  15532. /***/ "./js/visualUI/commands/switch.js":
  15533. /*!****************************************!*\
  15534. !*** ./js/visualUI/commands/switch.js ***!
  15535. \****************************************/
  15536. /*! no static exports found */
  15537. /***/ (function(module, exports, __webpack_require__) {
  15538. "use strict";
  15539. Object.defineProperty(exports, "__esModule", {
  15540. value: true
  15541. });
  15542. exports.createFloatingCommand = createFloatingCommand;
  15543. exports.renderCommand = renderCommand;
  15544. exports.renderCase = renderCase;
  15545. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  15546. var _jquery2 = _interopRequireDefault(_jquery);
  15547. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  15548. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15549. var Models = _interopRequireWildcard(_ivprog_elements);
  15550. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15551. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  15552. var GlobalsManagement = _interopRequireWildcard(_globals);
  15553. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  15554. var VariablesManagement = _interopRequireWildcard(_variables);
  15555. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  15556. var CommandsManagement = _interopRequireWildcard(_commands);
  15557. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  15558. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  15559. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  15560. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  15561. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  15562. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15563. function createFloatingCommand() {
  15564. return (0, _jquery2.default)('<div class="ui switch created_element"> <i class="ui icon small random"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_switch') + ' ( x ) { <br> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_case') + ' 1: <br> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_case') + ' 2: <br> } </span></div>');
  15565. }
  15566. function renderCommand(command, function_obj) {
  15567. var ret = '';
  15568. ret += '<div class="ui switch command_container"> <i class="ui icon small random command_drag" ></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_switch') + ' ( <div class="ui variable_to_switch"></div> ) <div class="ui all_cases_div"></div></span>';
  15569. ret += '</div>';
  15570. var el = (0, _jquery2.default)(ret);
  15571. el.data('command', command);
  15572. addHandlers(command, function_obj, el);
  15573. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  15574. VariableValueMenu.renderMenu(command, command.variable, el.find('.variable_to_switch'), function_obj);
  15575. if (command.cases) {
  15576. for (var i = 0; i < command.cases.length; i++) {
  15577. renderCase(command.cases[i], command, function_obj, el.find('.all_cases_div'));
  15578. }
  15579. }
  15580. return el;
  15581. }
  15582. function renderCase(switchcase, command, function_obj, el) {
  15583. var casediv = (0, _jquery2.default)('<div class="ui case_div"><i class="ui icon times red button_remove_command"></i><span>' + _localizedStringsService.LocalizedStrings.getUI('text_code_case') + '</span> <div class="ui variable_case"></div>: <div class="case_commands_block"></div></div>');
  15584. VariableValueMenu.renderMenu(command, switchcase.variable_value_menu, casediv.find('.variable_case'), function_obj);
  15585. casediv.data('switchcase', switchcase);
  15586. casediv.find('.case_commands_block').data('switchcase', switchcase);
  15587. el.append(casediv);
  15588. }
  15589. function addHandlers(command, function_obj, switch_dom) {
  15590. switch_dom.find('.button_remove_command').on('click', function () {
  15591. if (CommandsManagement.removeCommand(command, function_obj, switch_dom)) {
  15592. switch_dom.remove();
  15593. }
  15594. });
  15595. }
  15596. /***/ }),
  15597. /***/ "./js/visualUI/commands/variable_value_menu.js":
  15598. /*!*****************************************************!*\
  15599. !*** ./js/visualUI/commands/variable_value_menu.js ***!
  15600. \*****************************************************/
  15601. /*! no static exports found */
  15602. /***/ (function(module, exports, __webpack_require__) {
  15603. "use strict";
  15604. Object.defineProperty(exports, "__esModule", {
  15605. value: true
  15606. });
  15607. exports.VAR_OR_VALUE_TYPES = undefined;
  15608. exports.renderMenu = renderMenu;
  15609. exports.refreshMenu = refreshMenu;
  15610. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  15611. var _jquery2 = _interopRequireDefault(_jquery);
  15612. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  15613. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15614. var Models = _interopRequireWildcard(_ivprog_elements);
  15615. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15616. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  15617. var GlobalsManagement = _interopRequireWildcard(_globals);
  15618. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  15619. var VariablesManagement = _interopRequireWildcard(_variables);
  15620. var _attribution = __webpack_require__(/*! ./attribution */ "./js/visualUI/commands/attribution.js");
  15621. var AttribuitionsManagement = _interopRequireWildcard(_attribution);
  15622. var _writer = __webpack_require__(/*! ./writer */ "./js/visualUI/commands/writer.js");
  15623. var WritersManagement = _interopRequireWildcard(_writer);
  15624. var _repeatNtimes = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  15625. var RepeatNTimesManagement = _interopRequireWildcard(_repeatNtimes);
  15626. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  15627. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15628. var VAR_OR_VALUE_TYPES = exports.VAR_OR_VALUE_TYPES = Object.freeze({ only_variable: 1, only_value: 2, only_function: 3, variable_and_function: 4, variable_and_value_opt: 5,
  15629. value_and_function: 6, all: 7 });
  15630. function renderMenu(command, ref_object, dom_object, function_obj) {
  15631. var size_field = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 2;
  15632. var expression_element = arguments[5];
  15633. var menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom" data-algo="12"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  15634. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_function) {
  15635. menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom"><div class="text"></div><i class="dropdown icon"></i><div class="menu menu_only_functions">';
  15636. menu_var_or_value += '</div>';
  15637. }
  15638. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.variable_and_function || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.value_and_function || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.all) {
  15639. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('btn_function');
  15640. menu_var_or_value += '<div class="menu menu_only_functions">';
  15641. menu_var_or_value += '</div></div>';
  15642. }
  15643. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_variable) {
  15644. menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom"><div class="text"></div><i class="dropdown icon"></i><div class="menu menu_only_vars">';
  15645. menu_var_or_value += '</div>';
  15646. }
  15647. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.variable_and_function || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.variable_and_value_opt || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.all) {
  15648. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('variable');
  15649. menu_var_or_value += '<div class="menu menu_only_vars">';
  15650. menu_var_or_value += '</div></div>';
  15651. }
  15652. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_value) {
  15653. menu_var_or_value = '<input type="text" class="width-dynamic" size="' + size_field + '" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />';
  15654. }
  15655. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.variable_and_value_opt || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.value_and_function || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.all) {
  15656. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_value + '">' + _localizedStringsService.LocalizedStrings.getUI('text_value') + '</div>';
  15657. if (command.type == Models.COMMAND_TYPES.attribution) {
  15658. menu_var_or_value += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  15659. menu_var_or_value += '<div class="menu">';
  15660. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  15661. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  15662. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  15663. menu_var_or_value += '</div></div>';
  15664. }
  15665. }
  15666. menu_var_or_value += '</div></div>';
  15667. menu_var_or_value = (0, _jquery2.default)(menu_var_or_value);
  15668. dom_object.append(menu_var_or_value);
  15669. addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  15670. addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  15671. addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  15672. if (ref_object.content || ref_object.function_called) {
  15673. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  15674. }
  15675. }
  15676. function refreshMenu(menu_var_or_value_dom) {
  15677. console.log('\n\n');
  15678. console.log(menu_var_or_value_dom);
  15679. console.log("olá, fui chamado! note alguns DATAS recuperados: ");
  15680. console.log(menu_var_or_value_dom.data());
  15681. console.log('\n\n\n');
  15682. }
  15683. function renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element) {
  15684. if (ref_object.function_called) {
  15685. menu_var_or_value.remove();
  15686. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  15687. } else if (ref_object.content.type) {
  15688. menu_var_or_value.remove();
  15689. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  15690. } else {
  15691. menu_var_or_value.remove();
  15692. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  15693. }
  15694. }
  15695. function variableValueMenuCode(command, variable_obj, dom_object, function_obj, menu_var_or_value, expression_element) {
  15696. if (variable_obj.content == null && variable_obj.function_called == null) {
  15697. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  15698. return;
  15699. }
  15700. var ret = '';
  15701. if (variable_obj.function_called) {
  15702. if (variable_obj.function_called.parameters_list == null || variable_obj.function_called.length == 0) {
  15703. menu_var_or_value.find('.text').text(' ');
  15704. dom_object.find('.menu_var_or_value_dom').remove();
  15705. var parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  15706. parameters_menu += '<span> ) </span></div>';
  15707. parameters_menu = (0, _jquery2.default)(parameters_menu);
  15708. dom_object.append(parameters_menu);
  15709. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  15710. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  15711. if (command.type == Models.COMMAND_TYPES.attribution) {
  15712. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  15713. context_menu += '<div class="menu">';
  15714. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  15715. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  15716. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  15717. context_menu += '</div></div>';
  15718. }
  15719. context_menu += '</div></div>';
  15720. context_menu = (0, _jquery2.default)(context_menu);
  15721. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  15722. context_menu.dropdown({
  15723. onChange: function onChange(value, text, $selectedItem) {
  15724. if ($selectedItem.data('clear')) {
  15725. console.log('PP1');
  15726. dom_object.text('');
  15727. variable_obj.content = null;
  15728. variable_obj.row = null;
  15729. variable_obj.column = null;
  15730. delete variable_obj.function_called;
  15731. delete variable_obj.parameters_list;
  15732. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  15733. }
  15734. if ($selectedItem.data('exp')) {
  15735. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  15736. }
  15737. }
  15738. });
  15739. } else {
  15740. menu_var_or_value.find('.text').text(' ');
  15741. dom_object.find('.menu_var_or_value_dom').remove();
  15742. var parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  15743. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  15744. parameters_menu += '<div class="parameter_' + j + '"></div>';
  15745. if (j + 1 != variable_obj.function_called.parameters_list.length) {
  15746. parameters_menu += ' , ';
  15747. }
  15748. }
  15749. parameters_menu += '<span> ) </span></div>';
  15750. parameters_menu = (0, _jquery2.default)(parameters_menu);
  15751. dom_object.append(parameters_menu);
  15752. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  15753. renderMenu(command, variable_obj.parameters_list[j], parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  15754. }
  15755. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  15756. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  15757. if (command.type == Models.COMMAND_TYPES.attribution) {
  15758. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  15759. context_menu += '<div class="menu">';
  15760. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  15761. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  15762. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  15763. context_menu += '</div></div>';
  15764. }
  15765. context_menu += '</div></div>';
  15766. context_menu = (0, _jquery2.default)(context_menu);
  15767. context_menu.insertAfter(parameters_menu);
  15768. context_menu.dropdown({
  15769. onChange: function onChange(value, text, $selectedItem) {
  15770. if ($selectedItem.data('clear')) {
  15771. console.log('PP2');
  15772. dom_object.text('');
  15773. variable_obj.content = null;
  15774. variable_obj.row = null;
  15775. variable_obj.column = null;
  15776. delete variable_obj.function_called;
  15777. delete variable_obj.parameters_list;
  15778. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  15779. }
  15780. if ($selectedItem.data('exp')) {
  15781. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  15782. }
  15783. }
  15784. });
  15785. }
  15786. } else if (variable_obj.content.type) {
  15787. var variable_render = "";
  15788. if (variable_obj.content.dimensions == 1) {
  15789. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  15790. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  15791. variable_render += '</div>';
  15792. variable_render = (0, _jquery2.default)(variable_render);
  15793. dom_object.append(variable_render);
  15794. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  15795. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  15796. if (command.type == Models.COMMAND_TYPES.attribution) {
  15797. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  15798. context_menu += '<div class="menu">';
  15799. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  15800. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  15801. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  15802. context_menu += '</div></div>';
  15803. }
  15804. context_menu += '</div></div>';
  15805. context_menu = (0, _jquery2.default)(context_menu);
  15806. variable_render.append(context_menu);
  15807. context_menu.dropdown({
  15808. onChange: function onChange(value, text, $selectedItem) {
  15809. if ($selectedItem.data('clear')) {
  15810. console.log('PP3');
  15811. dom_object.text('');
  15812. variable_obj.content = null;
  15813. variable_obj.row = null;
  15814. variable_obj.column = null;
  15815. delete variable_obj.function_called;
  15816. delete variable_obj.parameters_list;
  15817. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  15818. }
  15819. if ($selectedItem.data('exp')) {
  15820. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  15821. }
  15822. }
  15823. });
  15824. variableValueMenuCode(command, variable_obj.column, (0, _jquery2.default)(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  15825. } else if (variable_obj.content.dimensions == 2) {
  15826. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  15827. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span>';
  15828. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ] </span>';
  15829. variable_render += '</div>';
  15830. variable_render = (0, _jquery2.default)(variable_render);
  15831. dom_object.append(variable_render);
  15832. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  15833. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  15834. if (command.type == Models.COMMAND_TYPES.attribution) {
  15835. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  15836. context_menu += '<div class="menu">';
  15837. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  15838. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  15839. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  15840. context_menu += '</div></div>';
  15841. }
  15842. context_menu += '</div></div>';
  15843. context_menu = (0, _jquery2.default)(context_menu);
  15844. variable_render.append(context_menu);
  15845. context_menu.dropdown({
  15846. onChange: function onChange(value, text, $selectedItem) {
  15847. if ($selectedItem.data('clear')) {
  15848. console.log('PP4');
  15849. dom_object.text('');
  15850. variable_obj.content = null;
  15851. variable_obj.row = null;
  15852. variable_obj.column = null;
  15853. delete variable_obj.function_called;
  15854. delete variable_obj.parameters_list;
  15855. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  15856. }
  15857. if ($selectedItem.data('exp')) {
  15858. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  15859. }
  15860. }
  15861. });
  15862. variableValueMenuCode(command, variable_obj.row, (0, _jquery2.default)(variable_render.find('.row_container')), function_obj, menu_var_or_value, expression_element);
  15863. variableValueMenuCode(command, variable_obj.column, (0, _jquery2.default)(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  15864. } else {
  15865. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  15866. variable_render += '</div>';
  15867. variable_render = (0, _jquery2.default)(variable_render);
  15868. dom_object.append(variable_render);
  15869. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  15870. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  15871. if (command.type == Models.COMMAND_TYPES.attribution) {
  15872. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  15873. context_menu += '<div class="menu">';
  15874. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  15875. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  15876. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  15877. context_menu += '</div></div>';
  15878. }
  15879. context_menu += '</div></div>';
  15880. context_menu = (0, _jquery2.default)(context_menu);
  15881. variable_render.append(context_menu);
  15882. context_menu.dropdown({
  15883. onChange: function onChange(value, text, $selectedItem) {
  15884. if ($selectedItem.data('clear')) {
  15885. console.log('PP5');
  15886. dom_object.text('');
  15887. variable_obj.content = null;
  15888. variable_obj.row = null;
  15889. variable_obj.column = null;
  15890. delete variable_obj.function_called;
  15891. delete variable_obj.parameters_list;
  15892. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  15893. }
  15894. if ($selectedItem.data('exp')) {
  15895. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  15896. }
  15897. }
  15898. });
  15899. }
  15900. } else {
  15901. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content + '</span>';
  15902. variable_render += '</div>';
  15903. variable_render = (0, _jquery2.default)(variable_render);
  15904. dom_object.append(variable_render);
  15905. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  15906. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  15907. if (command.type == Models.COMMAND_TYPES.attribution) {
  15908. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  15909. context_menu += '<div class="menu">';
  15910. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  15911. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  15912. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  15913. context_menu += '</div></div>';
  15914. }
  15915. context_menu += '</div></div>';
  15916. context_menu = (0, _jquery2.default)(context_menu);
  15917. if (variable_obj.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  15918. context_menu.insertAfter(variable_render);
  15919. }
  15920. context_menu.dropdown({
  15921. onChange: function onChange(value, text, $selectedItem) {
  15922. if ($selectedItem.data('clear')) {
  15923. console.log('PP6');
  15924. dom_object.text('');
  15925. variable_obj.content = null;
  15926. variable_obj.row = null;
  15927. variable_obj.column = null;
  15928. delete variable_obj.function_called;
  15929. delete variable_obj.parameters_list;
  15930. dom_object.find('.value_rendered').remove();
  15931. dom_object.find('.context_menu_clear').remove();
  15932. dom_object.find('.width-dynamic-minus').remove();
  15933. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  15934. }
  15935. if ($selectedItem.data('exp')) {
  15936. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  15937. }
  15938. }
  15939. });
  15940. variable_render.on('click', function (e) {
  15941. variable_render.remove();
  15942. variable_render.empty();
  15943. variable_render.remove();
  15944. dom_object.empty();
  15945. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  15946. openInputToValue(command, variable_obj, dom_object, menu_var_or_value, function_obj, expression_element);
  15947. });
  15948. }
  15949. }
  15950. function addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  15951. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  15952. sub_menu.text('');
  15953. for (var i = 0; i < window.program_obj.functions.length; i++) {
  15954. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '">' + window.program_obj.functions[i].name + ' </div>');
  15955. temp.data('function_reference', window.program_obj.functions[i]);
  15956. sub_menu.append(temp);
  15957. }
  15958. }
  15959. function addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  15960. var sub_menu = menu_var_or_value.find('.menu_only_vars');
  15961. sub_menu.text('');
  15962. if (window.program_obj.globals) {
  15963. if (ref_object.include_constant) {
  15964. for (var i = 0; i < window.program_obj.globals.length; i++) {
  15965. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  15966. temp.data('variable_reference', window.program_obj.globals[i]);
  15967. sub_menu.append(temp);
  15968. }
  15969. } else {
  15970. for (var i = 0; i < window.program_obj.globals.length; i++) {
  15971. if (!window.program_obj.globals[i].is_constant) {
  15972. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  15973. temp.data('variable_reference', window.program_obj.globals[i]);
  15974. sub_menu.append(temp);
  15975. }
  15976. }
  15977. }
  15978. }
  15979. if (function_obj.parameters_list) {
  15980. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  15981. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.parameters_list[i].name + ' </div>');
  15982. temp.data('variable_reference', function_obj.parameters_list[i]);
  15983. sub_menu.append(temp);
  15984. }
  15985. }
  15986. if (function_obj.variables_list) {
  15987. for (var i = 0; i < function_obj.variables_list.length; i++) {
  15988. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.variables_list[i].name + ' </div>');
  15989. temp.data('variable_reference', function_obj.variables_list[i]);
  15990. sub_menu.append(temp);
  15991. }
  15992. }
  15993. }
  15994. function addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  15995. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  15996. menu_var_or_value.dropdown({
  15997. onChange: function onChange(value, text, $selectedItem) {
  15998. dom_object.find('.var_name').remove();
  15999. switch ($selectedItem.data('option')) {
  16000. case VAR_OR_VALUE_TYPES.only_function:
  16001. openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, (0, _jquery2.default)($selectedItem).data('function_reference'), expression_element);
  16002. break;
  16003. case VAR_OR_VALUE_TYPES.only_value:
  16004. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  16005. break;
  16006. case VAR_OR_VALUE_TYPES.only_variable:
  16007. openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, (0, _jquery2.default)($selectedItem).data('variable_reference'), expression_element);
  16008. break;
  16009. }
  16010. if ($selectedItem.data('exp')) {
  16011. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  16012. }
  16013. if (command.type == Models.COMMAND_TYPES.repeatNtimes) {
  16014. RepeatNTimesManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  16015. }
  16016. }
  16017. });
  16018. }
  16019. dom_object.find('.width-dynamic').on('input', function () {
  16020. var inputWidth = (0, _jquery2.default)(this).textWidth() + 10;
  16021. (0, _jquery2.default)(this).focus();
  16022. var tmpStr = (0, _jquery2.default)(this).val();
  16023. (0, _jquery2.default)(this).val('');
  16024. (0, _jquery2.default)(this).val(tmpStr);
  16025. (0, _jquery2.default)(this).css({
  16026. width: inputWidth
  16027. });
  16028. }).trigger('input');
  16029. }
  16030. function openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, function_selected, expression_element) {
  16031. ref_object.function_called = function_selected;
  16032. ref_object.parameters_list = [];
  16033. if (function_selected.parameters_list != null && function_selected.parameters_list.length > 0) {
  16034. menu_var_or_value.find('.text').text(' ');
  16035. dom_object.find('.menu_var_or_value_dom').remove();
  16036. var parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  16037. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  16038. parameters_menu += '<div class="parameter_' + j + '"></div>';
  16039. if (j + 1 != function_selected.parameters_list.length) {
  16040. parameters_menu += ' , ';
  16041. }
  16042. }
  16043. parameters_menu += '<span> ) </span></div>';
  16044. parameters_menu = (0, _jquery2.default)(parameters_menu);
  16045. dom_object.append(parameters_menu);
  16046. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  16047. var temp = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  16048. ref_object.parameters_list.push(temp);
  16049. renderMenu(command, temp, parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  16050. }
  16051. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  16052. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  16053. if (command.type == Models.COMMAND_TYPES.attribution) {
  16054. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  16055. context_menu += '<div class="menu">';
  16056. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  16057. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  16058. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  16059. context_menu += '</div></div>';
  16060. }
  16061. context_menu += '</div></div>';
  16062. context_menu = (0, _jquery2.default)(context_menu);
  16063. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  16064. context_menu.dropdown({
  16065. onChange: function onChange(value, text, $selectedItem) {
  16066. if ($selectedItem.data('clear')) {
  16067. console.log('PP7');
  16068. dom_object.text('');
  16069. ref_object.content = null;
  16070. ref_object.row = null;
  16071. ref_object.column = null;
  16072. delete ref_object.function_called;
  16073. delete ref_object.parameters_list;
  16074. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  16075. }
  16076. if ($selectedItem.data('exp')) {
  16077. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  16078. }
  16079. }
  16080. });
  16081. } else {
  16082. menu_var_or_value.find('.text').text(' ');
  16083. dom_object.find('.menu_var_or_value_dom').remove();
  16084. var parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  16085. parameters_menu += '<span> ) </span></div>';
  16086. parameters_menu = (0, _jquery2.default)(parameters_menu);
  16087. dom_object.append(parameters_menu);
  16088. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  16089. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  16090. if (command.type == Models.COMMAND_TYPES.attribution) {
  16091. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  16092. context_menu += '<div class="menu">';
  16093. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  16094. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  16095. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  16096. context_menu += '</div></div>';
  16097. }
  16098. context_menu += '</div></div>';
  16099. context_menu = (0, _jquery2.default)(context_menu);
  16100. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  16101. context_menu.dropdown({
  16102. onChange: function onChange(value, text, $selectedItem) {
  16103. if ($selectedItem.data('clear')) {
  16104. console.log('PP8');
  16105. dom_object.text('');
  16106. ref_object.content = null;
  16107. ref_object.row = null;
  16108. ref_object.column = null;
  16109. delete ref_object.function_called;
  16110. delete ref_object.parameters_list;
  16111. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  16112. }
  16113. if ($selectedItem.data('exp')) {
  16114. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  16115. }
  16116. }
  16117. });
  16118. }
  16119. if (command.type == Models.COMMAND_TYPES.attribution) {
  16120. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  16121. }
  16122. if (command.type == Models.COMMAND_TYPES.writer) {
  16123. WritersManagement.addContent(command, ref_object, dom_object, menu_var_or_value, function_obj, ref_object.content);
  16124. }
  16125. }
  16126. function openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected, expression_element) {
  16127. ref_object.content = variable_selected;
  16128. menu_var_or_value.find('.text').text(' ');
  16129. dom_object.find('.menu_var_or_value_dom').remove();
  16130. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_selected.name + '</span>';
  16131. if (variable_selected.dimensions == 1) {
  16132. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  16133. }
  16134. if (variable_selected.dimensions == 2) {
  16135. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span> ';
  16136. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  16137. }
  16138. variable_render += '</div>';
  16139. variable_render = (0, _jquery2.default)(variable_render);
  16140. dom_object.append(variable_render);
  16141. if (variable_selected.dimensions == 1) {
  16142. ref_object.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  16143. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  16144. }
  16145. if (variable_selected.dimensions == 2) {
  16146. ref_object.row = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  16147. renderMenu(command, ref_object.row, variable_render.find('.row_container'), function_obj, 2, expression_element);
  16148. ref_object.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  16149. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  16150. }
  16151. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  16152. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  16153. if (command.type == Models.COMMAND_TYPES.attribution) {
  16154. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  16155. context_menu += '<div class="menu">';
  16156. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  16157. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  16158. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  16159. context_menu += '</div></div>';
  16160. }
  16161. context_menu += '</div></div>';
  16162. context_menu = (0, _jquery2.default)(context_menu);
  16163. context_menu.insertAfter(dom_object.find('.variable_rendered'));
  16164. context_menu.dropdown({
  16165. onChange: function onChange(value, text, $selectedItem) {
  16166. if ($selectedItem.data('clear')) {
  16167. console.log('PP9');
  16168. dom_object.text('');
  16169. ref_object.content = null;
  16170. ref_object.row = null;
  16171. ref_object.column = null;
  16172. delete ref_object.function_called;
  16173. delete ref_object.parameters_list;
  16174. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  16175. }
  16176. if ($selectedItem.data('exp')) {
  16177. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  16178. }
  16179. if (command.type == Models.COMMAND_TYPES.repeatNtimes) {
  16180. RepeatNTimesManagement.manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  16181. }
  16182. }
  16183. });
  16184. if (command.type == Models.COMMAND_TYPES.attribution) {
  16185. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected);
  16186. }
  16187. if (command.type == Models.COMMAND_TYPES.writer) {
  16188. WritersManagement.addContent(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected);
  16189. }
  16190. }
  16191. function openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  16192. if (ref_object.content == null) {
  16193. ref_object.content = "";
  16194. }
  16195. menu_var_or_value.find('.text').text(' ');
  16196. var field = (0, _jquery2.default)('<input type="text" size="2" class="width-dynamic-minus" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />');
  16197. field.insertBefore(dom_object.find('.menu_var_or_value_dom'));
  16198. var rendered = (0, _jquery2.default)('<div class="value_rendered"></div>');
  16199. rendered.insertBefore(field);
  16200. field.focus();
  16201. field.val(ref_object.content);
  16202. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  16203. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  16204. if (command.type == Models.COMMAND_TYPES.attribution) {
  16205. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  16206. context_menu += '<div class="menu">';
  16207. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  16208. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  16209. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  16210. context_menu += '</div></div>';
  16211. }
  16212. context_menu += '</div></div>';
  16213. context_menu = (0, _jquery2.default)(context_menu);
  16214. dom_object.find('.menu_var_or_value_dom').remove();
  16215. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  16216. context_menu.insertAfter(field);
  16217. }
  16218. context_menu.dropdown({
  16219. onChange: function onChange(value, text, $selectedItem) {
  16220. if ($selectedItem.data('clear')) {
  16221. console.log('PP10');
  16222. dom_object.text('');
  16223. dom_object.find('.value_rendered').remove();
  16224. dom_object.find('.context_menu_clear').remove();
  16225. dom_object.find('.width-dynamic-minus').remove();
  16226. ref_object.content = null;
  16227. ref_object.row = null;
  16228. ref_object.column = null;
  16229. delete ref_object.function_called;
  16230. delete ref_object.parameters_list;
  16231. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  16232. }
  16233. if ($selectedItem.data('exp')) {
  16234. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  16235. }
  16236. }
  16237. });
  16238. dom_object.find('.width-dynamic-minus').focusout(function () {
  16239. if ((0, _jquery2.default)(this).val().trim()) {
  16240. ref_object.content = (0, _jquery2.default)(this).val().trim();
  16241. }
  16242. rendered.text(ref_object.content);
  16243. (0, _jquery2.default)(this).remove();
  16244. });
  16245. dom_object.find('.width-dynamic-minus').on('keydown', function (e) {
  16246. var code = e.keyCode || e.which;
  16247. if (code == 13) {
  16248. if ((0, _jquery2.default)(this).val().trim()) {
  16249. ref_object.content = (0, _jquery2.default)(this).val().trim();
  16250. }
  16251. rendered.text(ref_object.content);
  16252. (0, _jquery2.default)(this).remove();
  16253. }
  16254. if (code == 27) {
  16255. rendered.text(ref_object.content);
  16256. (0, _jquery2.default)(this).remove();
  16257. }
  16258. });
  16259. rendered.on('click', function (e) {
  16260. console.log("TTT2");
  16261. rendered.remove();
  16262. rendered.empty();
  16263. rendered.remove();
  16264. dom_object.empty();
  16265. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  16266. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  16267. });
  16268. if (command.type == Models.COMMAND_TYPES.attribution) {
  16269. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  16270. }
  16271. if (command.type == Models.COMMAND_TYPES.writer) {
  16272. WritersManagement.addContent(command, ref_object, dom_object, menu_var_or_value, function_obj, ref_object.content);
  16273. }
  16274. }
  16275. _jquery2.default.fn.textWidth = function (text, font) {
  16276. if (!_jquery2.default.fn.textWidth.fakeEl) _jquery2.default.fn.textWidth.fakeEl = (0, _jquery2.default)('<span>').hide().appendTo(document.body);
  16277. _jquery2.default.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  16278. return _jquery2.default.fn.textWidth.fakeEl.width();
  16279. };
  16280. /***/ }),
  16281. /***/ "./js/visualUI/commands/whiletrue.js":
  16282. /*!*******************************************!*\
  16283. !*** ./js/visualUI/commands/whiletrue.js ***!
  16284. \*******************************************/
  16285. /*! no static exports found */
  16286. /***/ (function(module, exports, __webpack_require__) {
  16287. "use strict";
  16288. Object.defineProperty(exports, "__esModule", {
  16289. value: true
  16290. });
  16291. exports.createFloatingCommand = createFloatingCommand;
  16292. exports.renderCommand = renderCommand;
  16293. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16294. var _jquery2 = _interopRequireDefault(_jquery);
  16295. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16296. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16297. var Models = _interopRequireWildcard(_ivprog_elements);
  16298. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16299. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  16300. var GlobalsManagement = _interopRequireWildcard(_globals);
  16301. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  16302. var VariablesManagement = _interopRequireWildcard(_variables);
  16303. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16304. var CommandsManagement = _interopRequireWildcard(_commands);
  16305. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  16306. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  16307. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  16308. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  16309. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  16310. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16311. function createFloatingCommand() {
  16312. return (0, _jquery2.default)('<div class="ui whiletrue created_element"> <i class="ui icon small sync"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while') + ' ( x < 10 ) { } </span></div>');
  16313. }
  16314. function renderCommand(command, function_obj) {
  16315. var ret = '';
  16316. ret += '<div class="ui whiletrue command_container"> <i class="ui icon small random command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while') + ' </span>';
  16317. ret += ' <div class="conditional_expression"></div>';
  16318. ret += ' </span>';
  16319. ret += '<div class="ui block_commands">';
  16320. ret += '</div>';
  16321. ret += '<span> </span>';
  16322. ret += '</div>';
  16323. var el = (0, _jquery2.default)(ret);
  16324. el.data('command', command);
  16325. addHandlers(command, function_obj, el);
  16326. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  16327. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  16328. return el;
  16329. }
  16330. function addHandlers(command, function_obj, whiletrue_dom) {
  16331. whiletrue_dom.find('.button_remove_command').on('click', function () {
  16332. if (CommandsManagement.removeCommand(command, function_obj, whiletrue_dom)) {
  16333. whiletrue_dom.remove();
  16334. }
  16335. });
  16336. }
  16337. /***/ }),
  16338. /***/ "./js/visualUI/commands/writer.js":
  16339. /*!****************************************!*\
  16340. !*** ./js/visualUI/commands/writer.js ***!
  16341. \****************************************/
  16342. /*! no static exports found */
  16343. /***/ (function(module, exports, __webpack_require__) {
  16344. "use strict";
  16345. Object.defineProperty(exports, "__esModule", {
  16346. value: true
  16347. });
  16348. exports.createFloatingCommand = createFloatingCommand;
  16349. exports.renderCommand = renderCommand;
  16350. exports.addContent = addContent;
  16351. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16352. var _jquery2 = _interopRequireDefault(_jquery);
  16353. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16354. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16355. var Models = _interopRequireWildcard(_ivprog_elements);
  16356. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16357. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  16358. var GlobalsManagement = _interopRequireWildcard(_globals);
  16359. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  16360. var VariablesManagement = _interopRequireWildcard(_variables);
  16361. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16362. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  16363. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  16364. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16365. var CommandsManagement = _interopRequireWildcard(_commands);
  16366. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  16367. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16368. function createFloatingCommand() {
  16369. return (0, _jquery2.default)('<div class="ui writer created_element"> <i class="ui icon small upload"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_command_write') + ' var </span></div>');
  16370. }
  16371. function renderCommand(command, function_obj) {
  16372. var ret = '';
  16373. ret += '<div class="ui writer command_container"> <i class="ui icon small upload command_drag"></i> <i class="ui icon times red button_remove_command"></i> <span>' + _localizedStringsService.LocalizedStrings.getUI('text_command_write') + ' ( </span><div class="var_value_menu_div"></div> <span class="close_parentheses">)</span> </div>';
  16374. var el = (0, _jquery2.default)(ret);
  16375. el.data('command', command);
  16376. VariableValueMenu.renderMenu(command, command.content[0], (0, _jquery2.default)(el).find('.var_value_menu_div'), function_obj);
  16377. addHandlers(command, function_obj, el);
  16378. return el;
  16379. }
  16380. function addHandlers(command, function_obj, writer_dom) {
  16381. writer_dom.find('.button_remove_command').on('click', function () {
  16382. if (CommandsManagement.removeCommand(command, function_obj, writer_dom)) {
  16383. writer_dom.remove();
  16384. }
  16385. });
  16386. }
  16387. function addContent(command, ref_object, dom_object, menu_var_or_value, function_obj, ref_object_content) {
  16388. if ((0, _jquery2.default)(dom_object).hasClass('var_value_menu_div')) {
  16389. var icon_add_item = (0, _jquery2.default)('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  16390. (0, _jquery2.default)(icon_add_item).insertAfter(dom_object);
  16391. (0, _jquery2.default)(icon_add_item).on('click', function (e) {
  16392. var new_div_item = (0, _jquery2.default)('<div class="var_value_menu_div"></div>');
  16393. (0, _jquery2.default)(new_div_item).insertAfter(icon_add_item);
  16394. var new_related_menu = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  16395. VariableValueMenu.renderMenu(command, new_related_menu, new_div_item, function_obj);
  16396. command.content.push(new_related_menu);
  16397. });
  16398. }
  16399. }
  16400. /***/ }),
  16401. /***/ "./js/visualUI/functions.js":
  16402. /*!**********************************!*\
  16403. !*** ./js/visualUI/functions.js ***!
  16404. \**********************************/
  16405. /*! no static exports found */
  16406. /***/ (function(module, exports, __webpack_require__) {
  16407. "use strict";
  16408. Object.defineProperty(exports, "__esModule", {
  16409. value: true
  16410. });
  16411. exports.renderFunction = renderFunction;
  16412. exports.initVisualUI = initVisualUI;
  16413. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16414. var _jquery2 = _interopRequireDefault(_jquery);
  16415. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  16416. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16417. var Models = _interopRequireWildcard(_ivprog_elements);
  16418. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16419. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  16420. var GlobalsManagement = _interopRequireWildcard(_globals);
  16421. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  16422. var VariablesManagement = _interopRequireWildcard(_variables);
  16423. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  16424. var CommandsManagement = _interopRequireWildcard(_commands);
  16425. var _code_generator = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  16426. var CodeManagement = _interopRequireWildcard(_code_generator);
  16427. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16428. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  16429. var _domConsole = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  16430. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  16431. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  16432. var _melankeWatchjs = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  16433. var _melankeWatchjs2 = _interopRequireDefault(_melankeWatchjs);
  16434. var _semanticAnalyser = __webpack_require__(/*! ../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  16435. var _ivprogAssessment = __webpack_require__(/*! ../assessment/ivprogAssessment */ "./js/assessment/ivprogAssessment.js");
  16436. var _algorithm = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  16437. var AlgorithmManagement = _interopRequireWildcard(_algorithm);
  16438. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  16439. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16440. var counter_new_functions = 0;
  16441. var counter_new_parameters = 0;
  16442. var studentTemp = null;
  16443. var domConsole = null;
  16444. window.studentGrade = null;
  16445. var program = new Models.Program();
  16446. /*const variable1 = new Models.Variable(Types.INTEGER, "a", 1);
  16447. const parameter1 = new Models.Variable(Types.INTEGER, "par_1", 1);
  16448. const command1 = new Models.Comment(new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.only_value, "Testing rendering commands"));
  16449. const sumFunction = new Models.Function("soma", Types.INTEGER, 0, [parameter1], false, false, [], null, [command1]);
  16450. program.addFunction(sumFunction);
  16451. */
  16452. var mainFunction = new Models.Function(_localizedStringsService.LocalizedStrings.getUI("start"), _types.Types.VOID, 0, [], true, false);
  16453. mainFunction.function_comment = new Models.Comment(_localizedStringsService.LocalizedStrings.getUI('text_comment_main'));
  16454. program.addFunction(mainFunction);
  16455. window.program_obj = program;
  16456. window.generator = CodeManagement.generate;
  16457. window.runCodeAssessment = runCodeAssessment;
  16458. window.renderAlgorithm = AlgorithmManagement.renderAlgorithm;
  16459. _melankeWatchjs2.default.watch(program.globals, function () {
  16460. AlgorithmManagement.renderAlgorithm();
  16461. }, 1);
  16462. function addFunctionHandler() {
  16463. var new_function = new Models.Function(_localizedStringsService.LocalizedStrings.getUI("new_function") + "_" + counter_new_functions, _types.Types.VOID, 0, [], false, false, [], new Models.Comment(_localizedStringsService.LocalizedStrings.getUI('text_comment_start')));
  16464. program.addFunction(new_function);
  16465. counter_new_functions++;
  16466. renderFunction(new_function);
  16467. }
  16468. function addParameter(function_obj, function_container) {
  16469. if (function_obj.parameters_list == null) {
  16470. function_obj.parameters_list = [];
  16471. }
  16472. var new_parameter = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI("new_parameter") + "_" + counter_new_parameters);
  16473. function_obj.parameters_list.push(new_parameter);
  16474. counter_new_parameters++;
  16475. renderParameter(function_obj, new_parameter, function_container);
  16476. }
  16477. function updateReturnType(function_obj, new_type) {
  16478. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  16479. function_obj.return_type = new_type;
  16480. function_obj.return_dimensions = new_dimensions;
  16481. }
  16482. function removeFunction(function_obj) {
  16483. var index = program.functions.indexOf(function_obj);
  16484. if (index > -1) {
  16485. program.functions.splice(index, 1);
  16486. }
  16487. }
  16488. function minimizeFunction(function_obj) {
  16489. function_obj.is_hidden = !function_obj.is_hidden;
  16490. }
  16491. function addHandlers(function_obj, function_container) {
  16492. function_container.find('.ui.dropdown.function_return').dropdown({
  16493. onChange: function onChange(value, text, $selectedItem) {
  16494. $selectedItem = (0, _jquery2.default)($selectedItem);
  16495. if ($selectedItem.data('dimensions')) {
  16496. updateReturnType(function_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  16497. } else {
  16498. updateReturnType(function_obj, _types.Types[$selectedItem.data('type')]);
  16499. }
  16500. }
  16501. });
  16502. function_container.find(".name_function_updated").on('click', function (e) {
  16503. enableNameFunctionUpdate(function_obj, function_container);
  16504. });
  16505. function_container.find(".add_parameter_button").on('click', function (e) {
  16506. addParameter(function_obj, function_container);
  16507. });
  16508. function_container.find('.menu_commands').dropdown({
  16509. on: 'hover'
  16510. });
  16511. function_container.find('.menu_commands a').on('click', function (evt) {
  16512. if (function_obj.commands == null || function_obj.commands.length == 0) {
  16513. function_obj.commands = [];
  16514. var new_cmd = CommandsManagement.genericCreateCommand((0, _jquery2.default)(this).data('command'));
  16515. function_obj.commands.push(new_cmd);
  16516. CommandsManagement.renderCommand(new_cmd, function_container.find('.commands_list_div'), 3, function_obj);
  16517. } else {
  16518. CommandsManagement.createFloatingCommand(function_obj, function_container, (0, _jquery2.default)(this).data('command'), evt);
  16519. }
  16520. });
  16521. function_container.find('.add_var_button_function').on('click', function (e) {
  16522. VariablesManagement.addVariable(function_obj, function_container);
  16523. });
  16524. function_container.find('.remove_function_button').on('click', function (e) {
  16525. removeFunction(function_obj);
  16526. function_container.slideUp(400);
  16527. });
  16528. function_container.find('.minimize_function_button').on('click', function (e) {
  16529. minimizeFunction(function_obj);
  16530. function_container.find(".function_area").toggle();
  16531. function_container.find(".add_var_top_button").toggle();
  16532. });
  16533. }
  16534. // Essa função imprime o tipo de retorno da função e cria o menu do tipo 'select' para alteração
  16535. function renderFunctionReturn(function_obj, function_element) {
  16536. var ret = '<div class="ui dropdown function_return">';
  16537. if (function_obj.return_dimensions > 0) {
  16538. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI("vector") + ':' + _localizedStringsService.LocalizedStrings.getUI(function_obj.return_type);
  16539. ret += '</div>';
  16540. } else {
  16541. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(function_obj.return_type) + '</div>';
  16542. }
  16543. ret += '<i class="dropdown icon"></i>' + '<div class="menu">';
  16544. for (var tm in _types.Types) {
  16545. ret += '<div class="item ' + (function_obj.return_type == tm.toLowerCase() && function_obj.return_dimensions < 1 ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  16546. }
  16547. for (var tm in _types.Types) {
  16548. if (tm == _types.Types.VOID.toUpperCase()) {
  16549. continue;
  16550. }
  16551. ret += '<div class="item">' + '<i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item ' + (function_obj.return_type == tm.toLowerCase() && function_obj.return_dimensions > 0 ? ' selected ' : '') + '" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item ' + (function_obj.return_type == tm.toLowerCase() && function_obj.return_dimensions > 0 ? ' selected ' : '') + '" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  16552. }
  16553. ret += '</div></div>';
  16554. ret = (0, _jquery2.default)(ret);
  16555. function_element.find('.function_return').append(ret);
  16556. }
  16557. function renderFunction(function_obj) {
  16558. var appender = '<div class="ui secondary segment function_div list-group-item">';
  16559. if (function_obj.function_comment) {
  16560. //appender += renderComment(function_obj.function_comment, sequence, true, -1);
  16561. }
  16562. appender += '<span class="glyphicon glyphicon-move move_function" aria-hidden="true"><i class="icon sort alternate vertical"></i></span>';
  16563. appender += (function_obj.is_main ? '<div class="div_start_minimize_v"> </div>' : '<button class="ui icon button large remove_function_button"><i class="red icon times"></i></button>') + '<button class="ui icon button tiny minimize_function_button"><i class="icon window minimize"></i></button>';
  16564. appender += '<div class="ui small icon buttons add_var_top_button"><div class="ui icon button add_var_button_function"><i class="icon superscript"></i></div>';
  16565. appender += '<div class="ui icon button dropdown menu_commands" ><i class="icon code"></i> <div class="menu"> ';
  16566. appender += '<a class="item" data-command="' + Models.COMMAND_TYPES.reader + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_read_var') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.writer + '"><i class="upload icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_write_var') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.comment + '"><i class="quote left icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_comment') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.attribution + '"><i class="arrow left icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_attribution') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.functioncall + '"><i class="hand point right icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_functioncall') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.iftrue + '" ><i class="random icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_iftrue') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.repeatNtimes + '"><i class="sync icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_repeatNtimes') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.whiletrue + '"><i class="sync icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_whiletrue') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.dowhiletrue + '"><i class="sync icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_dowhiletrue') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.switch + '"><i class="list icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_switch') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.return + '"><i class="reply icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_btn_return') + '</a>' + '</div></div></div>';
  16567. appender += '<div class="function_signature_div">' + _localizedStringsService.LocalizedStrings.getUI("function") + ' ';
  16568. if (function_obj.is_main) {
  16569. appender += '<div class="function_name_div"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' + _localizedStringsService.LocalizedStrings.getUI('void') + ' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="span_name_function" >' + function_obj.name + '</span> </div> ' + '( <div class="ui large labels parameters_list">';
  16570. } else {
  16571. appender += '<div class="ui function_return"></div>';
  16572. appender += '<div class="function_name_div"><span class="span_name_function name_function_updated">' + function_obj.name + '</span> <i class="icon small pencil alternate enable_edit_name_function name_function_updated"></i></div> ' + '( <i class="ui icon plus square outline add_parameter_button"></i> <div class="ui large labels parameters_list container_parameters_list">';
  16573. }
  16574. appender += '</div> ) </div>' + (function_obj.is_hidden ? ' <div class="function_area" style="display: none;"> ' : ' <div class="function_area"> ') + '<div class="ui top attached segment variables_list_div">' + '</div>' + '<div class="ui bottom attached segment commands_list_div" id="function_drag_cmd_">';
  16575. appender += '</div>';
  16576. appender += '<div class="function_close_div"></div>' + '</div>' + '</div>';
  16577. appender = (0, _jquery2.default)(appender);
  16578. (0, _jquery2.default)('.all_functions').append(appender);
  16579. appender.data('fun', function_obj);
  16580. appender.find('.commands_list_div').data('fun', function_obj);
  16581. renderFunctionReturn(function_obj, appender);
  16582. addHandlers(function_obj, appender);
  16583. // Rendering parameters:
  16584. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  16585. renderParameter(function_obj, function_obj.parameters_list[j], appender);
  16586. }
  16587. // Rendering variables:
  16588. for (var j = 0; j < function_obj.variables_list.length; j++) {
  16589. VariablesManagement.renderVariable(appender, function_obj.variables_list[j], function_obj);
  16590. }
  16591. // Rendering commands:
  16592. for (var j = 0; j < function_obj.commands.length; j++) {
  16593. CommandsManagement.renderCommand(function_obj.commands[j], (0, _jquery2.default)(appender.find('.commands_list_div')[0]), 3, function_obj);
  16594. }
  16595. (0, _jquery2.default)('.minimize_function_button').popup({
  16596. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_minimize"),
  16597. delay: {
  16598. show: 750,
  16599. hide: 0
  16600. }
  16601. });
  16602. }
  16603. function initVisualUI() {
  16604. // MUST USE CONST, LET, OR VAR !!!!!!
  16605. var mainDiv = (0, _jquery2.default)('#visual-main-div');
  16606. // fill mainDiv with functions and globals...
  16607. // renderAlgorithm()...
  16608. (0, _jquery2.default)('.add_function_button').on('click', function () {
  16609. addFunctionHandler();
  16610. });
  16611. (0, _jquery2.default)('.add_global_button').on('click', function () {
  16612. GlobalsManagement.addGlobal(program);
  16613. });
  16614. (0, _jquery2.default)('.run_button').on('click', function () {
  16615. runCode();
  16616. });
  16617. (0, _jquery2.default)('.visual_coding_button').on('click', function () {
  16618. toggleVisualCoding();
  16619. });
  16620. (0, _jquery2.default)('.textual_coding_button').on('click', function () {
  16621. toggleTextualCoding();
  16622. });
  16623. (0, _jquery2.default)('.assessment').on('click', function () {
  16624. runCodeAssessment();
  16625. is_iassign = true;
  16626. });
  16627. (0, _jquery2.default)('.div_toggle_console').on('click', function () {
  16628. toggleConsole();
  16629. });
  16630. }
  16631. var is_iassign = false;
  16632. (0, _jquery2.default)(document).ready(function () {
  16633. for (var i = 0; i < program.functions.length; i++) {
  16634. renderFunction(program.functions[i]);
  16635. }
  16636. var time_show = 750;
  16637. (0, _jquery2.default)('.visual_coding_button').popup({
  16638. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_visual"),
  16639. delay: {
  16640. show: time_show,
  16641. hide: 0
  16642. }
  16643. });
  16644. (0, _jquery2.default)('.textual_coding_button').popup({
  16645. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_textual"),
  16646. delay: {
  16647. show: time_show,
  16648. hide: 0
  16649. }
  16650. });
  16651. (0, _jquery2.default)('.upload_file_button').popup({
  16652. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_upload"),
  16653. delay: {
  16654. show: time_show,
  16655. hide: 0
  16656. }
  16657. });
  16658. (0, _jquery2.default)('.download_file_button').popup({
  16659. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_download"),
  16660. delay: {
  16661. show: time_show,
  16662. hide: 0
  16663. }
  16664. });
  16665. (0, _jquery2.default)('.undo_button').popup({
  16666. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_undo"),
  16667. delay: {
  16668. show: time_show,
  16669. hide: 0
  16670. }
  16671. });
  16672. (0, _jquery2.default)('.redo_button').popup({
  16673. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_redo"),
  16674. delay: {
  16675. show: time_show,
  16676. hide: 0
  16677. }
  16678. });
  16679. (0, _jquery2.default)('.run_button').popup({
  16680. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_run"),
  16681. delay: {
  16682. show: time_show,
  16683. hide: 0
  16684. }
  16685. });
  16686. (0, _jquery2.default)('.assessment_button').popup({
  16687. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_evaluate"),
  16688. delay: {
  16689. show: time_show,
  16690. hide: 0
  16691. }
  16692. });
  16693. (0, _jquery2.default)('.help_button').popup({
  16694. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_help"),
  16695. delay: {
  16696. show: time_show,
  16697. hide: 0
  16698. }
  16699. });
  16700. (0, _jquery2.default)('.add_global_button').popup({
  16701. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_add_global"),
  16702. delay: {
  16703. show: time_show,
  16704. hide: 0
  16705. }
  16706. });
  16707. (0, _jquery2.default)('.div_toggle_console').popup({
  16708. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_console"),
  16709. delay: {
  16710. show: time_show,
  16711. hide: 0
  16712. }
  16713. });
  16714. });
  16715. function runCodeAssessment() {
  16716. toggleConsole(true);
  16717. window.studentGrade = null;
  16718. studentTemp = null;
  16719. var strCode = CodeManagement.generate();
  16720. if (strCode == null) {
  16721. return;
  16722. }
  16723. if (domConsole == null) domConsole = new _domConsole.DOMConsole("#ivprog-term");
  16724. (0, _jquery2.default)("#ivprog-term").slideDown(500);
  16725. var runner = new _ivprogAssessment.IVProgAssessment(strCode, testCases, domConsole);
  16726. runner.runTest().then(function (grade) {
  16727. if (!is_iassign) {
  16728. parent.getEvaluationCallback(grade);
  16729. } else {
  16730. is_iassign = false;
  16731. }
  16732. }).catch(function (err) {
  16733. return domConsole.err(err.message);
  16734. });
  16735. }
  16736. function runCode() {
  16737. toggleConsole(true);
  16738. var strCode = CodeManagement.generate();
  16739. if (strCode == null) {
  16740. return;
  16741. }
  16742. if (domConsole == null) domConsole = new _domConsole.DOMConsole("#ivprog-term");
  16743. (0, _jquery2.default)("#ivprog-term").slideDown(500);
  16744. try {
  16745. var parser = _ivprogParser.IVProgParser.createParser(strCode);
  16746. var analyser = new _semanticAnalyser.SemanticAnalyser(parser.parseTree());
  16747. var data = analyser.analyseTree();
  16748. var proc = new _ivprogProcessor.IVProgProcessor(data);
  16749. proc.registerInput(domConsole);
  16750. proc.registerOutput(domConsole);
  16751. (0, _jquery2.default)("#ivprog-term").addClass('ivprog-term-active');
  16752. proc.interpretAST().then(function (_) {
  16753. domConsole.info("Programa executado com sucesso!");
  16754. (0, _jquery2.default)("#ivprog-term").removeClass('ivprog-term-active');
  16755. }).catch(function (err) {
  16756. domConsole.err(err.message);
  16757. (0, _jquery2.default)("#ivprog-term").removeClass('ivprog-term-active');
  16758. });
  16759. } catch (error) {
  16760. domConsole.err(error.message);
  16761. console.log(error);
  16762. }
  16763. }
  16764. function toggleConsole(is_running) {
  16765. if (is_running) {
  16766. (0, _jquery2.default)('.ivprog-term-div').css('display', 'block');
  16767. (0, _jquery2.default)('#ivprog-term').css('min-height', '160px');
  16768. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-170px');
  16769. return;
  16770. }
  16771. if ((0, _jquery2.default)('#ivprog-term').css('min-height') == '160px') {
  16772. // esconder
  16773. (0, _jquery2.default)('.ivprog-term-div').css('display', 'none');
  16774. (0, _jquery2.default)('#ivprog-term').css('min-height', '0');
  16775. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-30px');
  16776. (0, _jquery2.default)('#ivprog-term').css('padding', '5px');
  16777. } else {
  16778. // mostrar
  16779. (0, _jquery2.default)('.ivprog-term-div').css('display', 'block');
  16780. (0, _jquery2.default)('#ivprog-term').css('min-height', '160px');
  16781. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-170px');
  16782. }
  16783. }
  16784. function waitToCloseConsole() {
  16785. domConsole.info("Aperte qualquer tecla para fechar...");
  16786. var p = new Promise(function (resolve, _) {
  16787. domConsole.requestInput(resolve, true);
  16788. });
  16789. p.then(function (_) {
  16790. domConsole.dispose();
  16791. domConsole = null;
  16792. (0, _jquery2.default)("#ivprog-term").hide();
  16793. });
  16794. }
  16795. function toggleTextualCoding() {
  16796. var code = CodeManagement.generate();
  16797. (0, _jquery2.default)('.ivprog_visual_panel').css('display', 'none');
  16798. (0, _jquery2.default)('.ivprog_textual_panel').css('display', 'block');
  16799. (0, _jquery2.default)('.ivprog_textual_panel').removeClass('loading');
  16800. (0, _jquery2.default)('.ivprog_textual_code').text(code);
  16801. }
  16802. function toggleVisualCoding() {
  16803. (0, _jquery2.default)('.ivprog_textual_panel').addClass('loading');
  16804. (0, _jquery2.default)('.ivprog_textual_panel').css('display', 'none');
  16805. (0, _jquery2.default)('.ivprog_visual_panel').css('display', 'block');
  16806. }
  16807. function removeParameter(function_obj, parameter_obj, parameter_container) {
  16808. var index = function_obj.parameters_list.indexOf(parameter_obj);
  16809. if (index > -1) {
  16810. function_obj.parameters_list.splice(index, 1);
  16811. }
  16812. (0, _jquery2.default)(parameter_container).remove();
  16813. }
  16814. function updateParameterType(parameter_obj, new_type) {
  16815. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  16816. parameter_obj.type = new_type;
  16817. parameter_obj.dimensions = new_dimensions;
  16818. if (new_dimensions > 0) {
  16819. parameter_obj.rows = new_dimensions;
  16820. parameter_obj.columns = 2;
  16821. }
  16822. }
  16823. function renderParameter(function_obj, parameter_obj, function_container) {
  16824. var ret = "";
  16825. ret += '<div class="ui label function_name_parameter">';
  16826. ret += '<div class="ui dropdown parameter_type">';
  16827. if (parameter_obj.dimensions > 0) {
  16828. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(parameter_obj.type);
  16829. ret += '</div>';
  16830. } else {
  16831. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(parameter_obj.type) + '</div>';
  16832. }
  16833. ret += '<i class="dropdown icon"></i>' + '<div class="menu">';
  16834. for (var tm in _types.Types) {
  16835. if (tm == _types.Types.VOID.toUpperCase()) {
  16836. continue;
  16837. }
  16838. ret += '<div class="item ' + (parameter_obj.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  16839. }
  16840. for (var tm in _types.Types) {
  16841. if (tm == _types.Types.VOID.toUpperCase()) {
  16842. continue;
  16843. }
  16844. ret += '<div class="item">' + '<i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  16845. }
  16846. ret += '</div></div>';
  16847. ret += '<span class="span_name_parameter label_enable_name_parameter">' + parameter_obj.name + '</span> <i class="icon small pencil alternate enable_edit_name_parameter label_enable_name_parameter"></i>';
  16848. ret += ' <i class="red icon times remove_parameter"></i></div>';
  16849. ret = (0, _jquery2.default)(ret);
  16850. function_container.find('.container_parameters_list').append(ret);
  16851. ret.find('.remove_parameter').on('click', function (e) {
  16852. removeParameter(function_obj, parameter_obj, ret);
  16853. });
  16854. ret.find('.ui.dropdown.parameter_type').dropdown({
  16855. onChange: function onChange(value, text, $selectedItem) {
  16856. if ((0, _jquery2.default)($selectedItem).data('dimensions')) {
  16857. updateParameterType(parameter_obj, _types.Types[(0, _jquery2.default)($selectedItem).data('type')], (0, _jquery2.default)($selectedItem).data('dimensions'));
  16858. } else {
  16859. updateParameterType(parameter_obj, _types.Types[(0, _jquery2.default)($selectedItem).data('type')]);
  16860. }
  16861. }
  16862. });
  16863. ret.find('.label_enable_name_parameter').on('click', function (e) {
  16864. enableNameParameterUpdate(parameter_obj, ret);
  16865. });
  16866. }
  16867. var opened_name_parameter = false;
  16868. var opened_input_parameter = null;
  16869. function enableNameParameterUpdate(parameter_obj, parent_node) {
  16870. if (opened_name_parameter) {
  16871. (0, _jquery2.default)(opened_input_parameter).focus();
  16872. return;
  16873. }
  16874. opened_name_parameter = true;
  16875. (0, _jquery2.default)(parent_node).find('.span_name_parameter').text('');
  16876. (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + parameter_obj.name + "' />").insertBefore((0, _jquery2.default)(parent_node).find('.span_name_parameter'));
  16877. (0, _jquery2.default)('.width-dynamic').on('input', function () {
  16878. var inputWidth = (0, _jquery2.default)(this).textWidth() + 10;
  16879. opened_input_parameter = this;
  16880. (0, _jquery2.default)(this).focus();
  16881. var tmpStr = (0, _jquery2.default)(this).val();
  16882. (0, _jquery2.default)(this).val('');
  16883. (0, _jquery2.default)(this).val(tmpStr);
  16884. (0, _jquery2.default)(this).css({
  16885. width: inputWidth
  16886. });
  16887. }).trigger('input');
  16888. (0, _jquery2.default)('.width-dynamic').focusout(function () {
  16889. /// update array:
  16890. if ((0, _jquery2.default)(this).val().trim()) {
  16891. parameter_obj.name = (0, _jquery2.default)(this).val().trim();
  16892. (0, _jquery2.default)(parent_node).find('.span_name_parameter').text(parameter_obj.name);
  16893. }
  16894. (0, _jquery2.default)(this).remove();
  16895. /// update elements:
  16896. opened_name_parameter = false;
  16897. opened_input_parameter = false;
  16898. });
  16899. (0, _jquery2.default)('.width-dynamic').on('keydown', function (e) {
  16900. var code = e.keyCode || e.which;
  16901. if (code == 13) {
  16902. if ((0, _jquery2.default)(this).val().trim()) {
  16903. parameter_obj.name = (0, _jquery2.default)(this).val().trim();
  16904. (0, _jquery2.default)(parent_node).find('.span_name_parameter').text(parameter_obj.name);
  16905. }
  16906. (0, _jquery2.default)(this).remove();
  16907. /// update elements:
  16908. opened_name_parameter = false;
  16909. opened_input_parameter = false;
  16910. }
  16911. if (code == 27) {
  16912. (0, _jquery2.default)(parent_node).find('.span_name_parameter').text(parameter_obj.name);
  16913. (0, _jquery2.default)(this).remove();
  16914. /// update elements:
  16915. opened_name_parameter = false;
  16916. opened_input_parameter = false;
  16917. }
  16918. });
  16919. }
  16920. var opened_name_function = false;
  16921. var opened_input = null;
  16922. function enableNameFunctionUpdate(function_obj, parent_node) {
  16923. if (opened_name_function) {
  16924. (0, _jquery2.default)(opened_input).focus();
  16925. return;
  16926. }
  16927. (0, _jquery2.default)(parent_node).find('.span_name_function').text('');
  16928. (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + function_obj.name + "' />").insertBefore((0, _jquery2.default)(parent_node).find('.span_name_function'));
  16929. (0, _jquery2.default)('.width-dynamic').on('input', function () {
  16930. var inputWidth = (0, _jquery2.default)(this).textWidth() + 10;
  16931. opened_input = this;
  16932. (0, _jquery2.default)(this).focus();
  16933. var tmpStr = (0, _jquery2.default)(this).val();
  16934. (0, _jquery2.default)(this).val('');
  16935. (0, _jquery2.default)(this).val(tmpStr);
  16936. (0, _jquery2.default)(this).css({
  16937. width: inputWidth
  16938. });
  16939. }).trigger('input');
  16940. (0, _jquery2.default)('.width-dynamic').focusout(function () {
  16941. /// update array:
  16942. if ((0, _jquery2.default)(this).val().trim()) {
  16943. function_obj.name = (0, _jquery2.default)(this).val().trim();
  16944. }
  16945. (0, _jquery2.default)(this).remove();
  16946. (0, _jquery2.default)(parent_node).find('.span_name_function').text(function_obj.name);
  16947. /// update elements:
  16948. opened_name_function = false;
  16949. opened_input = false;
  16950. });
  16951. (0, _jquery2.default)('.width-dynamic').on('keydown', function (e) {
  16952. var code = e.keyCode || e.which;
  16953. if (code == 13) {
  16954. if ((0, _jquery2.default)(this).val().trim()) {
  16955. function_obj.name = (0, _jquery2.default)(this).val().trim();
  16956. }
  16957. (0, _jquery2.default)(this).remove();
  16958. (0, _jquery2.default)(parent_node).find('.span_name_function').text(function_obj.name);
  16959. /// update elements:
  16960. opened_name_function = false;
  16961. opened_input = false;
  16962. }
  16963. if (code == 27) {
  16964. (0, _jquery2.default)(this).remove();
  16965. (0, _jquery2.default)(parent_node).find('.span_name_function').text(function_obj.name);
  16966. /// update elements:
  16967. opened_name_function = false;
  16968. opened_input = false;
  16969. }
  16970. });
  16971. }
  16972. /***/ }),
  16973. /***/ "./js/visualUI/globals.js":
  16974. /*!********************************!*\
  16975. !*** ./js/visualUI/globals.js ***!
  16976. \********************************/
  16977. /*! no static exports found */
  16978. /***/ (function(module, exports, __webpack_require__) {
  16979. "use strict";
  16980. Object.defineProperty(exports, "__esModule", {
  16981. value: true
  16982. });
  16983. exports.addGlobal = addGlobal;
  16984. exports.renderGlobal = renderGlobal;
  16985. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16986. var _jquery2 = _interopRequireDefault(_jquery);
  16987. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  16988. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16989. var Models = _interopRequireWildcard(_ivprog_elements);
  16990. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16991. __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  16992. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  16993. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16994. window.jQuery = _jquery2.default;
  16995. var counter_new_globals = 0;
  16996. function addGlobal(program) {
  16997. var new_global = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI('new_global') + '_' + counter_new_globals, 1);
  16998. counter_new_globals++;
  16999. program.addGlobal(new_global);
  17000. renderGlobal(new_global);
  17001. }
  17002. function toggleConstant(global_var) {
  17003. global_var.is_constant = !global_var.is_constant;
  17004. }
  17005. function updateName(global_var, new_name) {
  17006. global_var.name = new_name;
  17007. }
  17008. function updateType(global_var, new_type) {
  17009. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  17010. global_var.type = new_type;
  17011. global_var.dimensions = new_dimensions;
  17012. if (new_dimensions > 0) {
  17013. global_var.rows = new_dimensions;
  17014. global_var.columns = 2;
  17015. }
  17016. updateInitialValues(global_var);
  17017. }
  17018. function removeGlobal(global_var, global_container) {
  17019. var index = window.program_obj.globals.indexOf(global_var);
  17020. if (index > -1) {
  17021. window.program_obj.globals.splice(index, 1);
  17022. }
  17023. (0, _jquery2.default)(global_container).remove();
  17024. }
  17025. function updateInitialValues(global_var) {
  17026. if (global_var.type == _types.Types.INTEGER) {
  17027. if (global_var.dimensions == 0) {
  17028. global_var.value = 1;
  17029. }
  17030. if (global_var.dimensions == 1) {
  17031. global_var.value = [1, 1];
  17032. }
  17033. if (global_var.dimensions == 2) {
  17034. global_var.value = [[1, 1], [1, 1]];
  17035. }
  17036. }
  17037. if (global_var.type == _types.Types.REAL) {
  17038. if (global_var.dimensions == 0) {
  17039. global_var.value = 1.0;
  17040. }
  17041. if (global_var.dimensions == 1) {
  17042. global_var.value = [1.0, 1.0];
  17043. }
  17044. if (global_var.dimensions == 2) {
  17045. global_var.value = [[1.0, 1.0], [1.0, 1.0]];
  17046. }
  17047. }
  17048. if (global_var.type == _types.Types.TEXT) {
  17049. if (global_var.dimensions == 0) {
  17050. global_var.value = _localizedStringsService.LocalizedStrings.getUI('text_start');
  17051. }
  17052. if (global_var.dimensions == 1) {
  17053. global_var.value = [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')];
  17054. }
  17055. if (global_var.dimensions == 2) {
  17056. global_var.value = [[_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')], [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')]];
  17057. }
  17058. }
  17059. if (global_var.type == _types.Types.BOOLEAN) {
  17060. if (global_var.dimensions == 0) {
  17061. global_var.value = true;
  17062. }
  17063. if (global_var.dimensions == 1) {
  17064. global_var.value = [true, true];
  17065. }
  17066. if (global_var.dimensions == 2) {
  17067. global_var.value = [[true, true], [true, true]];
  17068. }
  17069. }
  17070. }
  17071. function alternateBooleanGlobalValue(global_var, value_container) {
  17072. global_var.value = !global_var.value;
  17073. (0, _jquery2.default)(value_container).find('.span_value_variable').text(global_var.value);
  17074. }
  17075. function alternateBooleanGlobalVectorValue(global_var, index, value_container) {
  17076. global_var.value[index] = !global_var.value[index];
  17077. (0, _jquery2.default)(value_container).find('.span_value_variable').text(global_var.value[index]);
  17078. }
  17079. function removeGlobalColumnVector(global_var) {
  17080. if (global_var.columns == 0) {
  17081. return;
  17082. }
  17083. global_var.columns--;
  17084. global_var.value.splice(global_var.value.length - 1, 1);
  17085. }
  17086. function addGlobalColumnVector(global_var) {
  17087. global_var.columns++;
  17088. if (global_var.type == _types.Types.INTEGER) {
  17089. global_var.value.push(1);
  17090. }
  17091. if (global_var.type == _types.Types.REAL) {
  17092. global_var.value.push(1.0);
  17093. }
  17094. if (global_var.type == _types.Types.TEXT) {
  17095. global_var.value.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  17096. }
  17097. if (global_var.type == _types.Types.BOOLEAN) {
  17098. global_var.value.push(true);
  17099. }
  17100. }
  17101. function removeColumnGlobalMatrix(global_var) {
  17102. if (global_var.columns == 0) {
  17103. return;
  17104. }
  17105. global_var.columns--;
  17106. for (var i = 0; i < global_var.rows; i++) {
  17107. global_var.value[i].splice(global_var.value[i].length - 1, 1);
  17108. }
  17109. }
  17110. function addColumnGlobalMatrix(global_var) {
  17111. global_var.columns++;
  17112. if (global_var.type == _types.Types.INTEGER) {
  17113. for (var i = 0; i < global_var.rows; i++) {
  17114. global_var.value[i].push(1);
  17115. }
  17116. }
  17117. if (global_var.type == _types.Types.REAL) {
  17118. for (var i = 0; i < global_var.rows; i++) {
  17119. global_var.value[i].push(1.0);
  17120. }
  17121. }
  17122. if (global_var.type == _types.Types.TEXT) {
  17123. for (var i = 0; i < global_var.rows; i++) {
  17124. global_var.value[i].push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  17125. }
  17126. }
  17127. if (global_var.type == _types.Types.BOOLEAN) {
  17128. for (var i = 0; i < global_var.rows; i++) {
  17129. global_var.value[i].push(true);
  17130. }
  17131. }
  17132. }
  17133. function removeLineGlobalMatrix(global_var) {
  17134. if (global_var.rows == 0) {
  17135. return;
  17136. }
  17137. global_var.rows--;
  17138. global_var.value.splice(global_var.value.length - 1, 1);
  17139. }
  17140. function addLineGlobalMatrix(global_var) {
  17141. global_var.rows++;
  17142. if (global_var.type == _types.Types.INTEGER) {
  17143. var n_l = [];
  17144. for (var i = 0; i < global_var.columns; i++) {
  17145. n_l.push(1);
  17146. }
  17147. global_var.value.push(n_l);
  17148. }
  17149. if (global_var.type == _types.Types.REAL) {
  17150. var n_l = [];
  17151. for (i = 0; i < global_var.columns; i++) {
  17152. n_l.push(1.0);
  17153. }
  17154. global_var.value.push(n_l);
  17155. }
  17156. if (global_var.type == _types.Types.TEXT) {
  17157. var n_l = [];
  17158. for (i = 0; i < global_var.columns; i++) {
  17159. n_l.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  17160. }
  17161. global_var.value.push(n_l);
  17162. }
  17163. if (global_var.type == _types.Types.BOOLEAN) {
  17164. var n_l = [];
  17165. for (i = 0; i < global_var.columns; i++) {
  17166. n_l.push(true);
  17167. }
  17168. global_var.value.push(n_l);
  17169. }
  17170. }
  17171. function alternateBooleanGlobalMatrixValue(global_var, row, index, value_container) {
  17172. global_var.value[row][index] = !global_var.value[row][index];
  17173. (0, _jquery2.default)(value_container).find('.span_value_variable').text(global_var.value[row][index]);
  17174. }
  17175. function renderValues(global_var, global_container) {
  17176. var ret = "";
  17177. var j = 0;
  17178. if (global_var.dimensions == 0) {
  17179. if (global_var.type == _types.Types.REAL) {
  17180. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value.toFixed(1) + '</span> </div> ';
  17181. } else {
  17182. if (global_var.type == _types.Types.BOOLEAN) {
  17183. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + global_var.value + '</span> </div> ';
  17184. } else {
  17185. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value + '</span> </div> ';
  17186. }
  17187. }
  17188. } else {
  17189. ret += '<table class="tabela_var">';
  17190. if (global_var.dimensions == 1) {
  17191. ret += '<tr>';
  17192. if (global_var.type == _types.Types.REAL) {
  17193. for (var k = 0; k < global_var.columns; k++) {
  17194. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k].toFixed(1) + '</span></td>';
  17195. }
  17196. } else {
  17197. for (var k = 0; k < global_var.columns; k++) {
  17198. if (global_var.type == _types.Types.BOOLEAN) {
  17199. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + global_var.value[k] + '</span></td>';
  17200. } else {
  17201. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k] + '</span>' + '</td>';
  17202. }
  17203. }
  17204. }
  17205. ret += '</tr>';
  17206. ret += '</table>';
  17207. ret += '<div class="buttons_manage_columns"><i class="ui icon minus square outline remove_global_vector_column"></i>' + ' <i class="ui icon plus square outline add_global_vector_column"></i></div>';
  17208. }
  17209. if (global_var.dimensions == 2) {
  17210. if (global_var.type == _types.Types.REAL) {
  17211. for (var l = 0; l < global_var.rows; l++) {
  17212. ret += '<tr>';
  17213. for (var k = 0; k < global_var.columns; k++) {
  17214. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  17215. }
  17216. ret += '</tr>';
  17217. }
  17218. } else {
  17219. for (var l = 0; l < global_var.rows; l++) {
  17220. ret += '<tr>';
  17221. for (var k = 0; k < global_var.columns; k++) {
  17222. if (global_var.type == _types.Types.BOOLEAN) {
  17223. ret += '<td><span class="span_value_variable boolean_matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k] + '</span></td>';
  17224. } else {
  17225. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k] + '</span></td>';
  17226. }
  17227. }
  17228. ret += '</tr>';
  17229. }
  17230. }
  17231. if (global_var.rows == 0) {
  17232. ret += '<tr><td></td></tr>';
  17233. }
  17234. ret += '<tr><td colspan="' + global_var.columns + '" class="tr_manage_lines"><i class="ui icon minus square outline remove_global_matrix_line"></i>' + ' <i class="ui icon plus square outline add_global_matrix_line"></i></td></tr>';
  17235. ret += '</table>';
  17236. ret += '<div class="buttons_manage_columns"><i class="ui icon minus square outline remove_global_matrix_column"></i>' + ' <i class="ui icon plus square outline add_global_matrix_column"></i></div>';
  17237. }
  17238. }
  17239. (0, _jquery2.default)(global_container).find(".div_valor_var").html('');
  17240. ret = (0, _jquery2.default)(ret);
  17241. (0, _jquery2.default)(ret).find('.span_value_variable').data('associatedOject', global_var);
  17242. (0, _jquery2.default)(ret).find(".boolean_simple_type").on('click', function (e) {
  17243. alternateBooleanGlobalValue(global_var, this.parentNode);
  17244. });
  17245. (0, _jquery2.default)(ret).find(".simple_var").on('click', function (e) {
  17246. enableGlobalValueUpdate(global_var, this.parentNode);
  17247. });
  17248. (0, _jquery2.default)(ret).find(".boolean_vector_var").on('click', function (e) {
  17249. alternateBooleanGlobalVectorValue(global_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  17250. });
  17251. (0, _jquery2.default)(ret).find(".vector_var").on('click', function (e) {
  17252. enableGlobalVectorValueUpdate(global_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  17253. });
  17254. (0, _jquery2.default)(ret).find(".remove_global_vector_column").on('click', function (e) {
  17255. removeGlobalColumnVector(global_var);
  17256. (0, _jquery2.default)(global_container).find(".div_valor_var").html('');
  17257. renderValues(global_var, global_container);
  17258. });
  17259. (0, _jquery2.default)(ret).find(".add_global_vector_column").on('click', function (e) {
  17260. addGlobalColumnVector(global_var);
  17261. (0, _jquery2.default)(global_container).find(".div_valor_var").html('');
  17262. renderValues(global_var, global_container);
  17263. });
  17264. (0, _jquery2.default)(ret).find(".remove_global_matrix_column").on('click', function (e) {
  17265. removeColumnGlobalMatrix(global_var);
  17266. (0, _jquery2.default)(global_container).find(".div_valor_var").html('');
  17267. renderValues(global_var, global_container);
  17268. });
  17269. (0, _jquery2.default)(ret).find(".add_global_matrix_column").on('click', function (e) {
  17270. addColumnGlobalMatrix(global_var);
  17271. (0, _jquery2.default)(global_container).find(".div_valor_var").html('');
  17272. renderValues(global_var, global_container);
  17273. });
  17274. (0, _jquery2.default)(ret).find(".remove_global_matrix_line").on('click', function (e) {
  17275. removeLineGlobalMatrix(global_var);
  17276. (0, _jquery2.default)(global_container).find(".div_valor_var").html('');
  17277. renderValues(global_var, global_container);
  17278. });
  17279. (0, _jquery2.default)(ret).find(".add_global_matrix_line").on('click', function (e) {
  17280. addLineGlobalMatrix(global_var);
  17281. (0, _jquery2.default)(global_container).find(".div_valor_var").html('');
  17282. renderValues(global_var, global_container);
  17283. });
  17284. (0, _jquery2.default)(ret).find(".boolean_matrix_var").on('click', function (e) {
  17285. alternateBooleanGlobalMatrixValue(global_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  17286. });
  17287. (0, _jquery2.default)(ret).find(".matrix_var").on('click', function (e) {
  17288. enableGlobalMatrixValueUpdate(global_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  17289. });
  17290. (0, _jquery2.default)(global_container).find(".div_valor_var").append(ret);
  17291. updateColumnsAndRowsText(global_container, global_var);
  17292. }
  17293. function addHandlers(global_container) {
  17294. var global_var = global_container.data('associatedOject');
  17295. // Manage constant option:
  17296. global_container.find(".alternate_constant").on('click', function (e) {
  17297. toggleConstant(global_var);
  17298. (0, _jquery2.default)(this).removeClass("on off");
  17299. if (global_var.is_constant) {
  17300. (0, _jquery2.default)(this).addClass("on");
  17301. } else {
  17302. (0, _jquery2.default)(this).addClass("off");
  17303. }
  17304. });
  17305. // Manage global name:
  17306. global_container.find(".enable_edit_name_parameter").on('click', function (e) {
  17307. enableNameUpdate(global_container);
  17308. });
  17309. // Menu to change type:
  17310. global_container.find('.ui.dropdown.global_type').dropdown({
  17311. onChange: function onChange(value, text, $selectedItem) {
  17312. if ((0, _jquery2.default)($selectedItem).data('dimensions')) {
  17313. updateType(global_var, _types.Types[(0, _jquery2.default)($selectedItem).data('type')], (0, _jquery2.default)($selectedItem).data('dimensions'));
  17314. } else {
  17315. updateType(global_var, _types.Types[(0, _jquery2.default)($selectedItem).data('type')]);
  17316. }
  17317. renderValues(global_var, global_container);
  17318. }
  17319. });
  17320. // Remove global:
  17321. global_container.find(".remove_global").on('click', function (e) {
  17322. removeGlobal(global_var, global_container);
  17323. });
  17324. }
  17325. function updateColumnsAndRowsText(global_container, global_var) {
  17326. var prev = global_container.find('.text').text().split('[');
  17327. if (prev.length == 2) {
  17328. var ff = prev[0] + '[ ' + global_var.columns + ' ] ';
  17329. global_container.find('.text').empty();
  17330. global_container.find('.text').text(ff);
  17331. }
  17332. if (prev.length == 3) {
  17333. var ff = prev[0] + '[ ' + global_var.columns + ' ] [ ' + global_var.rows + ' ] ';
  17334. global_container.find('.text').empty();
  17335. global_container.find('.text').text(ff);
  17336. }
  17337. }
  17338. function renderGlobal(global_var) {
  17339. var element = '<div class="ui label global_container"><div class="global_const">const: ';
  17340. element += '<i class="ui icon toggle ' + (global_var.is_constant ? "on" : "off") + ' alternate_constant"></i></div>';
  17341. element += '<div class="ui dropdown global_type">';
  17342. if (global_var.dimensions > 0) {
  17343. element += '<div class="text">' + i18n('ui:vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(global_var.type);
  17344. for (var i = 0; i < global_var.dimensions; i++) {
  17345. element += ' [ <span class="dimensions_' + i + '"></span> ] ';
  17346. }
  17347. element += '</div>';
  17348. } else {
  17349. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(global_var.type.toLowerCase()) + '</div>';
  17350. }
  17351. element += '<div class="menu">';
  17352. for (var tm in _types.Types) {
  17353. if (tm == _types.Types.VOID.toUpperCase()) {
  17354. continue;
  17355. }
  17356. element += '<div class="item ' + (global_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  17357. }
  17358. for (var tm in _types.Types) {
  17359. if (tm == _types.Types.VOID.toUpperCase()) {
  17360. continue;
  17361. }
  17362. element += '<div class="item">' + '<i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  17363. }
  17364. element += '</div></div> <div class="editing_name_var"> <span class="span_name_variable enable_edit_name_parameter">' + global_var.name + '</span> </div> <span class="character_equals"> = </span> ';
  17365. element += '<div class="ui div_valor_var">' + global_var.value + '</div>';
  17366. element += ' <i class="red icon times remove_global"></i></div>';
  17367. var complete_element = (0, _jquery2.default)(element);
  17368. complete_element.data('associatedOject', global_var);
  17369. (0, _jquery2.default)('.list_globals').append(complete_element);
  17370. addHandlers(complete_element);
  17371. renderValues(global_var, complete_element);
  17372. if (global_var.dimensions == 1) {
  17373. complete_element.find('.dimensions_0').text(global_var.columns);
  17374. }
  17375. if (global_var.dimensions == 2) {
  17376. complete_element.find('.dimensions_0').text(global_var.columns);
  17377. complete_element.find('.dimensions_1').text(global_var.rows);
  17378. }
  17379. }
  17380. var opened_name_value_matrix_global_v = false;
  17381. var opened_input_value_matrix_global_v = null;
  17382. function enableGlobalMatrixValueUpdate(global_var, row, index, parent_node) {
  17383. if (opened_name_value_matrix_global_v) {
  17384. (0, _jquery2.default)(opened_input_value_matrix_global_v).focus();
  17385. return;
  17386. }
  17387. opened_name_value_matrix_global_v = true;
  17388. (0, _jquery2.default)(parent_node).find('.span_value_variable').text('');
  17389. if (global_var.type == _types.Types.REAL) {
  17390. (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[row][index].toFixed(1) + "' />").insertBefore((0, _jquery2.default)(parent_node).find('.span_value_variable'));
  17391. } else {
  17392. (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[row][index] + "' />").insertBefore((0, _jquery2.default)(parent_node).find('.span_value_variable'));
  17393. }
  17394. (0, _jquery2.default)('.width-dynamic').on('input', function () {
  17395. var inputWidth = (0, _jquery2.default)(this).textWidth() + 10;
  17396. opened_input_value_matrix_global_v = this;
  17397. (0, _jquery2.default)(this).focus();
  17398. var tmpStr = (0, _jquery2.default)(this).val();
  17399. (0, _jquery2.default)(this).val('');
  17400. (0, _jquery2.default)(this).val(tmpStr);
  17401. (0, _jquery2.default)(this).css({
  17402. width: inputWidth
  17403. });
  17404. }).trigger('input');
  17405. (0, _jquery2.default)('.width-dynamic').focusout(function () {
  17406. /// update array:
  17407. if ((0, _jquery2.default)(this).val().trim()) {
  17408. if (global_var.type == _types.Types.REAL) {
  17409. global_var.value[row][index] = parseFloat((0, _jquery2.default)(this).val().trim());
  17410. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  17411. } else {
  17412. if (global_var.type == _types.Types.INTEGER) {
  17413. global_var.value[row][index] = parseInt((0, _jquery2.default)(this).val().trim());
  17414. } else {
  17415. global_var.value[row][index] = (0, _jquery2.default)(this).val().trim();
  17416. }
  17417. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value[row][index]);
  17418. }
  17419. }
  17420. (0, _jquery2.default)(this).remove();
  17421. /// update elements:
  17422. opened_name_value_matrix_global_v = false;
  17423. opened_input_value_matrix_global_v = false;
  17424. });
  17425. (0, _jquery2.default)('.width-dynamic').on('keydown', function (e) {
  17426. var code = e.keyCode || e.which;
  17427. if (code == 13) {
  17428. if ((0, _jquery2.default)(this).val().trim()) {
  17429. if (global_var.type == _types.Types.REAL) {
  17430. global_var.value[row][index] = parseFloat((0, _jquery2.default)(this).val().trim());
  17431. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  17432. } else {
  17433. if (global_var.type == _types.Types.INTEGER) {
  17434. global_var.value[row][index] = parseInt((0, _jquery2.default)(this).val().trim());
  17435. } else {
  17436. global_var.value[row][index] = (0, _jquery2.default)(this).val().trim();
  17437. }
  17438. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value[row][index]);
  17439. }
  17440. }
  17441. (0, _jquery2.default)(this).remove();
  17442. /// update elements:
  17443. opened_name_value_matrix_global_v = false;
  17444. opened_input_value_matrix_global_v = false;
  17445. }
  17446. if (code == 27) {
  17447. if (global_var.type == _types.Types.REAL) {
  17448. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  17449. } else {
  17450. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value[row][index]);
  17451. }
  17452. (0, _jquery2.default)(this).remove();
  17453. /// update elements:
  17454. opened_name_value_matrix_global_v = false;
  17455. opened_input_value_matrix_global_v = false;
  17456. }
  17457. });
  17458. }
  17459. var opened_name_value_global_var = false;
  17460. var opened_input_value_global_ar = null;
  17461. function enableGlobalValueUpdate(global_var, parent_node) {
  17462. if (opened_name_value_global_var) {
  17463. (0, _jquery2.default)(opened_input_value_global_ar).focus();
  17464. return;
  17465. }
  17466. opened_name_value_global_var = true;
  17467. (0, _jquery2.default)(parent_node).find('.span_value_variable').text('');
  17468. if (global_var.type == _types.Types.REAL) {
  17469. (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value.toFixed(1) + "' />").insertBefore((0, _jquery2.default)(parent_node).find('.span_value_variable'));
  17470. } else {
  17471. (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value + "' />").insertBefore((0, _jquery2.default)(parent_node).find('.span_value_variable'));
  17472. }
  17473. (0, _jquery2.default)('.width-dynamic').on('input', function () {
  17474. var inputWidth = (0, _jquery2.default)(this).textWidth() + 10;
  17475. opened_input_value_global_ar = this;
  17476. (0, _jquery2.default)(this).focus();
  17477. var tmpStr = (0, _jquery2.default)(this).val();
  17478. (0, _jquery2.default)(this).val('');
  17479. (0, _jquery2.default)(this).val(tmpStr);
  17480. (0, _jquery2.default)(this).css({
  17481. width: inputWidth
  17482. });
  17483. }).trigger('input');
  17484. (0, _jquery2.default)('.width-dynamic').focusout(function () {
  17485. /// update array:
  17486. if ((0, _jquery2.default)(this).val().trim()) {
  17487. if (global_var.type == _types.Types.REAL) {
  17488. global_var.value = parseFloat((0, _jquery2.default)(this).val().trim());
  17489. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value.toFixed(1));
  17490. } else {
  17491. if (global_var.type == _types.Types.INTEGER) {
  17492. global_var.value = parseInt((0, _jquery2.default)(this).val().trim());
  17493. } else {
  17494. global_var.value = (0, _jquery2.default)(this).val().trim();
  17495. }
  17496. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value);
  17497. }
  17498. }
  17499. (0, _jquery2.default)(this).remove();
  17500. /// update elements:
  17501. opened_name_value_global_var = false;
  17502. opened_input_value_global_ar = false;
  17503. });
  17504. (0, _jquery2.default)('.width-dynamic').on('keydown', function (e) {
  17505. var code = e.keyCode || e.which;
  17506. if (code == 13) {
  17507. if ((0, _jquery2.default)(this).val().trim()) {
  17508. if (global_var.type == _types.Types.REAL) {
  17509. global_var.value = parseFloat((0, _jquery2.default)(this).val().trim());
  17510. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value.toFixed(1));
  17511. } else {
  17512. if (global_var.type == _types.Types.INTEGER) {
  17513. global_var.value = parseInt((0, _jquery2.default)(this).val().trim());
  17514. } else {
  17515. global_var.value = (0, _jquery2.default)(this).val().trim();
  17516. }
  17517. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value);
  17518. }
  17519. }
  17520. (0, _jquery2.default)(this).remove();
  17521. /// update elements:
  17522. opened_name_value_global_var = false;
  17523. opened_input_value_global_ar = false;
  17524. }
  17525. if (code == 27) {
  17526. if (global_var.type == _types.Types.REAL) {
  17527. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value.toFixed(1));
  17528. } else {
  17529. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value);
  17530. }
  17531. (0, _jquery2.default)(this).remove();
  17532. /// update elements:
  17533. opened_name_value_global_var = false;
  17534. opened_input_value_global_ar = false;
  17535. }
  17536. });
  17537. }
  17538. var opened_name_global = false;
  17539. var opened_input_global = null;
  17540. function enableNameUpdate(global_container) {
  17541. var global_var = global_container.data('associatedOject');
  17542. if (opened_name_global) {
  17543. opened_input_global.focus();
  17544. return;
  17545. }
  17546. opened_name_global = true;
  17547. global_container.find('.span_name_variable').text('');
  17548. (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.name + "' />").insertBefore(global_container.find('.span_name_variable'));
  17549. (0, _jquery2.default)('.width-dynamic').on('input', function () {
  17550. var inputWidth = (0, _jquery2.default)(this).textWidth() + 10;
  17551. opened_input_global = (0, _jquery2.default)(this);
  17552. opened_input_global.focus();
  17553. opened_input_global.css({
  17554. width: inputWidth
  17555. });
  17556. }).trigger('input');
  17557. (0, _jquery2.default)('.width-dynamic').focusout(function () {
  17558. /// update array:
  17559. if ((0, _jquery2.default)(this).val().trim().length > 0) {
  17560. updateName(global_var, (0, _jquery2.default)(this).val().trim());
  17561. global_container.find('.span_name_variable').text(global_var.name);
  17562. } else {
  17563. global_container.find('.span_name_variable').text(global_var.name);
  17564. }
  17565. (0, _jquery2.default)(this).remove();
  17566. /// update elements:
  17567. opened_name_global = false;
  17568. opened_input_global = false;
  17569. });
  17570. (0, _jquery2.default)('.width-dynamic').on('keydown', function (e) {
  17571. var code = e.keyCode || e.which;
  17572. if (code == 13) {
  17573. if ((0, _jquery2.default)(this).val().trim()) {
  17574. updateName(global_var, (0, _jquery2.default)(this).val().trim());
  17575. global_container.find('.span_name_variable').text(global_var.name);
  17576. } else {
  17577. global_container.find('.span_name_variable').text(global_var.name);
  17578. }
  17579. (0, _jquery2.default)(this).remove();
  17580. /// update elements:
  17581. opened_name_global = false;
  17582. opened_input_global = false;
  17583. }
  17584. if (code == 27) {
  17585. global_container.find('.span_name_variable').text(global_var.name);
  17586. (0, _jquery2.default)(this).remove();
  17587. /// update elements:
  17588. opened_name_global = false;
  17589. opened_input_global = false;
  17590. }
  17591. });
  17592. (0, _jquery2.default)('.width-dynamic').select();
  17593. }
  17594. var opened_name_value_vector_global_ = false;
  17595. var opened_input_value_vector_global_ = null;
  17596. function enableGlobalVectorValueUpdate(global_var, index, parent_node) {
  17597. if (opened_name_value_vector_global_) {
  17598. (0, _jquery2.default)(opened_input_value_vector_global_).focus();
  17599. return;
  17600. }
  17601. opened_name_value_vector_global_ = true;
  17602. (0, _jquery2.default)(parent_node).find('.span_value_variable').text('');
  17603. if (global_var.type == _types.Types.REAL) {
  17604. (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[index].toFixed(1) + "' />").insertBefore((0, _jquery2.default)(parent_node).find('.span_value_variable'));
  17605. } else {
  17606. (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[index] + "' />").insertBefore((0, _jquery2.default)(parent_node).find('.span_value_variable'));
  17607. }
  17608. (0, _jquery2.default)('.width-dynamic').on('input', function () {
  17609. var inputWidth = (0, _jquery2.default)(this).textWidth() + 10;
  17610. opened_input_value_vector_global_ = this;
  17611. (0, _jquery2.default)(this).focus();
  17612. var tmpStr = (0, _jquery2.default)(this).val();
  17613. (0, _jquery2.default)(this).val('');
  17614. (0, _jquery2.default)(this).val(tmpStr);
  17615. (0, _jquery2.default)(this).css({
  17616. width: inputWidth
  17617. });
  17618. }).trigger('input');
  17619. (0, _jquery2.default)('.width-dynamic').focusout(function () {
  17620. /// update array:
  17621. if ((0, _jquery2.default)(this).val().trim()) {
  17622. if (global_var.type == _types.Types.REAL) {
  17623. global_var.value[index] = parseFloat((0, _jquery2.default)(this).val().trim());
  17624. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value[index].toFixed(1));
  17625. } else {
  17626. if (global_var.type == _types.Types.INTEGER) {
  17627. global_var.value[index] = parseInt((0, _jquery2.default)(this).val().trim());
  17628. } else {
  17629. global_var.value[index] = (0, _jquery2.default)(this).val().trim();
  17630. }
  17631. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value[index]);
  17632. }
  17633. }
  17634. (0, _jquery2.default)(this).remove();
  17635. /// update elements:
  17636. opened_name_value_vector_global_ = false;
  17637. opened_input_value_vector_global_ = false;
  17638. });
  17639. (0, _jquery2.default)('.width-dynamic').on('keydown', function (e) {
  17640. var code = e.keyCode || e.which;
  17641. if (code == 13) {
  17642. if ((0, _jquery2.default)(this).val().trim()) {
  17643. if (global_var.type == _types.Types.REAL) {
  17644. global_var.value[index] = parseFloat((0, _jquery2.default)(this).val().trim());
  17645. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value[index].toFixed(1));
  17646. } else {
  17647. if (global_var.type == _types.Types.INTEGER) {
  17648. global_var.value[index] = parseInt((0, _jquery2.default)(this).val().trim());
  17649. } else {
  17650. global_var.value[index] = (0, _jquery2.default)(this).val().trim();
  17651. }
  17652. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value[index]);
  17653. }
  17654. }
  17655. (0, _jquery2.default)(this).remove();
  17656. /// update elements:
  17657. opened_name_value_vector_global_ = false;
  17658. opened_input_value_vector_global_ = false;
  17659. }
  17660. if (code == 27) {
  17661. if (global_var.type == _types.Types.REAL) {
  17662. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value[index].toFixed(1));
  17663. } else {
  17664. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value[index]);
  17665. }
  17666. (0, _jquery2.default)(this).remove();
  17667. /// update elements:
  17668. opened_name_value_vector_global_ = false;
  17669. opened_input_value_vector_global_ = false;
  17670. }
  17671. });
  17672. }
  17673. _jquery2.default.fn.textWidth = function (text, font) {
  17674. if (!_jquery2.default.fn.textWidth.fakeEl) _jquery2.default.fn.textWidth.fakeEl = (0, _jquery2.default)('<span>').hide().appendTo(document.body);
  17675. _jquery2.default.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  17676. return _jquery2.default.fn.textWidth.fakeEl.width();
  17677. };
  17678. /***/ }),
  17679. /***/ "./js/visualUI/ivprog_elements.js":
  17680. /*!****************************************!*\
  17681. !*** ./js/visualUI/ivprog_elements.js ***!
  17682. \****************************************/
  17683. /*! no static exports found */
  17684. /***/ (function(module, exports, __webpack_require__) {
  17685. "use strict";
  17686. Object.defineProperty(exports, "__esModule", {
  17687. value: true
  17688. });
  17689. exports.Program = exports.FunctionCallMenu = exports.VariableValueMenu = exports.FunctionCall = exports.SwitchCase = exports.Return = exports.Switch = exports.DoWhileTrue = exports.WhileTrue = exports.RepeatNTimes = exports.IfTrue = exports.ArithmeticExpression = exports.LogicExpression = exports.ConditionalExpression = exports.ExpressionElement = exports.Attribution = exports.Writer = exports.Reader = exports.Break = exports.Comment = exports.Function = exports.Variable = exports.LOGIC_COMPARISON = exports.ARITHMETIC_COMPARISON = exports.EXPRESSION_TYPES = exports.EXPRESSION_ELEMENTS = exports.ARITHMETIC_TYPES = exports.COMMAND_TYPES = undefined;
  17690. var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  17691. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17692. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  17693. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  17694. var _melankeWatchjs = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  17695. var _melankeWatchjs2 = _interopRequireDefault(_melankeWatchjs);
  17696. var _algorithm = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  17697. var AlgorithmManagement = _interopRequireWildcard(_algorithm);
  17698. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17699. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17700. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  17701. var COMMAND_TYPES = exports.COMMAND_TYPES = Object.freeze({ function: "function", comment: "comment", reader: "reader", writer: "writer", attribution: "attribution", iftrue: "iftrue",
  17702. repeatNtimes: "repeatNtimes", whiletrue: "whiletrue", dowhiletrue: "dowhiletrue", switch: "switch", switchcase: "switchcase", functioncall: "functioncall", break: "break",
  17703. return: "return" });
  17704. var ARITHMETIC_TYPES = exports.ARITHMETIC_TYPES = Object.freeze({ plus: "plus", minus: "minus", multiplication: "multiplication", division: "division", module: "module", none: "none" });
  17705. var EXPRESSION_ELEMENTS = exports.EXPRESSION_ELEMENTS = Object.freeze({ exp_op_exp: "exp_op_exp", op_exp: "op_exp", par_exp_par: "par_exp_par", start_point: "start_point" });
  17706. var EXPRESSION_TYPES = exports.EXPRESSION_TYPES = Object.freeze({ exp_conditional: "exp_conditional", exp_logic: "exp_logic", exp_arithmetic: "exp_arithmetic" });
  17707. var ARITHMETIC_COMPARISON = exports.ARITHMETIC_COMPARISON = Object.freeze({ greater_than: "greater_than", less_than: "less_than", equals_to: "equals_to", not_equals_to: "not_equals_to", greater_than_or_equals_to: "greater_than_or_equals_to", less_than_or_equals_to: "less_than_or_equals_to" });
  17708. var LOGIC_COMPARISON = exports.LOGIC_COMPARISON = Object.freeze({ equals_to: "equals_to", not_equals_to: "not_equals_to", and: "and", or: "or" });
  17709. var Variable = exports.Variable = function Variable(type, name, value) {
  17710. var dimensions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  17711. var is_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  17712. var rows = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  17713. var columns = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
  17714. _classCallCheck(this, Variable);
  17715. this.type = type;
  17716. this.name = name;
  17717. this.value = value;
  17718. this.dimensions = dimensions;
  17719. this.is_constant = is_constant;
  17720. this.rows = rows;
  17721. this.columns = columns;
  17722. };
  17723. var Function = exports.Function = function Function(name) {
  17724. var return_type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _types.Types.VOID;
  17725. var return_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  17726. var parameters_list = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  17727. var is_main = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  17728. var is_hidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
  17729. var variables_list = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [];
  17730. var function_comment = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  17731. var commands = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : [];
  17732. _classCallCheck(this, Function);
  17733. this.type = COMMAND_TYPES.function;
  17734. this.name = name;
  17735. this.return_type = return_type;
  17736. this.return_dimensions = return_dimensions;
  17737. this.parameters_list = parameters_list;
  17738. this.is_main = is_main;
  17739. this.is_hidden = is_hidden;
  17740. this.variables_list = variables_list;
  17741. this.function_comment = function_comment;
  17742. this.commands = commands;
  17743. };
  17744. var Comment = exports.Comment = function Comment(comment_text) {
  17745. _classCallCheck(this, Comment);
  17746. this.type = COMMAND_TYPES.comment;
  17747. this.comment_text = comment_text;
  17748. };
  17749. var Break = exports.Break = function Break() {
  17750. _classCallCheck(this, Break);
  17751. this.type = COMMAND_TYPES.break;
  17752. };
  17753. var Reader = exports.Reader = function Reader() {
  17754. var variable_value_menu = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new VariableValueMenu();
  17755. _classCallCheck(this, Reader);
  17756. this.type = COMMAND_TYPES.reader;
  17757. this.variable_value_menu = variable_value_menu;
  17758. };
  17759. var Writer = exports.Writer = function Writer(content) {
  17760. _classCallCheck(this, Writer);
  17761. this.type = COMMAND_TYPES.writer;
  17762. this.content = content;
  17763. };
  17764. var Attribution = exports.Attribution = function Attribution(variable) {
  17765. var expression = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  17766. _classCallCheck(this, Attribution);
  17767. this.type = COMMAND_TYPES.attribution;
  17768. this.variable = variable;
  17769. this.expression = expression;
  17770. };
  17771. var ExpressionElement = exports.ExpressionElement = function ExpressionElement(type_exp) {
  17772. var itens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  17773. _classCallCheck(this, ExpressionElement);
  17774. this.type_exp = type_exp;
  17775. this.itens = itens;
  17776. };
  17777. var ConditionalExpression = exports.ConditionalExpression = function ConditionalExpression(expression) {
  17778. _classCallCheck(this, ConditionalExpression);
  17779. this.type = EXPRESSION_TYPES.exp_conditional;
  17780. this.expression = expression;
  17781. };
  17782. var LogicExpression = exports.LogicExpression = function LogicExpression(has_neg, first_operand, second_operand, operator) {
  17783. _classCallCheck(this, LogicExpression);
  17784. this.type = EXPRESSION_TYPES.exp_logic;
  17785. this.has_neg = has_neg;
  17786. this.first_operand = first_operand;
  17787. this.second_operand = second_operand;
  17788. this.operator = operator;
  17789. };
  17790. var ArithmeticExpression = exports.ArithmeticExpression = function ArithmeticExpression(first_operand, second_operand, operator) {
  17791. _classCallCheck(this, ArithmeticExpression);
  17792. this.type = EXPRESSION_TYPES.exp_arithmetic;
  17793. this.first_operand = first_operand;
  17794. this.second_operand = second_operand;
  17795. this.operator = operator;
  17796. };
  17797. var IfTrue = exports.IfTrue = function IfTrue(expression, commands_block, commands_else) {
  17798. _classCallCheck(this, IfTrue);
  17799. this.type = COMMAND_TYPES.iftrue;
  17800. this.expression = expression;
  17801. this.commands_block = commands_block;
  17802. this.commands_else = commands_else;
  17803. };
  17804. var RepeatNTimes = exports.RepeatNTimes = function RepeatNTimes(var_attribution, var_incrementation, expression1, expression2, expression3, commands_block) {
  17805. _classCallCheck(this, RepeatNTimes);
  17806. this.type = COMMAND_TYPES.repeatNtimes;
  17807. this.var_attribution = var_attribution;
  17808. this.var_incrementation = var_incrementation;
  17809. this.expression1 = expression1;
  17810. this.expression2 = expression2;
  17811. this.expression3 = expression3;
  17812. this.commands_block = commands_block;
  17813. };
  17814. var WhileTrue = exports.WhileTrue = function WhileTrue(expression, commands_block) {
  17815. _classCallCheck(this, WhileTrue);
  17816. this.type = COMMAND_TYPES.whiletrue;
  17817. this.expression = expression;
  17818. this.commands_block = commands_block;
  17819. };
  17820. var DoWhileTrue = exports.DoWhileTrue = function DoWhileTrue(expression, commands_block) {
  17821. _classCallCheck(this, DoWhileTrue);
  17822. this.type = COMMAND_TYPES.dowhiletrue;
  17823. this.expression = expression;
  17824. this.commands_block = commands_block;
  17825. };
  17826. var Switch = exports.Switch = function Switch(variable) {
  17827. var cases = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  17828. _classCallCheck(this, Switch);
  17829. this.type = COMMAND_TYPES.switch;
  17830. this.variable = variable;
  17831. this.cases = cases;
  17832. };
  17833. var Return = exports.Return = function Return(variable_value_menu) {
  17834. _classCallCheck(this, Return);
  17835. this.type = COMMAND_TYPES.return;
  17836. this.variable_value_menu = variable_value_menu;
  17837. };
  17838. var SwitchCase = exports.SwitchCase = function SwitchCase(variable_value_menu) {
  17839. var commands_block = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  17840. _classCallCheck(this, SwitchCase);
  17841. this.type = COMMAND_TYPES.switchcase;
  17842. this.variable_value_menu = variable_value_menu;
  17843. this.commands_block = commands_block;
  17844. };
  17845. var FunctionCall = exports.FunctionCall = function FunctionCall(function_called, parameters_list) {
  17846. _classCallCheck(this, FunctionCall);
  17847. this.type = COMMAND_TYPES.functioncall;
  17848. this.function_called = function_called;
  17849. this.parameters_list = parameters_list;
  17850. };
  17851. var VariableValueMenu = exports.VariableValueMenu = function VariableValueMenu() {
  17852. var variable_and_value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 7;
  17853. var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  17854. var row = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  17855. var column = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  17856. var include_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  17857. _classCallCheck(this, VariableValueMenu);
  17858. this.type = "var_value";
  17859. this.variable_and_value = variable_and_value;
  17860. this.content = content;
  17861. this.row = row;
  17862. this.column = column;
  17863. this.include_constant = include_constant;
  17864. };
  17865. var FunctionCallMenu = exports.FunctionCallMenu = function FunctionCallMenu() {
  17866. var function_called = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  17867. var parameters_list = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  17868. _classCallCheck(this, FunctionCallMenu);
  17869. this.type = "function_call";
  17870. this.function_called = function_called;
  17871. this.parameters_list = parameters_list;
  17872. };
  17873. var Program = exports.Program = function () {
  17874. function Program() {
  17875. _classCallCheck(this, Program);
  17876. this.functions = [];
  17877. this.globals = [];
  17878. }
  17879. _createClass(Program, [{
  17880. key: 'addFunction',
  17881. value: function addFunction(function_to_add) {
  17882. _melankeWatchjs2.default.watch(function_to_add.parameters_list, function () {
  17883. AlgorithmManagement.renderAlgorithm();
  17884. }, 1);
  17885. _melankeWatchjs2.default.watch(function_to_add.variables_list, function () {
  17886. AlgorithmManagement.renderAlgorithm();
  17887. }, 1);
  17888. this.functions.push(function_to_add);
  17889. }
  17890. }, {
  17891. key: 'addVariable',
  17892. value: function addVariable(function_to_receive, variable) {
  17893. if (this.functions[function_to_receive].variable === null) {
  17894. this.functions[function_to_receive].variables_list = [];
  17895. }
  17896. this.functions[function_to_receive].variables_list.push(variable);
  17897. }
  17898. }, {
  17899. key: 'addGlobal',
  17900. value: function addGlobal(variable) {
  17901. this.globals.push(variable);
  17902. }
  17903. }]);
  17904. return Program;
  17905. }();
  17906. /***/ }),
  17907. /***/ "./js/visualUI/types.js":
  17908. /*!******************************!*\
  17909. !*** ./js/visualUI/types.js ***!
  17910. \******************************/
  17911. /*! no static exports found */
  17912. /***/ (function(module, exports, __webpack_require__) {
  17913. "use strict";
  17914. Object.defineProperty(exports, "__esModule", {
  17915. value: true
  17916. });
  17917. var Types = exports.Types = Object.freeze({
  17918. INTEGER: "integer",
  17919. REAL: "real",
  17920. TEXT: "text",
  17921. BOOLEAN: "boolean",
  17922. VOID: "void"
  17923. });
  17924. /***/ }),
  17925. /***/ "./js/visualUI/variables.js":
  17926. /*!**********************************!*\
  17927. !*** ./js/visualUI/variables.js ***!
  17928. \**********************************/
  17929. /*! no static exports found */
  17930. /***/ (function(module, exports, __webpack_require__) {
  17931. "use strict";
  17932. Object.defineProperty(exports, "__esModule", {
  17933. value: true
  17934. });
  17935. exports.addVariable = addVariable;
  17936. exports.renderVariable = renderVariable;
  17937. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17938. var _jquery2 = _interopRequireDefault(_jquery);
  17939. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  17940. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17941. var Models = _interopRequireWildcard(_ivprog_elements);
  17942. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17943. __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  17944. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17945. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17946. window.jQuery = _jquery2.default;
  17947. var counter_new_variables = 0;
  17948. function addVariable(function_obj, function_container) {
  17949. var new_var = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI('new_variable') + '_' + counter_new_variables, 1);
  17950. if (function_obj.variables_list == null) {
  17951. function_obj.variables_list = [];
  17952. }
  17953. function_obj.variables_list.push(new_var);
  17954. counter_new_variables++;
  17955. renderVariable(function_container, new_var, function_obj);
  17956. }
  17957. function updateName(variable_obj, new_name) {
  17958. variable_obj.name = new_name;
  17959. }
  17960. function removeVariable(variable_obj, variable_container) {
  17961. var function_associated = (0, _jquery2.default)(variable_container).data('associatedFunction');
  17962. var index = function_associated.variables_list.indexOf(variable_obj);
  17963. if (index > -1) {
  17964. function_associated.variables_list.splice(index, 1);
  17965. }
  17966. (0, _jquery2.default)(variable_container).remove();
  17967. }
  17968. function updateType(variable_obj, new_type) {
  17969. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  17970. variable_obj.type = new_type;
  17971. variable_obj.dimensions = new_dimensions;
  17972. if (new_dimensions > 0) {
  17973. variable_obj.rows = new_dimensions;
  17974. variable_obj.columns = 2;
  17975. }
  17976. updateInitialValues(variable_obj);
  17977. }
  17978. function addHandlers(variable_obj, variable_container) {
  17979. // Manage variable name:
  17980. (0, _jquery2.default)(variable_container).find(".enable_edit_name_variable").on('click', function (e) {
  17981. enableNameUpdate(variable_obj, variable_container);
  17982. });
  17983. // Menu to change type:
  17984. (0, _jquery2.default)(variable_container).find('.ui.dropdown.variable_type').dropdown({
  17985. onChange: function onChange(value, text, $selectedItem) {
  17986. if ((0, _jquery2.default)($selectedItem).data('dimensions')) {
  17987. updateType(variable_obj, _types.Types[(0, _jquery2.default)($selectedItem).data('type')], (0, _jquery2.default)($selectedItem).data('dimensions'));
  17988. } else {
  17989. updateType(variable_obj, _types.Types[(0, _jquery2.default)($selectedItem).data('type')]);
  17990. }
  17991. renderValues(variable_obj, variable_container);
  17992. }
  17993. });
  17994. // Remove global:
  17995. (0, _jquery2.default)(variable_container).find(".remove_variable").on('click', function (e) {
  17996. removeVariable(variable_obj, variable_container);
  17997. });
  17998. }
  17999. function renderVariable(function_container, new_var, function_obj) {
  18000. var element = '<div class="ui label variable_container">';
  18001. element += '<div class="ui dropdown variable_type">';
  18002. if (new_var.dimensions > 0) {
  18003. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(new_var.type.toLowerCase());
  18004. for (var i = 0; i < new_var.dimensions; i++) {
  18005. element += ' [ ] ';
  18006. }
  18007. element += '</div>';
  18008. } else {
  18009. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(new_var.type.toLowerCase()) + '</div>';
  18010. }
  18011. element += '<div class="menu">';
  18012. for (var tm in _types.Types) {
  18013. if (tm == _types.Types.VOID.toUpperCase()) {
  18014. continue;
  18015. }
  18016. element += '<div class="item ' + (new_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  18017. }
  18018. for (var tm in _types.Types) {
  18019. if (tm == _types.Types.VOID.toUpperCase()) {
  18020. continue;
  18021. }
  18022. element += '<div class="item">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  18023. }
  18024. element += '</div></div> ';
  18025. element += '<span class="span_name_variable enable_edit_name_variable">' + new_var.name + '</span> ';
  18026. element += ' = <div class="ui div_valor_var">' + new_var.value + '</div>';
  18027. element += ' <i class="red icon times remove_variable"></i></div>';
  18028. element = (0, _jquery2.default)(element);
  18029. (0, _jquery2.default)(element).data('associatedFunction', function_obj);
  18030. (0, _jquery2.default)(function_container).find('.variables_list_div').append(element);
  18031. addHandlers(new_var, element);
  18032. renderValues(new_var, element);
  18033. }
  18034. function renderValues(new_var, variable_container) {
  18035. var ret = "";
  18036. var j = 0;
  18037. if (new_var.dimensions == 0) {
  18038. if (new_var.type == _types.Types.REAL) {
  18039. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value.toFixed(1) + '</span> <i class="icon small pencil alternate enable_edit_name_function simple_var"></i></div> ';
  18040. } else {
  18041. if (new_var.type == _types.Types.BOOLEAN) {
  18042. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + new_var.value + '</span> <i class="icon small pencil alternate enable_edit_name_function boolean_simple_type"></i></div> ';
  18043. } else {
  18044. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value + '</span> <i class="icon small pencil alternate enable_edit_name_function simple_var"></i></div> ';
  18045. }
  18046. }
  18047. } else {
  18048. ret += '<table class="tabela_var">';
  18049. if (new_var.dimensions == 1) {
  18050. ret += '<tr>';
  18051. if (new_var.type == _types.Types.REAL) {
  18052. for (var k = 0; k < new_var.columns; k++) {
  18053. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k].toFixed(1) + '</span></td>';
  18054. }
  18055. } else {
  18056. for (var k = 0; k < new_var.columns; k++) {
  18057. if (new_var.type == _types.Types.BOOLEAN) {
  18058. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + new_var.value[k] + '</span></td>';
  18059. } else {
  18060. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k] + '</span>' + '</td>';
  18061. }
  18062. }
  18063. }
  18064. ret += '</tr>';
  18065. ret += '</table>';
  18066. ret += '<div class="buttons_manage_columns"><i class="ui icon minus square outline remove_global_vector_column"></i>' + ' <i class="ui icon plus square outline add_global_vector_column"></i></div>';
  18067. }
  18068. if (new_var.dimensions == 2) {
  18069. if (new_var.type == _types.Types.REAL) {
  18070. for (var l = 0; l < new_var.rows; l++) {
  18071. ret += '<tr>';
  18072. for (var k = 0; k < new_var.columns; k++) {
  18073. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  18074. }
  18075. ret += '</tr>';
  18076. }
  18077. } else {
  18078. for (var l = 0; l < new_var.rows; l++) {
  18079. ret += '<tr>';
  18080. for (var k = 0; k < new_var.columns; k++) {
  18081. if (new_var.type == _types.Types.BOOLEAN) {
  18082. ret += '<td><span class="span_value_variable boolean_matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k] + '</span></td>';
  18083. } else {
  18084. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k] + '</span></td>';
  18085. }
  18086. }
  18087. ret += '</tr>';
  18088. }
  18089. }
  18090. if (new_var.rows == 0) {
  18091. ret += '<tr><td></td></tr>';
  18092. }
  18093. ret += '<tr><td colspan="' + new_var.columns + '" class="tr_manage_lines"><i class="ui icon minus square outline remove_global_matrix_line"></i>' + ' <i class="ui icon plus square outline add_global_matrix_line"></i></td></tr>';
  18094. ret += '</table>';
  18095. ret += '<div class="buttons_manage_columns"><i class="ui icon minus square outline remove_global_matrix_column"></i>' + ' <i class="ui icon plus square outline add_global_matrix_column"></i></div>';
  18096. }
  18097. }
  18098. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  18099. ret = (0, _jquery2.default)(ret);
  18100. (0, _jquery2.default)(ret).find('.span_value_variable').data('associatedOject', new_var);
  18101. (0, _jquery2.default)(ret).find(".boolean_simple_type").on('click', function (e) {
  18102. alternateBooleanValue(new_var, this.parentNode);
  18103. });
  18104. (0, _jquery2.default)(ret).find(".simple_var").on('click', function (e) {
  18105. enableValueUpdate(new_var, this.parentNode);
  18106. });
  18107. (0, _jquery2.default)(ret).find(".boolean_vector_var").on('click', function (e) {
  18108. alternateBooleanVectorValue(new_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  18109. });
  18110. (0, _jquery2.default)(ret).find(".vector_var").on('click', function (e) {
  18111. enableVectorValueUpdate(new_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  18112. });
  18113. (0, _jquery2.default)(ret).find(".remove_global_vector_column").on('click', function (e) {
  18114. removeColumnVector(new_var);
  18115. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  18116. renderValues(new_var, variable_container);
  18117. });
  18118. (0, _jquery2.default)(ret).find(".add_global_vector_column").on('click', function (e) {
  18119. addColumnVector(new_var);
  18120. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  18121. renderValues(new_var, variable_container);
  18122. });
  18123. (0, _jquery2.default)(ret).find(".remove_global_matrix_column").on('click', function (e) {
  18124. removeColumnMatrix(new_var);
  18125. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  18126. renderValues(new_var, variable_container);
  18127. });
  18128. (0, _jquery2.default)(ret).find(".add_global_matrix_column").on('click', function (e) {
  18129. addColumnMatrix(new_var);
  18130. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  18131. renderValues(new_var, variable_container);
  18132. });
  18133. (0, _jquery2.default)(ret).find(".remove_global_matrix_line").on('click', function (e) {
  18134. removeLineMatrix(new_var);
  18135. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  18136. renderValues(new_var, variable_container);
  18137. });
  18138. (0, _jquery2.default)(ret).find(".add_global_matrix_line").on('click', function (e) {
  18139. addLineMatrix(new_var);
  18140. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  18141. renderValues(new_var, variable_container);
  18142. });
  18143. (0, _jquery2.default)(ret).find(".boolean_matrix_var").on('click', function (e) {
  18144. alternateBooleanMatrixValue(new_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  18145. });
  18146. (0, _jquery2.default)(ret).find(".matrix_var").on('click', function (e) {
  18147. enableMatrixValueUpdate(new_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  18148. });
  18149. (0, _jquery2.default)(variable_container).find(".div_valor_var").append(ret);
  18150. }
  18151. function alternateBooleanMatrixValue(var_obj, row, index, value_container) {
  18152. var_obj.value[row][index] = !var_obj.value[row][index];
  18153. (0, _jquery2.default)(value_container).find('.span_value_variable').text(var_obj.value[row][index]);
  18154. }
  18155. function addLineMatrix(var_obj) {
  18156. var_obj.rows++;
  18157. if (var_obj.type == _types.Types.INTEGER) {
  18158. var n_l = [];
  18159. for (var i = 0; i < var_obj.columns; i++) {
  18160. n_l.push(1);
  18161. }
  18162. var_obj.value.push(n_l);
  18163. }
  18164. if (var_obj.type == _types.Types.REAL) {
  18165. var n_l = [];
  18166. for (i = 0; i < var_obj.columns; i++) {
  18167. n_l.push(1.0);
  18168. }
  18169. var_obj.value.push(n_l);
  18170. }
  18171. if (var_obj.type == _types.Types.TEXT) {
  18172. var n_l = [];
  18173. for (i = 0; i < var_obj.columns; i++) {
  18174. n_l.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  18175. }
  18176. var_obj.value.push(n_l);
  18177. }
  18178. if (var_obj.type == _types.Types.BOOLEAN) {
  18179. var n_l = [];
  18180. for (i = 0; i < var_obj.columns; i++) {
  18181. n_l.push(true);
  18182. }
  18183. var_obj.value.push(n_l);
  18184. }
  18185. }
  18186. function removeLineMatrix(var_obj) {
  18187. if (var_obj.rows == 0) {
  18188. return;
  18189. }
  18190. var_obj.rows--;
  18191. var_obj.value.splice(var_obj.value.length - 1, 1);
  18192. }
  18193. function addColumnMatrix(var_obj) {
  18194. var_obj.columns++;
  18195. if (var_obj.type == _types.Types.INTEGER) {
  18196. for (var i = 0; i < var_obj.rows; i++) {
  18197. var_obj.value[i].push(1);
  18198. }
  18199. }
  18200. if (var_obj.type == _types.Types.REAL) {
  18201. for (var i = 0; i < var_obj.rows; i++) {
  18202. var_obj.value[i].push(1.0);
  18203. }
  18204. }
  18205. if (var_obj.type == _types.Types.TEXT) {
  18206. for (var i = 0; i < var_obj.rows; i++) {
  18207. var_obj.value[i].push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  18208. }
  18209. }
  18210. if (var_obj.type == _types.Types.BOOLEAN) {
  18211. for (var i = 0; i < var_obj.rows; i++) {
  18212. var_obj.value[i].push(true);
  18213. }
  18214. }
  18215. }
  18216. function removeColumnMatrix(var_obj) {
  18217. if (var_obj.columns == 0) {
  18218. return;
  18219. }
  18220. var_obj.columns--;
  18221. for (var i = 0; i < var_obj.rows; i++) {
  18222. var_obj.value[i].splice(var_obj.value[i].length - 1, 1);
  18223. }
  18224. }
  18225. function addColumnVector(var_obj) {
  18226. var_obj.columns++;
  18227. if (var_obj.type == _types.Types.INTEGER) {
  18228. var_obj.value.push(1);
  18229. }
  18230. if (var_obj.type == _types.Types.REAL) {
  18231. var_obj.value.push(1.0);
  18232. }
  18233. if (var_obj.type == _types.Types.TEXT) {
  18234. var_obj.value.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  18235. }
  18236. if (var_obj.type == _types.Types.BOOLEAN) {
  18237. var_obj.value.push(true);
  18238. }
  18239. }
  18240. function removeColumnVector(var_obj) {
  18241. if (var_obj.columns == 0) {
  18242. return;
  18243. }
  18244. var_obj.columns--;
  18245. var_obj.value.splice(var_obj.value.length - 1, 1);
  18246. }
  18247. function alternateBooleanValue(var_obj, value_container) {
  18248. var_obj.value = !var_obj.value;
  18249. (0, _jquery2.default)(value_container).find('.span_value_variable').text(var_obj.value);
  18250. }
  18251. function alternateBooleanVectorValue(var_obj, index, value_container) {
  18252. var_obj.value[index] = !var_obj.value[index];
  18253. (0, _jquery2.default)(value_container).find('.span_value_variable').text(var_obj.value[index]);
  18254. }
  18255. function updateInitialValues(variable_obj) {
  18256. if (variable_obj.type == _types.Types.INTEGER) {
  18257. if (variable_obj.dimensions == 0) {
  18258. variable_obj.value = 1;
  18259. }
  18260. if (variable_obj.dimensions == 1) {
  18261. variable_obj.value = [1, 1];
  18262. }
  18263. if (variable_obj.dimensions == 2) {
  18264. variable_obj.value = [[1, 1], [1, 1]];
  18265. }
  18266. }
  18267. if (variable_obj.type == _types.Types.REAL) {
  18268. if (variable_obj.dimensions == 0) {
  18269. variable_obj.value = 1.0;
  18270. }
  18271. if (variable_obj.dimensions == 1) {
  18272. variable_obj.value = [1.0, 1.0];
  18273. }
  18274. if (variable_obj.dimensions == 2) {
  18275. variable_obj.value = [[1.0, 1.0], [1.0, 1.0]];
  18276. }
  18277. }
  18278. if (variable_obj.type == _types.Types.TEXT) {
  18279. if (variable_obj.dimensions == 0) {
  18280. variable_obj.value = _localizedStringsService.LocalizedStrings.getUI('text_start');
  18281. }
  18282. if (variable_obj.dimensions == 1) {
  18283. variable_obj.value = [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')];
  18284. }
  18285. if (variable_obj.dimensions == 2) {
  18286. variable_obj.value = [[_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')], [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')]];
  18287. }
  18288. }
  18289. if (variable_obj.type == _types.Types.BOOLEAN) {
  18290. if (variable_obj.dimensions == 0) {
  18291. variable_obj.value = true;
  18292. }
  18293. if (variable_obj.dimensions == 1) {
  18294. variable_obj.value = [true, true];
  18295. }
  18296. if (variable_obj.dimensions == 2) {
  18297. variable_obj.value = [[true, true], [true, true]];
  18298. }
  18299. }
  18300. }
  18301. var opened_name_value_vector_global_ = false;
  18302. var opened_input_value_vector_global_ = null;
  18303. function enableVectorValueUpdate(var_obj, index, parent_node) {
  18304. if (opened_name_value_vector_global_) {
  18305. (0, _jquery2.default)(opened_input_value_vector_global_).focus();
  18306. return;
  18307. }
  18308. opened_name_value_vector_global_ = true;
  18309. (0, _jquery2.default)(parent_node).find('.span_value_variable').text('');
  18310. if (var_obj.type == _types.Types.REAL) {
  18311. (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[index].toFixed(1) + "' />").insertBefore((0, _jquery2.default)(parent_node).find('.span_value_variable'));
  18312. } else {
  18313. (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[index] + "' />").insertBefore((0, _jquery2.default)(parent_node).find('.span_value_variable'));
  18314. }
  18315. (0, _jquery2.default)('.width-dynamic').on('input', function () {
  18316. var inputWidth = (0, _jquery2.default)(this).textWidth() + 10;
  18317. opened_input_value_vector_global_ = this;
  18318. (0, _jquery2.default)(this).focus();
  18319. var tmpStr = (0, _jquery2.default)(this).val();
  18320. (0, _jquery2.default)(this).val('');
  18321. (0, _jquery2.default)(this).val(tmpStr);
  18322. (0, _jquery2.default)(this).css({
  18323. width: inputWidth
  18324. });
  18325. }).trigger('input');
  18326. (0, _jquery2.default)('.width-dynamic').focusout(function () {
  18327. /// update array:
  18328. if ((0, _jquery2.default)(this).val().trim()) {
  18329. if (var_obj.type == _types.Types.REAL) {
  18330. var_obj.value[index] = parseFloat((0, _jquery2.default)(this).val().trim());
  18331. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  18332. } else {
  18333. if (var_obj.type == _types.Types.INTEGER) {
  18334. var_obj.value[index] = parseInt((0, _jquery2.default)(this).val().trim());
  18335. } else {
  18336. var_obj.value[index] = (0, _jquery2.default)(this).val().trim();
  18337. }
  18338. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(var_obj.value[index]);
  18339. }
  18340. }
  18341. (0, _jquery2.default)(this).remove();
  18342. /// update elements:
  18343. opened_name_value_vector_global_ = false;
  18344. opened_input_value_vector_global_ = false;
  18345. });
  18346. (0, _jquery2.default)('.width-dynamic').on('keydown', function (e) {
  18347. var code = e.keyCode || e.which;
  18348. if (code == 13) {
  18349. if ((0, _jquery2.default)(this).val().trim()) {
  18350. if (var_obj.type == _types.Types.REAL) {
  18351. var_obj.value[index] = parseFloat((0, _jquery2.default)(this).val().trim());
  18352. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  18353. } else {
  18354. if (var_obj.type == _types.Types.INTEGER) {
  18355. var_obj.value[index] = parseInt((0, _jquery2.default)(this).val().trim());
  18356. } else {
  18357. var_obj.value[index] = (0, _jquery2.default)(this).val().trim();
  18358. }
  18359. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(var_obj.value[index]);
  18360. }
  18361. }
  18362. (0, _jquery2.default)(this).remove();
  18363. /// update elements:
  18364. opened_name_value_vector_global_ = false;
  18365. opened_input_value_vector_global_ = false;
  18366. }
  18367. if (code == 27) {
  18368. if (global_var.type == _types.Types.REAL) {
  18369. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  18370. } else {
  18371. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(var_obj.value[index]);
  18372. }
  18373. (0, _jquery2.default)(this).remove();
  18374. /// update elements:
  18375. opened_name_value_vector_global_ = false;
  18376. opened_input_value_vector_global_ = false;
  18377. }
  18378. });
  18379. }
  18380. var opened_name_value_global_var = false;
  18381. var opened_input_value_global_ar = null;
  18382. function enableValueUpdate(var_obj, parent_node) {
  18383. if (opened_name_value_global_var) {
  18384. (0, _jquery2.default)(opened_input_value_global_ar).focus();
  18385. return;
  18386. }
  18387. opened_name_value_global_var = true;
  18388. (0, _jquery2.default)(parent_node).find('.span_value_variable').text('');
  18389. if (var_obj.type == _types.Types.REAL) {
  18390. (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value.toFixed(1) + "' />").insertBefore((0, _jquery2.default)(parent_node).find('.span_value_variable'));
  18391. } else {
  18392. (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value + "' />").insertBefore((0, _jquery2.default)(parent_node).find('.span_value_variable'));
  18393. }
  18394. (0, _jquery2.default)('.width-dynamic').on('input', function () {
  18395. var inputWidth = (0, _jquery2.default)(this).textWidth() + 10;
  18396. opened_input_value_global_ar = this;
  18397. (0, _jquery2.default)(this).focus();
  18398. var tmpStr = (0, _jquery2.default)(this).val();
  18399. (0, _jquery2.default)(this).val('');
  18400. (0, _jquery2.default)(this).val(tmpStr);
  18401. (0, _jquery2.default)(this).css({
  18402. width: inputWidth
  18403. });
  18404. }).trigger('input');
  18405. (0, _jquery2.default)('.width-dynamic').focusout(function () {
  18406. /// update array:
  18407. if ((0, _jquery2.default)(this).val().trim()) {
  18408. if (var_obj.type == _types.Types.REAL) {
  18409. var_obj.value = parseFloat((0, _jquery2.default)(this).val().trim());
  18410. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(var_obj.value.toFixed(1));
  18411. } else {
  18412. if (var_obj.type == _types.Types.INTEGER) {
  18413. var_obj.value = parseInt((0, _jquery2.default)(this).val().trim());
  18414. } else {
  18415. var_obj.value = (0, _jquery2.default)(this).val().trim();
  18416. }
  18417. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(var_obj.value);
  18418. }
  18419. }
  18420. (0, _jquery2.default)(this).remove();
  18421. /// update elements:
  18422. opened_name_value_global_var = false;
  18423. opened_input_value_global_ar = false;
  18424. });
  18425. (0, _jquery2.default)('.width-dynamic').on('keydown', function (e) {
  18426. var code = e.keyCode || e.which;
  18427. if (code == 13) {
  18428. if ((0, _jquery2.default)(this).val().trim()) {
  18429. if (var_obj.type == _types.Types.REAL) {
  18430. var_obj.value = parseFloat((0, _jquery2.default)(this).val().trim());
  18431. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(var_obj.value.toFixed(1));
  18432. } else {
  18433. if (var_obj.type == _types.Types.INTEGER) {
  18434. var_obj.value = parseInt((0, _jquery2.default)(this).val().trim());
  18435. } else {
  18436. var_obj.value = (0, _jquery2.default)(this).val().trim();
  18437. }
  18438. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(var_obj.value);
  18439. }
  18440. }
  18441. (0, _jquery2.default)(this).remove();
  18442. /// update elements:
  18443. opened_name_value_global_var = false;
  18444. opened_input_value_global_ar = false;
  18445. }
  18446. if (code == 27) {
  18447. if (var_obj.type == _types.Types.REAL) {
  18448. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(var_obj.value.toFixed(1));
  18449. } else {
  18450. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(var_obj.value);
  18451. }
  18452. (0, _jquery2.default)(this).remove();
  18453. /// update elements:
  18454. opened_name_value_global_var = false;
  18455. opened_input_value_global_ar = false;
  18456. }
  18457. });
  18458. }
  18459. var opened_name_global = false;
  18460. var opened_input_global = null;
  18461. function enableNameUpdate(variable_obj, variable_container) {
  18462. if (opened_name_global) {
  18463. (0, _jquery2.default)(opened_input_global).focus();
  18464. return;
  18465. }
  18466. opened_name_global = true;
  18467. (0, _jquery2.default)(variable_container).find('.span_name_variable').text('');
  18468. (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + variable_obj.name + "' />").insertBefore((0, _jquery2.default)(variable_container).find('.span_name_variable'));
  18469. (0, _jquery2.default)('.width-dynamic').on('input', function () {
  18470. var inputWidth = (0, _jquery2.default)(this).textWidth() + 10;
  18471. opened_input_global = this;
  18472. (0, _jquery2.default)(this).focus();
  18473. var tmpStr = (0, _jquery2.default)(this).val();
  18474. (0, _jquery2.default)(this).val('');
  18475. (0, _jquery2.default)(this).val(tmpStr);
  18476. (0, _jquery2.default)(this).css({
  18477. width: inputWidth
  18478. });
  18479. }).trigger('input');
  18480. (0, _jquery2.default)('.width-dynamic').focusout(function () {
  18481. /// update array:
  18482. if ((0, _jquery2.default)(this).val().trim()) {
  18483. updateName(variable_obj, (0, _jquery2.default)(this).val().trim());
  18484. (0, _jquery2.default)(variable_container).find('.span_name_variable').text(variable_obj.name);
  18485. }
  18486. (0, _jquery2.default)(this).remove();
  18487. /// update elements:
  18488. opened_name_global = false;
  18489. opened_input_global = false;
  18490. });
  18491. (0, _jquery2.default)('.width-dynamic').on('keydown', function (e) {
  18492. var code = e.keyCode || e.which;
  18493. if (code == 13) {
  18494. if ((0, _jquery2.default)(this).val().trim()) {
  18495. updateName(variable_obj, (0, _jquery2.default)(this).val().trim());
  18496. (0, _jquery2.default)(variable_container).find('.span_name_variable').text(variable_obj.name);
  18497. }
  18498. (0, _jquery2.default)(this).remove();
  18499. /// update elements:
  18500. opened_name_global = false;
  18501. opened_input_global = false;
  18502. }
  18503. if (code == 27) {
  18504. (0, _jquery2.default)(variable_container).find('.span_name_variable').text(variable_obj.name);
  18505. (0, _jquery2.default)(this).remove();
  18506. /// update elements:
  18507. opened_name_global = false;
  18508. opened_input_global = false;
  18509. }
  18510. });
  18511. }
  18512. var opened_name_value_matrix_global_v = false;
  18513. var opened_input_value_matrix_global_v = null;
  18514. function enableMatrixValueUpdate(var_obj, row, index, parent_node) {
  18515. if (opened_name_value_matrix_global_v) {
  18516. (0, _jquery2.default)(opened_input_value_matrix_global_v).focus();
  18517. return;
  18518. }
  18519. opened_name_value_matrix_global_v = true;
  18520. (0, _jquery2.default)(parent_node).find('.span_value_variable').text('');
  18521. if (var_obj.type == _types.Types.REAL) {
  18522. (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[row][index].toFixed(1) + "' />").insertBefore((0, _jquery2.default)(parent_node).find('.span_value_variable'));
  18523. } else {
  18524. (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[row][index] + "' />").insertBefore((0, _jquery2.default)(parent_node).find('.span_value_variable'));
  18525. }
  18526. (0, _jquery2.default)('.width-dynamic').on('input', function () {
  18527. var inputWidth = (0, _jquery2.default)(this).textWidth() + 10;
  18528. opened_input_value_matrix_global_v = this;
  18529. (0, _jquery2.default)(this).focus();
  18530. var tmpStr = (0, _jquery2.default)(this).val();
  18531. (0, _jquery2.default)(this).val('');
  18532. (0, _jquery2.default)(this).val(tmpStr);
  18533. (0, _jquery2.default)(this).css({
  18534. width: inputWidth
  18535. });
  18536. }).trigger('input');
  18537. (0, _jquery2.default)('.width-dynamic').focusout(function () {
  18538. /// update array:
  18539. if ((0, _jquery2.default)(this).val().trim()) {
  18540. if (var_obj.type == _types.Types.REAL) {
  18541. var_obj.value[row][index] = parseFloat((0, _jquery2.default)(this).val().trim());
  18542. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  18543. } else {
  18544. if (var_obj.type == _types.Types.INTEGER) {
  18545. var_obj.value[row][index] = parseInt((0, _jquery2.default)(this).val().trim());
  18546. } else {
  18547. var_obj.value[row][index] = (0, _jquery2.default)(this).val().trim();
  18548. }
  18549. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(var_obj.value[row][index]);
  18550. }
  18551. }
  18552. (0, _jquery2.default)(this).remove();
  18553. /// update elements:
  18554. opened_name_value_matrix_global_v = false;
  18555. opened_input_value_matrix_global_v = false;
  18556. });
  18557. (0, _jquery2.default)('.width-dynamic').on('keydown', function (e) {
  18558. var code = e.keyCode || e.which;
  18559. if (code == 13) {
  18560. if ((0, _jquery2.default)(this).val().trim()) {
  18561. if (var_obj.type == _types.Types.REAL) {
  18562. var_obj.value[row][index] = parseFloat((0, _jquery2.default)(this).val().trim());
  18563. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  18564. } else {
  18565. if (var_obj.type == _types.Types.INTEGER) {
  18566. var_obj.value[row][index] = parseInt((0, _jquery2.default)(this).val().trim());
  18567. } else {
  18568. var_obj.value[row][index] = (0, _jquery2.default)(this).val().trim();
  18569. }
  18570. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(var_obj.value[row][index]);
  18571. }
  18572. }
  18573. (0, _jquery2.default)(this).remove();
  18574. /// update elements:
  18575. opened_name_value_matrix_global_v = false;
  18576. opened_input_value_matrix_global_v = false;
  18577. }
  18578. if (code == 27) {
  18579. if (var_obj.type == _types.Types.REAL) {
  18580. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  18581. } else {
  18582. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(var_obj.value[row][index]);
  18583. }
  18584. (0, _jquery2.default)(this).remove();
  18585. /// update elements:
  18586. opened_name_value_matrix_global_v = false;
  18587. opened_input_value_matrix_global_v = false;
  18588. }
  18589. });
  18590. }
  18591. /***/ }),
  18592. /***/ "./node_modules/antlr4/BufferedTokenStream.js":
  18593. /*!****************************************************!*\
  18594. !*** ./node_modules/antlr4/BufferedTokenStream.js ***!
  18595. \****************************************************/
  18596. /*! no static exports found */
  18597. /***/ (function(module, exports, __webpack_require__) {
  18598. "use strict";
  18599. //
  18600. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  18601. * Use of this file is governed by the BSD 3-clause license that
  18602. * can be found in the LICENSE.txt file in the project root.
  18603. */
  18604. // This implementation of {@link TokenStream} loads tokens from a
  18605. // {@link TokenSource} on-demand, and places the tokens in a buffer to provide
  18606. // access to any previous token by index.
  18607. //
  18608. // <p>
  18609. // This token stream ignores the value of {@link Token//getChannel}. If your
  18610. // parser requires the token stream filter tokens to only those on a particular
  18611. // channel, such as {@link Token//DEFAULT_CHANNEL} or
  18612. // {@link Token//HIDDEN_CHANNEL}, use a filtering token stream such a
  18613. // {@link CommonTokenStream}.</p>
  18614. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  18615. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  18616. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  18617. // this is just to keep meaningful parameter types to Parser
  18618. function TokenStream() {
  18619. return this;
  18620. }
  18621. function BufferedTokenStream(tokenSource) {
  18622. TokenStream.call(this);
  18623. // The {@link TokenSource} from which tokens for this stream are fetched.
  18624. this.tokenSource = tokenSource;
  18625. // A collection of all tokens fetched from the token source. The list is
  18626. // considered a complete view of the input once {@link //fetchedEOF} is set
  18627. // to {@code true}.
  18628. this.tokens = [];
  18629. // The index into {@link //tokens} of the current token (next token to
  18630. // {@link //consume}). {@link //tokens}{@code [}{@link //p}{@code ]} should
  18631. // be
  18632. // {@link //LT LT(1)}.
  18633. //
  18634. // <p>This field is set to -1 when the stream is first constructed or when
  18635. // {@link //setTokenSource} is called, indicating that the first token has
  18636. // not yet been fetched from the token source. For additional information,
  18637. // see the documentation of {@link IntStream} for a description of
  18638. // Initializing Methods.</p>
  18639. this.index = -1;
  18640. // Indicates whether the {@link Token//EOF} token has been fetched from
  18641. // {@link //tokenSource} and added to {@link //tokens}. This field improves
  18642. // performance for the following cases:
  18643. //
  18644. // <ul>
  18645. // <li>{@link //consume}: The lookahead check in {@link //consume} to
  18646. // prevent
  18647. // consuming the EOF symbol is optimized by checking the values of
  18648. // {@link //fetchedEOF} and {@link //p} instead of calling {@link
  18649. // //LA}.</li>
  18650. // <li>{@link //fetch}: The check to prevent adding multiple EOF symbols
  18651. // into
  18652. // {@link //tokens} is trivial with this field.</li>
  18653. // <ul>
  18654. this.fetchedEOF = false;
  18655. return this;
  18656. }
  18657. BufferedTokenStream.prototype = Object.create(TokenStream.prototype);
  18658. BufferedTokenStream.prototype.constructor = BufferedTokenStream;
  18659. BufferedTokenStream.prototype.mark = function () {
  18660. return 0;
  18661. };
  18662. BufferedTokenStream.prototype.release = function (marker) {
  18663. // no resources to release
  18664. };
  18665. BufferedTokenStream.prototype.reset = function () {
  18666. this.seek(0);
  18667. };
  18668. BufferedTokenStream.prototype.seek = function (index) {
  18669. this.lazyInit();
  18670. this.index = this.adjustSeekIndex(index);
  18671. };
  18672. BufferedTokenStream.prototype.get = function (index) {
  18673. this.lazyInit();
  18674. return this.tokens[index];
  18675. };
  18676. BufferedTokenStream.prototype.consume = function () {
  18677. var skipEofCheck = false;
  18678. if (this.index >= 0) {
  18679. if (this.fetchedEOF) {
  18680. // the last token in tokens is EOF. skip check if p indexes any
  18681. // fetched token except the last.
  18682. skipEofCheck = this.index < this.tokens.length - 1;
  18683. } else {
  18684. // no EOF token in tokens. skip check if p indexes a fetched token.
  18685. skipEofCheck = this.index < this.tokens.length;
  18686. }
  18687. } else {
  18688. // not yet initialized
  18689. skipEofCheck = false;
  18690. }
  18691. if (!skipEofCheck && this.LA(1) === Token.EOF) {
  18692. throw "cannot consume EOF";
  18693. }
  18694. if (this.sync(this.index + 1)) {
  18695. this.index = this.adjustSeekIndex(this.index + 1);
  18696. }
  18697. };
  18698. // Make sure index {@code i} in tokens has a token.
  18699. //
  18700. // @return {@code true} if a token is located at index {@code i}, otherwise
  18701. // {@code false}.
  18702. // @see //get(int i)
  18703. // /
  18704. BufferedTokenStream.prototype.sync = function (i) {
  18705. var n = i - this.tokens.length + 1; // how many more elements we need?
  18706. if (n > 0) {
  18707. var fetched = this.fetch(n);
  18708. return fetched >= n;
  18709. }
  18710. return true;
  18711. };
  18712. // Add {@code n} elements to buffer.
  18713. //
  18714. // @return The actual number of elements added to the buffer.
  18715. // /
  18716. BufferedTokenStream.prototype.fetch = function (n) {
  18717. if (this.fetchedEOF) {
  18718. return 0;
  18719. }
  18720. for (var i = 0; i < n; i++) {
  18721. var t = this.tokenSource.nextToken();
  18722. t.tokenIndex = this.tokens.length;
  18723. this.tokens.push(t);
  18724. if (t.type === Token.EOF) {
  18725. this.fetchedEOF = true;
  18726. return i + 1;
  18727. }
  18728. }
  18729. return n;
  18730. };
  18731. // Get all tokens from start..stop inclusively///
  18732. BufferedTokenStream.prototype.getTokens = function (start, stop, types) {
  18733. if (types === undefined) {
  18734. types = null;
  18735. }
  18736. if (start < 0 || stop < 0) {
  18737. return null;
  18738. }
  18739. this.lazyInit();
  18740. var subset = [];
  18741. if (stop >= this.tokens.length) {
  18742. stop = this.tokens.length - 1;
  18743. }
  18744. for (var i = start; i < stop; i++) {
  18745. var t = this.tokens[i];
  18746. if (t.type === Token.EOF) {
  18747. break;
  18748. }
  18749. if (types === null || types.contains(t.type)) {
  18750. subset.push(t);
  18751. }
  18752. }
  18753. return subset;
  18754. };
  18755. BufferedTokenStream.prototype.LA = function (i) {
  18756. return this.LT(i).type;
  18757. };
  18758. BufferedTokenStream.prototype.LB = function (k) {
  18759. if (this.index - k < 0) {
  18760. return null;
  18761. }
  18762. return this.tokens[this.index - k];
  18763. };
  18764. BufferedTokenStream.prototype.LT = function (k) {
  18765. this.lazyInit();
  18766. if (k === 0) {
  18767. return null;
  18768. }
  18769. if (k < 0) {
  18770. return this.LB(-k);
  18771. }
  18772. var i = this.index + k - 1;
  18773. this.sync(i);
  18774. if (i >= this.tokens.length) {
  18775. // return EOF token
  18776. // EOF must be last token
  18777. return this.tokens[this.tokens.length - 1];
  18778. }
  18779. return this.tokens[i];
  18780. };
  18781. // Allowed derived classes to modify the behavior of operations which change
  18782. // the current stream position by adjusting the target token index of a seek
  18783. // operation. The default implementation simply returns {@code i}. If an
  18784. // exception is thrown in this method, the current stream index should not be
  18785. // changed.
  18786. //
  18787. // <p>For example, {@link CommonTokenStream} overrides this method to ensure
  18788. // that
  18789. // the seek target is always an on-channel token.</p>
  18790. //
  18791. // @param i The target token index.
  18792. // @return The adjusted target token index.
  18793. BufferedTokenStream.prototype.adjustSeekIndex = function (i) {
  18794. return i;
  18795. };
  18796. BufferedTokenStream.prototype.lazyInit = function () {
  18797. if (this.index === -1) {
  18798. this.setup();
  18799. }
  18800. };
  18801. BufferedTokenStream.prototype.setup = function () {
  18802. this.sync(0);
  18803. this.index = this.adjustSeekIndex(0);
  18804. };
  18805. // Reset this token stream by setting its token source.///
  18806. BufferedTokenStream.prototype.setTokenSource = function (tokenSource) {
  18807. this.tokenSource = tokenSource;
  18808. this.tokens = [];
  18809. this.index = -1;
  18810. this.fetchedEOF = false;
  18811. };
  18812. // Given a starting index, return the index of the next token on channel.
  18813. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  18814. // on channel between i and EOF.
  18815. // /
  18816. BufferedTokenStream.prototype.nextTokenOnChannel = function (i, channel) {
  18817. this.sync(i);
  18818. if (i >= this.tokens.length) {
  18819. return -1;
  18820. }
  18821. var token = this.tokens[i];
  18822. while (token.channel !== this.channel) {
  18823. if (token.type === Token.EOF) {
  18824. return -1;
  18825. }
  18826. i += 1;
  18827. this.sync(i);
  18828. token = this.tokens[i];
  18829. }
  18830. return i;
  18831. };
  18832. // Given a starting index, return the index of the previous token on channel.
  18833. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  18834. // on channel between i and 0.
  18835. BufferedTokenStream.prototype.previousTokenOnChannel = function (i, channel) {
  18836. while (i >= 0 && this.tokens[i].channel !== channel) {
  18837. i -= 1;
  18838. }
  18839. return i;
  18840. };
  18841. // Collect all tokens on specified channel to the right of
  18842. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL or
  18843. // EOF. If channel is -1, find any non default channel token.
  18844. BufferedTokenStream.prototype.getHiddenTokensToRight = function (tokenIndex, channel) {
  18845. if (channel === undefined) {
  18846. channel = -1;
  18847. }
  18848. this.lazyInit();
  18849. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  18850. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  18851. }
  18852. var nextOnChannel = this.nextTokenOnChannel(tokenIndex + 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  18853. var from_ = tokenIndex + 1;
  18854. // if none onchannel to right, nextOnChannel=-1 so set to = last token
  18855. var to = nextOnChannel === -1 ? this.tokens.length - 1 : nextOnChannel;
  18856. return this.filterForChannel(from_, to, channel);
  18857. };
  18858. // Collect all tokens on specified channel to the left of
  18859. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL.
  18860. // If channel is -1, find any non default channel token.
  18861. BufferedTokenStream.prototype.getHiddenTokensToLeft = function (tokenIndex, channel) {
  18862. if (channel === undefined) {
  18863. channel = -1;
  18864. }
  18865. this.lazyInit();
  18866. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  18867. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  18868. }
  18869. var prevOnChannel = this.previousTokenOnChannel(tokenIndex - 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  18870. if (prevOnChannel === tokenIndex - 1) {
  18871. return null;
  18872. }
  18873. // if none on channel to left, prevOnChannel=-1 then from=0
  18874. var from_ = prevOnChannel + 1;
  18875. var to = tokenIndex - 1;
  18876. return this.filterForChannel(from_, to, channel);
  18877. };
  18878. BufferedTokenStream.prototype.filterForChannel = function (left, right, channel) {
  18879. var hidden = [];
  18880. for (var i = left; i < right + 1; i++) {
  18881. var t = this.tokens[i];
  18882. if (channel === -1) {
  18883. if (t.channel !== Lexer.DEFAULT_TOKEN_CHANNEL) {
  18884. hidden.push(t);
  18885. }
  18886. } else if (t.channel === channel) {
  18887. hidden.push(t);
  18888. }
  18889. }
  18890. if (hidden.length === 0) {
  18891. return null;
  18892. }
  18893. return hidden;
  18894. };
  18895. BufferedTokenStream.prototype.getSourceName = function () {
  18896. return this.tokenSource.getSourceName();
  18897. };
  18898. // Get the text of all tokens in this buffer.///
  18899. BufferedTokenStream.prototype.getText = function (interval) {
  18900. this.lazyInit();
  18901. this.fill();
  18902. if (interval === undefined || interval === null) {
  18903. interval = new Interval(0, this.tokens.length - 1);
  18904. }
  18905. var start = interval.start;
  18906. if (start instanceof Token) {
  18907. start = start.tokenIndex;
  18908. }
  18909. var stop = interval.stop;
  18910. if (stop instanceof Token) {
  18911. stop = stop.tokenIndex;
  18912. }
  18913. if (start === null || stop === null || start < 0 || stop < 0) {
  18914. return "";
  18915. }
  18916. if (stop >= this.tokens.length) {
  18917. stop = this.tokens.length - 1;
  18918. }
  18919. var s = "";
  18920. for (var i = start; i < stop + 1; i++) {
  18921. var t = this.tokens[i];
  18922. if (t.type === Token.EOF) {
  18923. break;
  18924. }
  18925. s = s + t.text;
  18926. }
  18927. return s;
  18928. };
  18929. // Get all tokens from lexer until EOF///
  18930. BufferedTokenStream.prototype.fill = function () {
  18931. this.lazyInit();
  18932. while (this.fetch(1000) === 1000) {
  18933. continue;
  18934. }
  18935. };
  18936. exports.BufferedTokenStream = BufferedTokenStream;
  18937. /***/ }),
  18938. /***/ "./node_modules/antlr4/CharStreams.js":
  18939. /*!********************************************!*\
  18940. !*** ./node_modules/antlr4/CharStreams.js ***!
  18941. \********************************************/
  18942. /*! no static exports found */
  18943. /***/ (function(module, exports, __webpack_require__) {
  18944. "use strict";
  18945. //
  18946. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  18947. * Use of this file is governed by the BSD 3-clause license that
  18948. * can be found in the LICENSE.txt file in the project root.
  18949. */
  18950. //
  18951. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  18952. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  18953. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  18954. // Utility functions to create InputStreams from various sources.
  18955. //
  18956. // All returned InputStreams support the full range of Unicode
  18957. // up to U+10FFFF (the default behavior of InputStream only supports
  18958. // code points up to U+FFFF).
  18959. var CharStreams = {
  18960. // Creates an InputStream from a string.
  18961. fromString: function fromString(str) {
  18962. return new InputStream(str, true);
  18963. },
  18964. // Asynchronously creates an InputStream from a blob given the
  18965. // encoding of the bytes in that blob (defaults to 'utf8' if
  18966. // encoding is null).
  18967. //
  18968. // Invokes onLoad(result) on success, onError(error) on
  18969. // failure.
  18970. fromBlob: function fromBlob(blob, encoding, onLoad, onError) {
  18971. var reader = FileReader();
  18972. reader.onload = function (e) {
  18973. var is = new InputStream(e.target.result, true);
  18974. onLoad(is);
  18975. };
  18976. reader.onerror = onError;
  18977. reader.readAsText(blob, encoding);
  18978. },
  18979. // Creates an InputStream from a Buffer given the
  18980. // encoding of the bytes in that buffer (defaults to 'utf8' if
  18981. // encoding is null).
  18982. fromBuffer: function fromBuffer(buffer, encoding) {
  18983. return new InputStream(buffer.toString(encoding), true);
  18984. },
  18985. // Asynchronously creates an InputStream from a file on disk given
  18986. // the encoding of the bytes in that file (defaults to 'utf8' if
  18987. // encoding is null).
  18988. //
  18989. // Invokes callback(error, result) on completion.
  18990. fromPath: function fromPath(path, encoding, callback) {
  18991. fs.readFile(path, encoding, function (err, data) {
  18992. var is = null;
  18993. if (data !== null) {
  18994. is = new InputStream(data, true);
  18995. }
  18996. callback(err, is);
  18997. });
  18998. },
  18999. // Synchronously creates an InputStream given a path to a file
  19000. // on disk and the encoding of the bytes in that file (defaults to
  19001. // 'utf8' if encoding is null).
  19002. fromPathSync: function fromPathSync(path, encoding) {
  19003. var data = fs.readFileSync(path, encoding);
  19004. return new InputStream(data, true);
  19005. }
  19006. };
  19007. exports.CharStreams = CharStreams;
  19008. /***/ }),
  19009. /***/ "./node_modules/antlr4/CommonTokenFactory.js":
  19010. /*!***************************************************!*\
  19011. !*** ./node_modules/antlr4/CommonTokenFactory.js ***!
  19012. \***************************************************/
  19013. /*! no static exports found */
  19014. /***/ (function(module, exports, __webpack_require__) {
  19015. "use strict";
  19016. //
  19017. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  19018. * Use of this file is governed by the BSD 3-clause license that
  19019. * can be found in the LICENSE.txt file in the project root.
  19020. */
  19021. //
  19022. //
  19023. // This default implementation of {@link TokenFactory} creates
  19024. // {@link CommonToken} objects.
  19025. //
  19026. var CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  19027. function TokenFactory() {
  19028. return this;
  19029. }
  19030. function CommonTokenFactory(copyText) {
  19031. TokenFactory.call(this);
  19032. // Indicates whether {@link CommonToken//setText} should be called after
  19033. // constructing tokens to explicitly set the text. This is useful for cases
  19034. // where the input stream might not be able to provide arbitrary substrings
  19035. // of text from the input after the lexer creates a token (e.g. the
  19036. // implementation of {@link CharStream//getText} in
  19037. // {@link UnbufferedCharStream} throws an
  19038. // {@link UnsupportedOperationException}). Explicitly setting the token text
  19039. // allows {@link Token//getText} to be called at any time regardless of the
  19040. // input stream implementation.
  19041. //
  19042. // <p>
  19043. // The default value is {@code false} to avoid the performance and memory
  19044. // overhead of copying text for every token unless explicitly requested.</p>
  19045. //
  19046. this.copyText = copyText === undefined ? false : copyText;
  19047. return this;
  19048. }
  19049. CommonTokenFactory.prototype = Object.create(TokenFactory.prototype);
  19050. CommonTokenFactory.prototype.constructor = CommonTokenFactory;
  19051. //
  19052. // The default {@link CommonTokenFactory} instance.
  19053. //
  19054. // <p>
  19055. // This token factory does not explicitly copy token text when constructing
  19056. // tokens.</p>
  19057. //
  19058. CommonTokenFactory.DEFAULT = new CommonTokenFactory();
  19059. CommonTokenFactory.prototype.create = function (source, type, text, channel, start, stop, line, column) {
  19060. var t = new CommonToken(source, type, channel, start, stop);
  19061. t.line = line;
  19062. t.column = column;
  19063. if (text !== null) {
  19064. t.text = text;
  19065. } else if (this.copyText && source[1] !== null) {
  19066. t.text = source[1].getText(start, stop);
  19067. }
  19068. return t;
  19069. };
  19070. CommonTokenFactory.prototype.createThin = function (type, text) {
  19071. var t = new CommonToken(null, type);
  19072. t.text = text;
  19073. return t;
  19074. };
  19075. exports.CommonTokenFactory = CommonTokenFactory;
  19076. /***/ }),
  19077. /***/ "./node_modules/antlr4/CommonTokenStream.js":
  19078. /*!**************************************************!*\
  19079. !*** ./node_modules/antlr4/CommonTokenStream.js ***!
  19080. \**************************************************/
  19081. /*! no static exports found */
  19082. /***/ (function(module, exports, __webpack_require__) {
  19083. "use strict";
  19084. //
  19085. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  19086. * Use of this file is governed by the BSD 3-clause license that
  19087. * can be found in the LICENSE.txt file in the project root.
  19088. */
  19089. ///
  19090. //
  19091. // This class extends {@link BufferedTokenStream} with functionality to filter
  19092. // token streams to tokens on a particular channel (tokens where
  19093. // {@link Token//getChannel} returns a particular value).
  19094. //
  19095. // <p>
  19096. // This token stream provides access to all tokens by index or when calling
  19097. // methods like {@link //getText}. The channel filtering is only used for code
  19098. // accessing tokens via the lookahead methods {@link //LA}, {@link //LT}, and
  19099. // {@link //LB}.</p>
  19100. //
  19101. // <p>
  19102. // By default, tokens are placed on the default channel
  19103. // ({@link Token//DEFAULT_CHANNEL}), but may be reassigned by using the
  19104. // {@code ->channel(HIDDEN)} lexer command, or by using an embedded action to
  19105. // call {@link Lexer//setChannel}.
  19106. // </p>
  19107. //
  19108. // <p>
  19109. // Note: lexer rules which use the {@code ->skip} lexer command or call
  19110. // {@link Lexer//skip} do not produce tokens at all, so input text matched by
  19111. // such a rule will not be available as part of the token stream, regardless of
  19112. // channel.</p>
  19113. ///
  19114. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  19115. var BufferedTokenStream = __webpack_require__(/*! ./BufferedTokenStream */ "./node_modules/antlr4/BufferedTokenStream.js").BufferedTokenStream;
  19116. function CommonTokenStream(lexer, channel) {
  19117. BufferedTokenStream.call(this, lexer);
  19118. this.channel = channel === undefined ? Token.DEFAULT_CHANNEL : channel;
  19119. return this;
  19120. }
  19121. CommonTokenStream.prototype = Object.create(BufferedTokenStream.prototype);
  19122. CommonTokenStream.prototype.constructor = CommonTokenStream;
  19123. CommonTokenStream.prototype.adjustSeekIndex = function (i) {
  19124. return this.nextTokenOnChannel(i, this.channel);
  19125. };
  19126. CommonTokenStream.prototype.LB = function (k) {
  19127. if (k === 0 || this.index - k < 0) {
  19128. return null;
  19129. }
  19130. var i = this.index;
  19131. var n = 1;
  19132. // find k good tokens looking backwards
  19133. while (n <= k) {
  19134. // skip off-channel tokens
  19135. i = this.previousTokenOnChannel(i - 1, this.channel);
  19136. n += 1;
  19137. }
  19138. if (i < 0) {
  19139. return null;
  19140. }
  19141. return this.tokens[i];
  19142. };
  19143. CommonTokenStream.prototype.LT = function (k) {
  19144. this.lazyInit();
  19145. if (k === 0) {
  19146. return null;
  19147. }
  19148. if (k < 0) {
  19149. return this.LB(-k);
  19150. }
  19151. var i = this.index;
  19152. var n = 1; // we know tokens[pos] is a good one
  19153. // find k good tokens
  19154. while (n < k) {
  19155. // skip off-channel tokens, but make sure to not look past EOF
  19156. if (this.sync(i + 1)) {
  19157. i = this.nextTokenOnChannel(i + 1, this.channel);
  19158. }
  19159. n += 1;
  19160. }
  19161. return this.tokens[i];
  19162. };
  19163. // Count EOF just once.///
  19164. CommonTokenStream.prototype.getNumberOfOnChannelTokens = function () {
  19165. var n = 0;
  19166. this.fill();
  19167. for (var i = 0; i < this.tokens.length; i++) {
  19168. var t = this.tokens[i];
  19169. if (t.channel === this.channel) {
  19170. n += 1;
  19171. }
  19172. if (t.type === Token.EOF) {
  19173. break;
  19174. }
  19175. }
  19176. return n;
  19177. };
  19178. exports.CommonTokenStream = CommonTokenStream;
  19179. /***/ }),
  19180. /***/ "./node_modules/antlr4/FileStream.js":
  19181. /*!*******************************************!*\
  19182. !*** ./node_modules/antlr4/FileStream.js ***!
  19183. \*******************************************/
  19184. /*! no static exports found */
  19185. /***/ (function(module, exports, __webpack_require__) {
  19186. "use strict";
  19187. //
  19188. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  19189. * Use of this file is governed by the BSD 3-clause license that
  19190. * can be found in the LICENSE.txt file in the project root.
  19191. */
  19192. //
  19193. //
  19194. // This is an InputStream that is loaded from a file all at once
  19195. // when you construct the object.
  19196. //
  19197. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  19198. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  19199. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  19200. function FileStream(fileName, decodeToUnicodeCodePoints) {
  19201. var data = fs.readFileSync(fileName, "utf8");
  19202. InputStream.call(this, data, decodeToUnicodeCodePoints);
  19203. this.fileName = fileName;
  19204. return this;
  19205. }
  19206. FileStream.prototype = Object.create(InputStream.prototype);
  19207. FileStream.prototype.constructor = FileStream;
  19208. exports.FileStream = FileStream;
  19209. /***/ }),
  19210. /***/ "./node_modules/antlr4/InputStream.js":
  19211. /*!********************************************!*\
  19212. !*** ./node_modules/antlr4/InputStream.js ***!
  19213. \********************************************/
  19214. /*! no static exports found */
  19215. /***/ (function(module, exports, __webpack_require__) {
  19216. "use strict";
  19217. //
  19218. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  19219. * Use of this file is governed by the BSD 3-clause license that
  19220. * can be found in the LICENSE.txt file in the project root.
  19221. */
  19222. //
  19223. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  19224. __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  19225. __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  19226. // Vacuum all input from a string and then treat it like a buffer.
  19227. function _loadString(stream, decodeToUnicodeCodePoints) {
  19228. stream._index = 0;
  19229. stream.data = [];
  19230. if (stream.decodeToUnicodeCodePoints) {
  19231. for (var i = 0; i < stream.strdata.length;) {
  19232. var codePoint = stream.strdata.codePointAt(i);
  19233. stream.data.push(codePoint);
  19234. i += codePoint <= 0xFFFF ? 1 : 2;
  19235. }
  19236. } else {
  19237. for (var i = 0; i < stream.strdata.length; i++) {
  19238. var codeUnit = stream.strdata.charCodeAt(i);
  19239. stream.data.push(codeUnit);
  19240. }
  19241. }
  19242. stream._size = stream.data.length;
  19243. }
  19244. // If decodeToUnicodeCodePoints is true, the input is treated
  19245. // as a series of Unicode code points.
  19246. //
  19247. // Otherwise, the input is treated as a series of 16-bit UTF-16 code
  19248. // units.
  19249. function InputStream(data, decodeToUnicodeCodePoints) {
  19250. this.name = "<empty>";
  19251. this.strdata = data;
  19252. this.decodeToUnicodeCodePoints = decodeToUnicodeCodePoints || false;
  19253. _loadString(this);
  19254. return this;
  19255. }
  19256. Object.defineProperty(InputStream.prototype, "index", {
  19257. get: function get() {
  19258. return this._index;
  19259. }
  19260. });
  19261. Object.defineProperty(InputStream.prototype, "size", {
  19262. get: function get() {
  19263. return this._size;
  19264. }
  19265. });
  19266. // Reset the stream so that it's in the same state it was
  19267. // when the object was created *except* the data array is not
  19268. // touched.
  19269. //
  19270. InputStream.prototype.reset = function () {
  19271. this._index = 0;
  19272. };
  19273. InputStream.prototype.consume = function () {
  19274. if (this._index >= this._size) {
  19275. // assert this.LA(1) == Token.EOF
  19276. throw "cannot consume EOF";
  19277. }
  19278. this._index += 1;
  19279. };
  19280. InputStream.prototype.LA = function (offset) {
  19281. if (offset === 0) {
  19282. return 0; // undefined
  19283. }
  19284. if (offset < 0) {
  19285. offset += 1; // e.g., translate LA(-1) to use offset=0
  19286. }
  19287. var pos = this._index + offset - 1;
  19288. if (pos < 0 || pos >= this._size) {
  19289. // invalid
  19290. return Token.EOF;
  19291. }
  19292. return this.data[pos];
  19293. };
  19294. InputStream.prototype.LT = function (offset) {
  19295. return this.LA(offset);
  19296. };
  19297. // mark/release do nothing; we have entire buffer
  19298. InputStream.prototype.mark = function () {
  19299. return -1;
  19300. };
  19301. InputStream.prototype.release = function (marker) {};
  19302. // consume() ahead until p==_index; can't just set p=_index as we must
  19303. // update line and column. If we seek backwards, just set p
  19304. //
  19305. InputStream.prototype.seek = function (_index) {
  19306. if (_index <= this._index) {
  19307. this._index = _index; // just jump; don't update stream state (line,
  19308. // ...)
  19309. return;
  19310. }
  19311. // seek forward
  19312. this._index = Math.min(_index, this._size);
  19313. };
  19314. InputStream.prototype.getText = function (start, stop) {
  19315. if (stop >= this._size) {
  19316. stop = this._size - 1;
  19317. }
  19318. if (start >= this._size) {
  19319. return "";
  19320. } else {
  19321. if (this.decodeToUnicodeCodePoints) {
  19322. var result = "";
  19323. for (var i = start; i <= stop; i++) {
  19324. result += String.fromCodePoint(this.data[i]);
  19325. }
  19326. return result;
  19327. } else {
  19328. return this.strdata.slice(start, stop + 1);
  19329. }
  19330. }
  19331. };
  19332. InputStream.prototype.toString = function () {
  19333. return this.strdata;
  19334. };
  19335. exports.InputStream = InputStream;
  19336. /***/ }),
  19337. /***/ "./node_modules/antlr4/IntervalSet.js":
  19338. /*!********************************************!*\
  19339. !*** ./node_modules/antlr4/IntervalSet.js ***!
  19340. \********************************************/
  19341. /*! no static exports found */
  19342. /***/ (function(module, exports, __webpack_require__) {
  19343. "use strict";
  19344. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  19345. * Use of this file is governed by the BSD 3-clause license that
  19346. * can be found in the LICENSE.txt file in the project root.
  19347. */
  19348. /*jslint smarttabs:true */
  19349. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  19350. /* stop is not included! */
  19351. function Interval(start, stop) {
  19352. this.start = start;
  19353. this.stop = stop;
  19354. return this;
  19355. }
  19356. Interval.prototype.contains = function (item) {
  19357. return item >= this.start && item < this.stop;
  19358. };
  19359. Interval.prototype.toString = function () {
  19360. if (this.start === this.stop - 1) {
  19361. return this.start.toString();
  19362. } else {
  19363. return this.start.toString() + ".." + (this.stop - 1).toString();
  19364. }
  19365. };
  19366. Object.defineProperty(Interval.prototype, "length", {
  19367. get: function get() {
  19368. return this.stop - this.start;
  19369. }
  19370. });
  19371. function IntervalSet() {
  19372. this.intervals = null;
  19373. this.readOnly = false;
  19374. }
  19375. IntervalSet.prototype.first = function (v) {
  19376. if (this.intervals === null || this.intervals.length === 0) {
  19377. return Token.INVALID_TYPE;
  19378. } else {
  19379. return this.intervals[0].start;
  19380. }
  19381. };
  19382. IntervalSet.prototype.addOne = function (v) {
  19383. this.addInterval(new Interval(v, v + 1));
  19384. };
  19385. IntervalSet.prototype.addRange = function (l, h) {
  19386. this.addInterval(new Interval(l, h + 1));
  19387. };
  19388. IntervalSet.prototype.addInterval = function (v) {
  19389. if (this.intervals === null) {
  19390. this.intervals = [];
  19391. this.intervals.push(v);
  19392. } else {
  19393. // find insert pos
  19394. for (var k = 0; k < this.intervals.length; k++) {
  19395. var i = this.intervals[k];
  19396. // distinct range -> insert
  19397. if (v.stop < i.start) {
  19398. this.intervals.splice(k, 0, v);
  19399. return;
  19400. }
  19401. // contiguous range -> adjust
  19402. else if (v.stop === i.start) {
  19403. this.intervals[k].start = v.start;
  19404. return;
  19405. }
  19406. // overlapping range -> adjust and reduce
  19407. else if (v.start <= i.stop) {
  19408. this.intervals[k] = new Interval(Math.min(i.start, v.start), Math.max(i.stop, v.stop));
  19409. this.reduce(k);
  19410. return;
  19411. }
  19412. }
  19413. // greater than any existing
  19414. this.intervals.push(v);
  19415. }
  19416. };
  19417. IntervalSet.prototype.addSet = function (other) {
  19418. if (other.intervals !== null) {
  19419. for (var k = 0; k < other.intervals.length; k++) {
  19420. var i = other.intervals[k];
  19421. this.addInterval(new Interval(i.start, i.stop));
  19422. }
  19423. }
  19424. return this;
  19425. };
  19426. IntervalSet.prototype.reduce = function (k) {
  19427. // only need to reduce if k is not the last
  19428. if (k < this.intervalslength - 1) {
  19429. var l = this.intervals[k];
  19430. var r = this.intervals[k + 1];
  19431. // if r contained in l
  19432. if (l.stop >= r.stop) {
  19433. this.intervals.pop(k + 1);
  19434. this.reduce(k);
  19435. } else if (l.stop >= r.start) {
  19436. this.intervals[k] = new Interval(l.start, r.stop);
  19437. this.intervals.pop(k + 1);
  19438. }
  19439. }
  19440. };
  19441. IntervalSet.prototype.complement = function (start, stop) {
  19442. var result = new IntervalSet();
  19443. result.addInterval(new Interval(start, stop + 1));
  19444. for (var i = 0; i < this.intervals.length; i++) {
  19445. result.removeRange(this.intervals[i]);
  19446. }
  19447. return result;
  19448. };
  19449. IntervalSet.prototype.contains = function (item) {
  19450. if (this.intervals === null) {
  19451. return false;
  19452. } else {
  19453. for (var k = 0; k < this.intervals.length; k++) {
  19454. if (this.intervals[k].contains(item)) {
  19455. return true;
  19456. }
  19457. }
  19458. return false;
  19459. }
  19460. };
  19461. Object.defineProperty(IntervalSet.prototype, "length", {
  19462. get: function get() {
  19463. var len = 0;
  19464. this.intervals.map(function (i) {
  19465. len += i.length;
  19466. });
  19467. return len;
  19468. }
  19469. });
  19470. IntervalSet.prototype.removeRange = function (v) {
  19471. if (v.start === v.stop - 1) {
  19472. this.removeOne(v.start);
  19473. } else if (this.intervals !== null) {
  19474. var k = 0;
  19475. for (var n = 0; n < this.intervals.length; n++) {
  19476. var i = this.intervals[k];
  19477. // intervals are ordered
  19478. if (v.stop <= i.start) {
  19479. return;
  19480. }
  19481. // check for including range, split it
  19482. else if (v.start > i.start && v.stop < i.stop) {
  19483. this.intervals[k] = new Interval(i.start, v.start);
  19484. var x = new Interval(v.stop, i.stop);
  19485. this.intervals.splice(k, 0, x);
  19486. return;
  19487. }
  19488. // check for included range, remove it
  19489. else if (v.start <= i.start && v.stop >= i.stop) {
  19490. this.intervals.splice(k, 1);
  19491. k = k - 1; // need another pass
  19492. }
  19493. // check for lower boundary
  19494. else if (v.start < i.stop) {
  19495. this.intervals[k] = new Interval(i.start, v.start);
  19496. }
  19497. // check for upper boundary
  19498. else if (v.stop < i.stop) {
  19499. this.intervals[k] = new Interval(v.stop, i.stop);
  19500. }
  19501. k += 1;
  19502. }
  19503. }
  19504. };
  19505. IntervalSet.prototype.removeOne = function (v) {
  19506. if (this.intervals !== null) {
  19507. for (var k = 0; k < this.intervals.length; k++) {
  19508. var i = this.intervals[k];
  19509. // intervals is ordered
  19510. if (v < i.start) {
  19511. return;
  19512. }
  19513. // check for single value range
  19514. else if (v === i.start && v === i.stop - 1) {
  19515. this.intervals.splice(k, 1);
  19516. return;
  19517. }
  19518. // check for lower boundary
  19519. else if (v === i.start) {
  19520. this.intervals[k] = new Interval(i.start + 1, i.stop);
  19521. return;
  19522. }
  19523. // check for upper boundary
  19524. else if (v === i.stop - 1) {
  19525. this.intervals[k] = new Interval(i.start, i.stop - 1);
  19526. return;
  19527. }
  19528. // split existing range
  19529. else if (v < i.stop - 1) {
  19530. var x = new Interval(i.start, v);
  19531. i.start = v + 1;
  19532. this.intervals.splice(k, 0, x);
  19533. return;
  19534. }
  19535. }
  19536. }
  19537. };
  19538. IntervalSet.prototype.toString = function (literalNames, symbolicNames, elemsAreChar) {
  19539. literalNames = literalNames || null;
  19540. symbolicNames = symbolicNames || null;
  19541. elemsAreChar = elemsAreChar || false;
  19542. if (this.intervals === null) {
  19543. return "{}";
  19544. } else if (literalNames !== null || symbolicNames !== null) {
  19545. return this.toTokenString(literalNames, symbolicNames);
  19546. } else if (elemsAreChar) {
  19547. return this.toCharString();
  19548. } else {
  19549. return this.toIndexString();
  19550. }
  19551. };
  19552. IntervalSet.prototype.toCharString = function () {
  19553. var names = [];
  19554. for (var i = 0; i < this.intervals.length; i++) {
  19555. var v = this.intervals[i];
  19556. if (v.stop === v.start + 1) {
  19557. if (v.start === Token.EOF) {
  19558. names.push("<EOF>");
  19559. } else {
  19560. names.push("'" + String.fromCharCode(v.start) + "'");
  19561. }
  19562. } else {
  19563. names.push("'" + String.fromCharCode(v.start) + "'..'" + String.fromCharCode(v.stop - 1) + "'");
  19564. }
  19565. }
  19566. if (names.length > 1) {
  19567. return "{" + names.join(", ") + "}";
  19568. } else {
  19569. return names[0];
  19570. }
  19571. };
  19572. IntervalSet.prototype.toIndexString = function () {
  19573. var names = [];
  19574. for (var i = 0; i < this.intervals.length; i++) {
  19575. var v = this.intervals[i];
  19576. if (v.stop === v.start + 1) {
  19577. if (v.start === Token.EOF) {
  19578. names.push("<EOF>");
  19579. } else {
  19580. names.push(v.start.toString());
  19581. }
  19582. } else {
  19583. names.push(v.start.toString() + ".." + (v.stop - 1).toString());
  19584. }
  19585. }
  19586. if (names.length > 1) {
  19587. return "{" + names.join(", ") + "}";
  19588. } else {
  19589. return names[0];
  19590. }
  19591. };
  19592. IntervalSet.prototype.toTokenString = function (literalNames, symbolicNames) {
  19593. var names = [];
  19594. for (var i = 0; i < this.intervals.length; i++) {
  19595. var v = this.intervals[i];
  19596. for (var j = v.start; j < v.stop; j++) {
  19597. names.push(this.elementName(literalNames, symbolicNames, j));
  19598. }
  19599. }
  19600. if (names.length > 1) {
  19601. return "{" + names.join(", ") + "}";
  19602. } else {
  19603. return names[0];
  19604. }
  19605. };
  19606. IntervalSet.prototype.elementName = function (literalNames, symbolicNames, a) {
  19607. if (a === Token.EOF) {
  19608. return "<EOF>";
  19609. } else if (a === Token.EPSILON) {
  19610. return "<EPSILON>";
  19611. } else {
  19612. return literalNames[a] || symbolicNames[a];
  19613. }
  19614. };
  19615. exports.Interval = Interval;
  19616. exports.IntervalSet = IntervalSet;
  19617. /***/ }),
  19618. /***/ "./node_modules/antlr4/LL1Analyzer.js":
  19619. /*!********************************************!*\
  19620. !*** ./node_modules/antlr4/LL1Analyzer.js ***!
  19621. \********************************************/
  19622. /*! no static exports found */
  19623. /***/ (function(module, exports, __webpack_require__) {
  19624. "use strict";
  19625. //
  19626. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  19627. * Use of this file is governed by the BSD 3-clause license that
  19628. * can be found in the LICENSE.txt file in the project root.
  19629. */
  19630. ///
  19631. var Set = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Set;
  19632. var BitSet = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  19633. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  19634. var ATNConfig = __webpack_require__(/*! ./atn/ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  19635. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  19636. var IntervalSet = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  19637. var RuleStopState = __webpack_require__(/*! ./atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  19638. var RuleTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").RuleTransition;
  19639. var NotSetTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").NotSetTransition;
  19640. var WildcardTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").WildcardTransition;
  19641. var AbstractPredicateTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").AbstractPredicateTransition;
  19642. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  19643. var predictionContextFromRuleContext = pc.predictionContextFromRuleContext;
  19644. var PredictionContext = pc.PredictionContext;
  19645. var SingletonPredictionContext = pc.SingletonPredictionContext;
  19646. function LL1Analyzer(atn) {
  19647. this.atn = atn;
  19648. }
  19649. //* Special value added to the lookahead sets to indicate that we hit
  19650. // a predicate during analysis if {@code seeThruPreds==false}.
  19651. ///
  19652. LL1Analyzer.HIT_PRED = Token.INVALID_TYPE;
  19653. //*
  19654. // Calculates the SLL(1) expected lookahead set for each outgoing transition
  19655. // of an {@link ATNState}. The returned array has one element for each
  19656. // outgoing transition in {@code s}. If the closure from transition
  19657. // <em>i</em> leads to a semantic predicate before matching a symbol, the
  19658. // element at index <em>i</em> of the result will be {@code null}.
  19659. //
  19660. // @param s the ATN state
  19661. // @return the expected symbols for each outgoing transition of {@code s}.
  19662. ///
  19663. LL1Analyzer.prototype.getDecisionLookahead = function (s) {
  19664. if (s === null) {
  19665. return null;
  19666. }
  19667. var count = s.transitions.length;
  19668. var look = [];
  19669. for (var alt = 0; alt < count; alt++) {
  19670. look[alt] = new IntervalSet();
  19671. var lookBusy = new Set();
  19672. var seeThruPreds = false; // fail to get lookahead upon pred
  19673. this._LOOK(s.transition(alt).target, null, PredictionContext.EMPTY, look[alt], lookBusy, new BitSet(), seeThruPreds, false);
  19674. // Wipe out lookahead for this alternative if we found nothing
  19675. // or we had a predicate when we !seeThruPreds
  19676. if (look[alt].length === 0 || look[alt].contains(LL1Analyzer.HIT_PRED)) {
  19677. look[alt] = null;
  19678. }
  19679. }
  19680. return look;
  19681. };
  19682. //*
  19683. // Compute set of tokens that can follow {@code s} in the ATN in the
  19684. // specified {@code ctx}.
  19685. //
  19686. // <p>If {@code ctx} is {@code null} and the end of the rule containing
  19687. // {@code s} is reached, {@link Token//EPSILON} is added to the result set.
  19688. // If {@code ctx} is not {@code null} and the end of the outermost rule is
  19689. // reached, {@link Token//EOF} is added to the result set.</p>
  19690. //
  19691. // @param s the ATN state
  19692. // @param stopState the ATN state to stop at. This can be a
  19693. // {@link BlockEndState} to detect epsilon paths through a closure.
  19694. // @param ctx the complete parser context, or {@code null} if the context
  19695. // should be ignored
  19696. //
  19697. // @return The set of tokens that can follow {@code s} in the ATN in the
  19698. // specified {@code ctx}.
  19699. ///
  19700. LL1Analyzer.prototype.LOOK = function (s, stopState, ctx) {
  19701. var r = new IntervalSet();
  19702. var seeThruPreds = true; // ignore preds; get all lookahead
  19703. ctx = ctx || null;
  19704. var lookContext = ctx !== null ? predictionContextFromRuleContext(s.atn, ctx) : null;
  19705. this._LOOK(s, stopState, lookContext, r, new Set(), new BitSet(), seeThruPreds, true);
  19706. return r;
  19707. };
  19708. //*
  19709. // Compute set of tokens that can follow {@code s} in the ATN in the
  19710. // specified {@code ctx}.
  19711. //
  19712. // <p>If {@code ctx} is {@code null} and {@code stopState} or the end of the
  19713. // rule containing {@code s} is reached, {@link Token//EPSILON} is added to
  19714. // the result set. If {@code ctx} is not {@code null} and {@code addEOF} is
  19715. // {@code true} and {@code stopState} or the end of the outermost rule is
  19716. // reached, {@link Token//EOF} is added to the result set.</p>
  19717. //
  19718. // @param s the ATN state.
  19719. // @param stopState the ATN state to stop at. This can be a
  19720. // {@link BlockEndState} to detect epsilon paths through a closure.
  19721. // @param ctx The outer context, or {@code null} if the outer context should
  19722. // not be used.
  19723. // @param look The result lookahead set.
  19724. // @param lookBusy A set used for preventing epsilon closures in the ATN
  19725. // from causing a stack overflow. Outside code should pass
  19726. // {@code new Set<ATNConfig>} for this argument.
  19727. // @param calledRuleStack A set used for preventing left recursion in the
  19728. // ATN from causing a stack overflow. Outside code should pass
  19729. // {@code new BitSet()} for this argument.
  19730. // @param seeThruPreds {@code true} to true semantic predicates as
  19731. // implicitly {@code true} and "see through them", otherwise {@code false}
  19732. // to treat semantic predicates as opaque and add {@link //HIT_PRED} to the
  19733. // result if one is encountered.
  19734. // @param addEOF Add {@link Token//EOF} to the result if the end of the
  19735. // outermost context is reached. This parameter has no effect if {@code ctx}
  19736. // is {@code null}.
  19737. ///
  19738. LL1Analyzer.prototype._LOOK = function (s, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF) {
  19739. var c = new ATNConfig({ state: s, alt: 0, context: ctx }, null);
  19740. if (lookBusy.contains(c)) {
  19741. return;
  19742. }
  19743. lookBusy.add(c);
  19744. if (s === stopState) {
  19745. if (ctx === null) {
  19746. look.addOne(Token.EPSILON);
  19747. return;
  19748. } else if (ctx.isEmpty() && addEOF) {
  19749. look.addOne(Token.EOF);
  19750. return;
  19751. }
  19752. }
  19753. if (s instanceof RuleStopState) {
  19754. if (ctx === null) {
  19755. look.addOne(Token.EPSILON);
  19756. return;
  19757. } else if (ctx.isEmpty() && addEOF) {
  19758. look.addOne(Token.EOF);
  19759. return;
  19760. }
  19761. if (ctx !== PredictionContext.EMPTY) {
  19762. // run thru all possible stack tops in ctx
  19763. for (var i = 0; i < ctx.length; i++) {
  19764. var returnState = this.atn.states[ctx.getReturnState(i)];
  19765. var removed = calledRuleStack.contains(returnState.ruleIndex);
  19766. try {
  19767. calledRuleStack.remove(returnState.ruleIndex);
  19768. this._LOOK(returnState, stopState, ctx.getParent(i), look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  19769. } finally {
  19770. if (removed) {
  19771. calledRuleStack.add(returnState.ruleIndex);
  19772. }
  19773. }
  19774. }
  19775. return;
  19776. }
  19777. }
  19778. for (var j = 0; j < s.transitions.length; j++) {
  19779. var t = s.transitions[j];
  19780. if (t.constructor === RuleTransition) {
  19781. if (calledRuleStack.contains(t.target.ruleIndex)) {
  19782. continue;
  19783. }
  19784. var newContext = SingletonPredictionContext.create(ctx, t.followState.stateNumber);
  19785. try {
  19786. calledRuleStack.add(t.target.ruleIndex);
  19787. this._LOOK(t.target, stopState, newContext, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  19788. } finally {
  19789. calledRuleStack.remove(t.target.ruleIndex);
  19790. }
  19791. } else if (t instanceof AbstractPredicateTransition) {
  19792. if (seeThruPreds) {
  19793. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  19794. } else {
  19795. look.addOne(LL1Analyzer.HIT_PRED);
  19796. }
  19797. } else if (t.isEpsilon) {
  19798. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  19799. } else if (t.constructor === WildcardTransition) {
  19800. look.addRange(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  19801. } else {
  19802. var set = t.label;
  19803. if (set !== null) {
  19804. if (t instanceof NotSetTransition) {
  19805. set = set.complement(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  19806. }
  19807. look.addSet(set);
  19808. }
  19809. }
  19810. }
  19811. };
  19812. exports.LL1Analyzer = LL1Analyzer;
  19813. /***/ }),
  19814. /***/ "./node_modules/antlr4/Lexer.js":
  19815. /*!**************************************!*\
  19816. !*** ./node_modules/antlr4/Lexer.js ***!
  19817. \**************************************/
  19818. /*! no static exports found */
  19819. /***/ (function(module, exports, __webpack_require__) {
  19820. "use strict";
  19821. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  19822. * Use of this file is governed by the BSD 3-clause license that
  19823. * can be found in the LICENSE.txt file in the project root.
  19824. */
  19825. ///
  19826. // A lexer is recognizer that draws input symbols from a character stream.
  19827. // lexer grammars result in a subclass of this object. A Lexer object
  19828. // uses simplified match() and error recovery mechanisms in the interest of speed.
  19829. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  19830. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  19831. var CommonTokenFactory = __webpack_require__(/*! ./CommonTokenFactory */ "./node_modules/antlr4/CommonTokenFactory.js").CommonTokenFactory;
  19832. var RecognitionException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  19833. var LexerNoViableAltException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  19834. function TokenSource() {
  19835. return this;
  19836. }
  19837. function Lexer(input) {
  19838. Recognizer.call(this);
  19839. this._input = input;
  19840. this._factory = CommonTokenFactory.DEFAULT;
  19841. this._tokenFactorySourcePair = [this, input];
  19842. this._interp = null; // child classes must populate this
  19843. // The goal of all lexer rules/methods is to create a token object.
  19844. // this is an instance variable as multiple rules may collaborate to
  19845. // create a single token. nextToken will return this object after
  19846. // matching lexer rule(s). If you subclass to allow multiple token
  19847. // emissions, then set this to the last token to be matched or
  19848. // something nonnull so that the auto token emit mechanism will not
  19849. // emit another token.
  19850. this._token = null;
  19851. // What character index in the stream did the current token start at?
  19852. // Needed, for example, to get the text for current token. Set at
  19853. // the start of nextToken.
  19854. this._tokenStartCharIndex = -1;
  19855. // The line on which the first character of the token resides///
  19856. this._tokenStartLine = -1;
  19857. // The character position of first character within the line///
  19858. this._tokenStartColumn = -1;
  19859. // Once we see EOF on char stream, next token will be EOF.
  19860. // If you have DONE : EOF ; then you see DONE EOF.
  19861. this._hitEOF = false;
  19862. // The channel number for the current token///
  19863. this._channel = Token.DEFAULT_CHANNEL;
  19864. // The token type for the current token///
  19865. this._type = Token.INVALID_TYPE;
  19866. this._modeStack = [];
  19867. this._mode = Lexer.DEFAULT_MODE;
  19868. // You can set the text for the current token to override what is in
  19869. // the input char buffer. Use setText() or can set this instance var.
  19870. // /
  19871. this._text = null;
  19872. return this;
  19873. }
  19874. Lexer.prototype = Object.create(Recognizer.prototype);
  19875. Lexer.prototype.constructor = Lexer;
  19876. Lexer.DEFAULT_MODE = 0;
  19877. Lexer.MORE = -2;
  19878. Lexer.SKIP = -3;
  19879. Lexer.DEFAULT_TOKEN_CHANNEL = Token.DEFAULT_CHANNEL;
  19880. Lexer.HIDDEN = Token.HIDDEN_CHANNEL;
  19881. Lexer.MIN_CHAR_VALUE = 0x0000;
  19882. Lexer.MAX_CHAR_VALUE = 0x10FFFF;
  19883. Lexer.prototype.reset = function () {
  19884. // wack Lexer state variables
  19885. if (this._input !== null) {
  19886. this._input.seek(0); // rewind the input
  19887. }
  19888. this._token = null;
  19889. this._type = Token.INVALID_TYPE;
  19890. this._channel = Token.DEFAULT_CHANNEL;
  19891. this._tokenStartCharIndex = -1;
  19892. this._tokenStartColumn = -1;
  19893. this._tokenStartLine = -1;
  19894. this._text = null;
  19895. this._hitEOF = false;
  19896. this._mode = Lexer.DEFAULT_MODE;
  19897. this._modeStack = [];
  19898. this._interp.reset();
  19899. };
  19900. // Return a token from this source; i.e., match a token on the char stream.
  19901. Lexer.prototype.nextToken = function () {
  19902. if (this._input === null) {
  19903. throw "nextToken requires a non-null input stream.";
  19904. }
  19905. // Mark start location in char stream so unbuffered streams are
  19906. // guaranteed at least have text of current token
  19907. var tokenStartMarker = this._input.mark();
  19908. try {
  19909. while (true) {
  19910. if (this._hitEOF) {
  19911. this.emitEOF();
  19912. return this._token;
  19913. }
  19914. this._token = null;
  19915. this._channel = Token.DEFAULT_CHANNEL;
  19916. this._tokenStartCharIndex = this._input.index;
  19917. this._tokenStartColumn = this._interp.column;
  19918. this._tokenStartLine = this._interp.line;
  19919. this._text = null;
  19920. var continueOuter = false;
  19921. while (true) {
  19922. this._type = Token.INVALID_TYPE;
  19923. var ttype = Lexer.SKIP;
  19924. try {
  19925. ttype = this._interp.match(this._input, this._mode);
  19926. } catch (e) {
  19927. if (e instanceof RecognitionException) {
  19928. this.notifyListeners(e); // report error
  19929. this.recover(e);
  19930. } else {
  19931. console.log(e.stack);
  19932. throw e;
  19933. }
  19934. }
  19935. if (this._input.LA(1) === Token.EOF) {
  19936. this._hitEOF = true;
  19937. }
  19938. if (this._type === Token.INVALID_TYPE) {
  19939. this._type = ttype;
  19940. }
  19941. if (this._type === Lexer.SKIP) {
  19942. continueOuter = true;
  19943. break;
  19944. }
  19945. if (this._type !== Lexer.MORE) {
  19946. break;
  19947. }
  19948. }
  19949. if (continueOuter) {
  19950. continue;
  19951. }
  19952. if (this._token === null) {
  19953. this.emit();
  19954. }
  19955. return this._token;
  19956. }
  19957. } finally {
  19958. // make sure we release marker after match or
  19959. // unbuffered char stream will keep buffering
  19960. this._input.release(tokenStartMarker);
  19961. }
  19962. };
  19963. // Instruct the lexer to skip creating a token for current lexer rule
  19964. // and look for another token. nextToken() knows to keep looking when
  19965. // a lexer rule finishes with token set to SKIP_TOKEN. Recall that
  19966. // if token==null at end of any token rule, it creates one for you
  19967. // and emits it.
  19968. // /
  19969. Lexer.prototype.skip = function () {
  19970. this._type = Lexer.SKIP;
  19971. };
  19972. Lexer.prototype.more = function () {
  19973. this._type = Lexer.MORE;
  19974. };
  19975. Lexer.prototype.mode = function (m) {
  19976. this._mode = m;
  19977. };
  19978. Lexer.prototype.pushMode = function (m) {
  19979. if (this._interp.debug) {
  19980. console.log("pushMode " + m);
  19981. }
  19982. this._modeStack.push(this._mode);
  19983. this.mode(m);
  19984. };
  19985. Lexer.prototype.popMode = function () {
  19986. if (this._modeStack.length === 0) {
  19987. throw "Empty Stack";
  19988. }
  19989. if (this._interp.debug) {
  19990. console.log("popMode back to " + this._modeStack.slice(0, -1));
  19991. }
  19992. this.mode(this._modeStack.pop());
  19993. return this._mode;
  19994. };
  19995. // Set the char stream and reset the lexer
  19996. Object.defineProperty(Lexer.prototype, "inputStream", {
  19997. get: function get() {
  19998. return this._input;
  19999. },
  20000. set: function set(input) {
  20001. this._input = null;
  20002. this._tokenFactorySourcePair = [this, this._input];
  20003. this.reset();
  20004. this._input = input;
  20005. this._tokenFactorySourcePair = [this, this._input];
  20006. }
  20007. });
  20008. Object.defineProperty(Lexer.prototype, "sourceName", {
  20009. get: function sourceName() {
  20010. return this._input.sourceName;
  20011. }
  20012. });
  20013. // By default does not support multiple emits per nextToken invocation
  20014. // for efficiency reasons. Subclass and override this method, nextToken,
  20015. // and getToken (to push tokens into a list and pull from that list
  20016. // rather than a single variable as this implementation does).
  20017. // /
  20018. Lexer.prototype.emitToken = function (token) {
  20019. this._token = token;
  20020. };
  20021. // The standard method called to automatically emit a token at the
  20022. // outermost lexical rule. The token object should point into the
  20023. // char buffer start..stop. If there is a text override in 'text',
  20024. // use that to set the token's text. Override this method to emit
  20025. // custom Token objects or provide a new factory.
  20026. // /
  20027. Lexer.prototype.emit = function () {
  20028. var t = this._factory.create(this._tokenFactorySourcePair, this._type, this._text, this._channel, this._tokenStartCharIndex, this.getCharIndex() - 1, this._tokenStartLine, this._tokenStartColumn);
  20029. this.emitToken(t);
  20030. return t;
  20031. };
  20032. Lexer.prototype.emitEOF = function () {
  20033. var cpos = this.column;
  20034. var lpos = this.line;
  20035. var eof = this._factory.create(this._tokenFactorySourcePair, Token.EOF, null, Token.DEFAULT_CHANNEL, this._input.index, this._input.index - 1, lpos, cpos);
  20036. this.emitToken(eof);
  20037. return eof;
  20038. };
  20039. Object.defineProperty(Lexer.prototype, "type", {
  20040. get: function get() {
  20041. return this.type;
  20042. },
  20043. set: function set(type) {
  20044. this._type = type;
  20045. }
  20046. });
  20047. Object.defineProperty(Lexer.prototype, "line", {
  20048. get: function get() {
  20049. return this._interp.line;
  20050. },
  20051. set: function set(line) {
  20052. this._interp.line = line;
  20053. }
  20054. });
  20055. Object.defineProperty(Lexer.prototype, "column", {
  20056. get: function get() {
  20057. return this._interp.column;
  20058. },
  20059. set: function set(column) {
  20060. this._interp.column = column;
  20061. }
  20062. });
  20063. // What is the index of the current character of lookahead?///
  20064. Lexer.prototype.getCharIndex = function () {
  20065. return this._input.index;
  20066. };
  20067. // Return the text matched so far for the current token or any text override.
  20068. //Set the complete text of this token; it wipes any previous changes to the text.
  20069. Object.defineProperty(Lexer.prototype, "text", {
  20070. get: function get() {
  20071. if (this._text !== null) {
  20072. return this._text;
  20073. } else {
  20074. return this._interp.getText(this._input);
  20075. }
  20076. },
  20077. set: function set(text) {
  20078. this._text = text;
  20079. }
  20080. });
  20081. // Return a list of all Token objects in input char stream.
  20082. // Forces load of all tokens. Does not include EOF token.
  20083. // /
  20084. Lexer.prototype.getAllTokens = function () {
  20085. var tokens = [];
  20086. var t = this.nextToken();
  20087. while (t.type !== Token.EOF) {
  20088. tokens.push(t);
  20089. t = this.nextToken();
  20090. }
  20091. return tokens;
  20092. };
  20093. Lexer.prototype.notifyListeners = function (e) {
  20094. var start = this._tokenStartCharIndex;
  20095. var stop = this._input.index;
  20096. var text = this._input.getText(start, stop);
  20097. var msg = "token recognition error at: '" + this.getErrorDisplay(text) + "'";
  20098. var listener = this.getErrorListenerDispatch();
  20099. listener.syntaxError(this, null, this._tokenStartLine, this._tokenStartColumn, msg, e);
  20100. };
  20101. Lexer.prototype.getErrorDisplay = function (s) {
  20102. var d = [];
  20103. for (var i = 0; i < s.length; i++) {
  20104. d.push(s[i]);
  20105. }
  20106. return d.join('');
  20107. };
  20108. Lexer.prototype.getErrorDisplayForChar = function (c) {
  20109. if (c.charCodeAt(0) === Token.EOF) {
  20110. return "<EOF>";
  20111. } else if (c === '\n') {
  20112. return "\\n";
  20113. } else if (c === '\t') {
  20114. return "\\t";
  20115. } else if (c === '\r') {
  20116. return "\\r";
  20117. } else {
  20118. return c;
  20119. }
  20120. };
  20121. Lexer.prototype.getCharErrorDisplay = function (c) {
  20122. return "'" + this.getErrorDisplayForChar(c) + "'";
  20123. };
  20124. // Lexers can normally match any char in it's vocabulary after matching
  20125. // a token, so do the easy thing and just kill a character and hope
  20126. // it all works out. You can instead use the rule invocation stack
  20127. // to do sophisticated error recovery if you are in a fragment rule.
  20128. // /
  20129. Lexer.prototype.recover = function (re) {
  20130. if (this._input.LA(1) !== Token.EOF) {
  20131. if (re instanceof LexerNoViableAltException) {
  20132. // skip a char and try again
  20133. this._interp.consume(this._input);
  20134. } else {
  20135. // TODO: Do we lose character or line position information?
  20136. this._input.consume();
  20137. }
  20138. }
  20139. };
  20140. exports.Lexer = Lexer;
  20141. /***/ }),
  20142. /***/ "./node_modules/antlr4/Parser.js":
  20143. /*!***************************************!*\
  20144. !*** ./node_modules/antlr4/Parser.js ***!
  20145. \***************************************/
  20146. /*! no static exports found */
  20147. /***/ (function(module, exports, __webpack_require__) {
  20148. "use strict";
  20149. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  20150. * Use of this file is governed by the BSD 3-clause license that
  20151. * can be found in the LICENSE.txt file in the project root.
  20152. */
  20153. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  20154. var ParseTreeListener = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ParseTreeListener;
  20155. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  20156. var DefaultErrorStrategy = __webpack_require__(/*! ./error/ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").DefaultErrorStrategy;
  20157. var ATNDeserializer = __webpack_require__(/*! ./atn/ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  20158. var ATNDeserializationOptions = __webpack_require__(/*! ./atn/ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  20159. var TerminalNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  20160. var ErrorNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  20161. function TraceListener(parser) {
  20162. ParseTreeListener.call(this);
  20163. this.parser = parser;
  20164. return this;
  20165. }
  20166. TraceListener.prototype = Object.create(ParseTreeListener.prototype);
  20167. TraceListener.prototype.constructor = TraceListener;
  20168. TraceListener.prototype.enterEveryRule = function (ctx) {
  20169. console.log("enter " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  20170. };
  20171. TraceListener.prototype.visitTerminal = function (node) {
  20172. console.log("consume " + node.symbol + " rule " + this.parser.ruleNames[this.parser._ctx.ruleIndex]);
  20173. };
  20174. TraceListener.prototype.exitEveryRule = function (ctx) {
  20175. console.log("exit " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  20176. };
  20177. // this is all the parsing support code essentially; most of it is error
  20178. // recovery stuff.//
  20179. function Parser(input) {
  20180. Recognizer.call(this);
  20181. // The input stream.
  20182. this._input = null;
  20183. // The error handling strategy for the parser. The default value is a new
  20184. // instance of {@link DefaultErrorStrategy}.
  20185. this._errHandler = new DefaultErrorStrategy();
  20186. this._precedenceStack = [];
  20187. this._precedenceStack.push(0);
  20188. // The {@link ParserRuleContext} object for the currently executing rule.
  20189. // this is always non-null during the parsing process.
  20190. this._ctx = null;
  20191. // Specifies whether or not the parser should construct a parse tree during
  20192. // the parsing process. The default value is {@code true}.
  20193. this.buildParseTrees = true;
  20194. // When {@link //setTrace}{@code (true)} is called, a reference to the
  20195. // {@link TraceListener} is stored here so it can be easily removed in a
  20196. // later call to {@link //setTrace}{@code (false)}. The listener itself is
  20197. // implemented as a parser listener so this field is not directly used by
  20198. // other parser methods.
  20199. this._tracer = null;
  20200. // The list of {@link ParseTreeListener} listeners registered to receive
  20201. // events during the parse.
  20202. this._parseListeners = null;
  20203. // The number of syntax errors reported during parsing. this value is
  20204. // incremented each time {@link //notifyErrorListeners} is called.
  20205. this._syntaxErrors = 0;
  20206. this.setInputStream(input);
  20207. return this;
  20208. }
  20209. Parser.prototype = Object.create(Recognizer.prototype);
  20210. Parser.prototype.contructor = Parser;
  20211. // this field maps from the serialized ATN string to the deserialized {@link
  20212. // ATN} with
  20213. // bypass alternatives.
  20214. //
  20215. // @see ATNDeserializationOptions//isGenerateRuleBypassTransitions()
  20216. //
  20217. Parser.bypassAltsAtnCache = {};
  20218. // reset the parser's state//
  20219. Parser.prototype.reset = function () {
  20220. if (this._input !== null) {
  20221. this._input.seek(0);
  20222. }
  20223. this._errHandler.reset(this);
  20224. this._ctx = null;
  20225. this._syntaxErrors = 0;
  20226. this.setTrace(false);
  20227. this._precedenceStack = [];
  20228. this._precedenceStack.push(0);
  20229. if (this._interp !== null) {
  20230. this._interp.reset();
  20231. }
  20232. };
  20233. // Match current input symbol against {@code ttype}. If the symbol type
  20234. // matches, {@link ANTLRErrorStrategy//reportMatch} and {@link //consume} are
  20235. // called to complete the match process.
  20236. //
  20237. // <p>If the symbol type does not match,
  20238. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  20239. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  20240. // {@code true} and the token index of the symbol returned by
  20241. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  20242. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  20243. //
  20244. // @param ttype the token type to match
  20245. // @return the matched symbol
  20246. // @throws RecognitionException if the current input symbol did not match
  20247. // {@code ttype} and the error strategy could not recover from the
  20248. // mismatched symbol
  20249. Parser.prototype.match = function (ttype) {
  20250. var t = this.getCurrentToken();
  20251. if (t.type === ttype) {
  20252. this._errHandler.reportMatch(this);
  20253. this.consume();
  20254. } else {
  20255. t = this._errHandler.recoverInline(this);
  20256. if (this.buildParseTrees && t.tokenIndex === -1) {
  20257. // we must have conjured up a new token during single token
  20258. // insertion
  20259. // if it's not the current symbol
  20260. this._ctx.addErrorNode(t);
  20261. }
  20262. }
  20263. return t;
  20264. };
  20265. // Match current input symbol as a wildcard. If the symbol type matches
  20266. // (i.e. has a value greater than 0), {@link ANTLRErrorStrategy//reportMatch}
  20267. // and {@link //consume} are called to complete the match process.
  20268. //
  20269. // <p>If the symbol type does not match,
  20270. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  20271. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  20272. // {@code true} and the token index of the symbol returned by
  20273. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  20274. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  20275. //
  20276. // @return the matched symbol
  20277. // @throws RecognitionException if the current input symbol did not match
  20278. // a wildcard and the error strategy could not recover from the mismatched
  20279. // symbol
  20280. Parser.prototype.matchWildcard = function () {
  20281. var t = this.getCurrentToken();
  20282. if (t.type > 0) {
  20283. this._errHandler.reportMatch(this);
  20284. this.consume();
  20285. } else {
  20286. t = this._errHandler.recoverInline(this);
  20287. if (this._buildParseTrees && t.tokenIndex === -1) {
  20288. // we must have conjured up a new token during single token
  20289. // insertion
  20290. // if it's not the current symbol
  20291. this._ctx.addErrorNode(t);
  20292. }
  20293. }
  20294. return t;
  20295. };
  20296. Parser.prototype.getParseListeners = function () {
  20297. return this._parseListeners || [];
  20298. };
  20299. // Registers {@code listener} to receive events during the parsing process.
  20300. //
  20301. // <p>To support output-preserving grammar transformations (including but not
  20302. // limited to left-recursion removal, automated left-factoring, and
  20303. // optimized code generation), calls to listener methods during the parse
  20304. // may differ substantially from calls made by
  20305. // {@link ParseTreeWalker//DEFAULT} used after the parse is complete. In
  20306. // particular, rule entry and exit events may occur in a different order
  20307. // during the parse than after the parser. In addition, calls to certain
  20308. // rule entry methods may be omitted.</p>
  20309. //
  20310. // <p>With the following specific exceptions, calls to listener events are
  20311. // <em>deterministic</em>, i.e. for identical input the calls to listener
  20312. // methods will be the same.</p>
  20313. //
  20314. // <ul>
  20315. // <li>Alterations to the grammar used to generate code may change the
  20316. // behavior of the listener calls.</li>
  20317. // <li>Alterations to the command line options passed to ANTLR 4 when
  20318. // generating the parser may change the behavior of the listener calls.</li>
  20319. // <li>Changing the version of the ANTLR Tool used to generate the parser
  20320. // may change the behavior of the listener calls.</li>
  20321. // </ul>
  20322. //
  20323. // @param listener the listener to add
  20324. //
  20325. // @throws NullPointerException if {@code} listener is {@code null}
  20326. //
  20327. Parser.prototype.addParseListener = function (listener) {
  20328. if (listener === null) {
  20329. throw "listener";
  20330. }
  20331. if (this._parseListeners === null) {
  20332. this._parseListeners = [];
  20333. }
  20334. this._parseListeners.push(listener);
  20335. };
  20336. //
  20337. // Remove {@code listener} from the list of parse listeners.
  20338. //
  20339. // <p>If {@code listener} is {@code null} or has not been added as a parse
  20340. // listener, this method does nothing.</p>
  20341. // @param listener the listener to remove
  20342. //
  20343. Parser.prototype.removeParseListener = function (listener) {
  20344. if (this._parseListeners !== null) {
  20345. var idx = this._parseListeners.indexOf(listener);
  20346. if (idx >= 0) {
  20347. this._parseListeners.splice(idx, 1);
  20348. }
  20349. if (this._parseListeners.length === 0) {
  20350. this._parseListeners = null;
  20351. }
  20352. }
  20353. };
  20354. // Remove all parse listeners.
  20355. Parser.prototype.removeParseListeners = function () {
  20356. this._parseListeners = null;
  20357. };
  20358. // Notify any parse listeners of an enter rule event.
  20359. Parser.prototype.triggerEnterRuleEvent = function () {
  20360. if (this._parseListeners !== null) {
  20361. var ctx = this._ctx;
  20362. this._parseListeners.map(function (listener) {
  20363. listener.enterEveryRule(ctx);
  20364. ctx.enterRule(listener);
  20365. });
  20366. }
  20367. };
  20368. //
  20369. // Notify any parse listeners of an exit rule event.
  20370. //
  20371. // @see //addParseListener
  20372. //
  20373. Parser.prototype.triggerExitRuleEvent = function () {
  20374. if (this._parseListeners !== null) {
  20375. // reverse order walk of listeners
  20376. var ctx = this._ctx;
  20377. this._parseListeners.slice(0).reverse().map(function (listener) {
  20378. ctx.exitRule(listener);
  20379. listener.exitEveryRule(ctx);
  20380. });
  20381. }
  20382. };
  20383. Parser.prototype.getTokenFactory = function () {
  20384. return this._input.tokenSource._factory;
  20385. };
  20386. // Tell our token source and error strategy about a new way to create tokens.//
  20387. Parser.prototype.setTokenFactory = function (factory) {
  20388. this._input.tokenSource._factory = factory;
  20389. };
  20390. // The ATN with bypass alternatives is expensive to create so we create it
  20391. // lazily.
  20392. //
  20393. // @throws UnsupportedOperationException if the current parser does not
  20394. // implement the {@link //getSerializedATN()} method.
  20395. //
  20396. Parser.prototype.getATNWithBypassAlts = function () {
  20397. var serializedAtn = this.getSerializedATN();
  20398. if (serializedAtn === null) {
  20399. throw "The current parser does not support an ATN with bypass alternatives.";
  20400. }
  20401. var result = this.bypassAltsAtnCache[serializedAtn];
  20402. if (result === null) {
  20403. var deserializationOptions = new ATNDeserializationOptions();
  20404. deserializationOptions.generateRuleBypassTransitions = true;
  20405. result = new ATNDeserializer(deserializationOptions).deserialize(serializedAtn);
  20406. this.bypassAltsAtnCache[serializedAtn] = result;
  20407. }
  20408. return result;
  20409. };
  20410. // The preferred method of getting a tree pattern. For example, here's a
  20411. // sample use:
  20412. //
  20413. // <pre>
  20414. // ParseTree t = parser.expr();
  20415. // ParseTreePattern p = parser.compileParseTreePattern("&lt;ID&gt;+0",
  20416. // MyParser.RULE_expr);
  20417. // ParseTreeMatch m = p.match(t);
  20418. // String id = m.get("ID");
  20419. // </pre>
  20420. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  20421. Parser.prototype.compileParseTreePattern = function (pattern, patternRuleIndex, lexer) {
  20422. lexer = lexer || null;
  20423. if (lexer === null) {
  20424. if (this.getTokenStream() !== null) {
  20425. var tokenSource = this.getTokenStream().tokenSource;
  20426. if (tokenSource instanceof Lexer) {
  20427. lexer = tokenSource;
  20428. }
  20429. }
  20430. }
  20431. if (lexer === null) {
  20432. throw "Parser can't discover a lexer to use";
  20433. }
  20434. var m = new ParseTreePatternMatcher(lexer, this);
  20435. return m.compile(pattern, patternRuleIndex);
  20436. };
  20437. Parser.prototype.getInputStream = function () {
  20438. return this.getTokenStream();
  20439. };
  20440. Parser.prototype.setInputStream = function (input) {
  20441. this.setTokenStream(input);
  20442. };
  20443. Parser.prototype.getTokenStream = function () {
  20444. return this._input;
  20445. };
  20446. // Set the token stream and reset the parser.//
  20447. Parser.prototype.setTokenStream = function (input) {
  20448. this._input = null;
  20449. this.reset();
  20450. this._input = input;
  20451. };
  20452. // Match needs to return the current input symbol, which gets put
  20453. // into the label for the associated token ref; e.g., x=ID.
  20454. //
  20455. Parser.prototype.getCurrentToken = function () {
  20456. return this._input.LT(1);
  20457. };
  20458. Parser.prototype.notifyErrorListeners = function (msg, offendingToken, err) {
  20459. offendingToken = offendingToken || null;
  20460. err = err || null;
  20461. if (offendingToken === null) {
  20462. offendingToken = this.getCurrentToken();
  20463. }
  20464. this._syntaxErrors += 1;
  20465. var line = offendingToken.line;
  20466. var column = offendingToken.column;
  20467. var listener = this.getErrorListenerDispatch();
  20468. listener.syntaxError(this, offendingToken, line, column, msg, err);
  20469. };
  20470. //
  20471. // Consume and return the {@linkplain //getCurrentToken current symbol}.
  20472. //
  20473. // <p>E.g., given the following input with {@code A} being the current
  20474. // lookahead symbol, this function moves the cursor to {@code B} and returns
  20475. // {@code A}.</p>
  20476. //
  20477. // <pre>
  20478. // A B
  20479. // ^
  20480. // </pre>
  20481. //
  20482. // If the parser is not in error recovery mode, the consumed symbol is added
  20483. // to the parse tree using {@link ParserRuleContext//addChild(Token)}, and
  20484. // {@link ParseTreeListener//visitTerminal} is called on any parse listeners.
  20485. // If the parser <em>is</em> in error recovery mode, the consumed symbol is
  20486. // added to the parse tree using
  20487. // {@link ParserRuleContext//addErrorNode(Token)}, and
  20488. // {@link ParseTreeListener//visitErrorNode} is called on any parse
  20489. // listeners.
  20490. //
  20491. Parser.prototype.consume = function () {
  20492. var o = this.getCurrentToken();
  20493. if (o.type !== Token.EOF) {
  20494. this.getInputStream().consume();
  20495. }
  20496. var hasListener = this._parseListeners !== null && this._parseListeners.length > 0;
  20497. if (this.buildParseTrees || hasListener) {
  20498. var node;
  20499. if (this._errHandler.inErrorRecoveryMode(this)) {
  20500. node = this._ctx.addErrorNode(o);
  20501. } else {
  20502. node = this._ctx.addTokenNode(o);
  20503. }
  20504. node.invokingState = this.state;
  20505. if (hasListener) {
  20506. this._parseListeners.map(function (listener) {
  20507. if (node instanceof ErrorNode || node.isErrorNode !== undefined && node.isErrorNode()) {
  20508. listener.visitErrorNode(node);
  20509. } else if (node instanceof TerminalNode) {
  20510. listener.visitTerminal(node);
  20511. }
  20512. });
  20513. }
  20514. }
  20515. return o;
  20516. };
  20517. Parser.prototype.addContextToParseTree = function () {
  20518. // add current context to parent if we have a parent
  20519. if (this._ctx.parentCtx !== null) {
  20520. this._ctx.parentCtx.addChild(this._ctx);
  20521. }
  20522. };
  20523. // Always called by generated parsers upon entry to a rule. Access field
  20524. // {@link //_ctx} get the current context.
  20525. Parser.prototype.enterRule = function (localctx, state, ruleIndex) {
  20526. this.state = state;
  20527. this._ctx = localctx;
  20528. this._ctx.start = this._input.LT(1);
  20529. if (this.buildParseTrees) {
  20530. this.addContextToParseTree();
  20531. }
  20532. if (this._parseListeners !== null) {
  20533. this.triggerEnterRuleEvent();
  20534. }
  20535. };
  20536. Parser.prototype.exitRule = function () {
  20537. this._ctx.stop = this._input.LT(-1);
  20538. // trigger event on _ctx, before it reverts to parent
  20539. if (this._parseListeners !== null) {
  20540. this.triggerExitRuleEvent();
  20541. }
  20542. this.state = this._ctx.invokingState;
  20543. this._ctx = this._ctx.parentCtx;
  20544. };
  20545. Parser.prototype.enterOuterAlt = function (localctx, altNum) {
  20546. localctx.setAltNumber(altNum);
  20547. // if we have new localctx, make sure we replace existing ctx
  20548. // that is previous child of parse tree
  20549. if (this.buildParseTrees && this._ctx !== localctx) {
  20550. if (this._ctx.parentCtx !== null) {
  20551. this._ctx.parentCtx.removeLastChild();
  20552. this._ctx.parentCtx.addChild(localctx);
  20553. }
  20554. }
  20555. this._ctx = localctx;
  20556. };
  20557. // Get the precedence level for the top-most precedence rule.
  20558. //
  20559. // @return The precedence level for the top-most precedence rule, or -1 if
  20560. // the parser context is not nested within a precedence rule.
  20561. Parser.prototype.getPrecedence = function () {
  20562. if (this._precedenceStack.length === 0) {
  20563. return -1;
  20564. } else {
  20565. return this._precedenceStack[this._precedenceStack.length - 1];
  20566. }
  20567. };
  20568. Parser.prototype.enterRecursionRule = function (localctx, state, ruleIndex, precedence) {
  20569. this.state = state;
  20570. this._precedenceStack.push(precedence);
  20571. this._ctx = localctx;
  20572. this._ctx.start = this._input.LT(1);
  20573. if (this._parseListeners !== null) {
  20574. this.triggerEnterRuleEvent(); // simulates rule entry for
  20575. // left-recursive rules
  20576. }
  20577. };
  20578. //
  20579. // Like {@link //enterRule} but for recursive rules.
  20580. Parser.prototype.pushNewRecursionContext = function (localctx, state, ruleIndex) {
  20581. var previous = this._ctx;
  20582. previous.parentCtx = localctx;
  20583. previous.invokingState = state;
  20584. previous.stop = this._input.LT(-1);
  20585. this._ctx = localctx;
  20586. this._ctx.start = previous.start;
  20587. if (this.buildParseTrees) {
  20588. this._ctx.addChild(previous);
  20589. }
  20590. if (this._parseListeners !== null) {
  20591. this.triggerEnterRuleEvent(); // simulates rule entry for
  20592. // left-recursive rules
  20593. }
  20594. };
  20595. Parser.prototype.unrollRecursionContexts = function (parentCtx) {
  20596. this._precedenceStack.pop();
  20597. this._ctx.stop = this._input.LT(-1);
  20598. var retCtx = this._ctx; // save current ctx (return value)
  20599. // unroll so _ctx is as it was before call to recursive method
  20600. if (this._parseListeners !== null) {
  20601. while (this._ctx !== parentCtx) {
  20602. this.triggerExitRuleEvent();
  20603. this._ctx = this._ctx.parentCtx;
  20604. }
  20605. } else {
  20606. this._ctx = parentCtx;
  20607. }
  20608. // hook into tree
  20609. retCtx.parentCtx = parentCtx;
  20610. if (this.buildParseTrees && parentCtx !== null) {
  20611. // add return ctx into invoking rule's tree
  20612. parentCtx.addChild(retCtx);
  20613. }
  20614. };
  20615. Parser.prototype.getInvokingContext = function (ruleIndex) {
  20616. var ctx = this._ctx;
  20617. while (ctx !== null) {
  20618. if (ctx.ruleIndex === ruleIndex) {
  20619. return ctx;
  20620. }
  20621. ctx = ctx.parentCtx;
  20622. }
  20623. return null;
  20624. };
  20625. Parser.prototype.precpred = function (localctx, precedence) {
  20626. return precedence >= this._precedenceStack[this._precedenceStack.length - 1];
  20627. };
  20628. Parser.prototype.inContext = function (context) {
  20629. // TODO: useful in parser?
  20630. return false;
  20631. };
  20632. //
  20633. // Checks whether or not {@code symbol} can follow the current state in the
  20634. // ATN. The behavior of this method is equivalent to the following, but is
  20635. // implemented such that the complete context-sensitive follow set does not
  20636. // need to be explicitly constructed.
  20637. //
  20638. // <pre>
  20639. // return getExpectedTokens().contains(symbol);
  20640. // </pre>
  20641. //
  20642. // @param symbol the symbol type to check
  20643. // @return {@code true} if {@code symbol} can follow the current state in
  20644. // the ATN, otherwise {@code false}.
  20645. Parser.prototype.isExpectedToken = function (symbol) {
  20646. var atn = this._interp.atn;
  20647. var ctx = this._ctx;
  20648. var s = atn.states[this.state];
  20649. var following = atn.nextTokens(s);
  20650. if (following.contains(symbol)) {
  20651. return true;
  20652. }
  20653. if (!following.contains(Token.EPSILON)) {
  20654. return false;
  20655. }
  20656. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  20657. var invokingState = atn.states[ctx.invokingState];
  20658. var rt = invokingState.transitions[0];
  20659. following = atn.nextTokens(rt.followState);
  20660. if (following.contains(symbol)) {
  20661. return true;
  20662. }
  20663. ctx = ctx.parentCtx;
  20664. }
  20665. if (following.contains(Token.EPSILON) && symbol === Token.EOF) {
  20666. return true;
  20667. } else {
  20668. return false;
  20669. }
  20670. };
  20671. // Computes the set of input symbols which could follow the current parser
  20672. // state and context, as given by {@link //getState} and {@link //getContext},
  20673. // respectively.
  20674. //
  20675. // @see ATN//getExpectedTokens(int, RuleContext)
  20676. //
  20677. Parser.prototype.getExpectedTokens = function () {
  20678. return this._interp.atn.getExpectedTokens(this.state, this._ctx);
  20679. };
  20680. Parser.prototype.getExpectedTokensWithinCurrentRule = function () {
  20681. var atn = this._interp.atn;
  20682. var s = atn.states[this.state];
  20683. return atn.nextTokens(s);
  20684. };
  20685. // Get a rule's index (i.e., {@code RULE_ruleName} field) or -1 if not found.//
  20686. Parser.prototype.getRuleIndex = function (ruleName) {
  20687. var ruleIndex = this.getRuleIndexMap()[ruleName];
  20688. if (ruleIndex !== null) {
  20689. return ruleIndex;
  20690. } else {
  20691. return -1;
  20692. }
  20693. };
  20694. // Return List&lt;String&gt; of the rule names in your parser instance
  20695. // leading up to a call to the current rule. You could override if
  20696. // you want more details such as the file/line info of where
  20697. // in the ATN a rule is invoked.
  20698. //
  20699. // this is very useful for error messages.
  20700. //
  20701. Parser.prototype.getRuleInvocationStack = function (p) {
  20702. p = p || null;
  20703. if (p === null) {
  20704. p = this._ctx;
  20705. }
  20706. var stack = [];
  20707. while (p !== null) {
  20708. // compute what follows who invoked us
  20709. var ruleIndex = p.ruleIndex;
  20710. if (ruleIndex < 0) {
  20711. stack.push("n/a");
  20712. } else {
  20713. stack.push(this.ruleNames[ruleIndex]);
  20714. }
  20715. p = p.parentCtx;
  20716. }
  20717. return stack;
  20718. };
  20719. // For debugging and other purposes.//
  20720. Parser.prototype.getDFAStrings = function () {
  20721. return this._interp.decisionToDFA.toString();
  20722. };
  20723. // For debugging and other purposes.//
  20724. Parser.prototype.dumpDFA = function () {
  20725. var seenOne = false;
  20726. for (var i = 0; i < this._interp.decisionToDFA.length; i++) {
  20727. var dfa = this._interp.decisionToDFA[i];
  20728. if (dfa.states.length > 0) {
  20729. if (seenOne) {
  20730. console.log();
  20731. }
  20732. this.printer.println("Decision " + dfa.decision + ":");
  20733. this.printer.print(dfa.toString(this.literalNames, this.symbolicNames));
  20734. seenOne = true;
  20735. }
  20736. }
  20737. };
  20738. /*
  20739. " printer = function() {\r\n" +
  20740. " this.println = function(s) { document.getElementById('output') += s + '\\n'; }\r\n" +
  20741. " this.print = function(s) { document.getElementById('output') += s; }\r\n" +
  20742. " };\r\n" +
  20743. */
  20744. Parser.prototype.getSourceName = function () {
  20745. return this._input.sourceName;
  20746. };
  20747. // During a parse is sometimes useful to listen in on the rule entry and exit
  20748. // events as well as token matches. this is for quick and dirty debugging.
  20749. //
  20750. Parser.prototype.setTrace = function (trace) {
  20751. if (!trace) {
  20752. this.removeParseListener(this._tracer);
  20753. this._tracer = null;
  20754. } else {
  20755. if (this._tracer !== null) {
  20756. this.removeParseListener(this._tracer);
  20757. }
  20758. this._tracer = new TraceListener(this);
  20759. this.addParseListener(this._tracer);
  20760. }
  20761. };
  20762. exports.Parser = Parser;
  20763. /***/ }),
  20764. /***/ "./node_modules/antlr4/ParserRuleContext.js":
  20765. /*!**************************************************!*\
  20766. !*** ./node_modules/antlr4/ParserRuleContext.js ***!
  20767. \**************************************************/
  20768. /*! no static exports found */
  20769. /***/ (function(module, exports, __webpack_require__) {
  20770. "use strict";
  20771. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  20772. * Use of this file is governed by the BSD 3-clause license that
  20773. * can be found in the LICENSE.txt file in the project root.
  20774. */
  20775. //* A rule invocation record for parsing.
  20776. //
  20777. // Contains all of the information about the current rule not stored in the
  20778. // RuleContext. It handles parse tree children list, Any ATN state
  20779. // tracing, and the default values available for rule indications:
  20780. // start, stop, rule index, current alt number, current
  20781. // ATN state.
  20782. //
  20783. // Subclasses made for each rule and grammar track the parameters,
  20784. // return values, locals, and labels specific to that rule. These
  20785. // are the objects that are returned from rules.
  20786. //
  20787. // Note text is not an actual field of a rule return value; it is computed
  20788. // from start and stop using the input stream's toString() method. I
  20789. // could add a ctor to this so that we can pass in and store the input
  20790. // stream, but I'm not sure we want to do that. It would seem to be undefined
  20791. // to get the .text property anyway if the rule matches tokens from multiple
  20792. // input streams.
  20793. //
  20794. // I do not use getters for fields of objects that are used simply to
  20795. // group values such as this aggregate. The getters/setters are there to
  20796. // satisfy the superclass interface.
  20797. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  20798. var Tree = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js");
  20799. var INVALID_INTERVAL = Tree.INVALID_INTERVAL;
  20800. var TerminalNode = Tree.TerminalNode;
  20801. var TerminalNodeImpl = Tree.TerminalNodeImpl;
  20802. var ErrorNodeImpl = Tree.ErrorNodeImpl;
  20803. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  20804. function ParserRuleContext(parent, invokingStateNumber) {
  20805. parent = parent || null;
  20806. invokingStateNumber = invokingStateNumber || null;
  20807. RuleContext.call(this, parent, invokingStateNumber);
  20808. this.ruleIndex = -1;
  20809. // * If we are debugging or building a parse tree for a visitor,
  20810. // we need to track all of the tokens and rule invocations associated
  20811. // with this rule's context. This is empty for parsing w/o tree constr.
  20812. // operation because we don't the need to track the details about
  20813. // how we parse this rule.
  20814. // /
  20815. this.children = null;
  20816. this.start = null;
  20817. this.stop = null;
  20818. // The exception that forced this rule to return. If the rule successfully
  20819. // completed, this is {@code null}.
  20820. this.exception = null;
  20821. }
  20822. ParserRuleContext.prototype = Object.create(RuleContext.prototype);
  20823. ParserRuleContext.prototype.constructor = ParserRuleContext;
  20824. // * COPY a ctx (I'm deliberately not using copy constructor)///
  20825. ParserRuleContext.prototype.copyFrom = function (ctx) {
  20826. // from RuleContext
  20827. this.parentCtx = ctx.parentCtx;
  20828. this.invokingState = ctx.invokingState;
  20829. this.children = null;
  20830. this.start = ctx.start;
  20831. this.stop = ctx.stop;
  20832. // copy any error nodes to alt label node
  20833. if (ctx.children) {
  20834. this.children = [];
  20835. // reset parent pointer for any error nodes
  20836. ctx.children.map(function (child) {
  20837. if (child instanceof ErrorNodeImpl) {
  20838. this.children.push(child);
  20839. child.parentCtx = this;
  20840. }
  20841. }, this);
  20842. }
  20843. };
  20844. // Double dispatch methods for listeners
  20845. ParserRuleContext.prototype.enterRule = function (listener) {};
  20846. ParserRuleContext.prototype.exitRule = function (listener) {};
  20847. // * Does not set parent link; other add methods do that///
  20848. ParserRuleContext.prototype.addChild = function (child) {
  20849. if (this.children === null) {
  20850. this.children = [];
  20851. }
  20852. this.children.push(child);
  20853. return child;
  20854. };
  20855. // * Used by enterOuterAlt to toss out a RuleContext previously added as
  20856. // we entered a rule. If we have // label, we will need to remove
  20857. // generic ruleContext object.
  20858. // /
  20859. ParserRuleContext.prototype.removeLastChild = function () {
  20860. if (this.children !== null) {
  20861. this.children.pop();
  20862. }
  20863. };
  20864. ParserRuleContext.prototype.addTokenNode = function (token) {
  20865. var node = new TerminalNodeImpl(token);
  20866. this.addChild(node);
  20867. node.parentCtx = this;
  20868. return node;
  20869. };
  20870. ParserRuleContext.prototype.addErrorNode = function (badToken) {
  20871. var node = new ErrorNodeImpl(badToken);
  20872. this.addChild(node);
  20873. node.parentCtx = this;
  20874. return node;
  20875. };
  20876. ParserRuleContext.prototype.getChild = function (i, type) {
  20877. type = type || null;
  20878. if (this.children === null || i < 0 || i >= this.children.length) {
  20879. return null;
  20880. }
  20881. if (type === null) {
  20882. return this.children[i];
  20883. } else {
  20884. for (var j = 0; j < this.children.length; j++) {
  20885. var child = this.children[j];
  20886. if (child instanceof type) {
  20887. if (i === 0) {
  20888. return child;
  20889. } else {
  20890. i -= 1;
  20891. }
  20892. }
  20893. }
  20894. return null;
  20895. }
  20896. };
  20897. ParserRuleContext.prototype.getToken = function (ttype, i) {
  20898. if (this.children === null || i < 0 || i >= this.children.length) {
  20899. return null;
  20900. }
  20901. for (var j = 0; j < this.children.length; j++) {
  20902. var child = this.children[j];
  20903. if (child instanceof TerminalNode) {
  20904. if (child.symbol.type === ttype) {
  20905. if (i === 0) {
  20906. return child;
  20907. } else {
  20908. i -= 1;
  20909. }
  20910. }
  20911. }
  20912. }
  20913. return null;
  20914. };
  20915. ParserRuleContext.prototype.getTokens = function (ttype) {
  20916. if (this.children === null) {
  20917. return [];
  20918. } else {
  20919. var tokens = [];
  20920. for (var j = 0; j < this.children.length; j++) {
  20921. var child = this.children[j];
  20922. if (child instanceof TerminalNode) {
  20923. if (child.symbol.type === ttype) {
  20924. tokens.push(child);
  20925. }
  20926. }
  20927. }
  20928. return tokens;
  20929. }
  20930. };
  20931. ParserRuleContext.prototype.getTypedRuleContext = function (ctxType, i) {
  20932. return this.getChild(i, ctxType);
  20933. };
  20934. ParserRuleContext.prototype.getTypedRuleContexts = function (ctxType) {
  20935. if (this.children === null) {
  20936. return [];
  20937. } else {
  20938. var contexts = [];
  20939. for (var j = 0; j < this.children.length; j++) {
  20940. var child = this.children[j];
  20941. if (child instanceof ctxType) {
  20942. contexts.push(child);
  20943. }
  20944. }
  20945. return contexts;
  20946. }
  20947. };
  20948. ParserRuleContext.prototype.getChildCount = function () {
  20949. if (this.children === null) {
  20950. return 0;
  20951. } else {
  20952. return this.children.length;
  20953. }
  20954. };
  20955. ParserRuleContext.prototype.getSourceInterval = function () {
  20956. if (this.start === null || this.stop === null) {
  20957. return INVALID_INTERVAL;
  20958. } else {
  20959. return new Interval(this.start.tokenIndex, this.stop.tokenIndex);
  20960. }
  20961. };
  20962. RuleContext.EMPTY = new ParserRuleContext();
  20963. function InterpreterRuleContext(parent, invokingStateNumber, ruleIndex) {
  20964. ParserRuleContext.call(parent, invokingStateNumber);
  20965. this.ruleIndex = ruleIndex;
  20966. return this;
  20967. }
  20968. InterpreterRuleContext.prototype = Object.create(ParserRuleContext.prototype);
  20969. InterpreterRuleContext.prototype.constructor = InterpreterRuleContext;
  20970. exports.ParserRuleContext = ParserRuleContext;
  20971. /***/ }),
  20972. /***/ "./node_modules/antlr4/PredictionContext.js":
  20973. /*!**************************************************!*\
  20974. !*** ./node_modules/antlr4/PredictionContext.js ***!
  20975. \**************************************************/
  20976. /*! no static exports found */
  20977. /***/ (function(module, exports, __webpack_require__) {
  20978. "use strict";
  20979. //
  20980. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  20981. * Use of this file is governed by the BSD 3-clause license that
  20982. * can be found in the LICENSE.txt file in the project root.
  20983. */
  20984. ///
  20985. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  20986. var Hash = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Hash;
  20987. function PredictionContext(cachedHashCode) {
  20988. this.cachedHashCode = cachedHashCode;
  20989. }
  20990. // Represents {@code $} in local context prediction, which means wildcard.
  20991. // {@code//+x =//}.
  20992. // /
  20993. PredictionContext.EMPTY = null;
  20994. // Represents {@code $} in an array in full context mode, when {@code $}
  20995. // doesn't mean wildcard: {@code $ + x = [$,x]}. Here,
  20996. // {@code $} = {@link //EMPTY_RETURN_STATE}.
  20997. // /
  20998. PredictionContext.EMPTY_RETURN_STATE = 0x7FFFFFFF;
  20999. PredictionContext.globalNodeCount = 1;
  21000. PredictionContext.id = PredictionContext.globalNodeCount;
  21001. // Stores the computed hash code of this {@link PredictionContext}. The hash
  21002. // code is computed in parts to match the following reference algorithm.
  21003. //
  21004. // <pre>
  21005. // private int referenceHashCode() {
  21006. // int hash = {@link MurmurHash//initialize MurmurHash.initialize}({@link
  21007. // //INITIAL_HASH});
  21008. //
  21009. // for (int i = 0; i &lt; {@link //size()}; i++) {
  21010. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link //getParent
  21011. // getParent}(i));
  21012. // }
  21013. //
  21014. // for (int i = 0; i &lt; {@link //size()}; i++) {
  21015. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link
  21016. // //getReturnState getReturnState}(i));
  21017. // }
  21018. //
  21019. // hash = {@link MurmurHash//finish MurmurHash.finish}(hash, 2// {@link
  21020. // //size()});
  21021. // return hash;
  21022. // }
  21023. // </pre>
  21024. // /
  21025. // This means only the {@link //EMPTY} context is in set.
  21026. PredictionContext.prototype.isEmpty = function () {
  21027. return this === PredictionContext.EMPTY;
  21028. };
  21029. PredictionContext.prototype.hasEmptyPath = function () {
  21030. return this.getReturnState(this.length - 1) === PredictionContext.EMPTY_RETURN_STATE;
  21031. };
  21032. PredictionContext.prototype.hashCode = function () {
  21033. return this.cachedHashCode;
  21034. };
  21035. PredictionContext.prototype.updateHashCode = function (hash) {
  21036. hash.update(this.cachedHashCode);
  21037. };
  21038. /*
  21039. function calculateHashString(parent, returnState) {
  21040. return "" + parent + returnState;
  21041. }
  21042. */
  21043. // Used to cache {@link PredictionContext} objects. Its used for the shared
  21044. // context cash associated with contexts in DFA states. This cache
  21045. // can be used for both lexers and parsers.
  21046. function PredictionContextCache() {
  21047. this.cache = {};
  21048. return this;
  21049. }
  21050. // Add a context to the cache and return it. If the context already exists,
  21051. // return that one instead and do not add a new context to the cache.
  21052. // Protect shared cache from unsafe thread access.
  21053. //
  21054. PredictionContextCache.prototype.add = function (ctx) {
  21055. if (ctx === PredictionContext.EMPTY) {
  21056. return PredictionContext.EMPTY;
  21057. }
  21058. var existing = this.cache[ctx] || null;
  21059. if (existing !== null) {
  21060. return existing;
  21061. }
  21062. this.cache[ctx] = ctx;
  21063. return ctx;
  21064. };
  21065. PredictionContextCache.prototype.get = function (ctx) {
  21066. return this.cache[ctx] || null;
  21067. };
  21068. Object.defineProperty(PredictionContextCache.prototype, "length", {
  21069. get: function get() {
  21070. return this.cache.length;
  21071. }
  21072. });
  21073. function SingletonPredictionContext(parent, returnState) {
  21074. var hashCode = 0;
  21075. if (parent !== null) {
  21076. var hash = new Hash();
  21077. hash.update(parent, returnState);
  21078. hashCode = hash.finish();
  21079. }
  21080. PredictionContext.call(this, hashCode);
  21081. this.parentCtx = parent;
  21082. this.returnState = returnState;
  21083. }
  21084. SingletonPredictionContext.prototype = Object.create(PredictionContext.prototype);
  21085. SingletonPredictionContext.prototype.contructor = SingletonPredictionContext;
  21086. SingletonPredictionContext.create = function (parent, returnState) {
  21087. if (returnState === PredictionContext.EMPTY_RETURN_STATE && parent === null) {
  21088. // someone can pass in the bits of an array ctx that mean $
  21089. return PredictionContext.EMPTY;
  21090. } else {
  21091. return new SingletonPredictionContext(parent, returnState);
  21092. }
  21093. };
  21094. Object.defineProperty(SingletonPredictionContext.prototype, "length", {
  21095. get: function get() {
  21096. return 1;
  21097. }
  21098. });
  21099. SingletonPredictionContext.prototype.getParent = function (index) {
  21100. return this.parentCtx;
  21101. };
  21102. SingletonPredictionContext.prototype.getReturnState = function (index) {
  21103. return this.returnState;
  21104. };
  21105. SingletonPredictionContext.prototype.equals = function (other) {
  21106. if (this === other) {
  21107. return true;
  21108. } else if (!(other instanceof SingletonPredictionContext)) {
  21109. return false;
  21110. } else if (this.hashCode() !== other.hashCode()) {
  21111. return false; // can't be same if hash is different
  21112. } else {
  21113. if (this.returnState !== other.returnState) return false;else if (this.parentCtx == null) return other.parentCtx == null;else return this.parentCtx.equals(other.parentCtx);
  21114. }
  21115. };
  21116. SingletonPredictionContext.prototype.toString = function () {
  21117. var up = this.parentCtx === null ? "" : this.parentCtx.toString();
  21118. if (up.length === 0) {
  21119. if (this.returnState === PredictionContext.EMPTY_RETURN_STATE) {
  21120. return "$";
  21121. } else {
  21122. return "" + this.returnState;
  21123. }
  21124. } else {
  21125. return "" + this.returnState + " " + up;
  21126. }
  21127. };
  21128. function EmptyPredictionContext() {
  21129. SingletonPredictionContext.call(this, null, PredictionContext.EMPTY_RETURN_STATE);
  21130. return this;
  21131. }
  21132. EmptyPredictionContext.prototype = Object.create(SingletonPredictionContext.prototype);
  21133. EmptyPredictionContext.prototype.constructor = EmptyPredictionContext;
  21134. EmptyPredictionContext.prototype.isEmpty = function () {
  21135. return true;
  21136. };
  21137. EmptyPredictionContext.prototype.getParent = function (index) {
  21138. return null;
  21139. };
  21140. EmptyPredictionContext.prototype.getReturnState = function (index) {
  21141. return this.returnState;
  21142. };
  21143. EmptyPredictionContext.prototype.equals = function (other) {
  21144. return this === other;
  21145. };
  21146. EmptyPredictionContext.prototype.toString = function () {
  21147. return "$";
  21148. };
  21149. PredictionContext.EMPTY = new EmptyPredictionContext();
  21150. function ArrayPredictionContext(parents, returnStates) {
  21151. // Parent can be null only if full ctx mode and we make an array
  21152. // from {@link //EMPTY} and non-empty. We merge {@link //EMPTY} by using
  21153. // null parent and
  21154. // returnState == {@link //EMPTY_RETURN_STATE}.
  21155. var h = new Hash();
  21156. h.update(parents, returnStates);
  21157. var hashCode = h.finish();
  21158. PredictionContext.call(this, hashCode);
  21159. this.parents = parents;
  21160. this.returnStates = returnStates;
  21161. return this;
  21162. }
  21163. ArrayPredictionContext.prototype = Object.create(PredictionContext.prototype);
  21164. ArrayPredictionContext.prototype.constructor = ArrayPredictionContext;
  21165. ArrayPredictionContext.prototype.isEmpty = function () {
  21166. // since EMPTY_RETURN_STATE can only appear in the last position, we
  21167. // don't need to verify that size==1
  21168. return this.returnStates[0] === PredictionContext.EMPTY_RETURN_STATE;
  21169. };
  21170. Object.defineProperty(ArrayPredictionContext.prototype, "length", {
  21171. get: function get() {
  21172. return this.returnStates.length;
  21173. }
  21174. });
  21175. ArrayPredictionContext.prototype.getParent = function (index) {
  21176. return this.parents[index];
  21177. };
  21178. ArrayPredictionContext.prototype.getReturnState = function (index) {
  21179. return this.returnStates[index];
  21180. };
  21181. ArrayPredictionContext.prototype.equals = function (other) {
  21182. if (this === other) {
  21183. return true;
  21184. } else if (!(other instanceof ArrayPredictionContext)) {
  21185. return false;
  21186. } else if (this.hashCode() !== other.hashCode()) {
  21187. return false; // can't be same if hash is different
  21188. } else {
  21189. return this.returnStates === other.returnStates && this.parents === other.parents;
  21190. }
  21191. };
  21192. ArrayPredictionContext.prototype.toString = function () {
  21193. if (this.isEmpty()) {
  21194. return "[]";
  21195. } else {
  21196. var s = "[";
  21197. for (var i = 0; i < this.returnStates.length; i++) {
  21198. if (i > 0) {
  21199. s = s + ", ";
  21200. }
  21201. if (this.returnStates[i] === PredictionContext.EMPTY_RETURN_STATE) {
  21202. s = s + "$";
  21203. continue;
  21204. }
  21205. s = s + this.returnStates[i];
  21206. if (this.parents[i] !== null) {
  21207. s = s + " " + this.parents[i];
  21208. } else {
  21209. s = s + "null";
  21210. }
  21211. }
  21212. return s + "]";
  21213. }
  21214. };
  21215. // Convert a {@link RuleContext} tree to a {@link PredictionContext} graph.
  21216. // Return {@link //EMPTY} if {@code outerContext} is empty or null.
  21217. // /
  21218. function predictionContextFromRuleContext(atn, outerContext) {
  21219. if (outerContext === undefined || outerContext === null) {
  21220. outerContext = RuleContext.EMPTY;
  21221. }
  21222. // if we are in RuleContext of start rule, s, then PredictionContext
  21223. // is EMPTY. Nobody called us. (if we are empty, return empty)
  21224. if (outerContext.parentCtx === null || outerContext === RuleContext.EMPTY) {
  21225. return PredictionContext.EMPTY;
  21226. }
  21227. // If we have a parent, convert it to a PredictionContext graph
  21228. var parent = predictionContextFromRuleContext(atn, outerContext.parentCtx);
  21229. var state = atn.states[outerContext.invokingState];
  21230. var transition = state.transitions[0];
  21231. return SingletonPredictionContext.create(parent, transition.followState.stateNumber);
  21232. }
  21233. /*
  21234. function calculateListsHashString(parents, returnStates) {
  21235. var s = "";
  21236. parents.map(function(p) {
  21237. s = s + p;
  21238. });
  21239. returnStates.map(function(r) {
  21240. s = s + r;
  21241. });
  21242. return s;
  21243. }
  21244. */
  21245. function merge(a, b, rootIsWildcard, mergeCache) {
  21246. // share same graph if both same
  21247. if (a === b) {
  21248. return a;
  21249. }
  21250. if (a instanceof SingletonPredictionContext && b instanceof SingletonPredictionContext) {
  21251. return mergeSingletons(a, b, rootIsWildcard, mergeCache);
  21252. }
  21253. // At least one of a or b is array
  21254. // If one is $ and rootIsWildcard, return $ as// wildcard
  21255. if (rootIsWildcard) {
  21256. if (a instanceof EmptyPredictionContext) {
  21257. return a;
  21258. }
  21259. if (b instanceof EmptyPredictionContext) {
  21260. return b;
  21261. }
  21262. }
  21263. // convert singleton so both are arrays to normalize
  21264. if (a instanceof SingletonPredictionContext) {
  21265. a = new ArrayPredictionContext([a.getParent()], [a.returnState]);
  21266. }
  21267. if (b instanceof SingletonPredictionContext) {
  21268. b = new ArrayPredictionContext([b.getParent()], [b.returnState]);
  21269. }
  21270. return mergeArrays(a, b, rootIsWildcard, mergeCache);
  21271. }
  21272. //
  21273. // Merge two {@link SingletonPredictionContext} instances.
  21274. //
  21275. // <p>Stack tops equal, parents merge is same; return left graph.<br>
  21276. // <embed src="images/SingletonMerge_SameRootSamePar.svg"
  21277. // type="image/svg+xml"/></p>
  21278. //
  21279. // <p>Same stack top, parents differ; merge parents giving array node, then
  21280. // remainders of those graphs. A new root node is created to point to the
  21281. // merged parents.<br>
  21282. // <embed src="images/SingletonMerge_SameRootDiffPar.svg"
  21283. // type="image/svg+xml"/></p>
  21284. //
  21285. // <p>Different stack tops pointing to same parent. Make array node for the
  21286. // root where both element in the root point to the same (original)
  21287. // parent.<br>
  21288. // <embed src="images/SingletonMerge_DiffRootSamePar.svg"
  21289. // type="image/svg+xml"/></p>
  21290. //
  21291. // <p>Different stack tops pointing to different parents. Make array node for
  21292. // the root where each element points to the corresponding original
  21293. // parent.<br>
  21294. // <embed src="images/SingletonMerge_DiffRootDiffPar.svg"
  21295. // type="image/svg+xml"/></p>
  21296. //
  21297. // @param a the first {@link SingletonPredictionContext}
  21298. // @param b the second {@link SingletonPredictionContext}
  21299. // @param rootIsWildcard {@code true} if this is a local-context merge,
  21300. // otherwise false to indicate a full-context merge
  21301. // @param mergeCache
  21302. // /
  21303. function mergeSingletons(a, b, rootIsWildcard, mergeCache) {
  21304. if (mergeCache !== null) {
  21305. var previous = mergeCache.get(a, b);
  21306. if (previous !== null) {
  21307. return previous;
  21308. }
  21309. previous = mergeCache.get(b, a);
  21310. if (previous !== null) {
  21311. return previous;
  21312. }
  21313. }
  21314. var rootMerge = mergeRoot(a, b, rootIsWildcard);
  21315. if (rootMerge !== null) {
  21316. if (mergeCache !== null) {
  21317. mergeCache.set(a, b, rootMerge);
  21318. }
  21319. return rootMerge;
  21320. }
  21321. if (a.returnState === b.returnState) {
  21322. var parent = merge(a.parentCtx, b.parentCtx, rootIsWildcard, mergeCache);
  21323. // if parent is same as existing a or b parent or reduced to a parent,
  21324. // return it
  21325. if (parent === a.parentCtx) {
  21326. return a; // ax + bx = ax, if a=b
  21327. }
  21328. if (parent === b.parentCtx) {
  21329. return b; // ax + bx = bx, if a=b
  21330. }
  21331. // else: ax + ay = a'[x,y]
  21332. // merge parents x and y, giving array node with x,y then remainders
  21333. // of those graphs. dup a, a' points at merged array
  21334. // new joined parent so create new singleton pointing to it, a'
  21335. var spc = SingletonPredictionContext.create(parent, a.returnState);
  21336. if (mergeCache !== null) {
  21337. mergeCache.set(a, b, spc);
  21338. }
  21339. return spc;
  21340. } else {
  21341. // a != b payloads differ
  21342. // see if we can collapse parents due to $+x parents if local ctx
  21343. var singleParent = null;
  21344. if (a === b || a.parentCtx !== null && a.parentCtx === b.parentCtx) {
  21345. // ax +
  21346. // bx =
  21347. // [a,b]x
  21348. singleParent = a.parentCtx;
  21349. }
  21350. if (singleParent !== null) {
  21351. // parents are same
  21352. // sort payloads and use same parent
  21353. var payloads = [a.returnState, b.returnState];
  21354. if (a.returnState > b.returnState) {
  21355. payloads[0] = b.returnState;
  21356. payloads[1] = a.returnState;
  21357. }
  21358. var parents = [singleParent, singleParent];
  21359. var apc = new ArrayPredictionContext(parents, payloads);
  21360. if (mergeCache !== null) {
  21361. mergeCache.set(a, b, apc);
  21362. }
  21363. return apc;
  21364. }
  21365. // parents differ and can't merge them. Just pack together
  21366. // into array; can't merge.
  21367. // ax + by = [ax,by]
  21368. var payloads = [a.returnState, b.returnState];
  21369. var parents = [a.parentCtx, b.parentCtx];
  21370. if (a.returnState > b.returnState) {
  21371. // sort by payload
  21372. payloads[0] = b.returnState;
  21373. payloads[1] = a.returnState;
  21374. parents = [b.parentCtx, a.parentCtx];
  21375. }
  21376. var a_ = new ArrayPredictionContext(parents, payloads);
  21377. if (mergeCache !== null) {
  21378. mergeCache.set(a, b, a_);
  21379. }
  21380. return a_;
  21381. }
  21382. }
  21383. //
  21384. // Handle case where at least one of {@code a} or {@code b} is
  21385. // {@link //EMPTY}. In the following diagrams, the symbol {@code $} is used
  21386. // to represent {@link //EMPTY}.
  21387. //
  21388. // <h2>Local-Context Merges</h2>
  21389. //
  21390. // <p>These local-context merge operations are used when {@code rootIsWildcard}
  21391. // is true.</p>
  21392. //
  21393. // <p>{@link //EMPTY} is superset of any graph; return {@link //EMPTY}.<br>
  21394. // <embed src="images/LocalMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  21395. //
  21396. // <p>{@link //EMPTY} and anything is {@code //EMPTY}, so merged parent is
  21397. // {@code //EMPTY}; return left graph.<br>
  21398. // <embed src="images/LocalMerge_EmptyParent.svg" type="image/svg+xml"/></p>
  21399. //
  21400. // <p>Special case of last merge if local context.<br>
  21401. // <embed src="images/LocalMerge_DiffRoots.svg" type="image/svg+xml"/></p>
  21402. //
  21403. // <h2>Full-Context Merges</h2>
  21404. //
  21405. // <p>These full-context merge operations are used when {@code rootIsWildcard}
  21406. // is false.</p>
  21407. //
  21408. // <p><embed src="images/FullMerge_EmptyRoots.svg" type="image/svg+xml"/></p>
  21409. //
  21410. // <p>Must keep all contexts; {@link //EMPTY} in array is a special value (and
  21411. // null parent).<br>
  21412. // <embed src="images/FullMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  21413. //
  21414. // <p><embed src="images/FullMerge_SameRoot.svg" type="image/svg+xml"/></p>
  21415. //
  21416. // @param a the first {@link SingletonPredictionContext}
  21417. // @param b the second {@link SingletonPredictionContext}
  21418. // @param rootIsWildcard {@code true} if this is a local-context merge,
  21419. // otherwise false to indicate a full-context merge
  21420. // /
  21421. function mergeRoot(a, b, rootIsWildcard) {
  21422. if (rootIsWildcard) {
  21423. if (a === PredictionContext.EMPTY) {
  21424. return PredictionContext.EMPTY; // // + b =//
  21425. }
  21426. if (b === PredictionContext.EMPTY) {
  21427. return PredictionContext.EMPTY; // a +// =//
  21428. }
  21429. } else {
  21430. if (a === PredictionContext.EMPTY && b === PredictionContext.EMPTY) {
  21431. return PredictionContext.EMPTY; // $ + $ = $
  21432. } else if (a === PredictionContext.EMPTY) {
  21433. // $ + x = [$,x]
  21434. var payloads = [b.returnState, PredictionContext.EMPTY_RETURN_STATE];
  21435. var parents = [b.parentCtx, null];
  21436. return new ArrayPredictionContext(parents, payloads);
  21437. } else if (b === PredictionContext.EMPTY) {
  21438. // x + $ = [$,x] ($ is always first if present)
  21439. var payloads = [a.returnState, PredictionContext.EMPTY_RETURN_STATE];
  21440. var parents = [a.parentCtx, null];
  21441. return new ArrayPredictionContext(parents, payloads);
  21442. }
  21443. }
  21444. return null;
  21445. }
  21446. //
  21447. // Merge two {@link ArrayPredictionContext} instances.
  21448. //
  21449. // <p>Different tops, different parents.<br>
  21450. // <embed src="images/ArrayMerge_DiffTopDiffPar.svg" type="image/svg+xml"/></p>
  21451. //
  21452. // <p>Shared top, same parents.<br>
  21453. // <embed src="images/ArrayMerge_ShareTopSamePar.svg" type="image/svg+xml"/></p>
  21454. //
  21455. // <p>Shared top, different parents.<br>
  21456. // <embed src="images/ArrayMerge_ShareTopDiffPar.svg" type="image/svg+xml"/></p>
  21457. //
  21458. // <p>Shared top, all shared parents.<br>
  21459. // <embed src="images/ArrayMerge_ShareTopSharePar.svg"
  21460. // type="image/svg+xml"/></p>
  21461. //
  21462. // <p>Equal tops, merge parents and reduce top to
  21463. // {@link SingletonPredictionContext}.<br>
  21464. // <embed src="images/ArrayMerge_EqualTop.svg" type="image/svg+xml"/></p>
  21465. // /
  21466. function mergeArrays(a, b, rootIsWildcard, mergeCache) {
  21467. if (mergeCache !== null) {
  21468. var previous = mergeCache.get(a, b);
  21469. if (previous !== null) {
  21470. return previous;
  21471. }
  21472. previous = mergeCache.get(b, a);
  21473. if (previous !== null) {
  21474. return previous;
  21475. }
  21476. }
  21477. // merge sorted payloads a + b => M
  21478. var i = 0; // walks a
  21479. var j = 0; // walks b
  21480. var k = 0; // walks target M array
  21481. var mergedReturnStates = [];
  21482. var mergedParents = [];
  21483. // walk and merge to yield mergedParents, mergedReturnStates
  21484. while (i < a.returnStates.length && j < b.returnStates.length) {
  21485. var a_parent = a.parents[i];
  21486. var b_parent = b.parents[j];
  21487. if (a.returnStates[i] === b.returnStates[j]) {
  21488. // same payload (stack tops are equal), must yield merged singleton
  21489. var payload = a.returnStates[i];
  21490. // $+$ = $
  21491. var bothDollars = payload === PredictionContext.EMPTY_RETURN_STATE && a_parent === null && b_parent === null;
  21492. var ax_ax = a_parent !== null && b_parent !== null && a_parent === b_parent; // ax+ax
  21493. // ->
  21494. // ax
  21495. if (bothDollars || ax_ax) {
  21496. mergedParents[k] = a_parent; // choose left
  21497. mergedReturnStates[k] = payload;
  21498. } else {
  21499. // ax+ay -> a'[x,y]
  21500. var mergedParent = merge(a_parent, b_parent, rootIsWildcard, mergeCache);
  21501. mergedParents[k] = mergedParent;
  21502. mergedReturnStates[k] = payload;
  21503. }
  21504. i += 1; // hop over left one as usual
  21505. j += 1; // but also skip one in right side since we merge
  21506. } else if (a.returnStates[i] < b.returnStates[j]) {
  21507. // copy a[i] to M
  21508. mergedParents[k] = a_parent;
  21509. mergedReturnStates[k] = a.returnStates[i];
  21510. i += 1;
  21511. } else {
  21512. // b > a, copy b[j] to M
  21513. mergedParents[k] = b_parent;
  21514. mergedReturnStates[k] = b.returnStates[j];
  21515. j += 1;
  21516. }
  21517. k += 1;
  21518. }
  21519. // copy over any payloads remaining in either array
  21520. if (i < a.returnStates.length) {
  21521. for (var p = i; p < a.returnStates.length; p++) {
  21522. mergedParents[k] = a.parents[p];
  21523. mergedReturnStates[k] = a.returnStates[p];
  21524. k += 1;
  21525. }
  21526. } else {
  21527. for (var p = j; p < b.returnStates.length; p++) {
  21528. mergedParents[k] = b.parents[p];
  21529. mergedReturnStates[k] = b.returnStates[p];
  21530. k += 1;
  21531. }
  21532. }
  21533. // trim merged if we combined a few that had same stack tops
  21534. if (k < mergedParents.length) {
  21535. // write index < last position; trim
  21536. if (k === 1) {
  21537. // for just one merged element, return singleton top
  21538. var a_ = SingletonPredictionContext.create(mergedParents[0], mergedReturnStates[0]);
  21539. if (mergeCache !== null) {
  21540. mergeCache.set(a, b, a_);
  21541. }
  21542. return a_;
  21543. }
  21544. mergedParents = mergedParents.slice(0, k);
  21545. mergedReturnStates = mergedReturnStates.slice(0, k);
  21546. }
  21547. var M = new ArrayPredictionContext(mergedParents, mergedReturnStates);
  21548. // if we created same array as a or b, return that instead
  21549. // TODO: track whether this is possible above during merge sort for speed
  21550. if (M === a) {
  21551. if (mergeCache !== null) {
  21552. mergeCache.set(a, b, a);
  21553. }
  21554. return a;
  21555. }
  21556. if (M === b) {
  21557. if (mergeCache !== null) {
  21558. mergeCache.set(a, b, b);
  21559. }
  21560. return b;
  21561. }
  21562. combineCommonParents(mergedParents);
  21563. if (mergeCache !== null) {
  21564. mergeCache.set(a, b, M);
  21565. }
  21566. return M;
  21567. }
  21568. //
  21569. // Make pass over all <em>M</em> {@code parents}; merge any {@code equals()}
  21570. // ones.
  21571. // /
  21572. function combineCommonParents(parents) {
  21573. var uniqueParents = {};
  21574. for (var p = 0; p < parents.length; p++) {
  21575. var parent = parents[p];
  21576. if (!(parent in uniqueParents)) {
  21577. uniqueParents[parent] = parent;
  21578. }
  21579. }
  21580. for (var q = 0; q < parents.length; q++) {
  21581. parents[q] = uniqueParents[parents[q]];
  21582. }
  21583. }
  21584. function getCachedPredictionContext(context, contextCache, visited) {
  21585. if (context.isEmpty()) {
  21586. return context;
  21587. }
  21588. var existing = visited[context] || null;
  21589. if (existing !== null) {
  21590. return existing;
  21591. }
  21592. existing = contextCache.get(context);
  21593. if (existing !== null) {
  21594. visited[context] = existing;
  21595. return existing;
  21596. }
  21597. var changed = false;
  21598. var parents = [];
  21599. for (var i = 0; i < parents.length; i++) {
  21600. var parent = getCachedPredictionContext(context.getParent(i), contextCache, visited);
  21601. if (changed || parent !== context.getParent(i)) {
  21602. if (!changed) {
  21603. parents = [];
  21604. for (var j = 0; j < context.length; j++) {
  21605. parents[j] = context.getParent(j);
  21606. }
  21607. changed = true;
  21608. }
  21609. parents[i] = parent;
  21610. }
  21611. }
  21612. if (!changed) {
  21613. contextCache.add(context);
  21614. visited[context] = context;
  21615. return context;
  21616. }
  21617. var updated = null;
  21618. if (parents.length === 0) {
  21619. updated = PredictionContext.EMPTY;
  21620. } else if (parents.length === 1) {
  21621. updated = SingletonPredictionContext.create(parents[0], context.getReturnState(0));
  21622. } else {
  21623. updated = new ArrayPredictionContext(parents, context.returnStates);
  21624. }
  21625. contextCache.add(updated);
  21626. visited[updated] = updated;
  21627. visited[context] = updated;
  21628. return updated;
  21629. }
  21630. // ter's recursive version of Sam's getAllNodes()
  21631. function getAllContextNodes(context, nodes, visited) {
  21632. if (nodes === null) {
  21633. nodes = [];
  21634. return getAllContextNodes(context, nodes, visited);
  21635. } else if (visited === null) {
  21636. visited = {};
  21637. return getAllContextNodes(context, nodes, visited);
  21638. } else {
  21639. if (context === null || visited[context] !== null) {
  21640. return nodes;
  21641. }
  21642. visited[context] = context;
  21643. nodes.push(context);
  21644. for (var i = 0; i < context.length; i++) {
  21645. getAllContextNodes(context.getParent(i), nodes, visited);
  21646. }
  21647. return nodes;
  21648. }
  21649. }
  21650. exports.merge = merge;
  21651. exports.PredictionContext = PredictionContext;
  21652. exports.PredictionContextCache = PredictionContextCache;
  21653. exports.SingletonPredictionContext = SingletonPredictionContext;
  21654. exports.predictionContextFromRuleContext = predictionContextFromRuleContext;
  21655. exports.getCachedPredictionContext = getCachedPredictionContext;
  21656. /***/ }),
  21657. /***/ "./node_modules/antlr4/Recognizer.js":
  21658. /*!*******************************************!*\
  21659. !*** ./node_modules/antlr4/Recognizer.js ***!
  21660. \*******************************************/
  21661. /*! no static exports found */
  21662. /***/ (function(module, exports, __webpack_require__) {
  21663. "use strict";
  21664. //
  21665. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21666. * Use of this file is governed by the BSD 3-clause license that
  21667. * can be found in the LICENSE.txt file in the project root.
  21668. */
  21669. //
  21670. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  21671. var ConsoleErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ConsoleErrorListener;
  21672. var ProxyErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ProxyErrorListener;
  21673. function Recognizer() {
  21674. this._listeners = [ConsoleErrorListener.INSTANCE];
  21675. this._interp = null;
  21676. this._stateNumber = -1;
  21677. return this;
  21678. }
  21679. Recognizer.tokenTypeMapCache = {};
  21680. Recognizer.ruleIndexMapCache = {};
  21681. Recognizer.prototype.checkVersion = function (toolVersion) {
  21682. var runtimeVersion = "4.7.1";
  21683. if (runtimeVersion !== toolVersion) {
  21684. console.log("ANTLR runtime and generated code versions disagree: " + runtimeVersion + "!=" + toolVersion);
  21685. }
  21686. };
  21687. Recognizer.prototype.addErrorListener = function (listener) {
  21688. this._listeners.push(listener);
  21689. };
  21690. Recognizer.prototype.removeErrorListeners = function () {
  21691. this._listeners = [];
  21692. };
  21693. Recognizer.prototype.getTokenTypeMap = function () {
  21694. var tokenNames = this.getTokenNames();
  21695. if (tokenNames === null) {
  21696. throw "The current recognizer does not provide a list of token names.";
  21697. }
  21698. var result = this.tokenTypeMapCache[tokenNames];
  21699. if (result === undefined) {
  21700. result = tokenNames.reduce(function (o, k, i) {
  21701. o[k] = i;
  21702. });
  21703. result.EOF = Token.EOF;
  21704. this.tokenTypeMapCache[tokenNames] = result;
  21705. }
  21706. return result;
  21707. };
  21708. // Get a map from rule names to rule indexes.
  21709. //
  21710. // <p>Used for XPath and tree pattern compilation.</p>
  21711. //
  21712. Recognizer.prototype.getRuleIndexMap = function () {
  21713. var ruleNames = this.ruleNames;
  21714. if (ruleNames === null) {
  21715. throw "The current recognizer does not provide a list of rule names.";
  21716. }
  21717. var result = this.ruleIndexMapCache[ruleNames];
  21718. if (result === undefined) {
  21719. result = ruleNames.reduce(function (o, k, i) {
  21720. o[k] = i;
  21721. });
  21722. this.ruleIndexMapCache[ruleNames] = result;
  21723. }
  21724. return result;
  21725. };
  21726. Recognizer.prototype.getTokenType = function (tokenName) {
  21727. var ttype = this.getTokenTypeMap()[tokenName];
  21728. if (ttype !== undefined) {
  21729. return ttype;
  21730. } else {
  21731. return Token.INVALID_TYPE;
  21732. }
  21733. };
  21734. // What is the error header, normally line/character position information?//
  21735. Recognizer.prototype.getErrorHeader = function (e) {
  21736. var line = e.getOffendingToken().line;
  21737. var column = e.getOffendingToken().column;
  21738. return "line " + line + ":" + column;
  21739. };
  21740. // How should a token be displayed in an error message? The default
  21741. // is to display just the text, but during development you might
  21742. // want to have a lot of information spit out. Override in that case
  21743. // to use t.toString() (which, for CommonToken, dumps everything about
  21744. // the token). This is better than forcing you to override a method in
  21745. // your token objects because you don't have to go modify your lexer
  21746. // so that it creates a new Java type.
  21747. //
  21748. // @deprecated This method is not called by the ANTLR 4 Runtime. Specific
  21749. // implementations of {@link ANTLRErrorStrategy} may provide a similar
  21750. // feature when necessary. For example, see
  21751. // {@link DefaultErrorStrategy//getTokenErrorDisplay}.
  21752. //
  21753. Recognizer.prototype.getTokenErrorDisplay = function (t) {
  21754. if (t === null) {
  21755. return "<no token>";
  21756. }
  21757. var s = t.text;
  21758. if (s === null) {
  21759. if (t.type === Token.EOF) {
  21760. s = "<EOF>";
  21761. } else {
  21762. s = "<" + t.type + ">";
  21763. }
  21764. }
  21765. s = s.replace("\n", "\\n").replace("\r", "\\r").replace("\t", "\\t");
  21766. return "'" + s + "'";
  21767. };
  21768. Recognizer.prototype.getErrorListenerDispatch = function () {
  21769. return new ProxyErrorListener(this._listeners);
  21770. };
  21771. // subclass needs to override these if there are sempreds or actions
  21772. // that the ATN interp needs to execute
  21773. Recognizer.prototype.sempred = function (localctx, ruleIndex, actionIndex) {
  21774. return true;
  21775. };
  21776. Recognizer.prototype.precpred = function (localctx, precedence) {
  21777. return true;
  21778. };
  21779. //Indicate that the recognizer has changed internal state that is
  21780. //consistent with the ATN state passed in. This way we always know
  21781. //where we are in the ATN as the parser goes along. The rule
  21782. //context objects form a stack that lets us see the stack of
  21783. //invoking rules. Combine this and we have complete ATN
  21784. //configuration information.
  21785. Object.defineProperty(Recognizer.prototype, "state", {
  21786. get: function get() {
  21787. return this._stateNumber;
  21788. },
  21789. set: function set(state) {
  21790. this._stateNumber = state;
  21791. }
  21792. });
  21793. exports.Recognizer = Recognizer;
  21794. /***/ }),
  21795. /***/ "./node_modules/antlr4/RuleContext.js":
  21796. /*!********************************************!*\
  21797. !*** ./node_modules/antlr4/RuleContext.js ***!
  21798. \********************************************/
  21799. /*! no static exports found */
  21800. /***/ (function(module, exports, __webpack_require__) {
  21801. "use strict";
  21802. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21803. * Use of this file is governed by the BSD 3-clause license that
  21804. * can be found in the LICENSE.txt file in the project root.
  21805. */
  21806. ///
  21807. // A rule context is a record of a single rule invocation. It knows
  21808. // which context invoked it, if any. If there is no parent context, then
  21809. // naturally the invoking state is not valid. The parent link
  21810. // provides a chain upwards from the current rule invocation to the root
  21811. // of the invocation tree, forming a stack. We actually carry no
  21812. // information about the rule associated with this context (except
  21813. // when parsing). We keep only the state number of the invoking state from
  21814. // the ATN submachine that invoked this. Contrast this with the s
  21815. // pointer inside ParserRuleContext that tracks the current state
  21816. // being "executed" for the current rule.
  21817. //
  21818. // The parent contexts are useful for computing lookahead sets and
  21819. // getting error information.
  21820. //
  21821. // These objects are used during parsing and prediction.
  21822. // For the special case of parsers, we use the subclass
  21823. // ParserRuleContext.
  21824. //
  21825. // @see ParserRuleContext
  21826. ///
  21827. var RuleNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  21828. var INVALID_INTERVAL = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").INVALID_INTERVAL;
  21829. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  21830. function RuleContext(parent, invokingState) {
  21831. RuleNode.call(this);
  21832. // What context invoked this rule?
  21833. this.parentCtx = parent || null;
  21834. // What state invoked the rule associated with this context?
  21835. // The "return address" is the followState of invokingState
  21836. // If parent is null, this should be -1.
  21837. this.invokingState = invokingState || -1;
  21838. return this;
  21839. }
  21840. RuleContext.prototype = Object.create(RuleNode.prototype);
  21841. RuleContext.prototype.constructor = RuleContext;
  21842. RuleContext.prototype.depth = function () {
  21843. var n = 0;
  21844. var p = this;
  21845. while (p !== null) {
  21846. p = p.parentCtx;
  21847. n += 1;
  21848. }
  21849. return n;
  21850. };
  21851. // A context is empty if there is no invoking state; meaning nobody call
  21852. // current context.
  21853. RuleContext.prototype.isEmpty = function () {
  21854. return this.invokingState === -1;
  21855. };
  21856. // satisfy the ParseTree / SyntaxTree interface
  21857. RuleContext.prototype.getSourceInterval = function () {
  21858. return INVALID_INTERVAL;
  21859. };
  21860. RuleContext.prototype.getRuleContext = function () {
  21861. return this;
  21862. };
  21863. RuleContext.prototype.getPayload = function () {
  21864. return this;
  21865. };
  21866. // Return the combined text of all child nodes. This method only considers
  21867. // tokens which have been added to the parse tree.
  21868. // <p>
  21869. // Since tokens on hidden channels (e.g. whitespace or comments) are not
  21870. // added to the parse trees, they will not appear in the output of this
  21871. // method.
  21872. // /
  21873. RuleContext.prototype.getText = function () {
  21874. if (this.getChildCount() === 0) {
  21875. return "";
  21876. } else {
  21877. return this.children.map(function (child) {
  21878. return child.getText();
  21879. }).join("");
  21880. }
  21881. };
  21882. // For rule associated with this parse tree internal node, return
  21883. // the outer alternative number used to match the input. Default
  21884. // implementation does not compute nor store this alt num. Create
  21885. // a subclass of ParserRuleContext with backing field and set
  21886. // option contextSuperClass.
  21887. // to set it.
  21888. RuleContext.prototype.getAltNumber = function () {
  21889. return INVALID_ALT_NUMBER;
  21890. };
  21891. // Set the outer alternative number for this context node. Default
  21892. // implementation does nothing to avoid backing field overhead for
  21893. // trees that don't need it. Create
  21894. // a subclass of ParserRuleContext with backing field and set
  21895. // option contextSuperClass.
  21896. RuleContext.prototype.setAltNumber = function (altNumber) {};
  21897. RuleContext.prototype.getChild = function (i) {
  21898. return null;
  21899. };
  21900. RuleContext.prototype.getChildCount = function () {
  21901. return 0;
  21902. };
  21903. RuleContext.prototype.accept = function (visitor) {
  21904. return visitor.visitChildren(this);
  21905. };
  21906. //need to manage circular dependencies, so export now
  21907. exports.RuleContext = RuleContext;
  21908. var Trees = __webpack_require__(/*! ./tree/Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  21909. // Print out a whole tree, not just a node, in LISP format
  21910. // (root child1 .. childN). Print just a node if this is a leaf.
  21911. //
  21912. RuleContext.prototype.toStringTree = function (ruleNames, recog) {
  21913. return Trees.toStringTree(this, ruleNames, recog);
  21914. };
  21915. RuleContext.prototype.toString = function (ruleNames, stop) {
  21916. ruleNames = ruleNames || null;
  21917. stop = stop || null;
  21918. var p = this;
  21919. var s = "[";
  21920. while (p !== null && p !== stop) {
  21921. if (ruleNames === null) {
  21922. if (!p.isEmpty()) {
  21923. s += p.invokingState;
  21924. }
  21925. } else {
  21926. var ri = p.ruleIndex;
  21927. var ruleName = ri >= 0 && ri < ruleNames.length ? ruleNames[ri] : "" + ri;
  21928. s += ruleName;
  21929. }
  21930. if (p.parentCtx !== null && (ruleNames !== null || !p.parentCtx.isEmpty())) {
  21931. s += " ";
  21932. }
  21933. p = p.parentCtx;
  21934. }
  21935. s += "]";
  21936. return s;
  21937. };
  21938. /***/ }),
  21939. /***/ "./node_modules/antlr4/Token.js":
  21940. /*!**************************************!*\
  21941. !*** ./node_modules/antlr4/Token.js ***!
  21942. \**************************************/
  21943. /*! no static exports found */
  21944. /***/ (function(module, exports, __webpack_require__) {
  21945. "use strict";
  21946. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21947. * Use of this file is governed by the BSD 3-clause license that
  21948. * can be found in the LICENSE.txt file in the project root.
  21949. */
  21950. //
  21951. // A token has properties: text, type, line, character position in the line
  21952. // (so we can ignore tabs), token channel, index, and source from which
  21953. // we obtained this token.
  21954. function Token() {
  21955. this.source = null;
  21956. this.type = null; // token type of the token
  21957. this.channel = null; // The parser ignores everything not on DEFAULT_CHANNEL
  21958. this.start = null; // optional; return -1 if not implemented.
  21959. this.stop = null; // optional; return -1 if not implemented.
  21960. this.tokenIndex = null; // from 0..n-1 of the token object in the input stream
  21961. this.line = null; // line=1..n of the 1st character
  21962. this.column = null; // beginning of the line at which it occurs, 0..n-1
  21963. this._text = null; // text of the token.
  21964. return this;
  21965. }
  21966. Token.INVALID_TYPE = 0;
  21967. // During lookahead operations, this "token" signifies we hit rule end ATN state
  21968. // and did not follow it despite needing to.
  21969. Token.EPSILON = -2;
  21970. Token.MIN_USER_TOKEN_TYPE = 1;
  21971. Token.EOF = -1;
  21972. // All tokens go to the parser (unless skip() is called in that rule)
  21973. // on a particular "channel". The parser tunes to a particular channel
  21974. // so that whitespace etc... can go to the parser on a "hidden" channel.
  21975. Token.DEFAULT_CHANNEL = 0;
  21976. // Anything on different channel than DEFAULT_CHANNEL is not parsed
  21977. // by parser.
  21978. Token.HIDDEN_CHANNEL = 1;
  21979. // Explicitly set the text for this token. If {code text} is not
  21980. // {@code null}, then {@link //getText} will return this value rather than
  21981. // extracting the text from the input.
  21982. //
  21983. // @param text The explicit text of the token, or {@code null} if the text
  21984. // should be obtained from the input along with the start and stop indexes
  21985. // of the token.
  21986. Object.defineProperty(Token.prototype, "text", {
  21987. get: function get() {
  21988. return this._text;
  21989. },
  21990. set: function set(text) {
  21991. this._text = text;
  21992. }
  21993. });
  21994. Token.prototype.getTokenSource = function () {
  21995. return this.source[0];
  21996. };
  21997. Token.prototype.getInputStream = function () {
  21998. return this.source[1];
  21999. };
  22000. function CommonToken(source, type, channel, start, stop) {
  22001. Token.call(this);
  22002. this.source = source !== undefined ? source : CommonToken.EMPTY_SOURCE;
  22003. this.type = type !== undefined ? type : null;
  22004. this.channel = channel !== undefined ? channel : Token.DEFAULT_CHANNEL;
  22005. this.start = start !== undefined ? start : -1;
  22006. this.stop = stop !== undefined ? stop : -1;
  22007. this.tokenIndex = -1;
  22008. if (this.source[0] !== null) {
  22009. this.line = source[0].line;
  22010. this.column = source[0].column;
  22011. } else {
  22012. this.column = -1;
  22013. }
  22014. return this;
  22015. }
  22016. CommonToken.prototype = Object.create(Token.prototype);
  22017. CommonToken.prototype.constructor = CommonToken;
  22018. // An empty {@link Pair} which is used as the default value of
  22019. // {@link //source} for tokens that do not have a source.
  22020. CommonToken.EMPTY_SOURCE = [null, null];
  22021. // Constructs a new {@link CommonToken} as a copy of another {@link Token}.
  22022. //
  22023. // <p>
  22024. // If {@code oldToken} is also a {@link CommonToken} instance, the newly
  22025. // constructed token will share a reference to the {@link //text} field and
  22026. // the {@link Pair} stored in {@link //source}. Otherwise, {@link //text} will
  22027. // be assigned the result of calling {@link //getText}, and {@link //source}
  22028. // will be constructed from the result of {@link Token//getTokenSource} and
  22029. // {@link Token//getInputStream}.</p>
  22030. //
  22031. // @param oldToken The token to copy.
  22032. //
  22033. CommonToken.prototype.clone = function () {
  22034. var t = new CommonToken(this.source, this.type, this.channel, this.start, this.stop);
  22035. t.tokenIndex = this.tokenIndex;
  22036. t.line = this.line;
  22037. t.column = this.column;
  22038. t.text = this.text;
  22039. return t;
  22040. };
  22041. Object.defineProperty(CommonToken.prototype, "text", {
  22042. get: function get() {
  22043. if (this._text !== null) {
  22044. return this._text;
  22045. }
  22046. var input = this.getInputStream();
  22047. if (input === null) {
  22048. return null;
  22049. }
  22050. var n = input.size;
  22051. if (this.start < n && this.stop < n) {
  22052. return input.getText(this.start, this.stop);
  22053. } else {
  22054. return "<EOF>";
  22055. }
  22056. },
  22057. set: function set(text) {
  22058. this._text = text;
  22059. }
  22060. });
  22061. CommonToken.prototype.toString = function () {
  22062. var txt = this.text;
  22063. if (txt !== null) {
  22064. txt = txt.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
  22065. } else {
  22066. txt = "<no text>";
  22067. }
  22068. return "[@" + this.tokenIndex + "," + this.start + ":" + this.stop + "='" + txt + "',<" + this.type + ">" + (this.channel > 0 ? ",channel=" + this.channel : "") + "," + this.line + ":" + this.column + "]";
  22069. };
  22070. exports.Token = Token;
  22071. exports.CommonToken = CommonToken;
  22072. /***/ }),
  22073. /***/ "./node_modules/antlr4/Utils.js":
  22074. /*!**************************************!*\
  22075. !*** ./node_modules/antlr4/Utils.js ***!
  22076. \**************************************/
  22077. /*! no static exports found */
  22078. /***/ (function(module, exports, __webpack_require__) {
  22079. "use strict";
  22080. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  22081. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22082. * Use of this file is governed by the BSD 3-clause license that
  22083. * can be found in the LICENSE.txt file in the project root.
  22084. */
  22085. function arrayToString(a) {
  22086. return "[" + a.join(", ") + "]";
  22087. }
  22088. String.prototype.seed = String.prototype.seed || Math.round(Math.random() * Math.pow(2, 32));
  22089. String.prototype.hashCode = function () {
  22090. var remainder,
  22091. bytes,
  22092. h1,
  22093. h1b,
  22094. c1,
  22095. c1b,
  22096. c2,
  22097. c2b,
  22098. k1,
  22099. i,
  22100. key = this.toString();
  22101. remainder = key.length & 3; // key.length % 4
  22102. bytes = key.length - remainder;
  22103. h1 = String.prototype.seed;
  22104. c1 = 0xcc9e2d51;
  22105. c2 = 0x1b873593;
  22106. i = 0;
  22107. while (i < bytes) {
  22108. k1 = key.charCodeAt(i) & 0xff | (key.charCodeAt(++i) & 0xff) << 8 | (key.charCodeAt(++i) & 0xff) << 16 | (key.charCodeAt(++i) & 0xff) << 24;
  22109. ++i;
  22110. k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff;
  22111. k1 = k1 << 15 | k1 >>> 17;
  22112. k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff;
  22113. h1 ^= k1;
  22114. h1 = h1 << 13 | h1 >>> 19;
  22115. h1b = (h1 & 0xffff) * 5 + (((h1 >>> 16) * 5 & 0xffff) << 16) & 0xffffffff;
  22116. h1 = (h1b & 0xffff) + 0x6b64 + (((h1b >>> 16) + 0xe654 & 0xffff) << 16);
  22117. }
  22118. k1 = 0;
  22119. switch (remainder) {
  22120. case 3:
  22121. k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;
  22122. case 2:
  22123. k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;
  22124. case 1:
  22125. k1 ^= key.charCodeAt(i) & 0xff;
  22126. k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff;
  22127. k1 = k1 << 15 | k1 >>> 17;
  22128. k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff;
  22129. h1 ^= k1;
  22130. }
  22131. h1 ^= key.length;
  22132. h1 ^= h1 >>> 16;
  22133. h1 = (h1 & 0xffff) * 0x85ebca6b + (((h1 >>> 16) * 0x85ebca6b & 0xffff) << 16) & 0xffffffff;
  22134. h1 ^= h1 >>> 13;
  22135. h1 = (h1 & 0xffff) * 0xc2b2ae35 + (((h1 >>> 16) * 0xc2b2ae35 & 0xffff) << 16) & 0xffffffff;
  22136. h1 ^= h1 >>> 16;
  22137. return h1 >>> 0;
  22138. };
  22139. function standardEqualsFunction(a, b) {
  22140. return a.equals(b);
  22141. }
  22142. function standardHashCodeFunction(a) {
  22143. return a.hashCode();
  22144. }
  22145. function Set(hashFunction, equalsFunction) {
  22146. this.data = {};
  22147. this.hashFunction = hashFunction || standardHashCodeFunction;
  22148. this.equalsFunction = equalsFunction || standardEqualsFunction;
  22149. return this;
  22150. }
  22151. Object.defineProperty(Set.prototype, "length", {
  22152. get: function get() {
  22153. var l = 0;
  22154. for (var key in this.data) {
  22155. if (key.indexOf("hash_") === 0) {
  22156. l = l + this.data[key].length;
  22157. }
  22158. }
  22159. return l;
  22160. }
  22161. });
  22162. Set.prototype.add = function (value) {
  22163. var hash = this.hashFunction(value);
  22164. var key = "hash_" + hash;
  22165. if (key in this.data) {
  22166. var values = this.data[key];
  22167. for (var i = 0; i < values.length; i++) {
  22168. if (this.equalsFunction(value, values[i])) {
  22169. return values[i];
  22170. }
  22171. }
  22172. values.push(value);
  22173. return value;
  22174. } else {
  22175. this.data[key] = [value];
  22176. return value;
  22177. }
  22178. };
  22179. Set.prototype.contains = function (value) {
  22180. return this.get(value) != null;
  22181. };
  22182. Set.prototype.get = function (value) {
  22183. var hash = this.hashFunction(value);
  22184. var key = "hash_" + hash;
  22185. if (key in this.data) {
  22186. var values = this.data[key];
  22187. for (var i = 0; i < values.length; i++) {
  22188. if (this.equalsFunction(value, values[i])) {
  22189. return values[i];
  22190. }
  22191. }
  22192. }
  22193. return null;
  22194. };
  22195. Set.prototype.values = function () {
  22196. var l = [];
  22197. for (var key in this.data) {
  22198. if (key.indexOf("hash_") === 0) {
  22199. l = l.concat(this.data[key]);
  22200. }
  22201. }
  22202. return l;
  22203. };
  22204. Set.prototype.toString = function () {
  22205. return arrayToString(this.values());
  22206. };
  22207. function BitSet() {
  22208. this.data = [];
  22209. return this;
  22210. }
  22211. BitSet.prototype.add = function (value) {
  22212. this.data[value] = true;
  22213. };
  22214. BitSet.prototype.or = function (set) {
  22215. var bits = this;
  22216. Object.keys(set.data).map(function (alt) {
  22217. bits.add(alt);
  22218. });
  22219. };
  22220. BitSet.prototype.remove = function (value) {
  22221. delete this.data[value];
  22222. };
  22223. BitSet.prototype.contains = function (value) {
  22224. return this.data[value] === true;
  22225. };
  22226. BitSet.prototype.values = function () {
  22227. return Object.keys(this.data);
  22228. };
  22229. BitSet.prototype.minValue = function () {
  22230. return Math.min.apply(null, this.values());
  22231. };
  22232. BitSet.prototype.hashCode = function () {
  22233. var hash = new Hash();
  22234. hash.update(this.values());
  22235. return hash.finish();
  22236. };
  22237. BitSet.prototype.equals = function (other) {
  22238. if (!(other instanceof BitSet)) {
  22239. return false;
  22240. }
  22241. return this.hashCode() === other.hashCode();
  22242. };
  22243. Object.defineProperty(BitSet.prototype, "length", {
  22244. get: function get() {
  22245. return this.values().length;
  22246. }
  22247. });
  22248. BitSet.prototype.toString = function () {
  22249. return "{" + this.values().join(", ") + "}";
  22250. };
  22251. function Map(hashFunction, equalsFunction) {
  22252. this.data = {};
  22253. this.hashFunction = hashFunction || standardHashCodeFunction;
  22254. this.equalsFunction = equalsFunction || standardEqualsFunction;
  22255. return this;
  22256. }
  22257. Object.defineProperty(Map.prototype, "length", {
  22258. get: function get() {
  22259. var l = 0;
  22260. for (var hashKey in this.data) {
  22261. if (hashKey.indexOf("hash_") === 0) {
  22262. l = l + this.data[hashKey].length;
  22263. }
  22264. }
  22265. return l;
  22266. }
  22267. });
  22268. Map.prototype.put = function (key, value) {
  22269. var hashKey = "hash_" + this.hashFunction(key);
  22270. if (hashKey in this.data) {
  22271. var entries = this.data[hashKey];
  22272. for (var i = 0; i < entries.length; i++) {
  22273. var entry = entries[i];
  22274. if (this.equalsFunction(key, entry.key)) {
  22275. var oldValue = entry.value;
  22276. entry.value = value;
  22277. return oldValue;
  22278. }
  22279. }
  22280. entries.push({ key: key, value: value });
  22281. return value;
  22282. } else {
  22283. this.data[hashKey] = [{ key: key, value: value }];
  22284. return value;
  22285. }
  22286. };
  22287. Map.prototype.containsKey = function (key) {
  22288. var hashKey = "hash_" + this.hashFunction(key);
  22289. if (hashKey in this.data) {
  22290. var entries = this.data[hashKey];
  22291. for (var i = 0; i < entries.length; i++) {
  22292. var entry = entries[i];
  22293. if (this.equalsFunction(key, entry.key)) return true;
  22294. }
  22295. }
  22296. return false;
  22297. };
  22298. Map.prototype.get = function (key) {
  22299. var hashKey = "hash_" + this.hashFunction(key);
  22300. if (hashKey in this.data) {
  22301. var entries = this.data[hashKey];
  22302. for (var i = 0; i < entries.length; i++) {
  22303. var entry = entries[i];
  22304. if (this.equalsFunction(key, entry.key)) return entry.value;
  22305. }
  22306. }
  22307. return null;
  22308. };
  22309. Map.prototype.entries = function () {
  22310. var l = [];
  22311. for (var key in this.data) {
  22312. if (key.indexOf("hash_") === 0) {
  22313. l = l.concat(this.data[key]);
  22314. }
  22315. }
  22316. return l;
  22317. };
  22318. Map.prototype.getKeys = function () {
  22319. return this.entries().map(function (e) {
  22320. return e.key;
  22321. });
  22322. };
  22323. Map.prototype.getValues = function () {
  22324. return this.entries().map(function (e) {
  22325. return e.value;
  22326. });
  22327. };
  22328. Map.prototype.toString = function () {
  22329. var ss = this.entries().map(function (entry) {
  22330. return '{' + entry.key + ':' + entry.value + '}';
  22331. });
  22332. return '[' + ss.join(", ") + ']';
  22333. };
  22334. function AltDict() {
  22335. this.data = {};
  22336. return this;
  22337. }
  22338. AltDict.prototype.get = function (key) {
  22339. key = "k-" + key;
  22340. if (key in this.data) {
  22341. return this.data[key];
  22342. } else {
  22343. return null;
  22344. }
  22345. };
  22346. AltDict.prototype.put = function (key, value) {
  22347. key = "k-" + key;
  22348. this.data[key] = value;
  22349. };
  22350. AltDict.prototype.values = function () {
  22351. var data = this.data;
  22352. var keys = Object.keys(this.data);
  22353. return keys.map(function (key) {
  22354. return data[key];
  22355. });
  22356. };
  22357. function DoubleDict() {
  22358. return this;
  22359. }
  22360. function Hash() {
  22361. this.count = 0;
  22362. this.hash = 0;
  22363. return this;
  22364. }
  22365. Hash.prototype.update = function () {
  22366. for (var i = 0; i < arguments.length; i++) {
  22367. var value = arguments[i];
  22368. if (value == null) continue;
  22369. if (Array.isArray(value)) this.update.apply(value);else {
  22370. var k = 0;
  22371. switch (typeof value === "undefined" ? "undefined" : _typeof(value)) {
  22372. case 'undefined':
  22373. case 'function':
  22374. continue;
  22375. case 'number':
  22376. case 'boolean':
  22377. k = value;
  22378. break;
  22379. case 'string':
  22380. k = value.hashCode();
  22381. break;
  22382. default:
  22383. value.updateHashCode(this);
  22384. continue;
  22385. }
  22386. k = k * 0xCC9E2D51;
  22387. k = k << 15 | k >>> 32 - 15;
  22388. k = k * 0x1B873593;
  22389. this.count = this.count + 1;
  22390. var hash = this.hash ^ k;
  22391. hash = hash << 13 | hash >>> 32 - 13;
  22392. hash = hash * 5 + 0xE6546B64;
  22393. this.hash = hash;
  22394. }
  22395. }
  22396. };
  22397. Hash.prototype.finish = function () {
  22398. var hash = this.hash ^ this.count * 4;
  22399. hash = hash ^ hash >>> 16;
  22400. hash = hash * 0x85EBCA6B;
  22401. hash = hash ^ hash >>> 13;
  22402. hash = hash * 0xC2B2AE35;
  22403. hash = hash ^ hash >>> 16;
  22404. return hash;
  22405. };
  22406. function hashStuff() {
  22407. var hash = new Hash();
  22408. hash.update.apply(arguments);
  22409. return hash.finish();
  22410. }
  22411. DoubleDict.prototype.get = function (a, b) {
  22412. var d = this[a] || null;
  22413. return d === null ? null : d[b] || null;
  22414. };
  22415. DoubleDict.prototype.set = function (a, b, o) {
  22416. var d = this[a] || null;
  22417. if (d === null) {
  22418. d = {};
  22419. this[a] = d;
  22420. }
  22421. d[b] = o;
  22422. };
  22423. function escapeWhitespace(s, escapeSpaces) {
  22424. s = s.replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r");
  22425. if (escapeSpaces) {
  22426. s = s.replace(/ /g, "\xB7");
  22427. }
  22428. return s;
  22429. }
  22430. function titleCase(str) {
  22431. return str.replace(/\w\S*/g, function (txt) {
  22432. return txt.charAt(0).toUpperCase() + txt.substr(1);
  22433. });
  22434. };
  22435. function equalArrays(a, b) {
  22436. if (!Array.isArray(a) || !Array.isArray(b)) return false;
  22437. if (a == b) return true;
  22438. if (a.length != b.length) return false;
  22439. for (var i = 0; i < a.length; i++) {
  22440. if (a[i] == b[i]) continue;
  22441. if (!a[i].equals(b[i])) return false;
  22442. }
  22443. return true;
  22444. };
  22445. exports.Hash = Hash;
  22446. exports.Set = Set;
  22447. exports.Map = Map;
  22448. exports.BitSet = BitSet;
  22449. exports.AltDict = AltDict;
  22450. exports.DoubleDict = DoubleDict;
  22451. exports.hashStuff = hashStuff;
  22452. exports.escapeWhitespace = escapeWhitespace;
  22453. exports.arrayToString = arrayToString;
  22454. exports.titleCase = titleCase;
  22455. exports.equalArrays = equalArrays;
  22456. /***/ }),
  22457. /***/ "./node_modules/antlr4/atn/ATN.js":
  22458. /*!****************************************!*\
  22459. !*** ./node_modules/antlr4/atn/ATN.js ***!
  22460. \****************************************/
  22461. /*! no static exports found */
  22462. /***/ (function(module, exports, __webpack_require__) {
  22463. "use strict";
  22464. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22465. * Use of this file is governed by the BSD 3-clause license that
  22466. * can be found in the LICENSE.txt file in the project root.
  22467. */
  22468. var LL1Analyzer = __webpack_require__(/*! ./../LL1Analyzer */ "./node_modules/antlr4/LL1Analyzer.js").LL1Analyzer;
  22469. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  22470. function ATN(grammarType, maxTokenType) {
  22471. // Used for runtime deserialization of ATNs from strings///
  22472. // The type of the ATN.
  22473. this.grammarType = grammarType;
  22474. // The maximum value for any symbol recognized by a transition in the ATN.
  22475. this.maxTokenType = maxTokenType;
  22476. this.states = [];
  22477. // Each subrule/rule is a decision point and we must track them so we
  22478. // can go back later and build DFA predictors for them. This includes
  22479. // all the rules, subrules, optional blocks, ()+, ()* etc...
  22480. this.decisionToState = [];
  22481. // Maps from rule index to starting state number.
  22482. this.ruleToStartState = [];
  22483. // Maps from rule index to stop state number.
  22484. this.ruleToStopState = null;
  22485. this.modeNameToStartState = {};
  22486. // For lexer ATNs, this maps the rule index to the resulting token type.
  22487. // For parser ATNs, this maps the rule index to the generated bypass token
  22488. // type if the
  22489. // {@link ATNDeserializationOptions//isGenerateRuleBypassTransitions}
  22490. // deserialization option was specified; otherwise, this is {@code null}.
  22491. this.ruleToTokenType = null;
  22492. // For lexer ATNs, this is an array of {@link LexerAction} objects which may
  22493. // be referenced by action transitions in the ATN.
  22494. this.lexerActions = null;
  22495. this.modeToStartState = [];
  22496. return this;
  22497. }
  22498. // Compute the set of valid tokens that can occur starting in state {@code s}.
  22499. // If {@code ctx} is null, the set of tokens will not include what can follow
  22500. // the rule surrounding {@code s}. In other words, the set will be
  22501. // restricted to tokens reachable staying within {@code s}'s rule.
  22502. ATN.prototype.nextTokensInContext = function (s, ctx) {
  22503. var anal = new LL1Analyzer(this);
  22504. return anal.LOOK(s, null, ctx);
  22505. };
  22506. // Compute the set of valid tokens that can occur starting in {@code s} and
  22507. // staying in same rule. {@link Token//EPSILON} is in set if we reach end of
  22508. // rule.
  22509. ATN.prototype.nextTokensNoContext = function (s) {
  22510. if (s.nextTokenWithinRule !== null) {
  22511. return s.nextTokenWithinRule;
  22512. }
  22513. s.nextTokenWithinRule = this.nextTokensInContext(s, null);
  22514. s.nextTokenWithinRule.readOnly = true;
  22515. return s.nextTokenWithinRule;
  22516. };
  22517. ATN.prototype.nextTokens = function (s, ctx) {
  22518. if (ctx === undefined) {
  22519. return this.nextTokensNoContext(s);
  22520. } else {
  22521. return this.nextTokensInContext(s, ctx);
  22522. }
  22523. };
  22524. ATN.prototype.addState = function (state) {
  22525. if (state !== null) {
  22526. state.atn = this;
  22527. state.stateNumber = this.states.length;
  22528. }
  22529. this.states.push(state);
  22530. };
  22531. ATN.prototype.removeState = function (state) {
  22532. this.states[state.stateNumber] = null; // just free mem, don't shift states in list
  22533. };
  22534. ATN.prototype.defineDecisionState = function (s) {
  22535. this.decisionToState.push(s);
  22536. s.decision = this.decisionToState.length - 1;
  22537. return s.decision;
  22538. };
  22539. ATN.prototype.getDecisionState = function (decision) {
  22540. if (this.decisionToState.length === 0) {
  22541. return null;
  22542. } else {
  22543. return this.decisionToState[decision];
  22544. }
  22545. };
  22546. // Computes the set of input symbols which could follow ATN state number
  22547. // {@code stateNumber} in the specified full {@code context}. This method
  22548. // considers the complete parser context, but does not evaluate semantic
  22549. // predicates (i.e. all predicates encountered during the calculation are
  22550. // assumed true). If a path in the ATN exists from the starting state to the
  22551. // {@link RuleStopState} of the outermost context without matching any
  22552. // symbols, {@link Token//EOF} is added to the returned set.
  22553. //
  22554. // <p>If {@code context} is {@code null}, it is treated as
  22555. // {@link ParserRuleContext//EMPTY}.</p>
  22556. //
  22557. // @param stateNumber the ATN state number
  22558. // @param context the full parse context
  22559. // @return The set of potentially valid input symbols which could follow the
  22560. // specified state in the specified context.
  22561. // @throws IllegalArgumentException if the ATN does not contain a state with
  22562. // number {@code stateNumber}
  22563. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  22564. ATN.prototype.getExpectedTokens = function (stateNumber, ctx) {
  22565. if (stateNumber < 0 || stateNumber >= this.states.length) {
  22566. throw "Invalid state number.";
  22567. }
  22568. var s = this.states[stateNumber];
  22569. var following = this.nextTokens(s);
  22570. if (!following.contains(Token.EPSILON)) {
  22571. return following;
  22572. }
  22573. var expected = new IntervalSet();
  22574. expected.addSet(following);
  22575. expected.removeOne(Token.EPSILON);
  22576. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  22577. var invokingState = this.states[ctx.invokingState];
  22578. var rt = invokingState.transitions[0];
  22579. following = this.nextTokens(rt.followState);
  22580. expected.addSet(following);
  22581. expected.removeOne(Token.EPSILON);
  22582. ctx = ctx.parentCtx;
  22583. }
  22584. if (following.contains(Token.EPSILON)) {
  22585. expected.addOne(Token.EOF);
  22586. }
  22587. return expected;
  22588. };
  22589. ATN.INVALID_ALT_NUMBER = 0;
  22590. exports.ATN = ATN;
  22591. /***/ }),
  22592. /***/ "./node_modules/antlr4/atn/ATNConfig.js":
  22593. /*!**********************************************!*\
  22594. !*** ./node_modules/antlr4/atn/ATNConfig.js ***!
  22595. \**********************************************/
  22596. /*! no static exports found */
  22597. /***/ (function(module, exports, __webpack_require__) {
  22598. "use strict";
  22599. //
  22600. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22601. * Use of this file is governed by the BSD 3-clause license that
  22602. * can be found in the LICENSE.txt file in the project root.
  22603. */
  22604. ///
  22605. // A tuple: (ATN state, predicted alt, syntactic, semantic context).
  22606. // The syntactic context is a graph-structured stack node whose
  22607. // path(s) to the root is the rule invocation(s)
  22608. // chain used to arrive at the state. The semantic context is
  22609. // the tree of semantic predicates encountered before reaching
  22610. // an ATN state.
  22611. ///
  22612. var DecisionState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").DecisionState;
  22613. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  22614. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  22615. function checkParams(params, isCfg) {
  22616. if (params === null) {
  22617. var result = { state: null, alt: null, context: null, semanticContext: null };
  22618. if (isCfg) {
  22619. result.reachesIntoOuterContext = 0;
  22620. }
  22621. return result;
  22622. } else {
  22623. var props = {};
  22624. props.state = params.state || null;
  22625. props.alt = params.alt === undefined ? null : params.alt;
  22626. props.context = params.context || null;
  22627. props.semanticContext = params.semanticContext || null;
  22628. if (isCfg) {
  22629. props.reachesIntoOuterContext = params.reachesIntoOuterContext || 0;
  22630. props.precedenceFilterSuppressed = params.precedenceFilterSuppressed || false;
  22631. }
  22632. return props;
  22633. }
  22634. }
  22635. function ATNConfig(params, config) {
  22636. this.checkContext(params, config);
  22637. params = checkParams(params);
  22638. config = checkParams(config, true);
  22639. // The ATN state associated with this configuration///
  22640. this.state = params.state !== null ? params.state : config.state;
  22641. // What alt (or lexer rule) is predicted by this configuration///
  22642. this.alt = params.alt !== null ? params.alt : config.alt;
  22643. // The stack of invoking states leading to the rule/states associated
  22644. // with this config. We track only those contexts pushed during
  22645. // execution of the ATN simulator.
  22646. this.context = params.context !== null ? params.context : config.context;
  22647. this.semanticContext = params.semanticContext !== null ? params.semanticContext : config.semanticContext !== null ? config.semanticContext : SemanticContext.NONE;
  22648. // We cannot execute predicates dependent upon local context unless
  22649. // we know for sure we are in the correct context. Because there is
  22650. // no way to do this efficiently, we simply cannot evaluate
  22651. // dependent predicates unless we are in the rule that initially
  22652. // invokes the ATN simulator.
  22653. //
  22654. // closure() tracks the depth of how far we dip into the
  22655. // outer context: depth &gt; 0. Note that it may not be totally
  22656. // accurate depth since I don't ever decrement. TODO: make it a boolean then
  22657. this.reachesIntoOuterContext = config.reachesIntoOuterContext;
  22658. this.precedenceFilterSuppressed = config.precedenceFilterSuppressed;
  22659. return this;
  22660. }
  22661. ATNConfig.prototype.checkContext = function (params, config) {
  22662. if ((params.context === null || params.context === undefined) && (config === null || config.context === null || config.context === undefined)) {
  22663. this.context = null;
  22664. }
  22665. };
  22666. ATNConfig.prototype.hashCode = function () {
  22667. var hash = new Hash();
  22668. this.updateHashCode(hash);
  22669. return hash.finish();
  22670. };
  22671. ATNConfig.prototype.updateHashCode = function (hash) {
  22672. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext);
  22673. };
  22674. // An ATN configuration is equal to another if both have
  22675. // the same state, they predict the same alternative, and
  22676. // syntactic/semantic contexts are the same.
  22677. ATNConfig.prototype.equals = function (other) {
  22678. if (this === other) {
  22679. return true;
  22680. } else if (!(other instanceof ATNConfig)) {
  22681. return false;
  22682. } else {
  22683. return this.state.stateNumber === other.state.stateNumber && this.alt === other.alt && (this.context === null ? other.context === null : this.context.equals(other.context)) && this.semanticContext.equals(other.semanticContext) && this.precedenceFilterSuppressed === other.precedenceFilterSuppressed;
  22684. }
  22685. };
  22686. ATNConfig.prototype.hashCodeForConfigSet = function () {
  22687. var hash = new Hash();
  22688. hash.update(this.state.stateNumber, this.alt, this.semanticContext);
  22689. return hash.finish();
  22690. };
  22691. ATNConfig.prototype.equalsForConfigSet = function (other) {
  22692. if (this === other) {
  22693. return true;
  22694. } else if (!(other instanceof ATNConfig)) {
  22695. return false;
  22696. } else {
  22697. return this.state.stateNumber === other.state.stateNumber && this.alt === other.alt && this.semanticContext.equals(other.semanticContext);
  22698. }
  22699. };
  22700. ATNConfig.prototype.toString = function () {
  22701. return "(" + this.state + "," + this.alt + (this.context !== null ? ",[" + this.context.toString() + "]" : "") + (this.semanticContext !== SemanticContext.NONE ? "," + this.semanticContext.toString() : "") + (this.reachesIntoOuterContext > 0 ? ",up=" + this.reachesIntoOuterContext : "") + ")";
  22702. };
  22703. function LexerATNConfig(params, config) {
  22704. ATNConfig.call(this, params, config);
  22705. // This is the backing field for {@link //getLexerActionExecutor}.
  22706. var lexerActionExecutor = params.lexerActionExecutor || null;
  22707. this.lexerActionExecutor = lexerActionExecutor || (config !== null ? config.lexerActionExecutor : null);
  22708. this.passedThroughNonGreedyDecision = config !== null ? this.checkNonGreedyDecision(config, this.state) : false;
  22709. return this;
  22710. }
  22711. LexerATNConfig.prototype = Object.create(ATNConfig.prototype);
  22712. LexerATNConfig.prototype.constructor = LexerATNConfig;
  22713. LexerATNConfig.prototype.updateHashCode = function (hash) {
  22714. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext, this.passedThroughNonGreedyDecision, this.lexerActionExecutor);
  22715. };
  22716. LexerATNConfig.prototype.equals = function (other) {
  22717. return this === other || other instanceof LexerATNConfig && this.passedThroughNonGreedyDecision == other.passedThroughNonGreedyDecision && (this.lexerActionExecutor ? this.lexerActionExecutor.equals(other.lexerActionExecutor) : !other.lexerActionExecutor) && ATNConfig.prototype.equals.call(this, other);
  22718. };
  22719. LexerATNConfig.prototype.hashCodeForConfigSet = LexerATNConfig.prototype.hashCode;
  22720. LexerATNConfig.prototype.equalsForConfigSet = LexerATNConfig.prototype.equals;
  22721. LexerATNConfig.prototype.checkNonGreedyDecision = function (source, target) {
  22722. return source.passedThroughNonGreedyDecision || target instanceof DecisionState && target.nonGreedy;
  22723. };
  22724. exports.ATNConfig = ATNConfig;
  22725. exports.LexerATNConfig = LexerATNConfig;
  22726. /***/ }),
  22727. /***/ "./node_modules/antlr4/atn/ATNConfigSet.js":
  22728. /*!*************************************************!*\
  22729. !*** ./node_modules/antlr4/atn/ATNConfigSet.js ***!
  22730. \*************************************************/
  22731. /*! no static exports found */
  22732. /***/ (function(module, exports, __webpack_require__) {
  22733. "use strict";
  22734. //
  22735. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22736. * Use of this file is governed by the BSD 3-clause license that
  22737. * can be found in the LICENSE.txt file in the project root.
  22738. */
  22739. //
  22740. // Specialized {@link Set}{@code <}{@link ATNConfig}{@code >} that can track
  22741. // info about the set, with support for combining similar configurations using a
  22742. // graph-structured stack.
  22743. ///
  22744. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  22745. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  22746. var Hash = Utils.Hash;
  22747. var Set = Utils.Set;
  22748. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  22749. var merge = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").merge;
  22750. function hashATNConfig(c) {
  22751. return c.hashCodeForConfigSet();
  22752. }
  22753. function equalATNConfigs(a, b) {
  22754. if (a === b) {
  22755. return true;
  22756. } else if (a === null || b === null) {
  22757. return false;
  22758. } else return a.equalsForConfigSet(b);
  22759. }
  22760. function ATNConfigSet(fullCtx) {
  22761. //
  22762. // The reason that we need this is because we don't want the hash map to use
  22763. // the standard hash code and equals. We need all configurations with the
  22764. // same
  22765. // {@code (s,i,_,semctx)} to be equal. Unfortunately, this key effectively
  22766. // doubles
  22767. // the number of objects associated with ATNConfigs. The other solution is
  22768. // to
  22769. // use a hash table that lets us specify the equals/hashcode operation.
  22770. // All configs but hashed by (s, i, _, pi) not including context. Wiped out
  22771. // when we go readonly as this set becomes a DFA state.
  22772. this.configLookup = new Set(hashATNConfig, equalATNConfigs);
  22773. // Indicates that this configuration set is part of a full context
  22774. // LL prediction. It will be used to determine how to merge $. With SLL
  22775. // it's a wildcard whereas it is not for LL context merge.
  22776. this.fullCtx = fullCtx === undefined ? true : fullCtx;
  22777. // Indicates that the set of configurations is read-only. Do not
  22778. // allow any code to manipulate the set; DFA states will point at
  22779. // the sets and they must not change. This does not protect the other
  22780. // fields; in particular, conflictingAlts is set after
  22781. // we've made this readonly.
  22782. this.readOnly = false;
  22783. // Track the elements as they are added to the set; supports get(i)///
  22784. this.configs = [];
  22785. // TODO: these fields make me pretty uncomfortable but nice to pack up info
  22786. // together, saves recomputation
  22787. // TODO: can we track conflicts as they are added to save scanning configs
  22788. // later?
  22789. this.uniqueAlt = 0;
  22790. this.conflictingAlts = null;
  22791. // Used in parser and lexer. In lexer, it indicates we hit a pred
  22792. // while computing a closure operation. Don't make a DFA state from this.
  22793. this.hasSemanticContext = false;
  22794. this.dipsIntoOuterContext = false;
  22795. this.cachedHashCode = -1;
  22796. return this;
  22797. }
  22798. // Adding a new config means merging contexts with existing configs for
  22799. // {@code (s, i, pi, _)}, where {@code s} is the
  22800. // {@link ATNConfig//state}, {@code i} is the {@link ATNConfig//alt}, and
  22801. // {@code pi} is the {@link ATNConfig//semanticContext}. We use
  22802. // {@code (s,i,pi)} as key.
  22803. //
  22804. // <p>This method updates {@link //dipsIntoOuterContext} and
  22805. // {@link //hasSemanticContext} when necessary.</p>
  22806. // /
  22807. ATNConfigSet.prototype.add = function (config, mergeCache) {
  22808. if (mergeCache === undefined) {
  22809. mergeCache = null;
  22810. }
  22811. if (this.readOnly) {
  22812. throw "This set is readonly";
  22813. }
  22814. if (config.semanticContext !== SemanticContext.NONE) {
  22815. this.hasSemanticContext = true;
  22816. }
  22817. if (config.reachesIntoOuterContext > 0) {
  22818. this.dipsIntoOuterContext = true;
  22819. }
  22820. var existing = this.configLookup.add(config);
  22821. if (existing === config) {
  22822. this.cachedHashCode = -1;
  22823. this.configs.push(config); // track order here
  22824. return true;
  22825. }
  22826. // a previous (s,i,pi,_), merge with it and save result
  22827. var rootIsWildcard = !this.fullCtx;
  22828. var merged = merge(existing.context, config.context, rootIsWildcard, mergeCache);
  22829. // no need to check for existing.context, config.context in cache
  22830. // since only way to create new graphs is "call rule" and here. We
  22831. // cache at both places.
  22832. existing.reachesIntoOuterContext = Math.max(existing.reachesIntoOuterContext, config.reachesIntoOuterContext);
  22833. // make sure to preserve the precedence filter suppression during the merge
  22834. if (config.precedenceFilterSuppressed) {
  22835. existing.precedenceFilterSuppressed = true;
  22836. }
  22837. existing.context = merged; // replace context; no need to alt mapping
  22838. return true;
  22839. };
  22840. ATNConfigSet.prototype.getStates = function () {
  22841. var states = new Set();
  22842. for (var i = 0; i < this.configs.length; i++) {
  22843. states.add(this.configs[i].state);
  22844. }
  22845. return states;
  22846. };
  22847. ATNConfigSet.prototype.getPredicates = function () {
  22848. var preds = [];
  22849. for (var i = 0; i < this.configs.length; i++) {
  22850. var c = this.configs[i].semanticContext;
  22851. if (c !== SemanticContext.NONE) {
  22852. preds.push(c.semanticContext);
  22853. }
  22854. }
  22855. return preds;
  22856. };
  22857. Object.defineProperty(ATNConfigSet.prototype, "items", {
  22858. get: function get() {
  22859. return this.configs;
  22860. }
  22861. });
  22862. ATNConfigSet.prototype.optimizeConfigs = function (interpreter) {
  22863. if (this.readOnly) {
  22864. throw "This set is readonly";
  22865. }
  22866. if (this.configLookup.length === 0) {
  22867. return;
  22868. }
  22869. for (var i = 0; i < this.configs.length; i++) {
  22870. var config = this.configs[i];
  22871. config.context = interpreter.getCachedContext(config.context);
  22872. }
  22873. };
  22874. ATNConfigSet.prototype.addAll = function (coll) {
  22875. for (var i = 0; i < coll.length; i++) {
  22876. this.add(coll[i]);
  22877. }
  22878. return false;
  22879. };
  22880. ATNConfigSet.prototype.equals = function (other) {
  22881. return this === other || other instanceof ATNConfigSet && Utils.equalArrays(this.configs, other.configs) && this.fullCtx === other.fullCtx && this.uniqueAlt === other.uniqueAlt && this.conflictingAlts === other.conflictingAlts && this.hasSemanticContext === other.hasSemanticContext && this.dipsIntoOuterContext === other.dipsIntoOuterContext;
  22882. };
  22883. ATNConfigSet.prototype.hashCode = function () {
  22884. var hash = new Hash();
  22885. this.updateHashCode(hash);
  22886. return hash.finish();
  22887. };
  22888. ATNConfigSet.prototype.updateHashCode = function (hash) {
  22889. if (this.readOnly) {
  22890. if (this.cachedHashCode === -1) {
  22891. var hash = new Hash();
  22892. hash.update(this.configs);
  22893. this.cachedHashCode = hash.finish();
  22894. }
  22895. hash.update(this.cachedHashCode);
  22896. } else {
  22897. hash.update(this.configs);
  22898. }
  22899. };
  22900. Object.defineProperty(ATNConfigSet.prototype, "length", {
  22901. get: function get() {
  22902. return this.configs.length;
  22903. }
  22904. });
  22905. ATNConfigSet.prototype.isEmpty = function () {
  22906. return this.configs.length === 0;
  22907. };
  22908. ATNConfigSet.prototype.contains = function (item) {
  22909. if (this.configLookup === null) {
  22910. throw "This method is not implemented for readonly sets.";
  22911. }
  22912. return this.configLookup.contains(item);
  22913. };
  22914. ATNConfigSet.prototype.containsFast = function (item) {
  22915. if (this.configLookup === null) {
  22916. throw "This method is not implemented for readonly sets.";
  22917. }
  22918. return this.configLookup.containsFast(item);
  22919. };
  22920. ATNConfigSet.prototype.clear = function () {
  22921. if (this.readOnly) {
  22922. throw "This set is readonly";
  22923. }
  22924. this.configs = [];
  22925. this.cachedHashCode = -1;
  22926. this.configLookup = new Set();
  22927. };
  22928. ATNConfigSet.prototype.setReadonly = function (readOnly) {
  22929. this.readOnly = readOnly;
  22930. if (readOnly) {
  22931. this.configLookup = null; // can't mod, no need for lookup cache
  22932. }
  22933. };
  22934. ATNConfigSet.prototype.toString = function () {
  22935. return Utils.arrayToString(this.configs) + (this.hasSemanticContext ? ",hasSemanticContext=" + this.hasSemanticContext : "") + (this.uniqueAlt !== ATN.INVALID_ALT_NUMBER ? ",uniqueAlt=" + this.uniqueAlt : "") + (this.conflictingAlts !== null ? ",conflictingAlts=" + this.conflictingAlts : "") + (this.dipsIntoOuterContext ? ",dipsIntoOuterContext" : "");
  22936. };
  22937. function OrderedATNConfigSet() {
  22938. ATNConfigSet.call(this);
  22939. this.configLookup = new Set();
  22940. return this;
  22941. }
  22942. OrderedATNConfigSet.prototype = Object.create(ATNConfigSet.prototype);
  22943. OrderedATNConfigSet.prototype.constructor = OrderedATNConfigSet;
  22944. exports.ATNConfigSet = ATNConfigSet;
  22945. exports.OrderedATNConfigSet = OrderedATNConfigSet;
  22946. /***/ }),
  22947. /***/ "./node_modules/antlr4/atn/ATNDeserializationOptions.js":
  22948. /*!**************************************************************!*\
  22949. !*** ./node_modules/antlr4/atn/ATNDeserializationOptions.js ***!
  22950. \**************************************************************/
  22951. /*! no static exports found */
  22952. /***/ (function(module, exports, __webpack_require__) {
  22953. "use strict";
  22954. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22955. * Use of this file is governed by the BSD 3-clause license that
  22956. * can be found in the LICENSE.txt file in the project root.
  22957. */
  22958. function ATNDeserializationOptions(copyFrom) {
  22959. if (copyFrom === undefined) {
  22960. copyFrom = null;
  22961. }
  22962. this.readOnly = false;
  22963. this.verifyATN = copyFrom === null ? true : copyFrom.verifyATN;
  22964. this.generateRuleBypassTransitions = copyFrom === null ? false : copyFrom.generateRuleBypassTransitions;
  22965. return this;
  22966. }
  22967. ATNDeserializationOptions.defaultOptions = new ATNDeserializationOptions();
  22968. ATNDeserializationOptions.defaultOptions.readOnly = true;
  22969. // def __setattr__(self, key, value):
  22970. // if key!="readOnly" and self.readOnly:
  22971. // raise Exception("The object is read only.")
  22972. // super(type(self), self).__setattr__(key,value)
  22973. exports.ATNDeserializationOptions = ATNDeserializationOptions;
  22974. /***/ }),
  22975. /***/ "./node_modules/antlr4/atn/ATNDeserializer.js":
  22976. /*!****************************************************!*\
  22977. !*** ./node_modules/antlr4/atn/ATNDeserializer.js ***!
  22978. \****************************************************/
  22979. /*! no static exports found */
  22980. /***/ (function(module, exports, __webpack_require__) {
  22981. "use strict";
  22982. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22983. * Use of this file is governed by the BSD 3-clause license that
  22984. * can be found in the LICENSE.txt file in the project root.
  22985. */
  22986. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  22987. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  22988. var ATNType = __webpack_require__(/*! ./ATNType */ "./node_modules/antlr4/atn/ATNType.js").ATNType;
  22989. var ATNStates = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js");
  22990. var ATNState = ATNStates.ATNState;
  22991. var BasicState = ATNStates.BasicState;
  22992. var DecisionState = ATNStates.DecisionState;
  22993. var BlockStartState = ATNStates.BlockStartState;
  22994. var BlockEndState = ATNStates.BlockEndState;
  22995. var LoopEndState = ATNStates.LoopEndState;
  22996. var RuleStartState = ATNStates.RuleStartState;
  22997. var RuleStopState = ATNStates.RuleStopState;
  22998. var TokensStartState = ATNStates.TokensStartState;
  22999. var PlusLoopbackState = ATNStates.PlusLoopbackState;
  23000. var StarLoopbackState = ATNStates.StarLoopbackState;
  23001. var StarLoopEntryState = ATNStates.StarLoopEntryState;
  23002. var PlusBlockStartState = ATNStates.PlusBlockStartState;
  23003. var StarBlockStartState = ATNStates.StarBlockStartState;
  23004. var BasicBlockStartState = ATNStates.BasicBlockStartState;
  23005. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  23006. var Transition = Transitions.Transition;
  23007. var AtomTransition = Transitions.AtomTransition;
  23008. var SetTransition = Transitions.SetTransition;
  23009. var NotSetTransition = Transitions.NotSetTransition;
  23010. var RuleTransition = Transitions.RuleTransition;
  23011. var RangeTransition = Transitions.RangeTransition;
  23012. var ActionTransition = Transitions.ActionTransition;
  23013. var EpsilonTransition = Transitions.EpsilonTransition;
  23014. var WildcardTransition = Transitions.WildcardTransition;
  23015. var PredicateTransition = Transitions.PredicateTransition;
  23016. var PrecedencePredicateTransition = Transitions.PrecedencePredicateTransition;
  23017. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  23018. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  23019. var ATNDeserializationOptions = __webpack_require__(/*! ./ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  23020. var LexerActions = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js");
  23021. var LexerActionType = LexerActions.LexerActionType;
  23022. var LexerSkipAction = LexerActions.LexerSkipAction;
  23023. var LexerChannelAction = LexerActions.LexerChannelAction;
  23024. var LexerCustomAction = LexerActions.LexerCustomAction;
  23025. var LexerMoreAction = LexerActions.LexerMoreAction;
  23026. var LexerTypeAction = LexerActions.LexerTypeAction;
  23027. var LexerPushModeAction = LexerActions.LexerPushModeAction;
  23028. var LexerPopModeAction = LexerActions.LexerPopModeAction;
  23029. var LexerModeAction = LexerActions.LexerModeAction;
  23030. // This is the earliest supported serialized UUID.
  23031. // stick to serialized version for now, we don't need a UUID instance
  23032. var BASE_SERIALIZED_UUID = "AADB8D7E-AEEF-4415-AD2B-8204D6CF042E";
  23033. //
  23034. // This UUID indicates the serialized ATN contains two sets of
  23035. // IntervalSets, where the second set's values are encoded as
  23036. // 32-bit integers to support the full Unicode SMP range up to U+10FFFF.
  23037. //
  23038. var ADDED_UNICODE_SMP = "59627784-3BE5-417A-B9EB-8131A7286089";
  23039. // This list contains all of the currently supported UUIDs, ordered by when
  23040. // the feature first appeared in this branch.
  23041. var SUPPORTED_UUIDS = [BASE_SERIALIZED_UUID, ADDED_UNICODE_SMP];
  23042. var SERIALIZED_VERSION = 3;
  23043. // This is the current serialized UUID.
  23044. var SERIALIZED_UUID = ADDED_UNICODE_SMP;
  23045. function initArray(length, value) {
  23046. var tmp = [];
  23047. tmp[length - 1] = value;
  23048. return tmp.map(function (i) {
  23049. return value;
  23050. });
  23051. }
  23052. function ATNDeserializer(options) {
  23053. if (options === undefined || options === null) {
  23054. options = ATNDeserializationOptions.defaultOptions;
  23055. }
  23056. this.deserializationOptions = options;
  23057. this.stateFactories = null;
  23058. this.actionFactories = null;
  23059. return this;
  23060. }
  23061. // Determines if a particular serialized representation of an ATN supports
  23062. // a particular feature, identified by the {@link UUID} used for serializing
  23063. // the ATN at the time the feature was first introduced.
  23064. //
  23065. // @param feature The {@link UUID} marking the first time the feature was
  23066. // supported in the serialized ATN.
  23067. // @param actualUuid The {@link UUID} of the actual serialized ATN which is
  23068. // currently being deserialized.
  23069. // @return {@code true} if the {@code actualUuid} value represents a
  23070. // serialized ATN at or after the feature identified by {@code feature} was
  23071. // introduced; otherwise, {@code false}.
  23072. ATNDeserializer.prototype.isFeatureSupported = function (feature, actualUuid) {
  23073. var idx1 = SUPPORTED_UUIDS.indexOf(feature);
  23074. if (idx1 < 0) {
  23075. return false;
  23076. }
  23077. var idx2 = SUPPORTED_UUIDS.indexOf(actualUuid);
  23078. return idx2 >= idx1;
  23079. };
  23080. ATNDeserializer.prototype.deserialize = function (data) {
  23081. this.reset(data);
  23082. this.checkVersion();
  23083. this.checkUUID();
  23084. var atn = this.readATN();
  23085. this.readStates(atn);
  23086. this.readRules(atn);
  23087. this.readModes(atn);
  23088. var sets = [];
  23089. // First, deserialize sets with 16-bit arguments <= U+FFFF.
  23090. this.readSets(atn, sets, this.readInt.bind(this));
  23091. // Next, if the ATN was serialized with the Unicode SMP feature,
  23092. // deserialize sets with 32-bit arguments <= U+10FFFF.
  23093. if (this.isFeatureSupported(ADDED_UNICODE_SMP, this.uuid)) {
  23094. this.readSets(atn, sets, this.readInt32.bind(this));
  23095. }
  23096. this.readEdges(atn, sets);
  23097. this.readDecisions(atn);
  23098. this.readLexerActions(atn);
  23099. this.markPrecedenceDecisions(atn);
  23100. this.verifyATN(atn);
  23101. if (this.deserializationOptions.generateRuleBypassTransitions && atn.grammarType === ATNType.PARSER) {
  23102. this.generateRuleBypassTransitions(atn);
  23103. // re-verify after modification
  23104. this.verifyATN(atn);
  23105. }
  23106. return atn;
  23107. };
  23108. ATNDeserializer.prototype.reset = function (data) {
  23109. var adjust = function adjust(c) {
  23110. var v = c.charCodeAt(0);
  23111. return v > 1 ? v - 2 : v + 65533;
  23112. };
  23113. var temp = data.split("").map(adjust);
  23114. // don't adjust the first value since that's the version number
  23115. temp[0] = data.charCodeAt(0);
  23116. this.data = temp;
  23117. this.pos = 0;
  23118. };
  23119. ATNDeserializer.prototype.checkVersion = function () {
  23120. var version = this.readInt();
  23121. if (version !== SERIALIZED_VERSION) {
  23122. throw "Could not deserialize ATN with version " + version + " (expected " + SERIALIZED_VERSION + ").";
  23123. }
  23124. };
  23125. ATNDeserializer.prototype.checkUUID = function () {
  23126. var uuid = this.readUUID();
  23127. if (SUPPORTED_UUIDS.indexOf(uuid) < 0) {
  23128. throw "Could not deserialize ATN with UUID: " + uuid + " (expected " + SERIALIZED_UUID + " or a legacy UUID).", uuid, SERIALIZED_UUID;
  23129. }
  23130. this.uuid = uuid;
  23131. };
  23132. ATNDeserializer.prototype.readATN = function () {
  23133. var grammarType = this.readInt();
  23134. var maxTokenType = this.readInt();
  23135. return new ATN(grammarType, maxTokenType);
  23136. };
  23137. ATNDeserializer.prototype.readStates = function (atn) {
  23138. var j, pair, stateNumber;
  23139. var loopBackStateNumbers = [];
  23140. var endStateNumbers = [];
  23141. var nstates = this.readInt();
  23142. for (var i = 0; i < nstates; i++) {
  23143. var stype = this.readInt();
  23144. // ignore bad type of states
  23145. if (stype === ATNState.INVALID_TYPE) {
  23146. atn.addState(null);
  23147. continue;
  23148. }
  23149. var ruleIndex = this.readInt();
  23150. if (ruleIndex === 0xFFFF) {
  23151. ruleIndex = -1;
  23152. }
  23153. var s = this.stateFactory(stype, ruleIndex);
  23154. if (stype === ATNState.LOOP_END) {
  23155. // special case
  23156. var loopBackStateNumber = this.readInt();
  23157. loopBackStateNumbers.push([s, loopBackStateNumber]);
  23158. } else if (s instanceof BlockStartState) {
  23159. var endStateNumber = this.readInt();
  23160. endStateNumbers.push([s, endStateNumber]);
  23161. }
  23162. atn.addState(s);
  23163. }
  23164. // delay the assignment of loop back and end states until we know all the
  23165. // state instances have been initialized
  23166. for (j = 0; j < loopBackStateNumbers.length; j++) {
  23167. pair = loopBackStateNumbers[j];
  23168. pair[0].loopBackState = atn.states[pair[1]];
  23169. }
  23170. for (j = 0; j < endStateNumbers.length; j++) {
  23171. pair = endStateNumbers[j];
  23172. pair[0].endState = atn.states[pair[1]];
  23173. }
  23174. var numNonGreedyStates = this.readInt();
  23175. for (j = 0; j < numNonGreedyStates; j++) {
  23176. stateNumber = this.readInt();
  23177. atn.states[stateNumber].nonGreedy = true;
  23178. }
  23179. var numPrecedenceStates = this.readInt();
  23180. for (j = 0; j < numPrecedenceStates; j++) {
  23181. stateNumber = this.readInt();
  23182. atn.states[stateNumber].isPrecedenceRule = true;
  23183. }
  23184. };
  23185. ATNDeserializer.prototype.readRules = function (atn) {
  23186. var i;
  23187. var nrules = this.readInt();
  23188. if (atn.grammarType === ATNType.LEXER) {
  23189. atn.ruleToTokenType = initArray(nrules, 0);
  23190. }
  23191. atn.ruleToStartState = initArray(nrules, 0);
  23192. for (i = 0; i < nrules; i++) {
  23193. var s = this.readInt();
  23194. var startState = atn.states[s];
  23195. atn.ruleToStartState[i] = startState;
  23196. if (atn.grammarType === ATNType.LEXER) {
  23197. var tokenType = this.readInt();
  23198. if (tokenType === 0xFFFF) {
  23199. tokenType = Token.EOF;
  23200. }
  23201. atn.ruleToTokenType[i] = tokenType;
  23202. }
  23203. }
  23204. atn.ruleToStopState = initArray(nrules, 0);
  23205. for (i = 0; i < atn.states.length; i++) {
  23206. var state = atn.states[i];
  23207. if (!(state instanceof RuleStopState)) {
  23208. continue;
  23209. }
  23210. atn.ruleToStopState[state.ruleIndex] = state;
  23211. atn.ruleToStartState[state.ruleIndex].stopState = state;
  23212. }
  23213. };
  23214. ATNDeserializer.prototype.readModes = function (atn) {
  23215. var nmodes = this.readInt();
  23216. for (var i = 0; i < nmodes; i++) {
  23217. var s = this.readInt();
  23218. atn.modeToStartState.push(atn.states[s]);
  23219. }
  23220. };
  23221. ATNDeserializer.prototype.readSets = function (atn, sets, readUnicode) {
  23222. var m = this.readInt();
  23223. for (var i = 0; i < m; i++) {
  23224. var iset = new IntervalSet();
  23225. sets.push(iset);
  23226. var n = this.readInt();
  23227. var containsEof = this.readInt();
  23228. if (containsEof !== 0) {
  23229. iset.addOne(-1);
  23230. }
  23231. for (var j = 0; j < n; j++) {
  23232. var i1 = readUnicode();
  23233. var i2 = readUnicode();
  23234. iset.addRange(i1, i2);
  23235. }
  23236. }
  23237. };
  23238. ATNDeserializer.prototype.readEdges = function (atn, sets) {
  23239. var i, j, state, trans, target;
  23240. var nedges = this.readInt();
  23241. for (i = 0; i < nedges; i++) {
  23242. var src = this.readInt();
  23243. var trg = this.readInt();
  23244. var ttype = this.readInt();
  23245. var arg1 = this.readInt();
  23246. var arg2 = this.readInt();
  23247. var arg3 = this.readInt();
  23248. trans = this.edgeFactory(atn, ttype, src, trg, arg1, arg2, arg3, sets);
  23249. var srcState = atn.states[src];
  23250. srcState.addTransition(trans);
  23251. }
  23252. // edges for rule stop states can be derived, so they aren't serialized
  23253. for (i = 0; i < atn.states.length; i++) {
  23254. state = atn.states[i];
  23255. for (j = 0; j < state.transitions.length; j++) {
  23256. var t = state.transitions[j];
  23257. if (!(t instanceof RuleTransition)) {
  23258. continue;
  23259. }
  23260. var outermostPrecedenceReturn = -1;
  23261. if (atn.ruleToStartState[t.target.ruleIndex].isPrecedenceRule) {
  23262. if (t.precedence === 0) {
  23263. outermostPrecedenceReturn = t.target.ruleIndex;
  23264. }
  23265. }
  23266. trans = new EpsilonTransition(t.followState, outermostPrecedenceReturn);
  23267. atn.ruleToStopState[t.target.ruleIndex].addTransition(trans);
  23268. }
  23269. }
  23270. for (i = 0; i < atn.states.length; i++) {
  23271. state = atn.states[i];
  23272. if (state instanceof BlockStartState) {
  23273. // we need to know the end state to set its start state
  23274. if (state.endState === null) {
  23275. throw "IllegalState";
  23276. }
  23277. // block end states can only be associated to a single block start
  23278. // state
  23279. if (state.endState.startState !== null) {
  23280. throw "IllegalState";
  23281. }
  23282. state.endState.startState = state;
  23283. }
  23284. if (state instanceof PlusLoopbackState) {
  23285. for (j = 0; j < state.transitions.length; j++) {
  23286. target = state.transitions[j].target;
  23287. if (target instanceof PlusBlockStartState) {
  23288. target.loopBackState = state;
  23289. }
  23290. }
  23291. } else if (state instanceof StarLoopbackState) {
  23292. for (j = 0; j < state.transitions.length; j++) {
  23293. target = state.transitions[j].target;
  23294. if (target instanceof StarLoopEntryState) {
  23295. target.loopBackState = state;
  23296. }
  23297. }
  23298. }
  23299. }
  23300. };
  23301. ATNDeserializer.prototype.readDecisions = function (atn) {
  23302. var ndecisions = this.readInt();
  23303. for (var i = 0; i < ndecisions; i++) {
  23304. var s = this.readInt();
  23305. var decState = atn.states[s];
  23306. atn.decisionToState.push(decState);
  23307. decState.decision = i;
  23308. }
  23309. };
  23310. ATNDeserializer.prototype.readLexerActions = function (atn) {
  23311. if (atn.grammarType === ATNType.LEXER) {
  23312. var count = this.readInt();
  23313. atn.lexerActions = initArray(count, null);
  23314. for (var i = 0; i < count; i++) {
  23315. var actionType = this.readInt();
  23316. var data1 = this.readInt();
  23317. if (data1 === 0xFFFF) {
  23318. data1 = -1;
  23319. }
  23320. var data2 = this.readInt();
  23321. if (data2 === 0xFFFF) {
  23322. data2 = -1;
  23323. }
  23324. var lexerAction = this.lexerActionFactory(actionType, data1, data2);
  23325. atn.lexerActions[i] = lexerAction;
  23326. }
  23327. }
  23328. };
  23329. ATNDeserializer.prototype.generateRuleBypassTransitions = function (atn) {
  23330. var i;
  23331. var count = atn.ruleToStartState.length;
  23332. for (i = 0; i < count; i++) {
  23333. atn.ruleToTokenType[i] = atn.maxTokenType + i + 1;
  23334. }
  23335. for (i = 0; i < count; i++) {
  23336. this.generateRuleBypassTransition(atn, i);
  23337. }
  23338. };
  23339. ATNDeserializer.prototype.generateRuleBypassTransition = function (atn, idx) {
  23340. var i, state;
  23341. var bypassStart = new BasicBlockStartState();
  23342. bypassStart.ruleIndex = idx;
  23343. atn.addState(bypassStart);
  23344. var bypassStop = new BlockEndState();
  23345. bypassStop.ruleIndex = idx;
  23346. atn.addState(bypassStop);
  23347. bypassStart.endState = bypassStop;
  23348. atn.defineDecisionState(bypassStart);
  23349. bypassStop.startState = bypassStart;
  23350. var excludeTransition = null;
  23351. var endState = null;
  23352. if (atn.ruleToStartState[idx].isPrecedenceRule) {
  23353. // wrap from the beginning of the rule to the StarLoopEntryState
  23354. endState = null;
  23355. for (i = 0; i < atn.states.length; i++) {
  23356. state = atn.states[i];
  23357. if (this.stateIsEndStateFor(state, idx)) {
  23358. endState = state;
  23359. excludeTransition = state.loopBackState.transitions[0];
  23360. break;
  23361. }
  23362. }
  23363. if (excludeTransition === null) {
  23364. throw "Couldn't identify final state of the precedence rule prefix section.";
  23365. }
  23366. } else {
  23367. endState = atn.ruleToStopState[idx];
  23368. }
  23369. // all non-excluded transitions that currently target end state need to
  23370. // target blockEnd instead
  23371. for (i = 0; i < atn.states.length; i++) {
  23372. state = atn.states[i];
  23373. for (var j = 0; j < state.transitions.length; j++) {
  23374. var transition = state.transitions[j];
  23375. if (transition === excludeTransition) {
  23376. continue;
  23377. }
  23378. if (transition.target === endState) {
  23379. transition.target = bypassStop;
  23380. }
  23381. }
  23382. }
  23383. // all transitions leaving the rule start state need to leave blockStart
  23384. // instead
  23385. var ruleToStartState = atn.ruleToStartState[idx];
  23386. var count = ruleToStartState.transitions.length;
  23387. while (count > 0) {
  23388. bypassStart.addTransition(ruleToStartState.transitions[count - 1]);
  23389. ruleToStartState.transitions = ruleToStartState.transitions.slice(-1);
  23390. }
  23391. // link the new states
  23392. atn.ruleToStartState[idx].addTransition(new EpsilonTransition(bypassStart));
  23393. bypassStop.addTransition(new EpsilonTransition(endState));
  23394. var matchState = new BasicState();
  23395. atn.addState(matchState);
  23396. matchState.addTransition(new AtomTransition(bypassStop, atn.ruleToTokenType[idx]));
  23397. bypassStart.addTransition(new EpsilonTransition(matchState));
  23398. };
  23399. ATNDeserializer.prototype.stateIsEndStateFor = function (state, idx) {
  23400. if (state.ruleIndex !== idx) {
  23401. return null;
  23402. }
  23403. if (!(state instanceof StarLoopEntryState)) {
  23404. return null;
  23405. }
  23406. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  23407. if (!(maybeLoopEndState instanceof LoopEndState)) {
  23408. return null;
  23409. }
  23410. if (maybeLoopEndState.epsilonOnlyTransitions && maybeLoopEndState.transitions[0].target instanceof RuleStopState) {
  23411. return state;
  23412. } else {
  23413. return null;
  23414. }
  23415. };
  23416. //
  23417. // Analyze the {@link StarLoopEntryState} states in the specified ATN to set
  23418. // the {@link StarLoopEntryState//isPrecedenceDecision} field to the
  23419. // correct value.
  23420. //
  23421. // @param atn The ATN.
  23422. //
  23423. ATNDeserializer.prototype.markPrecedenceDecisions = function (atn) {
  23424. for (var i = 0; i < atn.states.length; i++) {
  23425. var state = atn.states[i];
  23426. if (!(state instanceof StarLoopEntryState)) {
  23427. continue;
  23428. }
  23429. // We analyze the ATN to determine if this ATN decision state is the
  23430. // decision for the closure block that determines whether a
  23431. // precedence rule should continue or complete.
  23432. //
  23433. if (atn.ruleToStartState[state.ruleIndex].isPrecedenceRule) {
  23434. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  23435. if (maybeLoopEndState instanceof LoopEndState) {
  23436. if (maybeLoopEndState.epsilonOnlyTransitions && maybeLoopEndState.transitions[0].target instanceof RuleStopState) {
  23437. state.isPrecedenceDecision = true;
  23438. }
  23439. }
  23440. }
  23441. }
  23442. };
  23443. ATNDeserializer.prototype.verifyATN = function (atn) {
  23444. if (!this.deserializationOptions.verifyATN) {
  23445. return;
  23446. }
  23447. // verify assumptions
  23448. for (var i = 0; i < atn.states.length; i++) {
  23449. var state = atn.states[i];
  23450. if (state === null) {
  23451. continue;
  23452. }
  23453. this.checkCondition(state.epsilonOnlyTransitions || state.transitions.length <= 1);
  23454. if (state instanceof PlusBlockStartState) {
  23455. this.checkCondition(state.loopBackState !== null);
  23456. } else if (state instanceof StarLoopEntryState) {
  23457. this.checkCondition(state.loopBackState !== null);
  23458. this.checkCondition(state.transitions.length === 2);
  23459. if (state.transitions[0].target instanceof StarBlockStartState) {
  23460. this.checkCondition(state.transitions[1].target instanceof LoopEndState);
  23461. this.checkCondition(!state.nonGreedy);
  23462. } else if (state.transitions[0].target instanceof LoopEndState) {
  23463. this.checkCondition(state.transitions[1].target instanceof StarBlockStartState);
  23464. this.checkCondition(state.nonGreedy);
  23465. } else {
  23466. throw "IllegalState";
  23467. }
  23468. } else if (state instanceof StarLoopbackState) {
  23469. this.checkCondition(state.transitions.length === 1);
  23470. this.checkCondition(state.transitions[0].target instanceof StarLoopEntryState);
  23471. } else if (state instanceof LoopEndState) {
  23472. this.checkCondition(state.loopBackState !== null);
  23473. } else if (state instanceof RuleStartState) {
  23474. this.checkCondition(state.stopState !== null);
  23475. } else if (state instanceof BlockStartState) {
  23476. this.checkCondition(state.endState !== null);
  23477. } else if (state instanceof BlockEndState) {
  23478. this.checkCondition(state.startState !== null);
  23479. } else if (state instanceof DecisionState) {
  23480. this.checkCondition(state.transitions.length <= 1 || state.decision >= 0);
  23481. } else {
  23482. this.checkCondition(state.transitions.length <= 1 || state instanceof RuleStopState);
  23483. }
  23484. }
  23485. };
  23486. ATNDeserializer.prototype.checkCondition = function (condition, message) {
  23487. if (!condition) {
  23488. if (message === undefined || message === null) {
  23489. message = "IllegalState";
  23490. }
  23491. throw message;
  23492. }
  23493. };
  23494. ATNDeserializer.prototype.readInt = function () {
  23495. return this.data[this.pos++];
  23496. };
  23497. ATNDeserializer.prototype.readInt32 = function () {
  23498. var low = this.readInt();
  23499. var high = this.readInt();
  23500. return low | high << 16;
  23501. };
  23502. ATNDeserializer.prototype.readLong = function () {
  23503. var low = this.readInt32();
  23504. var high = this.readInt32();
  23505. return low & 0x00000000FFFFFFFF | high << 32;
  23506. };
  23507. function createByteToHex() {
  23508. var bth = [];
  23509. for (var i = 0; i < 256; i++) {
  23510. bth[i] = (i + 0x100).toString(16).substr(1).toUpperCase();
  23511. }
  23512. return bth;
  23513. }
  23514. var byteToHex = createByteToHex();
  23515. ATNDeserializer.prototype.readUUID = function () {
  23516. var bb = [];
  23517. for (var i = 7; i >= 0; i--) {
  23518. var int = this.readInt();
  23519. /* jshint bitwise: false */
  23520. bb[2 * i + 1] = int & 0xFF;
  23521. bb[2 * i] = int >> 8 & 0xFF;
  23522. }
  23523. return byteToHex[bb[0]] + byteToHex[bb[1]] + byteToHex[bb[2]] + byteToHex[bb[3]] + '-' + byteToHex[bb[4]] + byteToHex[bb[5]] + '-' + byteToHex[bb[6]] + byteToHex[bb[7]] + '-' + byteToHex[bb[8]] + byteToHex[bb[9]] + '-' + byteToHex[bb[10]] + byteToHex[bb[11]] + byteToHex[bb[12]] + byteToHex[bb[13]] + byteToHex[bb[14]] + byteToHex[bb[15]];
  23524. };
  23525. ATNDeserializer.prototype.edgeFactory = function (atn, type, src, trg, arg1, arg2, arg3, sets) {
  23526. var target = atn.states[trg];
  23527. switch (type) {
  23528. case Transition.EPSILON:
  23529. return new EpsilonTransition(target);
  23530. case Transition.RANGE:
  23531. return arg3 !== 0 ? new RangeTransition(target, Token.EOF, arg2) : new RangeTransition(target, arg1, arg2);
  23532. case Transition.RULE:
  23533. return new RuleTransition(atn.states[arg1], arg2, arg3, target);
  23534. case Transition.PREDICATE:
  23535. return new PredicateTransition(target, arg1, arg2, arg3 !== 0);
  23536. case Transition.PRECEDENCE:
  23537. return new PrecedencePredicateTransition(target, arg1);
  23538. case Transition.ATOM:
  23539. return arg3 !== 0 ? new AtomTransition(target, Token.EOF) : new AtomTransition(target, arg1);
  23540. case Transition.ACTION:
  23541. return new ActionTransition(target, arg1, arg2, arg3 !== 0);
  23542. case Transition.SET:
  23543. return new SetTransition(target, sets[arg1]);
  23544. case Transition.NOT_SET:
  23545. return new NotSetTransition(target, sets[arg1]);
  23546. case Transition.WILDCARD:
  23547. return new WildcardTransition(target);
  23548. default:
  23549. throw "The specified transition type: " + type + " is not valid.";
  23550. }
  23551. };
  23552. ATNDeserializer.prototype.stateFactory = function (type, ruleIndex) {
  23553. if (this.stateFactories === null) {
  23554. var sf = [];
  23555. sf[ATNState.INVALID_TYPE] = null;
  23556. sf[ATNState.BASIC] = function () {
  23557. return new BasicState();
  23558. };
  23559. sf[ATNState.RULE_START] = function () {
  23560. return new RuleStartState();
  23561. };
  23562. sf[ATNState.BLOCK_START] = function () {
  23563. return new BasicBlockStartState();
  23564. };
  23565. sf[ATNState.PLUS_BLOCK_START] = function () {
  23566. return new PlusBlockStartState();
  23567. };
  23568. sf[ATNState.STAR_BLOCK_START] = function () {
  23569. return new StarBlockStartState();
  23570. };
  23571. sf[ATNState.TOKEN_START] = function () {
  23572. return new TokensStartState();
  23573. };
  23574. sf[ATNState.RULE_STOP] = function () {
  23575. return new RuleStopState();
  23576. };
  23577. sf[ATNState.BLOCK_END] = function () {
  23578. return new BlockEndState();
  23579. };
  23580. sf[ATNState.STAR_LOOP_BACK] = function () {
  23581. return new StarLoopbackState();
  23582. };
  23583. sf[ATNState.STAR_LOOP_ENTRY] = function () {
  23584. return new StarLoopEntryState();
  23585. };
  23586. sf[ATNState.PLUS_LOOP_BACK] = function () {
  23587. return new PlusLoopbackState();
  23588. };
  23589. sf[ATNState.LOOP_END] = function () {
  23590. return new LoopEndState();
  23591. };
  23592. this.stateFactories = sf;
  23593. }
  23594. if (type > this.stateFactories.length || this.stateFactories[type] === null) {
  23595. throw "The specified state type " + type + " is not valid.";
  23596. } else {
  23597. var s = this.stateFactories[type]();
  23598. if (s !== null) {
  23599. s.ruleIndex = ruleIndex;
  23600. return s;
  23601. }
  23602. }
  23603. };
  23604. ATNDeserializer.prototype.lexerActionFactory = function (type, data1, data2) {
  23605. if (this.actionFactories === null) {
  23606. var af = [];
  23607. af[LexerActionType.CHANNEL] = function (data1, data2) {
  23608. return new LexerChannelAction(data1);
  23609. };
  23610. af[LexerActionType.CUSTOM] = function (data1, data2) {
  23611. return new LexerCustomAction(data1, data2);
  23612. };
  23613. af[LexerActionType.MODE] = function (data1, data2) {
  23614. return new LexerModeAction(data1);
  23615. };
  23616. af[LexerActionType.MORE] = function (data1, data2) {
  23617. return LexerMoreAction.INSTANCE;
  23618. };
  23619. af[LexerActionType.POP_MODE] = function (data1, data2) {
  23620. return LexerPopModeAction.INSTANCE;
  23621. };
  23622. af[LexerActionType.PUSH_MODE] = function (data1, data2) {
  23623. return new LexerPushModeAction(data1);
  23624. };
  23625. af[LexerActionType.SKIP] = function (data1, data2) {
  23626. return LexerSkipAction.INSTANCE;
  23627. };
  23628. af[LexerActionType.TYPE] = function (data1, data2) {
  23629. return new LexerTypeAction(data1);
  23630. };
  23631. this.actionFactories = af;
  23632. }
  23633. if (type > this.actionFactories.length || this.actionFactories[type] === null) {
  23634. throw "The specified lexer action type " + type + " is not valid.";
  23635. } else {
  23636. return this.actionFactories[type](data1, data2);
  23637. }
  23638. };
  23639. exports.ATNDeserializer = ATNDeserializer;
  23640. /***/ }),
  23641. /***/ "./node_modules/antlr4/atn/ATNSimulator.js":
  23642. /*!*************************************************!*\
  23643. !*** ./node_modules/antlr4/atn/ATNSimulator.js ***!
  23644. \*************************************************/
  23645. /*! no static exports found */
  23646. /***/ (function(module, exports, __webpack_require__) {
  23647. "use strict";
  23648. //
  23649. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  23650. * Use of this file is governed by the BSD 3-clause license that
  23651. * can be found in the LICENSE.txt file in the project root.
  23652. */
  23653. ///
  23654. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  23655. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  23656. var getCachedPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").getCachedPredictionContext;
  23657. function ATNSimulator(atn, sharedContextCache) {
  23658. // The context cache maps all PredictionContext objects that are ==
  23659. // to a single cached copy. This cache is shared across all contexts
  23660. // in all ATNConfigs in all DFA states. We rebuild each ATNConfigSet
  23661. // to use only cached nodes/graphs in addDFAState(). We don't want to
  23662. // fill this during closure() since there are lots of contexts that
  23663. // pop up but are not used ever again. It also greatly slows down closure().
  23664. //
  23665. // <p>This cache makes a huge difference in memory and a little bit in speed.
  23666. // For the Java grammar on java.*, it dropped the memory requirements
  23667. // at the end from 25M to 16M. We don't store any of the full context
  23668. // graphs in the DFA because they are limited to local context only,
  23669. // but apparently there's a lot of repetition there as well. We optimize
  23670. // the config contexts before storing the config set in the DFA states
  23671. // by literally rebuilding them with cached subgraphs only.</p>
  23672. //
  23673. // <p>I tried a cache for use during closure operations, that was
  23674. // whacked after each adaptivePredict(). It cost a little bit
  23675. // more time I think and doesn't save on the overall footprint
  23676. // so it's not worth the complexity.</p>
  23677. ///
  23678. this.atn = atn;
  23679. this.sharedContextCache = sharedContextCache;
  23680. return this;
  23681. }
  23682. // Must distinguish between missing edge and edge we know leads nowhere///
  23683. ATNSimulator.ERROR = new DFAState(0x7FFFFFFF, new ATNConfigSet());
  23684. ATNSimulator.prototype.getCachedContext = function (context) {
  23685. if (this.sharedContextCache === null) {
  23686. return context;
  23687. }
  23688. var visited = {};
  23689. return getCachedPredictionContext(context, this.sharedContextCache, visited);
  23690. };
  23691. exports.ATNSimulator = ATNSimulator;
  23692. /***/ }),
  23693. /***/ "./node_modules/antlr4/atn/ATNState.js":
  23694. /*!*********************************************!*\
  23695. !*** ./node_modules/antlr4/atn/ATNState.js ***!
  23696. \*********************************************/
  23697. /*! no static exports found */
  23698. /***/ (function(module, exports, __webpack_require__) {
  23699. "use strict";
  23700. //
  23701. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  23702. * Use of this file is governed by the BSD 3-clause license that
  23703. * can be found in the LICENSE.txt file in the project root.
  23704. */
  23705. //
  23706. // The following images show the relation of states and
  23707. // {@link ATNState//transitions} for various grammar constructs.
  23708. //
  23709. // <ul>
  23710. //
  23711. // <li>Solid edges marked with an &//0949; indicate a required
  23712. // {@link EpsilonTransition}.</li>
  23713. //
  23714. // <li>Dashed edges indicate locations where any transition derived from
  23715. // {@link Transition} might appear.</li>
  23716. //
  23717. // <li>Dashed nodes are place holders for either a sequence of linked
  23718. // {@link BasicState} states or the inclusion of a block representing a nested
  23719. // construct in one of the forms below.</li>
  23720. //
  23721. // <li>Nodes showing multiple outgoing alternatives with a {@code ...} support
  23722. // any number of alternatives (one or more). Nodes without the {@code ...} only
  23723. // support the exact number of alternatives shown in the diagram.</li>
  23724. //
  23725. // </ul>
  23726. //
  23727. // <h2>Basic Blocks</h2>
  23728. //
  23729. // <h3>Rule</h3>
  23730. //
  23731. // <embed src="images/Rule.svg" type="image/svg+xml"/>
  23732. //
  23733. // <h3>Block of 1 or more alternatives</h3>
  23734. //
  23735. // <embed src="images/Block.svg" type="image/svg+xml"/>
  23736. //
  23737. // <h2>Greedy Loops</h2>
  23738. //
  23739. // <h3>Greedy Closure: {@code (...)*}</h3>
  23740. //
  23741. // <embed src="images/ClosureGreedy.svg" type="image/svg+xml"/>
  23742. //
  23743. // <h3>Greedy Positive Closure: {@code (...)+}</h3>
  23744. //
  23745. // <embed src="images/PositiveClosureGreedy.svg" type="image/svg+xml"/>
  23746. //
  23747. // <h3>Greedy Optional: {@code (...)?}</h3>
  23748. //
  23749. // <embed src="images/OptionalGreedy.svg" type="image/svg+xml"/>
  23750. //
  23751. // <h2>Non-Greedy Loops</h2>
  23752. //
  23753. // <h3>Non-Greedy Closure: {@code (...)*?}</h3>
  23754. //
  23755. // <embed src="images/ClosureNonGreedy.svg" type="image/svg+xml"/>
  23756. //
  23757. // <h3>Non-Greedy Positive Closure: {@code (...)+?}</h3>
  23758. //
  23759. // <embed src="images/PositiveClosureNonGreedy.svg" type="image/svg+xml"/>
  23760. //
  23761. // <h3>Non-Greedy Optional: {@code (...)??}</h3>
  23762. //
  23763. // <embed src="images/OptionalNonGreedy.svg" type="image/svg+xml"/>
  23764. //
  23765. var INITIAL_NUM_TRANSITIONS = 4;
  23766. function ATNState() {
  23767. // Which ATN are we in?
  23768. this.atn = null;
  23769. this.stateNumber = ATNState.INVALID_STATE_NUMBER;
  23770. this.stateType = null;
  23771. this.ruleIndex = 0; // at runtime, we don't have Rule objects
  23772. this.epsilonOnlyTransitions = false;
  23773. // Track the transitions emanating from this ATN state.
  23774. this.transitions = [];
  23775. // Used to cache lookahead during parsing, not used during construction
  23776. this.nextTokenWithinRule = null;
  23777. return this;
  23778. }
  23779. // constants for serialization
  23780. ATNState.INVALID_TYPE = 0;
  23781. ATNState.BASIC = 1;
  23782. ATNState.RULE_START = 2;
  23783. ATNState.BLOCK_START = 3;
  23784. ATNState.PLUS_BLOCK_START = 4;
  23785. ATNState.STAR_BLOCK_START = 5;
  23786. ATNState.TOKEN_START = 6;
  23787. ATNState.RULE_STOP = 7;
  23788. ATNState.BLOCK_END = 8;
  23789. ATNState.STAR_LOOP_BACK = 9;
  23790. ATNState.STAR_LOOP_ENTRY = 10;
  23791. ATNState.PLUS_LOOP_BACK = 11;
  23792. ATNState.LOOP_END = 12;
  23793. ATNState.serializationNames = ["INVALID", "BASIC", "RULE_START", "BLOCK_START", "PLUS_BLOCK_START", "STAR_BLOCK_START", "TOKEN_START", "RULE_STOP", "BLOCK_END", "STAR_LOOP_BACK", "STAR_LOOP_ENTRY", "PLUS_LOOP_BACK", "LOOP_END"];
  23794. ATNState.INVALID_STATE_NUMBER = -1;
  23795. ATNState.prototype.toString = function () {
  23796. return this.stateNumber;
  23797. };
  23798. ATNState.prototype.equals = function (other) {
  23799. if (other instanceof ATNState) {
  23800. return this.stateNumber === other.stateNumber;
  23801. } else {
  23802. return false;
  23803. }
  23804. };
  23805. ATNState.prototype.isNonGreedyExitState = function () {
  23806. return false;
  23807. };
  23808. ATNState.prototype.addTransition = function (trans, index) {
  23809. if (index === undefined) {
  23810. index = -1;
  23811. }
  23812. if (this.transitions.length === 0) {
  23813. this.epsilonOnlyTransitions = trans.isEpsilon;
  23814. } else if (this.epsilonOnlyTransitions !== trans.isEpsilon) {
  23815. this.epsilonOnlyTransitions = false;
  23816. }
  23817. if (index === -1) {
  23818. this.transitions.push(trans);
  23819. } else {
  23820. this.transitions.splice(index, 1, trans);
  23821. }
  23822. };
  23823. function BasicState() {
  23824. ATNState.call(this);
  23825. this.stateType = ATNState.BASIC;
  23826. return this;
  23827. }
  23828. BasicState.prototype = Object.create(ATNState.prototype);
  23829. BasicState.prototype.constructor = BasicState;
  23830. function DecisionState() {
  23831. ATNState.call(this);
  23832. this.decision = -1;
  23833. this.nonGreedy = false;
  23834. return this;
  23835. }
  23836. DecisionState.prototype = Object.create(ATNState.prototype);
  23837. DecisionState.prototype.constructor = DecisionState;
  23838. // The start of a regular {@code (...)} block.
  23839. function BlockStartState() {
  23840. DecisionState.call(this);
  23841. this.endState = null;
  23842. return this;
  23843. }
  23844. BlockStartState.prototype = Object.create(DecisionState.prototype);
  23845. BlockStartState.prototype.constructor = BlockStartState;
  23846. function BasicBlockStartState() {
  23847. BlockStartState.call(this);
  23848. this.stateType = ATNState.BLOCK_START;
  23849. return this;
  23850. }
  23851. BasicBlockStartState.prototype = Object.create(BlockStartState.prototype);
  23852. BasicBlockStartState.prototype.constructor = BasicBlockStartState;
  23853. // Terminal node of a simple {@code (a|b|c)} block.
  23854. function BlockEndState() {
  23855. ATNState.call(this);
  23856. this.stateType = ATNState.BLOCK_END;
  23857. this.startState = null;
  23858. return this;
  23859. }
  23860. BlockEndState.prototype = Object.create(ATNState.prototype);
  23861. BlockEndState.prototype.constructor = BlockEndState;
  23862. // The last node in the ATN for a rule, unless that rule is the start symbol.
  23863. // In that case, there is one transition to EOF. Later, we might encode
  23864. // references to all calls to this rule to compute FOLLOW sets for
  23865. // error handling.
  23866. //
  23867. function RuleStopState() {
  23868. ATNState.call(this);
  23869. this.stateType = ATNState.RULE_STOP;
  23870. return this;
  23871. }
  23872. RuleStopState.prototype = Object.create(ATNState.prototype);
  23873. RuleStopState.prototype.constructor = RuleStopState;
  23874. function RuleStartState() {
  23875. ATNState.call(this);
  23876. this.stateType = ATNState.RULE_START;
  23877. this.stopState = null;
  23878. this.isPrecedenceRule = false;
  23879. return this;
  23880. }
  23881. RuleStartState.prototype = Object.create(ATNState.prototype);
  23882. RuleStartState.prototype.constructor = RuleStartState;
  23883. // Decision state for {@code A+} and {@code (A|B)+}. It has two transitions:
  23884. // one to the loop back to start of the block and one to exit.
  23885. //
  23886. function PlusLoopbackState() {
  23887. DecisionState.call(this);
  23888. this.stateType = ATNState.PLUS_LOOP_BACK;
  23889. return this;
  23890. }
  23891. PlusLoopbackState.prototype = Object.create(DecisionState.prototype);
  23892. PlusLoopbackState.prototype.constructor = PlusLoopbackState;
  23893. // Start of {@code (A|B|...)+} loop. Technically a decision state, but
  23894. // we don't use for code generation; somebody might need it, so I'm defining
  23895. // it for completeness. In reality, the {@link PlusLoopbackState} node is the
  23896. // real decision-making note for {@code A+}.
  23897. //
  23898. function PlusBlockStartState() {
  23899. BlockStartState.call(this);
  23900. this.stateType = ATNState.PLUS_BLOCK_START;
  23901. this.loopBackState = null;
  23902. return this;
  23903. }
  23904. PlusBlockStartState.prototype = Object.create(BlockStartState.prototype);
  23905. PlusBlockStartState.prototype.constructor = PlusBlockStartState;
  23906. // The block that begins a closure loop.
  23907. function StarBlockStartState() {
  23908. BlockStartState.call(this);
  23909. this.stateType = ATNState.STAR_BLOCK_START;
  23910. return this;
  23911. }
  23912. StarBlockStartState.prototype = Object.create(BlockStartState.prototype);
  23913. StarBlockStartState.prototype.constructor = StarBlockStartState;
  23914. function StarLoopbackState() {
  23915. ATNState.call(this);
  23916. this.stateType = ATNState.STAR_LOOP_BACK;
  23917. return this;
  23918. }
  23919. StarLoopbackState.prototype = Object.create(ATNState.prototype);
  23920. StarLoopbackState.prototype.constructor = StarLoopbackState;
  23921. function StarLoopEntryState() {
  23922. DecisionState.call(this);
  23923. this.stateType = ATNState.STAR_LOOP_ENTRY;
  23924. this.loopBackState = null;
  23925. // Indicates whether this state can benefit from a precedence DFA during SLL decision making.
  23926. this.isPrecedenceDecision = null;
  23927. return this;
  23928. }
  23929. StarLoopEntryState.prototype = Object.create(DecisionState.prototype);
  23930. StarLoopEntryState.prototype.constructor = StarLoopEntryState;
  23931. // Mark the end of a * or + loop.
  23932. function LoopEndState() {
  23933. ATNState.call(this);
  23934. this.stateType = ATNState.LOOP_END;
  23935. this.loopBackState = null;
  23936. return this;
  23937. }
  23938. LoopEndState.prototype = Object.create(ATNState.prototype);
  23939. LoopEndState.prototype.constructor = LoopEndState;
  23940. // The Tokens rule start state linking to each lexer rule start state */
  23941. function TokensStartState() {
  23942. DecisionState.call(this);
  23943. this.stateType = ATNState.TOKEN_START;
  23944. return this;
  23945. }
  23946. TokensStartState.prototype = Object.create(DecisionState.prototype);
  23947. TokensStartState.prototype.constructor = TokensStartState;
  23948. exports.ATNState = ATNState;
  23949. exports.BasicState = BasicState;
  23950. exports.DecisionState = DecisionState;
  23951. exports.BlockStartState = BlockStartState;
  23952. exports.BlockEndState = BlockEndState;
  23953. exports.LoopEndState = LoopEndState;
  23954. exports.RuleStartState = RuleStartState;
  23955. exports.RuleStopState = RuleStopState;
  23956. exports.TokensStartState = TokensStartState;
  23957. exports.PlusLoopbackState = PlusLoopbackState;
  23958. exports.StarLoopbackState = StarLoopbackState;
  23959. exports.StarLoopEntryState = StarLoopEntryState;
  23960. exports.PlusBlockStartState = PlusBlockStartState;
  23961. exports.StarBlockStartState = StarBlockStartState;
  23962. exports.BasicBlockStartState = BasicBlockStartState;
  23963. /***/ }),
  23964. /***/ "./node_modules/antlr4/atn/ATNType.js":
  23965. /*!********************************************!*\
  23966. !*** ./node_modules/antlr4/atn/ATNType.js ***!
  23967. \********************************************/
  23968. /*! no static exports found */
  23969. /***/ (function(module, exports, __webpack_require__) {
  23970. "use strict";
  23971. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  23972. * Use of this file is governed by the BSD 3-clause license that
  23973. * can be found in the LICENSE.txt file in the project root.
  23974. */
  23975. ///
  23976. // Represents the type of recognizer an ATN applies to.
  23977. function ATNType() {}
  23978. ATNType.LEXER = 0;
  23979. ATNType.PARSER = 1;
  23980. exports.ATNType = ATNType;
  23981. /***/ }),
  23982. /***/ "./node_modules/antlr4/atn/LexerATNSimulator.js":
  23983. /*!******************************************************!*\
  23984. !*** ./node_modules/antlr4/atn/LexerATNSimulator.js ***!
  23985. \******************************************************/
  23986. /*! no static exports found */
  23987. /***/ (function(module, exports, __webpack_require__) {
  23988. "use strict";
  23989. //
  23990. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  23991. * Use of this file is governed by the BSD 3-clause license that
  23992. * can be found in the LICENSE.txt file in the project root.
  23993. */
  23994. ///
  23995. // When we hit an accept state in either the DFA or the ATN, we
  23996. // have to notify the character stream to start buffering characters
  23997. // via {@link IntStream//mark} and record the current state. The current sim state
  23998. // includes the current index into the input, the current line,
  23999. // and current character position in that line. Note that the Lexer is
  24000. // tracking the starting line and characterization of the token. These
  24001. // variables track the "state" of the simulator when it hits an accept state.
  24002. //
  24003. // <p>We track these variables separately for the DFA and ATN simulation
  24004. // because the DFA simulation often has to fail over to the ATN
  24005. // simulation. If the ATN simulation fails, we need the DFA to fall
  24006. // back to its previously accepted state, if any. If the ATN succeeds,
  24007. // then the ATN does the accept and the DFA simulator that invoked it
  24008. // can simply return the predicted token type.</p>
  24009. ///
  24010. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  24011. var Lexer = __webpack_require__(/*! ./../Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  24012. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  24013. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  24014. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  24015. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  24016. var OrderedATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").OrderedATNConfigSet;
  24017. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  24018. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  24019. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  24020. var LexerATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").LexerATNConfig;
  24021. var Transition = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js").Transition;
  24022. var LexerActionExecutor = __webpack_require__(/*! ./LexerActionExecutor */ "./node_modules/antlr4/atn/LexerActionExecutor.js").LexerActionExecutor;
  24023. var LexerNoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  24024. function resetSimState(sim) {
  24025. sim.index = -1;
  24026. sim.line = 0;
  24027. sim.column = -1;
  24028. sim.dfaState = null;
  24029. }
  24030. function SimState() {
  24031. resetSimState(this);
  24032. return this;
  24033. }
  24034. SimState.prototype.reset = function () {
  24035. resetSimState(this);
  24036. };
  24037. function LexerATNSimulator(recog, atn, decisionToDFA, sharedContextCache) {
  24038. ATNSimulator.call(this, atn, sharedContextCache);
  24039. this.decisionToDFA = decisionToDFA;
  24040. this.recog = recog;
  24041. // The current token's starting index into the character stream.
  24042. // Shared across DFA to ATN simulation in case the ATN fails and the
  24043. // DFA did not have a previous accept state. In this case, we use the
  24044. // ATN-generated exception object.
  24045. this.startIndex = -1;
  24046. // line number 1..n within the input///
  24047. this.line = 1;
  24048. // The index of the character relative to the beginning of the line
  24049. // 0..n-1///
  24050. this.column = 0;
  24051. this.mode = Lexer.DEFAULT_MODE;
  24052. // Used during DFA/ATN exec to record the most recent accept configuration
  24053. // info
  24054. this.prevAccept = new SimState();
  24055. // done
  24056. return this;
  24057. }
  24058. LexerATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  24059. LexerATNSimulator.prototype.constructor = LexerATNSimulator;
  24060. LexerATNSimulator.debug = false;
  24061. LexerATNSimulator.dfa_debug = false;
  24062. LexerATNSimulator.MIN_DFA_EDGE = 0;
  24063. LexerATNSimulator.MAX_DFA_EDGE = 127; // forces unicode to stay in ATN
  24064. LexerATNSimulator.match_calls = 0;
  24065. LexerATNSimulator.prototype.copyState = function (simulator) {
  24066. this.column = simulator.column;
  24067. this.line = simulator.line;
  24068. this.mode = simulator.mode;
  24069. this.startIndex = simulator.startIndex;
  24070. };
  24071. LexerATNSimulator.prototype.match = function (input, mode) {
  24072. this.match_calls += 1;
  24073. this.mode = mode;
  24074. var mark = input.mark();
  24075. try {
  24076. this.startIndex = input.index;
  24077. this.prevAccept.reset();
  24078. var dfa = this.decisionToDFA[mode];
  24079. if (dfa.s0 === null) {
  24080. return this.matchATN(input);
  24081. } else {
  24082. return this.execATN(input, dfa.s0);
  24083. }
  24084. } finally {
  24085. input.release(mark);
  24086. }
  24087. };
  24088. LexerATNSimulator.prototype.reset = function () {
  24089. this.prevAccept.reset();
  24090. this.startIndex = -1;
  24091. this.line = 1;
  24092. this.column = 0;
  24093. this.mode = Lexer.DEFAULT_MODE;
  24094. };
  24095. LexerATNSimulator.prototype.matchATN = function (input) {
  24096. var startState = this.atn.modeToStartState[this.mode];
  24097. if (LexerATNSimulator.debug) {
  24098. console.log("matchATN mode " + this.mode + " start: " + startState);
  24099. }
  24100. var old_mode = this.mode;
  24101. var s0_closure = this.computeStartState(input, startState);
  24102. var suppressEdge = s0_closure.hasSemanticContext;
  24103. s0_closure.hasSemanticContext = false;
  24104. var next = this.addDFAState(s0_closure);
  24105. if (!suppressEdge) {
  24106. this.decisionToDFA[this.mode].s0 = next;
  24107. }
  24108. var predict = this.execATN(input, next);
  24109. if (LexerATNSimulator.debug) {
  24110. console.log("DFA after matchATN: " + this.decisionToDFA[old_mode].toLexerString());
  24111. }
  24112. return predict;
  24113. };
  24114. LexerATNSimulator.prototype.execATN = function (input, ds0) {
  24115. if (LexerATNSimulator.debug) {
  24116. console.log("start state closure=" + ds0.configs);
  24117. }
  24118. if (ds0.isAcceptState) {
  24119. // allow zero-length tokens
  24120. this.captureSimState(this.prevAccept, input, ds0);
  24121. }
  24122. var t = input.LA(1);
  24123. var s = ds0; // s is current/from DFA state
  24124. while (true) {
  24125. // while more work
  24126. if (LexerATNSimulator.debug) {
  24127. console.log("execATN loop starting closure: " + s.configs);
  24128. }
  24129. // As we move src->trg, src->trg, we keep track of the previous trg to
  24130. // avoid looking up the DFA state again, which is expensive.
  24131. // If the previous target was already part of the DFA, we might
  24132. // be able to avoid doing a reach operation upon t. If s!=null,
  24133. // it means that semantic predicates didn't prevent us from
  24134. // creating a DFA state. Once we know s!=null, we check to see if
  24135. // the DFA state has an edge already for t. If so, we can just reuse
  24136. // it's configuration set; there's no point in re-computing it.
  24137. // This is kind of like doing DFA simulation within the ATN
  24138. // simulation because DFA simulation is really just a way to avoid
  24139. // computing reach/closure sets. Technically, once we know that
  24140. // we have a previously added DFA state, we could jump over to
  24141. // the DFA simulator. But, that would mean popping back and forth
  24142. // a lot and making things more complicated algorithmically.
  24143. // This optimization makes a lot of sense for loops within DFA.
  24144. // A character will take us back to an existing DFA state
  24145. // that already has lots of edges out of it. e.g., .* in comments.
  24146. // print("Target for:" + str(s) + " and:" + str(t))
  24147. var target = this.getExistingTargetState(s, t);
  24148. // print("Existing:" + str(target))
  24149. if (target === null) {
  24150. target = this.computeTargetState(input, s, t);
  24151. // print("Computed:" + str(target))
  24152. }
  24153. if (target === ATNSimulator.ERROR) {
  24154. break;
  24155. }
  24156. // If this is a consumable input element, make sure to consume before
  24157. // capturing the accept state so the input index, line, and char
  24158. // position accurately reflect the state of the interpreter at the
  24159. // end of the token.
  24160. if (t !== Token.EOF) {
  24161. this.consume(input);
  24162. }
  24163. if (target.isAcceptState) {
  24164. this.captureSimState(this.prevAccept, input, target);
  24165. if (t === Token.EOF) {
  24166. break;
  24167. }
  24168. }
  24169. t = input.LA(1);
  24170. s = target; // flip; current DFA target becomes new src/from state
  24171. }
  24172. return this.failOrAccept(this.prevAccept, input, s.configs, t);
  24173. };
  24174. // Get an existing target state for an edge in the DFA. If the target state
  24175. // for the edge has not yet been computed or is otherwise not available,
  24176. // this method returns {@code null}.
  24177. //
  24178. // @param s The current DFA state
  24179. // @param t The next input symbol
  24180. // @return The existing target DFA state for the given input symbol
  24181. // {@code t}, or {@code null} if the target state for this edge is not
  24182. // already cached
  24183. LexerATNSimulator.prototype.getExistingTargetState = function (s, t) {
  24184. if (s.edges === null || t < LexerATNSimulator.MIN_DFA_EDGE || t > LexerATNSimulator.MAX_DFA_EDGE) {
  24185. return null;
  24186. }
  24187. var target = s.edges[t - LexerATNSimulator.MIN_DFA_EDGE];
  24188. if (target === undefined) {
  24189. target = null;
  24190. }
  24191. if (LexerATNSimulator.debug && target !== null) {
  24192. console.log("reuse state " + s.stateNumber + " edge to " + target.stateNumber);
  24193. }
  24194. return target;
  24195. };
  24196. // Compute a target state for an edge in the DFA, and attempt to add the
  24197. // computed state and corresponding edge to the DFA.
  24198. //
  24199. // @param input The input stream
  24200. // @param s The current DFA state
  24201. // @param t The next input symbol
  24202. //
  24203. // @return The computed target DFA state for the given input symbol
  24204. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  24205. // returns {@link //ERROR}.
  24206. LexerATNSimulator.prototype.computeTargetState = function (input, s, t) {
  24207. var reach = new OrderedATNConfigSet();
  24208. // if we don't find an existing DFA state
  24209. // Fill reach starting from closure, following t transitions
  24210. this.getReachableConfigSet(input, s.configs, reach, t);
  24211. if (reach.items.length === 0) {
  24212. // we got nowhere on t from s
  24213. if (!reach.hasSemanticContext) {
  24214. // we got nowhere on t, don't throw out this knowledge; it'd
  24215. // cause a failover from DFA later.
  24216. this.addDFAEdge(s, t, ATNSimulator.ERROR);
  24217. }
  24218. // stop when we can't match any more char
  24219. return ATNSimulator.ERROR;
  24220. }
  24221. // Add an edge from s to target DFA found/created for reach
  24222. return this.addDFAEdge(s, t, null, reach);
  24223. };
  24224. LexerATNSimulator.prototype.failOrAccept = function (prevAccept, input, reach, t) {
  24225. if (this.prevAccept.dfaState !== null) {
  24226. var lexerActionExecutor = prevAccept.dfaState.lexerActionExecutor;
  24227. this.accept(input, lexerActionExecutor, this.startIndex, prevAccept.index, prevAccept.line, prevAccept.column);
  24228. return prevAccept.dfaState.prediction;
  24229. } else {
  24230. // if no accept and EOF is first char, return EOF
  24231. if (t === Token.EOF && input.index === this.startIndex) {
  24232. return Token.EOF;
  24233. }
  24234. throw new LexerNoViableAltException(this.recog, input, this.startIndex, reach);
  24235. }
  24236. };
  24237. // Given a starting configuration set, figure out all ATN configurations
  24238. // we can reach upon input {@code t}. Parameter {@code reach} is a return
  24239. // parameter.
  24240. LexerATNSimulator.prototype.getReachableConfigSet = function (input, closure, reach, t) {
  24241. // this is used to skip processing for configs which have a lower priority
  24242. // than a config that already reached an accept state for the same rule
  24243. var skipAlt = ATN.INVALID_ALT_NUMBER;
  24244. for (var i = 0; i < closure.items.length; i++) {
  24245. var cfg = closure.items[i];
  24246. var currentAltReachedAcceptState = cfg.alt === skipAlt;
  24247. if (currentAltReachedAcceptState && cfg.passedThroughNonGreedyDecision) {
  24248. continue;
  24249. }
  24250. if (LexerATNSimulator.debug) {
  24251. console.log("testing %s at %s\n", this.getTokenName(t), cfg.toString(this.recog, true));
  24252. }
  24253. for (var j = 0; j < cfg.state.transitions.length; j++) {
  24254. var trans = cfg.state.transitions[j]; // for each transition
  24255. var target = this.getReachableTarget(trans, t);
  24256. if (target !== null) {
  24257. var lexerActionExecutor = cfg.lexerActionExecutor;
  24258. if (lexerActionExecutor !== null) {
  24259. lexerActionExecutor = lexerActionExecutor.fixOffsetBeforeMatch(input.index - this.startIndex);
  24260. }
  24261. var treatEofAsEpsilon = t === Token.EOF;
  24262. var config = new LexerATNConfig({ state: target, lexerActionExecutor: lexerActionExecutor }, cfg);
  24263. if (this.closure(input, config, reach, currentAltReachedAcceptState, true, treatEofAsEpsilon)) {
  24264. // any remaining configs for this alt have a lower priority
  24265. // than the one that just reached an accept state.
  24266. skipAlt = cfg.alt;
  24267. }
  24268. }
  24269. }
  24270. }
  24271. };
  24272. LexerATNSimulator.prototype.accept = function (input, lexerActionExecutor, startIndex, index, line, charPos) {
  24273. if (LexerATNSimulator.debug) {
  24274. console.log("ACTION %s\n", lexerActionExecutor);
  24275. }
  24276. // seek to after last char in token
  24277. input.seek(index);
  24278. this.line = line;
  24279. this.column = charPos;
  24280. if (lexerActionExecutor !== null && this.recog !== null) {
  24281. lexerActionExecutor.execute(this.recog, input, startIndex);
  24282. }
  24283. };
  24284. LexerATNSimulator.prototype.getReachableTarget = function (trans, t) {
  24285. if (trans.matches(t, 0, Lexer.MAX_CHAR_VALUE)) {
  24286. return trans.target;
  24287. } else {
  24288. return null;
  24289. }
  24290. };
  24291. LexerATNSimulator.prototype.computeStartState = function (input, p) {
  24292. var initialContext = PredictionContext.EMPTY;
  24293. var configs = new OrderedATNConfigSet();
  24294. for (var i = 0; i < p.transitions.length; i++) {
  24295. var target = p.transitions[i].target;
  24296. var cfg = new LexerATNConfig({ state: target, alt: i + 1, context: initialContext }, null);
  24297. this.closure(input, cfg, configs, false, false, false);
  24298. }
  24299. return configs;
  24300. };
  24301. // Since the alternatives within any lexer decision are ordered by
  24302. // preference, this method stops pursuing the closure as soon as an accept
  24303. // state is reached. After the first accept state is reached by depth-first
  24304. // search from {@code config}, all other (potentially reachable) states for
  24305. // this rule would have a lower priority.
  24306. //
  24307. // @return {@code true} if an accept state is reached, otherwise
  24308. // {@code false}.
  24309. LexerATNSimulator.prototype.closure = function (input, config, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon) {
  24310. var cfg = null;
  24311. if (LexerATNSimulator.debug) {
  24312. console.log("closure(" + config.toString(this.recog, true) + ")");
  24313. }
  24314. if (config.state instanceof RuleStopState) {
  24315. if (LexerATNSimulator.debug) {
  24316. if (this.recog !== null) {
  24317. console.log("closure at %s rule stop %s\n", this.recog.ruleNames[config.state.ruleIndex], config);
  24318. } else {
  24319. console.log("closure at rule stop %s\n", config);
  24320. }
  24321. }
  24322. if (config.context === null || config.context.hasEmptyPath()) {
  24323. if (config.context === null || config.context.isEmpty()) {
  24324. configs.add(config);
  24325. return true;
  24326. } else {
  24327. configs.add(new LexerATNConfig({ state: config.state, context: PredictionContext.EMPTY }, config));
  24328. currentAltReachedAcceptState = true;
  24329. }
  24330. }
  24331. if (config.context !== null && !config.context.isEmpty()) {
  24332. for (var i = 0; i < config.context.length; i++) {
  24333. if (config.context.getReturnState(i) !== PredictionContext.EMPTY_RETURN_STATE) {
  24334. var newContext = config.context.getParent(i); // "pop" return state
  24335. var returnState = this.atn.states[config.context.getReturnState(i)];
  24336. cfg = new LexerATNConfig({ state: returnState, context: newContext }, config);
  24337. currentAltReachedAcceptState = this.closure(input, cfg, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  24338. }
  24339. }
  24340. }
  24341. return currentAltReachedAcceptState;
  24342. }
  24343. // optimization
  24344. if (!config.state.epsilonOnlyTransitions) {
  24345. if (!currentAltReachedAcceptState || !config.passedThroughNonGreedyDecision) {
  24346. configs.add(config);
  24347. }
  24348. }
  24349. for (var j = 0; j < config.state.transitions.length; j++) {
  24350. var trans = config.state.transitions[j];
  24351. cfg = this.getEpsilonTarget(input, config, trans, configs, speculative, treatEofAsEpsilon);
  24352. if (cfg !== null) {
  24353. currentAltReachedAcceptState = this.closure(input, cfg, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  24354. }
  24355. }
  24356. return currentAltReachedAcceptState;
  24357. };
  24358. // side-effect: can alter configs.hasSemanticContext
  24359. LexerATNSimulator.prototype.getEpsilonTarget = function (input, config, trans, configs, speculative, treatEofAsEpsilon) {
  24360. var cfg = null;
  24361. if (trans.serializationType === Transition.RULE) {
  24362. var newContext = SingletonPredictionContext.create(config.context, trans.followState.stateNumber);
  24363. cfg = new LexerATNConfig({ state: trans.target, context: newContext }, config);
  24364. } else if (trans.serializationType === Transition.PRECEDENCE) {
  24365. throw "Precedence predicates are not supported in lexers.";
  24366. } else if (trans.serializationType === Transition.PREDICATE) {
  24367. // Track traversing semantic predicates. If we traverse,
  24368. // we cannot add a DFA state for this "reach" computation
  24369. // because the DFA would not test the predicate again in the
  24370. // future. Rather than creating collections of semantic predicates
  24371. // like v3 and testing them on prediction, v4 will test them on the
  24372. // fly all the time using the ATN not the DFA. This is slower but
  24373. // semantically it's not used that often. One of the key elements to
  24374. // this predicate mechanism is not adding DFA states that see
  24375. // predicates immediately afterwards in the ATN. For example,
  24376. // a : ID {p1}? | ID {p2}? ;
  24377. // should create the start state for rule 'a' (to save start state
  24378. // competition), but should not create target of ID state. The
  24379. // collection of ATN states the following ID references includes
  24380. // states reached by traversing predicates. Since this is when we
  24381. // test them, we cannot cash the DFA state target of ID.
  24382. if (LexerATNSimulator.debug) {
  24383. console.log("EVAL rule " + trans.ruleIndex + ":" + trans.predIndex);
  24384. }
  24385. configs.hasSemanticContext = true;
  24386. if (this.evaluatePredicate(input, trans.ruleIndex, trans.predIndex, speculative)) {
  24387. cfg = new LexerATNConfig({ state: trans.target }, config);
  24388. }
  24389. } else if (trans.serializationType === Transition.ACTION) {
  24390. if (config.context === null || config.context.hasEmptyPath()) {
  24391. // execute actions anywhere in the start rule for a token.
  24392. //
  24393. // TODO: if the entry rule is invoked recursively, some
  24394. // actions may be executed during the recursive call. The
  24395. // problem can appear when hasEmptyPath() is true but
  24396. // isEmpty() is false. In this case, the config needs to be
  24397. // split into two contexts - one with just the empty path
  24398. // and another with everything but the empty path.
  24399. // Unfortunately, the current algorithm does not allow
  24400. // getEpsilonTarget to return two configurations, so
  24401. // additional modifications are needed before we can support
  24402. // the split operation.
  24403. var lexerActionExecutor = LexerActionExecutor.append(config.lexerActionExecutor, this.atn.lexerActions[trans.actionIndex]);
  24404. cfg = new LexerATNConfig({ state: trans.target, lexerActionExecutor: lexerActionExecutor }, config);
  24405. } else {
  24406. // ignore actions in referenced rules
  24407. cfg = new LexerATNConfig({ state: trans.target }, config);
  24408. }
  24409. } else if (trans.serializationType === Transition.EPSILON) {
  24410. cfg = new LexerATNConfig({ state: trans.target }, config);
  24411. } else if (trans.serializationType === Transition.ATOM || trans.serializationType === Transition.RANGE || trans.serializationType === Transition.SET) {
  24412. if (treatEofAsEpsilon) {
  24413. if (trans.matches(Token.EOF, 0, Lexer.MAX_CHAR_VALUE)) {
  24414. cfg = new LexerATNConfig({ state: trans.target }, config);
  24415. }
  24416. }
  24417. }
  24418. return cfg;
  24419. };
  24420. // Evaluate a predicate specified in the lexer.
  24421. //
  24422. // <p>If {@code speculative} is {@code true}, this method was called before
  24423. // {@link //consume} for the matched character. This method should call
  24424. // {@link //consume} before evaluating the predicate to ensure position
  24425. // sensitive values, including {@link Lexer//getText}, {@link Lexer//getLine},
  24426. // and {@link Lexer//getcolumn}, properly reflect the current
  24427. // lexer state. This method should restore {@code input} and the simulator
  24428. // to the original state before returning (i.e. undo the actions made by the
  24429. // call to {@link //consume}.</p>
  24430. //
  24431. // @param input The input stream.
  24432. // @param ruleIndex The rule containing the predicate.
  24433. // @param predIndex The index of the predicate within the rule.
  24434. // @param speculative {@code true} if the current index in {@code input} is
  24435. // one character before the predicate's location.
  24436. //
  24437. // @return {@code true} if the specified predicate evaluates to
  24438. // {@code true}.
  24439. // /
  24440. LexerATNSimulator.prototype.evaluatePredicate = function (input, ruleIndex, predIndex, speculative) {
  24441. // assume true if no recognizer was provided
  24442. if (this.recog === null) {
  24443. return true;
  24444. }
  24445. if (!speculative) {
  24446. return this.recog.sempred(null, ruleIndex, predIndex);
  24447. }
  24448. var savedcolumn = this.column;
  24449. var savedLine = this.line;
  24450. var index = input.index;
  24451. var marker = input.mark();
  24452. try {
  24453. this.consume(input);
  24454. return this.recog.sempred(null, ruleIndex, predIndex);
  24455. } finally {
  24456. this.column = savedcolumn;
  24457. this.line = savedLine;
  24458. input.seek(index);
  24459. input.release(marker);
  24460. }
  24461. };
  24462. LexerATNSimulator.prototype.captureSimState = function (settings, input, dfaState) {
  24463. settings.index = input.index;
  24464. settings.line = this.line;
  24465. settings.column = this.column;
  24466. settings.dfaState = dfaState;
  24467. };
  24468. LexerATNSimulator.prototype.addDFAEdge = function (from_, tk, to, cfgs) {
  24469. if (to === undefined) {
  24470. to = null;
  24471. }
  24472. if (cfgs === undefined) {
  24473. cfgs = null;
  24474. }
  24475. if (to === null && cfgs !== null) {
  24476. // leading to this call, ATNConfigSet.hasSemanticContext is used as a
  24477. // marker indicating dynamic predicate evaluation makes this edge
  24478. // dependent on the specific input sequence, so the static edge in the
  24479. // DFA should be omitted. The target DFAState is still created since
  24480. // execATN has the ability to resynchronize with the DFA state cache
  24481. // following the predicate evaluation step.
  24482. //
  24483. // TJP notes: next time through the DFA, we see a pred again and eval.
  24484. // If that gets us to a previously created (but dangling) DFA
  24485. // state, we can continue in pure DFA mode from there.
  24486. // /
  24487. var suppressEdge = cfgs.hasSemanticContext;
  24488. cfgs.hasSemanticContext = false;
  24489. to = this.addDFAState(cfgs);
  24490. if (suppressEdge) {
  24491. return to;
  24492. }
  24493. }
  24494. // add the edge
  24495. if (tk < LexerATNSimulator.MIN_DFA_EDGE || tk > LexerATNSimulator.MAX_DFA_EDGE) {
  24496. // Only track edges within the DFA bounds
  24497. return to;
  24498. }
  24499. if (LexerATNSimulator.debug) {
  24500. console.log("EDGE " + from_ + " -> " + to + " upon " + tk);
  24501. }
  24502. if (from_.edges === null) {
  24503. // make room for tokens 1..n and -1 masquerading as index 0
  24504. from_.edges = [];
  24505. }
  24506. from_.edges[tk - LexerATNSimulator.MIN_DFA_EDGE] = to; // connect
  24507. return to;
  24508. };
  24509. // Add a new DFA state if there isn't one with this set of
  24510. // configurations already. This method also detects the first
  24511. // configuration containing an ATN rule stop state. Later, when
  24512. // traversing the DFA, we will know which rule to accept.
  24513. LexerATNSimulator.prototype.addDFAState = function (configs) {
  24514. var proposed = new DFAState(null, configs);
  24515. var firstConfigWithRuleStopState = null;
  24516. for (var i = 0; i < configs.items.length; i++) {
  24517. var cfg = configs.items[i];
  24518. if (cfg.state instanceof RuleStopState) {
  24519. firstConfigWithRuleStopState = cfg;
  24520. break;
  24521. }
  24522. }
  24523. if (firstConfigWithRuleStopState !== null) {
  24524. proposed.isAcceptState = true;
  24525. proposed.lexerActionExecutor = firstConfigWithRuleStopState.lexerActionExecutor;
  24526. proposed.prediction = this.atn.ruleToTokenType[firstConfigWithRuleStopState.state.ruleIndex];
  24527. }
  24528. var dfa = this.decisionToDFA[this.mode];
  24529. var existing = dfa.states.get(proposed);
  24530. if (existing !== null) {
  24531. return existing;
  24532. }
  24533. var newState = proposed;
  24534. newState.stateNumber = dfa.states.length;
  24535. configs.setReadonly(true);
  24536. newState.configs = configs;
  24537. dfa.states.add(newState);
  24538. return newState;
  24539. };
  24540. LexerATNSimulator.prototype.getDFA = function (mode) {
  24541. return this.decisionToDFA[mode];
  24542. };
  24543. // Get the text matched so far for the current token.
  24544. LexerATNSimulator.prototype.getText = function (input) {
  24545. // index is first lookahead char, don't include.
  24546. return input.getText(this.startIndex, input.index - 1);
  24547. };
  24548. LexerATNSimulator.prototype.consume = function (input) {
  24549. var curChar = input.LA(1);
  24550. if (curChar === "\n".charCodeAt(0)) {
  24551. this.line += 1;
  24552. this.column = 0;
  24553. } else {
  24554. this.column += 1;
  24555. }
  24556. input.consume();
  24557. };
  24558. LexerATNSimulator.prototype.getTokenName = function (tt) {
  24559. if (tt === -1) {
  24560. return "EOF";
  24561. } else {
  24562. return "'" + String.fromCharCode(tt) + "'";
  24563. }
  24564. };
  24565. exports.LexerATNSimulator = LexerATNSimulator;
  24566. /***/ }),
  24567. /***/ "./node_modules/antlr4/atn/LexerAction.js":
  24568. /*!************************************************!*\
  24569. !*** ./node_modules/antlr4/atn/LexerAction.js ***!
  24570. \************************************************/
  24571. /*! no static exports found */
  24572. /***/ (function(module, exports, __webpack_require__) {
  24573. "use strict";
  24574. //
  24575. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24576. * Use of this file is governed by the BSD 3-clause license that
  24577. * can be found in the LICENSE.txt file in the project root.
  24578. */
  24579. //
  24580. function LexerActionType() {}
  24581. LexerActionType.CHANNEL = 0; //The type of a {@link LexerChannelAction} action.
  24582. LexerActionType.CUSTOM = 1; //The type of a {@link LexerCustomAction} action.
  24583. LexerActionType.MODE = 2; //The type of a {@link LexerModeAction} action.
  24584. LexerActionType.MORE = 3; //The type of a {@link LexerMoreAction} action.
  24585. LexerActionType.POP_MODE = 4; //The type of a {@link LexerPopModeAction} action.
  24586. LexerActionType.PUSH_MODE = 5; //The type of a {@link LexerPushModeAction} action.
  24587. LexerActionType.SKIP = 6; //The type of a {@link LexerSkipAction} action.
  24588. LexerActionType.TYPE = 7; //The type of a {@link LexerTypeAction} action.
  24589. function LexerAction(action) {
  24590. this.actionType = action;
  24591. this.isPositionDependent = false;
  24592. return this;
  24593. }
  24594. LexerAction.prototype.hashCode = function () {
  24595. var hash = new Hash();
  24596. this.updateHashCode(hash);
  24597. return hash.finish();
  24598. };
  24599. LexerAction.prototype.updateHashCode = function (hash) {
  24600. hash.update(this.actionType);
  24601. };
  24602. LexerAction.prototype.equals = function (other) {
  24603. return this === other;
  24604. };
  24605. //
  24606. // Implements the {@code skip} lexer action by calling {@link Lexer//skip}.
  24607. //
  24608. // <p>The {@code skip} command does not have any parameters, so this action is
  24609. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  24610. function LexerSkipAction() {
  24611. LexerAction.call(this, LexerActionType.SKIP);
  24612. return this;
  24613. }
  24614. LexerSkipAction.prototype = Object.create(LexerAction.prototype);
  24615. LexerSkipAction.prototype.constructor = LexerSkipAction;
  24616. // Provides a singleton instance of this parameterless lexer action.
  24617. LexerSkipAction.INSTANCE = new LexerSkipAction();
  24618. LexerSkipAction.prototype.execute = function (lexer) {
  24619. lexer.skip();
  24620. };
  24621. LexerSkipAction.prototype.toString = function () {
  24622. return "skip";
  24623. };
  24624. // Implements the {@code type} lexer action by calling {@link Lexer//setType}
  24625. // with the assigned type.
  24626. function LexerTypeAction(type) {
  24627. LexerAction.call(this, LexerActionType.TYPE);
  24628. this.type = type;
  24629. return this;
  24630. }
  24631. LexerTypeAction.prototype = Object.create(LexerAction.prototype);
  24632. LexerTypeAction.prototype.constructor = LexerTypeAction;
  24633. LexerTypeAction.prototype.execute = function (lexer) {
  24634. lexer.type = this.type;
  24635. };
  24636. LexerTypeAction.prototype.updateHashCode = function (hash) {
  24637. hash.update(this.actionType, this.type);
  24638. };
  24639. LexerTypeAction.prototype.equals = function (other) {
  24640. if (this === other) {
  24641. return true;
  24642. } else if (!(other instanceof LexerTypeAction)) {
  24643. return false;
  24644. } else {
  24645. return this.type === other.type;
  24646. }
  24647. };
  24648. LexerTypeAction.prototype.toString = function () {
  24649. return "type(" + this.type + ")";
  24650. };
  24651. // Implements the {@code pushMode} lexer action by calling
  24652. // {@link Lexer//pushMode} with the assigned mode.
  24653. function LexerPushModeAction(mode) {
  24654. LexerAction.call(this, LexerActionType.PUSH_MODE);
  24655. this.mode = mode;
  24656. return this;
  24657. }
  24658. LexerPushModeAction.prototype = Object.create(LexerAction.prototype);
  24659. LexerPushModeAction.prototype.constructor = LexerPushModeAction;
  24660. // <p>This action is implemented by calling {@link Lexer//pushMode} with the
  24661. // value provided by {@link //getMode}.</p>
  24662. LexerPushModeAction.prototype.execute = function (lexer) {
  24663. lexer.pushMode(this.mode);
  24664. };
  24665. LexerPushModeAction.prototype.updateHashCode = function (hash) {
  24666. hash.update(this.actionType, this.mode);
  24667. };
  24668. LexerPushModeAction.prototype.equals = function (other) {
  24669. if (this === other) {
  24670. return true;
  24671. } else if (!(other instanceof LexerPushModeAction)) {
  24672. return false;
  24673. } else {
  24674. return this.mode === other.mode;
  24675. }
  24676. };
  24677. LexerPushModeAction.prototype.toString = function () {
  24678. return "pushMode(" + this.mode + ")";
  24679. };
  24680. // Implements the {@code popMode} lexer action by calling {@link Lexer//popMode}.
  24681. //
  24682. // <p>The {@code popMode} command does not have any parameters, so this action is
  24683. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  24684. function LexerPopModeAction() {
  24685. LexerAction.call(this, LexerActionType.POP_MODE);
  24686. return this;
  24687. }
  24688. LexerPopModeAction.prototype = Object.create(LexerAction.prototype);
  24689. LexerPopModeAction.prototype.constructor = LexerPopModeAction;
  24690. LexerPopModeAction.INSTANCE = new LexerPopModeAction();
  24691. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  24692. LexerPopModeAction.prototype.execute = function (lexer) {
  24693. lexer.popMode();
  24694. };
  24695. LexerPopModeAction.prototype.toString = function () {
  24696. return "popMode";
  24697. };
  24698. // Implements the {@code more} lexer action by calling {@link Lexer//more}.
  24699. //
  24700. // <p>The {@code more} command does not have any parameters, so this action is
  24701. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  24702. function LexerMoreAction() {
  24703. LexerAction.call(this, LexerActionType.MORE);
  24704. return this;
  24705. }
  24706. LexerMoreAction.prototype = Object.create(LexerAction.prototype);
  24707. LexerMoreAction.prototype.constructor = LexerMoreAction;
  24708. LexerMoreAction.INSTANCE = new LexerMoreAction();
  24709. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  24710. LexerMoreAction.prototype.execute = function (lexer) {
  24711. lexer.more();
  24712. };
  24713. LexerMoreAction.prototype.toString = function () {
  24714. return "more";
  24715. };
  24716. // Implements the {@code mode} lexer action by calling {@link Lexer//mode} with
  24717. // the assigned mode.
  24718. function LexerModeAction(mode) {
  24719. LexerAction.call(this, LexerActionType.MODE);
  24720. this.mode = mode;
  24721. return this;
  24722. }
  24723. LexerModeAction.prototype = Object.create(LexerAction.prototype);
  24724. LexerModeAction.prototype.constructor = LexerModeAction;
  24725. // <p>This action is implemented by calling {@link Lexer//mode} with the
  24726. // value provided by {@link //getMode}.</p>
  24727. LexerModeAction.prototype.execute = function (lexer) {
  24728. lexer.mode(this.mode);
  24729. };
  24730. LexerModeAction.prototype.updateHashCode = function (hash) {
  24731. hash.update(this.actionType, this.mode);
  24732. };
  24733. LexerModeAction.prototype.equals = function (other) {
  24734. if (this === other) {
  24735. return true;
  24736. } else if (!(other instanceof LexerModeAction)) {
  24737. return false;
  24738. } else {
  24739. return this.mode === other.mode;
  24740. }
  24741. };
  24742. LexerModeAction.prototype.toString = function () {
  24743. return "mode(" + this.mode + ")";
  24744. };
  24745. // Executes a custom lexer action by calling {@link Recognizer//action} with the
  24746. // rule and action indexes assigned to the custom action. The implementation of
  24747. // a custom action is added to the generated code for the lexer in an override
  24748. // of {@link Recognizer//action} when the grammar is compiled.
  24749. //
  24750. // <p>This class may represent embedded actions created with the <code>{...}</code>
  24751. // syntax in ANTLR 4, as well as actions created for lexer commands where the
  24752. // command argument could not be evaluated when the grammar was compiled.</p>
  24753. // Constructs a custom lexer action with the specified rule and action
  24754. // indexes.
  24755. //
  24756. // @param ruleIndex The rule index to use for calls to
  24757. // {@link Recognizer//action}.
  24758. // @param actionIndex The action index to use for calls to
  24759. // {@link Recognizer//action}.
  24760. function LexerCustomAction(ruleIndex, actionIndex) {
  24761. LexerAction.call(this, LexerActionType.CUSTOM);
  24762. this.ruleIndex = ruleIndex;
  24763. this.actionIndex = actionIndex;
  24764. this.isPositionDependent = true;
  24765. return this;
  24766. }
  24767. LexerCustomAction.prototype = Object.create(LexerAction.prototype);
  24768. LexerCustomAction.prototype.constructor = LexerCustomAction;
  24769. // <p>Custom actions are implemented by calling {@link Lexer//action} with the
  24770. // appropriate rule and action indexes.</p>
  24771. LexerCustomAction.prototype.execute = function (lexer) {
  24772. lexer.action(null, this.ruleIndex, this.actionIndex);
  24773. };
  24774. LexerCustomAction.prototype.updateHashCode = function (hash) {
  24775. hash.update(this.actionType, this.ruleIndex, this.actionIndex);
  24776. };
  24777. LexerCustomAction.prototype.equals = function (other) {
  24778. if (this === other) {
  24779. return true;
  24780. } else if (!(other instanceof LexerCustomAction)) {
  24781. return false;
  24782. } else {
  24783. return this.ruleIndex === other.ruleIndex && this.actionIndex === other.actionIndex;
  24784. }
  24785. };
  24786. // Implements the {@code channel} lexer action by calling
  24787. // {@link Lexer//setChannel} with the assigned channel.
  24788. // Constructs a new {@code channel} action with the specified channel value.
  24789. // @param channel The channel value to pass to {@link Lexer//setChannel}.
  24790. function LexerChannelAction(channel) {
  24791. LexerAction.call(this, LexerActionType.CHANNEL);
  24792. this.channel = channel;
  24793. return this;
  24794. }
  24795. LexerChannelAction.prototype = Object.create(LexerAction.prototype);
  24796. LexerChannelAction.prototype.constructor = LexerChannelAction;
  24797. // <p>This action is implemented by calling {@link Lexer//setChannel} with the
  24798. // value provided by {@link //getChannel}.</p>
  24799. LexerChannelAction.prototype.execute = function (lexer) {
  24800. lexer._channel = this.channel;
  24801. };
  24802. LexerChannelAction.prototype.updateHashCode = function (hash) {
  24803. hash.update(this.actionType, this.channel);
  24804. };
  24805. LexerChannelAction.prototype.equals = function (other) {
  24806. if (this === other) {
  24807. return true;
  24808. } else if (!(other instanceof LexerChannelAction)) {
  24809. return false;
  24810. } else {
  24811. return this.channel === other.channel;
  24812. }
  24813. };
  24814. LexerChannelAction.prototype.toString = function () {
  24815. return "channel(" + this.channel + ")";
  24816. };
  24817. // This implementation of {@link LexerAction} is used for tracking input offsets
  24818. // for position-dependent actions within a {@link LexerActionExecutor}.
  24819. //
  24820. // <p>This action is not serialized as part of the ATN, and is only required for
  24821. // position-dependent lexer actions which appear at a location other than the
  24822. // end of a rule. For more information about DFA optimizations employed for
  24823. // lexer actions, see {@link LexerActionExecutor//append} and
  24824. // {@link LexerActionExecutor//fixOffsetBeforeMatch}.</p>
  24825. // Constructs a new indexed custom action by associating a character offset
  24826. // with a {@link LexerAction}.
  24827. //
  24828. // <p>Note: This class is only required for lexer actions for which
  24829. // {@link LexerAction//isPositionDependent} returns {@code true}.</p>
  24830. //
  24831. // @param offset The offset into the input {@link CharStream}, relative to
  24832. // the token start index, at which the specified lexer action should be
  24833. // executed.
  24834. // @param action The lexer action to execute at a particular offset in the
  24835. // input {@link CharStream}.
  24836. function LexerIndexedCustomAction(offset, action) {
  24837. LexerAction.call(this, action.actionType);
  24838. this.offset = offset;
  24839. this.action = action;
  24840. this.isPositionDependent = true;
  24841. return this;
  24842. }
  24843. LexerIndexedCustomAction.prototype = Object.create(LexerAction.prototype);
  24844. LexerIndexedCustomAction.prototype.constructor = LexerIndexedCustomAction;
  24845. // <p>This method calls {@link //execute} on the result of {@link //getAction}
  24846. // using the provided {@code lexer}.</p>
  24847. LexerIndexedCustomAction.prototype.execute = function (lexer) {
  24848. // assume the input stream position was properly set by the calling code
  24849. this.action.execute(lexer);
  24850. };
  24851. LexerIndexedCustomAction.prototype.updateHashCode = function (hash) {
  24852. hash.update(this.actionType, this.offset, this.action);
  24853. };
  24854. LexerIndexedCustomAction.prototype.equals = function (other) {
  24855. if (this === other) {
  24856. return true;
  24857. } else if (!(other instanceof LexerIndexedCustomAction)) {
  24858. return false;
  24859. } else {
  24860. return this.offset === other.offset && this.action === other.action;
  24861. }
  24862. };
  24863. exports.LexerActionType = LexerActionType;
  24864. exports.LexerSkipAction = LexerSkipAction;
  24865. exports.LexerChannelAction = LexerChannelAction;
  24866. exports.LexerCustomAction = LexerCustomAction;
  24867. exports.LexerIndexedCustomAction = LexerIndexedCustomAction;
  24868. exports.LexerMoreAction = LexerMoreAction;
  24869. exports.LexerTypeAction = LexerTypeAction;
  24870. exports.LexerPushModeAction = LexerPushModeAction;
  24871. exports.LexerPopModeAction = LexerPopModeAction;
  24872. exports.LexerModeAction = LexerModeAction;
  24873. /***/ }),
  24874. /***/ "./node_modules/antlr4/atn/LexerActionExecutor.js":
  24875. /*!********************************************************!*\
  24876. !*** ./node_modules/antlr4/atn/LexerActionExecutor.js ***!
  24877. \********************************************************/
  24878. /*! no static exports found */
  24879. /***/ (function(module, exports, __webpack_require__) {
  24880. "use strict";
  24881. //
  24882. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24883. * Use of this file is governed by the BSD 3-clause license that
  24884. * can be found in the LICENSE.txt file in the project root.
  24885. */
  24886. ///
  24887. // Represents an executor for a sequence of lexer actions which traversed during
  24888. // the matching operation of a lexer rule (token).
  24889. //
  24890. // <p>The executor tracks position information for position-dependent lexer actions
  24891. // efficiently, ensuring that actions appearing only at the end of the rule do
  24892. // not cause bloating of the {@link DFA} created for the lexer.</p>
  24893. var hashStuff = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  24894. var LexerIndexedCustomAction = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js").LexerIndexedCustomAction;
  24895. function LexerActionExecutor(lexerActions) {
  24896. this.lexerActions = lexerActions === null ? [] : lexerActions;
  24897. // Caches the result of {@link //hashCode} since the hash code is an element
  24898. // of the performance-critical {@link LexerATNConfig//hashCode} operation.
  24899. this.cachedHashCode = hashStuff(lexerActions); // "".join([str(la) for la in
  24900. // lexerActions]))
  24901. return this;
  24902. }
  24903. // Creates a {@link LexerActionExecutor} which executes the actions for
  24904. // the input {@code lexerActionExecutor} followed by a specified
  24905. // {@code lexerAction}.
  24906. //
  24907. // @param lexerActionExecutor The executor for actions already traversed by
  24908. // the lexer while matching a token within a particular
  24909. // {@link LexerATNConfig}. If this is {@code null}, the method behaves as
  24910. // though it were an empty executor.
  24911. // @param lexerAction The lexer action to execute after the actions
  24912. // specified in {@code lexerActionExecutor}.
  24913. //
  24914. // @return A {@link LexerActionExecutor} for executing the combine actions
  24915. // of {@code lexerActionExecutor} and {@code lexerAction}.
  24916. LexerActionExecutor.append = function (lexerActionExecutor, lexerAction) {
  24917. if (lexerActionExecutor === null) {
  24918. return new LexerActionExecutor([lexerAction]);
  24919. }
  24920. var lexerActions = lexerActionExecutor.lexerActions.concat([lexerAction]);
  24921. return new LexerActionExecutor(lexerActions);
  24922. };
  24923. // Creates a {@link LexerActionExecutor} which encodes the current offset
  24924. // for position-dependent lexer actions.
  24925. //
  24926. // <p>Normally, when the executor encounters lexer actions where
  24927. // {@link LexerAction//isPositionDependent} returns {@code true}, it calls
  24928. // {@link IntStream//seek} on the input {@link CharStream} to set the input
  24929. // position to the <em>end</em> of the current token. This behavior provides
  24930. // for efficient DFA representation of lexer actions which appear at the end
  24931. // of a lexer rule, even when the lexer rule matches a variable number of
  24932. // characters.</p>
  24933. //
  24934. // <p>Prior to traversing a match transition in the ATN, the current offset
  24935. // from the token start index is assigned to all position-dependent lexer
  24936. // actions which have not already been assigned a fixed offset. By storing
  24937. // the offsets relative to the token start index, the DFA representation of
  24938. // lexer actions which appear in the middle of tokens remains efficient due
  24939. // to sharing among tokens of the same length, regardless of their absolute
  24940. // position in the input stream.</p>
  24941. //
  24942. // <p>If the current executor already has offsets assigned to all
  24943. // position-dependent lexer actions, the method returns {@code this}.</p>
  24944. //
  24945. // @param offset The current offset to assign to all position-dependent
  24946. // lexer actions which do not already have offsets assigned.
  24947. //
  24948. // @return A {@link LexerActionExecutor} which stores input stream offsets
  24949. // for all position-dependent lexer actions.
  24950. // /
  24951. LexerActionExecutor.prototype.fixOffsetBeforeMatch = function (offset) {
  24952. var updatedLexerActions = null;
  24953. for (var i = 0; i < this.lexerActions.length; i++) {
  24954. if (this.lexerActions[i].isPositionDependent && !(this.lexerActions[i] instanceof LexerIndexedCustomAction)) {
  24955. if (updatedLexerActions === null) {
  24956. updatedLexerActions = this.lexerActions.concat([]);
  24957. }
  24958. updatedLexerActions[i] = new LexerIndexedCustomAction(offset, this.lexerActions[i]);
  24959. }
  24960. }
  24961. if (updatedLexerActions === null) {
  24962. return this;
  24963. } else {
  24964. return new LexerActionExecutor(updatedLexerActions);
  24965. }
  24966. };
  24967. // Execute the actions encapsulated by this executor within the context of a
  24968. // particular {@link Lexer}.
  24969. //
  24970. // <p>This method calls {@link IntStream//seek} to set the position of the
  24971. // {@code input} {@link CharStream} prior to calling
  24972. // {@link LexerAction//execute} on a position-dependent action. Before the
  24973. // method returns, the input position will be restored to the same position
  24974. // it was in when the method was invoked.</p>
  24975. //
  24976. // @param lexer The lexer instance.
  24977. // @param input The input stream which is the source for the current token.
  24978. // When this method is called, the current {@link IntStream//index} for
  24979. // {@code input} should be the start of the following token, i.e. 1
  24980. // character past the end of the current token.
  24981. // @param startIndex The token start index. This value may be passed to
  24982. // {@link IntStream//seek} to set the {@code input} position to the beginning
  24983. // of the token.
  24984. // /
  24985. LexerActionExecutor.prototype.execute = function (lexer, input, startIndex) {
  24986. var requiresSeek = false;
  24987. var stopIndex = input.index;
  24988. try {
  24989. for (var i = 0; i < this.lexerActions.length; i++) {
  24990. var lexerAction = this.lexerActions[i];
  24991. if (lexerAction instanceof LexerIndexedCustomAction) {
  24992. var offset = lexerAction.offset;
  24993. input.seek(startIndex + offset);
  24994. lexerAction = lexerAction.action;
  24995. requiresSeek = startIndex + offset !== stopIndex;
  24996. } else if (lexerAction.isPositionDependent) {
  24997. input.seek(stopIndex);
  24998. requiresSeek = false;
  24999. }
  25000. lexerAction.execute(lexer);
  25001. }
  25002. } finally {
  25003. if (requiresSeek) {
  25004. input.seek(stopIndex);
  25005. }
  25006. }
  25007. };
  25008. LexerActionExecutor.prototype.hashCode = function () {
  25009. return this.cachedHashCode;
  25010. };
  25011. LexerActionExecutor.prototype.updateHashCode = function (hash) {
  25012. hash.update(this.cachedHashCode);
  25013. };
  25014. LexerActionExecutor.prototype.equals = function (other) {
  25015. if (this === other) {
  25016. return true;
  25017. } else if (!(other instanceof LexerActionExecutor)) {
  25018. return false;
  25019. } else if (this.cachedHashCode != other.cachedHashCode) {
  25020. return false;
  25021. } else if (this.lexerActions.length != other.lexerActions.length) {
  25022. return false;
  25023. } else {
  25024. var numActions = this.lexerActions.length;
  25025. for (var idx = 0; idx < numActions; ++idx) {
  25026. if (!this.lexerActions[idx].equals(other.lexerActions[idx])) {
  25027. return false;
  25028. }
  25029. }
  25030. return true;
  25031. }
  25032. };
  25033. exports.LexerActionExecutor = LexerActionExecutor;
  25034. /***/ }),
  25035. /***/ "./node_modules/antlr4/atn/ParserATNSimulator.js":
  25036. /*!*******************************************************!*\
  25037. !*** ./node_modules/antlr4/atn/ParserATNSimulator.js ***!
  25038. \*******************************************************/
  25039. /*! no static exports found */
  25040. /***/ (function(module, exports, __webpack_require__) {
  25041. "use strict";
  25042. //
  25043. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25044. * Use of this file is governed by the BSD 3-clause license that
  25045. * can be found in the LICENSE.txt file in the project root.
  25046. */
  25047. //
  25048. //
  25049. // The embodiment of the adaptive LL(*), ALL(*), parsing strategy.
  25050. //
  25051. // <p>
  25052. // The basic complexity of the adaptive strategy makes it harder to understand.
  25053. // We begin with ATN simulation to build paths in a DFA. Subsequent prediction
  25054. // requests go through the DFA first. If they reach a state without an edge for
  25055. // the current symbol, the algorithm fails over to the ATN simulation to
  25056. // complete the DFA path for the current input (until it finds a conflict state
  25057. // or uniquely predicting state).</p>
  25058. //
  25059. // <p>
  25060. // All of that is done without using the outer context because we want to create
  25061. // a DFA that is not dependent upon the rule invocation stack when we do a
  25062. // prediction. One DFA works in all contexts. We avoid using context not
  25063. // necessarily because it's slower, although it can be, but because of the DFA
  25064. // caching problem. The closure routine only considers the rule invocation stack
  25065. // created during prediction beginning in the decision rule. For example, if
  25066. // prediction occurs without invoking another rule's ATN, there are no context
  25067. // stacks in the configurations. When lack of context leads to a conflict, we
  25068. // don't know if it's an ambiguity or a weakness in the strong LL(*) parsing
  25069. // strategy (versus full LL(*)).</p>
  25070. //
  25071. // <p>
  25072. // When SLL yields a configuration set with conflict, we rewind the input and
  25073. // retry the ATN simulation, this time using full outer context without adding
  25074. // to the DFA. Configuration context stacks will be the full invocation stacks
  25075. // from the start rule. If we get a conflict using full context, then we can
  25076. // definitively say we have a true ambiguity for that input sequence. If we
  25077. // don't get a conflict, it implies that the decision is sensitive to the outer
  25078. // context. (It is not context-sensitive in the sense of context-sensitive
  25079. // grammars.)</p>
  25080. //
  25081. // <p>
  25082. // The next time we reach this DFA state with an SLL conflict, through DFA
  25083. // simulation, we will again retry the ATN simulation using full context mode.
  25084. // This is slow because we can't save the results and have to "interpret" the
  25085. // ATN each time we get that input.</p>
  25086. //
  25087. // <p>
  25088. // <strong>CACHING FULL CONTEXT PREDICTIONS</strong></p>
  25089. //
  25090. // <p>
  25091. // We could cache results from full context to predicted alternative easily and
  25092. // that saves a lot of time but doesn't work in presence of predicates. The set
  25093. // of visible predicates from the ATN start state changes depending on the
  25094. // context, because closure can fall off the end of a rule. I tried to cache
  25095. // tuples (stack context, semantic context, predicted alt) but it was slower
  25096. // than interpreting and much more complicated. Also required a huge amount of
  25097. // memory. The goal is not to create the world's fastest parser anyway. I'd like
  25098. // to keep this algorithm simple. By launching multiple threads, we can improve
  25099. // the speed of parsing across a large number of files.</p>
  25100. //
  25101. // <p>
  25102. // There is no strict ordering between the amount of input used by SLL vs LL,
  25103. // which makes it really hard to build a cache for full context. Let's say that
  25104. // we have input A B C that leads to an SLL conflict with full context X. That
  25105. // implies that using X we might only use A B but we could also use A B C D to
  25106. // resolve conflict. Input A B C D could predict alternative 1 in one position
  25107. // in the input and A B C E could predict alternative 2 in another position in
  25108. // input. The conflicting SLL configurations could still be non-unique in the
  25109. // full context prediction, which would lead us to requiring more input than the
  25110. // original A B C. To make a prediction cache work, we have to track the exact
  25111. // input used during the previous prediction. That amounts to a cache that maps
  25112. // X to a specific DFA for that context.</p>
  25113. //
  25114. // <p>
  25115. // Something should be done for left-recursive expression predictions. They are
  25116. // likely LL(1) + pred eval. Easier to do the whole SLL unless error and retry
  25117. // with full LL thing Sam does.</p>
  25118. //
  25119. // <p>
  25120. // <strong>AVOIDING FULL CONTEXT PREDICTION</strong></p>
  25121. //
  25122. // <p>
  25123. // We avoid doing full context retry when the outer context is empty, we did not
  25124. // dip into the outer context by falling off the end of the decision state rule,
  25125. // or when we force SLL mode.</p>
  25126. //
  25127. // <p>
  25128. // As an example of the not dip into outer context case, consider as super
  25129. // constructor calls versus function calls. One grammar might look like
  25130. // this:</p>
  25131. //
  25132. // <pre>
  25133. // ctorBody
  25134. // : '{' superCall? stat* '}'
  25135. // ;
  25136. // </pre>
  25137. //
  25138. // <p>
  25139. // Or, you might see something like</p>
  25140. //
  25141. // <pre>
  25142. // stat
  25143. // : superCall ';'
  25144. // | expression ';'
  25145. // | ...
  25146. // ;
  25147. // </pre>
  25148. //
  25149. // <p>
  25150. // In both cases I believe that no closure operations will dip into the outer
  25151. // context. In the first case ctorBody in the worst case will stop at the '}'.
  25152. // In the 2nd case it should stop at the ';'. Both cases should stay within the
  25153. // entry rule and not dip into the outer context.</p>
  25154. //
  25155. // <p>
  25156. // <strong>PREDICATES</strong></p>
  25157. //
  25158. // <p>
  25159. // Predicates are always evaluated if present in either SLL or LL both. SLL and
  25160. // LL simulation deals with predicates differently. SLL collects predicates as
  25161. // it performs closure operations like ANTLR v3 did. It delays predicate
  25162. // evaluation until it reaches and accept state. This allows us to cache the SLL
  25163. // ATN simulation whereas, if we had evaluated predicates on-the-fly during
  25164. // closure, the DFA state configuration sets would be different and we couldn't
  25165. // build up a suitable DFA.</p>
  25166. //
  25167. // <p>
  25168. // When building a DFA accept state during ATN simulation, we evaluate any
  25169. // predicates and return the sole semantically valid alternative. If there is
  25170. // more than 1 alternative, we report an ambiguity. If there are 0 alternatives,
  25171. // we throw an exception. Alternatives without predicates act like they have
  25172. // true predicates. The simple way to think about it is to strip away all
  25173. // alternatives with false predicates and choose the minimum alternative that
  25174. // remains.</p>
  25175. //
  25176. // <p>
  25177. // When we start in the DFA and reach an accept state that's predicated, we test
  25178. // those and return the minimum semantically viable alternative. If no
  25179. // alternatives are viable, we throw an exception.</p>
  25180. //
  25181. // <p>
  25182. // During full LL ATN simulation, closure always evaluates predicates and
  25183. // on-the-fly. This is crucial to reducing the configuration set size during
  25184. // closure. It hits a landmine when parsing with the Java grammar, for example,
  25185. // without this on-the-fly evaluation.</p>
  25186. //
  25187. // <p>
  25188. // <strong>SHARING DFA</strong></p>
  25189. //
  25190. // <p>
  25191. // All instances of the same parser share the same decision DFAs through a
  25192. // static field. Each instance gets its own ATN simulator but they share the
  25193. // same {@link //decisionToDFA} field. They also share a
  25194. // {@link PredictionContextCache} object that makes sure that all
  25195. // {@link PredictionContext} objects are shared among the DFA states. This makes
  25196. // a big size difference.</p>
  25197. //
  25198. // <p>
  25199. // <strong>THREAD SAFETY</strong></p>
  25200. //
  25201. // <p>
  25202. // The {@link ParserATNSimulator} locks on the {@link //decisionToDFA} field when
  25203. // it adds a new DFA object to that array. {@link //addDFAEdge}
  25204. // locks on the DFA for the current decision when setting the
  25205. // {@link DFAState//edges} field. {@link //addDFAState} locks on
  25206. // the DFA for the current decision when looking up a DFA state to see if it
  25207. // already exists. We must make sure that all requests to add DFA states that
  25208. // are equivalent result in the same shared DFA object. This is because lots of
  25209. // threads will be trying to update the DFA at once. The
  25210. // {@link //addDFAState} method also locks inside the DFA lock
  25211. // but this time on the shared context cache when it rebuilds the
  25212. // configurations' {@link PredictionContext} objects using cached
  25213. // subgraphs/nodes. No other locking occurs, even during DFA simulation. This is
  25214. // safe as long as we can guarantee that all threads referencing
  25215. // {@code s.edge[t]} get the same physical target {@link DFAState}, or
  25216. // {@code null}. Once into the DFA, the DFA simulation does not reference the
  25217. // {@link DFA//states} map. It follows the {@link DFAState//edges} field to new
  25218. // targets. The DFA simulator will either find {@link DFAState//edges} to be
  25219. // {@code null}, to be non-{@code null} and {@code dfa.edges[t]} null, or
  25220. // {@code dfa.edges[t]} to be non-null. The
  25221. // {@link //addDFAEdge} method could be racing to set the field
  25222. // but in either case the DFA simulator works; if {@code null}, and requests ATN
  25223. // simulation. It could also race trying to get {@code dfa.edges[t]}, but either
  25224. // way it will work because it's not doing a test and set operation.</p>
  25225. //
  25226. // <p>
  25227. // <strong>Starting with SLL then failing to combined SLL/LL (Two-Stage
  25228. // Parsing)</strong></p>
  25229. //
  25230. // <p>
  25231. // Sam pointed out that if SLL does not give a syntax error, then there is no
  25232. // point in doing full LL, which is slower. We only have to try LL if we get a
  25233. // syntax error. For maximum speed, Sam starts the parser set to pure SLL
  25234. // mode with the {@link BailErrorStrategy}:</p>
  25235. //
  25236. // <pre>
  25237. // parser.{@link Parser//getInterpreter() getInterpreter()}.{@link //setPredictionMode setPredictionMode}{@code (}{@link PredictionMode//SLL}{@code )};
  25238. // parser.{@link Parser//setErrorHandler setErrorHandler}(new {@link BailErrorStrategy}());
  25239. // </pre>
  25240. //
  25241. // <p>
  25242. // If it does not get a syntax error, then we're done. If it does get a syntax
  25243. // error, we need to retry with the combined SLL/LL strategy.</p>
  25244. //
  25245. // <p>
  25246. // The reason this works is as follows. If there are no SLL conflicts, then the
  25247. // grammar is SLL (at least for that input set). If there is an SLL conflict,
  25248. // the full LL analysis must yield a set of viable alternatives which is a
  25249. // subset of the alternatives reported by SLL. If the LL set is a singleton,
  25250. // then the grammar is LL but not SLL. If the LL set is the same size as the SLL
  25251. // set, the decision is SLL. If the LL set has size &gt; 1, then that decision
  25252. // is truly ambiguous on the current input. If the LL set is smaller, then the
  25253. // SLL conflict resolution might choose an alternative that the full LL would
  25254. // rule out as a possibility based upon better context information. If that's
  25255. // the case, then the SLL parse will definitely get an error because the full LL
  25256. // analysis says it's not viable. If SLL conflict resolution chooses an
  25257. // alternative within the LL set, them both SLL and LL would choose the same
  25258. // alternative because they both choose the minimum of multiple conflicting
  25259. // alternatives.</p>
  25260. //
  25261. // <p>
  25262. // Let's say we have a set of SLL conflicting alternatives {@code {1, 2, 3}} and
  25263. // a smaller LL set called <em>s</em>. If <em>s</em> is {@code {2, 3}}, then SLL
  25264. // parsing will get an error because SLL will pursue alternative 1. If
  25265. // <em>s</em> is {@code {1, 2}} or {@code {1, 3}} then both SLL and LL will
  25266. // choose the same alternative because alternative one is the minimum of either
  25267. // set. If <em>s</em> is {@code {2}} or {@code {3}} then SLL will get a syntax
  25268. // error. If <em>s</em> is {@code {1}} then SLL will succeed.</p>
  25269. //
  25270. // <p>
  25271. // Of course, if the input is invalid, then we will get an error for sure in
  25272. // both SLL and LL parsing. Erroneous input will therefore require 2 passes over
  25273. // the input.</p>
  25274. //
  25275. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  25276. var Set = Utils.Set;
  25277. var BitSet = Utils.BitSet;
  25278. var DoubleDict = Utils.DoubleDict;
  25279. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  25280. var ATNState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  25281. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  25282. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  25283. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  25284. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  25285. var PredPrediction = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  25286. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  25287. var PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  25288. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  25289. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  25290. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  25291. var StarLoopEntryState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  25292. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  25293. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  25294. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  25295. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  25296. var Transition = Transitions.Transition;
  25297. var SetTransition = Transitions.SetTransition;
  25298. var NotSetTransition = Transitions.NotSetTransition;
  25299. var RuleTransition = Transitions.RuleTransition;
  25300. var ActionTransition = Transitions.ActionTransition;
  25301. var NoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  25302. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  25303. var predictionContextFromRuleContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").predictionContextFromRuleContext;
  25304. function ParserATNSimulator(parser, atn, decisionToDFA, sharedContextCache) {
  25305. ATNSimulator.call(this, atn, sharedContextCache);
  25306. this.parser = parser;
  25307. this.decisionToDFA = decisionToDFA;
  25308. // SLL, LL, or LL + exact ambig detection?//
  25309. this.predictionMode = PredictionMode.LL;
  25310. // LAME globals to avoid parameters!!!!! I need these down deep in predTransition
  25311. this._input = null;
  25312. this._startIndex = 0;
  25313. this._outerContext = null;
  25314. this._dfa = null;
  25315. // Each prediction operation uses a cache for merge of prediction contexts.
  25316. // Don't keep around as it wastes huge amounts of memory. DoubleKeyMap
  25317. // isn't synchronized but we're ok since two threads shouldn't reuse same
  25318. // parser/atnsim object because it can only handle one input at a time.
  25319. // This maps graphs a and b to merged result c. (a,b)&rarr;c. We can avoid
  25320. // the merge if we ever see a and b again. Note that (b,a)&rarr;c should
  25321. // also be examined during cache lookup.
  25322. //
  25323. this.mergeCache = null;
  25324. return this;
  25325. }
  25326. ParserATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  25327. ParserATNSimulator.prototype.constructor = ParserATNSimulator;
  25328. ParserATNSimulator.prototype.debug = false;
  25329. ParserATNSimulator.prototype.debug_closure = false;
  25330. ParserATNSimulator.prototype.debug_add = false;
  25331. ParserATNSimulator.prototype.debug_list_atn_decisions = false;
  25332. ParserATNSimulator.prototype.dfa_debug = false;
  25333. ParserATNSimulator.prototype.retry_debug = false;
  25334. ParserATNSimulator.prototype.reset = function () {};
  25335. ParserATNSimulator.prototype.adaptivePredict = function (input, decision, outerContext) {
  25336. if (this.debug || this.debug_list_atn_decisions) {
  25337. console.log("adaptivePredict decision " + decision + " exec LA(1)==" + this.getLookaheadName(input) + " line " + input.LT(1).line + ":" + input.LT(1).column);
  25338. }
  25339. this._input = input;
  25340. this._startIndex = input.index;
  25341. this._outerContext = outerContext;
  25342. var dfa = this.decisionToDFA[decision];
  25343. this._dfa = dfa;
  25344. var m = input.mark();
  25345. var index = input.index;
  25346. // Now we are certain to have a specific decision's DFA
  25347. // But, do we still need an initial state?
  25348. try {
  25349. var s0;
  25350. if (dfa.precedenceDfa) {
  25351. // the start state for a precedence DFA depends on the current
  25352. // parser precedence, and is provided by a DFA method.
  25353. s0 = dfa.getPrecedenceStartState(this.parser.getPrecedence());
  25354. } else {
  25355. // the start state for a "regular" DFA is just s0
  25356. s0 = dfa.s0;
  25357. }
  25358. if (s0 === null) {
  25359. if (outerContext === null) {
  25360. outerContext = RuleContext.EMPTY;
  25361. }
  25362. if (this.debug || this.debug_list_atn_decisions) {
  25363. console.log("predictATN decision " + dfa.decision + " exec LA(1)==" + this.getLookaheadName(input) + ", outerContext=" + outerContext.toString(this.parser.ruleNames));
  25364. }
  25365. var fullCtx = false;
  25366. var s0_closure = this.computeStartState(dfa.atnStartState, RuleContext.EMPTY, fullCtx);
  25367. if (dfa.precedenceDfa) {
  25368. // If this is a precedence DFA, we use applyPrecedenceFilter
  25369. // to convert the computed start state to a precedence start
  25370. // state. We then use DFA.setPrecedenceStartState to set the
  25371. // appropriate start state for the precedence level rather
  25372. // than simply setting DFA.s0.
  25373. //
  25374. dfa.s0.configs = s0_closure; // not used for prediction but useful to know start configs anyway
  25375. s0_closure = this.applyPrecedenceFilter(s0_closure);
  25376. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  25377. dfa.setPrecedenceStartState(this.parser.getPrecedence(), s0);
  25378. } else {
  25379. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  25380. dfa.s0 = s0;
  25381. }
  25382. }
  25383. var alt = this.execATN(dfa, s0, input, index, outerContext);
  25384. if (this.debug) {
  25385. console.log("DFA after predictATN: " + dfa.toString(this.parser.literalNames));
  25386. }
  25387. return alt;
  25388. } finally {
  25389. this._dfa = null;
  25390. this.mergeCache = null; // wack cache after each prediction
  25391. input.seek(index);
  25392. input.release(m);
  25393. }
  25394. };
  25395. // Performs ATN simulation to compute a predicted alternative based
  25396. // upon the remaining input, but also updates the DFA cache to avoid
  25397. // having to traverse the ATN again for the same input sequence.
  25398. // There are some key conditions we're looking for after computing a new
  25399. // set of ATN configs (proposed DFA state):
  25400. // if the set is empty, there is no viable alternative for current symbol
  25401. // does the state uniquely predict an alternative?
  25402. // does the state have a conflict that would prevent us from
  25403. // putting it on the work list?
  25404. // We also have some key operations to do:
  25405. // add an edge from previous DFA state to potentially new DFA state, D,
  25406. // upon current symbol but only if adding to work list, which means in all
  25407. // cases except no viable alternative (and possibly non-greedy decisions?)
  25408. // collecting predicates and adding semantic context to DFA accept states
  25409. // adding rule context to context-sensitive DFA accept states
  25410. // consuming an input symbol
  25411. // reporting a conflict
  25412. // reporting an ambiguity
  25413. // reporting a context sensitivity
  25414. // reporting insufficient predicates
  25415. // cover these cases:
  25416. // dead end
  25417. // single alt
  25418. // single alt + preds
  25419. // conflict
  25420. // conflict + preds
  25421. //
  25422. ParserATNSimulator.prototype.execATN = function (dfa, s0, input, startIndex, outerContext) {
  25423. if (this.debug || this.debug_list_atn_decisions) {
  25424. console.log("execATN decision " + dfa.decision + " exec LA(1)==" + this.getLookaheadName(input) + " line " + input.LT(1).line + ":" + input.LT(1).column);
  25425. }
  25426. var alt;
  25427. var previousD = s0;
  25428. if (this.debug) {
  25429. console.log("s0 = " + s0);
  25430. }
  25431. var t = input.LA(1);
  25432. while (true) {
  25433. // while more work
  25434. var D = this.getExistingTargetState(previousD, t);
  25435. if (D === null) {
  25436. D = this.computeTargetState(dfa, previousD, t);
  25437. }
  25438. if (D === ATNSimulator.ERROR) {
  25439. // if any configs in previous dipped into outer context, that
  25440. // means that input up to t actually finished entry rule
  25441. // at least for SLL decision. Full LL doesn't dip into outer
  25442. // so don't need special case.
  25443. // We will get an error no matter what so delay until after
  25444. // decision; better error message. Also, no reachable target
  25445. // ATN states in SLL implies LL will also get nowhere.
  25446. // If conflict in states that dip out, choose min since we
  25447. // will get error no matter what.
  25448. var e = this.noViableAlt(input, outerContext, previousD.configs, startIndex);
  25449. input.seek(startIndex);
  25450. alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previousD.configs, outerContext);
  25451. if (alt !== ATN.INVALID_ALT_NUMBER) {
  25452. return alt;
  25453. } else {
  25454. throw e;
  25455. }
  25456. }
  25457. if (D.requiresFullContext && this.predictionMode !== PredictionMode.SLL) {
  25458. // IF PREDS, MIGHT RESOLVE TO SINGLE ALT => SLL (or syntax error)
  25459. var conflictingAlts = null;
  25460. if (D.predicates !== null) {
  25461. if (this.debug) {
  25462. console.log("DFA state has preds in DFA sim LL failover");
  25463. }
  25464. var conflictIndex = input.index;
  25465. if (conflictIndex !== startIndex) {
  25466. input.seek(startIndex);
  25467. }
  25468. conflictingAlts = this.evalSemanticContext(D.predicates, outerContext, true);
  25469. if (conflictingAlts.length === 1) {
  25470. if (this.debug) {
  25471. console.log("Full LL avoided");
  25472. }
  25473. return conflictingAlts.minValue();
  25474. }
  25475. if (conflictIndex !== startIndex) {
  25476. // restore the index so reporting the fallback to full
  25477. // context occurs with the index at the correct spot
  25478. input.seek(conflictIndex);
  25479. }
  25480. }
  25481. if (this.dfa_debug) {
  25482. console.log("ctx sensitive state " + outerContext + " in " + D);
  25483. }
  25484. var fullCtx = true;
  25485. var s0_closure = this.computeStartState(dfa.atnStartState, outerContext, fullCtx);
  25486. this.reportAttemptingFullContext(dfa, conflictingAlts, D.configs, startIndex, input.index);
  25487. alt = this.execATNWithFullContext(dfa, D, s0_closure, input, startIndex, outerContext);
  25488. return alt;
  25489. }
  25490. if (D.isAcceptState) {
  25491. if (D.predicates === null) {
  25492. return D.prediction;
  25493. }
  25494. var stopIndex = input.index;
  25495. input.seek(startIndex);
  25496. var alts = this.evalSemanticContext(D.predicates, outerContext, true);
  25497. if (alts.length === 0) {
  25498. throw this.noViableAlt(input, outerContext, D.configs, startIndex);
  25499. } else if (alts.length === 1) {
  25500. return alts.minValue();
  25501. } else {
  25502. // report ambiguity after predicate evaluation to make sure the correct set of ambig alts is reported.
  25503. this.reportAmbiguity(dfa, D, startIndex, stopIndex, false, alts, D.configs);
  25504. return alts.minValue();
  25505. }
  25506. }
  25507. previousD = D;
  25508. if (t !== Token.EOF) {
  25509. input.consume();
  25510. t = input.LA(1);
  25511. }
  25512. }
  25513. };
  25514. //
  25515. // Get an existing target state for an edge in the DFA. If the target state
  25516. // for the edge has not yet been computed or is otherwise not available,
  25517. // this method returns {@code null}.
  25518. //
  25519. // @param previousD The current DFA state
  25520. // @param t The next input symbol
  25521. // @return The existing target DFA state for the given input symbol
  25522. // {@code t}, or {@code null} if the target state for this edge is not
  25523. // already cached
  25524. //
  25525. ParserATNSimulator.prototype.getExistingTargetState = function (previousD, t) {
  25526. var edges = previousD.edges;
  25527. if (edges === null) {
  25528. return null;
  25529. } else {
  25530. return edges[t + 1] || null;
  25531. }
  25532. };
  25533. //
  25534. // Compute a target state for an edge in the DFA, and attempt to add the
  25535. // computed state and corresponding edge to the DFA.
  25536. //
  25537. // @param dfa The DFA
  25538. // @param previousD The current DFA state
  25539. // @param t The next input symbol
  25540. //
  25541. // @return The computed target DFA state for the given input symbol
  25542. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  25543. // returns {@link //ERROR}.
  25544. //
  25545. ParserATNSimulator.prototype.computeTargetState = function (dfa, previousD, t) {
  25546. var reach = this.computeReachSet(previousD.configs, t, false);
  25547. if (reach === null) {
  25548. this.addDFAEdge(dfa, previousD, t, ATNSimulator.ERROR);
  25549. return ATNSimulator.ERROR;
  25550. }
  25551. // create new target state; we'll add to DFA after it's complete
  25552. var D = new DFAState(null, reach);
  25553. var predictedAlt = this.getUniqueAlt(reach);
  25554. if (this.debug) {
  25555. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  25556. console.log("SLL altSubSets=" + Utils.arrayToString(altSubSets) + ", previous=" + previousD.configs + ", configs=" + reach + ", predict=" + predictedAlt + ", allSubsetsConflict=" + PredictionMode.allSubsetsConflict(altSubSets) + ", conflictingAlts=" + this.getConflictingAlts(reach));
  25557. }
  25558. if (predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  25559. // NO CONFLICT, UNIQUELY PREDICTED ALT
  25560. D.isAcceptState = true;
  25561. D.configs.uniqueAlt = predictedAlt;
  25562. D.prediction = predictedAlt;
  25563. } else if (PredictionMode.hasSLLConflictTerminatingPrediction(this.predictionMode, reach)) {
  25564. // MORE THAN ONE VIABLE ALTERNATIVE
  25565. D.configs.conflictingAlts = this.getConflictingAlts(reach);
  25566. D.requiresFullContext = true;
  25567. // in SLL-only mode, we will stop at this state and return the minimum alt
  25568. D.isAcceptState = true;
  25569. D.prediction = D.configs.conflictingAlts.minValue();
  25570. }
  25571. if (D.isAcceptState && D.configs.hasSemanticContext) {
  25572. this.predicateDFAState(D, this.atn.getDecisionState(dfa.decision));
  25573. if (D.predicates !== null) {
  25574. D.prediction = ATN.INVALID_ALT_NUMBER;
  25575. }
  25576. }
  25577. // all adds to dfa are done after we've created full D state
  25578. D = this.addDFAEdge(dfa, previousD, t, D);
  25579. return D;
  25580. };
  25581. ParserATNSimulator.prototype.predicateDFAState = function (dfaState, decisionState) {
  25582. // We need to test all predicates, even in DFA states that
  25583. // uniquely predict alternative.
  25584. var nalts = decisionState.transitions.length;
  25585. // Update DFA so reach becomes accept state with (predicate,alt)
  25586. // pairs if preds found for conflicting alts
  25587. var altsToCollectPredsFrom = this.getConflictingAltsOrUniqueAlt(dfaState.configs);
  25588. var altToPred = this.getPredsForAmbigAlts(altsToCollectPredsFrom, dfaState.configs, nalts);
  25589. if (altToPred !== null) {
  25590. dfaState.predicates = this.getPredicatePredictions(altsToCollectPredsFrom, altToPred);
  25591. dfaState.prediction = ATN.INVALID_ALT_NUMBER; // make sure we use preds
  25592. } else {
  25593. // There are preds in configs but they might go away
  25594. // when OR'd together like {p}? || NONE == NONE. If neither
  25595. // alt has preds, resolve to min alt
  25596. dfaState.prediction = altsToCollectPredsFrom.minValue();
  25597. }
  25598. };
  25599. // comes back with reach.uniqueAlt set to a valid alt
  25600. ParserATNSimulator.prototype.execATNWithFullContext = function (dfa, D, // how far we got before failing over
  25601. s0, input, startIndex, outerContext) {
  25602. if (this.debug || this.debug_list_atn_decisions) {
  25603. console.log("execATNWithFullContext " + s0);
  25604. }
  25605. var fullCtx = true;
  25606. var foundExactAmbig = false;
  25607. var reach = null;
  25608. var previous = s0;
  25609. input.seek(startIndex);
  25610. var t = input.LA(1);
  25611. var predictedAlt = -1;
  25612. while (true) {
  25613. // while more work
  25614. reach = this.computeReachSet(previous, t, fullCtx);
  25615. if (reach === null) {
  25616. // if any configs in previous dipped into outer context, that
  25617. // means that input up to t actually finished entry rule
  25618. // at least for LL decision. Full LL doesn't dip into outer
  25619. // so don't need special case.
  25620. // We will get an error no matter what so delay until after
  25621. // decision; better error message. Also, no reachable target
  25622. // ATN states in SLL implies LL will also get nowhere.
  25623. // If conflict in states that dip out, choose min since we
  25624. // will get error no matter what.
  25625. var e = this.noViableAlt(input, outerContext, previous, startIndex);
  25626. input.seek(startIndex);
  25627. var alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previous, outerContext);
  25628. if (alt !== ATN.INVALID_ALT_NUMBER) {
  25629. return alt;
  25630. } else {
  25631. throw e;
  25632. }
  25633. }
  25634. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  25635. if (this.debug) {
  25636. console.log("LL altSubSets=" + altSubSets + ", predict=" + PredictionMode.getUniqueAlt(altSubSets) + ", resolvesToJustOneViableAlt=" + PredictionMode.resolvesToJustOneViableAlt(altSubSets));
  25637. }
  25638. reach.uniqueAlt = this.getUniqueAlt(reach);
  25639. // unique prediction?
  25640. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  25641. predictedAlt = reach.uniqueAlt;
  25642. break;
  25643. } else if (this.predictionMode !== PredictionMode.LL_EXACT_AMBIG_DETECTION) {
  25644. predictedAlt = PredictionMode.resolvesToJustOneViableAlt(altSubSets);
  25645. if (predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  25646. break;
  25647. }
  25648. } else {
  25649. // In exact ambiguity mode, we never try to terminate early.
  25650. // Just keeps scarfing until we know what the conflict is
  25651. if (PredictionMode.allSubsetsConflict(altSubSets) && PredictionMode.allSubsetsEqual(altSubSets)) {
  25652. foundExactAmbig = true;
  25653. predictedAlt = PredictionMode.getSingleViableAlt(altSubSets);
  25654. break;
  25655. }
  25656. // else there are multiple non-conflicting subsets or
  25657. // we're not sure what the ambiguity is yet.
  25658. // So, keep going.
  25659. }
  25660. previous = reach;
  25661. if (t !== Token.EOF) {
  25662. input.consume();
  25663. t = input.LA(1);
  25664. }
  25665. }
  25666. // If the configuration set uniquely predicts an alternative,
  25667. // without conflict, then we know that it's a full LL decision
  25668. // not SLL.
  25669. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  25670. this.reportContextSensitivity(dfa, predictedAlt, reach, startIndex, input.index);
  25671. return predictedAlt;
  25672. }
  25673. // We do not check predicates here because we have checked them
  25674. // on-the-fly when doing full context prediction.
  25675. //
  25676. // In non-exact ambiguity detection mode, we might actually be able to
  25677. // detect an exact ambiguity, but I'm not going to spend the cycles
  25678. // needed to check. We only emit ambiguity warnings in exact ambiguity
  25679. // mode.
  25680. //
  25681. // For example, we might know that we have conflicting configurations.
  25682. // But, that does not mean that there is no way forward without a
  25683. // conflict. It's possible to have nonconflicting alt subsets as in:
  25684. // altSubSets=[{1, 2}, {1, 2}, {1}, {1, 2}]
  25685. // from
  25686. //
  25687. // [(17,1,[5 $]), (13,1,[5 10 $]), (21,1,[5 10 $]), (11,1,[$]),
  25688. // (13,2,[5 10 $]), (21,2,[5 10 $]), (11,2,[$])]
  25689. //
  25690. // In this case, (17,1,[5 $]) indicates there is some next sequence that
  25691. // would resolve this without conflict to alternative 1. Any other viable
  25692. // next sequence, however, is associated with a conflict. We stop
  25693. // looking for input because no amount of further lookahead will alter
  25694. // the fact that we should predict alternative 1. We just can't say for
  25695. // sure that there is an ambiguity without looking further.
  25696. this.reportAmbiguity(dfa, D, startIndex, input.index, foundExactAmbig, null, reach);
  25697. return predictedAlt;
  25698. };
  25699. ParserATNSimulator.prototype.computeReachSet = function (closure, t, fullCtx) {
  25700. if (this.debug) {
  25701. console.log("in computeReachSet, starting closure: " + closure);
  25702. }
  25703. if (this.mergeCache === null) {
  25704. this.mergeCache = new DoubleDict();
  25705. }
  25706. var intermediate = new ATNConfigSet(fullCtx);
  25707. // Configurations already in a rule stop state indicate reaching the end
  25708. // of the decision rule (local context) or end of the start rule (full
  25709. // context). Once reached, these configurations are never updated by a
  25710. // closure operation, so they are handled separately for the performance
  25711. // advantage of having a smaller intermediate set when calling closure.
  25712. //
  25713. // For full-context reach operations, separate handling is required to
  25714. // ensure that the alternative matching the longest overall sequence is
  25715. // chosen when multiple such configurations can match the input.
  25716. var skippedStopStates = null;
  25717. // First figure out where we can reach on input t
  25718. for (var i = 0; i < closure.items.length; i++) {
  25719. var c = closure.items[i];
  25720. if (this.debug_add) {
  25721. console.log("testing " + this.getTokenName(t) + " at " + c);
  25722. }
  25723. if (c.state instanceof RuleStopState) {
  25724. if (fullCtx || t === Token.EOF) {
  25725. if (skippedStopStates === null) {
  25726. skippedStopStates = [];
  25727. }
  25728. skippedStopStates.push(c);
  25729. if (this.debug_add) {
  25730. console.log("added " + c + " to skippedStopStates");
  25731. }
  25732. }
  25733. continue;
  25734. }
  25735. for (var j = 0; j < c.state.transitions.length; j++) {
  25736. var trans = c.state.transitions[j];
  25737. var target = this.getReachableTarget(trans, t);
  25738. if (target !== null) {
  25739. var cfg = new ATNConfig({ state: target }, c);
  25740. intermediate.add(cfg, this.mergeCache);
  25741. if (this.debug_add) {
  25742. console.log("added " + cfg + " to intermediate");
  25743. }
  25744. }
  25745. }
  25746. }
  25747. // Now figure out where the reach operation can take us...
  25748. var reach = null;
  25749. // This block optimizes the reach operation for intermediate sets which
  25750. // trivially indicate a termination state for the overall
  25751. // adaptivePredict operation.
  25752. //
  25753. // The conditions assume that intermediate
  25754. // contains all configurations relevant to the reach set, but this
  25755. // condition is not true when one or more configurations have been
  25756. // withheld in skippedStopStates, or when the current symbol is EOF.
  25757. //
  25758. if (skippedStopStates === null && t !== Token.EOF) {
  25759. if (intermediate.items.length === 1) {
  25760. // Don't pursue the closure if there is just one state.
  25761. // It can only have one alternative; just add to result
  25762. // Also don't pursue the closure if there is unique alternative
  25763. // among the configurations.
  25764. reach = intermediate;
  25765. } else if (this.getUniqueAlt(intermediate) !== ATN.INVALID_ALT_NUMBER) {
  25766. // Also don't pursue the closure if there is unique alternative
  25767. // among the configurations.
  25768. reach = intermediate;
  25769. }
  25770. }
  25771. // If the reach set could not be trivially determined, perform a closure
  25772. // operation on the intermediate set to compute its initial value.
  25773. //
  25774. if (reach === null) {
  25775. reach = new ATNConfigSet(fullCtx);
  25776. var closureBusy = new Set();
  25777. var treatEofAsEpsilon = t === Token.EOF;
  25778. for (var k = 0; k < intermediate.items.length; k++) {
  25779. this.closure(intermediate.items[k], reach, closureBusy, false, fullCtx, treatEofAsEpsilon);
  25780. }
  25781. }
  25782. if (t === Token.EOF) {
  25783. // After consuming EOF no additional input is possible, so we are
  25784. // only interested in configurations which reached the end of the
  25785. // decision rule (local context) or end of the start rule (full
  25786. // context). Update reach to contain only these configurations. This
  25787. // handles both explicit EOF transitions in the grammar and implicit
  25788. // EOF transitions following the end of the decision or start rule.
  25789. //
  25790. // When reach==intermediate, no closure operation was performed. In
  25791. // this case, removeAllConfigsNotInRuleStopState needs to check for
  25792. // reachable rule stop states as well as configurations already in
  25793. // a rule stop state.
  25794. //
  25795. // This is handled before the configurations in skippedStopStates,
  25796. // because any configurations potentially added from that list are
  25797. // already guaranteed to meet this condition whether or not it's
  25798. // required.
  25799. //
  25800. reach = this.removeAllConfigsNotInRuleStopState(reach, reach === intermediate);
  25801. }
  25802. // If skippedStopStates!==null, then it contains at least one
  25803. // configuration. For full-context reach operations, these
  25804. // configurations reached the end of the start rule, in which case we
  25805. // only add them back to reach if no configuration during the current
  25806. // closure operation reached such a state. This ensures adaptivePredict
  25807. // chooses an alternative matching the longest overall sequence when
  25808. // multiple alternatives are viable.
  25809. //
  25810. if (skippedStopStates !== null && (!fullCtx || !PredictionMode.hasConfigInRuleStopState(reach))) {
  25811. for (var l = 0; l < skippedStopStates.length; l++) {
  25812. reach.add(skippedStopStates[l], this.mergeCache);
  25813. }
  25814. }
  25815. if (reach.items.length === 0) {
  25816. return null;
  25817. } else {
  25818. return reach;
  25819. }
  25820. };
  25821. //
  25822. // Return a configuration set containing only the configurations from
  25823. // {@code configs} which are in a {@link RuleStopState}. If all
  25824. // configurations in {@code configs} are already in a rule stop state, this
  25825. // method simply returns {@code configs}.
  25826. //
  25827. // <p>When {@code lookToEndOfRule} is true, this method uses
  25828. // {@link ATN//nextTokens} for each configuration in {@code configs} which is
  25829. // not already in a rule stop state to see if a rule stop state is reachable
  25830. // from the configuration via epsilon-only transitions.</p>
  25831. //
  25832. // @param configs the configuration set to update
  25833. // @param lookToEndOfRule when true, this method checks for rule stop states
  25834. // reachable by epsilon-only transitions from each configuration in
  25835. // {@code configs}.
  25836. //
  25837. // @return {@code configs} if all configurations in {@code configs} are in a
  25838. // rule stop state, otherwise return a new configuration set containing only
  25839. // the configurations from {@code configs} which are in a rule stop state
  25840. //
  25841. ParserATNSimulator.prototype.removeAllConfigsNotInRuleStopState = function (configs, lookToEndOfRule) {
  25842. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  25843. return configs;
  25844. }
  25845. var result = new ATNConfigSet(configs.fullCtx);
  25846. for (var i = 0; i < configs.items.length; i++) {
  25847. var config = configs.items[i];
  25848. if (config.state instanceof RuleStopState) {
  25849. result.add(config, this.mergeCache);
  25850. continue;
  25851. }
  25852. if (lookToEndOfRule && config.state.epsilonOnlyTransitions) {
  25853. var nextTokens = this.atn.nextTokens(config.state);
  25854. if (nextTokens.contains(Token.EPSILON)) {
  25855. var endOfRuleState = this.atn.ruleToStopState[config.state.ruleIndex];
  25856. result.add(new ATNConfig({ state: endOfRuleState }, config), this.mergeCache);
  25857. }
  25858. }
  25859. }
  25860. return result;
  25861. };
  25862. ParserATNSimulator.prototype.computeStartState = function (p, ctx, fullCtx) {
  25863. // always at least the implicit call to start rule
  25864. var initialContext = predictionContextFromRuleContext(this.atn, ctx);
  25865. var configs = new ATNConfigSet(fullCtx);
  25866. for (var i = 0; i < p.transitions.length; i++) {
  25867. var target = p.transitions[i].target;
  25868. var c = new ATNConfig({ state: target, alt: i + 1, context: initialContext }, null);
  25869. var closureBusy = new Set();
  25870. this.closure(c, configs, closureBusy, true, fullCtx, false);
  25871. }
  25872. return configs;
  25873. };
  25874. //
  25875. // This method transforms the start state computed by
  25876. // {@link //computeStartState} to the special start state used by a
  25877. // precedence DFA for a particular precedence value. The transformation
  25878. // process applies the following changes to the start state's configuration
  25879. // set.
  25880. //
  25881. // <ol>
  25882. // <li>Evaluate the precedence predicates for each configuration using
  25883. // {@link SemanticContext//evalPrecedence}.</li>
  25884. // <li>Remove all configurations which predict an alternative greater than
  25885. // 1, for which another configuration that predicts alternative 1 is in the
  25886. // same ATN state with the same prediction context. This transformation is
  25887. // valid for the following reasons:
  25888. // <ul>
  25889. // <li>The closure block cannot contain any epsilon transitions which bypass
  25890. // the body of the closure, so all states reachable via alternative 1 are
  25891. // part of the precedence alternatives of the transformed left-recursive
  25892. // rule.</li>
  25893. // <li>The "primary" portion of a left recursive rule cannot contain an
  25894. // epsilon transition, so the only way an alternative other than 1 can exist
  25895. // in a state that is also reachable via alternative 1 is by nesting calls
  25896. // to the left-recursive rule, with the outer calls not being at the
  25897. // preferred precedence level.</li>
  25898. // </ul>
  25899. // </li>
  25900. // </ol>
  25901. //
  25902. // <p>
  25903. // The prediction context must be considered by this filter to address
  25904. // situations like the following.
  25905. // </p>
  25906. // <code>
  25907. // <pre>
  25908. // grammar TA;
  25909. // prog: statement* EOF;
  25910. // statement: letterA | statement letterA 'b' ;
  25911. // letterA: 'a';
  25912. // </pre>
  25913. // </code>
  25914. // <p>
  25915. // If the above grammar, the ATN state immediately before the token
  25916. // reference {@code 'a'} in {@code letterA} is reachable from the left edge
  25917. // of both the primary and closure blocks of the left-recursive rule
  25918. // {@code statement}. The prediction context associated with each of these
  25919. // configurations distinguishes between them, and prevents the alternative
  25920. // which stepped out to {@code prog} (and then back in to {@code statement}
  25921. // from being eliminated by the filter.
  25922. // </p>
  25923. //
  25924. // @param configs The configuration set computed by
  25925. // {@link //computeStartState} as the start state for the DFA.
  25926. // @return The transformed configuration set representing the start state
  25927. // for a precedence DFA at a particular precedence level (determined by
  25928. // calling {@link Parser//getPrecedence}).
  25929. //
  25930. ParserATNSimulator.prototype.applyPrecedenceFilter = function (configs) {
  25931. var config;
  25932. var statesFromAlt1 = [];
  25933. var configSet = new ATNConfigSet(configs.fullCtx);
  25934. for (var i = 0; i < configs.items.length; i++) {
  25935. config = configs.items[i];
  25936. // handle alt 1 first
  25937. if (config.alt !== 1) {
  25938. continue;
  25939. }
  25940. var updatedContext = config.semanticContext.evalPrecedence(this.parser, this._outerContext);
  25941. if (updatedContext === null) {
  25942. // the configuration was eliminated
  25943. continue;
  25944. }
  25945. statesFromAlt1[config.state.stateNumber] = config.context;
  25946. if (updatedContext !== config.semanticContext) {
  25947. configSet.add(new ATNConfig({ semanticContext: updatedContext }, config), this.mergeCache);
  25948. } else {
  25949. configSet.add(config, this.mergeCache);
  25950. }
  25951. }
  25952. for (i = 0; i < configs.items.length; i++) {
  25953. config = configs.items[i];
  25954. if (config.alt === 1) {
  25955. // already handled
  25956. continue;
  25957. }
  25958. // In the future, this elimination step could be updated to also
  25959. // filter the prediction context for alternatives predicting alt>1
  25960. // (basically a graph subtraction algorithm).
  25961. if (!config.precedenceFilterSuppressed) {
  25962. var context = statesFromAlt1[config.state.stateNumber] || null;
  25963. if (context !== null && context.equals(config.context)) {
  25964. // eliminated
  25965. continue;
  25966. }
  25967. }
  25968. configSet.add(config, this.mergeCache);
  25969. }
  25970. return configSet;
  25971. };
  25972. ParserATNSimulator.prototype.getReachableTarget = function (trans, ttype) {
  25973. if (trans.matches(ttype, 0, this.atn.maxTokenType)) {
  25974. return trans.target;
  25975. } else {
  25976. return null;
  25977. }
  25978. };
  25979. ParserATNSimulator.prototype.getPredsForAmbigAlts = function (ambigAlts, configs, nalts) {
  25980. // REACH=[1|1|[]|0:0, 1|2|[]|0:1]
  25981. // altToPred starts as an array of all null contexts. The entry at index i
  25982. // corresponds to alternative i. altToPred[i] may have one of three values:
  25983. // 1. null: no ATNConfig c is found such that c.alt==i
  25984. // 2. SemanticContext.NONE: At least one ATNConfig c exists such that
  25985. // c.alt==i and c.semanticContext==SemanticContext.NONE. In other words,
  25986. // alt i has at least one unpredicated config.
  25987. // 3. Non-NONE Semantic Context: There exists at least one, and for all
  25988. // ATNConfig c such that c.alt==i, c.semanticContext!=SemanticContext.NONE.
  25989. //
  25990. // From this, it is clear that NONE||anything==NONE.
  25991. //
  25992. var altToPred = [];
  25993. for (var i = 0; i < configs.items.length; i++) {
  25994. var c = configs.items[i];
  25995. if (ambigAlts.contains(c.alt)) {
  25996. altToPred[c.alt] = SemanticContext.orContext(altToPred[c.alt] || null, c.semanticContext);
  25997. }
  25998. }
  25999. var nPredAlts = 0;
  26000. for (i = 1; i < nalts + 1; i++) {
  26001. var pred = altToPred[i] || null;
  26002. if (pred === null) {
  26003. altToPred[i] = SemanticContext.NONE;
  26004. } else if (pred !== SemanticContext.NONE) {
  26005. nPredAlts += 1;
  26006. }
  26007. }
  26008. // nonambig alts are null in altToPred
  26009. if (nPredAlts === 0) {
  26010. altToPred = null;
  26011. }
  26012. if (this.debug) {
  26013. console.log("getPredsForAmbigAlts result " + Utils.arrayToString(altToPred));
  26014. }
  26015. return altToPred;
  26016. };
  26017. ParserATNSimulator.prototype.getPredicatePredictions = function (ambigAlts, altToPred) {
  26018. var pairs = [];
  26019. var containsPredicate = false;
  26020. for (var i = 1; i < altToPred.length; i++) {
  26021. var pred = altToPred[i];
  26022. // unpredicated is indicated by SemanticContext.NONE
  26023. if (ambigAlts !== null && ambigAlts.contains(i)) {
  26024. pairs.push(new PredPrediction(pred, i));
  26025. }
  26026. if (pred !== SemanticContext.NONE) {
  26027. containsPredicate = true;
  26028. }
  26029. }
  26030. if (!containsPredicate) {
  26031. return null;
  26032. }
  26033. return pairs;
  26034. };
  26035. //
  26036. // This method is used to improve the localization of error messages by
  26037. // choosing an alternative rather than throwing a
  26038. // {@link NoViableAltException} in particular prediction scenarios where the
  26039. // {@link //ERROR} state was reached during ATN simulation.
  26040. //
  26041. // <p>
  26042. // The default implementation of this method uses the following
  26043. // algorithm to identify an ATN configuration which successfully parsed the
  26044. // decision entry rule. Choosing such an alternative ensures that the
  26045. // {@link ParserRuleContext} returned by the calling rule will be complete
  26046. // and valid, and the syntax error will be reported later at a more
  26047. // localized location.</p>
  26048. //
  26049. // <ul>
  26050. // <li>If a syntactically valid path or paths reach the end of the decision rule and
  26051. // they are semantically valid if predicated, return the min associated alt.</li>
  26052. // <li>Else, if a semantically invalid but syntactically valid path exist
  26053. // or paths exist, return the minimum associated alt.
  26054. // </li>
  26055. // <li>Otherwise, return {@link ATN//INVALID_ALT_NUMBER}.</li>
  26056. // </ul>
  26057. //
  26058. // <p>
  26059. // In some scenarios, the algorithm described above could predict an
  26060. // alternative which will result in a {@link FailedPredicateException} in
  26061. // the parser. Specifically, this could occur if the <em>only</em> configuration
  26062. // capable of successfully parsing to the end of the decision rule is
  26063. // blocked by a semantic predicate. By choosing this alternative within
  26064. // {@link //adaptivePredict} instead of throwing a
  26065. // {@link NoViableAltException}, the resulting
  26066. // {@link FailedPredicateException} in the parser will identify the specific
  26067. // predicate which is preventing the parser from successfully parsing the
  26068. // decision rule, which helps developers identify and correct logic errors
  26069. // in semantic predicates.
  26070. // </p>
  26071. //
  26072. // @param configs The ATN configurations which were valid immediately before
  26073. // the {@link //ERROR} state was reached
  26074. // @param outerContext The is the \gamma_0 initial parser context from the paper
  26075. // or the parser stack at the instant before prediction commences.
  26076. //
  26077. // @return The value to return from {@link //adaptivePredict}, or
  26078. // {@link ATN//INVALID_ALT_NUMBER} if a suitable alternative was not
  26079. // identified and {@link //adaptivePredict} should report an error instead.
  26080. //
  26081. ParserATNSimulator.prototype.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule = function (configs, outerContext) {
  26082. var cfgs = this.splitAccordingToSemanticValidity(configs, outerContext);
  26083. var semValidConfigs = cfgs[0];
  26084. var semInvalidConfigs = cfgs[1];
  26085. var alt = this.getAltThatFinishedDecisionEntryRule(semValidConfigs);
  26086. if (alt !== ATN.INVALID_ALT_NUMBER) {
  26087. // semantically/syntactically viable path exists
  26088. return alt;
  26089. }
  26090. // Is there a syntactically valid path with a failed pred?
  26091. if (semInvalidConfigs.items.length > 0) {
  26092. alt = this.getAltThatFinishedDecisionEntryRule(semInvalidConfigs);
  26093. if (alt !== ATN.INVALID_ALT_NUMBER) {
  26094. // syntactically viable path exists
  26095. return alt;
  26096. }
  26097. }
  26098. return ATN.INVALID_ALT_NUMBER;
  26099. };
  26100. ParserATNSimulator.prototype.getAltThatFinishedDecisionEntryRule = function (configs) {
  26101. var alts = [];
  26102. for (var i = 0; i < configs.items.length; i++) {
  26103. var c = configs.items[i];
  26104. if (c.reachesIntoOuterContext > 0 || c.state instanceof RuleStopState && c.context.hasEmptyPath()) {
  26105. if (alts.indexOf(c.alt) < 0) {
  26106. alts.push(c.alt);
  26107. }
  26108. }
  26109. }
  26110. if (alts.length === 0) {
  26111. return ATN.INVALID_ALT_NUMBER;
  26112. } else {
  26113. return Math.min.apply(null, alts);
  26114. }
  26115. };
  26116. // Walk the list of configurations and split them according to
  26117. // those that have preds evaluating to true/false. If no pred, assume
  26118. // true pred and include in succeeded set. Returns Pair of sets.
  26119. //
  26120. // Create a new set so as not to alter the incoming parameter.
  26121. //
  26122. // Assumption: the input stream has been restored to the starting point
  26123. // prediction, which is where predicates need to evaluate.
  26124. //
  26125. ParserATNSimulator.prototype.splitAccordingToSemanticValidity = function (configs, outerContext) {
  26126. var succeeded = new ATNConfigSet(configs.fullCtx);
  26127. var failed = new ATNConfigSet(configs.fullCtx);
  26128. for (var i = 0; i < configs.items.length; i++) {
  26129. var c = configs.items[i];
  26130. if (c.semanticContext !== SemanticContext.NONE) {
  26131. var predicateEvaluationResult = c.semanticContext.evaluate(this.parser, outerContext);
  26132. if (predicateEvaluationResult) {
  26133. succeeded.add(c);
  26134. } else {
  26135. failed.add(c);
  26136. }
  26137. } else {
  26138. succeeded.add(c);
  26139. }
  26140. }
  26141. return [succeeded, failed];
  26142. };
  26143. // Look through a list of predicate/alt pairs, returning alts for the
  26144. // pairs that win. A {@code NONE} predicate indicates an alt containing an
  26145. // unpredicated config which behaves as "always true." If !complete
  26146. // then we stop at the first predicate that evaluates to true. This
  26147. // includes pairs with null predicates.
  26148. //
  26149. ParserATNSimulator.prototype.evalSemanticContext = function (predPredictions, outerContext, complete) {
  26150. var predictions = new BitSet();
  26151. for (var i = 0; i < predPredictions.length; i++) {
  26152. var pair = predPredictions[i];
  26153. if (pair.pred === SemanticContext.NONE) {
  26154. predictions.add(pair.alt);
  26155. if (!complete) {
  26156. break;
  26157. }
  26158. continue;
  26159. }
  26160. var predicateEvaluationResult = pair.pred.evaluate(this.parser, outerContext);
  26161. if (this.debug || this.dfa_debug) {
  26162. console.log("eval pred " + pair + "=" + predicateEvaluationResult);
  26163. }
  26164. if (predicateEvaluationResult) {
  26165. if (this.debug || this.dfa_debug) {
  26166. console.log("PREDICT " + pair.alt);
  26167. }
  26168. predictions.add(pair.alt);
  26169. if (!complete) {
  26170. break;
  26171. }
  26172. }
  26173. }
  26174. return predictions;
  26175. };
  26176. // TODO: If we are doing predicates, there is no point in pursuing
  26177. // closure operations if we reach a DFA state that uniquely predicts
  26178. // alternative. We will not be caching that DFA state and it is a
  26179. // waste to pursue the closure. Might have to advance when we do
  26180. // ambig detection thought :(
  26181. //
  26182. ParserATNSimulator.prototype.closure = function (config, configs, closureBusy, collectPredicates, fullCtx, treatEofAsEpsilon) {
  26183. var initialDepth = 0;
  26184. this.closureCheckingStopState(config, configs, closureBusy, collectPredicates, fullCtx, initialDepth, treatEofAsEpsilon);
  26185. };
  26186. ParserATNSimulator.prototype.closureCheckingStopState = function (config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  26187. if (this.debug || this.debug_closure) {
  26188. console.log("closure(" + config.toString(this.parser, true) + ")");
  26189. // console.log("configs(" + configs.toString() + ")");
  26190. if (config.reachesIntoOuterContext > 50) {
  26191. throw "problem";
  26192. }
  26193. }
  26194. if (config.state instanceof RuleStopState) {
  26195. // We hit rule end. If we have context info, use it
  26196. // run thru all possible stack tops in ctx
  26197. if (!config.context.isEmpty()) {
  26198. for (var i = 0; i < config.context.length; i++) {
  26199. if (config.context.getReturnState(i) === PredictionContext.EMPTY_RETURN_STATE) {
  26200. if (fullCtx) {
  26201. configs.add(new ATNConfig({ state: config.state, context: PredictionContext.EMPTY }, config), this.mergeCache);
  26202. continue;
  26203. } else {
  26204. // we have no context info, just chase follow links (if greedy)
  26205. if (this.debug) {
  26206. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  26207. }
  26208. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  26209. }
  26210. continue;
  26211. }
  26212. var returnState = this.atn.states[config.context.getReturnState(i)];
  26213. var newContext = config.context.getParent(i); // "pop" return state
  26214. var parms = { state: returnState, alt: config.alt, context: newContext, semanticContext: config.semanticContext };
  26215. var c = new ATNConfig(parms, null);
  26216. // While we have context to pop back from, we may have
  26217. // gotten that context AFTER having falling off a rule.
  26218. // Make sure we track that we are now out of context.
  26219. c.reachesIntoOuterContext = config.reachesIntoOuterContext;
  26220. this.closureCheckingStopState(c, configs, closureBusy, collectPredicates, fullCtx, depth - 1, treatEofAsEpsilon);
  26221. }
  26222. return;
  26223. } else if (fullCtx) {
  26224. // reached end of start rule
  26225. configs.add(config, this.mergeCache);
  26226. return;
  26227. } else {
  26228. // else if we have no context info, just chase follow links (if greedy)
  26229. if (this.debug) {
  26230. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  26231. }
  26232. }
  26233. }
  26234. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  26235. };
  26236. // Do the actual work of walking epsilon edges//
  26237. ParserATNSimulator.prototype.closure_ = function (config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  26238. var p = config.state;
  26239. // optimization
  26240. if (!p.epsilonOnlyTransitions) {
  26241. configs.add(config, this.mergeCache);
  26242. // make sure to not return here, because EOF transitions can act as
  26243. // both epsilon transitions and non-epsilon transitions.
  26244. }
  26245. for (var i = 0; i < p.transitions.length; i++) {
  26246. if (i == 0 && this.canDropLoopEntryEdgeInLeftRecursiveRule(config)) continue;
  26247. var t = p.transitions[i];
  26248. var continueCollecting = collectPredicates && !(t instanceof ActionTransition);
  26249. var c = this.getEpsilonTarget(config, t, continueCollecting, depth === 0, fullCtx, treatEofAsEpsilon);
  26250. if (c !== null) {
  26251. if (!t.isEpsilon && closureBusy.add(c) !== c) {
  26252. // avoid infinite recursion for EOF* and EOF+
  26253. continue;
  26254. }
  26255. var newDepth = depth;
  26256. if (config.state instanceof RuleStopState) {
  26257. // target fell off end of rule; mark resulting c as having dipped into outer context
  26258. // We can't get here if incoming config was rule stop and we had context
  26259. // track how far we dip into outer context. Might
  26260. // come in handy and we avoid evaluating context dependent
  26261. // preds if this is > 0.
  26262. if (closureBusy.add(c) !== c) {
  26263. // avoid infinite recursion for right-recursive rules
  26264. continue;
  26265. }
  26266. if (this._dfa !== null && this._dfa.precedenceDfa) {
  26267. if (t.outermostPrecedenceReturn === this._dfa.atnStartState.ruleIndex) {
  26268. c.precedenceFilterSuppressed = true;
  26269. }
  26270. }
  26271. c.reachesIntoOuterContext += 1;
  26272. configs.dipsIntoOuterContext = true; // TODO: can remove? only care when we add to set per middle of this method
  26273. newDepth -= 1;
  26274. if (this.debug) {
  26275. console.log("dips into outer ctx: " + c);
  26276. }
  26277. } else if (t instanceof RuleTransition) {
  26278. // latch when newDepth goes negative - once we step out of the entry context we can't return
  26279. if (newDepth >= 0) {
  26280. newDepth += 1;
  26281. }
  26282. }
  26283. this.closureCheckingStopState(c, configs, closureBusy, continueCollecting, fullCtx, newDepth, treatEofAsEpsilon);
  26284. }
  26285. }
  26286. };
  26287. ParserATNSimulator.prototype.canDropLoopEntryEdgeInLeftRecursiveRule = function (config) {
  26288. // return False
  26289. var p = config.state;
  26290. // First check to see if we are in StarLoopEntryState generated during
  26291. // left-recursion elimination. For efficiency, also check if
  26292. // the context has an empty stack case. If so, it would mean
  26293. // global FOLLOW so we can't perform optimization
  26294. // Are we the special loop entry/exit state? or SLL wildcard
  26295. if (p.stateType != ATNState.STAR_LOOP_ENTRY) return false;
  26296. if (p.stateType != ATNState.STAR_LOOP_ENTRY || !p.isPrecedenceDecision || config.context.isEmpty() || config.context.hasEmptyPath()) return false;
  26297. // Require all return states to return back to the same rule that p is in.
  26298. var numCtxs = config.context.length;
  26299. for (var i = 0; i < numCtxs; i++) {
  26300. // for each stack context
  26301. var returnState = this.atn.states[config.context.getReturnState(i)];
  26302. if (returnState.ruleIndex != p.ruleIndex) return false;
  26303. }
  26304. var decisionStartState = p.transitions[0].target;
  26305. var blockEndStateNum = decisionStartState.endState.stateNumber;
  26306. var blockEndState = this.atn.states[blockEndStateNum];
  26307. // Verify that the top of each stack context leads to loop entry/exit
  26308. // state through epsilon edges and w/o leaving rule.
  26309. for (var i = 0; i < numCtxs; i++) {
  26310. // for each stack context
  26311. var returnStateNumber = config.context.getReturnState(i);
  26312. var returnState = this.atn.states[returnStateNumber];
  26313. // all states must have single outgoing epsilon edge
  26314. if (returnState.transitions.length != 1 || !returnState.transitions[0].isEpsilon) return false;
  26315. // Look for prefix op case like 'not expr', (' type ')' expr
  26316. var returnStateTarget = returnState.transitions[0].target;
  26317. if (returnState.stateType == ATNState.BLOCK_END && returnStateTarget == p) continue;
  26318. // Look for 'expr op expr' or case where expr's return state is block end
  26319. // of (...)* internal block; the block end points to loop back
  26320. // which points to p but we don't need to check that
  26321. if (returnState == blockEndState) continue;
  26322. // Look for ternary expr ? expr : expr. The return state points at block end,
  26323. // which points at loop entry state
  26324. if (returnStateTarget == blockEndState) continue;
  26325. // Look for complex prefix 'between expr and expr' case where 2nd expr's
  26326. // return state points at block end state of (...)* internal block
  26327. if (returnStateTarget.stateType == ATNState.BLOCK_END && returnStateTarget.transitions.length == 1 && returnStateTarget.transitions[0].isEpsilon && returnStateTarget.transitions[0].target == p) continue;
  26328. // anything else ain't conforming
  26329. return false;
  26330. }
  26331. return true;
  26332. };
  26333. ParserATNSimulator.prototype.getRuleName = function (index) {
  26334. if (this.parser !== null && index >= 0) {
  26335. return this.parser.ruleNames[index];
  26336. } else {
  26337. return "<rule " + index + ">";
  26338. }
  26339. };
  26340. ParserATNSimulator.prototype.getEpsilonTarget = function (config, t, collectPredicates, inContext, fullCtx, treatEofAsEpsilon) {
  26341. switch (t.serializationType) {
  26342. case Transition.RULE:
  26343. return this.ruleTransition(config, t);
  26344. case Transition.PRECEDENCE:
  26345. return this.precedenceTransition(config, t, collectPredicates, inContext, fullCtx);
  26346. case Transition.PREDICATE:
  26347. return this.predTransition(config, t, collectPredicates, inContext, fullCtx);
  26348. case Transition.ACTION:
  26349. return this.actionTransition(config, t);
  26350. case Transition.EPSILON:
  26351. return new ATNConfig({ state: t.target }, config);
  26352. case Transition.ATOM:
  26353. case Transition.RANGE:
  26354. case Transition.SET:
  26355. // EOF transitions act like epsilon transitions after the first EOF
  26356. // transition is traversed
  26357. if (treatEofAsEpsilon) {
  26358. if (t.matches(Token.EOF, 0, 1)) {
  26359. return new ATNConfig({ state: t.target }, config);
  26360. }
  26361. }
  26362. return null;
  26363. default:
  26364. return null;
  26365. }
  26366. };
  26367. ParserATNSimulator.prototype.actionTransition = function (config, t) {
  26368. if (this.debug) {
  26369. var index = t.actionIndex == -1 ? 65535 : t.actionIndex;
  26370. console.log("ACTION edge " + t.ruleIndex + ":" + index);
  26371. }
  26372. return new ATNConfig({ state: t.target }, config);
  26373. };
  26374. ParserATNSimulator.prototype.precedenceTransition = function (config, pt, collectPredicates, inContext, fullCtx) {
  26375. if (this.debug) {
  26376. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.precedence + ">=_p, ctx dependent=true");
  26377. if (this.parser !== null) {
  26378. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  26379. }
  26380. }
  26381. var c = null;
  26382. if (collectPredicates && inContext) {
  26383. if (fullCtx) {
  26384. // In full context mode, we can evaluate predicates on-the-fly
  26385. // during closure, which dramatically reduces the size of
  26386. // the config sets. It also obviates the need to test predicates
  26387. // later during conflict resolution.
  26388. var currentPosition = this._input.index;
  26389. this._input.seek(this._startIndex);
  26390. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  26391. this._input.seek(currentPosition);
  26392. if (predSucceeds) {
  26393. c = new ATNConfig({ state: pt.target }, config); // no pred context
  26394. }
  26395. } else {
  26396. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  26397. c = new ATNConfig({ state: pt.target, semanticContext: newSemCtx }, config);
  26398. }
  26399. } else {
  26400. c = new ATNConfig({ state: pt.target }, config);
  26401. }
  26402. if (this.debug) {
  26403. console.log("config from pred transition=" + c);
  26404. }
  26405. return c;
  26406. };
  26407. ParserATNSimulator.prototype.predTransition = function (config, pt, collectPredicates, inContext, fullCtx) {
  26408. if (this.debug) {
  26409. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.ruleIndex + ":" + pt.predIndex + ", ctx dependent=" + pt.isCtxDependent);
  26410. if (this.parser !== null) {
  26411. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  26412. }
  26413. }
  26414. var c = null;
  26415. if (collectPredicates && (pt.isCtxDependent && inContext || !pt.isCtxDependent)) {
  26416. if (fullCtx) {
  26417. // In full context mode, we can evaluate predicates on-the-fly
  26418. // during closure, which dramatically reduces the size of
  26419. // the config sets. It also obviates the need to test predicates
  26420. // later during conflict resolution.
  26421. var currentPosition = this._input.index;
  26422. this._input.seek(this._startIndex);
  26423. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  26424. this._input.seek(currentPosition);
  26425. if (predSucceeds) {
  26426. c = new ATNConfig({ state: pt.target }, config); // no pred context
  26427. }
  26428. } else {
  26429. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  26430. c = new ATNConfig({ state: pt.target, semanticContext: newSemCtx }, config);
  26431. }
  26432. } else {
  26433. c = new ATNConfig({ state: pt.target }, config);
  26434. }
  26435. if (this.debug) {
  26436. console.log("config from pred transition=" + c);
  26437. }
  26438. return c;
  26439. };
  26440. ParserATNSimulator.prototype.ruleTransition = function (config, t) {
  26441. if (this.debug) {
  26442. console.log("CALL rule " + this.getRuleName(t.target.ruleIndex) + ", ctx=" + config.context);
  26443. }
  26444. var returnState = t.followState;
  26445. var newContext = SingletonPredictionContext.create(config.context, returnState.stateNumber);
  26446. return new ATNConfig({ state: t.target, context: newContext }, config);
  26447. };
  26448. ParserATNSimulator.prototype.getConflictingAlts = function (configs) {
  26449. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  26450. return PredictionMode.getAlts(altsets);
  26451. };
  26452. // Sam pointed out a problem with the previous definition, v3, of
  26453. // ambiguous states. If we have another state associated with conflicting
  26454. // alternatives, we should keep going. For example, the following grammar
  26455. //
  26456. // s : (ID | ID ID?) ';' ;
  26457. //
  26458. // When the ATN simulation reaches the state before ';', it has a DFA
  26459. // state that looks like: [12|1|[], 6|2|[], 12|2|[]]. Naturally
  26460. // 12|1|[] and 12|2|[] conflict, but we cannot stop processing this node
  26461. // because alternative to has another way to continue, via [6|2|[]].
  26462. // The key is that we have a single state that has config's only associated
  26463. // with a single alternative, 2, and crucially the state transitions
  26464. // among the configurations are all non-epsilon transitions. That means
  26465. // we don't consider any conflicts that include alternative 2. So, we
  26466. // ignore the conflict between alts 1 and 2. We ignore a set of
  26467. // conflicting alts when there is an intersection with an alternative
  26468. // associated with a single alt state in the state&rarr;config-list map.
  26469. //
  26470. // It's also the case that we might have two conflicting configurations but
  26471. // also a 3rd nonconflicting configuration for a different alternative:
  26472. // [1|1|[], 1|2|[], 8|3|[]]. This can come about from grammar:
  26473. //
  26474. // a : A | A | A B ;
  26475. //
  26476. // After matching input A, we reach the stop state for rule A, state 1.
  26477. // State 8 is the state right before B. Clearly alternatives 1 and 2
  26478. // conflict and no amount of further lookahead will separate the two.
  26479. // However, alternative 3 will be able to continue and so we do not
  26480. // stop working on this state. In the previous example, we're concerned
  26481. // with states associated with the conflicting alternatives. Here alt
  26482. // 3 is not associated with the conflicting configs, but since we can continue
  26483. // looking for input reasonably, I don't declare the state done. We
  26484. // ignore a set of conflicting alts when we have an alternative
  26485. // that we still need to pursue.
  26486. //
  26487. ParserATNSimulator.prototype.getConflictingAltsOrUniqueAlt = function (configs) {
  26488. var conflictingAlts = null;
  26489. if (configs.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  26490. conflictingAlts = new BitSet();
  26491. conflictingAlts.add(configs.uniqueAlt);
  26492. } else {
  26493. conflictingAlts = configs.conflictingAlts;
  26494. }
  26495. return conflictingAlts;
  26496. };
  26497. ParserATNSimulator.prototype.getTokenName = function (t) {
  26498. if (t === Token.EOF) {
  26499. return "EOF";
  26500. }
  26501. if (this.parser !== null && this.parser.literalNames !== null) {
  26502. if (t >= this.parser.literalNames.length && t >= this.parser.symbolicNames.length) {
  26503. console.log("" + t + " ttype out of range: " + this.parser.literalNames);
  26504. console.log("" + this.parser.getInputStream().getTokens());
  26505. } else {
  26506. var name = this.parser.literalNames[t] || this.parser.symbolicNames[t];
  26507. return name + "<" + t + ">";
  26508. }
  26509. }
  26510. return "" + t;
  26511. };
  26512. ParserATNSimulator.prototype.getLookaheadName = function (input) {
  26513. return this.getTokenName(input.LA(1));
  26514. };
  26515. // Used for debugging in adaptivePredict around execATN but I cut
  26516. // it out for clarity now that alg. works well. We can leave this
  26517. // "dead" code for a bit.
  26518. //
  26519. ParserATNSimulator.prototype.dumpDeadEndConfigs = function (nvae) {
  26520. console.log("dead end configs: ");
  26521. var decs = nvae.getDeadEndConfigs();
  26522. for (var i = 0; i < decs.length; i++) {
  26523. var c = decs[i];
  26524. var trans = "no edges";
  26525. if (c.state.transitions.length > 0) {
  26526. var t = c.state.transitions[0];
  26527. if (t instanceof AtomTransition) {
  26528. trans = "Atom " + this.getTokenName(t.label);
  26529. } else if (t instanceof SetTransition) {
  26530. var neg = t instanceof NotSetTransition;
  26531. trans = (neg ? "~" : "") + "Set " + t.set;
  26532. }
  26533. }
  26534. console.error(c.toString(this.parser, true) + ":" + trans);
  26535. }
  26536. };
  26537. ParserATNSimulator.prototype.noViableAlt = function (input, outerContext, configs, startIndex) {
  26538. return new NoViableAltException(this.parser, input, input.get(startIndex), input.LT(1), configs, outerContext);
  26539. };
  26540. ParserATNSimulator.prototype.getUniqueAlt = function (configs) {
  26541. var alt = ATN.INVALID_ALT_NUMBER;
  26542. for (var i = 0; i < configs.items.length; i++) {
  26543. var c = configs.items[i];
  26544. if (alt === ATN.INVALID_ALT_NUMBER) {
  26545. alt = c.alt; // found first alt
  26546. } else if (c.alt !== alt) {
  26547. return ATN.INVALID_ALT_NUMBER;
  26548. }
  26549. }
  26550. return alt;
  26551. };
  26552. //
  26553. // Add an edge to the DFA, if possible. This method calls
  26554. // {@link //addDFAState} to ensure the {@code to} state is present in the
  26555. // DFA. If {@code from} is {@code null}, or if {@code t} is outside the
  26556. // range of edges that can be represented in the DFA tables, this method
  26557. // returns without adding the edge to the DFA.
  26558. //
  26559. // <p>If {@code to} is {@code null}, this method returns {@code null}.
  26560. // Otherwise, this method returns the {@link DFAState} returned by calling
  26561. // {@link //addDFAState} for the {@code to} state.</p>
  26562. //
  26563. // @param dfa The DFA
  26564. // @param from The source state for the edge
  26565. // @param t The input symbol
  26566. // @param to The target state for the edge
  26567. //
  26568. // @return If {@code to} is {@code null}, this method returns {@code null};
  26569. // otherwise this method returns the result of calling {@link //addDFAState}
  26570. // on {@code to}
  26571. //
  26572. ParserATNSimulator.prototype.addDFAEdge = function (dfa, from_, t, to) {
  26573. if (this.debug) {
  26574. console.log("EDGE " + from_ + " -> " + to + " upon " + this.getTokenName(t));
  26575. }
  26576. if (to === null) {
  26577. return null;
  26578. }
  26579. to = this.addDFAState(dfa, to); // used existing if possible not incoming
  26580. if (from_ === null || t < -1 || t > this.atn.maxTokenType) {
  26581. return to;
  26582. }
  26583. if (from_.edges === null) {
  26584. from_.edges = [];
  26585. }
  26586. from_.edges[t + 1] = to; // connect
  26587. if (this.debug) {
  26588. var literalNames = this.parser === null ? null : this.parser.literalNames;
  26589. var symbolicNames = this.parser === null ? null : this.parser.symbolicNames;
  26590. console.log("DFA=\n" + dfa.toString(literalNames, symbolicNames));
  26591. }
  26592. return to;
  26593. };
  26594. //
  26595. // Add state {@code D} to the DFA if it is not already present, and return
  26596. // the actual instance stored in the DFA. If a state equivalent to {@code D}
  26597. // is already in the DFA, the existing state is returned. Otherwise this
  26598. // method returns {@code D} after adding it to the DFA.
  26599. //
  26600. // <p>If {@code D} is {@link //ERROR}, this method returns {@link //ERROR} and
  26601. // does not change the DFA.</p>
  26602. //
  26603. // @param dfa The dfa
  26604. // @param D The DFA state to add
  26605. // @return The state stored in the DFA. This will be either the existing
  26606. // state if {@code D} is already in the DFA, or {@code D} itself if the
  26607. // state was not already present.
  26608. //
  26609. ParserATNSimulator.prototype.addDFAState = function (dfa, D) {
  26610. if (D == ATNSimulator.ERROR) {
  26611. return D;
  26612. }
  26613. var existing = dfa.states.get(D);
  26614. if (existing !== null) {
  26615. return existing;
  26616. }
  26617. D.stateNumber = dfa.states.length;
  26618. if (!D.configs.readOnly) {
  26619. D.configs.optimizeConfigs(this);
  26620. D.configs.setReadonly(true);
  26621. }
  26622. dfa.states.add(D);
  26623. if (this.debug) {
  26624. console.log("adding new DFA state: " + D);
  26625. }
  26626. return D;
  26627. };
  26628. ParserATNSimulator.prototype.reportAttemptingFullContext = function (dfa, conflictingAlts, configs, startIndex, stopIndex) {
  26629. if (this.debug || this.retry_debug) {
  26630. var interval = new Interval(startIndex, stopIndex + 1);
  26631. console.log("reportAttemptingFullContext decision=" + dfa.decision + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  26632. }
  26633. if (this.parser !== null) {
  26634. this.parser.getErrorListenerDispatch().reportAttemptingFullContext(this.parser, dfa, startIndex, stopIndex, conflictingAlts, configs);
  26635. }
  26636. };
  26637. ParserATNSimulator.prototype.reportContextSensitivity = function (dfa, prediction, configs, startIndex, stopIndex) {
  26638. if (this.debug || this.retry_debug) {
  26639. var interval = new Interval(startIndex, stopIndex + 1);
  26640. console.log("reportContextSensitivity decision=" + dfa.decision + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  26641. }
  26642. if (this.parser !== null) {
  26643. this.parser.getErrorListenerDispatch().reportContextSensitivity(this.parser, dfa, startIndex, stopIndex, prediction, configs);
  26644. }
  26645. };
  26646. // If context sensitive parsing, we know it's ambiguity not conflict//
  26647. ParserATNSimulator.prototype.reportAmbiguity = function (dfa, D, startIndex, stopIndex, exact, ambigAlts, configs) {
  26648. if (this.debug || this.retry_debug) {
  26649. var interval = new Interval(startIndex, stopIndex + 1);
  26650. console.log("reportAmbiguity " + ambigAlts + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  26651. }
  26652. if (this.parser !== null) {
  26653. this.parser.getErrorListenerDispatch().reportAmbiguity(this.parser, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  26654. }
  26655. };
  26656. exports.ParserATNSimulator = ParserATNSimulator;
  26657. /***/ }),
  26658. /***/ "./node_modules/antlr4/atn/PredictionMode.js":
  26659. /*!***************************************************!*\
  26660. !*** ./node_modules/antlr4/atn/PredictionMode.js ***!
  26661. \***************************************************/
  26662. /*! no static exports found */
  26663. /***/ (function(module, exports, __webpack_require__) {
  26664. "use strict";
  26665. //
  26666. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26667. * Use of this file is governed by the BSD 3-clause license that
  26668. * can be found in the LICENSE.txt file in the project root.
  26669. */
  26670. //
  26671. //
  26672. // This enumeration defines the prediction modes available in ANTLR 4 along with
  26673. // utility methods for analyzing configuration sets for conflicts and/or
  26674. // ambiguities.
  26675. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  26676. var Map = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Map;
  26677. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  26678. var AltDict = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").AltDict;
  26679. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  26680. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  26681. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  26682. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  26683. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  26684. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  26685. var hashStuff = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  26686. var equalArrays = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").equalArrays;
  26687. function PredictionMode() {
  26688. return this;
  26689. }
  26690. //
  26691. // The SLL(*) prediction mode. This prediction mode ignores the current
  26692. // parser context when making predictions. This is the fastest prediction
  26693. // mode, and provides correct results for many grammars. This prediction
  26694. // mode is more powerful than the prediction mode provided by ANTLR 3, but
  26695. // may result in syntax errors for grammar and input combinations which are
  26696. // not SLL.
  26697. //
  26698. // <p>
  26699. // When using this prediction mode, the parser will either return a correct
  26700. // parse tree (i.e. the same parse tree that would be returned with the
  26701. // {@link //LL} prediction mode), or it will report a syntax error. If a
  26702. // syntax error is encountered when using the {@link //SLL} prediction mode,
  26703. // it may be due to either an actual syntax error in the input or indicate
  26704. // that the particular combination of grammar and input requires the more
  26705. // powerful {@link //LL} prediction abilities to complete successfully.</p>
  26706. //
  26707. // <p>
  26708. // This prediction mode does not provide any guarantees for prediction
  26709. // behavior for syntactically-incorrect inputs.</p>
  26710. //
  26711. PredictionMode.SLL = 0;
  26712. //
  26713. // The LL(*) prediction mode. This prediction mode allows the current parser
  26714. // context to be used for resolving SLL conflicts that occur during
  26715. // prediction. This is the fastest prediction mode that guarantees correct
  26716. // parse results for all combinations of grammars with syntactically correct
  26717. // inputs.
  26718. //
  26719. // <p>
  26720. // When using this prediction mode, the parser will make correct decisions
  26721. // for all syntactically-correct grammar and input combinations. However, in
  26722. // cases where the grammar is truly ambiguous this prediction mode might not
  26723. // report a precise answer for <em>exactly which</em> alternatives are
  26724. // ambiguous.</p>
  26725. //
  26726. // <p>
  26727. // This prediction mode does not provide any guarantees for prediction
  26728. // behavior for syntactically-incorrect inputs.</p>
  26729. //
  26730. PredictionMode.LL = 1;
  26731. //
  26732. // The LL(*) prediction mode with exact ambiguity detection. In addition to
  26733. // the correctness guarantees provided by the {@link //LL} prediction mode,
  26734. // this prediction mode instructs the prediction algorithm to determine the
  26735. // complete and exact set of ambiguous alternatives for every ambiguous
  26736. // decision encountered while parsing.
  26737. //
  26738. // <p>
  26739. // This prediction mode may be used for diagnosing ambiguities during
  26740. // grammar development. Due to the performance overhead of calculating sets
  26741. // of ambiguous alternatives, this prediction mode should be avoided when
  26742. // the exact results are not necessary.</p>
  26743. //
  26744. // <p>
  26745. // This prediction mode does not provide any guarantees for prediction
  26746. // behavior for syntactically-incorrect inputs.</p>
  26747. //
  26748. PredictionMode.LL_EXACT_AMBIG_DETECTION = 2;
  26749. //
  26750. // Computes the SLL prediction termination condition.
  26751. //
  26752. // <p>
  26753. // This method computes the SLL prediction termination condition for both of
  26754. // the following cases.</p>
  26755. //
  26756. // <ul>
  26757. // <li>The usual SLL+LL fallback upon SLL conflict</li>
  26758. // <li>Pure SLL without LL fallback</li>
  26759. // </ul>
  26760. //
  26761. // <p><strong>COMBINED SLL+LL PARSING</strong></p>
  26762. //
  26763. // <p>When LL-fallback is enabled upon SLL conflict, correct predictions are
  26764. // ensured regardless of how the termination condition is computed by this
  26765. // method. Due to the substantially higher cost of LL prediction, the
  26766. // prediction should only fall back to LL when the additional lookahead
  26767. // cannot lead to a unique SLL prediction.</p>
  26768. //
  26769. // <p>Assuming combined SLL+LL parsing, an SLL configuration set with only
  26770. // conflicting subsets should fall back to full LL, even if the
  26771. // configuration sets don't resolve to the same alternative (e.g.
  26772. // {@code {1,2}} and {@code {3,4}}. If there is at least one non-conflicting
  26773. // configuration, SLL could continue with the hopes that more lookahead will
  26774. // resolve via one of those non-conflicting configurations.</p>
  26775. //
  26776. // <p>Here's the prediction termination rule them: SLL (for SLL+LL parsing)
  26777. // stops when it sees only conflicting configuration subsets. In contrast,
  26778. // full LL keeps going when there is uncertainty.</p>
  26779. //
  26780. // <p><strong>HEURISTIC</strong></p>
  26781. //
  26782. // <p>As a heuristic, we stop prediction when we see any conflicting subset
  26783. // unless we see a state that only has one alternative associated with it.
  26784. // The single-alt-state thing lets prediction continue upon rules like
  26785. // (otherwise, it would admit defeat too soon):</p>
  26786. //
  26787. // <p>{@code [12|1|[], 6|2|[], 12|2|[]]. s : (ID | ID ID?) ';' ;}</p>
  26788. //
  26789. // <p>When the ATN simulation reaches the state before {@code ';'}, it has a
  26790. // DFA state that looks like: {@code [12|1|[], 6|2|[], 12|2|[]]}. Naturally
  26791. // {@code 12|1|[]} and {@code 12|2|[]} conflict, but we cannot stop
  26792. // processing this node because alternative to has another way to continue,
  26793. // via {@code [6|2|[]]}.</p>
  26794. //
  26795. // <p>It also let's us continue for this rule:</p>
  26796. //
  26797. // <p>{@code [1|1|[], 1|2|[], 8|3|[]] a : A | A | A B ;}</p>
  26798. //
  26799. // <p>After matching input A, we reach the stop state for rule A, state 1.
  26800. // State 8 is the state right before B. Clearly alternatives 1 and 2
  26801. // conflict and no amount of further lookahead will separate the two.
  26802. // However, alternative 3 will be able to continue and so we do not stop
  26803. // working on this state. In the previous example, we're concerned with
  26804. // states associated with the conflicting alternatives. Here alt 3 is not
  26805. // associated with the conflicting configs, but since we can continue
  26806. // looking for input reasonably, don't declare the state done.</p>
  26807. //
  26808. // <p><strong>PURE SLL PARSING</strong></p>
  26809. //
  26810. // <p>To handle pure SLL parsing, all we have to do is make sure that we
  26811. // combine stack contexts for configurations that differ only by semantic
  26812. // predicate. From there, we can do the usual SLL termination heuristic.</p>
  26813. //
  26814. // <p><strong>PREDICATES IN SLL+LL PARSING</strong></p>
  26815. //
  26816. // <p>SLL decisions don't evaluate predicates until after they reach DFA stop
  26817. // states because they need to create the DFA cache that works in all
  26818. // semantic situations. In contrast, full LL evaluates predicates collected
  26819. // during start state computation so it can ignore predicates thereafter.
  26820. // This means that SLL termination detection can totally ignore semantic
  26821. // predicates.</p>
  26822. //
  26823. // <p>Implementation-wise, {@link ATNConfigSet} combines stack contexts but not
  26824. // semantic predicate contexts so we might see two configurations like the
  26825. // following.</p>
  26826. //
  26827. // <p>{@code (s, 1, x, {}), (s, 1, x', {p})}</p>
  26828. //
  26829. // <p>Before testing these configurations against others, we have to merge
  26830. // {@code x} and {@code x'} (without modifying the existing configurations).
  26831. // For example, we test {@code (x+x')==x''} when looking for conflicts in
  26832. // the following configurations.</p>
  26833. //
  26834. // <p>{@code (s, 1, x, {}), (s, 1, x', {p}), (s, 2, x'', {})}</p>
  26835. //
  26836. // <p>If the configuration set has predicates (as indicated by
  26837. // {@link ATNConfigSet//hasSemanticContext}), this algorithm makes a copy of
  26838. // the configurations to strip out all of the predicates so that a standard
  26839. // {@link ATNConfigSet} will merge everything ignoring predicates.</p>
  26840. //
  26841. PredictionMode.hasSLLConflictTerminatingPrediction = function (mode, configs) {
  26842. // Configs in rule stop states indicate reaching the end of the decision
  26843. // rule (local context) or end of start rule (full context). If all
  26844. // configs meet this condition, then none of the configurations is able
  26845. // to match additional input so we terminate prediction.
  26846. //
  26847. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  26848. return true;
  26849. }
  26850. // pure SLL mode parsing
  26851. if (mode === PredictionMode.SLL) {
  26852. // Don't bother with combining configs from different semantic
  26853. // contexts if we can fail over to full LL; costs more time
  26854. // since we'll often fail over anyway.
  26855. if (configs.hasSemanticContext) {
  26856. // dup configs, tossing out semantic predicates
  26857. var dup = new ATNConfigSet();
  26858. for (var i = 0; i < configs.items.length; i++) {
  26859. var c = configs.items[i];
  26860. c = new ATNConfig({ semanticContext: SemanticContext.NONE }, c);
  26861. dup.add(c);
  26862. }
  26863. configs = dup;
  26864. }
  26865. // now we have combined contexts for configs with dissimilar preds
  26866. }
  26867. // pure SLL or combined SLL+LL mode parsing
  26868. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  26869. return PredictionMode.hasConflictingAltSet(altsets) && !PredictionMode.hasStateAssociatedWithOneAlt(configs);
  26870. };
  26871. // Checks if any configuration in {@code configs} is in a
  26872. // {@link RuleStopState}. Configurations meeting this condition have reached
  26873. // the end of the decision rule (local context) or end of start rule (full
  26874. // context).
  26875. //
  26876. // @param configs the configuration set to test
  26877. // @return {@code true} if any configuration in {@code configs} is in a
  26878. // {@link RuleStopState}, otherwise {@code false}
  26879. PredictionMode.hasConfigInRuleStopState = function (configs) {
  26880. for (var i = 0; i < configs.items.length; i++) {
  26881. var c = configs.items[i];
  26882. if (c.state instanceof RuleStopState) {
  26883. return true;
  26884. }
  26885. }
  26886. return false;
  26887. };
  26888. // Checks if all configurations in {@code configs} are in a
  26889. // {@link RuleStopState}. Configurations meeting this condition have reached
  26890. // the end of the decision rule (local context) or end of start rule (full
  26891. // context).
  26892. //
  26893. // @param configs the configuration set to test
  26894. // @return {@code true} if all configurations in {@code configs} are in a
  26895. // {@link RuleStopState}, otherwise {@code false}
  26896. PredictionMode.allConfigsInRuleStopStates = function (configs) {
  26897. for (var i = 0; i < configs.items.length; i++) {
  26898. var c = configs.items[i];
  26899. if (!(c.state instanceof RuleStopState)) {
  26900. return false;
  26901. }
  26902. }
  26903. return true;
  26904. };
  26905. //
  26906. // Full LL prediction termination.
  26907. //
  26908. // <p>Can we stop looking ahead during ATN simulation or is there some
  26909. // uncertainty as to which alternative we will ultimately pick, after
  26910. // consuming more input? Even if there are partial conflicts, we might know
  26911. // that everything is going to resolve to the same minimum alternative. That
  26912. // means we can stop since no more lookahead will change that fact. On the
  26913. // other hand, there might be multiple conflicts that resolve to different
  26914. // minimums. That means we need more look ahead to decide which of those
  26915. // alternatives we should predict.</p>
  26916. //
  26917. // <p>The basic idea is to split the set of configurations {@code C}, into
  26918. // conflicting subsets {@code (s, _, ctx, _)} and singleton subsets with
  26919. // non-conflicting configurations. Two configurations conflict if they have
  26920. // identical {@link ATNConfig//state} and {@link ATNConfig//context} values
  26921. // but different {@link ATNConfig//alt} value, e.g. {@code (s, i, ctx, _)}
  26922. // and {@code (s, j, ctx, _)} for {@code i!=j}.</p>
  26923. //
  26924. // <p>Reduce these configuration subsets to the set of possible alternatives.
  26925. // You can compute the alternative subsets in one pass as follows:</p>
  26926. //
  26927. // <p>{@code A_s,ctx = {i | (s, i, ctx, _)}} for each configuration in
  26928. // {@code C} holding {@code s} and {@code ctx} fixed.</p>
  26929. //
  26930. // <p>Or in pseudo-code, for each configuration {@code c} in {@code C}:</p>
  26931. //
  26932. // <pre>
  26933. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  26934. // alt and not pred
  26935. // </pre>
  26936. //
  26937. // <p>The values in {@code map} are the set of {@code A_s,ctx} sets.</p>
  26938. //
  26939. // <p>If {@code |A_s,ctx|=1} then there is no conflict associated with
  26940. // {@code s} and {@code ctx}.</p>
  26941. //
  26942. // <p>Reduce the subsets to singletons by choosing a minimum of each subset. If
  26943. // the union of these alternative subsets is a singleton, then no amount of
  26944. // more lookahead will help us. We will always pick that alternative. If,
  26945. // however, there is more than one alternative, then we are uncertain which
  26946. // alternative to predict and must continue looking for resolution. We may
  26947. // or may not discover an ambiguity in the future, even if there are no
  26948. // conflicting subsets this round.</p>
  26949. //
  26950. // <p>The biggest sin is to terminate early because it means we've made a
  26951. // decision but were uncertain as to the eventual outcome. We haven't used
  26952. // enough lookahead. On the other hand, announcing a conflict too late is no
  26953. // big deal; you will still have the conflict. It's just inefficient. It
  26954. // might even look until the end of file.</p>
  26955. //
  26956. // <p>No special consideration for semantic predicates is required because
  26957. // predicates are evaluated on-the-fly for full LL prediction, ensuring that
  26958. // no configuration contains a semantic context during the termination
  26959. // check.</p>
  26960. //
  26961. // <p><strong>CONFLICTING CONFIGS</strong></p>
  26962. //
  26963. // <p>Two configurations {@code (s, i, x)} and {@code (s, j, x')}, conflict
  26964. // when {@code i!=j} but {@code x=x'}. Because we merge all
  26965. // {@code (s, i, _)} configurations together, that means that there are at
  26966. // most {@code n} configurations associated with state {@code s} for
  26967. // {@code n} possible alternatives in the decision. The merged stacks
  26968. // complicate the comparison of configuration contexts {@code x} and
  26969. // {@code x'}. Sam checks to see if one is a subset of the other by calling
  26970. // merge and checking to see if the merged result is either {@code x} or
  26971. // {@code x'}. If the {@code x} associated with lowest alternative {@code i}
  26972. // is the superset, then {@code i} is the only possible prediction since the
  26973. // others resolve to {@code min(i)} as well. However, if {@code x} is
  26974. // associated with {@code j>i} then at least one stack configuration for
  26975. // {@code j} is not in conflict with alternative {@code i}. The algorithm
  26976. // should keep going, looking for more lookahead due to the uncertainty.</p>
  26977. //
  26978. // <p>For simplicity, I'm doing a equality check between {@code x} and
  26979. // {@code x'} that lets the algorithm continue to consume lookahead longer
  26980. // than necessary. The reason I like the equality is of course the
  26981. // simplicity but also because that is the test you need to detect the
  26982. // alternatives that are actually in conflict.</p>
  26983. //
  26984. // <p><strong>CONTINUE/STOP RULE</strong></p>
  26985. //
  26986. // <p>Continue if union of resolved alternative sets from non-conflicting and
  26987. // conflicting alternative subsets has more than one alternative. We are
  26988. // uncertain about which alternative to predict.</p>
  26989. //
  26990. // <p>The complete set of alternatives, {@code [i for (_,i,_)]}, tells us which
  26991. // alternatives are still in the running for the amount of input we've
  26992. // consumed at this point. The conflicting sets let us to strip away
  26993. // configurations that won't lead to more states because we resolve
  26994. // conflicts to the configuration with a minimum alternate for the
  26995. // conflicting set.</p>
  26996. //
  26997. // <p><strong>CASES</strong></p>
  26998. //
  26999. // <ul>
  27000. //
  27001. // <li>no conflicts and more than 1 alternative in set =&gt; continue</li>
  27002. //
  27003. // <li> {@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s, 3, z)},
  27004. // {@code (s', 1, y)}, {@code (s', 2, y)} yields non-conflicting set
  27005. // {@code {3}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  27006. // {@code {1,3}} =&gt; continue
  27007. // </li>
  27008. //
  27009. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  27010. // {@code (s', 2, y)}, {@code (s'', 1, z)} yields non-conflicting set
  27011. // {@code {1}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  27012. // {@code {1}} =&gt; stop and predict 1</li>
  27013. //
  27014. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  27015. // {@code (s', 2, y)} yields conflicting, reduced sets {@code {1}} U
  27016. // {@code {1}} = {@code {1}} =&gt; stop and predict 1, can announce
  27017. // ambiguity {@code {1,2}}</li>
  27018. //
  27019. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 2, y)},
  27020. // {@code (s', 3, y)} yields conflicting, reduced sets {@code {1}} U
  27021. // {@code {2}} = {@code {1,2}} =&gt; continue</li>
  27022. //
  27023. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 3, y)},
  27024. // {@code (s', 4, y)} yields conflicting, reduced sets {@code {1}} U
  27025. // {@code {3}} = {@code {1,3}} =&gt; continue</li>
  27026. //
  27027. // </ul>
  27028. //
  27029. // <p><strong>EXACT AMBIGUITY DETECTION</strong></p>
  27030. //
  27031. // <p>If all states report the same conflicting set of alternatives, then we
  27032. // know we have the exact ambiguity set.</p>
  27033. //
  27034. // <p><code>|A_<em>i</em>|&gt;1</code> and
  27035. // <code>A_<em>i</em> = A_<em>j</em></code> for all <em>i</em>, <em>j</em>.</p>
  27036. //
  27037. // <p>In other words, we continue examining lookahead until all {@code A_i}
  27038. // have more than one alternative and all {@code A_i} are the same. If
  27039. // {@code A={{1,2}, {1,3}}}, then regular LL prediction would terminate
  27040. // because the resolved set is {@code {1}}. To determine what the real
  27041. // ambiguity is, we have to know whether the ambiguity is between one and
  27042. // two or one and three so we keep going. We can only stop prediction when
  27043. // we need exact ambiguity detection when the sets look like
  27044. // {@code A={{1,2}}} or {@code {{1,2},{1,2}}}, etc...</p>
  27045. //
  27046. PredictionMode.resolvesToJustOneViableAlt = function (altsets) {
  27047. return PredictionMode.getSingleViableAlt(altsets);
  27048. };
  27049. //
  27050. // Determines if every alternative subset in {@code altsets} contains more
  27051. // than one alternative.
  27052. //
  27053. // @param altsets a collection of alternative subsets
  27054. // @return {@code true} if every {@link BitSet} in {@code altsets} has
  27055. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  27056. //
  27057. PredictionMode.allSubsetsConflict = function (altsets) {
  27058. return !PredictionMode.hasNonConflictingAltSet(altsets);
  27059. };
  27060. //
  27061. // Determines if any single alternative subset in {@code altsets} contains
  27062. // exactly one alternative.
  27063. //
  27064. // @param altsets a collection of alternative subsets
  27065. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  27066. // {@link BitSet//cardinality cardinality} 1, otherwise {@code false}
  27067. //
  27068. PredictionMode.hasNonConflictingAltSet = function (altsets) {
  27069. for (var i = 0; i < altsets.length; i++) {
  27070. var alts = altsets[i];
  27071. if (alts.length === 1) {
  27072. return true;
  27073. }
  27074. }
  27075. return false;
  27076. };
  27077. //
  27078. // Determines if any single alternative subset in {@code altsets} contains
  27079. // more than one alternative.
  27080. //
  27081. // @param altsets a collection of alternative subsets
  27082. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  27083. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  27084. //
  27085. PredictionMode.hasConflictingAltSet = function (altsets) {
  27086. for (var i = 0; i < altsets.length; i++) {
  27087. var alts = altsets[i];
  27088. if (alts.length > 1) {
  27089. return true;
  27090. }
  27091. }
  27092. return false;
  27093. };
  27094. //
  27095. // Determines if every alternative subset in {@code altsets} is equivalent.
  27096. //
  27097. // @param altsets a collection of alternative subsets
  27098. // @return {@code true} if every member of {@code altsets} is equal to the
  27099. // others, otherwise {@code false}
  27100. //
  27101. PredictionMode.allSubsetsEqual = function (altsets) {
  27102. var first = null;
  27103. for (var i = 0; i < altsets.length; i++) {
  27104. var alts = altsets[i];
  27105. if (first === null) {
  27106. first = alts;
  27107. } else if (alts !== first) {
  27108. return false;
  27109. }
  27110. }
  27111. return true;
  27112. };
  27113. //
  27114. // Returns the unique alternative predicted by all alternative subsets in
  27115. // {@code altsets}. If no such alternative exists, this method returns
  27116. // {@link ATN//INVALID_ALT_NUMBER}.
  27117. //
  27118. // @param altsets a collection of alternative subsets
  27119. //
  27120. PredictionMode.getUniqueAlt = function (altsets) {
  27121. var all = PredictionMode.getAlts(altsets);
  27122. if (all.length === 1) {
  27123. return all.minValue();
  27124. } else {
  27125. return ATN.INVALID_ALT_NUMBER;
  27126. }
  27127. };
  27128. // Gets the complete set of represented alternatives for a collection of
  27129. // alternative subsets. This method returns the union of each {@link BitSet}
  27130. // in {@code altsets}.
  27131. //
  27132. // @param altsets a collection of alternative subsets
  27133. // @return the set of represented alternatives in {@code altsets}
  27134. //
  27135. PredictionMode.getAlts = function (altsets) {
  27136. var all = new BitSet();
  27137. altsets.map(function (alts) {
  27138. all.or(alts);
  27139. });
  27140. return all;
  27141. };
  27142. //
  27143. // This function gets the conflicting alt subsets from a configuration set.
  27144. // For each configuration {@code c} in {@code configs}:
  27145. //
  27146. // <pre>
  27147. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  27148. // alt and not pred
  27149. // </pre>
  27150. PredictionMode.getConflictingAltSubsets = function (configs) {
  27151. var configToAlts = new Map();
  27152. configToAlts.hashFunction = function (cfg) {
  27153. hashStuff(cfg.state.stateNumber, cfg.context);
  27154. };
  27155. configToAlts.equalsFunction = function (c1, c2) {
  27156. return c1.state.stateNumber == c2.state.stateNumber && c1.context.equals(c2.context);
  27157. };
  27158. configs.items.map(function (cfg) {
  27159. var alts = configToAlts.get(cfg);
  27160. if (alts === null) {
  27161. alts = new BitSet();
  27162. configToAlts.put(cfg, alts);
  27163. }
  27164. alts.add(cfg.alt);
  27165. });
  27166. return configToAlts.getValues();
  27167. };
  27168. //
  27169. // Get a map from state to alt subset from a configuration set. For each
  27170. // configuration {@code c} in {@code configs}:
  27171. //
  27172. // <pre>
  27173. // map[c.{@link ATNConfig//state state}] U= c.{@link ATNConfig//alt alt}
  27174. // </pre>
  27175. //
  27176. PredictionMode.getStateToAltMap = function (configs) {
  27177. var m = new AltDict();
  27178. configs.items.map(function (c) {
  27179. var alts = m.get(c.state);
  27180. if (alts === null) {
  27181. alts = new BitSet();
  27182. m.put(c.state, alts);
  27183. }
  27184. alts.add(c.alt);
  27185. });
  27186. return m;
  27187. };
  27188. PredictionMode.hasStateAssociatedWithOneAlt = function (configs) {
  27189. var values = PredictionMode.getStateToAltMap(configs).values();
  27190. for (var i = 0; i < values.length; i++) {
  27191. if (values[i].length === 1) {
  27192. return true;
  27193. }
  27194. }
  27195. return false;
  27196. };
  27197. PredictionMode.getSingleViableAlt = function (altsets) {
  27198. var result = null;
  27199. for (var i = 0; i < altsets.length; i++) {
  27200. var alts = altsets[i];
  27201. var minAlt = alts.minValue();
  27202. if (result === null) {
  27203. result = minAlt;
  27204. } else if (result !== minAlt) {
  27205. // more than 1 viable alt
  27206. return ATN.INVALID_ALT_NUMBER;
  27207. }
  27208. }
  27209. return result;
  27210. };
  27211. exports.PredictionMode = PredictionMode;
  27212. /***/ }),
  27213. /***/ "./node_modules/antlr4/atn/SemanticContext.js":
  27214. /*!****************************************************!*\
  27215. !*** ./node_modules/antlr4/atn/SemanticContext.js ***!
  27216. \****************************************************/
  27217. /*! no static exports found */
  27218. /***/ (function(module, exports, __webpack_require__) {
  27219. "use strict";
  27220. //
  27221. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27222. * Use of this file is governed by the BSD 3-clause license that
  27223. * can be found in the LICENSE.txt file in the project root.
  27224. */
  27225. //
  27226. // A tree structure used to record the semantic context in which
  27227. // an ATN configuration is valid. It's either a single predicate,
  27228. // a conjunction {@code p1&&p2}, or a sum of products {@code p1||p2}.
  27229. //
  27230. // <p>I have scoped the {@link AND}, {@link OR}, and {@link Predicate} subclasses of
  27231. // {@link SemanticContext} within the scope of this outer class.</p>
  27232. //
  27233. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  27234. var Hash = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  27235. function SemanticContext() {
  27236. return this;
  27237. }
  27238. SemanticContext.prototype.hashCode = function () {
  27239. var hash = new Hash();
  27240. this.updateHashCode(hash);
  27241. return hash.finish();
  27242. };
  27243. // For context independent predicates, we evaluate them without a local
  27244. // context (i.e., null context). That way, we can evaluate them without
  27245. // having to create proper rule-specific context during prediction (as
  27246. // opposed to the parser, which creates them naturally). In a practical
  27247. // sense, this avoids a cast exception from RuleContext to myruleContext.
  27248. //
  27249. // <p>For context dependent predicates, we must pass in a local context so that
  27250. // references such as $arg evaluate properly as _localctx.arg. We only
  27251. // capture context dependent predicates in the context in which we begin
  27252. // prediction, so we passed in the outer context here in case of context
  27253. // dependent predicate evaluation.</p>
  27254. //
  27255. SemanticContext.prototype.evaluate = function (parser, outerContext) {};
  27256. //
  27257. // Evaluate the precedence predicates for the context and reduce the result.
  27258. //
  27259. // @param parser The parser instance.
  27260. // @param outerContext The current parser context object.
  27261. // @return The simplified semantic context after precedence predicates are
  27262. // evaluated, which will be one of the following values.
  27263. // <ul>
  27264. // <li>{@link //NONE}: if the predicate simplifies to {@code true} after
  27265. // precedence predicates are evaluated.</li>
  27266. // <li>{@code null}: if the predicate simplifies to {@code false} after
  27267. // precedence predicates are evaluated.</li>
  27268. // <li>{@code this}: if the semantic context is not changed as a result of
  27269. // precedence predicate evaluation.</li>
  27270. // <li>A non-{@code null} {@link SemanticContext}: the new simplified
  27271. // semantic context after precedence predicates are evaluated.</li>
  27272. // </ul>
  27273. //
  27274. SemanticContext.prototype.evalPrecedence = function (parser, outerContext) {
  27275. return this;
  27276. };
  27277. SemanticContext.andContext = function (a, b) {
  27278. if (a === null || a === SemanticContext.NONE) {
  27279. return b;
  27280. }
  27281. if (b === null || b === SemanticContext.NONE) {
  27282. return a;
  27283. }
  27284. var result = new AND(a, b);
  27285. if (result.opnds.length === 1) {
  27286. return result.opnds[0];
  27287. } else {
  27288. return result;
  27289. }
  27290. };
  27291. SemanticContext.orContext = function (a, b) {
  27292. if (a === null) {
  27293. return b;
  27294. }
  27295. if (b === null) {
  27296. return a;
  27297. }
  27298. if (a === SemanticContext.NONE || b === SemanticContext.NONE) {
  27299. return SemanticContext.NONE;
  27300. }
  27301. var result = new OR(a, b);
  27302. if (result.opnds.length === 1) {
  27303. return result.opnds[0];
  27304. } else {
  27305. return result;
  27306. }
  27307. };
  27308. function Predicate(ruleIndex, predIndex, isCtxDependent) {
  27309. SemanticContext.call(this);
  27310. this.ruleIndex = ruleIndex === undefined ? -1 : ruleIndex;
  27311. this.predIndex = predIndex === undefined ? -1 : predIndex;
  27312. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  27313. return this;
  27314. }
  27315. Predicate.prototype = Object.create(SemanticContext.prototype);
  27316. Predicate.prototype.constructor = Predicate;
  27317. //The default {@link SemanticContext}, which is semantically equivalent to
  27318. //a predicate of the form {@code {true}?}.
  27319. //
  27320. SemanticContext.NONE = new Predicate();
  27321. Predicate.prototype.evaluate = function (parser, outerContext) {
  27322. var localctx = this.isCtxDependent ? outerContext : null;
  27323. return parser.sempred(localctx, this.ruleIndex, this.predIndex);
  27324. };
  27325. Predicate.prototype.updateHashCode = function (hash) {
  27326. hash.update(this.ruleIndex, this.predIndex, this.isCtxDependent);
  27327. };
  27328. Predicate.prototype.equals = function (other) {
  27329. if (this === other) {
  27330. return true;
  27331. } else if (!(other instanceof Predicate)) {
  27332. return false;
  27333. } else {
  27334. return this.ruleIndex === other.ruleIndex && this.predIndex === other.predIndex && this.isCtxDependent === other.isCtxDependent;
  27335. }
  27336. };
  27337. Predicate.prototype.toString = function () {
  27338. return "{" + this.ruleIndex + ":" + this.predIndex + "}?";
  27339. };
  27340. function PrecedencePredicate(precedence) {
  27341. SemanticContext.call(this);
  27342. this.precedence = precedence === undefined ? 0 : precedence;
  27343. }
  27344. PrecedencePredicate.prototype = Object.create(SemanticContext.prototype);
  27345. PrecedencePredicate.prototype.constructor = PrecedencePredicate;
  27346. PrecedencePredicate.prototype.evaluate = function (parser, outerContext) {
  27347. return parser.precpred(outerContext, this.precedence);
  27348. };
  27349. PrecedencePredicate.prototype.evalPrecedence = function (parser, outerContext) {
  27350. if (parser.precpred(outerContext, this.precedence)) {
  27351. return SemanticContext.NONE;
  27352. } else {
  27353. return null;
  27354. }
  27355. };
  27356. PrecedencePredicate.prototype.compareTo = function (other) {
  27357. return this.precedence - other.precedence;
  27358. };
  27359. PrecedencePredicate.prototype.updateHashCode = function (hash) {
  27360. hash.update(31);
  27361. };
  27362. PrecedencePredicate.prototype.equals = function (other) {
  27363. if (this === other) {
  27364. return true;
  27365. } else if (!(other instanceof PrecedencePredicate)) {
  27366. return false;
  27367. } else {
  27368. return this.precedence === other.precedence;
  27369. }
  27370. };
  27371. PrecedencePredicate.prototype.toString = function () {
  27372. return "{" + this.precedence + ">=prec}?";
  27373. };
  27374. PrecedencePredicate.filterPrecedencePredicates = function (set) {
  27375. var result = [];
  27376. set.values().map(function (context) {
  27377. if (context instanceof PrecedencePredicate) {
  27378. result.push(context);
  27379. }
  27380. });
  27381. return result;
  27382. };
  27383. // A semantic context which is true whenever none of the contained contexts
  27384. // is false.
  27385. //
  27386. function AND(a, b) {
  27387. SemanticContext.call(this);
  27388. var operands = new Set();
  27389. if (a instanceof AND) {
  27390. a.opnds.map(function (o) {
  27391. operands.add(o);
  27392. });
  27393. } else {
  27394. operands.add(a);
  27395. }
  27396. if (b instanceof AND) {
  27397. b.opnds.map(function (o) {
  27398. operands.add(o);
  27399. });
  27400. } else {
  27401. operands.add(b);
  27402. }
  27403. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  27404. if (precedencePredicates.length > 0) {
  27405. // interested in the transition with the lowest precedence
  27406. var reduced = null;
  27407. precedencePredicates.map(function (p) {
  27408. if (reduced === null || p.precedence < reduced.precedence) {
  27409. reduced = p;
  27410. }
  27411. });
  27412. operands.add(reduced);
  27413. }
  27414. this.opnds = operands.values();
  27415. return this;
  27416. }
  27417. AND.prototype = Object.create(SemanticContext.prototype);
  27418. AND.prototype.constructor = AND;
  27419. AND.prototype.equals = function (other) {
  27420. if (this === other) {
  27421. return true;
  27422. } else if (!(other instanceof AND)) {
  27423. return false;
  27424. } else {
  27425. return this.opnds === other.opnds;
  27426. }
  27427. };
  27428. AND.prototype.updateHashCode = function (hash) {
  27429. hash.update(this.opnds, "AND");
  27430. };
  27431. //
  27432. // {@inheritDoc}
  27433. //
  27434. // <p>
  27435. // The evaluation of predicates by this context is short-circuiting, but
  27436. // unordered.</p>
  27437. //
  27438. AND.prototype.evaluate = function (parser, outerContext) {
  27439. for (var i = 0; i < this.opnds.length; i++) {
  27440. if (!this.opnds[i].evaluate(parser, outerContext)) {
  27441. return false;
  27442. }
  27443. }
  27444. return true;
  27445. };
  27446. AND.prototype.evalPrecedence = function (parser, outerContext) {
  27447. var differs = false;
  27448. var operands = [];
  27449. for (var i = 0; i < this.opnds.length; i++) {
  27450. var context = this.opnds[i];
  27451. var evaluated = context.evalPrecedence(parser, outerContext);
  27452. differs |= evaluated !== context;
  27453. if (evaluated === null) {
  27454. // The AND context is false if any element is false
  27455. return null;
  27456. } else if (evaluated !== SemanticContext.NONE) {
  27457. // Reduce the result by skipping true elements
  27458. operands.push(evaluated);
  27459. }
  27460. }
  27461. if (!differs) {
  27462. return this;
  27463. }
  27464. if (operands.length === 0) {
  27465. // all elements were true, so the AND context is true
  27466. return SemanticContext.NONE;
  27467. }
  27468. var result = null;
  27469. operands.map(function (o) {
  27470. result = result === null ? o : SemanticContext.andContext(result, o);
  27471. });
  27472. return result;
  27473. };
  27474. AND.prototype.toString = function () {
  27475. var s = "";
  27476. this.opnds.map(function (o) {
  27477. s += "&& " + o.toString();
  27478. });
  27479. return s.length > 3 ? s.slice(3) : s;
  27480. };
  27481. //
  27482. // A semantic context which is true whenever at least one of the contained
  27483. // contexts is true.
  27484. //
  27485. function OR(a, b) {
  27486. SemanticContext.call(this);
  27487. var operands = new Set();
  27488. if (a instanceof OR) {
  27489. a.opnds.map(function (o) {
  27490. operands.add(o);
  27491. });
  27492. } else {
  27493. operands.add(a);
  27494. }
  27495. if (b instanceof OR) {
  27496. b.opnds.map(function (o) {
  27497. operands.add(o);
  27498. });
  27499. } else {
  27500. operands.add(b);
  27501. }
  27502. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  27503. if (precedencePredicates.length > 0) {
  27504. // interested in the transition with the highest precedence
  27505. var s = precedencePredicates.sort(function (a, b) {
  27506. return a.compareTo(b);
  27507. });
  27508. var reduced = s[s.length - 1];
  27509. operands.add(reduced);
  27510. }
  27511. this.opnds = operands.values();
  27512. return this;
  27513. }
  27514. OR.prototype = Object.create(SemanticContext.prototype);
  27515. OR.prototype.constructor = OR;
  27516. OR.prototype.constructor = function (other) {
  27517. if (this === other) {
  27518. return true;
  27519. } else if (!(other instanceof OR)) {
  27520. return false;
  27521. } else {
  27522. return this.opnds === other.opnds;
  27523. }
  27524. };
  27525. OR.prototype.updateHashCode = function (hash) {
  27526. hash.update(this.opnds, "OR");
  27527. };
  27528. // <p>
  27529. // The evaluation of predicates by this context is short-circuiting, but
  27530. // unordered.</p>
  27531. //
  27532. OR.prototype.evaluate = function (parser, outerContext) {
  27533. for (var i = 0; i < this.opnds.length; i++) {
  27534. if (this.opnds[i].evaluate(parser, outerContext)) {
  27535. return true;
  27536. }
  27537. }
  27538. return false;
  27539. };
  27540. OR.prototype.evalPrecedence = function (parser, outerContext) {
  27541. var differs = false;
  27542. var operands = [];
  27543. for (var i = 0; i < this.opnds.length; i++) {
  27544. var context = this.opnds[i];
  27545. var evaluated = context.evalPrecedence(parser, outerContext);
  27546. differs |= evaluated !== context;
  27547. if (evaluated === SemanticContext.NONE) {
  27548. // The OR context is true if any element is true
  27549. return SemanticContext.NONE;
  27550. } else if (evaluated !== null) {
  27551. // Reduce the result by skipping false elements
  27552. operands.push(evaluated);
  27553. }
  27554. }
  27555. if (!differs) {
  27556. return this;
  27557. }
  27558. if (operands.length === 0) {
  27559. // all elements were false, so the OR context is false
  27560. return null;
  27561. }
  27562. var result = null;
  27563. operands.map(function (o) {
  27564. return result === null ? o : SemanticContext.orContext(result, o);
  27565. });
  27566. return result;
  27567. };
  27568. OR.prototype.toString = function () {
  27569. var s = "";
  27570. this.opnds.map(function (o) {
  27571. s += "|| " + o.toString();
  27572. });
  27573. return s.length > 3 ? s.slice(3) : s;
  27574. };
  27575. exports.SemanticContext = SemanticContext;
  27576. exports.PrecedencePredicate = PrecedencePredicate;
  27577. exports.Predicate = Predicate;
  27578. /***/ }),
  27579. /***/ "./node_modules/antlr4/atn/Transition.js":
  27580. /*!***********************************************!*\
  27581. !*** ./node_modules/antlr4/atn/Transition.js ***!
  27582. \***********************************************/
  27583. /*! no static exports found */
  27584. /***/ (function(module, exports, __webpack_require__) {
  27585. "use strict";
  27586. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27587. * Use of this file is governed by the BSD 3-clause license that
  27588. * can be found in the LICENSE.txt file in the project root.
  27589. */
  27590. //
  27591. // An ATN transition between any two ATN states. Subclasses define
  27592. // atom, set, epsilon, action, predicate, rule transitions.
  27593. //
  27594. // <p>This is a one way link. It emanates from a state (usually via a list of
  27595. // transitions) and has a target state.</p>
  27596. //
  27597. // <p>Since we never have to change the ATN transitions once we construct it,
  27598. // we can fix these transitions as specific classes. The DFA transitions
  27599. // on the other hand need to update the labels as it adds transitions to
  27600. // the states. We'll use the term Edge for the DFA to distinguish them from
  27601. // ATN transitions.</p>
  27602. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  27603. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  27604. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  27605. var Predicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").Predicate;
  27606. var PrecedencePredicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").PrecedencePredicate;
  27607. function Transition(target) {
  27608. // The target of this transition.
  27609. if (target === undefined || target === null) {
  27610. throw "target cannot be null.";
  27611. }
  27612. this.target = target;
  27613. // Are we epsilon, action, sempred?
  27614. this.isEpsilon = false;
  27615. this.label = null;
  27616. return this;
  27617. }
  27618. // constants for serialization
  27619. Transition.EPSILON = 1;
  27620. Transition.RANGE = 2;
  27621. Transition.RULE = 3;
  27622. Transition.PREDICATE = 4; // e.g., {isType(input.LT(1))}?
  27623. Transition.ATOM = 5;
  27624. Transition.ACTION = 6;
  27625. Transition.SET = 7; // ~(A|B) or ~atom, wildcard, which convert to next 2
  27626. Transition.NOT_SET = 8;
  27627. Transition.WILDCARD = 9;
  27628. Transition.PRECEDENCE = 10;
  27629. Transition.serializationNames = ["INVALID", "EPSILON", "RANGE", "RULE", "PREDICATE", "ATOM", "ACTION", "SET", "NOT_SET", "WILDCARD", "PRECEDENCE"];
  27630. Transition.serializationTypes = {
  27631. EpsilonTransition: Transition.EPSILON,
  27632. RangeTransition: Transition.RANGE,
  27633. RuleTransition: Transition.RULE,
  27634. PredicateTransition: Transition.PREDICATE,
  27635. AtomTransition: Transition.ATOM,
  27636. ActionTransition: Transition.ACTION,
  27637. SetTransition: Transition.SET,
  27638. NotSetTransition: Transition.NOT_SET,
  27639. WildcardTransition: Transition.WILDCARD,
  27640. PrecedencePredicateTransition: Transition.PRECEDENCE
  27641. };
  27642. // TODO: make all transitions sets? no, should remove set edges
  27643. function AtomTransition(target, label) {
  27644. Transition.call(this, target);
  27645. this.label_ = label; // The token type or character value; or, signifies special label.
  27646. this.label = this.makeLabel();
  27647. this.serializationType = Transition.ATOM;
  27648. return this;
  27649. }
  27650. AtomTransition.prototype = Object.create(Transition.prototype);
  27651. AtomTransition.prototype.constructor = AtomTransition;
  27652. AtomTransition.prototype.makeLabel = function () {
  27653. var s = new IntervalSet();
  27654. s.addOne(this.label_);
  27655. return s;
  27656. };
  27657. AtomTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  27658. return this.label_ === symbol;
  27659. };
  27660. AtomTransition.prototype.toString = function () {
  27661. return this.label_;
  27662. };
  27663. function RuleTransition(ruleStart, ruleIndex, precedence, followState) {
  27664. Transition.call(this, ruleStart);
  27665. this.ruleIndex = ruleIndex; // ptr to the rule definition object for this rule ref
  27666. this.precedence = precedence;
  27667. this.followState = followState; // what node to begin computations following ref to rule
  27668. this.serializationType = Transition.RULE;
  27669. this.isEpsilon = true;
  27670. return this;
  27671. }
  27672. RuleTransition.prototype = Object.create(Transition.prototype);
  27673. RuleTransition.prototype.constructor = RuleTransition;
  27674. RuleTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  27675. return false;
  27676. };
  27677. function EpsilonTransition(target, outermostPrecedenceReturn) {
  27678. Transition.call(this, target);
  27679. this.serializationType = Transition.EPSILON;
  27680. this.isEpsilon = true;
  27681. this.outermostPrecedenceReturn = outermostPrecedenceReturn;
  27682. return this;
  27683. }
  27684. EpsilonTransition.prototype = Object.create(Transition.prototype);
  27685. EpsilonTransition.prototype.constructor = EpsilonTransition;
  27686. EpsilonTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  27687. return false;
  27688. };
  27689. EpsilonTransition.prototype.toString = function () {
  27690. return "epsilon";
  27691. };
  27692. function RangeTransition(target, start, stop) {
  27693. Transition.call(this, target);
  27694. this.serializationType = Transition.RANGE;
  27695. this.start = start;
  27696. this.stop = stop;
  27697. this.label = this.makeLabel();
  27698. return this;
  27699. }
  27700. RangeTransition.prototype = Object.create(Transition.prototype);
  27701. RangeTransition.prototype.constructor = RangeTransition;
  27702. RangeTransition.prototype.makeLabel = function () {
  27703. var s = new IntervalSet();
  27704. s.addRange(this.start, this.stop);
  27705. return s;
  27706. };
  27707. RangeTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  27708. return symbol >= this.start && symbol <= this.stop;
  27709. };
  27710. RangeTransition.prototype.toString = function () {
  27711. return "'" + String.fromCharCode(this.start) + "'..'" + String.fromCharCode(this.stop) + "'";
  27712. };
  27713. function AbstractPredicateTransition(target) {
  27714. Transition.call(this, target);
  27715. return this;
  27716. }
  27717. AbstractPredicateTransition.prototype = Object.create(Transition.prototype);
  27718. AbstractPredicateTransition.prototype.constructor = AbstractPredicateTransition;
  27719. function PredicateTransition(target, ruleIndex, predIndex, isCtxDependent) {
  27720. AbstractPredicateTransition.call(this, target);
  27721. this.serializationType = Transition.PREDICATE;
  27722. this.ruleIndex = ruleIndex;
  27723. this.predIndex = predIndex;
  27724. this.isCtxDependent = isCtxDependent; // e.g., $i ref in pred
  27725. this.isEpsilon = true;
  27726. return this;
  27727. }
  27728. PredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  27729. PredicateTransition.prototype.constructor = PredicateTransition;
  27730. PredicateTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  27731. return false;
  27732. };
  27733. PredicateTransition.prototype.getPredicate = function () {
  27734. return new Predicate(this.ruleIndex, this.predIndex, this.isCtxDependent);
  27735. };
  27736. PredicateTransition.prototype.toString = function () {
  27737. return "pred_" + this.ruleIndex + ":" + this.predIndex;
  27738. };
  27739. function ActionTransition(target, ruleIndex, actionIndex, isCtxDependent) {
  27740. Transition.call(this, target);
  27741. this.serializationType = Transition.ACTION;
  27742. this.ruleIndex = ruleIndex;
  27743. this.actionIndex = actionIndex === undefined ? -1 : actionIndex;
  27744. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  27745. this.isEpsilon = true;
  27746. return this;
  27747. }
  27748. ActionTransition.prototype = Object.create(Transition.prototype);
  27749. ActionTransition.prototype.constructor = ActionTransition;
  27750. ActionTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  27751. return false;
  27752. };
  27753. ActionTransition.prototype.toString = function () {
  27754. return "action_" + this.ruleIndex + ":" + this.actionIndex;
  27755. };
  27756. // A transition containing a set of values.
  27757. function SetTransition(target, set) {
  27758. Transition.call(this, target);
  27759. this.serializationType = Transition.SET;
  27760. if (set !== undefined && set !== null) {
  27761. this.label = set;
  27762. } else {
  27763. this.label = new IntervalSet();
  27764. this.label.addOne(Token.INVALID_TYPE);
  27765. }
  27766. return this;
  27767. }
  27768. SetTransition.prototype = Object.create(Transition.prototype);
  27769. SetTransition.prototype.constructor = SetTransition;
  27770. SetTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  27771. return this.label.contains(symbol);
  27772. };
  27773. SetTransition.prototype.toString = function () {
  27774. return this.label.toString();
  27775. };
  27776. function NotSetTransition(target, set) {
  27777. SetTransition.call(this, target, set);
  27778. this.serializationType = Transition.NOT_SET;
  27779. return this;
  27780. }
  27781. NotSetTransition.prototype = Object.create(SetTransition.prototype);
  27782. NotSetTransition.prototype.constructor = NotSetTransition;
  27783. NotSetTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  27784. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol && !SetTransition.prototype.matches.call(this, symbol, minVocabSymbol, maxVocabSymbol);
  27785. };
  27786. NotSetTransition.prototype.toString = function () {
  27787. return '~' + SetTransition.prototype.toString.call(this);
  27788. };
  27789. function WildcardTransition(target) {
  27790. Transition.call(this, target);
  27791. this.serializationType = Transition.WILDCARD;
  27792. return this;
  27793. }
  27794. WildcardTransition.prototype = Object.create(Transition.prototype);
  27795. WildcardTransition.prototype.constructor = WildcardTransition;
  27796. WildcardTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  27797. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol;
  27798. };
  27799. WildcardTransition.prototype.toString = function () {
  27800. return ".";
  27801. };
  27802. function PrecedencePredicateTransition(target, precedence) {
  27803. AbstractPredicateTransition.call(this, target);
  27804. this.serializationType = Transition.PRECEDENCE;
  27805. this.precedence = precedence;
  27806. this.isEpsilon = true;
  27807. return this;
  27808. }
  27809. PrecedencePredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  27810. PrecedencePredicateTransition.prototype.constructor = PrecedencePredicateTransition;
  27811. PrecedencePredicateTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  27812. return false;
  27813. };
  27814. PrecedencePredicateTransition.prototype.getPredicate = function () {
  27815. return new PrecedencePredicate(this.precedence);
  27816. };
  27817. PrecedencePredicateTransition.prototype.toString = function () {
  27818. return this.precedence + " >= _p";
  27819. };
  27820. exports.Transition = Transition;
  27821. exports.AtomTransition = AtomTransition;
  27822. exports.SetTransition = SetTransition;
  27823. exports.NotSetTransition = NotSetTransition;
  27824. exports.RuleTransition = RuleTransition;
  27825. exports.ActionTransition = ActionTransition;
  27826. exports.EpsilonTransition = EpsilonTransition;
  27827. exports.RangeTransition = RangeTransition;
  27828. exports.WildcardTransition = WildcardTransition;
  27829. exports.PredicateTransition = PredicateTransition;
  27830. exports.PrecedencePredicateTransition = PrecedencePredicateTransition;
  27831. exports.AbstractPredicateTransition = AbstractPredicateTransition;
  27832. /***/ }),
  27833. /***/ "./node_modules/antlr4/atn/index.js":
  27834. /*!******************************************!*\
  27835. !*** ./node_modules/antlr4/atn/index.js ***!
  27836. \******************************************/
  27837. /*! no static exports found */
  27838. /***/ (function(module, exports, __webpack_require__) {
  27839. "use strict";
  27840. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27841. * Use of this file is governed by the BSD 3-clause license that
  27842. * can be found in the LICENSE.txt file in the project root.
  27843. */
  27844. exports.ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  27845. exports.ATNDeserializer = __webpack_require__(/*! ./ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  27846. exports.LexerATNSimulator = __webpack_require__(/*! ./LexerATNSimulator */ "./node_modules/antlr4/atn/LexerATNSimulator.js").LexerATNSimulator;
  27847. exports.ParserATNSimulator = __webpack_require__(/*! ./ParserATNSimulator */ "./node_modules/antlr4/atn/ParserATNSimulator.js").ParserATNSimulator;
  27848. exports.PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  27849. /***/ }),
  27850. /***/ "./node_modules/antlr4/dfa/DFA.js":
  27851. /*!****************************************!*\
  27852. !*** ./node_modules/antlr4/dfa/DFA.js ***!
  27853. \****************************************/
  27854. /*! no static exports found */
  27855. /***/ (function(module, exports, __webpack_require__) {
  27856. "use strict";
  27857. //
  27858. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27859. * Use of this file is governed by the BSD 3-clause license that
  27860. * can be found in the LICENSE.txt file in the project root.
  27861. */
  27862. var Set = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Set;
  27863. var DFAState = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  27864. var StarLoopEntryState = __webpack_require__(/*! ../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  27865. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  27866. var DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  27867. var LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  27868. function DFA(atnStartState, decision) {
  27869. if (decision === undefined) {
  27870. decision = 0;
  27871. }
  27872. // From which ATN state did we create this DFA?
  27873. this.atnStartState = atnStartState;
  27874. this.decision = decision;
  27875. // A set of all DFA states. Use {@link Map} so we can get old state back
  27876. // ({@link Set} only allows you to see if it's there).
  27877. this._states = new Set();
  27878. this.s0 = null;
  27879. // {@code true} if this DFA is for a precedence decision; otherwise,
  27880. // {@code false}. This is the backing field for {@link //isPrecedenceDfa},
  27881. // {@link //setPrecedenceDfa}.
  27882. this.precedenceDfa = false;
  27883. if (atnStartState instanceof StarLoopEntryState) {
  27884. if (atnStartState.isPrecedenceDecision) {
  27885. this.precedenceDfa = true;
  27886. var precedenceState = new DFAState(null, new ATNConfigSet());
  27887. precedenceState.edges = [];
  27888. precedenceState.isAcceptState = false;
  27889. precedenceState.requiresFullContext = false;
  27890. this.s0 = precedenceState;
  27891. }
  27892. }
  27893. return this;
  27894. }
  27895. // Get the start state for a specific precedence value.
  27896. //
  27897. // @param precedence The current precedence.
  27898. // @return The start state corresponding to the specified precedence, or
  27899. // {@code null} if no start state exists for the specified precedence.
  27900. //
  27901. // @throws IllegalStateException if this is not a precedence DFA.
  27902. // @see //isPrecedenceDfa()
  27903. DFA.prototype.getPrecedenceStartState = function (precedence) {
  27904. if (!this.precedenceDfa) {
  27905. throw "Only precedence DFAs may contain a precedence start state.";
  27906. }
  27907. // s0.edges is never null for a precedence DFA
  27908. if (precedence < 0 || precedence >= this.s0.edges.length) {
  27909. return null;
  27910. }
  27911. return this.s0.edges[precedence] || null;
  27912. };
  27913. // Set the start state for a specific precedence value.
  27914. //
  27915. // @param precedence The current precedence.
  27916. // @param startState The start state corresponding to the specified
  27917. // precedence.
  27918. //
  27919. // @throws IllegalStateException if this is not a precedence DFA.
  27920. // @see //isPrecedenceDfa()
  27921. //
  27922. DFA.prototype.setPrecedenceStartState = function (precedence, startState) {
  27923. if (!this.precedenceDfa) {
  27924. throw "Only precedence DFAs may contain a precedence start state.";
  27925. }
  27926. if (precedence < 0) {
  27927. return;
  27928. }
  27929. // synchronization on s0 here is ok. when the DFA is turned into a
  27930. // precedence DFA, s0 will be initialized once and not updated again
  27931. // s0.edges is never null for a precedence DFA
  27932. this.s0.edges[precedence] = startState;
  27933. };
  27934. //
  27935. // Sets whether this is a precedence DFA. If the specified value differs
  27936. // from the current DFA configuration, the following actions are taken;
  27937. // otherwise no changes are made to the current DFA.
  27938. //
  27939. // <ul>
  27940. // <li>The {@link //states} map is cleared</li>
  27941. // <li>If {@code precedenceDfa} is {@code false}, the initial state
  27942. // {@link //s0} is set to {@code null}; otherwise, it is initialized to a new
  27943. // {@link DFAState} with an empty outgoing {@link DFAState//edges} array to
  27944. // store the start states for individual precedence values.</li>
  27945. // <li>The {@link //precedenceDfa} field is updated</li>
  27946. // </ul>
  27947. //
  27948. // @param precedenceDfa {@code true} if this is a precedence DFA; otherwise,
  27949. // {@code false}
  27950. DFA.prototype.setPrecedenceDfa = function (precedenceDfa) {
  27951. if (this.precedenceDfa !== precedenceDfa) {
  27952. this._states = new DFAStatesSet();
  27953. if (precedenceDfa) {
  27954. var precedenceState = new DFAState(null, new ATNConfigSet());
  27955. precedenceState.edges = [];
  27956. precedenceState.isAcceptState = false;
  27957. precedenceState.requiresFullContext = false;
  27958. this.s0 = precedenceState;
  27959. } else {
  27960. this.s0 = null;
  27961. }
  27962. this.precedenceDfa = precedenceDfa;
  27963. }
  27964. };
  27965. Object.defineProperty(DFA.prototype, "states", {
  27966. get: function get() {
  27967. return this._states;
  27968. }
  27969. });
  27970. // Return a list of all states in this DFA, ordered by state number.
  27971. DFA.prototype.sortedStates = function () {
  27972. var list = this._states.values();
  27973. return list.sort(function (a, b) {
  27974. return a.stateNumber - b.stateNumber;
  27975. });
  27976. };
  27977. DFA.prototype.toString = function (literalNames, symbolicNames) {
  27978. literalNames = literalNames || null;
  27979. symbolicNames = symbolicNames || null;
  27980. if (this.s0 === null) {
  27981. return "";
  27982. }
  27983. var serializer = new DFASerializer(this, literalNames, symbolicNames);
  27984. return serializer.toString();
  27985. };
  27986. DFA.prototype.toLexerString = function () {
  27987. if (this.s0 === null) {
  27988. return "";
  27989. }
  27990. var serializer = new LexerDFASerializer(this);
  27991. return serializer.toString();
  27992. };
  27993. exports.DFA = DFA;
  27994. /***/ }),
  27995. /***/ "./node_modules/antlr4/dfa/DFASerializer.js":
  27996. /*!**************************************************!*\
  27997. !*** ./node_modules/antlr4/dfa/DFASerializer.js ***!
  27998. \**************************************************/
  27999. /*! no static exports found */
  28000. /***/ (function(module, exports, __webpack_require__) {
  28001. "use strict";
  28002. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28003. * Use of this file is governed by the BSD 3-clause license that
  28004. * can be found in the LICENSE.txt file in the project root.
  28005. */
  28006. // A DFA walker that knows how to dump them to serialized strings.#/
  28007. function DFASerializer(dfa, literalNames, symbolicNames) {
  28008. this.dfa = dfa;
  28009. this.literalNames = literalNames || [];
  28010. this.symbolicNames = symbolicNames || [];
  28011. return this;
  28012. }
  28013. DFASerializer.prototype.toString = function () {
  28014. if (this.dfa.s0 === null) {
  28015. return null;
  28016. }
  28017. var buf = "";
  28018. var states = this.dfa.sortedStates();
  28019. for (var i = 0; i < states.length; i++) {
  28020. var s = states[i];
  28021. if (s.edges !== null) {
  28022. var n = s.edges.length;
  28023. for (var j = 0; j < n; j++) {
  28024. var t = s.edges[j] || null;
  28025. if (t !== null && t.stateNumber !== 0x7FFFFFFF) {
  28026. buf = buf.concat(this.getStateString(s));
  28027. buf = buf.concat("-");
  28028. buf = buf.concat(this.getEdgeLabel(j));
  28029. buf = buf.concat("->");
  28030. buf = buf.concat(this.getStateString(t));
  28031. buf = buf.concat('\n');
  28032. }
  28033. }
  28034. }
  28035. }
  28036. return buf.length === 0 ? null : buf;
  28037. };
  28038. DFASerializer.prototype.getEdgeLabel = function (i) {
  28039. if (i === 0) {
  28040. return "EOF";
  28041. } else if (this.literalNames !== null || this.symbolicNames !== null) {
  28042. return this.literalNames[i - 1] || this.symbolicNames[i - 1];
  28043. } else {
  28044. return String.fromCharCode(i - 1);
  28045. }
  28046. };
  28047. DFASerializer.prototype.getStateString = function (s) {
  28048. var baseStateStr = (s.isAcceptState ? ":" : "") + "s" + s.stateNumber + (s.requiresFullContext ? "^" : "");
  28049. if (s.isAcceptState) {
  28050. if (s.predicates !== null) {
  28051. return baseStateStr + "=>" + s.predicates.toString();
  28052. } else {
  28053. return baseStateStr + "=>" + s.prediction.toString();
  28054. }
  28055. } else {
  28056. return baseStateStr;
  28057. }
  28058. };
  28059. function LexerDFASerializer(dfa) {
  28060. DFASerializer.call(this, dfa, null);
  28061. return this;
  28062. }
  28063. LexerDFASerializer.prototype = Object.create(DFASerializer.prototype);
  28064. LexerDFASerializer.prototype.constructor = LexerDFASerializer;
  28065. LexerDFASerializer.prototype.getEdgeLabel = function (i) {
  28066. return "'" + String.fromCharCode(i) + "'";
  28067. };
  28068. exports.DFASerializer = DFASerializer;
  28069. exports.LexerDFASerializer = LexerDFASerializer;
  28070. /***/ }),
  28071. /***/ "./node_modules/antlr4/dfa/DFAState.js":
  28072. /*!*********************************************!*\
  28073. !*** ./node_modules/antlr4/dfa/DFAState.js ***!
  28074. \*********************************************/
  28075. /*! no static exports found */
  28076. /***/ (function(module, exports, __webpack_require__) {
  28077. "use strict";
  28078. //
  28079. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28080. * Use of this file is governed by the BSD 3-clause license that
  28081. * can be found in the LICENSE.txt file in the project root.
  28082. */
  28083. ///
  28084. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  28085. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  28086. var Hash = Utils.Hash;
  28087. var Set = Utils.Set;
  28088. // Map a predicate to a predicted alternative.///
  28089. function PredPrediction(pred, alt) {
  28090. this.alt = alt;
  28091. this.pred = pred;
  28092. return this;
  28093. }
  28094. PredPrediction.prototype.toString = function () {
  28095. return "(" + this.pred + ", " + this.alt + ")";
  28096. };
  28097. // A DFA state represents a set of possible ATN configurations.
  28098. // As Aho, Sethi, Ullman p. 117 says "The DFA uses its state
  28099. // to keep track of all possible states the ATN can be in after
  28100. // reading each input symbol. That is to say, after reading
  28101. // input a1a2..an, the DFA is in a state that represents the
  28102. // subset T of the states of the ATN that are reachable from the
  28103. // ATN's start state along some path labeled a1a2..an."
  28104. // In conventional NFA&rarr;DFA conversion, therefore, the subset T
  28105. // would be a bitset representing the set of states the
  28106. // ATN could be in. We need to track the alt predicted by each
  28107. // state as well, however. More importantly, we need to maintain
  28108. // a stack of states, tracking the closure operations as they
  28109. // jump from rule to rule, emulating rule invocations (method calls).
  28110. // I have to add a stack to simulate the proper lookahead sequences for
  28111. // the underlying LL grammar from which the ATN was derived.
  28112. //
  28113. // <p>I use a set of ATNConfig objects not simple states. An ATNConfig
  28114. // is both a state (ala normal conversion) and a RuleContext describing
  28115. // the chain of rules (if any) followed to arrive at that state.</p>
  28116. //
  28117. // <p>A DFA state may have multiple references to a particular state,
  28118. // but with different ATN contexts (with same or different alts)
  28119. // meaning that state was reached via a different set of rule invocations.</p>
  28120. // /
  28121. function DFAState(stateNumber, configs) {
  28122. if (stateNumber === null) {
  28123. stateNumber = -1;
  28124. }
  28125. if (configs === null) {
  28126. configs = new ATNConfigSet();
  28127. }
  28128. this.stateNumber = stateNumber;
  28129. this.configs = configs;
  28130. // {@code edges[symbol]} points to target of symbol. Shift up by 1 so (-1)
  28131. // {@link Token//EOF} maps to {@code edges[0]}.
  28132. this.edges = null;
  28133. this.isAcceptState = false;
  28134. // if accept state, what ttype do we match or alt do we predict?
  28135. // This is set to {@link ATN//INVALID_ALT_NUMBER} when {@link
  28136. // //predicates}{@code !=null} or
  28137. // {@link //requiresFullContext}.
  28138. this.prediction = 0;
  28139. this.lexerActionExecutor = null;
  28140. // Indicates that this state was created during SLL prediction that
  28141. // discovered a conflict between the configurations in the state. Future
  28142. // {@link ParserATNSimulator//execATN} invocations immediately jumped doing
  28143. // full context prediction if this field is true.
  28144. this.requiresFullContext = false;
  28145. // During SLL parsing, this is a list of predicates associated with the
  28146. // ATN configurations of the DFA state. When we have predicates,
  28147. // {@link //requiresFullContext} is {@code false} since full context
  28148. // prediction evaluates predicates
  28149. // on-the-fly. If this is not null, then {@link //prediction} is
  28150. // {@link ATN//INVALID_ALT_NUMBER}.
  28151. //
  28152. // <p>We only use these for non-{@link //requiresFullContext} but
  28153. // conflicting states. That
  28154. // means we know from the context (it's $ or we don't dip into outer
  28155. // context) that it's an ambiguity not a conflict.</p>
  28156. //
  28157. // <p>This list is computed by {@link
  28158. // ParserATNSimulator//predicateDFAState}.</p>
  28159. this.predicates = null;
  28160. return this;
  28161. }
  28162. // Get the set of all alts mentioned by all ATN configurations in this
  28163. // DFA state.
  28164. DFAState.prototype.getAltSet = function () {
  28165. var alts = new Set();
  28166. if (this.configs !== null) {
  28167. for (var i = 0; i < this.configs.length; i++) {
  28168. var c = this.configs[i];
  28169. alts.add(c.alt);
  28170. }
  28171. }
  28172. if (alts.length === 0) {
  28173. return null;
  28174. } else {
  28175. return alts;
  28176. }
  28177. };
  28178. // Two {@link DFAState} instances are equal if their ATN configuration sets
  28179. // are the same. This method is used to see if a state already exists.
  28180. //
  28181. // <p>Because the number of alternatives and number of ATN configurations are
  28182. // finite, there is a finite number of DFA states that can be processed.
  28183. // This is necessary to show that the algorithm terminates.</p>
  28184. //
  28185. // <p>Cannot test the DFA state numbers here because in
  28186. // {@link ParserATNSimulator//addDFAState} we need to know if any other state
  28187. // exists that has this exact set of ATN configurations. The
  28188. // {@link //stateNumber} is irrelevant.</p>
  28189. DFAState.prototype.equals = function (other) {
  28190. // compare set of ATN configurations in this set with other
  28191. return this === other || other instanceof DFAState && this.configs.equals(other.configs);
  28192. };
  28193. DFAState.prototype.toString = function () {
  28194. var s = "" + this.stateNumber + ":" + this.configs;
  28195. if (this.isAcceptState) {
  28196. s = s + "=>";
  28197. if (this.predicates !== null) s = s + this.predicates;else s = s + this.prediction;
  28198. }
  28199. return s;
  28200. };
  28201. DFAState.prototype.hashCode = function () {
  28202. var hash = new Hash();
  28203. hash.update(this.configs);
  28204. if (this.isAcceptState) {
  28205. if (this.predicates !== null) hash.update(this.predicates);else hash.update(this.prediction);
  28206. }
  28207. return hash.finish();
  28208. };
  28209. exports.DFAState = DFAState;
  28210. exports.PredPrediction = PredPrediction;
  28211. /***/ }),
  28212. /***/ "./node_modules/antlr4/dfa/index.js":
  28213. /*!******************************************!*\
  28214. !*** ./node_modules/antlr4/dfa/index.js ***!
  28215. \******************************************/
  28216. /*! no static exports found */
  28217. /***/ (function(module, exports, __webpack_require__) {
  28218. "use strict";
  28219. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28220. * Use of this file is governed by the BSD 3-clause license that
  28221. * can be found in the LICENSE.txt file in the project root.
  28222. */
  28223. exports.DFA = __webpack_require__(/*! ./DFA */ "./node_modules/antlr4/dfa/DFA.js").DFA;
  28224. exports.DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  28225. exports.LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  28226. exports.PredPrediction = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  28227. /***/ }),
  28228. /***/ "./node_modules/antlr4/error/DiagnosticErrorListener.js":
  28229. /*!**************************************************************!*\
  28230. !*** ./node_modules/antlr4/error/DiagnosticErrorListener.js ***!
  28231. \**************************************************************/
  28232. /*! no static exports found */
  28233. /***/ (function(module, exports, __webpack_require__) {
  28234. "use strict";
  28235. //
  28236. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28237. * Use of this file is governed by the BSD 3-clause license that
  28238. * can be found in the LICENSE.txt file in the project root.
  28239. */
  28240. //
  28241. //
  28242. // This implementation of {@link ANTLRErrorListener} can be used to identify
  28243. // certain potential correctness and performance problems in grammars. "Reports"
  28244. // are made by calling {@link Parser//notifyErrorListeners} with the appropriate
  28245. // message.
  28246. //
  28247. // <ul>
  28248. // <li><b>Ambiguities</b>: These are cases where more than one path through the
  28249. // grammar can match the input.</li>
  28250. // <li><b>Weak context sensitivity</b>: These are cases where full-context
  28251. // prediction resolved an SLL conflict to a unique alternative which equaled the
  28252. // minimum alternative of the SLL conflict.</li>
  28253. // <li><b>Strong (forced) context sensitivity</b>: These are cases where the
  28254. // full-context prediction resolved an SLL conflict to a unique alternative,
  28255. // <em>and</em> the minimum alternative of the SLL conflict was found to not be
  28256. // a truly viable alternative. Two-stage parsing cannot be used for inputs where
  28257. // this situation occurs.</li>
  28258. // </ul>
  28259. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  28260. var ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  28261. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  28262. function DiagnosticErrorListener(exactOnly) {
  28263. ErrorListener.call(this);
  28264. exactOnly = exactOnly || true;
  28265. // whether all ambiguities or only exact ambiguities are reported.
  28266. this.exactOnly = exactOnly;
  28267. return this;
  28268. }
  28269. DiagnosticErrorListener.prototype = Object.create(ErrorListener.prototype);
  28270. DiagnosticErrorListener.prototype.constructor = DiagnosticErrorListener;
  28271. DiagnosticErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  28272. if (this.exactOnly && !exact) {
  28273. return;
  28274. }
  28275. var msg = "reportAmbiguity d=" + this.getDecisionDescription(recognizer, dfa) + ": ambigAlts=" + this.getConflictingAlts(ambigAlts, configs) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  28276. recognizer.notifyErrorListeners(msg);
  28277. };
  28278. DiagnosticErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  28279. var msg = "reportAttemptingFullContext d=" + this.getDecisionDescription(recognizer, dfa) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  28280. recognizer.notifyErrorListeners(msg);
  28281. };
  28282. DiagnosticErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  28283. var msg = "reportContextSensitivity d=" + this.getDecisionDescription(recognizer, dfa) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  28284. recognizer.notifyErrorListeners(msg);
  28285. };
  28286. DiagnosticErrorListener.prototype.getDecisionDescription = function (recognizer, dfa) {
  28287. var decision = dfa.decision;
  28288. var ruleIndex = dfa.atnStartState.ruleIndex;
  28289. var ruleNames = recognizer.ruleNames;
  28290. if (ruleIndex < 0 || ruleIndex >= ruleNames.length) {
  28291. return "" + decision;
  28292. }
  28293. var ruleName = ruleNames[ruleIndex] || null;
  28294. if (ruleName === null || ruleName.length === 0) {
  28295. return "" + decision;
  28296. }
  28297. return "" + decision + " (" + ruleName + ")";
  28298. };
  28299. //
  28300. // Computes the set of conflicting or ambiguous alternatives from a
  28301. // configuration set, if that information was not already provided by the
  28302. // parser.
  28303. //
  28304. // @param reportedAlts The set of conflicting or ambiguous alternatives, as
  28305. // reported by the parser.
  28306. // @param configs The conflicting or ambiguous configuration set.
  28307. // @return Returns {@code reportedAlts} if it is not {@code null}, otherwise
  28308. // returns the set of alternatives represented in {@code configs}.
  28309. //
  28310. DiagnosticErrorListener.prototype.getConflictingAlts = function (reportedAlts, configs) {
  28311. if (reportedAlts !== null) {
  28312. return reportedAlts;
  28313. }
  28314. var result = new BitSet();
  28315. for (var i = 0; i < configs.items.length; i++) {
  28316. result.add(configs.items[i].alt);
  28317. }
  28318. return "{" + result.values().join(", ") + "}";
  28319. };
  28320. exports.DiagnosticErrorListener = DiagnosticErrorListener;
  28321. /***/ }),
  28322. /***/ "./node_modules/antlr4/error/ErrorListener.js":
  28323. /*!****************************************************!*\
  28324. !*** ./node_modules/antlr4/error/ErrorListener.js ***!
  28325. \****************************************************/
  28326. /*! no static exports found */
  28327. /***/ (function(module, exports, __webpack_require__) {
  28328. "use strict";
  28329. //
  28330. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28331. * Use of this file is governed by the BSD 3-clause license that
  28332. * can be found in the LICENSE.txt file in the project root.
  28333. */
  28334. // Provides an empty default implementation of {@link ANTLRErrorListener}. The
  28335. // default implementation of each method does nothing, but can be overridden as
  28336. // necessary.
  28337. function ErrorListener() {
  28338. return this;
  28339. }
  28340. ErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {};
  28341. ErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {};
  28342. ErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {};
  28343. ErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {};
  28344. function ConsoleErrorListener() {
  28345. ErrorListener.call(this);
  28346. return this;
  28347. }
  28348. ConsoleErrorListener.prototype = Object.create(ErrorListener.prototype);
  28349. ConsoleErrorListener.prototype.constructor = ConsoleErrorListener;
  28350. //
  28351. // Provides a default instance of {@link ConsoleErrorListener}.
  28352. //
  28353. ConsoleErrorListener.INSTANCE = new ConsoleErrorListener();
  28354. //
  28355. // {@inheritDoc}
  28356. //
  28357. // <p>
  28358. // This implementation prints messages to {@link System//err} containing the
  28359. // values of {@code line}, {@code charPositionInLine}, and {@code msg} using
  28360. // the following format.</p>
  28361. //
  28362. // <pre>
  28363. // line <em>line</em>:<em>charPositionInLine</em> <em>msg</em>
  28364. // </pre>
  28365. //
  28366. ConsoleErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
  28367. console.error("line " + line + ":" + column + " " + msg);
  28368. };
  28369. function ProxyErrorListener(delegates) {
  28370. ErrorListener.call(this);
  28371. if (delegates === null) {
  28372. throw "delegates";
  28373. }
  28374. this.delegates = delegates;
  28375. return this;
  28376. }
  28377. ProxyErrorListener.prototype = Object.create(ErrorListener.prototype);
  28378. ProxyErrorListener.prototype.constructor = ProxyErrorListener;
  28379. ProxyErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
  28380. this.delegates.map(function (d) {
  28381. d.syntaxError(recognizer, offendingSymbol, line, column, msg, e);
  28382. });
  28383. };
  28384. ProxyErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  28385. this.delegates.map(function (d) {
  28386. d.reportAmbiguity(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  28387. });
  28388. };
  28389. ProxyErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  28390. this.delegates.map(function (d) {
  28391. d.reportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs);
  28392. });
  28393. };
  28394. ProxyErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  28395. this.delegates.map(function (d) {
  28396. d.reportContextSensitivity(recognizer, dfa, startIndex, stopIndex, prediction, configs);
  28397. });
  28398. };
  28399. exports.ErrorListener = ErrorListener;
  28400. exports.ConsoleErrorListener = ConsoleErrorListener;
  28401. exports.ProxyErrorListener = ProxyErrorListener;
  28402. /***/ }),
  28403. /***/ "./node_modules/antlr4/error/ErrorStrategy.js":
  28404. /*!****************************************************!*\
  28405. !*** ./node_modules/antlr4/error/ErrorStrategy.js ***!
  28406. \****************************************************/
  28407. /*! no static exports found */
  28408. /***/ (function(module, exports, __webpack_require__) {
  28409. "use strict";
  28410. //
  28411. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28412. * Use of this file is governed by the BSD 3-clause license that
  28413. * can be found in the LICENSE.txt file in the project root.
  28414. */
  28415. //
  28416. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  28417. var Errors = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js");
  28418. var NoViableAltException = Errors.NoViableAltException;
  28419. var InputMismatchException = Errors.InputMismatchException;
  28420. var FailedPredicateException = Errors.FailedPredicateException;
  28421. var ParseCancellationException = Errors.ParseCancellationException;
  28422. var ATNState = __webpack_require__(/*! ./../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  28423. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  28424. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  28425. function ErrorStrategy() {}
  28426. ErrorStrategy.prototype.reset = function (recognizer) {};
  28427. ErrorStrategy.prototype.recoverInline = function (recognizer) {};
  28428. ErrorStrategy.prototype.recover = function (recognizer, e) {};
  28429. ErrorStrategy.prototype.sync = function (recognizer) {};
  28430. ErrorStrategy.prototype.inErrorRecoveryMode = function (recognizer) {};
  28431. ErrorStrategy.prototype.reportError = function (recognizer) {};
  28432. // This is the default implementation of {@link ANTLRErrorStrategy} used for
  28433. // error reporting and recovery in ANTLR parsers.
  28434. //
  28435. function DefaultErrorStrategy() {
  28436. ErrorStrategy.call(this);
  28437. // Indicates whether the error strategy is currently "recovering from an
  28438. // error". This is used to suppress reporting multiple error messages while
  28439. // attempting to recover from a detected syntax error.
  28440. //
  28441. // @see //inErrorRecoveryMode
  28442. //
  28443. this.errorRecoveryMode = false;
  28444. // The index into the input stream where the last error occurred.
  28445. // This is used to prevent infinite loops where an error is found
  28446. // but no token is consumed during recovery...another error is found,
  28447. // ad nauseum. This is a failsafe mechanism to guarantee that at least
  28448. // one token/tree node is consumed for two errors.
  28449. //
  28450. this.lastErrorIndex = -1;
  28451. this.lastErrorStates = null;
  28452. return this;
  28453. }
  28454. DefaultErrorStrategy.prototype = Object.create(ErrorStrategy.prototype);
  28455. DefaultErrorStrategy.prototype.constructor = DefaultErrorStrategy;
  28456. // <p>The default implementation simply calls {@link //endErrorCondition} to
  28457. // ensure that the handler is not in error recovery mode.</p>
  28458. DefaultErrorStrategy.prototype.reset = function (recognizer) {
  28459. this.endErrorCondition(recognizer);
  28460. };
  28461. //
  28462. // This method is called to enter error recovery mode when a recognition
  28463. // exception is reported.
  28464. //
  28465. // @param recognizer the parser instance
  28466. //
  28467. DefaultErrorStrategy.prototype.beginErrorCondition = function (recognizer) {
  28468. this.errorRecoveryMode = true;
  28469. };
  28470. DefaultErrorStrategy.prototype.inErrorRecoveryMode = function (recognizer) {
  28471. return this.errorRecoveryMode;
  28472. };
  28473. //
  28474. // This method is called to leave error recovery mode after recovering from
  28475. // a recognition exception.
  28476. //
  28477. // @param recognizer
  28478. //
  28479. DefaultErrorStrategy.prototype.endErrorCondition = function (recognizer) {
  28480. this.errorRecoveryMode = false;
  28481. this.lastErrorStates = null;
  28482. this.lastErrorIndex = -1;
  28483. };
  28484. //
  28485. // {@inheritDoc}
  28486. //
  28487. // <p>The default implementation simply calls {@link //endErrorCondition}.</p>
  28488. //
  28489. DefaultErrorStrategy.prototype.reportMatch = function (recognizer) {
  28490. this.endErrorCondition(recognizer);
  28491. };
  28492. //
  28493. // {@inheritDoc}
  28494. //
  28495. // <p>The default implementation returns immediately if the handler is already
  28496. // in error recovery mode. Otherwise, it calls {@link //beginErrorCondition}
  28497. // and dispatches the reporting task based on the runtime type of {@code e}
  28498. // according to the following table.</p>
  28499. //
  28500. // <ul>
  28501. // <li>{@link NoViableAltException}: Dispatches the call to
  28502. // {@link //reportNoViableAlternative}</li>
  28503. // <li>{@link InputMismatchException}: Dispatches the call to
  28504. // {@link //reportInputMismatch}</li>
  28505. // <li>{@link FailedPredicateException}: Dispatches the call to
  28506. // {@link //reportFailedPredicate}</li>
  28507. // <li>All other types: calls {@link Parser//notifyErrorListeners} to report
  28508. // the exception</li>
  28509. // </ul>
  28510. //
  28511. DefaultErrorStrategy.prototype.reportError = function (recognizer, e) {
  28512. // if we've already reported an error and have not matched a token
  28513. // yet successfully, don't report any errors.
  28514. if (this.inErrorRecoveryMode(recognizer)) {
  28515. return; // don't report spurious errors
  28516. }
  28517. this.beginErrorCondition(recognizer);
  28518. if (e instanceof NoViableAltException) {
  28519. this.reportNoViableAlternative(recognizer, e);
  28520. } else if (e instanceof InputMismatchException) {
  28521. this.reportInputMismatch(recognizer, e);
  28522. } else if (e instanceof FailedPredicateException) {
  28523. this.reportFailedPredicate(recognizer, e);
  28524. } else {
  28525. console.log("unknown recognition error type: " + e.constructor.name);
  28526. console.log(e.stack);
  28527. recognizer.notifyErrorListeners(e.getOffendingToken(), e.getMessage(), e);
  28528. }
  28529. };
  28530. //
  28531. // {@inheritDoc}
  28532. //
  28533. // <p>The default implementation resynchronizes the parser by consuming tokens
  28534. // until we find one in the resynchronization set--loosely the set of tokens
  28535. // that can follow the current rule.</p>
  28536. //
  28537. DefaultErrorStrategy.prototype.recover = function (recognizer, e) {
  28538. if (this.lastErrorIndex === recognizer.getInputStream().index && this.lastErrorStates !== null && this.lastErrorStates.indexOf(recognizer.state) >= 0) {
  28539. // uh oh, another error at same token index and previously-visited
  28540. // state in ATN; must be a case where LT(1) is in the recovery
  28541. // token set so nothing got consumed. Consume a single token
  28542. // at least to prevent an infinite loop; this is a failsafe.
  28543. recognizer.consume();
  28544. }
  28545. this.lastErrorIndex = recognizer._input.index;
  28546. if (this.lastErrorStates === null) {
  28547. this.lastErrorStates = [];
  28548. }
  28549. this.lastErrorStates.push(recognizer.state);
  28550. var followSet = this.getErrorRecoverySet(recognizer);
  28551. this.consumeUntil(recognizer, followSet);
  28552. };
  28553. // The default implementation of {@link ANTLRErrorStrategy//sync} makes sure
  28554. // that the current lookahead symbol is consistent with what were expecting
  28555. // at this point in the ATN. You can call this anytime but ANTLR only
  28556. // generates code to check before subrules/loops and each iteration.
  28557. //
  28558. // <p>Implements Jim Idle's magic sync mechanism in closures and optional
  28559. // subrules. E.g.,</p>
  28560. //
  28561. // <pre>
  28562. // a : sync ( stuff sync )* ;
  28563. // sync : {consume to what can follow sync} ;
  28564. // </pre>
  28565. //
  28566. // At the start of a sub rule upon error, {@link //sync} performs single
  28567. // token deletion, if possible. If it can't do that, it bails on the current
  28568. // rule and uses the default error recovery, which consumes until the
  28569. // resynchronization set of the current rule.
  28570. //
  28571. // <p>If the sub rule is optional ({@code (...)?}, {@code (...)*}, or block
  28572. // with an empty alternative), then the expected set includes what follows
  28573. // the subrule.</p>
  28574. //
  28575. // <p>During loop iteration, it consumes until it sees a token that can start a
  28576. // sub rule or what follows loop. Yes, that is pretty aggressive. We opt to
  28577. // stay in the loop as long as possible.</p>
  28578. //
  28579. // <p><strong>ORIGINS</strong></p>
  28580. //
  28581. // <p>Previous versions of ANTLR did a poor job of their recovery within loops.
  28582. // A single mismatch token or missing token would force the parser to bail
  28583. // out of the entire rules surrounding the loop. So, for rule</p>
  28584. //
  28585. // <pre>
  28586. // classDef : 'class' ID '{' member* '}'
  28587. // </pre>
  28588. //
  28589. // input with an extra token between members would force the parser to
  28590. // consume until it found the next class definition rather than the next
  28591. // member definition of the current class.
  28592. //
  28593. // <p>This functionality cost a little bit of effort because the parser has to
  28594. // compare token set at the start of the loop and at each iteration. If for
  28595. // some reason speed is suffering for you, you can turn off this
  28596. // functionality by simply overriding this method as a blank { }.</p>
  28597. //
  28598. DefaultErrorStrategy.prototype.sync = function (recognizer) {
  28599. // If already recovering, don't try to sync
  28600. if (this.inErrorRecoveryMode(recognizer)) {
  28601. return;
  28602. }
  28603. var s = recognizer._interp.atn.states[recognizer.state];
  28604. var la = recognizer.getTokenStream().LA(1);
  28605. // try cheaper subset first; might get lucky. seems to shave a wee bit off
  28606. var nextTokens = recognizer.atn.nextTokens(s);
  28607. if (nextTokens.contains(Token.EPSILON) || nextTokens.contains(la)) {
  28608. return;
  28609. }
  28610. switch (s.stateType) {
  28611. case ATNState.BLOCK_START:
  28612. case ATNState.STAR_BLOCK_START:
  28613. case ATNState.PLUS_BLOCK_START:
  28614. case ATNState.STAR_LOOP_ENTRY:
  28615. // report error and recover if possible
  28616. if (this.singleTokenDeletion(recognizer) !== null) {
  28617. return;
  28618. } else {
  28619. throw new InputMismatchException(recognizer);
  28620. }
  28621. break;
  28622. case ATNState.PLUS_LOOP_BACK:
  28623. case ATNState.STAR_LOOP_BACK:
  28624. this.reportUnwantedToken(recognizer);
  28625. var expecting = new IntervalSet();
  28626. expecting.addSet(recognizer.getExpectedTokens());
  28627. var whatFollowsLoopIterationOrRule = expecting.addSet(this.getErrorRecoverySet(recognizer));
  28628. this.consumeUntil(recognizer, whatFollowsLoopIterationOrRule);
  28629. break;
  28630. default:
  28631. // do nothing if we can't identify the exact kind of ATN state
  28632. }
  28633. };
  28634. // This is called by {@link //reportError} when the exception is a
  28635. // {@link NoViableAltException}.
  28636. //
  28637. // @see //reportError
  28638. //
  28639. // @param recognizer the parser instance
  28640. // @param e the recognition exception
  28641. //
  28642. DefaultErrorStrategy.prototype.reportNoViableAlternative = function (recognizer, e) {
  28643. var tokens = recognizer.getTokenStream();
  28644. var input;
  28645. if (tokens !== null) {
  28646. if (e.startToken.type === Token.EOF) {
  28647. input = "<EOF>";
  28648. } else {
  28649. input = tokens.getText(new Interval(e.startToken.tokenIndex, e.offendingToken.tokenIndex));
  28650. }
  28651. } else {
  28652. input = "<unknown input>";
  28653. }
  28654. var msg = "no viable alternative at input " + this.escapeWSAndQuote(input);
  28655. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  28656. };
  28657. //
  28658. // This is called by {@link //reportError} when the exception is an
  28659. // {@link InputMismatchException}.
  28660. //
  28661. // @see //reportError
  28662. //
  28663. // @param recognizer the parser instance
  28664. // @param e the recognition exception
  28665. //
  28666. DefaultErrorStrategy.prototype.reportInputMismatch = function (recognizer, e) {
  28667. var msg = "mismatched input " + this.getTokenErrorDisplay(e.offendingToken) + " expecting " + e.getExpectedTokens().toString(recognizer.literalNames, recognizer.symbolicNames);
  28668. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  28669. };
  28670. //
  28671. // This is called by {@link //reportError} when the exception is a
  28672. // {@link FailedPredicateException}.
  28673. //
  28674. // @see //reportError
  28675. //
  28676. // @param recognizer the parser instance
  28677. // @param e the recognition exception
  28678. //
  28679. DefaultErrorStrategy.prototype.reportFailedPredicate = function (recognizer, e) {
  28680. var ruleName = recognizer.ruleNames[recognizer._ctx.ruleIndex];
  28681. var msg = "rule " + ruleName + " " + e.message;
  28682. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  28683. };
  28684. // This method is called to report a syntax error which requires the removal
  28685. // of a token from the input stream. At the time this method is called, the
  28686. // erroneous symbol is current {@code LT(1)} symbol and has not yet been
  28687. // removed from the input stream. When this method returns,
  28688. // {@code recognizer} is in error recovery mode.
  28689. //
  28690. // <p>This method is called when {@link //singleTokenDeletion} identifies
  28691. // single-token deletion as a viable recovery strategy for a mismatched
  28692. // input error.</p>
  28693. //
  28694. // <p>The default implementation simply returns if the handler is already in
  28695. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  28696. // enter error recovery mode, followed by calling
  28697. // {@link Parser//notifyErrorListeners}.</p>
  28698. //
  28699. // @param recognizer the parser instance
  28700. //
  28701. DefaultErrorStrategy.prototype.reportUnwantedToken = function (recognizer) {
  28702. if (this.inErrorRecoveryMode(recognizer)) {
  28703. return;
  28704. }
  28705. this.beginErrorCondition(recognizer);
  28706. var t = recognizer.getCurrentToken();
  28707. var tokenName = this.getTokenErrorDisplay(t);
  28708. var expecting = this.getExpectedTokens(recognizer);
  28709. var msg = "extraneous input " + tokenName + " expecting " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames);
  28710. recognizer.notifyErrorListeners(msg, t, null);
  28711. };
  28712. // This method is called to report a syntax error which requires the
  28713. // insertion of a missing token into the input stream. At the time this
  28714. // method is called, the missing token has not yet been inserted. When this
  28715. // method returns, {@code recognizer} is in error recovery mode.
  28716. //
  28717. // <p>This method is called when {@link //singleTokenInsertion} identifies
  28718. // single-token insertion as a viable recovery strategy for a mismatched
  28719. // input error.</p>
  28720. //
  28721. // <p>The default implementation simply returns if the handler is already in
  28722. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  28723. // enter error recovery mode, followed by calling
  28724. // {@link Parser//notifyErrorListeners}.</p>
  28725. //
  28726. // @param recognizer the parser instance
  28727. //
  28728. DefaultErrorStrategy.prototype.reportMissingToken = function (recognizer) {
  28729. if (this.inErrorRecoveryMode(recognizer)) {
  28730. return;
  28731. }
  28732. this.beginErrorCondition(recognizer);
  28733. var t = recognizer.getCurrentToken();
  28734. var expecting = this.getExpectedTokens(recognizer);
  28735. var msg = "missing " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames) + " at " + this.getTokenErrorDisplay(t);
  28736. recognizer.notifyErrorListeners(msg, t, null);
  28737. };
  28738. // <p>The default implementation attempts to recover from the mismatched input
  28739. // by using single token insertion and deletion as described below. If the
  28740. // recovery attempt fails, this method throws an
  28741. // {@link InputMismatchException}.</p>
  28742. //
  28743. // <p><strong>EXTRA TOKEN</strong> (single token deletion)</p>
  28744. //
  28745. // <p>{@code LA(1)} is not what we are looking for. If {@code LA(2)} has the
  28746. // right token, however, then assume {@code LA(1)} is some extra spurious
  28747. // token and delete it. Then consume and return the next token (which was
  28748. // the {@code LA(2)} token) as the successful result of the match operation.</p>
  28749. //
  28750. // <p>This recovery strategy is implemented by {@link
  28751. // //singleTokenDeletion}.</p>
  28752. //
  28753. // <p><strong>MISSING TOKEN</strong> (single token insertion)</p>
  28754. //
  28755. // <p>If current token (at {@code LA(1)}) is consistent with what could come
  28756. // after the expected {@code LA(1)} token, then assume the token is missing
  28757. // and use the parser's {@link TokenFactory} to create it on the fly. The
  28758. // "insertion" is performed by returning the created token as the successful
  28759. // result of the match operation.</p>
  28760. //
  28761. // <p>This recovery strategy is implemented by {@link
  28762. // //singleTokenInsertion}.</p>
  28763. //
  28764. // <p><strong>EXAMPLE</strong></p>
  28765. //
  28766. // <p>For example, Input {@code i=(3;} is clearly missing the {@code ')'}. When
  28767. // the parser returns from the nested call to {@code expr}, it will have
  28768. // call chain:</p>
  28769. //
  28770. // <pre>
  28771. // stat &rarr; expr &rarr; atom
  28772. // </pre>
  28773. //
  28774. // and it will be trying to match the {@code ')'} at this point in the
  28775. // derivation:
  28776. //
  28777. // <pre>
  28778. // =&gt; ID '=' '(' INT ')' ('+' atom)* ';'
  28779. // ^
  28780. // </pre>
  28781. //
  28782. // The attempt to match {@code ')'} will fail when it sees {@code ';'} and
  28783. // call {@link //recoverInline}. To recover, it sees that {@code LA(1)==';'}
  28784. // is in the set of tokens that can follow the {@code ')'} token reference
  28785. // in rule {@code atom}. It can assume that you forgot the {@code ')'}.
  28786. //
  28787. DefaultErrorStrategy.prototype.recoverInline = function (recognizer) {
  28788. // SINGLE TOKEN DELETION
  28789. var matchedSymbol = this.singleTokenDeletion(recognizer);
  28790. if (matchedSymbol !== null) {
  28791. // we have deleted the extra token.
  28792. // now, move past ttype token as if all were ok
  28793. recognizer.consume();
  28794. return matchedSymbol;
  28795. }
  28796. // SINGLE TOKEN INSERTION
  28797. if (this.singleTokenInsertion(recognizer)) {
  28798. return this.getMissingSymbol(recognizer);
  28799. }
  28800. // even that didn't work; must throw the exception
  28801. throw new InputMismatchException(recognizer);
  28802. };
  28803. //
  28804. // This method implements the single-token insertion inline error recovery
  28805. // strategy. It is called by {@link //recoverInline} if the single-token
  28806. // deletion strategy fails to recover from the mismatched input. If this
  28807. // method returns {@code true}, {@code recognizer} will be in error recovery
  28808. // mode.
  28809. //
  28810. // <p>This method determines whether or not single-token insertion is viable by
  28811. // checking if the {@code LA(1)} input symbol could be successfully matched
  28812. // if it were instead the {@code LA(2)} symbol. If this method returns
  28813. // {@code true}, the caller is responsible for creating and inserting a
  28814. // token with the correct type to produce this behavior.</p>
  28815. //
  28816. // @param recognizer the parser instance
  28817. // @return {@code true} if single-token insertion is a viable recovery
  28818. // strategy for the current mismatched input, otherwise {@code false}
  28819. //
  28820. DefaultErrorStrategy.prototype.singleTokenInsertion = function (recognizer) {
  28821. var currentSymbolType = recognizer.getTokenStream().LA(1);
  28822. // if current token is consistent with what could come after current
  28823. // ATN state, then we know we're missing a token; error recovery
  28824. // is free to conjure up and insert the missing token
  28825. var atn = recognizer._interp.atn;
  28826. var currentState = atn.states[recognizer.state];
  28827. var next = currentState.transitions[0].target;
  28828. var expectingAtLL2 = atn.nextTokens(next, recognizer._ctx);
  28829. if (expectingAtLL2.contains(currentSymbolType)) {
  28830. this.reportMissingToken(recognizer);
  28831. return true;
  28832. } else {
  28833. return false;
  28834. }
  28835. };
  28836. // This method implements the single-token deletion inline error recovery
  28837. // strategy. It is called by {@link //recoverInline} to attempt to recover
  28838. // from mismatched input. If this method returns null, the parser and error
  28839. // handler state will not have changed. If this method returns non-null,
  28840. // {@code recognizer} will <em>not</em> be in error recovery mode since the
  28841. // returned token was a successful match.
  28842. //
  28843. // <p>If the single-token deletion is successful, this method calls
  28844. // {@link //reportUnwantedToken} to report the error, followed by
  28845. // {@link Parser//consume} to actually "delete" the extraneous token. Then,
  28846. // before returning {@link //reportMatch} is called to signal a successful
  28847. // match.</p>
  28848. //
  28849. // @param recognizer the parser instance
  28850. // @return the successfully matched {@link Token} instance if single-token
  28851. // deletion successfully recovers from the mismatched input, otherwise
  28852. // {@code null}
  28853. //
  28854. DefaultErrorStrategy.prototype.singleTokenDeletion = function (recognizer) {
  28855. var nextTokenType = recognizer.getTokenStream().LA(2);
  28856. var expecting = this.getExpectedTokens(recognizer);
  28857. if (expecting.contains(nextTokenType)) {
  28858. this.reportUnwantedToken(recognizer);
  28859. // print("recoverFromMismatchedToken deleting " \
  28860. // + str(recognizer.getTokenStream().LT(1)) \
  28861. // + " since " + str(recognizer.getTokenStream().LT(2)) \
  28862. // + " is what we want", file=sys.stderr)
  28863. recognizer.consume(); // simply delete extra token
  28864. // we want to return the token we're actually matching
  28865. var matchedSymbol = recognizer.getCurrentToken();
  28866. this.reportMatch(recognizer); // we know current token is correct
  28867. return matchedSymbol;
  28868. } else {
  28869. return null;
  28870. }
  28871. };
  28872. // Conjure up a missing token during error recovery.
  28873. //
  28874. // The recognizer attempts to recover from single missing
  28875. // symbols. But, actions might refer to that missing symbol.
  28876. // For example, x=ID {f($x);}. The action clearly assumes
  28877. // that there has been an identifier matched previously and that
  28878. // $x points at that token. If that token is missing, but
  28879. // the next token in the stream is what we want we assume that
  28880. // this token is missing and we keep going. Because we
  28881. // have to return some token to replace the missing token,
  28882. // we have to conjure one up. This method gives the user control
  28883. // over the tokens returned for missing tokens. Mostly,
  28884. // you will want to create something special for identifier
  28885. // tokens. For literals such as '{' and ',', the default
  28886. // action in the parser or tree parser works. It simply creates
  28887. // a CommonToken of the appropriate type. The text will be the token.
  28888. // If you change what tokens must be created by the lexer,
  28889. // override this method to create the appropriate tokens.
  28890. //
  28891. DefaultErrorStrategy.prototype.getMissingSymbol = function (recognizer) {
  28892. var currentSymbol = recognizer.getCurrentToken();
  28893. var expecting = this.getExpectedTokens(recognizer);
  28894. var expectedTokenType = expecting.first(); // get any element
  28895. var tokenText;
  28896. if (expectedTokenType === Token.EOF) {
  28897. tokenText = "<missing EOF>";
  28898. } else {
  28899. tokenText = "<missing " + recognizer.literalNames[expectedTokenType] + ">";
  28900. }
  28901. var current = currentSymbol;
  28902. var lookback = recognizer.getTokenStream().LT(-1);
  28903. if (current.type === Token.EOF && lookback !== null) {
  28904. current = lookback;
  28905. }
  28906. return recognizer.getTokenFactory().create(current.source, expectedTokenType, tokenText, Token.DEFAULT_CHANNEL, -1, -1, current.line, current.column);
  28907. };
  28908. DefaultErrorStrategy.prototype.getExpectedTokens = function (recognizer) {
  28909. return recognizer.getExpectedTokens();
  28910. };
  28911. // How should a token be displayed in an error message? The default
  28912. // is to display just the text, but during development you might
  28913. // want to have a lot of information spit out. Override in that case
  28914. // to use t.toString() (which, for CommonToken, dumps everything about
  28915. // the token). This is better than forcing you to override a method in
  28916. // your token objects because you don't have to go modify your lexer
  28917. // so that it creates a new Java type.
  28918. //
  28919. DefaultErrorStrategy.prototype.getTokenErrorDisplay = function (t) {
  28920. if (t === null) {
  28921. return "<no token>";
  28922. }
  28923. var s = t.text;
  28924. if (s === null) {
  28925. if (t.type === Token.EOF) {
  28926. s = "<EOF>";
  28927. } else {
  28928. s = "<" + t.type + ">";
  28929. }
  28930. }
  28931. return this.escapeWSAndQuote(s);
  28932. };
  28933. DefaultErrorStrategy.prototype.escapeWSAndQuote = function (s) {
  28934. s = s.replace(/\n/g, "\\n");
  28935. s = s.replace(/\r/g, "\\r");
  28936. s = s.replace(/\t/g, "\\t");
  28937. return "'" + s + "'";
  28938. };
  28939. // Compute the error recovery set for the current rule. During
  28940. // rule invocation, the parser pushes the set of tokens that can
  28941. // follow that rule reference on the stack; this amounts to
  28942. // computing FIRST of what follows the rule reference in the
  28943. // enclosing rule. See LinearApproximator.FIRST().
  28944. // This local follow set only includes tokens
  28945. // from within the rule; i.e., the FIRST computation done by
  28946. // ANTLR stops at the end of a rule.
  28947. //
  28948. // EXAMPLE
  28949. //
  28950. // When you find a "no viable alt exception", the input is not
  28951. // consistent with any of the alternatives for rule r. The best
  28952. // thing to do is to consume tokens until you see something that
  28953. // can legally follow a call to r//or* any rule that called r.
  28954. // You don't want the exact set of viable next tokens because the
  28955. // input might just be missing a token--you might consume the
  28956. // rest of the input looking for one of the missing tokens.
  28957. //
  28958. // Consider grammar:
  28959. //
  28960. // a : '[' b ']'
  28961. // | '(' b ')'
  28962. // ;
  28963. // b : c '^' INT ;
  28964. // c : ID
  28965. // | INT
  28966. // ;
  28967. //
  28968. // At each rule invocation, the set of tokens that could follow
  28969. // that rule is pushed on a stack. Here are the various
  28970. // context-sensitive follow sets:
  28971. //
  28972. // FOLLOW(b1_in_a) = FIRST(']') = ']'
  28973. // FOLLOW(b2_in_a) = FIRST(')') = ')'
  28974. // FOLLOW(c_in_b) = FIRST('^') = '^'
  28975. //
  28976. // Upon erroneous input "[]", the call chain is
  28977. //
  28978. // a -> b -> c
  28979. //
  28980. // and, hence, the follow context stack is:
  28981. //
  28982. // depth follow set start of rule execution
  28983. // 0 <EOF> a (from main())
  28984. // 1 ']' b
  28985. // 2 '^' c
  28986. //
  28987. // Notice that ')' is not included, because b would have to have
  28988. // been called from a different context in rule a for ')' to be
  28989. // included.
  28990. //
  28991. // For error recovery, we cannot consider FOLLOW(c)
  28992. // (context-sensitive or otherwise). We need the combined set of
  28993. // all context-sensitive FOLLOW sets--the set of all tokens that
  28994. // could follow any reference in the call chain. We need to
  28995. // resync to one of those tokens. Note that FOLLOW(c)='^' and if
  28996. // we resync'd to that token, we'd consume until EOF. We need to
  28997. // sync to context-sensitive FOLLOWs for a, b, and c: {']','^'}.
  28998. // In this case, for input "[]", LA(1) is ']' and in the set, so we would
  28999. // not consume anything. After printing an error, rule c would
  29000. // return normally. Rule b would not find the required '^' though.
  29001. // At this point, it gets a mismatched token error and throws an
  29002. // exception (since LA(1) is not in the viable following token
  29003. // set). The rule exception handler tries to recover, but finds
  29004. // the same recovery set and doesn't consume anything. Rule b
  29005. // exits normally returning to rule a. Now it finds the ']' (and
  29006. // with the successful match exits errorRecovery mode).
  29007. //
  29008. // So, you can see that the parser walks up the call chain looking
  29009. // for the token that was a member of the recovery set.
  29010. //
  29011. // Errors are not generated in errorRecovery mode.
  29012. //
  29013. // ANTLR's error recovery mechanism is based upon original ideas:
  29014. //
  29015. // "Algorithms + Data Structures = Programs" by Niklaus Wirth
  29016. //
  29017. // and
  29018. //
  29019. // "A note on error recovery in recursive descent parsers":
  29020. // http://portal.acm.org/citation.cfm?id=947902.947905
  29021. //
  29022. // Later, Josef Grosch had some good ideas:
  29023. //
  29024. // "Efficient and Comfortable Error Recovery in Recursive Descent
  29025. // Parsers":
  29026. // ftp://www.cocolab.com/products/cocktail/doca4.ps/ell.ps.zip
  29027. //
  29028. // Like Grosch I implement context-sensitive FOLLOW sets that are combined
  29029. // at run-time upon error to avoid overhead during parsing.
  29030. //
  29031. DefaultErrorStrategy.prototype.getErrorRecoverySet = function (recognizer) {
  29032. var atn = recognizer._interp.atn;
  29033. var ctx = recognizer._ctx;
  29034. var recoverSet = new IntervalSet();
  29035. while (ctx !== null && ctx.invokingState >= 0) {
  29036. // compute what follows who invoked us
  29037. var invokingState = atn.states[ctx.invokingState];
  29038. var rt = invokingState.transitions[0];
  29039. var follow = atn.nextTokens(rt.followState);
  29040. recoverSet.addSet(follow);
  29041. ctx = ctx.parentCtx;
  29042. }
  29043. recoverSet.removeOne(Token.EPSILON);
  29044. return recoverSet;
  29045. };
  29046. // Consume tokens until one matches the given token set.//
  29047. DefaultErrorStrategy.prototype.consumeUntil = function (recognizer, set) {
  29048. var ttype = recognizer.getTokenStream().LA(1);
  29049. while (ttype !== Token.EOF && !set.contains(ttype)) {
  29050. recognizer.consume();
  29051. ttype = recognizer.getTokenStream().LA(1);
  29052. }
  29053. };
  29054. //
  29055. // This implementation of {@link ANTLRErrorStrategy} responds to syntax errors
  29056. // by immediately canceling the parse operation with a
  29057. // {@link ParseCancellationException}. The implementation ensures that the
  29058. // {@link ParserRuleContext//exception} field is set for all parse tree nodes
  29059. // that were not completed prior to encountering the error.
  29060. //
  29061. // <p>
  29062. // This error strategy is useful in the following scenarios.</p>
  29063. //
  29064. // <ul>
  29065. // <li><strong>Two-stage parsing:</strong> This error strategy allows the first
  29066. // stage of two-stage parsing to immediately terminate if an error is
  29067. // encountered, and immediately fall back to the second stage. In addition to
  29068. // avoiding wasted work by attempting to recover from errors here, the empty
  29069. // implementation of {@link BailErrorStrategy//sync} improves the performance of
  29070. // the first stage.</li>
  29071. // <li><strong>Silent validation:</strong> When syntax errors are not being
  29072. // reported or logged, and the parse result is simply ignored if errors occur,
  29073. // the {@link BailErrorStrategy} avoids wasting work on recovering from errors
  29074. // when the result will be ignored either way.</li>
  29075. // </ul>
  29076. //
  29077. // <p>
  29078. // {@code myparser.setErrorHandler(new BailErrorStrategy());}</p>
  29079. //
  29080. // @see Parser//setErrorHandler(ANTLRErrorStrategy)
  29081. //
  29082. function BailErrorStrategy() {
  29083. DefaultErrorStrategy.call(this);
  29084. return this;
  29085. }
  29086. BailErrorStrategy.prototype = Object.create(DefaultErrorStrategy.prototype);
  29087. BailErrorStrategy.prototype.constructor = BailErrorStrategy;
  29088. // Instead of recovering from exception {@code e}, re-throw it wrapped
  29089. // in a {@link ParseCancellationException} so it is not caught by the
  29090. // rule function catches. Use {@link Exception//getCause()} to get the
  29091. // original {@link RecognitionException}.
  29092. //
  29093. BailErrorStrategy.prototype.recover = function (recognizer, e) {
  29094. var context = recognizer._ctx;
  29095. while (context !== null) {
  29096. context.exception = e;
  29097. context = context.parentCtx;
  29098. }
  29099. throw new ParseCancellationException(e);
  29100. };
  29101. // Make sure we don't attempt to recover inline; if the parser
  29102. // successfully recovers, it won't throw an exception.
  29103. //
  29104. BailErrorStrategy.prototype.recoverInline = function (recognizer) {
  29105. this.recover(recognizer, new InputMismatchException(recognizer));
  29106. };
  29107. // Make sure we don't attempt to recover from problems in subrules.//
  29108. BailErrorStrategy.prototype.sync = function (recognizer) {
  29109. // pass
  29110. };
  29111. exports.BailErrorStrategy = BailErrorStrategy;
  29112. exports.DefaultErrorStrategy = DefaultErrorStrategy;
  29113. /***/ }),
  29114. /***/ "./node_modules/antlr4/error/Errors.js":
  29115. /*!*********************************************!*\
  29116. !*** ./node_modules/antlr4/error/Errors.js ***!
  29117. \*********************************************/
  29118. /*! no static exports found */
  29119. /***/ (function(module, exports, __webpack_require__) {
  29120. "use strict";
  29121. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29122. * Use of this file is governed by the BSD 3-clause license that
  29123. * can be found in the LICENSE.txt file in the project root.
  29124. */
  29125. // The root of the ANTLR exception hierarchy. In general, ANTLR tracks just
  29126. // 3 kinds of errors: prediction errors, failed predicate errors, and
  29127. // mismatched input errors. In each case, the parser knows where it is
  29128. // in the input, where it is in the ATN, the rule invocation stack,
  29129. // and what kind of problem occurred.
  29130. var PredicateTransition = __webpack_require__(/*! ./../atn/Transition */ "./node_modules/antlr4/atn/Transition.js").PredicateTransition;
  29131. function RecognitionException(params) {
  29132. Error.call(this);
  29133. if (!!Error.captureStackTrace) {
  29134. Error.captureStackTrace(this, RecognitionException);
  29135. } else {
  29136. var stack = new Error().stack;
  29137. }
  29138. this.message = params.message;
  29139. this.recognizer = params.recognizer;
  29140. this.input = params.input;
  29141. this.ctx = params.ctx;
  29142. // The current {@link Token} when an error occurred. Since not all streams
  29143. // support accessing symbols by index, we have to track the {@link Token}
  29144. // instance itself.
  29145. this.offendingToken = null;
  29146. // Get the ATN state number the parser was in at the time the error
  29147. // occurred. For {@link NoViableAltException} and
  29148. // {@link LexerNoViableAltException} exceptions, this is the
  29149. // {@link DecisionState} number. For others, it is the state whose outgoing
  29150. // edge we couldn't match.
  29151. this.offendingState = -1;
  29152. if (this.recognizer !== null) {
  29153. this.offendingState = this.recognizer.state;
  29154. }
  29155. return this;
  29156. }
  29157. RecognitionException.prototype = Object.create(Error.prototype);
  29158. RecognitionException.prototype.constructor = RecognitionException;
  29159. // <p>If the state number is not known, this method returns -1.</p>
  29160. //
  29161. // Gets the set of input symbols which could potentially follow the
  29162. // previously matched symbol at the time this exception was thrown.
  29163. //
  29164. // <p>If the set of expected tokens is not known and could not be computed,
  29165. // this method returns {@code null}.</p>
  29166. //
  29167. // @return The set of token types that could potentially follow the current
  29168. // state in the ATN, or {@code null} if the information is not available.
  29169. // /
  29170. RecognitionException.prototype.getExpectedTokens = function () {
  29171. if (this.recognizer !== null) {
  29172. return this.recognizer.atn.getExpectedTokens(this.offendingState, this.ctx);
  29173. } else {
  29174. return null;
  29175. }
  29176. };
  29177. RecognitionException.prototype.toString = function () {
  29178. return this.message;
  29179. };
  29180. function LexerNoViableAltException(lexer, input, startIndex, deadEndConfigs) {
  29181. RecognitionException.call(this, { message: "", recognizer: lexer, input: input, ctx: null });
  29182. this.startIndex = startIndex;
  29183. this.deadEndConfigs = deadEndConfigs;
  29184. return this;
  29185. }
  29186. LexerNoViableAltException.prototype = Object.create(RecognitionException.prototype);
  29187. LexerNoViableAltException.prototype.constructor = LexerNoViableAltException;
  29188. LexerNoViableAltException.prototype.toString = function () {
  29189. var symbol = "";
  29190. if (this.startIndex >= 0 && this.startIndex < this.input.size) {
  29191. symbol = this.input.getText((this.startIndex, this.startIndex));
  29192. }
  29193. return "LexerNoViableAltException" + symbol;
  29194. };
  29195. // Indicates that the parser could not decide which of two or more paths
  29196. // to take based upon the remaining input. It tracks the starting token
  29197. // of the offending input and also knows where the parser was
  29198. // in the various paths when the error. Reported by reportNoViableAlternative()
  29199. //
  29200. function NoViableAltException(recognizer, input, startToken, offendingToken, deadEndConfigs, ctx) {
  29201. ctx = ctx || recognizer._ctx;
  29202. offendingToken = offendingToken || recognizer.getCurrentToken();
  29203. startToken = startToken || recognizer.getCurrentToken();
  29204. input = input || recognizer.getInputStream();
  29205. RecognitionException.call(this, { message: "", recognizer: recognizer, input: input, ctx: ctx });
  29206. // Which configurations did we try at input.index() that couldn't match
  29207. // input.LT(1)?//
  29208. this.deadEndConfigs = deadEndConfigs;
  29209. // The token object at the start index; the input stream might
  29210. // not be buffering tokens so get a reference to it. (At the
  29211. // time the error occurred, of course the stream needs to keep a
  29212. // buffer all of the tokens but later we might not have access to those.)
  29213. this.startToken = startToken;
  29214. this.offendingToken = offendingToken;
  29215. }
  29216. NoViableAltException.prototype = Object.create(RecognitionException.prototype);
  29217. NoViableAltException.prototype.constructor = NoViableAltException;
  29218. // This signifies any kind of mismatched input exceptions such as
  29219. // when the current input does not match the expected token.
  29220. //
  29221. function InputMismatchException(recognizer) {
  29222. RecognitionException.call(this, { message: "", recognizer: recognizer, input: recognizer.getInputStream(), ctx: recognizer._ctx });
  29223. this.offendingToken = recognizer.getCurrentToken();
  29224. }
  29225. InputMismatchException.prototype = Object.create(RecognitionException.prototype);
  29226. InputMismatchException.prototype.constructor = InputMismatchException;
  29227. // A semantic predicate failed during validation. Validation of predicates
  29228. // occurs when normally parsing the alternative just like matching a token.
  29229. // Disambiguating predicate evaluation occurs when we test a predicate during
  29230. // prediction.
  29231. function FailedPredicateException(recognizer, predicate, message) {
  29232. RecognitionException.call(this, { message: this.formatMessage(predicate, message || null), recognizer: recognizer,
  29233. input: recognizer.getInputStream(), ctx: recognizer._ctx });
  29234. var s = recognizer._interp.atn.states[recognizer.state];
  29235. var trans = s.transitions[0];
  29236. if (trans instanceof PredicateTransition) {
  29237. this.ruleIndex = trans.ruleIndex;
  29238. this.predicateIndex = trans.predIndex;
  29239. } else {
  29240. this.ruleIndex = 0;
  29241. this.predicateIndex = 0;
  29242. }
  29243. this.predicate = predicate;
  29244. this.offendingToken = recognizer.getCurrentToken();
  29245. return this;
  29246. }
  29247. FailedPredicateException.prototype = Object.create(RecognitionException.prototype);
  29248. FailedPredicateException.prototype.constructor = FailedPredicateException;
  29249. FailedPredicateException.prototype.formatMessage = function (predicate, message) {
  29250. if (message !== null) {
  29251. return message;
  29252. } else {
  29253. return "failed predicate: {" + predicate + "}?";
  29254. }
  29255. };
  29256. function ParseCancellationException() {
  29257. Error.call(this);
  29258. Error.captureStackTrace(this, ParseCancellationException);
  29259. return this;
  29260. }
  29261. ParseCancellationException.prototype = Object.create(Error.prototype);
  29262. ParseCancellationException.prototype.constructor = ParseCancellationException;
  29263. exports.RecognitionException = RecognitionException;
  29264. exports.NoViableAltException = NoViableAltException;
  29265. exports.LexerNoViableAltException = LexerNoViableAltException;
  29266. exports.InputMismatchException = InputMismatchException;
  29267. exports.FailedPredicateException = FailedPredicateException;
  29268. exports.ParseCancellationException = ParseCancellationException;
  29269. /***/ }),
  29270. /***/ "./node_modules/antlr4/error/index.js":
  29271. /*!********************************************!*\
  29272. !*** ./node_modules/antlr4/error/index.js ***!
  29273. \********************************************/
  29274. /*! no static exports found */
  29275. /***/ (function(module, exports, __webpack_require__) {
  29276. "use strict";
  29277. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29278. * Use of this file is governed by the BSD 3-clause license that
  29279. * can be found in the LICENSE.txt file in the project root.
  29280. */
  29281. exports.RecognitionException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  29282. exports.NoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  29283. exports.LexerNoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  29284. exports.InputMismatchException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").InputMismatchException;
  29285. exports.FailedPredicateException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").FailedPredicateException;
  29286. exports.DiagnosticErrorListener = __webpack_require__(/*! ./DiagnosticErrorListener */ "./node_modules/antlr4/error/DiagnosticErrorListener.js").DiagnosticErrorListener;
  29287. exports.BailErrorStrategy = __webpack_require__(/*! ./ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").BailErrorStrategy;
  29288. exports.ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  29289. /***/ }),
  29290. /***/ "./node_modules/antlr4/index.js":
  29291. /*!**************************************!*\
  29292. !*** ./node_modules/antlr4/index.js ***!
  29293. \**************************************/
  29294. /*! no static exports found */
  29295. /***/ (function(module, exports, __webpack_require__) {
  29296. "use strict";
  29297. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29298. * Use of this file is governed by the BSD 3-clause license that
  29299. * can be found in the LICENSE.txt file in the project root.
  29300. */
  29301. exports.atn = __webpack_require__(/*! ./atn/index */ "./node_modules/antlr4/atn/index.js");
  29302. exports.codepointat = __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  29303. exports.dfa = __webpack_require__(/*! ./dfa/index */ "./node_modules/antlr4/dfa/index.js");
  29304. exports.fromcodepoint = __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  29305. exports.tree = __webpack_require__(/*! ./tree/index */ "./node_modules/antlr4/tree/index.js");
  29306. exports.error = __webpack_require__(/*! ./error/index */ "./node_modules/antlr4/error/index.js");
  29307. exports.Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  29308. exports.CharStreams = __webpack_require__(/*! ./CharStreams */ "./node_modules/antlr4/CharStreams.js").CharStreams;
  29309. exports.CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  29310. exports.InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  29311. exports.FileStream = __webpack_require__(/*! ./FileStream */ "./node_modules/antlr4/FileStream.js").FileStream;
  29312. exports.CommonTokenStream = __webpack_require__(/*! ./CommonTokenStream */ "./node_modules/antlr4/CommonTokenStream.js").CommonTokenStream;
  29313. exports.Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  29314. exports.Parser = __webpack_require__(/*! ./Parser */ "./node_modules/antlr4/Parser.js").Parser;
  29315. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  29316. exports.PredictionContextCache = pc.PredictionContextCache;
  29317. exports.ParserRuleContext = __webpack_require__(/*! ./ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  29318. exports.Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  29319. exports.Utils = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js");
  29320. /***/ }),
  29321. /***/ "./node_modules/antlr4/polyfills/codepointat.js":
  29322. /*!******************************************************!*\
  29323. !*** ./node_modules/antlr4/polyfills/codepointat.js ***!
  29324. \******************************************************/
  29325. /*! no static exports found */
  29326. /***/ (function(module, exports, __webpack_require__) {
  29327. "use strict";
  29328. /*! https://mths.be/codepointat v0.2.0 by @mathias */
  29329. if (!String.prototype.codePointAt) {
  29330. (function () {
  29331. 'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
  29332. var defineProperty = function () {
  29333. // IE 8 only supports `Object.defineProperty` on DOM elements
  29334. try {
  29335. var object = {};
  29336. var $defineProperty = Object.defineProperty;
  29337. var result = $defineProperty(object, object, object) && $defineProperty;
  29338. } catch (error) {}
  29339. return result;
  29340. }();
  29341. var codePointAt = function codePointAt(position) {
  29342. if (this == null) {
  29343. throw TypeError();
  29344. }
  29345. var string = String(this);
  29346. var size = string.length;
  29347. // `ToInteger`
  29348. var index = position ? Number(position) : 0;
  29349. if (index != index) {
  29350. // better `isNaN`
  29351. index = 0;
  29352. }
  29353. // Account for out-of-bounds indices:
  29354. if (index < 0 || index >= size) {
  29355. return undefined;
  29356. }
  29357. // Get the first code unit
  29358. var first = string.charCodeAt(index);
  29359. var second;
  29360. if ( // check if it’s the start of a surrogate pair
  29361. first >= 0xD800 && first <= 0xDBFF && // high surrogate
  29362. size > index + 1 // there is a next code unit
  29363. ) {
  29364. second = string.charCodeAt(index + 1);
  29365. if (second >= 0xDC00 && second <= 0xDFFF) {
  29366. // low surrogate
  29367. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  29368. return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
  29369. }
  29370. }
  29371. return first;
  29372. };
  29373. if (defineProperty) {
  29374. defineProperty(String.prototype, 'codePointAt', {
  29375. 'value': codePointAt,
  29376. 'configurable': true,
  29377. 'writable': true
  29378. });
  29379. } else {
  29380. String.prototype.codePointAt = codePointAt;
  29381. }
  29382. })();
  29383. }
  29384. /***/ }),
  29385. /***/ "./node_modules/antlr4/polyfills/fromcodepoint.js":
  29386. /*!********************************************************!*\
  29387. !*** ./node_modules/antlr4/polyfills/fromcodepoint.js ***!
  29388. \********************************************************/
  29389. /*! no static exports found */
  29390. /***/ (function(module, exports, __webpack_require__) {
  29391. "use strict";
  29392. /*! https://mths.be/fromcodepoint v0.2.1 by @mathias */
  29393. if (!String.fromCodePoint) {
  29394. (function () {
  29395. var defineProperty = function () {
  29396. // IE 8 only supports `Object.defineProperty` on DOM elements
  29397. try {
  29398. var object = {};
  29399. var $defineProperty = Object.defineProperty;
  29400. var result = $defineProperty(object, object, object) && $defineProperty;
  29401. } catch (error) {}
  29402. return result;
  29403. }();
  29404. var stringFromCharCode = String.fromCharCode;
  29405. var floor = Math.floor;
  29406. var fromCodePoint = function fromCodePoint(_) {
  29407. var MAX_SIZE = 0x4000;
  29408. var codeUnits = [];
  29409. var highSurrogate;
  29410. var lowSurrogate;
  29411. var index = -1;
  29412. var length = arguments.length;
  29413. if (!length) {
  29414. return '';
  29415. }
  29416. var result = '';
  29417. while (++index < length) {
  29418. var codePoint = Number(arguments[index]);
  29419. if (!isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`
  29420. codePoint < 0 || // not a valid Unicode code point
  29421. codePoint > 0x10FFFF || // not a valid Unicode code point
  29422. floor(codePoint) != codePoint // not an integer
  29423. ) {
  29424. throw RangeError('Invalid code point: ' + codePoint);
  29425. }
  29426. if (codePoint <= 0xFFFF) {
  29427. // BMP code point
  29428. codeUnits.push(codePoint);
  29429. } else {
  29430. // Astral code point; split in surrogate halves
  29431. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  29432. codePoint -= 0x10000;
  29433. highSurrogate = (codePoint >> 10) + 0xD800;
  29434. lowSurrogate = codePoint % 0x400 + 0xDC00;
  29435. codeUnits.push(highSurrogate, lowSurrogate);
  29436. }
  29437. if (index + 1 == length || codeUnits.length > MAX_SIZE) {
  29438. result += stringFromCharCode.apply(null, codeUnits);
  29439. codeUnits.length = 0;
  29440. }
  29441. }
  29442. return result;
  29443. };
  29444. if (defineProperty) {
  29445. defineProperty(String, 'fromCodePoint', {
  29446. 'value': fromCodePoint,
  29447. 'configurable': true,
  29448. 'writable': true
  29449. });
  29450. } else {
  29451. String.fromCodePoint = fromCodePoint;
  29452. }
  29453. })();
  29454. }
  29455. /***/ }),
  29456. /***/ "./node_modules/antlr4/tree/Tree.js":
  29457. /*!******************************************!*\
  29458. !*** ./node_modules/antlr4/tree/Tree.js ***!
  29459. \******************************************/
  29460. /*! no static exports found */
  29461. /***/ (function(module, exports, __webpack_require__) {
  29462. "use strict";
  29463. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29464. * Use of this file is governed by the BSD 3-clause license that
  29465. * can be found in the LICENSE.txt file in the project root.
  29466. */
  29467. ///
  29468. // The basic notion of a tree has a parent, a payload, and a list of children.
  29469. // It is the most abstract interface for all the trees used by ANTLR.
  29470. ///
  29471. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  29472. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  29473. var INVALID_INTERVAL = new Interval(-1, -2);
  29474. var Utils = __webpack_require__(/*! ../Utils.js */ "./node_modules/antlr4/Utils.js");
  29475. function Tree() {
  29476. return this;
  29477. }
  29478. function SyntaxTree() {
  29479. Tree.call(this);
  29480. return this;
  29481. }
  29482. SyntaxTree.prototype = Object.create(Tree.prototype);
  29483. SyntaxTree.prototype.constructor = SyntaxTree;
  29484. function ParseTree() {
  29485. SyntaxTree.call(this);
  29486. return this;
  29487. }
  29488. ParseTree.prototype = Object.create(SyntaxTree.prototype);
  29489. ParseTree.prototype.constructor = ParseTree;
  29490. function RuleNode() {
  29491. ParseTree.call(this);
  29492. return this;
  29493. }
  29494. RuleNode.prototype = Object.create(ParseTree.prototype);
  29495. RuleNode.prototype.constructor = RuleNode;
  29496. function TerminalNode() {
  29497. ParseTree.call(this);
  29498. return this;
  29499. }
  29500. TerminalNode.prototype = Object.create(ParseTree.prototype);
  29501. TerminalNode.prototype.constructor = TerminalNode;
  29502. function ErrorNode() {
  29503. TerminalNode.call(this);
  29504. return this;
  29505. }
  29506. ErrorNode.prototype = Object.create(TerminalNode.prototype);
  29507. ErrorNode.prototype.constructor = ErrorNode;
  29508. function ParseTreeVisitor() {
  29509. return this;
  29510. }
  29511. ParseTreeVisitor.prototype.visit = function (ctx) {
  29512. if (Array.isArray(ctx)) {
  29513. return ctx.map(function (child) {
  29514. return child.accept(this);
  29515. }, this);
  29516. } else {
  29517. return ctx.accept(this);
  29518. }
  29519. };
  29520. ParseTreeVisitor.prototype.visitChildren = function (ctx) {
  29521. return this.visit(ctx.children);
  29522. };
  29523. ParseTreeVisitor.prototype.visitTerminal = function (node) {};
  29524. ParseTreeVisitor.prototype.visitErrorNode = function (node) {};
  29525. function ParseTreeListener() {
  29526. return this;
  29527. }
  29528. ParseTreeListener.prototype.visitTerminal = function (node) {};
  29529. ParseTreeListener.prototype.visitErrorNode = function (node) {};
  29530. ParseTreeListener.prototype.enterEveryRule = function (node) {};
  29531. ParseTreeListener.prototype.exitEveryRule = function (node) {};
  29532. function TerminalNodeImpl(symbol) {
  29533. TerminalNode.call(this);
  29534. this.parentCtx = null;
  29535. this.symbol = symbol;
  29536. return this;
  29537. }
  29538. TerminalNodeImpl.prototype = Object.create(TerminalNode.prototype);
  29539. TerminalNodeImpl.prototype.constructor = TerminalNodeImpl;
  29540. TerminalNodeImpl.prototype.getChild = function (i) {
  29541. return null;
  29542. };
  29543. TerminalNodeImpl.prototype.getSymbol = function () {
  29544. return this.symbol;
  29545. };
  29546. TerminalNodeImpl.prototype.getParent = function () {
  29547. return this.parentCtx;
  29548. };
  29549. TerminalNodeImpl.prototype.getPayload = function () {
  29550. return this.symbol;
  29551. };
  29552. TerminalNodeImpl.prototype.getSourceInterval = function () {
  29553. if (this.symbol === null) {
  29554. return INVALID_INTERVAL;
  29555. }
  29556. var tokenIndex = this.symbol.tokenIndex;
  29557. return new Interval(tokenIndex, tokenIndex);
  29558. };
  29559. TerminalNodeImpl.prototype.getChildCount = function () {
  29560. return 0;
  29561. };
  29562. TerminalNodeImpl.prototype.accept = function (visitor) {
  29563. return visitor.visitTerminal(this);
  29564. };
  29565. TerminalNodeImpl.prototype.getText = function () {
  29566. return this.symbol.text;
  29567. };
  29568. TerminalNodeImpl.prototype.toString = function () {
  29569. if (this.symbol.type === Token.EOF) {
  29570. return "<EOF>";
  29571. } else {
  29572. return this.symbol.text;
  29573. }
  29574. };
  29575. // Represents a token that was consumed during resynchronization
  29576. // rather than during a valid match operation. For example,
  29577. // we will create this kind of a node during single token insertion
  29578. // and deletion as well as during "consume until error recovery set"
  29579. // upon no viable alternative exceptions.
  29580. function ErrorNodeImpl(token) {
  29581. TerminalNodeImpl.call(this, token);
  29582. return this;
  29583. }
  29584. ErrorNodeImpl.prototype = Object.create(TerminalNodeImpl.prototype);
  29585. ErrorNodeImpl.prototype.constructor = ErrorNodeImpl;
  29586. ErrorNodeImpl.prototype.isErrorNode = function () {
  29587. return true;
  29588. };
  29589. ErrorNodeImpl.prototype.accept = function (visitor) {
  29590. return visitor.visitErrorNode(this);
  29591. };
  29592. function ParseTreeWalker() {
  29593. return this;
  29594. }
  29595. ParseTreeWalker.prototype.walk = function (listener, t) {
  29596. var errorNode = t instanceof ErrorNode || t.isErrorNode !== undefined && t.isErrorNode();
  29597. if (errorNode) {
  29598. listener.visitErrorNode(t);
  29599. } else if (t instanceof TerminalNode) {
  29600. listener.visitTerminal(t);
  29601. } else {
  29602. this.enterRule(listener, t);
  29603. for (var i = 0; i < t.getChildCount(); i++) {
  29604. var child = t.getChild(i);
  29605. this.walk(listener, child);
  29606. }
  29607. this.exitRule(listener, t);
  29608. }
  29609. };
  29610. //
  29611. // The discovery of a rule node, involves sending two events: the generic
  29612. // {@link ParseTreeListener//enterEveryRule} and a
  29613. // {@link RuleContext}-specific event. First we trigger the generic and then
  29614. // the rule specific. We to them in reverse order upon finishing the node.
  29615. //
  29616. ParseTreeWalker.prototype.enterRule = function (listener, r) {
  29617. var ctx = r.getRuleContext();
  29618. listener.enterEveryRule(ctx);
  29619. ctx.enterRule(listener);
  29620. };
  29621. ParseTreeWalker.prototype.exitRule = function (listener, r) {
  29622. var ctx = r.getRuleContext();
  29623. ctx.exitRule(listener);
  29624. listener.exitEveryRule(ctx);
  29625. };
  29626. ParseTreeWalker.DEFAULT = new ParseTreeWalker();
  29627. exports.RuleNode = RuleNode;
  29628. exports.ErrorNode = ErrorNode;
  29629. exports.TerminalNode = TerminalNode;
  29630. exports.ErrorNodeImpl = ErrorNodeImpl;
  29631. exports.TerminalNodeImpl = TerminalNodeImpl;
  29632. exports.ParseTreeListener = ParseTreeListener;
  29633. exports.ParseTreeVisitor = ParseTreeVisitor;
  29634. exports.ParseTreeWalker = ParseTreeWalker;
  29635. exports.INVALID_INTERVAL = INVALID_INTERVAL;
  29636. /***/ }),
  29637. /***/ "./node_modules/antlr4/tree/Trees.js":
  29638. /*!*******************************************!*\
  29639. !*** ./node_modules/antlr4/tree/Trees.js ***!
  29640. \*******************************************/
  29641. /*! no static exports found */
  29642. /***/ (function(module, exports, __webpack_require__) {
  29643. "use strict";
  29644. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29645. * Use of this file is governed by the BSD 3-clause license that
  29646. * can be found in the LICENSE.txt file in the project root.
  29647. */
  29648. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  29649. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  29650. var RuleNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  29651. var ErrorNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  29652. var TerminalNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  29653. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  29654. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  29655. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./../atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  29656. /** A set of utility routines useful for all kinds of ANTLR trees. */
  29657. function Trees() {}
  29658. // Print out a whole tree in LISP form. {@link //getNodeText} is used on the
  29659. // node payloads to get the text for the nodes. Detect
  29660. // parse trees and extract data appropriately.
  29661. Trees.toStringTree = function (tree, ruleNames, recog) {
  29662. ruleNames = ruleNames || null;
  29663. recog = recog || null;
  29664. if (recog !== null) {
  29665. ruleNames = recog.ruleNames;
  29666. }
  29667. var s = Trees.getNodeText(tree, ruleNames);
  29668. s = Utils.escapeWhitespace(s, false);
  29669. var c = tree.getChildCount();
  29670. if (c === 0) {
  29671. return s;
  29672. }
  29673. var res = "(" + s + ' ';
  29674. if (c > 0) {
  29675. s = Trees.toStringTree(tree.getChild(0), ruleNames);
  29676. res = res.concat(s);
  29677. }
  29678. for (var i = 1; i < c; i++) {
  29679. s = Trees.toStringTree(tree.getChild(i), ruleNames);
  29680. res = res.concat(' ' + s);
  29681. }
  29682. res = res.concat(")");
  29683. return res;
  29684. };
  29685. Trees.getNodeText = function (t, ruleNames, recog) {
  29686. ruleNames = ruleNames || null;
  29687. recog = recog || null;
  29688. if (recog !== null) {
  29689. ruleNames = recog.ruleNames;
  29690. }
  29691. if (ruleNames !== null) {
  29692. if (t instanceof RuleContext) {
  29693. var altNumber = t.getAltNumber();
  29694. if (altNumber != INVALID_ALT_NUMBER) {
  29695. return ruleNames[t.ruleIndex] + ":" + altNumber;
  29696. }
  29697. return ruleNames[t.ruleIndex];
  29698. } else if (t instanceof ErrorNode) {
  29699. return t.toString();
  29700. } else if (t instanceof TerminalNode) {
  29701. if (t.symbol !== null) {
  29702. return t.symbol.text;
  29703. }
  29704. }
  29705. }
  29706. // no recog for rule names
  29707. var payload = t.getPayload();
  29708. if (payload instanceof Token) {
  29709. return payload.text;
  29710. }
  29711. return t.getPayload().toString();
  29712. };
  29713. // Return ordered list of all children of this node
  29714. Trees.getChildren = function (t) {
  29715. var list = [];
  29716. for (var i = 0; i < t.getChildCount(); i++) {
  29717. list.push(t.getChild(i));
  29718. }
  29719. return list;
  29720. };
  29721. // Return a list of all ancestors of this node. The first node of
  29722. // list is the root and the last is the parent of this node.
  29723. //
  29724. Trees.getAncestors = function (t) {
  29725. var ancestors = [];
  29726. t = t.getParent();
  29727. while (t !== null) {
  29728. ancestors = [t].concat(ancestors);
  29729. t = t.getParent();
  29730. }
  29731. return ancestors;
  29732. };
  29733. Trees.findAllTokenNodes = function (t, ttype) {
  29734. return Trees.findAllNodes(t, ttype, true);
  29735. };
  29736. Trees.findAllRuleNodes = function (t, ruleIndex) {
  29737. return Trees.findAllNodes(t, ruleIndex, false);
  29738. };
  29739. Trees.findAllNodes = function (t, index, findTokens) {
  29740. var nodes = [];
  29741. Trees._findAllNodes(t, index, findTokens, nodes);
  29742. return nodes;
  29743. };
  29744. Trees._findAllNodes = function (t, index, findTokens, nodes) {
  29745. // check this node (the root) first
  29746. if (findTokens && t instanceof TerminalNode) {
  29747. if (t.symbol.type === index) {
  29748. nodes.push(t);
  29749. }
  29750. } else if (!findTokens && t instanceof ParserRuleContext) {
  29751. if (t.ruleIndex === index) {
  29752. nodes.push(t);
  29753. }
  29754. }
  29755. // check children
  29756. for (var i = 0; i < t.getChildCount(); i++) {
  29757. Trees._findAllNodes(t.getChild(i), index, findTokens, nodes);
  29758. }
  29759. };
  29760. Trees.descendants = function (t) {
  29761. var nodes = [t];
  29762. for (var i = 0; i < t.getChildCount(); i++) {
  29763. nodes = nodes.concat(Trees.descendants(t.getChild(i)));
  29764. }
  29765. return nodes;
  29766. };
  29767. exports.Trees = Trees;
  29768. /***/ }),
  29769. /***/ "./node_modules/antlr4/tree/index.js":
  29770. /*!*******************************************!*\
  29771. !*** ./node_modules/antlr4/tree/index.js ***!
  29772. \*******************************************/
  29773. /*! no static exports found */
  29774. /***/ (function(module, exports, __webpack_require__) {
  29775. "use strict";
  29776. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29777. * Use of this file is governed by the BSD 3-clause license that
  29778. * can be found in the LICENSE.txt file in the project root.
  29779. */
  29780. var Tree = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js");
  29781. exports.Trees = __webpack_require__(/*! ./Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  29782. exports.RuleNode = Tree.RuleNode;
  29783. exports.ParseTreeListener = Tree.ParseTreeListener;
  29784. exports.ParseTreeVisitor = Tree.ParseTreeVisitor;
  29785. exports.ParseTreeWalker = Tree.ParseTreeWalker;
  29786. /***/ }),
  29787. /***/ "./node_modules/decimal.js/decimal.js":
  29788. /*!********************************************!*\
  29789. !*** ./node_modules/decimal.js/decimal.js ***!
  29790. \********************************************/
  29791. /*! no static exports found */
  29792. /***/ (function(module, exports, __webpack_require__) {
  29793. "use strict";
  29794. var __WEBPACK_AMD_DEFINE_RESULT__;
  29795. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  29796. /*! decimal.js v10.0.1 https://github.com/MikeMcl/decimal.js/LICENCE */
  29797. ;(function (globalScope) {
  29798. 'use strict';
  29799. /*
  29800. * decimal.js v10.0.1
  29801. * An arbitrary-precision Decimal type for JavaScript.
  29802. * https://github.com/MikeMcl/decimal.js
  29803. * Copyright (c) 2017 Michael Mclaughlin <M8ch88l@gmail.com>
  29804. * MIT Licence
  29805. */
  29806. // ----------------------------------- EDITABLE DEFAULTS ------------------------------------ //
  29807. // The maximum exponent magnitude.
  29808. // The limit on the value of `toExpNeg`, `toExpPos`, `minE` and `maxE`.
  29809. var EXP_LIMIT = 9e15,
  29810. // 0 to 9e15
  29811. // The limit on the value of `precision`, and on the value of the first argument to
  29812. // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`.
  29813. MAX_DIGITS = 1e9,
  29814. // 0 to 1e9
  29815. // Base conversion alphabet.
  29816. NUMERALS = '0123456789abcdef',
  29817. // The natural logarithm of 10 (1025 digits).
  29818. LN10 = '2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058',
  29819. // Pi (1025 digits).
  29820. PI = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789',
  29821. // The initial configuration properties of the Decimal constructor.
  29822. DEFAULTS = {
  29823. // These values must be integers within the stated ranges (inclusive).
  29824. // Most of these values can be changed at run-time using the `Decimal.config` method.
  29825. // The maximum number of significant digits of the result of a calculation or base conversion.
  29826. // E.g. `Decimal.config({ precision: 20 });`
  29827. precision: 20, // 1 to MAX_DIGITS
  29828. // The rounding mode used when rounding to `precision`.
  29829. //
  29830. // ROUND_UP 0 Away from zero.
  29831. // ROUND_DOWN 1 Towards zero.
  29832. // ROUND_CEIL 2 Towards +Infinity.
  29833. // ROUND_FLOOR 3 Towards -Infinity.
  29834. // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.
  29835. // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
  29836. // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
  29837. // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
  29838. // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
  29839. //
  29840. // E.g.
  29841. // `Decimal.rounding = 4;`
  29842. // `Decimal.rounding = Decimal.ROUND_HALF_UP;`
  29843. rounding: 4, // 0 to 8
  29844. // The modulo mode used when calculating the modulus: a mod n.
  29845. // The quotient (q = a / n) is calculated according to the corresponding rounding mode.
  29846. // The remainder (r) is calculated as: r = a - n * q.
  29847. //
  29848. // UP 0 The remainder is positive if the dividend is negative, else is negative.
  29849. // DOWN 1 The remainder has the same sign as the dividend (JavaScript %).
  29850. // FLOOR 3 The remainder has the same sign as the divisor (Python %).
  29851. // HALF_EVEN 6 The IEEE 754 remainder function.
  29852. // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.
  29853. //
  29854. // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian
  29855. // division (9) are commonly used for the modulus operation. The other rounding modes can also
  29856. // be used, but they may not give useful results.
  29857. modulo: 1, // 0 to 9
  29858. // The exponent value at and beneath which `toString` returns exponential notation.
  29859. // JavaScript numbers: -7
  29860. toExpNeg: -7, // 0 to -EXP_LIMIT
  29861. // The exponent value at and above which `toString` returns exponential notation.
  29862. // JavaScript numbers: 21
  29863. toExpPos: 21, // 0 to EXP_LIMIT
  29864. // The minimum exponent value, beneath which underflow to zero occurs.
  29865. // JavaScript numbers: -324 (5e-324)
  29866. minE: -EXP_LIMIT, // -1 to -EXP_LIMIT
  29867. // The maximum exponent value, above which overflow to Infinity occurs.
  29868. // JavaScript numbers: 308 (1.7976931348623157e+308)
  29869. maxE: EXP_LIMIT, // 1 to EXP_LIMIT
  29870. // Whether to use cryptographically-secure random number generation, if available.
  29871. crypto: false // true/false
  29872. },
  29873. // ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- //
  29874. Decimal,
  29875. inexact,
  29876. noConflict,
  29877. quadrant,
  29878. external = true,
  29879. decimalError = '[DecimalError] ',
  29880. invalidArgument = decimalError + 'Invalid argument: ',
  29881. precisionLimitExceeded = decimalError + 'Precision limit exceeded',
  29882. cryptoUnavailable = decimalError + 'crypto unavailable',
  29883. mathfloor = Math.floor,
  29884. mathpow = Math.pow,
  29885. isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,
  29886. isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,
  29887. isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,
  29888. isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,
  29889. BASE = 1e7,
  29890. LOG_BASE = 7,
  29891. MAX_SAFE_INTEGER = 9007199254740991,
  29892. LN10_PRECISION = LN10.length - 1,
  29893. PI_PRECISION = PI.length - 1,
  29894. // Decimal.prototype object
  29895. P = { name: '[object Decimal]' };
  29896. // Decimal prototype methods
  29897. /*
  29898. * absoluteValue abs
  29899. * ceil
  29900. * comparedTo cmp
  29901. * cosine cos
  29902. * cubeRoot cbrt
  29903. * decimalPlaces dp
  29904. * dividedBy div
  29905. * dividedToIntegerBy divToInt
  29906. * equals eq
  29907. * floor
  29908. * greaterThan gt
  29909. * greaterThanOrEqualTo gte
  29910. * hyperbolicCosine cosh
  29911. * hyperbolicSine sinh
  29912. * hyperbolicTangent tanh
  29913. * inverseCosine acos
  29914. * inverseHyperbolicCosine acosh
  29915. * inverseHyperbolicSine asinh
  29916. * inverseHyperbolicTangent atanh
  29917. * inverseSine asin
  29918. * inverseTangent atan
  29919. * isFinite
  29920. * isInteger isInt
  29921. * isNaN
  29922. * isNegative isNeg
  29923. * isPositive isPos
  29924. * isZero
  29925. * lessThan lt
  29926. * lessThanOrEqualTo lte
  29927. * logarithm log
  29928. * [maximum] [max]
  29929. * [minimum] [min]
  29930. * minus sub
  29931. * modulo mod
  29932. * naturalExponential exp
  29933. * naturalLogarithm ln
  29934. * negated neg
  29935. * plus add
  29936. * precision sd
  29937. * round
  29938. * sine sin
  29939. * squareRoot sqrt
  29940. * tangent tan
  29941. * times mul
  29942. * toBinary
  29943. * toDecimalPlaces toDP
  29944. * toExponential
  29945. * toFixed
  29946. * toFraction
  29947. * toHexadecimal toHex
  29948. * toNearest
  29949. * toNumber
  29950. * toOctal
  29951. * toPower pow
  29952. * toPrecision
  29953. * toSignificantDigits toSD
  29954. * toString
  29955. * truncated trunc
  29956. * valueOf toJSON
  29957. */
  29958. /*
  29959. * Return a new Decimal whose value is the absolute value of this Decimal.
  29960. *
  29961. */
  29962. P.absoluteValue = P.abs = function () {
  29963. var x = new this.constructor(this);
  29964. if (x.s < 0) x.s = 1;
  29965. return finalise(x);
  29966. };
  29967. /*
  29968. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  29969. * direction of positive Infinity.
  29970. *
  29971. */
  29972. P.ceil = function () {
  29973. return finalise(new this.constructor(this), this.e + 1, 2);
  29974. };
  29975. /*
  29976. * Return
  29977. * 1 if the value of this Decimal is greater than the value of `y`,
  29978. * -1 if the value of this Decimal is less than the value of `y`,
  29979. * 0 if they have the same value,
  29980. * NaN if the value of either Decimal is NaN.
  29981. *
  29982. */
  29983. P.comparedTo = P.cmp = function (y) {
  29984. var i,
  29985. j,
  29986. xdL,
  29987. ydL,
  29988. x = this,
  29989. xd = x.d,
  29990. yd = (y = new x.constructor(y)).d,
  29991. xs = x.s,
  29992. ys = y.s;
  29993. // Either NaN or ±Infinity?
  29994. if (!xd || !yd) {
  29995. return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1;
  29996. }
  29997. // Either zero?
  29998. if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0;
  29999. // Signs differ?
  30000. if (xs !== ys) return xs;
  30001. // Compare exponents.
  30002. if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1;
  30003. xdL = xd.length;
  30004. ydL = yd.length;
  30005. // Compare digit by digit.
  30006. for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) {
  30007. if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1;
  30008. }
  30009. // Compare lengths.
  30010. return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1;
  30011. };
  30012. /*
  30013. * Return a new Decimal whose value is the cosine of the value in radians of this Decimal.
  30014. *
  30015. * Domain: [-Infinity, Infinity]
  30016. * Range: [-1, 1]
  30017. *
  30018. * cos(0) = 1
  30019. * cos(-0) = 1
  30020. * cos(Infinity) = NaN
  30021. * cos(-Infinity) = NaN
  30022. * cos(NaN) = NaN
  30023. *
  30024. */
  30025. P.cosine = P.cos = function () {
  30026. var pr,
  30027. rm,
  30028. x = this,
  30029. Ctor = x.constructor;
  30030. if (!x.d) return new Ctor(NaN);
  30031. // cos(0) = cos(-0) = 1
  30032. if (!x.d[0]) return new Ctor(1);
  30033. pr = Ctor.precision;
  30034. rm = Ctor.rounding;
  30035. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  30036. Ctor.rounding = 1;
  30037. x = cosine(Ctor, toLessThanHalfPi(Ctor, x));
  30038. Ctor.precision = pr;
  30039. Ctor.rounding = rm;
  30040. return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true);
  30041. };
  30042. /*
  30043. *
  30044. * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to
  30045. * `precision` significant digits using rounding mode `rounding`.
  30046. *
  30047. * cbrt(0) = 0
  30048. * cbrt(-0) = -0
  30049. * cbrt(1) = 1
  30050. * cbrt(-1) = -1
  30051. * cbrt(N) = N
  30052. * cbrt(-I) = -I
  30053. * cbrt(I) = I
  30054. *
  30055. * Math.cbrt(x) = (x < 0 ? -Math.pow(-x, 1/3) : Math.pow(x, 1/3))
  30056. *
  30057. */
  30058. P.cubeRoot = P.cbrt = function () {
  30059. var e,
  30060. m,
  30061. n,
  30062. r,
  30063. rep,
  30064. s,
  30065. sd,
  30066. t,
  30067. t3,
  30068. t3plusx,
  30069. x = this,
  30070. Ctor = x.constructor;
  30071. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  30072. external = false;
  30073. // Initial estimate.
  30074. s = x.s * Math.pow(x.s * x, 1 / 3);
  30075. // Math.cbrt underflow/overflow?
  30076. // Pass x to Math.pow as integer, then adjust the exponent of the result.
  30077. if (!s || Math.abs(s) == 1 / 0) {
  30078. n = digitsToString(x.d);
  30079. e = x.e;
  30080. // Adjust n exponent so it is a multiple of 3 away from x exponent.
  30081. if (s = (e - n.length + 1) % 3) n += s == 1 || s == -2 ? '0' : '00';
  30082. s = Math.pow(n, 1 / 3);
  30083. // Rarely, e may be one less than the result exponent value.
  30084. e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2));
  30085. if (s == 1 / 0) {
  30086. n = '5e' + e;
  30087. } else {
  30088. n = s.toExponential();
  30089. n = n.slice(0, n.indexOf('e') + 1) + e;
  30090. }
  30091. r = new Ctor(n);
  30092. r.s = x.s;
  30093. } else {
  30094. r = new Ctor(s.toString());
  30095. }
  30096. sd = (e = Ctor.precision) + 3;
  30097. // Halley's method.
  30098. // TODO? Compare Newton's method.
  30099. for (;;) {
  30100. t = r;
  30101. t3 = t.times(t).times(t);
  30102. t3plusx = t3.plus(x);
  30103. r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1);
  30104. // TODO? Replace with for-loop and checkRoundingDigits.
  30105. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  30106. n = n.slice(sd - 3, sd + 1);
  30107. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999
  30108. // , i.e. approaching a rounding boundary, continue the iteration.
  30109. if (n == '9999' || !rep && n == '4999') {
  30110. // On the first iteration only, check to see if rounding up gives the exact result as the
  30111. // nines may infinitely repeat.
  30112. if (!rep) {
  30113. finalise(t, e + 1, 0);
  30114. if (t.times(t).times(t).eq(x)) {
  30115. r = t;
  30116. break;
  30117. }
  30118. }
  30119. sd += 4;
  30120. rep = 1;
  30121. } else {
  30122. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  30123. // If not, then there are further digits and m will be truthy.
  30124. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  30125. // Truncate to the first rounding digit.
  30126. finalise(r, e + 1, 1);
  30127. m = !r.times(r).times(r).eq(x);
  30128. }
  30129. break;
  30130. }
  30131. }
  30132. }
  30133. external = true;
  30134. return finalise(r, e, Ctor.rounding, m);
  30135. };
  30136. /*
  30137. * Return the number of decimal places of the value of this Decimal.
  30138. *
  30139. */
  30140. P.decimalPlaces = P.dp = function () {
  30141. var w,
  30142. d = this.d,
  30143. n = NaN;
  30144. if (d) {
  30145. w = d.length - 1;
  30146. n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE;
  30147. // Subtract the number of trailing zeros of the last word.
  30148. w = d[w];
  30149. if (w) for (; w % 10 == 0; w /= 10) {
  30150. n--;
  30151. }if (n < 0) n = 0;
  30152. }
  30153. return n;
  30154. };
  30155. /*
  30156. * n / 0 = I
  30157. * n / N = N
  30158. * n / I = 0
  30159. * 0 / n = 0
  30160. * 0 / 0 = N
  30161. * 0 / N = N
  30162. * 0 / I = 0
  30163. * N / n = N
  30164. * N / 0 = N
  30165. * N / N = N
  30166. * N / I = N
  30167. * I / n = I
  30168. * I / 0 = I
  30169. * I / N = N
  30170. * I / I = N
  30171. *
  30172. * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to
  30173. * `precision` significant digits using rounding mode `rounding`.
  30174. *
  30175. */
  30176. P.dividedBy = P.div = function (y) {
  30177. return divide(this, new this.constructor(y));
  30178. };
  30179. /*
  30180. * Return a new Decimal whose value is the integer part of dividing the value of this Decimal
  30181. * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`.
  30182. *
  30183. */
  30184. P.dividedToIntegerBy = P.divToInt = function (y) {
  30185. var x = this,
  30186. Ctor = x.constructor;
  30187. return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding);
  30188. };
  30189. /*
  30190. * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.
  30191. *
  30192. */
  30193. P.equals = P.eq = function (y) {
  30194. return this.cmp(y) === 0;
  30195. };
  30196. /*
  30197. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  30198. * direction of negative Infinity.
  30199. *
  30200. */
  30201. P.floor = function () {
  30202. return finalise(new this.constructor(this), this.e + 1, 3);
  30203. };
  30204. /*
  30205. * Return true if the value of this Decimal is greater than the value of `y`, otherwise return
  30206. * false.
  30207. *
  30208. */
  30209. P.greaterThan = P.gt = function (y) {
  30210. return this.cmp(y) > 0;
  30211. };
  30212. /*
  30213. * Return true if the value of this Decimal is greater than or equal to the value of `y`,
  30214. * otherwise return false.
  30215. *
  30216. */
  30217. P.greaterThanOrEqualTo = P.gte = function (y) {
  30218. var k = this.cmp(y);
  30219. return k == 1 || k === 0;
  30220. };
  30221. /*
  30222. * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this
  30223. * Decimal.
  30224. *
  30225. * Domain: [-Infinity, Infinity]
  30226. * Range: [1, Infinity]
  30227. *
  30228. * cosh(x) = 1 + x^2/2! + x^4/4! + x^6/6! + ...
  30229. *
  30230. * cosh(0) = 1
  30231. * cosh(-0) = 1
  30232. * cosh(Infinity) = Infinity
  30233. * cosh(-Infinity) = Infinity
  30234. * cosh(NaN) = NaN
  30235. *
  30236. * x time taken (ms) result
  30237. * 1000 9 9.8503555700852349694e+433
  30238. * 10000 25 4.4034091128314607936e+4342
  30239. * 100000 171 1.4033316802130615897e+43429
  30240. * 1000000 3817 1.5166076984010437725e+434294
  30241. * 10000000 abandoned after 2 minute wait
  30242. *
  30243. * TODO? Compare performance of cosh(x) = 0.5 * (exp(x) + exp(-x))
  30244. *
  30245. */
  30246. P.hyperbolicCosine = P.cosh = function () {
  30247. var k,
  30248. n,
  30249. pr,
  30250. rm,
  30251. len,
  30252. x = this,
  30253. Ctor = x.constructor,
  30254. one = new Ctor(1);
  30255. if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN);
  30256. if (x.isZero()) return one;
  30257. pr = Ctor.precision;
  30258. rm = Ctor.rounding;
  30259. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  30260. Ctor.rounding = 1;
  30261. len = x.d.length;
  30262. // Argument reduction: cos(4x) = 1 - 8cos^2(x) + 8cos^4(x) + 1
  30263. // i.e. cos(x) = 1 - cos^2(x/4)(8 - 8cos^2(x/4))
  30264. // Estimate the optimum number of times to use the argument reduction.
  30265. // TODO? Estimation reused from cosine() and may not be optimal here.
  30266. if (len < 32) {
  30267. k = Math.ceil(len / 3);
  30268. n = Math.pow(4, -k).toString();
  30269. } else {
  30270. k = 16;
  30271. n = '2.3283064365386962890625e-10';
  30272. }
  30273. x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true);
  30274. // Reverse argument reduction
  30275. var cosh2_x,
  30276. i = k,
  30277. d8 = new Ctor(8);
  30278. for (; i--;) {
  30279. cosh2_x = x.times(x);
  30280. x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8))));
  30281. }
  30282. return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true);
  30283. };
  30284. /*
  30285. * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this
  30286. * Decimal.
  30287. *
  30288. * Domain: [-Infinity, Infinity]
  30289. * Range: [-Infinity, Infinity]
  30290. *
  30291. * sinh(x) = x + x^3/3! + x^5/5! + x^7/7! + ...
  30292. *
  30293. * sinh(0) = 0
  30294. * sinh(-0) = -0
  30295. * sinh(Infinity) = Infinity
  30296. * sinh(-Infinity) = -Infinity
  30297. * sinh(NaN) = NaN
  30298. *
  30299. * x time taken (ms)
  30300. * 10 2 ms
  30301. * 100 5 ms
  30302. * 1000 14 ms
  30303. * 10000 82 ms
  30304. * 100000 886 ms 1.4033316802130615897e+43429
  30305. * 200000 2613 ms
  30306. * 300000 5407 ms
  30307. * 400000 8824 ms
  30308. * 500000 13026 ms 8.7080643612718084129e+217146
  30309. * 1000000 48543 ms
  30310. *
  30311. * TODO? Compare performance of sinh(x) = 0.5 * (exp(x) - exp(-x))
  30312. *
  30313. */
  30314. P.hyperbolicSine = P.sinh = function () {
  30315. var k,
  30316. pr,
  30317. rm,
  30318. len,
  30319. x = this,
  30320. Ctor = x.constructor;
  30321. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  30322. pr = Ctor.precision;
  30323. rm = Ctor.rounding;
  30324. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  30325. Ctor.rounding = 1;
  30326. len = x.d.length;
  30327. if (len < 3) {
  30328. x = taylorSeries(Ctor, 2, x, x, true);
  30329. } else {
  30330. // Alternative argument reduction: sinh(3x) = sinh(x)(3 + 4sinh^2(x))
  30331. // i.e. sinh(x) = sinh(x/3)(3 + 4sinh^2(x/3))
  30332. // 3 multiplications and 1 addition
  30333. // Argument reduction: sinh(5x) = sinh(x)(5 + sinh^2(x)(20 + 16sinh^2(x)))
  30334. // i.e. sinh(x) = sinh(x/5)(5 + sinh^2(x/5)(20 + 16sinh^2(x/5)))
  30335. // 4 multiplications and 2 additions
  30336. // Estimate the optimum number of times to use the argument reduction.
  30337. k = 1.4 * Math.sqrt(len);
  30338. k = k > 16 ? 16 : k | 0;
  30339. x = x.times(Math.pow(5, -k));
  30340. x = taylorSeries(Ctor, 2, x, x, true);
  30341. // Reverse argument reduction
  30342. var sinh2_x,
  30343. d5 = new Ctor(5),
  30344. d16 = new Ctor(16),
  30345. d20 = new Ctor(20);
  30346. for (; k--;) {
  30347. sinh2_x = x.times(x);
  30348. x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20))));
  30349. }
  30350. }
  30351. Ctor.precision = pr;
  30352. Ctor.rounding = rm;
  30353. return finalise(x, pr, rm, true);
  30354. };
  30355. /*
  30356. * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this
  30357. * Decimal.
  30358. *
  30359. * Domain: [-Infinity, Infinity]
  30360. * Range: [-1, 1]
  30361. *
  30362. * tanh(x) = sinh(x) / cosh(x)
  30363. *
  30364. * tanh(0) = 0
  30365. * tanh(-0) = -0
  30366. * tanh(Infinity) = 1
  30367. * tanh(-Infinity) = -1
  30368. * tanh(NaN) = NaN
  30369. *
  30370. */
  30371. P.hyperbolicTangent = P.tanh = function () {
  30372. var pr,
  30373. rm,
  30374. x = this,
  30375. Ctor = x.constructor;
  30376. if (!x.isFinite()) return new Ctor(x.s);
  30377. if (x.isZero()) return new Ctor(x);
  30378. pr = Ctor.precision;
  30379. rm = Ctor.rounding;
  30380. Ctor.precision = pr + 7;
  30381. Ctor.rounding = 1;
  30382. return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
  30383. };
  30384. /*
  30385. * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of
  30386. * this Decimal.
  30387. *
  30388. * Domain: [-1, 1]
  30389. * Range: [0, pi]
  30390. *
  30391. * acos(x) = pi/2 - asin(x)
  30392. *
  30393. * acos(0) = pi/2
  30394. * acos(-0) = pi/2
  30395. * acos(1) = 0
  30396. * acos(-1) = pi
  30397. * acos(1/2) = pi/3
  30398. * acos(-1/2) = 2*pi/3
  30399. * acos(|x| > 1) = NaN
  30400. * acos(NaN) = NaN
  30401. *
  30402. */
  30403. P.inverseCosine = P.acos = function () {
  30404. var halfPi,
  30405. x = this,
  30406. Ctor = x.constructor,
  30407. k = x.abs().cmp(1),
  30408. pr = Ctor.precision,
  30409. rm = Ctor.rounding;
  30410. if (k !== -1) {
  30411. return k === 0
  30412. // |x| is 1
  30413. ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0)
  30414. // |x| > 1 or x is NaN
  30415. : new Ctor(NaN);
  30416. }
  30417. if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5);
  30418. // TODO? Special case acos(0.5) = pi/3 and acos(-0.5) = 2*pi/3
  30419. Ctor.precision = pr + 6;
  30420. Ctor.rounding = 1;
  30421. x = x.asin();
  30422. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  30423. Ctor.precision = pr;
  30424. Ctor.rounding = rm;
  30425. return halfPi.minus(x);
  30426. };
  30427. /*
  30428. * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the
  30429. * value of this Decimal.
  30430. *
  30431. * Domain: [1, Infinity]
  30432. * Range: [0, Infinity]
  30433. *
  30434. * acosh(x) = ln(x + sqrt(x^2 - 1))
  30435. *
  30436. * acosh(x < 1) = NaN
  30437. * acosh(NaN) = NaN
  30438. * acosh(Infinity) = Infinity
  30439. * acosh(-Infinity) = NaN
  30440. * acosh(0) = NaN
  30441. * acosh(-0) = NaN
  30442. * acosh(1) = 0
  30443. * acosh(-1) = NaN
  30444. *
  30445. */
  30446. P.inverseHyperbolicCosine = P.acosh = function () {
  30447. var pr,
  30448. rm,
  30449. x = this,
  30450. Ctor = x.constructor;
  30451. if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN);
  30452. if (!x.isFinite()) return new Ctor(x);
  30453. pr = Ctor.precision;
  30454. rm = Ctor.rounding;
  30455. Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4;
  30456. Ctor.rounding = 1;
  30457. external = false;
  30458. x = x.times(x).minus(1).sqrt().plus(x);
  30459. external = true;
  30460. Ctor.precision = pr;
  30461. Ctor.rounding = rm;
  30462. return x.ln();
  30463. };
  30464. /*
  30465. * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value
  30466. * of this Decimal.
  30467. *
  30468. * Domain: [-Infinity, Infinity]
  30469. * Range: [-Infinity, Infinity]
  30470. *
  30471. * asinh(x) = ln(x + sqrt(x^2 + 1))
  30472. *
  30473. * asinh(NaN) = NaN
  30474. * asinh(Infinity) = Infinity
  30475. * asinh(-Infinity) = -Infinity
  30476. * asinh(0) = 0
  30477. * asinh(-0) = -0
  30478. *
  30479. */
  30480. P.inverseHyperbolicSine = P.asinh = function () {
  30481. var pr,
  30482. rm,
  30483. x = this,
  30484. Ctor = x.constructor;
  30485. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  30486. pr = Ctor.precision;
  30487. rm = Ctor.rounding;
  30488. Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6;
  30489. Ctor.rounding = 1;
  30490. external = false;
  30491. x = x.times(x).plus(1).sqrt().plus(x);
  30492. external = true;
  30493. Ctor.precision = pr;
  30494. Ctor.rounding = rm;
  30495. return x.ln();
  30496. };
  30497. /*
  30498. * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the
  30499. * value of this Decimal.
  30500. *
  30501. * Domain: [-1, 1]
  30502. * Range: [-Infinity, Infinity]
  30503. *
  30504. * atanh(x) = 0.5 * ln((1 + x) / (1 - x))
  30505. *
  30506. * atanh(|x| > 1) = NaN
  30507. * atanh(NaN) = NaN
  30508. * atanh(Infinity) = NaN
  30509. * atanh(-Infinity) = NaN
  30510. * atanh(0) = 0
  30511. * atanh(-0) = -0
  30512. * atanh(1) = Infinity
  30513. * atanh(-1) = -Infinity
  30514. *
  30515. */
  30516. P.inverseHyperbolicTangent = P.atanh = function () {
  30517. var pr,
  30518. rm,
  30519. wpr,
  30520. xsd,
  30521. x = this,
  30522. Ctor = x.constructor;
  30523. if (!x.isFinite()) return new Ctor(NaN);
  30524. if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN);
  30525. pr = Ctor.precision;
  30526. rm = Ctor.rounding;
  30527. xsd = x.sd();
  30528. if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true);
  30529. Ctor.precision = wpr = xsd - x.e;
  30530. x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1);
  30531. Ctor.precision = pr + 4;
  30532. Ctor.rounding = 1;
  30533. x = x.ln();
  30534. Ctor.precision = pr;
  30535. Ctor.rounding = rm;
  30536. return x.times(0.5);
  30537. };
  30538. /*
  30539. * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this
  30540. * Decimal.
  30541. *
  30542. * Domain: [-Infinity, Infinity]
  30543. * Range: [-pi/2, pi/2]
  30544. *
  30545. * asin(x) = 2*atan(x/(1 + sqrt(1 - x^2)))
  30546. *
  30547. * asin(0) = 0
  30548. * asin(-0) = -0
  30549. * asin(1/2) = pi/6
  30550. * asin(-1/2) = -pi/6
  30551. * asin(1) = pi/2
  30552. * asin(-1) = -pi/2
  30553. * asin(|x| > 1) = NaN
  30554. * asin(NaN) = NaN
  30555. *
  30556. * TODO? Compare performance of Taylor series.
  30557. *
  30558. */
  30559. P.inverseSine = P.asin = function () {
  30560. var halfPi,
  30561. k,
  30562. pr,
  30563. rm,
  30564. x = this,
  30565. Ctor = x.constructor;
  30566. if (x.isZero()) return new Ctor(x);
  30567. k = x.abs().cmp(1);
  30568. pr = Ctor.precision;
  30569. rm = Ctor.rounding;
  30570. if (k !== -1) {
  30571. // |x| is 1
  30572. if (k === 0) {
  30573. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  30574. halfPi.s = x.s;
  30575. return halfPi;
  30576. }
  30577. // |x| > 1 or x is NaN
  30578. return new Ctor(NaN);
  30579. }
  30580. // TODO? Special case asin(1/2) = pi/6 and asin(-1/2) = -pi/6
  30581. Ctor.precision = pr + 6;
  30582. Ctor.rounding = 1;
  30583. x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan();
  30584. Ctor.precision = pr;
  30585. Ctor.rounding = rm;
  30586. return x.times(2);
  30587. };
  30588. /*
  30589. * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value
  30590. * of this Decimal.
  30591. *
  30592. * Domain: [-Infinity, Infinity]
  30593. * Range: [-pi/2, pi/2]
  30594. *
  30595. * atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  30596. *
  30597. * atan(0) = 0
  30598. * atan(-0) = -0
  30599. * atan(1) = pi/4
  30600. * atan(-1) = -pi/4
  30601. * atan(Infinity) = pi/2
  30602. * atan(-Infinity) = -pi/2
  30603. * atan(NaN) = NaN
  30604. *
  30605. */
  30606. P.inverseTangent = P.atan = function () {
  30607. var i,
  30608. j,
  30609. k,
  30610. n,
  30611. px,
  30612. t,
  30613. r,
  30614. wpr,
  30615. x2,
  30616. x = this,
  30617. Ctor = x.constructor,
  30618. pr = Ctor.precision,
  30619. rm = Ctor.rounding;
  30620. if (!x.isFinite()) {
  30621. if (!x.s) return new Ctor(NaN);
  30622. if (pr + 4 <= PI_PRECISION) {
  30623. r = getPi(Ctor, pr + 4, rm).times(0.5);
  30624. r.s = x.s;
  30625. return r;
  30626. }
  30627. } else if (x.isZero()) {
  30628. return new Ctor(x);
  30629. } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) {
  30630. r = getPi(Ctor, pr + 4, rm).times(0.25);
  30631. r.s = x.s;
  30632. return r;
  30633. }
  30634. Ctor.precision = wpr = pr + 10;
  30635. Ctor.rounding = 1;
  30636. // TODO? if (x >= 1 && pr <= PI_PRECISION) atan(x) = halfPi * x.s - atan(1 / x);
  30637. // Argument reduction
  30638. // Ensure |x| < 0.42
  30639. // atan(x) = 2 * atan(x / (1 + sqrt(1 + x^2)))
  30640. k = Math.min(28, wpr / LOG_BASE + 2 | 0);
  30641. for (i = k; i; --i) {
  30642. x = x.div(x.times(x).plus(1).sqrt().plus(1));
  30643. }external = false;
  30644. j = Math.ceil(wpr / LOG_BASE);
  30645. n = 1;
  30646. x2 = x.times(x);
  30647. r = new Ctor(x);
  30648. px = x;
  30649. // atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  30650. for (; i !== -1;) {
  30651. px = px.times(x2);
  30652. t = r.minus(px.div(n += 2));
  30653. px = px.times(x2);
  30654. r = t.plus(px.div(n += 2));
  30655. if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--;) {}
  30656. }
  30657. if (k) r = r.times(2 << k - 1);
  30658. external = true;
  30659. return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true);
  30660. };
  30661. /*
  30662. * Return true if the value of this Decimal is a finite number, otherwise return false.
  30663. *
  30664. */
  30665. P.isFinite = function () {
  30666. return !!this.d;
  30667. };
  30668. /*
  30669. * Return true if the value of this Decimal is an integer, otherwise return false.
  30670. *
  30671. */
  30672. P.isInteger = P.isInt = function () {
  30673. return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2;
  30674. };
  30675. /*
  30676. * Return true if the value of this Decimal is NaN, otherwise return false.
  30677. *
  30678. */
  30679. P.isNaN = function () {
  30680. return !this.s;
  30681. };
  30682. /*
  30683. * Return true if the value of this Decimal is negative, otherwise return false.
  30684. *
  30685. */
  30686. P.isNegative = P.isNeg = function () {
  30687. return this.s < 0;
  30688. };
  30689. /*
  30690. * Return true if the value of this Decimal is positive, otherwise return false.
  30691. *
  30692. */
  30693. P.isPositive = P.isPos = function () {
  30694. return this.s > 0;
  30695. };
  30696. /*
  30697. * Return true if the value of this Decimal is 0 or -0, otherwise return false.
  30698. *
  30699. */
  30700. P.isZero = function () {
  30701. return !!this.d && this.d[0] === 0;
  30702. };
  30703. /*
  30704. * Return true if the value of this Decimal is less than `y`, otherwise return false.
  30705. *
  30706. */
  30707. P.lessThan = P.lt = function (y) {
  30708. return this.cmp(y) < 0;
  30709. };
  30710. /*
  30711. * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.
  30712. *
  30713. */
  30714. P.lessThanOrEqualTo = P.lte = function (y) {
  30715. return this.cmp(y) < 1;
  30716. };
  30717. /*
  30718. * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision`
  30719. * significant digits using rounding mode `rounding`.
  30720. *
  30721. * If no base is specified, return log[10](arg).
  30722. *
  30723. * log[base](arg) = ln(arg) / ln(base)
  30724. *
  30725. * The result will always be correctly rounded if the base of the log is 10, and 'almost always'
  30726. * otherwise:
  30727. *
  30728. * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen
  30729. * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error
  30730. * between the result and the correctly rounded result will be one ulp (unit in the last place).
  30731. *
  30732. * log[-b](a) = NaN
  30733. * log[0](a) = NaN
  30734. * log[1](a) = NaN
  30735. * log[NaN](a) = NaN
  30736. * log[Infinity](a) = NaN
  30737. * log[b](0) = -Infinity
  30738. * log[b](-0) = -Infinity
  30739. * log[b](-a) = NaN
  30740. * log[b](1) = 0
  30741. * log[b](Infinity) = Infinity
  30742. * log[b](NaN) = NaN
  30743. *
  30744. * [base] {number|string|Decimal} The base of the logarithm.
  30745. *
  30746. */
  30747. P.logarithm = P.log = function (base) {
  30748. var isBase10,
  30749. d,
  30750. denominator,
  30751. k,
  30752. inf,
  30753. num,
  30754. sd,
  30755. r,
  30756. arg = this,
  30757. Ctor = arg.constructor,
  30758. pr = Ctor.precision,
  30759. rm = Ctor.rounding,
  30760. guard = 5;
  30761. // Default base is 10.
  30762. if (base == null) {
  30763. base = new Ctor(10);
  30764. isBase10 = true;
  30765. } else {
  30766. base = new Ctor(base);
  30767. d = base.d;
  30768. // Return NaN if base is negative, or non-finite, or is 0 or 1.
  30769. if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN);
  30770. isBase10 = base.eq(10);
  30771. }
  30772. d = arg.d;
  30773. // Is arg negative, non-finite, 0 or 1?
  30774. if (arg.s < 0 || !d || !d[0] || arg.eq(1)) {
  30775. return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0);
  30776. }
  30777. // The result will have a non-terminating decimal expansion if base is 10 and arg is not an
  30778. // integer power of 10.
  30779. if (isBase10) {
  30780. if (d.length > 1) {
  30781. inf = true;
  30782. } else {
  30783. for (k = d[0]; k % 10 === 0;) {
  30784. k /= 10;
  30785. }inf = k !== 1;
  30786. }
  30787. }
  30788. external = false;
  30789. sd = pr + guard;
  30790. num = naturalLogarithm(arg, sd);
  30791. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  30792. // The result will have 5 rounding digits.
  30793. r = divide(num, denominator, sd, 1);
  30794. // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000,
  30795. // calculate 10 further digits.
  30796. //
  30797. // If the result is known to have an infinite decimal expansion, repeat this until it is clear
  30798. // that the result is above or below the boundary. Otherwise, if after calculating the 10
  30799. // further digits, the last 14 are nines, round up and assume the result is exact.
  30800. // Also assume the result is exact if the last 14 are zero.
  30801. //
  30802. // Example of a result that will be incorrectly rounded:
  30803. // log[1048576](4503599627370502) = 2.60000000000000009610279511444746...
  30804. // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it
  30805. // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so
  30806. // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal
  30807. // place is still 2.6.
  30808. if (checkRoundingDigits(r.d, k = pr, rm)) {
  30809. do {
  30810. sd += 10;
  30811. num = naturalLogarithm(arg, sd);
  30812. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  30813. r = divide(num, denominator, sd, 1);
  30814. if (!inf) {
  30815. // Check for 14 nines from the 2nd rounding digit, as the first may be 4.
  30816. if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) {
  30817. r = finalise(r, pr + 1, 0);
  30818. }
  30819. break;
  30820. }
  30821. } while (checkRoundingDigits(r.d, k += 10, rm));
  30822. }
  30823. external = true;
  30824. return finalise(r, pr, rm);
  30825. };
  30826. /*
  30827. * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal.
  30828. *
  30829. * arguments {number|string|Decimal}
  30830. *
  30831. P.max = function () {
  30832. Array.prototype.push.call(arguments, this);
  30833. return maxOrMin(this.constructor, arguments, 'lt');
  30834. };
  30835. */
  30836. /*
  30837. * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal.
  30838. *
  30839. * arguments {number|string|Decimal}
  30840. *
  30841. P.min = function () {
  30842. Array.prototype.push.call(arguments, this);
  30843. return maxOrMin(this.constructor, arguments, 'gt');
  30844. };
  30845. */
  30846. /*
  30847. * n - 0 = n
  30848. * n - N = N
  30849. * n - I = -I
  30850. * 0 - n = -n
  30851. * 0 - 0 = 0
  30852. * 0 - N = N
  30853. * 0 - I = -I
  30854. * N - n = N
  30855. * N - 0 = N
  30856. * N - N = N
  30857. * N - I = N
  30858. * I - n = I
  30859. * I - 0 = I
  30860. * I - N = N
  30861. * I - I = N
  30862. *
  30863. * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision`
  30864. * significant digits using rounding mode `rounding`.
  30865. *
  30866. */
  30867. P.minus = P.sub = function (y) {
  30868. var d,
  30869. e,
  30870. i,
  30871. j,
  30872. k,
  30873. len,
  30874. pr,
  30875. rm,
  30876. xd,
  30877. xe,
  30878. xLTy,
  30879. yd,
  30880. x = this,
  30881. Ctor = x.constructor;
  30882. y = new Ctor(y);
  30883. // If either is not finite...
  30884. if (!x.d || !y.d) {
  30885. // Return NaN if either is NaN.
  30886. if (!x.s || !y.s) y = new Ctor(NaN);
  30887. // Return y negated if x is finite and y is ±Infinity.
  30888. else if (x.d) y.s = -y.s;
  30889. // Return x if y is finite and x is ±Infinity.
  30890. // Return x if both are ±Infinity with different signs.
  30891. // Return NaN if both are ±Infinity with the same sign.
  30892. else y = new Ctor(y.d || x.s !== y.s ? x : NaN);
  30893. return y;
  30894. }
  30895. // If signs differ...
  30896. if (x.s != y.s) {
  30897. y.s = -y.s;
  30898. return x.plus(y);
  30899. }
  30900. xd = x.d;
  30901. yd = y.d;
  30902. pr = Ctor.precision;
  30903. rm = Ctor.rounding;
  30904. // If either is zero...
  30905. if (!xd[0] || !yd[0]) {
  30906. // Return y negated if x is zero and y is non-zero.
  30907. if (yd[0]) y.s = -y.s;
  30908. // Return x if y is zero and x is non-zero.
  30909. else if (xd[0]) y = new Ctor(x);
  30910. // Return zero if both are zero.
  30911. // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity.
  30912. else return new Ctor(rm === 3 ? -0 : 0);
  30913. return external ? finalise(y, pr, rm) : y;
  30914. }
  30915. // x and y are finite, non-zero numbers with the same sign.
  30916. // Calculate base 1e7 exponents.
  30917. e = mathfloor(y.e / LOG_BASE);
  30918. xe = mathfloor(x.e / LOG_BASE);
  30919. xd = xd.slice();
  30920. k = xe - e;
  30921. // If base 1e7 exponents differ...
  30922. if (k) {
  30923. xLTy = k < 0;
  30924. if (xLTy) {
  30925. d = xd;
  30926. k = -k;
  30927. len = yd.length;
  30928. } else {
  30929. d = yd;
  30930. e = xe;
  30931. len = xd.length;
  30932. }
  30933. // Numbers with massively different exponents would result in a very high number of
  30934. // zeros needing to be prepended, but this can be avoided while still ensuring correct
  30935. // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`.
  30936. i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2;
  30937. if (k > i) {
  30938. k = i;
  30939. d.length = 1;
  30940. }
  30941. // Prepend zeros to equalise exponents.
  30942. d.reverse();
  30943. for (i = k; i--;) {
  30944. d.push(0);
  30945. }d.reverse();
  30946. // Base 1e7 exponents equal.
  30947. } else {
  30948. // Check digits to determine which is the bigger number.
  30949. i = xd.length;
  30950. len = yd.length;
  30951. xLTy = i < len;
  30952. if (xLTy) len = i;
  30953. for (i = 0; i < len; i++) {
  30954. if (xd[i] != yd[i]) {
  30955. xLTy = xd[i] < yd[i];
  30956. break;
  30957. }
  30958. }
  30959. k = 0;
  30960. }
  30961. if (xLTy) {
  30962. d = xd;
  30963. xd = yd;
  30964. yd = d;
  30965. y.s = -y.s;
  30966. }
  30967. len = xd.length;
  30968. // Append zeros to `xd` if shorter.
  30969. // Don't add zeros to `yd` if shorter as subtraction only needs to start at `yd` length.
  30970. for (i = yd.length - len; i > 0; --i) {
  30971. xd[len++] = 0;
  30972. } // Subtract yd from xd.
  30973. for (i = yd.length; i > k;) {
  30974. if (xd[--i] < yd[i]) {
  30975. for (j = i; j && xd[--j] === 0;) {
  30976. xd[j] = BASE - 1;
  30977. }--xd[j];
  30978. xd[i] += BASE;
  30979. }
  30980. xd[i] -= yd[i];
  30981. }
  30982. // Remove trailing zeros.
  30983. for (; xd[--len] === 0;) {
  30984. xd.pop();
  30985. } // Remove leading zeros and adjust exponent accordingly.
  30986. for (; xd[0] === 0; xd.shift()) {
  30987. --e;
  30988. } // Zero?
  30989. if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0);
  30990. y.d = xd;
  30991. y.e = getBase10Exponent(xd, e);
  30992. return external ? finalise(y, pr, rm) : y;
  30993. };
  30994. /*
  30995. * n % 0 = N
  30996. * n % N = N
  30997. * n % I = n
  30998. * 0 % n = 0
  30999. * -0 % n = -0
  31000. * 0 % 0 = N
  31001. * 0 % N = N
  31002. * 0 % I = 0
  31003. * N % n = N
  31004. * N % 0 = N
  31005. * N % N = N
  31006. * N % I = N
  31007. * I % n = N
  31008. * I % 0 = N
  31009. * I % N = N
  31010. * I % I = N
  31011. *
  31012. * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to
  31013. * `precision` significant digits using rounding mode `rounding`.
  31014. *
  31015. * The result depends on the modulo mode.
  31016. *
  31017. */
  31018. P.modulo = P.mod = function (y) {
  31019. var q,
  31020. x = this,
  31021. Ctor = x.constructor;
  31022. y = new Ctor(y);
  31023. // Return NaN if x is ±Infinity or NaN, or y is NaN or ±0.
  31024. if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN);
  31025. // Return x if y is ±Infinity or x is ±0.
  31026. if (!y.d || x.d && !x.d[0]) {
  31027. return finalise(new Ctor(x), Ctor.precision, Ctor.rounding);
  31028. }
  31029. // Prevent rounding of intermediate calculations.
  31030. external = false;
  31031. if (Ctor.modulo == 9) {
  31032. // Euclidian division: q = sign(y) * floor(x / abs(y))
  31033. // result = x - q * y where 0 <= result < abs(y)
  31034. q = divide(x, y.abs(), 0, 3, 1);
  31035. q.s *= y.s;
  31036. } else {
  31037. q = divide(x, y, 0, Ctor.modulo, 1);
  31038. }
  31039. q = q.times(y);
  31040. external = true;
  31041. return x.minus(q);
  31042. };
  31043. /*
  31044. * Return a new Decimal whose value is the natural exponential of the value of this Decimal,
  31045. * i.e. the base e raised to the power the value of this Decimal, rounded to `precision`
  31046. * significant digits using rounding mode `rounding`.
  31047. *
  31048. */
  31049. P.naturalExponential = P.exp = function () {
  31050. return naturalExponential(this);
  31051. };
  31052. /*
  31053. * Return a new Decimal whose value is the natural logarithm of the value of this Decimal,
  31054. * rounded to `precision` significant digits using rounding mode `rounding`.
  31055. *
  31056. */
  31057. P.naturalLogarithm = P.ln = function () {
  31058. return naturalLogarithm(this);
  31059. };
  31060. /*
  31061. * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by
  31062. * -1.
  31063. *
  31064. */
  31065. P.negated = P.neg = function () {
  31066. var x = new this.constructor(this);
  31067. x.s = -x.s;
  31068. return finalise(x);
  31069. };
  31070. /*
  31071. * n + 0 = n
  31072. * n + N = N
  31073. * n + I = I
  31074. * 0 + n = n
  31075. * 0 + 0 = 0
  31076. * 0 + N = N
  31077. * 0 + I = I
  31078. * N + n = N
  31079. * N + 0 = N
  31080. * N + N = N
  31081. * N + I = N
  31082. * I + n = I
  31083. * I + 0 = I
  31084. * I + N = N
  31085. * I + I = I
  31086. *
  31087. * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision`
  31088. * significant digits using rounding mode `rounding`.
  31089. *
  31090. */
  31091. P.plus = P.add = function (y) {
  31092. var carry,
  31093. d,
  31094. e,
  31095. i,
  31096. k,
  31097. len,
  31098. pr,
  31099. rm,
  31100. xd,
  31101. yd,
  31102. x = this,
  31103. Ctor = x.constructor;
  31104. y = new Ctor(y);
  31105. // If either is not finite...
  31106. if (!x.d || !y.d) {
  31107. // Return NaN if either is NaN.
  31108. if (!x.s || !y.s) y = new Ctor(NaN);
  31109. // Return x if y is finite and x is ±Infinity.
  31110. // Return x if both are ±Infinity with the same sign.
  31111. // Return NaN if both are ±Infinity with different signs.
  31112. // Return y if x is finite and y is ±Infinity.
  31113. else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN);
  31114. return y;
  31115. }
  31116. // If signs differ...
  31117. if (x.s != y.s) {
  31118. y.s = -y.s;
  31119. return x.minus(y);
  31120. }
  31121. xd = x.d;
  31122. yd = y.d;
  31123. pr = Ctor.precision;
  31124. rm = Ctor.rounding;
  31125. // If either is zero...
  31126. if (!xd[0] || !yd[0]) {
  31127. // Return x if y is zero.
  31128. // Return y if y is non-zero.
  31129. if (!yd[0]) y = new Ctor(x);
  31130. return external ? finalise(y, pr, rm) : y;
  31131. }
  31132. // x and y are finite, non-zero numbers with the same sign.
  31133. // Calculate base 1e7 exponents.
  31134. k = mathfloor(x.e / LOG_BASE);
  31135. e = mathfloor(y.e / LOG_BASE);
  31136. xd = xd.slice();
  31137. i = k - e;
  31138. // If base 1e7 exponents differ...
  31139. if (i) {
  31140. if (i < 0) {
  31141. d = xd;
  31142. i = -i;
  31143. len = yd.length;
  31144. } else {
  31145. d = yd;
  31146. e = k;
  31147. len = xd.length;
  31148. }
  31149. // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1.
  31150. k = Math.ceil(pr / LOG_BASE);
  31151. len = k > len ? k + 1 : len + 1;
  31152. if (i > len) {
  31153. i = len;
  31154. d.length = 1;
  31155. }
  31156. // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts.
  31157. d.reverse();
  31158. for (; i--;) {
  31159. d.push(0);
  31160. }d.reverse();
  31161. }
  31162. len = xd.length;
  31163. i = yd.length;
  31164. // If yd is longer than xd, swap xd and yd so xd points to the longer array.
  31165. if (len - i < 0) {
  31166. i = len;
  31167. d = yd;
  31168. yd = xd;
  31169. xd = d;
  31170. }
  31171. // Only start adding at yd.length - 1 as the further digits of xd can be left as they are.
  31172. for (carry = 0; i;) {
  31173. carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0;
  31174. xd[i] %= BASE;
  31175. }
  31176. if (carry) {
  31177. xd.unshift(carry);
  31178. ++e;
  31179. }
  31180. // Remove trailing zeros.
  31181. // No need to check for zero, as +x + +y != 0 && -x + -y != 0
  31182. for (len = xd.length; xd[--len] == 0;) {
  31183. xd.pop();
  31184. }y.d = xd;
  31185. y.e = getBase10Exponent(xd, e);
  31186. return external ? finalise(y, pr, rm) : y;
  31187. };
  31188. /*
  31189. * Return the number of significant digits of the value of this Decimal.
  31190. *
  31191. * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.
  31192. *
  31193. */
  31194. P.precision = P.sd = function (z) {
  31195. var k,
  31196. x = this;
  31197. if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z);
  31198. if (x.d) {
  31199. k = getPrecision(x.d);
  31200. if (z && x.e + 1 > k) k = x.e + 1;
  31201. } else {
  31202. k = NaN;
  31203. }
  31204. return k;
  31205. };
  31206. /*
  31207. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using
  31208. * rounding mode `rounding`.
  31209. *
  31210. */
  31211. P.round = function () {
  31212. var x = this,
  31213. Ctor = x.constructor;
  31214. return finalise(new Ctor(x), x.e + 1, Ctor.rounding);
  31215. };
  31216. /*
  31217. * Return a new Decimal whose value is the sine of the value in radians of this Decimal.
  31218. *
  31219. * Domain: [-Infinity, Infinity]
  31220. * Range: [-1, 1]
  31221. *
  31222. * sin(x) = x - x^3/3! + x^5/5! - ...
  31223. *
  31224. * sin(0) = 0
  31225. * sin(-0) = -0
  31226. * sin(Infinity) = NaN
  31227. * sin(-Infinity) = NaN
  31228. * sin(NaN) = NaN
  31229. *
  31230. */
  31231. P.sine = P.sin = function () {
  31232. var pr,
  31233. rm,
  31234. x = this,
  31235. Ctor = x.constructor;
  31236. if (!x.isFinite()) return new Ctor(NaN);
  31237. if (x.isZero()) return new Ctor(x);
  31238. pr = Ctor.precision;
  31239. rm = Ctor.rounding;
  31240. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  31241. Ctor.rounding = 1;
  31242. x = sine(Ctor, toLessThanHalfPi(Ctor, x));
  31243. Ctor.precision = pr;
  31244. Ctor.rounding = rm;
  31245. return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true);
  31246. };
  31247. /*
  31248. * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision`
  31249. * significant digits using rounding mode `rounding`.
  31250. *
  31251. * sqrt(-n) = N
  31252. * sqrt(N) = N
  31253. * sqrt(-I) = N
  31254. * sqrt(I) = I
  31255. * sqrt(0) = 0
  31256. * sqrt(-0) = -0
  31257. *
  31258. */
  31259. P.squareRoot = P.sqrt = function () {
  31260. var m,
  31261. n,
  31262. sd,
  31263. r,
  31264. rep,
  31265. t,
  31266. x = this,
  31267. d = x.d,
  31268. e = x.e,
  31269. s = x.s,
  31270. Ctor = x.constructor;
  31271. // Negative/NaN/Infinity/zero?
  31272. if (s !== 1 || !d || !d[0]) {
  31273. return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0);
  31274. }
  31275. external = false;
  31276. // Initial estimate.
  31277. s = Math.sqrt(+x);
  31278. // Math.sqrt underflow/overflow?
  31279. // Pass x to Math.sqrt as integer, then adjust the exponent of the result.
  31280. if (s == 0 || s == 1 / 0) {
  31281. n = digitsToString(d);
  31282. if ((n.length + e) % 2 == 0) n += '0';
  31283. s = Math.sqrt(n);
  31284. e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);
  31285. if (s == 1 / 0) {
  31286. n = '1e' + e;
  31287. } else {
  31288. n = s.toExponential();
  31289. n = n.slice(0, n.indexOf('e') + 1) + e;
  31290. }
  31291. r = new Ctor(n);
  31292. } else {
  31293. r = new Ctor(s.toString());
  31294. }
  31295. sd = (e = Ctor.precision) + 3;
  31296. // Newton-Raphson iteration.
  31297. for (;;) {
  31298. t = r;
  31299. r = t.plus(divide(x, t, sd + 2, 1)).times(0.5);
  31300. // TODO? Replace with for-loop and checkRoundingDigits.
  31301. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  31302. n = n.slice(sd - 3, sd + 1);
  31303. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or
  31304. // 4999, i.e. approaching a rounding boundary, continue the iteration.
  31305. if (n == '9999' || !rep && n == '4999') {
  31306. // On the first iteration only, check to see if rounding up gives the exact result as the
  31307. // nines may infinitely repeat.
  31308. if (!rep) {
  31309. finalise(t, e + 1, 0);
  31310. if (t.times(t).eq(x)) {
  31311. r = t;
  31312. break;
  31313. }
  31314. }
  31315. sd += 4;
  31316. rep = 1;
  31317. } else {
  31318. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  31319. // If not, then there are further digits and m will be truthy.
  31320. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  31321. // Truncate to the first rounding digit.
  31322. finalise(r, e + 1, 1);
  31323. m = !r.times(r).eq(x);
  31324. }
  31325. break;
  31326. }
  31327. }
  31328. }
  31329. external = true;
  31330. return finalise(r, e, Ctor.rounding, m);
  31331. };
  31332. /*
  31333. * Return a new Decimal whose value is the tangent of the value in radians of this Decimal.
  31334. *
  31335. * Domain: [-Infinity, Infinity]
  31336. * Range: [-Infinity, Infinity]
  31337. *
  31338. * tan(0) = 0
  31339. * tan(-0) = -0
  31340. * tan(Infinity) = NaN
  31341. * tan(-Infinity) = NaN
  31342. * tan(NaN) = NaN
  31343. *
  31344. */
  31345. P.tangent = P.tan = function () {
  31346. var pr,
  31347. rm,
  31348. x = this,
  31349. Ctor = x.constructor;
  31350. if (!x.isFinite()) return new Ctor(NaN);
  31351. if (x.isZero()) return new Ctor(x);
  31352. pr = Ctor.precision;
  31353. rm = Ctor.rounding;
  31354. Ctor.precision = pr + 10;
  31355. Ctor.rounding = 1;
  31356. x = x.sin();
  31357. x.s = 1;
  31358. x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0);
  31359. Ctor.precision = pr;
  31360. Ctor.rounding = rm;
  31361. return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true);
  31362. };
  31363. /*
  31364. * n * 0 = 0
  31365. * n * N = N
  31366. * n * I = I
  31367. * 0 * n = 0
  31368. * 0 * 0 = 0
  31369. * 0 * N = N
  31370. * 0 * I = N
  31371. * N * n = N
  31372. * N * 0 = N
  31373. * N * N = N
  31374. * N * I = N
  31375. * I * n = I
  31376. * I * 0 = N
  31377. * I * N = N
  31378. * I * I = I
  31379. *
  31380. * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant
  31381. * digits using rounding mode `rounding`.
  31382. *
  31383. */
  31384. P.times = P.mul = function (y) {
  31385. var carry,
  31386. e,
  31387. i,
  31388. k,
  31389. r,
  31390. rL,
  31391. t,
  31392. xdL,
  31393. ydL,
  31394. x = this,
  31395. Ctor = x.constructor,
  31396. xd = x.d,
  31397. yd = (y = new Ctor(y)).d;
  31398. y.s *= x.s;
  31399. // If either is NaN, ±Infinity or ±0...
  31400. if (!xd || !xd[0] || !yd || !yd[0]) {
  31401. return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd
  31402. // Return NaN if either is NaN.
  31403. // Return NaN if x is ±0 and y is ±Infinity, or y is ±0 and x is ±Infinity.
  31404. ? NaN
  31405. // Return ±Infinity if either is ±Infinity.
  31406. // Return ±0 if either is ±0.
  31407. : !xd || !yd ? y.s / 0 : y.s * 0);
  31408. }
  31409. e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE);
  31410. xdL = xd.length;
  31411. ydL = yd.length;
  31412. // Ensure xd points to the longer array.
  31413. if (xdL < ydL) {
  31414. r = xd;
  31415. xd = yd;
  31416. yd = r;
  31417. rL = xdL;
  31418. xdL = ydL;
  31419. ydL = rL;
  31420. }
  31421. // Initialise the result array with zeros.
  31422. r = [];
  31423. rL = xdL + ydL;
  31424. for (i = rL; i--;) {
  31425. r.push(0);
  31426. } // Multiply!
  31427. for (i = ydL; --i >= 0;) {
  31428. carry = 0;
  31429. for (k = xdL + i; k > i;) {
  31430. t = r[k] + yd[i] * xd[k - i - 1] + carry;
  31431. r[k--] = t % BASE | 0;
  31432. carry = t / BASE | 0;
  31433. }
  31434. r[k] = (r[k] + carry) % BASE | 0;
  31435. }
  31436. // Remove trailing zeros.
  31437. for (; !r[--rL];) {
  31438. r.pop();
  31439. }if (carry) ++e;else r.shift();
  31440. y.d = r;
  31441. y.e = getBase10Exponent(r, e);
  31442. return external ? finalise(y, Ctor.precision, Ctor.rounding) : y;
  31443. };
  31444. /*
  31445. * Return a string representing the value of this Decimal in base 2, round to `sd` significant
  31446. * digits using rounding mode `rm`.
  31447. *
  31448. * If the optional `sd` argument is present then return binary exponential notation.
  31449. *
  31450. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  31451. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  31452. *
  31453. */
  31454. P.toBinary = function (sd, rm) {
  31455. return toStringBinary(this, 2, sd, rm);
  31456. };
  31457. /*
  31458. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp`
  31459. * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted.
  31460. *
  31461. * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal.
  31462. *
  31463. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  31464. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  31465. *
  31466. */
  31467. P.toDecimalPlaces = P.toDP = function (dp, rm) {
  31468. var x = this,
  31469. Ctor = x.constructor;
  31470. x = new Ctor(x);
  31471. if (dp === void 0) return x;
  31472. checkInt32(dp, 0, MAX_DIGITS);
  31473. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  31474. return finalise(x, dp + x.e + 1, rm);
  31475. };
  31476. /*
  31477. * Return a string representing the value of this Decimal in exponential notation rounded to
  31478. * `dp` fixed decimal places using rounding mode `rounding`.
  31479. *
  31480. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  31481. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  31482. *
  31483. */
  31484. P.toExponential = function (dp, rm) {
  31485. var str,
  31486. x = this,
  31487. Ctor = x.constructor;
  31488. if (dp === void 0) {
  31489. str = finiteToString(x, true);
  31490. } else {
  31491. checkInt32(dp, 0, MAX_DIGITS);
  31492. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  31493. x = finalise(new Ctor(x), dp + 1, rm);
  31494. str = finiteToString(x, true, dp + 1);
  31495. }
  31496. return x.isNeg() && !x.isZero() ? '-' + str : str;
  31497. };
  31498. /*
  31499. * Return a string representing the value of this Decimal in normal (fixed-point) notation to
  31500. * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is
  31501. * omitted.
  31502. *
  31503. * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'.
  31504. *
  31505. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  31506. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  31507. *
  31508. * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
  31509. * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
  31510. * (-0).toFixed(3) is '0.000'.
  31511. * (-0.5).toFixed(0) is '-0'.
  31512. *
  31513. */
  31514. P.toFixed = function (dp, rm) {
  31515. var str,
  31516. y,
  31517. x = this,
  31518. Ctor = x.constructor;
  31519. if (dp === void 0) {
  31520. str = finiteToString(x);
  31521. } else {
  31522. checkInt32(dp, 0, MAX_DIGITS);
  31523. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  31524. y = finalise(new Ctor(x), dp + x.e + 1, rm);
  31525. str = finiteToString(y, false, dp + y.e + 1);
  31526. }
  31527. // To determine whether to add the minus sign look at the value before it was rounded,
  31528. // i.e. look at `x` rather than `y`.
  31529. return x.isNeg() && !x.isZero() ? '-' + str : str;
  31530. };
  31531. /*
  31532. * Return an array representing the value of this Decimal as a simple fraction with an integer
  31533. * numerator and an integer denominator.
  31534. *
  31535. * The denominator will be a positive non-zero value less than or equal to the specified maximum
  31536. * denominator. If a maximum denominator is not specified, the denominator will be the lowest
  31537. * value necessary to represent the number exactly.
  31538. *
  31539. * [maxD] {number|string|Decimal} Maximum denominator. Integer >= 1 and < Infinity.
  31540. *
  31541. */
  31542. P.toFraction = function (maxD) {
  31543. var d,
  31544. d0,
  31545. d1,
  31546. d2,
  31547. e,
  31548. k,
  31549. n,
  31550. n0,
  31551. n1,
  31552. pr,
  31553. q,
  31554. r,
  31555. x = this,
  31556. xd = x.d,
  31557. Ctor = x.constructor;
  31558. if (!xd) return new Ctor(x);
  31559. n1 = d0 = new Ctor(1);
  31560. d1 = n0 = new Ctor(0);
  31561. d = new Ctor(d1);
  31562. e = d.e = getPrecision(xd) - x.e - 1;
  31563. k = e % LOG_BASE;
  31564. d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k);
  31565. if (maxD == null) {
  31566. // d is 10**e, the minimum max-denominator needed.
  31567. maxD = e > 0 ? d : n1;
  31568. } else {
  31569. n = new Ctor(maxD);
  31570. if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n);
  31571. maxD = n.gt(d) ? e > 0 ? d : n1 : n;
  31572. }
  31573. external = false;
  31574. n = new Ctor(digitsToString(xd));
  31575. pr = Ctor.precision;
  31576. Ctor.precision = e = xd.length * LOG_BASE * 2;
  31577. for (;;) {
  31578. q = divide(n, d, 0, 1, 1);
  31579. d2 = d0.plus(q.times(d1));
  31580. if (d2.cmp(maxD) == 1) break;
  31581. d0 = d1;
  31582. d1 = d2;
  31583. d2 = n1;
  31584. n1 = n0.plus(q.times(d2));
  31585. n0 = d2;
  31586. d2 = d;
  31587. d = n.minus(q.times(d2));
  31588. n = d2;
  31589. }
  31590. d2 = divide(maxD.minus(d0), d1, 0, 1, 1);
  31591. n0 = n0.plus(d2.times(n1));
  31592. d0 = d0.plus(d2.times(d1));
  31593. n0.s = n1.s = x.s;
  31594. // Determine which fraction is closer to x, n0/d0 or n1/d1?
  31595. r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];
  31596. Ctor.precision = pr;
  31597. external = true;
  31598. return r;
  31599. };
  31600. /*
  31601. * Return a string representing the value of this Decimal in base 16, round to `sd` significant
  31602. * digits using rounding mode `rm`.
  31603. *
  31604. * If the optional `sd` argument is present then return binary exponential notation.
  31605. *
  31606. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  31607. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  31608. *
  31609. */
  31610. P.toHexadecimal = P.toHex = function (sd, rm) {
  31611. return toStringBinary(this, 16, sd, rm);
  31612. };
  31613. /*
  31614. * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding
  31615. * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal.
  31616. *
  31617. * The return value will always have the same sign as this Decimal, unless either this Decimal
  31618. * or `y` is NaN, in which case the return value will be also be NaN.
  31619. *
  31620. * The return value is not affected by the value of `precision`.
  31621. *
  31622. * y {number|string|Decimal} The magnitude to round to a multiple of.
  31623. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  31624. *
  31625. * 'toNearest() rounding mode not an integer: {rm}'
  31626. * 'toNearest() rounding mode out of range: {rm}'
  31627. *
  31628. */
  31629. P.toNearest = function (y, rm) {
  31630. var x = this,
  31631. Ctor = x.constructor;
  31632. x = new Ctor(x);
  31633. if (y == null) {
  31634. // If x is not finite, return x.
  31635. if (!x.d) return x;
  31636. y = new Ctor(1);
  31637. rm = Ctor.rounding;
  31638. } else {
  31639. y = new Ctor(y);
  31640. if (rm === void 0) {
  31641. rm = Ctor.rounding;
  31642. } else {
  31643. checkInt32(rm, 0, 8);
  31644. }
  31645. // If x is not finite, return x if y is not NaN, else NaN.
  31646. if (!x.d) return y.s ? x : y;
  31647. // If y is not finite, return Infinity with the sign of x if y is Infinity, else NaN.
  31648. if (!y.d) {
  31649. if (y.s) y.s = x.s;
  31650. return y;
  31651. }
  31652. }
  31653. // If y is not zero, calculate the nearest multiple of y to x.
  31654. if (y.d[0]) {
  31655. external = false;
  31656. x = divide(x, y, 0, rm, 1).times(y);
  31657. external = true;
  31658. finalise(x);
  31659. // If y is zero, return zero with the sign of x.
  31660. } else {
  31661. y.s = x.s;
  31662. x = y;
  31663. }
  31664. return x;
  31665. };
  31666. /*
  31667. * Return the value of this Decimal converted to a number primitive.
  31668. * Zero keeps its sign.
  31669. *
  31670. */
  31671. P.toNumber = function () {
  31672. return +this;
  31673. };
  31674. /*
  31675. * Return a string representing the value of this Decimal in base 8, round to `sd` significant
  31676. * digits using rounding mode `rm`.
  31677. *
  31678. * If the optional `sd` argument is present then return binary exponential notation.
  31679. *
  31680. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  31681. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  31682. *
  31683. */
  31684. P.toOctal = function (sd, rm) {
  31685. return toStringBinary(this, 8, sd, rm);
  31686. };
  31687. /*
  31688. * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded
  31689. * to `precision` significant digits using rounding mode `rounding`.
  31690. *
  31691. * ECMAScript compliant.
  31692. *
  31693. * pow(x, NaN) = NaN
  31694. * pow(x, ±0) = 1
  31695. * pow(NaN, non-zero) = NaN
  31696. * pow(abs(x) > 1, +Infinity) = +Infinity
  31697. * pow(abs(x) > 1, -Infinity) = +0
  31698. * pow(abs(x) == 1, ±Infinity) = NaN
  31699. * pow(abs(x) < 1, +Infinity) = +0
  31700. * pow(abs(x) < 1, -Infinity) = +Infinity
  31701. * pow(+Infinity, y > 0) = +Infinity
  31702. * pow(+Infinity, y < 0) = +0
  31703. * pow(-Infinity, odd integer > 0) = -Infinity
  31704. * pow(-Infinity, even integer > 0) = +Infinity
  31705. * pow(-Infinity, odd integer < 0) = -0
  31706. * pow(-Infinity, even integer < 0) = +0
  31707. * pow(+0, y > 0) = +0
  31708. * pow(+0, y < 0) = +Infinity
  31709. * pow(-0, odd integer > 0) = -0
  31710. * pow(-0, even integer > 0) = +0
  31711. * pow(-0, odd integer < 0) = -Infinity
  31712. * pow(-0, even integer < 0) = +Infinity
  31713. * pow(finite x < 0, finite non-integer) = NaN
  31714. *
  31715. * For non-integer or very large exponents pow(x, y) is calculated using
  31716. *
  31717. * x^y = exp(y*ln(x))
  31718. *
  31719. * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the
  31720. * probability of an incorrectly rounded result
  31721. * P([49]9{14} | [50]0{14}) = 2 * 0.2 * 10^-14 = 4e-15 = 1/2.5e+14
  31722. * i.e. 1 in 250,000,000,000,000
  31723. *
  31724. * If a result is incorrectly rounded the maximum error will be 1 ulp (unit in last place).
  31725. *
  31726. * y {number|string|Decimal} The power to which to raise this Decimal.
  31727. *
  31728. */
  31729. P.toPower = P.pow = function (y) {
  31730. var e,
  31731. k,
  31732. pr,
  31733. r,
  31734. rm,
  31735. s,
  31736. x = this,
  31737. Ctor = x.constructor,
  31738. yn = +(y = new Ctor(y));
  31739. // Either ±Infinity, NaN or ±0?
  31740. if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn));
  31741. x = new Ctor(x);
  31742. if (x.eq(1)) return x;
  31743. pr = Ctor.precision;
  31744. rm = Ctor.rounding;
  31745. if (y.eq(1)) return finalise(x, pr, rm);
  31746. // y exponent
  31747. e = mathfloor(y.e / LOG_BASE);
  31748. // If y is a small integer use the 'exponentiation by squaring' algorithm.
  31749. if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) {
  31750. r = intPow(Ctor, x, k, pr);
  31751. return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm);
  31752. }
  31753. s = x.s;
  31754. // if x is negative
  31755. if (s < 0) {
  31756. // if y is not an integer
  31757. if (e < y.d.length - 1) return new Ctor(NaN);
  31758. // Result is positive if x is negative and the last digit of integer y is even.
  31759. if ((y.d[e] & 1) == 0) s = 1;
  31760. // if x.eq(-1)
  31761. if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) {
  31762. x.s = s;
  31763. return x;
  31764. }
  31765. }
  31766. // Estimate result exponent.
  31767. // x^y = 10^e, where e = y * log10(x)
  31768. // log10(x) = log10(x_significand) + x_exponent
  31769. // log10(x_significand) = ln(x_significand) / ln(10)
  31770. k = mathpow(+x, yn);
  31771. e = k == 0 || !isFinite(k) ? mathfloor(yn * (Math.log('0.' + digitsToString(x.d)) / Math.LN10 + x.e + 1)) : new Ctor(k + '').e;
  31772. // Exponent estimate may be incorrect e.g. x: 0.999999999999999999, y: 2.29, e: 0, r.e: -1.
  31773. // Overflow/underflow?
  31774. if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0);
  31775. external = false;
  31776. Ctor.rounding = x.s = 1;
  31777. // Estimate the extra guard digits needed to ensure five correct rounding digits from
  31778. // naturalLogarithm(x). Example of failure without these extra digits (precision: 10):
  31779. // new Decimal(2.32456).pow('2087987436534566.46411')
  31780. // should be 1.162377823e+764914905173815, but is 1.162355823e+764914905173815
  31781. k = Math.min(12, (e + '').length);
  31782. // r = x^y = exp(y*ln(x))
  31783. r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr);
  31784. // r may be Infinity, e.g. (0.9999999999999999).pow(-1e+40)
  31785. if (r.d) {
  31786. // Truncate to the required precision plus five rounding digits.
  31787. r = finalise(r, pr + 5, 1);
  31788. // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate
  31789. // the result.
  31790. if (checkRoundingDigits(r.d, pr, rm)) {
  31791. e = pr + 10;
  31792. // Truncate to the increased precision plus five rounding digits.
  31793. r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1);
  31794. // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9).
  31795. if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) {
  31796. r = finalise(r, pr + 1, 0);
  31797. }
  31798. }
  31799. }
  31800. r.s = s;
  31801. external = true;
  31802. Ctor.rounding = rm;
  31803. return finalise(r, pr, rm);
  31804. };
  31805. /*
  31806. * Return a string representing the value of this Decimal rounded to `sd` significant digits
  31807. * using rounding mode `rounding`.
  31808. *
  31809. * Return exponential notation if `sd` is less than the number of digits necessary to represent
  31810. * the integer part of the value in normal notation.
  31811. *
  31812. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  31813. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  31814. *
  31815. */
  31816. P.toPrecision = function (sd, rm) {
  31817. var str,
  31818. x = this,
  31819. Ctor = x.constructor;
  31820. if (sd === void 0) {
  31821. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  31822. } else {
  31823. checkInt32(sd, 1, MAX_DIGITS);
  31824. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  31825. x = finalise(new Ctor(x), sd, rm);
  31826. str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd);
  31827. }
  31828. return x.isNeg() && !x.isZero() ? '-' + str : str;
  31829. };
  31830. /*
  31831. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd`
  31832. * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if
  31833. * omitted.
  31834. *
  31835. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  31836. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  31837. *
  31838. * 'toSD() digits out of range: {sd}'
  31839. * 'toSD() digits not an integer: {sd}'
  31840. * 'toSD() rounding mode not an integer: {rm}'
  31841. * 'toSD() rounding mode out of range: {rm}'
  31842. *
  31843. */
  31844. P.toSignificantDigits = P.toSD = function (sd, rm) {
  31845. var x = this,
  31846. Ctor = x.constructor;
  31847. if (sd === void 0) {
  31848. sd = Ctor.precision;
  31849. rm = Ctor.rounding;
  31850. } else {
  31851. checkInt32(sd, 1, MAX_DIGITS);
  31852. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  31853. }
  31854. return finalise(new Ctor(x), sd, rm);
  31855. };
  31856. /*
  31857. * Return a string representing the value of this Decimal.
  31858. *
  31859. * Return exponential notation if this Decimal has a positive exponent equal to or greater than
  31860. * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.
  31861. *
  31862. */
  31863. P.toString = function () {
  31864. var x = this,
  31865. Ctor = x.constructor,
  31866. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  31867. return x.isNeg() && !x.isZero() ? '-' + str : str;
  31868. };
  31869. /*
  31870. * Return a new Decimal whose value is the value of this Decimal truncated to a whole number.
  31871. *
  31872. */
  31873. P.truncated = P.trunc = function () {
  31874. return finalise(new this.constructor(this), this.e + 1, 1);
  31875. };
  31876. /*
  31877. * Return a string representing the value of this Decimal.
  31878. * Unlike `toString`, negative zero will include the minus sign.
  31879. *
  31880. */
  31881. P.valueOf = P.toJSON = function () {
  31882. var x = this,
  31883. Ctor = x.constructor,
  31884. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  31885. return x.isNeg() ? '-' + str : str;
  31886. };
  31887. /*
  31888. // Add aliases to match BigDecimal method names.
  31889. // P.add = P.plus;
  31890. P.subtract = P.minus;
  31891. P.multiply = P.times;
  31892. P.divide = P.div;
  31893. P.remainder = P.mod;
  31894. P.compareTo = P.cmp;
  31895. P.negate = P.neg;
  31896. */
  31897. // Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers.
  31898. /*
  31899. * digitsToString P.cubeRoot, P.logarithm, P.squareRoot, P.toFraction, P.toPower,
  31900. * finiteToString, naturalExponential, naturalLogarithm
  31901. * checkInt32 P.toDecimalPlaces, P.toExponential, P.toFixed, P.toNearest,
  31902. * P.toPrecision, P.toSignificantDigits, toStringBinary, random
  31903. * checkRoundingDigits P.logarithm, P.toPower, naturalExponential, naturalLogarithm
  31904. * convertBase toStringBinary, parseOther
  31905. * cos P.cos
  31906. * divide P.atanh, P.cubeRoot, P.dividedBy, P.dividedToIntegerBy,
  31907. * P.logarithm, P.modulo, P.squareRoot, P.tan, P.tanh, P.toFraction,
  31908. * P.toNearest, toStringBinary, naturalExponential, naturalLogarithm,
  31909. * taylorSeries, atan2, parseOther
  31910. * finalise P.absoluteValue, P.atan, P.atanh, P.ceil, P.cos, P.cosh,
  31911. * P.cubeRoot, P.dividedToIntegerBy, P.floor, P.logarithm, P.minus,
  31912. * P.modulo, P.negated, P.plus, P.round, P.sin, P.sinh, P.squareRoot,
  31913. * P.tan, P.times, P.toDecimalPlaces, P.toExponential, P.toFixed,
  31914. * P.toNearest, P.toPower, P.toPrecision, P.toSignificantDigits,
  31915. * P.truncated, divide, getLn10, getPi, naturalExponential,
  31916. * naturalLogarithm, ceil, floor, round, trunc
  31917. * finiteToString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf,
  31918. * toStringBinary
  31919. * getBase10Exponent P.minus, P.plus, P.times, parseOther
  31920. * getLn10 P.logarithm, naturalLogarithm
  31921. * getPi P.acos, P.asin, P.atan, toLessThanHalfPi, atan2
  31922. * getPrecision P.precision, P.toFraction
  31923. * getZeroString digitsToString, finiteToString
  31924. * intPow P.toPower, parseOther
  31925. * isOdd toLessThanHalfPi
  31926. * maxOrMin max, min
  31927. * naturalExponential P.naturalExponential, P.toPower
  31928. * naturalLogarithm P.acosh, P.asinh, P.atanh, P.logarithm, P.naturalLogarithm,
  31929. * P.toPower, naturalExponential
  31930. * nonFiniteToString finiteToString, toStringBinary
  31931. * parseDecimal Decimal
  31932. * parseOther Decimal
  31933. * sin P.sin
  31934. * taylorSeries P.cosh, P.sinh, cos, sin
  31935. * toLessThanHalfPi P.cos, P.sin
  31936. * toStringBinary P.toBinary, P.toHexadecimal, P.toOctal
  31937. * truncate intPow
  31938. *
  31939. * Throws: P.logarithm, P.precision, P.toFraction, checkInt32, getLn10, getPi,
  31940. * naturalLogarithm, config, parseOther, random, Decimal
  31941. */
  31942. function digitsToString(d) {
  31943. var i,
  31944. k,
  31945. ws,
  31946. indexOfLastWord = d.length - 1,
  31947. str = '',
  31948. w = d[0];
  31949. if (indexOfLastWord > 0) {
  31950. str += w;
  31951. for (i = 1; i < indexOfLastWord; i++) {
  31952. ws = d[i] + '';
  31953. k = LOG_BASE - ws.length;
  31954. if (k) str += getZeroString(k);
  31955. str += ws;
  31956. }
  31957. w = d[i];
  31958. ws = w + '';
  31959. k = LOG_BASE - ws.length;
  31960. if (k) str += getZeroString(k);
  31961. } else if (w === 0) {
  31962. return '0';
  31963. }
  31964. // Remove trailing zeros of last w.
  31965. for (; w % 10 === 0;) {
  31966. w /= 10;
  31967. }return str + w;
  31968. }
  31969. function checkInt32(i, min, max) {
  31970. if (i !== ~~i || i < min || i > max) {
  31971. throw Error(invalidArgument + i);
  31972. }
  31973. }
  31974. /*
  31975. * Check 5 rounding digits if `repeating` is null, 4 otherwise.
  31976. * `repeating == null` if caller is `log` or `pow`,
  31977. * `repeating != null` if caller is `naturalLogarithm` or `naturalExponential`.
  31978. */
  31979. function checkRoundingDigits(d, i, rm, repeating) {
  31980. var di, k, r, rd;
  31981. // Get the length of the first word of the array d.
  31982. for (k = d[0]; k >= 10; k /= 10) {
  31983. --i;
  31984. } // Is the rounding digit in the first word of d?
  31985. if (--i < 0) {
  31986. i += LOG_BASE;
  31987. di = 0;
  31988. } else {
  31989. di = Math.ceil((i + 1) / LOG_BASE);
  31990. i %= LOG_BASE;
  31991. }
  31992. // i is the index (0 - 6) of the rounding digit.
  31993. // E.g. if within the word 3487563 the first rounding digit is 5,
  31994. // then i = 4, k = 1000, rd = 3487563 % 1000 = 563
  31995. k = mathpow(10, LOG_BASE - i);
  31996. rd = d[di] % k | 0;
  31997. if (repeating == null) {
  31998. if (i < 3) {
  31999. if (i == 0) rd = rd / 100 | 0;else if (i == 1) rd = rd / 10 | 0;
  32000. r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 50000 || rd == 0;
  32001. } else {
  32002. r = (rm < 4 && rd + 1 == k || rm > 3 && rd + 1 == k / 2) && (d[di + 1] / k / 100 | 0) == mathpow(10, i - 2) - 1 || (rd == k / 2 || rd == 0) && (d[di + 1] / k / 100 | 0) == 0;
  32003. }
  32004. } else {
  32005. if (i < 4) {
  32006. if (i == 0) rd = rd / 1000 | 0;else if (i == 1) rd = rd / 100 | 0;else if (i == 2) rd = rd / 10 | 0;
  32007. r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999;
  32008. } else {
  32009. r = ((repeating || rm < 4) && rd + 1 == k || !repeating && rm > 3 && rd + 1 == k / 2) && (d[di + 1] / k / 1000 | 0) == mathpow(10, i - 3) - 1;
  32010. }
  32011. }
  32012. return r;
  32013. }
  32014. // Convert string of `baseIn` to an array of numbers of `baseOut`.
  32015. // Eg. convertBase('255', 10, 16) returns [15, 15].
  32016. // Eg. convertBase('ff', 16, 10) returns [2, 5, 5].
  32017. function convertBase(str, baseIn, baseOut) {
  32018. var j,
  32019. arr = [0],
  32020. arrL,
  32021. i = 0,
  32022. strL = str.length;
  32023. for (; i < strL;) {
  32024. for (arrL = arr.length; arrL--;) {
  32025. arr[arrL] *= baseIn;
  32026. }arr[0] += NUMERALS.indexOf(str.charAt(i++));
  32027. for (j = 0; j < arr.length; j++) {
  32028. if (arr[j] > baseOut - 1) {
  32029. if (arr[j + 1] === void 0) arr[j + 1] = 0;
  32030. arr[j + 1] += arr[j] / baseOut | 0;
  32031. arr[j] %= baseOut;
  32032. }
  32033. }
  32034. }
  32035. return arr.reverse();
  32036. }
  32037. /*
  32038. * cos(x) = 1 - x^2/2! + x^4/4! - ...
  32039. * |x| < pi/2
  32040. *
  32041. */
  32042. function cosine(Ctor, x) {
  32043. var k,
  32044. y,
  32045. len = x.d.length;
  32046. // Argument reduction: cos(4x) = 8*(cos^4(x) - cos^2(x)) + 1
  32047. // i.e. cos(x) = 8*(cos^4(x/4) - cos^2(x/4)) + 1
  32048. // Estimate the optimum number of times to use the argument reduction.
  32049. if (len < 32) {
  32050. k = Math.ceil(len / 3);
  32051. y = Math.pow(4, -k).toString();
  32052. } else {
  32053. k = 16;
  32054. y = '2.3283064365386962890625e-10';
  32055. }
  32056. Ctor.precision += k;
  32057. x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1));
  32058. // Reverse argument reduction
  32059. for (var i = k; i--;) {
  32060. var cos2x = x.times(x);
  32061. x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1);
  32062. }
  32063. Ctor.precision -= k;
  32064. return x;
  32065. }
  32066. /*
  32067. * Perform division in the specified base.
  32068. */
  32069. var divide = function () {
  32070. // Assumes non-zero x and k, and hence non-zero result.
  32071. function multiplyInteger(x, k, base) {
  32072. var temp,
  32073. carry = 0,
  32074. i = x.length;
  32075. for (x = x.slice(); i--;) {
  32076. temp = x[i] * k + carry;
  32077. x[i] = temp % base | 0;
  32078. carry = temp / base | 0;
  32079. }
  32080. if (carry) x.unshift(carry);
  32081. return x;
  32082. }
  32083. function compare(a, b, aL, bL) {
  32084. var i, r;
  32085. if (aL != bL) {
  32086. r = aL > bL ? 1 : -1;
  32087. } else {
  32088. for (i = r = 0; i < aL; i++) {
  32089. if (a[i] != b[i]) {
  32090. r = a[i] > b[i] ? 1 : -1;
  32091. break;
  32092. }
  32093. }
  32094. }
  32095. return r;
  32096. }
  32097. function subtract(a, b, aL, base) {
  32098. var i = 0;
  32099. // Subtract b from a.
  32100. for (; aL--;) {
  32101. a[aL] -= i;
  32102. i = a[aL] < b[aL] ? 1 : 0;
  32103. a[aL] = i * base + a[aL] - b[aL];
  32104. }
  32105. // Remove leading zeros.
  32106. for (; !a[0] && a.length > 1;) {
  32107. a.shift();
  32108. }
  32109. }
  32110. return function (x, y, pr, rm, dp, base) {
  32111. var cmp,
  32112. e,
  32113. i,
  32114. k,
  32115. logBase,
  32116. more,
  32117. prod,
  32118. prodL,
  32119. q,
  32120. qd,
  32121. rem,
  32122. remL,
  32123. rem0,
  32124. sd,
  32125. t,
  32126. xi,
  32127. xL,
  32128. yd0,
  32129. yL,
  32130. yz,
  32131. Ctor = x.constructor,
  32132. sign = x.s == y.s ? 1 : -1,
  32133. xd = x.d,
  32134. yd = y.d;
  32135. // Either NaN, Infinity or 0?
  32136. if (!xd || !xd[0] || !yd || !yd[0]) {
  32137. return new Ctor( // Return NaN if either NaN, or both Infinity or 0.
  32138. !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN :
  32139. // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
  32140. xd && xd[0] == 0 || !yd ? sign * 0 : sign / 0);
  32141. }
  32142. if (base) {
  32143. logBase = 1;
  32144. e = x.e - y.e;
  32145. } else {
  32146. base = BASE;
  32147. logBase = LOG_BASE;
  32148. e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase);
  32149. }
  32150. yL = yd.length;
  32151. xL = xd.length;
  32152. q = new Ctor(sign);
  32153. qd = q.d = [];
  32154. // Result exponent may be one less than e.
  32155. // The digit array of a Decimal from toStringBinary may have trailing zeros.
  32156. for (i = 0; yd[i] == (xd[i] || 0); i++) {}
  32157. if (yd[i] > (xd[i] || 0)) e--;
  32158. if (pr == null) {
  32159. sd = pr = Ctor.precision;
  32160. rm = Ctor.rounding;
  32161. } else if (dp) {
  32162. sd = pr + (x.e - y.e) + 1;
  32163. } else {
  32164. sd = pr;
  32165. }
  32166. if (sd < 0) {
  32167. qd.push(1);
  32168. more = true;
  32169. } else {
  32170. // Convert precision in number of base 10 digits to base 1e7 digits.
  32171. sd = sd / logBase + 2 | 0;
  32172. i = 0;
  32173. // divisor < 1e7
  32174. if (yL == 1) {
  32175. k = 0;
  32176. yd = yd[0];
  32177. sd++;
  32178. // k is the carry.
  32179. for (; (i < xL || k) && sd--; i++) {
  32180. t = k * base + (xd[i] || 0);
  32181. qd[i] = t / yd | 0;
  32182. k = t % yd | 0;
  32183. }
  32184. more = k || i < xL;
  32185. // divisor >= 1e7
  32186. } else {
  32187. // Normalise xd and yd so highest order digit of yd is >= base/2
  32188. k = base / (yd[0] + 1) | 0;
  32189. if (k > 1) {
  32190. yd = multiplyInteger(yd, k, base);
  32191. xd = multiplyInteger(xd, k, base);
  32192. yL = yd.length;
  32193. xL = xd.length;
  32194. }
  32195. xi = yL;
  32196. rem = xd.slice(0, yL);
  32197. remL = rem.length;
  32198. // Add zeros to make remainder as long as divisor.
  32199. for (; remL < yL;) {
  32200. rem[remL++] = 0;
  32201. }yz = yd.slice();
  32202. yz.unshift(0);
  32203. yd0 = yd[0];
  32204. if (yd[1] >= base / 2) ++yd0;
  32205. do {
  32206. k = 0;
  32207. // Compare divisor and remainder.
  32208. cmp = compare(yd, rem, yL, remL);
  32209. // If divisor < remainder.
  32210. if (cmp < 0) {
  32211. // Calculate trial digit, k.
  32212. rem0 = rem[0];
  32213. if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
  32214. // k will be how many times the divisor goes into the current remainder.
  32215. k = rem0 / yd0 | 0;
  32216. // Algorithm:
  32217. // 1. product = divisor * trial digit (k)
  32218. // 2. if product > remainder: product -= divisor, k--
  32219. // 3. remainder -= product
  32220. // 4. if product was < remainder at 2:
  32221. // 5. compare new remainder and divisor
  32222. // 6. If remainder > divisor: remainder -= divisor, k++
  32223. if (k > 1) {
  32224. if (k >= base) k = base - 1;
  32225. // product = divisor * trial digit.
  32226. prod = multiplyInteger(yd, k, base);
  32227. prodL = prod.length;
  32228. remL = rem.length;
  32229. // Compare product and remainder.
  32230. cmp = compare(prod, rem, prodL, remL);
  32231. // product > remainder.
  32232. if (cmp == 1) {
  32233. k--;
  32234. // Subtract divisor from product.
  32235. subtract(prod, yL < prodL ? yz : yd, prodL, base);
  32236. }
  32237. } else {
  32238. // cmp is -1.
  32239. // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1
  32240. // to avoid it. If k is 1 there is a need to compare yd and rem again below.
  32241. if (k == 0) cmp = k = 1;
  32242. prod = yd.slice();
  32243. }
  32244. prodL = prod.length;
  32245. if (prodL < remL) prod.unshift(0);
  32246. // Subtract product from remainder.
  32247. subtract(rem, prod, remL, base);
  32248. // If product was < previous remainder.
  32249. if (cmp == -1) {
  32250. remL = rem.length;
  32251. // Compare divisor and new remainder.
  32252. cmp = compare(yd, rem, yL, remL);
  32253. // If divisor < new remainder, subtract divisor from remainder.
  32254. if (cmp < 1) {
  32255. k++;
  32256. // Subtract divisor from remainder.
  32257. subtract(rem, yL < remL ? yz : yd, remL, base);
  32258. }
  32259. }
  32260. remL = rem.length;
  32261. } else if (cmp === 0) {
  32262. k++;
  32263. rem = [0];
  32264. } // if cmp === 1, k will be 0
  32265. // Add the next digit, k, to the result array.
  32266. qd[i++] = k;
  32267. // Update the remainder.
  32268. if (cmp && rem[0]) {
  32269. rem[remL++] = xd[xi] || 0;
  32270. } else {
  32271. rem = [xd[xi]];
  32272. remL = 1;
  32273. }
  32274. } while ((xi++ < xL || rem[0] !== void 0) && sd--);
  32275. more = rem[0] !== void 0;
  32276. }
  32277. // Leading zero?
  32278. if (!qd[0]) qd.shift();
  32279. }
  32280. // logBase is 1 when divide is being used for base conversion.
  32281. if (logBase == 1) {
  32282. q.e = e;
  32283. inexact = more;
  32284. } else {
  32285. // To calculate q.e, first get the number of digits of qd[0].
  32286. for (i = 1, k = qd[0]; k >= 10; k /= 10) {
  32287. i++;
  32288. }q.e = i + e * logBase - 1;
  32289. finalise(q, dp ? pr + q.e + 1 : pr, rm, more);
  32290. }
  32291. return q;
  32292. };
  32293. }();
  32294. /*
  32295. * Round `x` to `sd` significant digits using rounding mode `rm`.
  32296. * Check for over/under-flow.
  32297. */
  32298. function finalise(x, sd, rm, isTruncated) {
  32299. var digits,
  32300. i,
  32301. j,
  32302. k,
  32303. rd,
  32304. roundUp,
  32305. w,
  32306. xd,
  32307. xdi,
  32308. Ctor = x.constructor;
  32309. // Don't round if sd is null or undefined.
  32310. out: if (sd != null) {
  32311. xd = x.d;
  32312. // Infinity/NaN.
  32313. if (!xd) return x;
  32314. // rd: the rounding digit, i.e. the digit after the digit that may be rounded up.
  32315. // w: the word of xd containing rd, a base 1e7 number.
  32316. // xdi: the index of w within xd.
  32317. // digits: the number of digits of w.
  32318. // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if
  32319. // they had leading zeros)
  32320. // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero).
  32321. // Get the length of the first word of the digits array xd.
  32322. for (digits = 1, k = xd[0]; k >= 10; k /= 10) {
  32323. digits++;
  32324. }i = sd - digits;
  32325. // Is the rounding digit in the first word of xd?
  32326. if (i < 0) {
  32327. i += LOG_BASE;
  32328. j = sd;
  32329. w = xd[xdi = 0];
  32330. // Get the rounding digit at index j of w.
  32331. rd = w / mathpow(10, digits - j - 1) % 10 | 0;
  32332. } else {
  32333. xdi = Math.ceil((i + 1) / LOG_BASE);
  32334. k = xd.length;
  32335. if (xdi >= k) {
  32336. if (isTruncated) {
  32337. // Needed by `naturalExponential`, `naturalLogarithm` and `squareRoot`.
  32338. for (; k++ <= xdi;) {
  32339. xd.push(0);
  32340. }w = rd = 0;
  32341. digits = 1;
  32342. i %= LOG_BASE;
  32343. j = i - LOG_BASE + 1;
  32344. } else {
  32345. break out;
  32346. }
  32347. } else {
  32348. w = k = xd[xdi];
  32349. // Get the number of digits of w.
  32350. for (digits = 1; k >= 10; k /= 10) {
  32351. digits++;
  32352. } // Get the index of rd within w.
  32353. i %= LOG_BASE;
  32354. // Get the index of rd within w, adjusted for leading zeros.
  32355. // The number of leading zeros of w is given by LOG_BASE - digits.
  32356. j = i - LOG_BASE + digits;
  32357. // Get the rounding digit at index j of w.
  32358. rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0;
  32359. }
  32360. }
  32361. // Are there any non-zero digits after the rounding digit?
  32362. isTruncated = isTruncated || sd < 0 || xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1));
  32363. // The expression `w % mathpow(10, digits - j - 1)` returns all the digits of w to the right
  32364. // of the digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression
  32365. // will give 714.
  32366. roundUp = rm < 4 ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 &&
  32367. // Check whether the digit to the left of the rounding digit is odd.
  32368. (i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7));
  32369. if (sd < 1 || !xd[0]) {
  32370. xd.length = 0;
  32371. if (roundUp) {
  32372. // Convert sd to decimal places.
  32373. sd -= x.e + 1;
  32374. // 1, 0.1, 0.01, 0.001, 0.0001 etc.
  32375. xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE);
  32376. x.e = -sd || 0;
  32377. } else {
  32378. // Zero.
  32379. xd[0] = x.e = 0;
  32380. }
  32381. return x;
  32382. }
  32383. // Remove excess digits.
  32384. if (i == 0) {
  32385. xd.length = xdi;
  32386. k = 1;
  32387. xdi--;
  32388. } else {
  32389. xd.length = xdi + 1;
  32390. k = mathpow(10, LOG_BASE - i);
  32391. // E.g. 56700 becomes 56000 if 7 is the rounding digit.
  32392. // j > 0 means i > number of leading zeros of w.
  32393. xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0;
  32394. }
  32395. if (roundUp) {
  32396. for (;;) {
  32397. // Is the digit to be rounded up in the first word of xd?
  32398. if (xdi == 0) {
  32399. // i will be the length of xd[0] before k is added.
  32400. for (i = 1, j = xd[0]; j >= 10; j /= 10) {
  32401. i++;
  32402. }j = xd[0] += k;
  32403. for (k = 1; j >= 10; j /= 10) {
  32404. k++;
  32405. } // if i != k the length has increased.
  32406. if (i != k) {
  32407. x.e++;
  32408. if (xd[0] == BASE) xd[0] = 1;
  32409. }
  32410. break;
  32411. } else {
  32412. xd[xdi] += k;
  32413. if (xd[xdi] != BASE) break;
  32414. xd[xdi--] = 0;
  32415. k = 1;
  32416. }
  32417. }
  32418. }
  32419. // Remove trailing zeros.
  32420. for (i = xd.length; xd[--i] === 0;) {
  32421. xd.pop();
  32422. }
  32423. }
  32424. if (external) {
  32425. // Overflow?
  32426. if (x.e > Ctor.maxE) {
  32427. // Infinity.
  32428. x.d = null;
  32429. x.e = NaN;
  32430. // Underflow?
  32431. } else if (x.e < Ctor.minE) {
  32432. // Zero.
  32433. x.e = 0;
  32434. x.d = [0];
  32435. // Ctor.underflow = true;
  32436. } // else Ctor.underflow = false;
  32437. }
  32438. return x;
  32439. }
  32440. function finiteToString(x, isExp, sd) {
  32441. if (!x.isFinite()) return nonFiniteToString(x);
  32442. var k,
  32443. e = x.e,
  32444. str = digitsToString(x.d),
  32445. len = str.length;
  32446. if (isExp) {
  32447. if (sd && (k = sd - len) > 0) {
  32448. str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k);
  32449. } else if (len > 1) {
  32450. str = str.charAt(0) + '.' + str.slice(1);
  32451. }
  32452. str = str + (x.e < 0 ? 'e' : 'e+') + x.e;
  32453. } else if (e < 0) {
  32454. str = '0.' + getZeroString(-e - 1) + str;
  32455. if (sd && (k = sd - len) > 0) str += getZeroString(k);
  32456. } else if (e >= len) {
  32457. str += getZeroString(e + 1 - len);
  32458. if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k);
  32459. } else {
  32460. if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k);
  32461. if (sd && (k = sd - len) > 0) {
  32462. if (e + 1 === len) str += '.';
  32463. str += getZeroString(k);
  32464. }
  32465. }
  32466. return str;
  32467. }
  32468. // Calculate the base 10 exponent from the base 1e7 exponent.
  32469. function getBase10Exponent(digits, e) {
  32470. var w = digits[0];
  32471. // Add the number of digits of the first word of the digits array.
  32472. for (e *= LOG_BASE; w >= 10; w /= 10) {
  32473. e++;
  32474. }return e;
  32475. }
  32476. function getLn10(Ctor, sd, pr) {
  32477. if (sd > LN10_PRECISION) {
  32478. // Reset global state in case the exception is caught.
  32479. external = true;
  32480. if (pr) Ctor.precision = pr;
  32481. throw Error(precisionLimitExceeded);
  32482. }
  32483. return finalise(new Ctor(LN10), sd, 1, true);
  32484. }
  32485. function getPi(Ctor, sd, rm) {
  32486. if (sd > PI_PRECISION) throw Error(precisionLimitExceeded);
  32487. return finalise(new Ctor(PI), sd, rm, true);
  32488. }
  32489. function getPrecision(digits) {
  32490. var w = digits.length - 1,
  32491. len = w * LOG_BASE + 1;
  32492. w = digits[w];
  32493. // If non-zero...
  32494. if (w) {
  32495. // Subtract the number of trailing zeros of the last word.
  32496. for (; w % 10 == 0; w /= 10) {
  32497. len--;
  32498. } // Add the number of digits of the first word.
  32499. for (w = digits[0]; w >= 10; w /= 10) {
  32500. len++;
  32501. }
  32502. }
  32503. return len;
  32504. }
  32505. function getZeroString(k) {
  32506. var zs = '';
  32507. for (; k--;) {
  32508. zs += '0';
  32509. }return zs;
  32510. }
  32511. /*
  32512. * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an
  32513. * integer of type number.
  32514. *
  32515. * Implements 'exponentiation by squaring'. Called by `pow` and `parseOther`.
  32516. *
  32517. */
  32518. function intPow(Ctor, x, n, pr) {
  32519. var isTruncated,
  32520. r = new Ctor(1),
  32521. // Max n of 9007199254740991 takes 53 loop iterations.
  32522. // Maximum digits array length; leaves [28, 34] guard digits.
  32523. k = Math.ceil(pr / LOG_BASE + 4);
  32524. external = false;
  32525. for (;;) {
  32526. if (n % 2) {
  32527. r = r.times(x);
  32528. if (truncate(r.d, k)) isTruncated = true;
  32529. }
  32530. n = mathfloor(n / 2);
  32531. if (n === 0) {
  32532. // To ensure correct rounding when r.d is truncated, increment the last word if it is zero.
  32533. n = r.d.length - 1;
  32534. if (isTruncated && r.d[n] === 0) ++r.d[n];
  32535. break;
  32536. }
  32537. x = x.times(x);
  32538. truncate(x.d, k);
  32539. }
  32540. external = true;
  32541. return r;
  32542. }
  32543. function isOdd(n) {
  32544. return n.d[n.d.length - 1] & 1;
  32545. }
  32546. /*
  32547. * Handle `max` and `min`. `ltgt` is 'lt' or 'gt'.
  32548. */
  32549. function maxOrMin(Ctor, args, ltgt) {
  32550. var y,
  32551. x = new Ctor(args[0]),
  32552. i = 0;
  32553. for (; ++i < args.length;) {
  32554. y = new Ctor(args[i]);
  32555. if (!y.s) {
  32556. x = y;
  32557. break;
  32558. } else if (x[ltgt](y)) {
  32559. x = y;
  32560. }
  32561. }
  32562. return x;
  32563. }
  32564. /*
  32565. * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant
  32566. * digits.
  32567. *
  32568. * Taylor/Maclaurin series.
  32569. *
  32570. * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ...
  32571. *
  32572. * Argument reduction:
  32573. * Repeat x = x / 32, k += 5, until |x| < 0.1
  32574. * exp(x) = exp(x / 2^k)^(2^k)
  32575. *
  32576. * Previously, the argument was initially reduced by
  32577. * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10)
  32578. * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was
  32579. * found to be slower than just dividing repeatedly by 32 as above.
  32580. *
  32581. * Max integer argument: exp('20723265836946413') = 6.3e+9000000000000000
  32582. * Min integer argument: exp('-20723265836946411') = 1.2e-9000000000000000
  32583. * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324)
  32584. *
  32585. * exp(Infinity) = Infinity
  32586. * exp(-Infinity) = 0
  32587. * exp(NaN) = NaN
  32588. * exp(±0) = 1
  32589. *
  32590. * exp(x) is non-terminating for any finite, non-zero x.
  32591. *
  32592. * The result will always be correctly rounded.
  32593. *
  32594. */
  32595. function naturalExponential(x, sd) {
  32596. var denominator,
  32597. guard,
  32598. j,
  32599. pow,
  32600. sum,
  32601. t,
  32602. wpr,
  32603. rep = 0,
  32604. i = 0,
  32605. k = 0,
  32606. Ctor = x.constructor,
  32607. rm = Ctor.rounding,
  32608. pr = Ctor.precision;
  32609. // 0/NaN/Infinity?
  32610. if (!x.d || !x.d[0] || x.e > 17) {
  32611. return new Ctor(x.d ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0 : x.s ? x.s < 0 ? 0 : x : 0 / 0);
  32612. }
  32613. if (sd == null) {
  32614. external = false;
  32615. wpr = pr;
  32616. } else {
  32617. wpr = sd;
  32618. }
  32619. t = new Ctor(0.03125);
  32620. // while abs(x) >= 0.1
  32621. while (x.e > -2) {
  32622. // x = x / 2^5
  32623. x = x.times(t);
  32624. k += 5;
  32625. }
  32626. // Use 2 * log10(2^k) + 5 (empirically derived) to estimate the increase in precision
  32627. // necessary to ensure the first 4 rounding digits are correct.
  32628. guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0;
  32629. wpr += guard;
  32630. denominator = pow = sum = new Ctor(1);
  32631. Ctor.precision = wpr;
  32632. for (;;) {
  32633. pow = finalise(pow.times(x), wpr, 1);
  32634. denominator = denominator.times(++i);
  32635. t = sum.plus(divide(pow, denominator, wpr, 1));
  32636. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  32637. j = k;
  32638. while (j--) {
  32639. sum = finalise(sum.times(sum), wpr, 1);
  32640. } // Check to see if the first 4 rounding digits are [49]999.
  32641. // If so, repeat the summation with a higher precision, otherwise
  32642. // e.g. with precision: 18, rounding: 1
  32643. // exp(18.404272462595034083567793919843761) = 98372560.1229999999 (should be 98372560.123)
  32644. // `wpr - guard` is the index of first rounding digit.
  32645. if (sd == null) {
  32646. if (rep < 3 && checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  32647. Ctor.precision = wpr += 10;
  32648. denominator = pow = t = new Ctor(1);
  32649. i = 0;
  32650. rep++;
  32651. } else {
  32652. return finalise(sum, Ctor.precision = pr, rm, external = true);
  32653. }
  32654. } else {
  32655. Ctor.precision = pr;
  32656. return sum;
  32657. }
  32658. }
  32659. sum = t;
  32660. }
  32661. }
  32662. /*
  32663. * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant
  32664. * digits.
  32665. *
  32666. * ln(-n) = NaN
  32667. * ln(0) = -Infinity
  32668. * ln(-0) = -Infinity
  32669. * ln(1) = 0
  32670. * ln(Infinity) = Infinity
  32671. * ln(-Infinity) = NaN
  32672. * ln(NaN) = NaN
  32673. *
  32674. * ln(n) (n != 1) is non-terminating.
  32675. *
  32676. */
  32677. function naturalLogarithm(y, sd) {
  32678. var c,
  32679. c0,
  32680. denominator,
  32681. e,
  32682. numerator,
  32683. rep,
  32684. sum,
  32685. t,
  32686. wpr,
  32687. x1,
  32688. x2,
  32689. n = 1,
  32690. guard = 10,
  32691. x = y,
  32692. xd = x.d,
  32693. Ctor = x.constructor,
  32694. rm = Ctor.rounding,
  32695. pr = Ctor.precision;
  32696. // Is x negative or Infinity, NaN, 0 or 1?
  32697. if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) {
  32698. return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x);
  32699. }
  32700. if (sd == null) {
  32701. external = false;
  32702. wpr = pr;
  32703. } else {
  32704. wpr = sd;
  32705. }
  32706. Ctor.precision = wpr += guard;
  32707. c = digitsToString(xd);
  32708. c0 = c.charAt(0);
  32709. if (Math.abs(e = x.e) < 1.5e15) {
  32710. // Argument reduction.
  32711. // The series converges faster the closer the argument is to 1, so using
  32712. // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b
  32713. // multiply the argument by itself until the leading digits of the significand are 7, 8, 9,
  32714. // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can
  32715. // later be divided by this number, then separate out the power of 10 using
  32716. // ln(a*10^b) = ln(a) + b*ln(10).
  32717. // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14).
  32718. //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) {
  32719. // max n is 6 (gives 0.7 - 1.3)
  32720. while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) {
  32721. x = x.times(y);
  32722. c = digitsToString(x.d);
  32723. c0 = c.charAt(0);
  32724. n++;
  32725. }
  32726. e = x.e;
  32727. if (c0 > 1) {
  32728. x = new Ctor('0.' + c);
  32729. e++;
  32730. } else {
  32731. x = new Ctor(c0 + '.' + c.slice(1));
  32732. }
  32733. } else {
  32734. // The argument reduction method above may result in overflow if the argument y is a massive
  32735. // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this
  32736. // function using ln(x*10^e) = ln(x) + e*ln(10).
  32737. t = getLn10(Ctor, wpr + 2, pr).times(e + '');
  32738. x = naturalLogarithm(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t);
  32739. Ctor.precision = pr;
  32740. return sd == null ? finalise(x, pr, rm, external = true) : x;
  32741. }
  32742. // x1 is x reduced to a value near 1.
  32743. x1 = x;
  32744. // Taylor series.
  32745. // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...)
  32746. // where x = (y - 1)/(y + 1) (|x| < 1)
  32747. sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1);
  32748. x2 = finalise(x.times(x), wpr, 1);
  32749. denominator = 3;
  32750. for (;;) {
  32751. numerator = finalise(numerator.times(x2), wpr, 1);
  32752. t = sum.plus(divide(numerator, new Ctor(denominator), wpr, 1));
  32753. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  32754. sum = sum.times(2);
  32755. // Reverse the argument reduction. Check that e is not 0 because, besides preventing an
  32756. // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0.
  32757. if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + ''));
  32758. sum = divide(sum, new Ctor(n), wpr, 1);
  32759. // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has
  32760. // been repeated previously) and the first 4 rounding digits 9999?
  32761. // If so, restart the summation with a higher precision, otherwise
  32762. // e.g. with precision: 12, rounding: 1
  32763. // ln(135520028.6126091714265381533) = 18.7246299999 when it should be 18.72463.
  32764. // `wpr - guard` is the index of first rounding digit.
  32765. if (sd == null) {
  32766. if (checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  32767. Ctor.precision = wpr += guard;
  32768. t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1);
  32769. x2 = finalise(x.times(x), wpr, 1);
  32770. denominator = rep = 1;
  32771. } else {
  32772. return finalise(sum, Ctor.precision = pr, rm, external = true);
  32773. }
  32774. } else {
  32775. Ctor.precision = pr;
  32776. return sum;
  32777. }
  32778. }
  32779. sum = t;
  32780. denominator += 2;
  32781. }
  32782. }
  32783. // ±Infinity, NaN.
  32784. function nonFiniteToString(x) {
  32785. // Unsigned.
  32786. return String(x.s * x.s / 0);
  32787. }
  32788. /*
  32789. * Parse the value of a new Decimal `x` from string `str`.
  32790. */
  32791. function parseDecimal(x, str) {
  32792. var e, i, len;
  32793. // Decimal point?
  32794. if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');
  32795. // Exponential form?
  32796. if ((i = str.search(/e/i)) > 0) {
  32797. // Determine exponent.
  32798. if (e < 0) e = i;
  32799. e += +str.slice(i + 1);
  32800. str = str.substring(0, i);
  32801. } else if (e < 0) {
  32802. // Integer.
  32803. e = str.length;
  32804. }
  32805. // Determine leading zeros.
  32806. for (i = 0; str.charCodeAt(i) === 48; i++) {}
  32807. // Determine trailing zeros.
  32808. for (len = str.length; str.charCodeAt(len - 1) === 48; --len) {}
  32809. str = str.slice(i, len);
  32810. if (str) {
  32811. len -= i;
  32812. x.e = e = e - i - 1;
  32813. x.d = [];
  32814. // Transform base
  32815. // e is the base 10 exponent.
  32816. // i is where to slice str to get the first word of the digits array.
  32817. i = (e + 1) % LOG_BASE;
  32818. if (e < 0) i += LOG_BASE;
  32819. if (i < len) {
  32820. if (i) x.d.push(+str.slice(0, i));
  32821. for (len -= LOG_BASE; i < len;) {
  32822. x.d.push(+str.slice(i, i += LOG_BASE));
  32823. }str = str.slice(i);
  32824. i = LOG_BASE - str.length;
  32825. } else {
  32826. i -= len;
  32827. }
  32828. for (; i--;) {
  32829. str += '0';
  32830. }x.d.push(+str);
  32831. if (external) {
  32832. // Overflow?
  32833. if (x.e > x.constructor.maxE) {
  32834. // Infinity.
  32835. x.d = null;
  32836. x.e = NaN;
  32837. // Underflow?
  32838. } else if (x.e < x.constructor.minE) {
  32839. // Zero.
  32840. x.e = 0;
  32841. x.d = [0];
  32842. // x.constructor.underflow = true;
  32843. } // else x.constructor.underflow = false;
  32844. }
  32845. } else {
  32846. // Zero.
  32847. x.e = 0;
  32848. x.d = [0];
  32849. }
  32850. return x;
  32851. }
  32852. /*
  32853. * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value.
  32854. */
  32855. function parseOther(x, str) {
  32856. var base, Ctor, divisor, i, isFloat, len, p, xd, xe;
  32857. if (str === 'Infinity' || str === 'NaN') {
  32858. if (!+str) x.s = NaN;
  32859. x.e = NaN;
  32860. x.d = null;
  32861. return x;
  32862. }
  32863. if (isHex.test(str)) {
  32864. base = 16;
  32865. str = str.toLowerCase();
  32866. } else if (isBinary.test(str)) {
  32867. base = 2;
  32868. } else if (isOctal.test(str)) {
  32869. base = 8;
  32870. } else {
  32871. throw Error(invalidArgument + str);
  32872. }
  32873. // Is there a binary exponent part?
  32874. i = str.search(/p/i);
  32875. if (i > 0) {
  32876. p = +str.slice(i + 1);
  32877. str = str.substring(2, i);
  32878. } else {
  32879. str = str.slice(2);
  32880. }
  32881. // Convert `str` as an integer then divide the result by `base` raised to a power such that the
  32882. // fraction part will be restored.
  32883. i = str.indexOf('.');
  32884. isFloat = i >= 0;
  32885. Ctor = x.constructor;
  32886. if (isFloat) {
  32887. str = str.replace('.', '');
  32888. len = str.length;
  32889. i = len - i;
  32890. // log[10](16) = 1.2041... , log[10](88) = 1.9444....
  32891. divisor = intPow(Ctor, new Ctor(base), i, i * 2);
  32892. }
  32893. xd = convertBase(str, base, BASE);
  32894. xe = xd.length - 1;
  32895. // Remove trailing zeros.
  32896. for (i = xe; xd[i] === 0; --i) {
  32897. xd.pop();
  32898. }if (i < 0) return new Ctor(x.s * 0);
  32899. x.e = getBase10Exponent(xd, xe);
  32900. x.d = xd;
  32901. external = false;
  32902. // At what precision to perform the division to ensure exact conversion?
  32903. // maxDecimalIntegerPartDigitCount = ceil(log[10](b) * otherBaseIntegerPartDigitCount)
  32904. // log[10](2) = 0.30103, log[10](8) = 0.90309, log[10](16) = 1.20412
  32905. // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits.
  32906. // maxDecimalFractionPartDigitCount = {Hex:4|Oct:3|Bin:1} * otherBaseFractionPartDigitCount
  32907. // Therefore using 4 * the number of digits of str will always be enough.
  32908. if (isFloat) x = divide(x, divisor, len * 4);
  32909. // Multiply by the binary exponent part if present.
  32910. if (p) x = x.times(Math.abs(p) < 54 ? Math.pow(2, p) : Decimal.pow(2, p));
  32911. external = true;
  32912. return x;
  32913. }
  32914. /*
  32915. * sin(x) = x - x^3/3! + x^5/5! - ...
  32916. * |x| < pi/2
  32917. *
  32918. */
  32919. function sine(Ctor, x) {
  32920. var k,
  32921. len = x.d.length;
  32922. if (len < 3) return taylorSeries(Ctor, 2, x, x);
  32923. // Argument reduction: sin(5x) = 16*sin^5(x) - 20*sin^3(x) + 5*sin(x)
  32924. // i.e. sin(x) = 16*sin^5(x/5) - 20*sin^3(x/5) + 5*sin(x/5)
  32925. // and sin(x) = sin(x/5)(5 + sin^2(x/5)(16sin^2(x/5) - 20))
  32926. // Estimate the optimum number of times to use the argument reduction.
  32927. k = 1.4 * Math.sqrt(len);
  32928. k = k > 16 ? 16 : k | 0;
  32929. // Max k before Math.pow precision loss is 22
  32930. x = x.times(Math.pow(5, -k));
  32931. x = taylorSeries(Ctor, 2, x, x);
  32932. // Reverse argument reduction
  32933. var sin2_x,
  32934. d5 = new Ctor(5),
  32935. d16 = new Ctor(16),
  32936. d20 = new Ctor(20);
  32937. for (; k--;) {
  32938. sin2_x = x.times(x);
  32939. x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20))));
  32940. }
  32941. return x;
  32942. }
  32943. // Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`.
  32944. function taylorSeries(Ctor, n, x, y, isHyperbolic) {
  32945. var j,
  32946. t,
  32947. u,
  32948. x2,
  32949. i = 1,
  32950. pr = Ctor.precision,
  32951. k = Math.ceil(pr / LOG_BASE);
  32952. external = false;
  32953. x2 = x.times(x);
  32954. u = new Ctor(y);
  32955. for (;;) {
  32956. t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1);
  32957. u = isHyperbolic ? y.plus(t) : y.minus(t);
  32958. y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1);
  32959. t = u.plus(y);
  32960. if (t.d[k] !== void 0) {
  32961. for (j = k; t.d[j] === u.d[j] && j--;) {}
  32962. if (j == -1) break;
  32963. }
  32964. j = u;
  32965. u = y;
  32966. y = t;
  32967. t = j;
  32968. i++;
  32969. }
  32970. external = true;
  32971. t.d.length = k + 1;
  32972. return t;
  32973. }
  32974. // Return the absolute value of `x` reduced to less than or equal to half pi.
  32975. function toLessThanHalfPi(Ctor, x) {
  32976. var t,
  32977. isNeg = x.s < 0,
  32978. pi = getPi(Ctor, Ctor.precision, 1),
  32979. halfPi = pi.times(0.5);
  32980. x = x.abs();
  32981. if (x.lte(halfPi)) {
  32982. quadrant = isNeg ? 4 : 1;
  32983. return x;
  32984. }
  32985. t = x.divToInt(pi);
  32986. if (t.isZero()) {
  32987. quadrant = isNeg ? 3 : 2;
  32988. } else {
  32989. x = x.minus(t.times(pi));
  32990. // 0 <= x < pi
  32991. if (x.lte(halfPi)) {
  32992. quadrant = isOdd(t) ? isNeg ? 2 : 3 : isNeg ? 4 : 1;
  32993. return x;
  32994. }
  32995. quadrant = isOdd(t) ? isNeg ? 1 : 4 : isNeg ? 3 : 2;
  32996. }
  32997. return x.minus(pi).abs();
  32998. }
  32999. /*
  33000. * Return the value of Decimal `x` as a string in base `baseOut`.
  33001. *
  33002. * If the optional `sd` argument is present include a binary exponent suffix.
  33003. */
  33004. function toStringBinary(x, baseOut, sd, rm) {
  33005. var base,
  33006. e,
  33007. i,
  33008. k,
  33009. len,
  33010. roundUp,
  33011. str,
  33012. xd,
  33013. y,
  33014. Ctor = x.constructor,
  33015. isExp = sd !== void 0;
  33016. if (isExp) {
  33017. checkInt32(sd, 1, MAX_DIGITS);
  33018. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  33019. } else {
  33020. sd = Ctor.precision;
  33021. rm = Ctor.rounding;
  33022. }
  33023. if (!x.isFinite()) {
  33024. str = nonFiniteToString(x);
  33025. } else {
  33026. str = finiteToString(x);
  33027. i = str.indexOf('.');
  33028. // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required:
  33029. // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10))
  33030. // minBinaryExponent = floor(decimalExponent * log[2](10))
  33031. // log[2](10) = 3.321928094887362347870319429489390175864
  33032. if (isExp) {
  33033. base = 2;
  33034. if (baseOut == 16) {
  33035. sd = sd * 4 - 3;
  33036. } else if (baseOut == 8) {
  33037. sd = sd * 3 - 2;
  33038. }
  33039. } else {
  33040. base = baseOut;
  33041. }
  33042. // Convert the number as an integer then divide the result by its base raised to a power such
  33043. // that the fraction part will be restored.
  33044. // Non-integer.
  33045. if (i >= 0) {
  33046. str = str.replace('.', '');
  33047. y = new Ctor(1);
  33048. y.e = str.length - i;
  33049. y.d = convertBase(finiteToString(y), 10, base);
  33050. y.e = y.d.length;
  33051. }
  33052. xd = convertBase(str, 10, base);
  33053. e = len = xd.length;
  33054. // Remove trailing zeros.
  33055. for (; xd[--len] == 0;) {
  33056. xd.pop();
  33057. }if (!xd[0]) {
  33058. str = isExp ? '0p+0' : '0';
  33059. } else {
  33060. if (i < 0) {
  33061. e--;
  33062. } else {
  33063. x = new Ctor(x);
  33064. x.d = xd;
  33065. x.e = e;
  33066. x = divide(x, y, sd, rm, 0, base);
  33067. xd = x.d;
  33068. e = x.e;
  33069. roundUp = inexact;
  33070. }
  33071. // The rounding digit, i.e. the digit after the digit that may be rounded up.
  33072. i = xd[sd];
  33073. k = base / 2;
  33074. roundUp = roundUp || xd[sd + 1] !== void 0;
  33075. roundUp = rm < 4 ? (i !== void 0 || roundUp) && (rm === 0 || rm === (x.s < 0 ? 3 : 2)) : i > k || i === k && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 || rm === (x.s < 0 ? 8 : 7));
  33076. xd.length = sd;
  33077. if (roundUp) {
  33078. // Rounding up may mean the previous digit has to be rounded up and so on.
  33079. for (; ++xd[--sd] > base - 1;) {
  33080. xd[sd] = 0;
  33081. if (!sd) {
  33082. ++e;
  33083. xd.unshift(1);
  33084. }
  33085. }
  33086. }
  33087. // Determine trailing zeros.
  33088. for (len = xd.length; !xd[len - 1]; --len) {}
  33089. // E.g. [4, 11, 15] becomes 4bf.
  33090. for (i = 0, str = ''; i < len; i++) {
  33091. str += NUMERALS.charAt(xd[i]);
  33092. } // Add binary exponent suffix?
  33093. if (isExp) {
  33094. if (len > 1) {
  33095. if (baseOut == 16 || baseOut == 8) {
  33096. i = baseOut == 16 ? 4 : 3;
  33097. for (--len; len % i; len++) {
  33098. str += '0';
  33099. }xd = convertBase(str, base, baseOut);
  33100. for (len = xd.length; !xd[len - 1]; --len) {}
  33101. // xd[0] will always be be 1
  33102. for (i = 1, str = '1.'; i < len; i++) {
  33103. str += NUMERALS.charAt(xd[i]);
  33104. }
  33105. } else {
  33106. str = str.charAt(0) + '.' + str.slice(1);
  33107. }
  33108. }
  33109. str = str + (e < 0 ? 'p' : 'p+') + e;
  33110. } else if (e < 0) {
  33111. for (; ++e;) {
  33112. str = '0' + str;
  33113. }str = '0.' + str;
  33114. } else {
  33115. if (++e > len) for (e -= len; e--;) {
  33116. str += '0';
  33117. } else if (e < len) str = str.slice(0, e) + '.' + str.slice(e);
  33118. }
  33119. }
  33120. str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str;
  33121. }
  33122. return x.s < 0 ? '-' + str : str;
  33123. }
  33124. // Does not strip trailing zeros.
  33125. function truncate(arr, len) {
  33126. if (arr.length > len) {
  33127. arr.length = len;
  33128. return true;
  33129. }
  33130. }
  33131. // Decimal methods
  33132. /*
  33133. * abs
  33134. * acos
  33135. * acosh
  33136. * add
  33137. * asin
  33138. * asinh
  33139. * atan
  33140. * atanh
  33141. * atan2
  33142. * cbrt
  33143. * ceil
  33144. * clone
  33145. * config
  33146. * cos
  33147. * cosh
  33148. * div
  33149. * exp
  33150. * floor
  33151. * hypot
  33152. * ln
  33153. * log
  33154. * log2
  33155. * log10
  33156. * max
  33157. * min
  33158. * mod
  33159. * mul
  33160. * pow
  33161. * random
  33162. * round
  33163. * set
  33164. * sign
  33165. * sin
  33166. * sinh
  33167. * sqrt
  33168. * sub
  33169. * tan
  33170. * tanh
  33171. * trunc
  33172. */
  33173. /*
  33174. * Return a new Decimal whose value is the absolute value of `x`.
  33175. *
  33176. * x {number|string|Decimal}
  33177. *
  33178. */
  33179. function abs(x) {
  33180. return new this(x).abs();
  33181. }
  33182. /*
  33183. * Return a new Decimal whose value is the arccosine in radians of `x`.
  33184. *
  33185. * x {number|string|Decimal}
  33186. *
  33187. */
  33188. function acos(x) {
  33189. return new this(x).acos();
  33190. }
  33191. /*
  33192. * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to
  33193. * `precision` significant digits using rounding mode `rounding`.
  33194. *
  33195. * x {number|string|Decimal} A value in radians.
  33196. *
  33197. */
  33198. function acosh(x) {
  33199. return new this(x).acosh();
  33200. }
  33201. /*
  33202. * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant
  33203. * digits using rounding mode `rounding`.
  33204. *
  33205. * x {number|string|Decimal}
  33206. * y {number|string|Decimal}
  33207. *
  33208. */
  33209. function add(x, y) {
  33210. return new this(x).plus(y);
  33211. }
  33212. /*
  33213. * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision`
  33214. * significant digits using rounding mode `rounding`.
  33215. *
  33216. * x {number|string|Decimal}
  33217. *
  33218. */
  33219. function asin(x) {
  33220. return new this(x).asin();
  33221. }
  33222. /*
  33223. * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to
  33224. * `precision` significant digits using rounding mode `rounding`.
  33225. *
  33226. * x {number|string|Decimal} A value in radians.
  33227. *
  33228. */
  33229. function asinh(x) {
  33230. return new this(x).asinh();
  33231. }
  33232. /*
  33233. * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision`
  33234. * significant digits using rounding mode `rounding`.
  33235. *
  33236. * x {number|string|Decimal}
  33237. *
  33238. */
  33239. function atan(x) {
  33240. return new this(x).atan();
  33241. }
  33242. /*
  33243. * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to
  33244. * `precision` significant digits using rounding mode `rounding`.
  33245. *
  33246. * x {number|string|Decimal} A value in radians.
  33247. *
  33248. */
  33249. function atanh(x) {
  33250. return new this(x).atanh();
  33251. }
  33252. /*
  33253. * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi
  33254. * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`.
  33255. *
  33256. * Domain: [-Infinity, Infinity]
  33257. * Range: [-pi, pi]
  33258. *
  33259. * y {number|string|Decimal} The y-coordinate.
  33260. * x {number|string|Decimal} The x-coordinate.
  33261. *
  33262. * atan2(±0, -0) = ±pi
  33263. * atan2(±0, +0) = ±0
  33264. * atan2(±0, -x) = ±pi for x > 0
  33265. * atan2(±0, x) = ±0 for x > 0
  33266. * atan2(-y, ±0) = -pi/2 for y > 0
  33267. * atan2(y, ±0) = pi/2 for y > 0
  33268. * atan2(±y, -Infinity) = ±pi for finite y > 0
  33269. * atan2(±y, +Infinity) = ±0 for finite y > 0
  33270. * atan2(±Infinity, x) = ±pi/2 for finite x
  33271. * atan2(±Infinity, -Infinity) = ±3*pi/4
  33272. * atan2(±Infinity, +Infinity) = ±pi/4
  33273. * atan2(NaN, x) = NaN
  33274. * atan2(y, NaN) = NaN
  33275. *
  33276. */
  33277. function atan2(y, x) {
  33278. y = new this(y);
  33279. x = new this(x);
  33280. var r,
  33281. pr = this.precision,
  33282. rm = this.rounding,
  33283. wpr = pr + 4;
  33284. // Either NaN
  33285. if (!y.s || !x.s) {
  33286. r = new this(NaN);
  33287. // Both ±Infinity
  33288. } else if (!y.d && !x.d) {
  33289. r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75);
  33290. r.s = y.s;
  33291. // x is ±Infinity or y is ±0
  33292. } else if (!x.d || y.isZero()) {
  33293. r = x.s < 0 ? getPi(this, pr, rm) : new this(0);
  33294. r.s = y.s;
  33295. // y is ±Infinity or x is ±0
  33296. } else if (!y.d || x.isZero()) {
  33297. r = getPi(this, wpr, 1).times(0.5);
  33298. r.s = y.s;
  33299. // Both non-zero and finite
  33300. } else if (x.s < 0) {
  33301. this.precision = wpr;
  33302. this.rounding = 1;
  33303. r = this.atan(divide(y, x, wpr, 1));
  33304. x = getPi(this, wpr, 1);
  33305. this.precision = pr;
  33306. this.rounding = rm;
  33307. r = y.s < 0 ? r.minus(x) : r.plus(x);
  33308. } else {
  33309. r = this.atan(divide(y, x, wpr, 1));
  33310. }
  33311. return r;
  33312. }
  33313. /*
  33314. * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant
  33315. * digits using rounding mode `rounding`.
  33316. *
  33317. * x {number|string|Decimal}
  33318. *
  33319. */
  33320. function cbrt(x) {
  33321. return new this(x).cbrt();
  33322. }
  33323. /*
  33324. * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`.
  33325. *
  33326. * x {number|string|Decimal}
  33327. *
  33328. */
  33329. function ceil(x) {
  33330. return finalise(x = new this(x), x.e + 1, 2);
  33331. }
  33332. /*
  33333. * Configure global settings for a Decimal constructor.
  33334. *
  33335. * `obj` is an object with one or more of the following properties,
  33336. *
  33337. * precision {number}
  33338. * rounding {number}
  33339. * toExpNeg {number}
  33340. * toExpPos {number}
  33341. * maxE {number}
  33342. * minE {number}
  33343. * modulo {number}
  33344. * crypto {boolean|number}
  33345. * defaults {true}
  33346. *
  33347. * E.g. Decimal.config({ precision: 20, rounding: 4 })
  33348. *
  33349. */
  33350. function config(obj) {
  33351. if (!obj || (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object') throw Error(decimalError + 'Object expected');
  33352. var i,
  33353. p,
  33354. v,
  33355. useDefaults = obj.defaults === true,
  33356. ps = ['precision', 1, MAX_DIGITS, 'rounding', 0, 8, 'toExpNeg', -EXP_LIMIT, 0, 'toExpPos', 0, EXP_LIMIT, 'maxE', 0, EXP_LIMIT, 'minE', -EXP_LIMIT, 0, 'modulo', 0, 9];
  33357. for (i = 0; i < ps.length; i += 3) {
  33358. if (p = ps[i], useDefaults) this[p] = DEFAULTS[p];
  33359. if ((v = obj[p]) !== void 0) {
  33360. if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v;else throw Error(invalidArgument + p + ': ' + v);
  33361. }
  33362. }
  33363. if (p = 'crypto', useDefaults) this[p] = DEFAULTS[p];
  33364. if ((v = obj[p]) !== void 0) {
  33365. if (v === true || v === false || v === 0 || v === 1) {
  33366. if (v) {
  33367. if (typeof crypto != 'undefined' && crypto && (crypto.getRandomValues || crypto.randomBytes)) {
  33368. this[p] = true;
  33369. } else {
  33370. throw Error(cryptoUnavailable);
  33371. }
  33372. } else {
  33373. this[p] = false;
  33374. }
  33375. } else {
  33376. throw Error(invalidArgument + p + ': ' + v);
  33377. }
  33378. }
  33379. return this;
  33380. }
  33381. /*
  33382. * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant
  33383. * digits using rounding mode `rounding`.
  33384. *
  33385. * x {number|string|Decimal} A value in radians.
  33386. *
  33387. */
  33388. function cos(x) {
  33389. return new this(x).cos();
  33390. }
  33391. /*
  33392. * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision
  33393. * significant digits using rounding mode `rounding`.
  33394. *
  33395. * x {number|string|Decimal} A value in radians.
  33396. *
  33397. */
  33398. function cosh(x) {
  33399. return new this(x).cosh();
  33400. }
  33401. /*
  33402. * Create and return a Decimal constructor with the same configuration properties as this Decimal
  33403. * constructor.
  33404. *
  33405. */
  33406. function clone(obj) {
  33407. var i, p, ps;
  33408. /*
  33409. * The Decimal constructor and exported function.
  33410. * Return a new Decimal instance.
  33411. *
  33412. * v {number|string|Decimal} A numeric value.
  33413. *
  33414. */
  33415. function Decimal(v) {
  33416. var e,
  33417. i,
  33418. t,
  33419. x = this;
  33420. // Decimal called without new.
  33421. if (!(x instanceof Decimal)) return new Decimal(v);
  33422. // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor
  33423. // which points to Object.
  33424. x.constructor = Decimal;
  33425. // Duplicate.
  33426. if (v instanceof Decimal) {
  33427. x.s = v.s;
  33428. x.e = v.e;
  33429. x.d = (v = v.d) ? v.slice() : v;
  33430. return;
  33431. }
  33432. t = typeof v === 'undefined' ? 'undefined' : _typeof(v);
  33433. if (t === 'number') {
  33434. if (v === 0) {
  33435. x.s = 1 / v < 0 ? -1 : 1;
  33436. x.e = 0;
  33437. x.d = [0];
  33438. return;
  33439. }
  33440. if (v < 0) {
  33441. v = -v;
  33442. x.s = -1;
  33443. } else {
  33444. x.s = 1;
  33445. }
  33446. // Fast path for small integers.
  33447. if (v === ~~v && v < 1e7) {
  33448. for (e = 0, i = v; i >= 10; i /= 10) {
  33449. e++;
  33450. }x.e = e;
  33451. x.d = [v];
  33452. return;
  33453. // Infinity, NaN.
  33454. } else if (v * 0 !== 0) {
  33455. if (!v) x.s = NaN;
  33456. x.e = NaN;
  33457. x.d = null;
  33458. return;
  33459. }
  33460. return parseDecimal(x, v.toString());
  33461. } else if (t !== 'string') {
  33462. throw Error(invalidArgument + v);
  33463. }
  33464. // Minus sign?
  33465. if (v.charCodeAt(0) === 45) {
  33466. v = v.slice(1);
  33467. x.s = -1;
  33468. } else {
  33469. x.s = 1;
  33470. }
  33471. return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
  33472. }
  33473. Decimal.prototype = P;
  33474. Decimal.ROUND_UP = 0;
  33475. Decimal.ROUND_DOWN = 1;
  33476. Decimal.ROUND_CEIL = 2;
  33477. Decimal.ROUND_FLOOR = 3;
  33478. Decimal.ROUND_HALF_UP = 4;
  33479. Decimal.ROUND_HALF_DOWN = 5;
  33480. Decimal.ROUND_HALF_EVEN = 6;
  33481. Decimal.ROUND_HALF_CEIL = 7;
  33482. Decimal.ROUND_HALF_FLOOR = 8;
  33483. Decimal.EUCLID = 9;
  33484. Decimal.config = Decimal.set = config;
  33485. Decimal.clone = clone;
  33486. Decimal.isDecimal = isDecimalInstance;
  33487. Decimal.abs = abs;
  33488. Decimal.acos = acos;
  33489. Decimal.acosh = acosh; // ES6
  33490. Decimal.add = add;
  33491. Decimal.asin = asin;
  33492. Decimal.asinh = asinh; // ES6
  33493. Decimal.atan = atan;
  33494. Decimal.atanh = atanh; // ES6
  33495. Decimal.atan2 = atan2;
  33496. Decimal.cbrt = cbrt; // ES6
  33497. Decimal.ceil = ceil;
  33498. Decimal.cos = cos;
  33499. Decimal.cosh = cosh; // ES6
  33500. Decimal.div = div;
  33501. Decimal.exp = exp;
  33502. Decimal.floor = floor;
  33503. Decimal.hypot = hypot; // ES6
  33504. Decimal.ln = ln;
  33505. Decimal.log = log;
  33506. Decimal.log10 = log10; // ES6
  33507. Decimal.log2 = log2; // ES6
  33508. Decimal.max = max;
  33509. Decimal.min = min;
  33510. Decimal.mod = mod;
  33511. Decimal.mul = mul;
  33512. Decimal.pow = pow;
  33513. Decimal.random = random;
  33514. Decimal.round = round;
  33515. Decimal.sign = sign; // ES6
  33516. Decimal.sin = sin;
  33517. Decimal.sinh = sinh; // ES6
  33518. Decimal.sqrt = sqrt;
  33519. Decimal.sub = sub;
  33520. Decimal.tan = tan;
  33521. Decimal.tanh = tanh; // ES6
  33522. Decimal.trunc = trunc; // ES6
  33523. if (obj === void 0) obj = {};
  33524. if (obj) {
  33525. if (obj.defaults !== true) {
  33526. ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];
  33527. for (i = 0; i < ps.length;) {
  33528. if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];
  33529. }
  33530. }
  33531. }
  33532. Decimal.config(obj);
  33533. return Decimal;
  33534. }
  33535. /*
  33536. * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant
  33537. * digits using rounding mode `rounding`.
  33538. *
  33539. * x {number|string|Decimal}
  33540. * y {number|string|Decimal}
  33541. *
  33542. */
  33543. function div(x, y) {
  33544. return new this(x).div(y);
  33545. }
  33546. /*
  33547. * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision`
  33548. * significant digits using rounding mode `rounding`.
  33549. *
  33550. * x {number|string|Decimal} The power to which to raise the base of the natural log.
  33551. *
  33552. */
  33553. function exp(x) {
  33554. return new this(x).exp();
  33555. }
  33556. /*
  33557. * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`.
  33558. *
  33559. * x {number|string|Decimal}
  33560. *
  33561. */
  33562. function floor(x) {
  33563. return finalise(x = new this(x), x.e + 1, 3);
  33564. }
  33565. /*
  33566. * Return a new Decimal whose value is the square root of the sum of the squares of the arguments,
  33567. * rounded to `precision` significant digits using rounding mode `rounding`.
  33568. *
  33569. * hypot(a, b, ...) = sqrt(a^2 + b^2 + ...)
  33570. *
  33571. */
  33572. function hypot() {
  33573. var i,
  33574. n,
  33575. t = new this(0);
  33576. external = false;
  33577. for (i = 0; i < arguments.length;) {
  33578. n = new this(arguments[i++]);
  33579. if (!n.d) {
  33580. if (n.s) {
  33581. external = true;
  33582. return new this(1 / 0);
  33583. }
  33584. t = n;
  33585. } else if (t.d) {
  33586. t = t.plus(n.times(n));
  33587. }
  33588. }
  33589. external = true;
  33590. return t.sqrt();
  33591. }
  33592. /*
  33593. * Return true if object is a Decimal instance (where Decimal is any Decimal constructor),
  33594. * otherwise return false.
  33595. *
  33596. */
  33597. function isDecimalInstance(obj) {
  33598. return obj instanceof Decimal || obj && obj.name === '[object Decimal]' || false;
  33599. }
  33600. /*
  33601. * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision`
  33602. * significant digits using rounding mode `rounding`.
  33603. *
  33604. * x {number|string|Decimal}
  33605. *
  33606. */
  33607. function ln(x) {
  33608. return new this(x).ln();
  33609. }
  33610. /*
  33611. * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base
  33612. * is specified, rounded to `precision` significant digits using rounding mode `rounding`.
  33613. *
  33614. * log[y](x)
  33615. *
  33616. * x {number|string|Decimal} The argument of the logarithm.
  33617. * y {number|string|Decimal} The base of the logarithm.
  33618. *
  33619. */
  33620. function log(x, y) {
  33621. return new this(x).log(y);
  33622. }
  33623. /*
  33624. * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision`
  33625. * significant digits using rounding mode `rounding`.
  33626. *
  33627. * x {number|string|Decimal}
  33628. *
  33629. */
  33630. function log2(x) {
  33631. return new this(x).log(2);
  33632. }
  33633. /*
  33634. * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision`
  33635. * significant digits using rounding mode `rounding`.
  33636. *
  33637. * x {number|string|Decimal}
  33638. *
  33639. */
  33640. function log10(x) {
  33641. return new this(x).log(10);
  33642. }
  33643. /*
  33644. * Return a new Decimal whose value is the maximum of the arguments.
  33645. *
  33646. * arguments {number|string|Decimal}
  33647. *
  33648. */
  33649. function max() {
  33650. return maxOrMin(this, arguments, 'lt');
  33651. }
  33652. /*
  33653. * Return a new Decimal whose value is the minimum of the arguments.
  33654. *
  33655. * arguments {number|string|Decimal}
  33656. *
  33657. */
  33658. function min() {
  33659. return maxOrMin(this, arguments, 'gt');
  33660. }
  33661. /*
  33662. * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits
  33663. * using rounding mode `rounding`.
  33664. *
  33665. * x {number|string|Decimal}
  33666. * y {number|string|Decimal}
  33667. *
  33668. */
  33669. function mod(x, y) {
  33670. return new this(x).mod(y);
  33671. }
  33672. /*
  33673. * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant
  33674. * digits using rounding mode `rounding`.
  33675. *
  33676. * x {number|string|Decimal}
  33677. * y {number|string|Decimal}
  33678. *
  33679. */
  33680. function mul(x, y) {
  33681. return new this(x).mul(y);
  33682. }
  33683. /*
  33684. * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision
  33685. * significant digits using rounding mode `rounding`.
  33686. *
  33687. * x {number|string|Decimal} The base.
  33688. * y {number|string|Decimal} The exponent.
  33689. *
  33690. */
  33691. function pow(x, y) {
  33692. return new this(x).pow(y);
  33693. }
  33694. /*
  33695. * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with
  33696. * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros
  33697. * are produced).
  33698. *
  33699. * [sd] {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive.
  33700. *
  33701. */
  33702. function random(sd) {
  33703. var d,
  33704. e,
  33705. k,
  33706. n,
  33707. i = 0,
  33708. r = new this(1),
  33709. rd = [];
  33710. if (sd === void 0) sd = this.precision;else checkInt32(sd, 1, MAX_DIGITS);
  33711. k = Math.ceil(sd / LOG_BASE);
  33712. if (!this.crypto) {
  33713. for (; i < k;) {
  33714. rd[i++] = Math.random() * 1e7 | 0;
  33715. } // Browsers supporting crypto.getRandomValues.
  33716. } else if (crypto.getRandomValues) {
  33717. d = crypto.getRandomValues(new Uint32Array(k));
  33718. for (; i < k;) {
  33719. n = d[i];
  33720. // 0 <= n < 4294967296
  33721. // Probability n >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865).
  33722. if (n >= 4.29e9) {
  33723. d[i] = crypto.getRandomValues(new Uint32Array(1))[0];
  33724. } else {
  33725. // 0 <= n <= 4289999999
  33726. // 0 <= (n % 1e7) <= 9999999
  33727. rd[i++] = n % 1e7;
  33728. }
  33729. }
  33730. // Node.js supporting crypto.randomBytes.
  33731. } else if (crypto.randomBytes) {
  33732. // buffer
  33733. d = crypto.randomBytes(k *= 4);
  33734. for (; i < k;) {
  33735. // 0 <= n < 2147483648
  33736. n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 0x7f) << 24);
  33737. // Probability n >= 2.14e9, is 7483648 / 2147483648 = 0.0035 (1 in 286).
  33738. if (n >= 2.14e9) {
  33739. crypto.randomBytes(4).copy(d, i);
  33740. } else {
  33741. // 0 <= n <= 2139999999
  33742. // 0 <= (n % 1e7) <= 9999999
  33743. rd.push(n % 1e7);
  33744. i += 4;
  33745. }
  33746. }
  33747. i = k / 4;
  33748. } else {
  33749. throw Error(cryptoUnavailable);
  33750. }
  33751. k = rd[--i];
  33752. sd %= LOG_BASE;
  33753. // Convert trailing digits to zeros according to sd.
  33754. if (k && sd) {
  33755. n = mathpow(10, LOG_BASE - sd);
  33756. rd[i] = (k / n | 0) * n;
  33757. }
  33758. // Remove trailing words which are zero.
  33759. for (; rd[i] === 0; i--) {
  33760. rd.pop();
  33761. } // Zero?
  33762. if (i < 0) {
  33763. e = 0;
  33764. rd = [0];
  33765. } else {
  33766. e = -1;
  33767. // Remove leading words which are zero and adjust exponent accordingly.
  33768. for (; rd[0] === 0; e -= LOG_BASE) {
  33769. rd.shift();
  33770. } // Count the digits of the first word of rd to determine leading zeros.
  33771. for (k = 1, n = rd[0]; n >= 10; n /= 10) {
  33772. k++;
  33773. } // Adjust the exponent for leading zeros of the first word of rd.
  33774. if (k < LOG_BASE) e -= LOG_BASE - k;
  33775. }
  33776. r.e = e;
  33777. r.d = rd;
  33778. return r;
  33779. }
  33780. /*
  33781. * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`.
  33782. *
  33783. * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL).
  33784. *
  33785. * x {number|string|Decimal}
  33786. *
  33787. */
  33788. function round(x) {
  33789. return finalise(x = new this(x), x.e + 1, this.rounding);
  33790. }
  33791. /*
  33792. * Return
  33793. * 1 if x > 0,
  33794. * -1 if x < 0,
  33795. * 0 if x is 0,
  33796. * -0 if x is -0,
  33797. * NaN otherwise
  33798. *
  33799. */
  33800. function sign(x) {
  33801. x = new this(x);
  33802. return x.d ? x.d[0] ? x.s : 0 * x.s : x.s || NaN;
  33803. }
  33804. /*
  33805. * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits
  33806. * using rounding mode `rounding`.
  33807. *
  33808. * x {number|string|Decimal} A value in radians.
  33809. *
  33810. */
  33811. function sin(x) {
  33812. return new this(x).sin();
  33813. }
  33814. /*
  33815. * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision`
  33816. * significant digits using rounding mode `rounding`.
  33817. *
  33818. * x {number|string|Decimal} A value in radians.
  33819. *
  33820. */
  33821. function sinh(x) {
  33822. return new this(x).sinh();
  33823. }
  33824. /*
  33825. * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant
  33826. * digits using rounding mode `rounding`.
  33827. *
  33828. * x {number|string|Decimal}
  33829. *
  33830. */
  33831. function sqrt(x) {
  33832. return new this(x).sqrt();
  33833. }
  33834. /*
  33835. * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits
  33836. * using rounding mode `rounding`.
  33837. *
  33838. * x {number|string|Decimal}
  33839. * y {number|string|Decimal}
  33840. *
  33841. */
  33842. function sub(x, y) {
  33843. return new this(x).sub(y);
  33844. }
  33845. /*
  33846. * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant
  33847. * digits using rounding mode `rounding`.
  33848. *
  33849. * x {number|string|Decimal} A value in radians.
  33850. *
  33851. */
  33852. function tan(x) {
  33853. return new this(x).tan();
  33854. }
  33855. /*
  33856. * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision`
  33857. * significant digits using rounding mode `rounding`.
  33858. *
  33859. * x {number|string|Decimal} A value in radians.
  33860. *
  33861. */
  33862. function tanh(x) {
  33863. return new this(x).tanh();
  33864. }
  33865. /*
  33866. * Return a new Decimal whose value is `x` truncated to an integer.
  33867. *
  33868. * x {number|string|Decimal}
  33869. *
  33870. */
  33871. function trunc(x) {
  33872. return finalise(x = new this(x), x.e + 1, 1);
  33873. }
  33874. // Create and configure initial Decimal constructor.
  33875. Decimal = clone(DEFAULTS);
  33876. Decimal['default'] = Decimal.Decimal = Decimal;
  33877. // Create the internal constants from their string values.
  33878. LN10 = new Decimal(LN10);
  33879. PI = new Decimal(PI);
  33880. // Export.
  33881. // AMD.
  33882. if (true) {
  33883. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  33884. return Decimal;
  33885. }).call(exports, __webpack_require__, exports, module),
  33886. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  33887. // Node and other environments that support module.exports.
  33888. } else {}
  33889. })(undefined);
  33890. /***/ }),
  33891. /***/ "./node_modules/jquery/dist/jquery.js":
  33892. /*!********************************************!*\
  33893. !*** ./node_modules/jquery/dist/jquery.js ***!
  33894. \********************************************/
  33895. /*! no static exports found */
  33896. /***/ (function(module, exports, __webpack_require__) {
  33897. "use strict";
  33898. /* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  33899. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  33900. /*!
  33901. * jQuery JavaScript Library v3.3.1
  33902. * https://jquery.com/
  33903. *
  33904. * Includes Sizzle.js
  33905. * https://sizzlejs.com/
  33906. *
  33907. * Copyright JS Foundation and other contributors
  33908. * Released under the MIT license
  33909. * https://jquery.org/license
  33910. *
  33911. * Date: 2018-01-20T17:24Z
  33912. */
  33913. (function (global, factory) {
  33914. "use strict";
  33915. if (( false ? undefined : _typeof(module)) === "object" && _typeof(module.exports) === "object") {
  33916. // For CommonJS and CommonJS-like environments where a proper `window`
  33917. // is present, execute the factory and get jQuery.
  33918. // For environments that do not have a `window` with a `document`
  33919. // (such as Node.js), expose a factory as module.exports.
  33920. // This accentuates the need for the creation of a real `window`.
  33921. // e.g. var jQuery = require("jquery")(window);
  33922. // See ticket #14549 for more info.
  33923. module.exports = global.document ? factory(global, true) : function (w) {
  33924. if (!w.document) {
  33925. throw new Error("jQuery requires a window with a document");
  33926. }
  33927. return factory(w);
  33928. };
  33929. } else {
  33930. factory(global);
  33931. }
  33932. // Pass this if window is not defined yet
  33933. })(typeof window !== "undefined" ? window : undefined, function (window, noGlobal) {
  33934. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  33935. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  33936. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  33937. // enough that all such attempts are guarded in a try block.
  33938. "use strict";
  33939. var arr = [];
  33940. var document = window.document;
  33941. var getProto = Object.getPrototypeOf;
  33942. var _slice = arr.slice;
  33943. var concat = arr.concat;
  33944. var push = arr.push;
  33945. var indexOf = arr.indexOf;
  33946. var class2type = {};
  33947. var toString = class2type.toString;
  33948. var hasOwn = class2type.hasOwnProperty;
  33949. var fnToString = hasOwn.toString;
  33950. var ObjectFunctionString = fnToString.call(Object);
  33951. var support = {};
  33952. var isFunction = function isFunction(obj) {
  33953. // Support: Chrome <=57, Firefox <=52
  33954. // In some browsers, typeof returns "function" for HTML <object> elements
  33955. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  33956. // We don't want to classify *any* DOM node as a function.
  33957. return typeof obj === "function" && typeof obj.nodeType !== "number";
  33958. };
  33959. var isWindow = function isWindow(obj) {
  33960. return obj != null && obj === obj.window;
  33961. };
  33962. var preservedScriptAttributes = {
  33963. type: true,
  33964. src: true,
  33965. noModule: true
  33966. };
  33967. function DOMEval(code, doc, node) {
  33968. doc = doc || document;
  33969. var i,
  33970. script = doc.createElement("script");
  33971. script.text = code;
  33972. if (node) {
  33973. for (i in preservedScriptAttributes) {
  33974. if (node[i]) {
  33975. script[i] = node[i];
  33976. }
  33977. }
  33978. }
  33979. doc.head.appendChild(script).parentNode.removeChild(script);
  33980. }
  33981. function toType(obj) {
  33982. if (obj == null) {
  33983. return obj + "";
  33984. }
  33985. // Support: Android <=2.3 only (functionish RegExp)
  33986. return (typeof obj === "undefined" ? "undefined" : _typeof(obj)) === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
  33987. }
  33988. /* global Symbol */
  33989. // Defining this global in .eslintrc.json would create a danger of using the global
  33990. // unguarded in another place, it seems safer to define global only for this module
  33991. var version = "3.3.1",
  33992. // Define a local copy of jQuery
  33993. jQuery = function jQuery(selector, context) {
  33994. // The jQuery object is actually just the init constructor 'enhanced'
  33995. // Need init if jQuery is called (just allow error to be thrown if not included)
  33996. return new jQuery.fn.init(selector, context);
  33997. },
  33998. // Support: Android <=4.0 only
  33999. // Make sure we trim BOM and NBSP
  34000. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  34001. jQuery.fn = jQuery.prototype = {
  34002. // The current version of jQuery being used
  34003. jquery: version,
  34004. constructor: jQuery,
  34005. // The default length of a jQuery object is 0
  34006. length: 0,
  34007. toArray: function toArray() {
  34008. return _slice.call(this);
  34009. },
  34010. // Get the Nth element in the matched element set OR
  34011. // Get the whole matched element set as a clean array
  34012. get: function get(num) {
  34013. // Return all the elements in a clean array
  34014. if (num == null) {
  34015. return _slice.call(this);
  34016. }
  34017. // Return just the one element from the set
  34018. return num < 0 ? this[num + this.length] : this[num];
  34019. },
  34020. // Take an array of elements and push it onto the stack
  34021. // (returning the new matched element set)
  34022. pushStack: function pushStack(elems) {
  34023. // Build a new jQuery matched element set
  34024. var ret = jQuery.merge(this.constructor(), elems);
  34025. // Add the old object onto the stack (as a reference)
  34026. ret.prevObject = this;
  34027. // Return the newly-formed element set
  34028. return ret;
  34029. },
  34030. // Execute a callback for every element in the matched set.
  34031. each: function each(callback) {
  34032. return jQuery.each(this, callback);
  34033. },
  34034. map: function map(callback) {
  34035. return this.pushStack(jQuery.map(this, function (elem, i) {
  34036. return callback.call(elem, i, elem);
  34037. }));
  34038. },
  34039. slice: function slice() {
  34040. return this.pushStack(_slice.apply(this, arguments));
  34041. },
  34042. first: function first() {
  34043. return this.eq(0);
  34044. },
  34045. last: function last() {
  34046. return this.eq(-1);
  34047. },
  34048. eq: function eq(i) {
  34049. var len = this.length,
  34050. j = +i + (i < 0 ? len : 0);
  34051. return this.pushStack(j >= 0 && j < len ? [this[j]] : []);
  34052. },
  34053. end: function end() {
  34054. return this.prevObject || this.constructor();
  34055. },
  34056. // For internal use only.
  34057. // Behaves like an Array's method, not like a jQuery method.
  34058. push: push,
  34059. sort: arr.sort,
  34060. splice: arr.splice
  34061. };
  34062. jQuery.extend = jQuery.fn.extend = function () {
  34063. var options,
  34064. name,
  34065. src,
  34066. copy,
  34067. copyIsArray,
  34068. clone,
  34069. target = arguments[0] || {},
  34070. i = 1,
  34071. length = arguments.length,
  34072. deep = false;
  34073. // Handle a deep copy situation
  34074. if (typeof target === "boolean") {
  34075. deep = target;
  34076. // Skip the boolean and the target
  34077. target = arguments[i] || {};
  34078. i++;
  34079. }
  34080. // Handle case when target is a string or something (possible in deep copy)
  34081. if ((typeof target === "undefined" ? "undefined" : _typeof(target)) !== "object" && !isFunction(target)) {
  34082. target = {};
  34083. }
  34084. // Extend jQuery itself if only one argument is passed
  34085. if (i === length) {
  34086. target = this;
  34087. i--;
  34088. }
  34089. for (; i < length; i++) {
  34090. // Only deal with non-null/undefined values
  34091. if ((options = arguments[i]) != null) {
  34092. // Extend the base object
  34093. for (name in options) {
  34094. src = target[name];
  34095. copy = options[name];
  34096. // Prevent never-ending loop
  34097. if (target === copy) {
  34098. continue;
  34099. }
  34100. // Recurse if we're merging plain objects or arrays
  34101. if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) {
  34102. if (copyIsArray) {
  34103. copyIsArray = false;
  34104. clone = src && Array.isArray(src) ? src : [];
  34105. } else {
  34106. clone = src && jQuery.isPlainObject(src) ? src : {};
  34107. }
  34108. // Never move original objects, clone them
  34109. target[name] = jQuery.extend(deep, clone, copy);
  34110. // Don't bring in undefined values
  34111. } else if (copy !== undefined) {
  34112. target[name] = copy;
  34113. }
  34114. }
  34115. }
  34116. }
  34117. // Return the modified object
  34118. return target;
  34119. };
  34120. jQuery.extend({
  34121. // Unique for each copy of jQuery on the page
  34122. expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""),
  34123. // Assume jQuery is ready without the ready module
  34124. isReady: true,
  34125. error: function error(msg) {
  34126. throw new Error(msg);
  34127. },
  34128. noop: function noop() {},
  34129. isPlainObject: function isPlainObject(obj) {
  34130. var proto, Ctor;
  34131. // Detect obvious negatives
  34132. // Use toString instead of jQuery.type to catch host objects
  34133. if (!obj || toString.call(obj) !== "[object Object]") {
  34134. return false;
  34135. }
  34136. proto = getProto(obj);
  34137. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  34138. if (!proto) {
  34139. return true;
  34140. }
  34141. // Objects with prototype are plain iff they were constructed by a global Object function
  34142. Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
  34143. return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString;
  34144. },
  34145. isEmptyObject: function isEmptyObject(obj) {
  34146. /* eslint-disable no-unused-vars */
  34147. // See https://github.com/eslint/eslint/issues/6125
  34148. var name;
  34149. for (name in obj) {
  34150. return false;
  34151. }
  34152. return true;
  34153. },
  34154. // Evaluates a script in a global context
  34155. globalEval: function globalEval(code) {
  34156. DOMEval(code);
  34157. },
  34158. each: function each(obj, callback) {
  34159. var length,
  34160. i = 0;
  34161. if (isArrayLike(obj)) {
  34162. length = obj.length;
  34163. for (; i < length; i++) {
  34164. if (callback.call(obj[i], i, obj[i]) === false) {
  34165. break;
  34166. }
  34167. }
  34168. } else {
  34169. for (i in obj) {
  34170. if (callback.call(obj[i], i, obj[i]) === false) {
  34171. break;
  34172. }
  34173. }
  34174. }
  34175. return obj;
  34176. },
  34177. // Support: Android <=4.0 only
  34178. trim: function trim(text) {
  34179. return text == null ? "" : (text + "").replace(rtrim, "");
  34180. },
  34181. // results is for internal usage only
  34182. makeArray: function makeArray(arr, results) {
  34183. var ret = results || [];
  34184. if (arr != null) {
  34185. if (isArrayLike(Object(arr))) {
  34186. jQuery.merge(ret, typeof arr === "string" ? [arr] : arr);
  34187. } else {
  34188. push.call(ret, arr);
  34189. }
  34190. }
  34191. return ret;
  34192. },
  34193. inArray: function inArray(elem, arr, i) {
  34194. return arr == null ? -1 : indexOf.call(arr, elem, i);
  34195. },
  34196. // Support: Android <=4.0 only, PhantomJS 1 only
  34197. // push.apply(_, arraylike) throws on ancient WebKit
  34198. merge: function merge(first, second) {
  34199. var len = +second.length,
  34200. j = 0,
  34201. i = first.length;
  34202. for (; j < len; j++) {
  34203. first[i++] = second[j];
  34204. }
  34205. first.length = i;
  34206. return first;
  34207. },
  34208. grep: function grep(elems, callback, invert) {
  34209. var callbackInverse,
  34210. matches = [],
  34211. i = 0,
  34212. length = elems.length,
  34213. callbackExpect = !invert;
  34214. // Go through the array, only saving the items
  34215. // that pass the validator function
  34216. for (; i < length; i++) {
  34217. callbackInverse = !callback(elems[i], i);
  34218. if (callbackInverse !== callbackExpect) {
  34219. matches.push(elems[i]);
  34220. }
  34221. }
  34222. return matches;
  34223. },
  34224. // arg is for internal usage only
  34225. map: function map(elems, callback, arg) {
  34226. var length,
  34227. value,
  34228. i = 0,
  34229. ret = [];
  34230. // Go through the array, translating each of the items to their new values
  34231. if (isArrayLike(elems)) {
  34232. length = elems.length;
  34233. for (; i < length; i++) {
  34234. value = callback(elems[i], i, arg);
  34235. if (value != null) {
  34236. ret.push(value);
  34237. }
  34238. }
  34239. // Go through every key on the object,
  34240. } else {
  34241. for (i in elems) {
  34242. value = callback(elems[i], i, arg);
  34243. if (value != null) {
  34244. ret.push(value);
  34245. }
  34246. }
  34247. }
  34248. // Flatten any nested arrays
  34249. return concat.apply([], ret);
  34250. },
  34251. // A global GUID counter for objects
  34252. guid: 1,
  34253. // jQuery.support is not used in Core but other projects attach their
  34254. // properties to it so it needs to exist.
  34255. support: support
  34256. });
  34257. if (typeof Symbol === "function") {
  34258. jQuery.fn[Symbol.iterator] = arr[Symbol.iterator];
  34259. }
  34260. // Populate the class2type map
  34261. jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), function (i, name) {
  34262. class2type["[object " + name + "]"] = name.toLowerCase();
  34263. });
  34264. function isArrayLike(obj) {
  34265. // Support: real iOS 8.2 only (not reproducible in simulator)
  34266. // `in` check used to prevent JIT error (gh-2145)
  34267. // hasOwn isn't used here due to false negatives
  34268. // regarding Nodelist length in IE
  34269. var length = !!obj && "length" in obj && obj.length,
  34270. type = toType(obj);
  34271. if (isFunction(obj) || isWindow(obj)) {
  34272. return false;
  34273. }
  34274. return type === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj;
  34275. }
  34276. var Sizzle =
  34277. /*!
  34278. * Sizzle CSS Selector Engine v2.3.3
  34279. * https://sizzlejs.com/
  34280. *
  34281. * Copyright jQuery Foundation and other contributors
  34282. * Released under the MIT license
  34283. * http://jquery.org/license
  34284. *
  34285. * Date: 2016-08-08
  34286. */
  34287. function (window) {
  34288. var i,
  34289. support,
  34290. Expr,
  34291. getText,
  34292. isXML,
  34293. tokenize,
  34294. compile,
  34295. select,
  34296. outermostContext,
  34297. sortInput,
  34298. hasDuplicate,
  34299. // Local document vars
  34300. setDocument,
  34301. document,
  34302. docElem,
  34303. documentIsHTML,
  34304. rbuggyQSA,
  34305. rbuggyMatches,
  34306. matches,
  34307. contains,
  34308. // Instance-specific data
  34309. expando = "sizzle" + 1 * new Date(),
  34310. preferredDoc = window.document,
  34311. dirruns = 0,
  34312. done = 0,
  34313. classCache = createCache(),
  34314. tokenCache = createCache(),
  34315. compilerCache = createCache(),
  34316. sortOrder = function sortOrder(a, b) {
  34317. if (a === b) {
  34318. hasDuplicate = true;
  34319. }
  34320. return 0;
  34321. },
  34322. // Instance methods
  34323. hasOwn = {}.hasOwnProperty,
  34324. arr = [],
  34325. pop = arr.pop,
  34326. push_native = arr.push,
  34327. push = arr.push,
  34328. slice = arr.slice,
  34329. // Use a stripped-down indexOf as it's faster than native
  34330. // https://jsperf.com/thor-indexof-vs-for/5
  34331. indexOf = function indexOf(list, elem) {
  34332. var i = 0,
  34333. len = list.length;
  34334. for (; i < len; i++) {
  34335. if (list[i] === elem) {
  34336. return i;
  34337. }
  34338. }
  34339. return -1;
  34340. },
  34341. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  34342. // Regular expressions
  34343. // http://www.w3.org/TR/css3-selectors/#whitespace
  34344. whitespace = "[\\x20\\t\\r\\n\\f]",
  34345. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  34346. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  34347. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  34348. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  34349. // Operator (capture 2)
  34350. "*([*^$|!~]?=)" + whitespace +
  34351. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  34352. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]",
  34353. pseudos = ":(" + identifier + ")(?:\\((" +
  34354. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  34355. // 1. quoted (capture 3; capture 4 or capture 5)
  34356. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  34357. // 2. simple (capture 6)
  34358. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  34359. // 3. anything else (capture 2)
  34360. ".*" + ")\\)|)",
  34361. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  34362. rwhitespace = new RegExp(whitespace + "+", "g"),
  34363. rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"),
  34364. rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"),
  34365. rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"),
  34366. rattributeQuotes = new RegExp("=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g"),
  34367. rpseudo = new RegExp(pseudos),
  34368. ridentifier = new RegExp("^" + identifier + "$"),
  34369. matchExpr = {
  34370. "ID": new RegExp("^#(" + identifier + ")"),
  34371. "CLASS": new RegExp("^\\.(" + identifier + ")"),
  34372. "TAG": new RegExp("^(" + identifier + "|[*])"),
  34373. "ATTR": new RegExp("^" + attributes),
  34374. "PSEUDO": new RegExp("^" + pseudos),
  34375. "CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"),
  34376. "bool": new RegExp("^(?:" + booleans + ")$", "i"),
  34377. // For use in libraries implementing .is()
  34378. // We use this for POS matching in `select`
  34379. "needsContext": new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
  34380. },
  34381. rinputs = /^(?:input|select|textarea|button)$/i,
  34382. rheader = /^h\d$/i,
  34383. rnative = /^[^{]+\{\s*\[native \w/,
  34384. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  34385. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  34386. rsibling = /[+~]/,
  34387. // CSS escapes
  34388. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  34389. runescape = new RegExp("\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig"),
  34390. funescape = function funescape(_, escaped, escapedWhitespace) {
  34391. var high = "0x" + escaped - 0x10000;
  34392. // NaN means non-codepoint
  34393. // Support: Firefox<24
  34394. // Workaround erroneous numeric interpretation of +"0x"
  34395. return high !== high || escapedWhitespace ? escaped : high < 0 ?
  34396. // BMP codepoint
  34397. String.fromCharCode(high + 0x10000) :
  34398. // Supplemental Plane codepoint (surrogate pair)
  34399. String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00);
  34400. },
  34401. // CSS string/identifier serialization
  34402. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  34403. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  34404. fcssescape = function fcssescape(ch, asCodePoint) {
  34405. if (asCodePoint) {
  34406. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  34407. if (ch === "\0") {
  34408. return "\uFFFD";
  34409. }
  34410. // Control characters and (dependent upon position) numbers get escaped as code points
  34411. return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
  34412. }
  34413. // Other potentially-special ASCII characters get backslash-escaped
  34414. return "\\" + ch;
  34415. },
  34416. // Used for iframes
  34417. // See setDocument()
  34418. // Removing the function wrapper causes a "Permission Denied"
  34419. // error in IE
  34420. unloadHandler = function unloadHandler() {
  34421. setDocument();
  34422. },
  34423. disabledAncestor = addCombinator(function (elem) {
  34424. return elem.disabled === true && ("form" in elem || "label" in elem);
  34425. }, { dir: "parentNode", next: "legend" });
  34426. // Optimize for push.apply( _, NodeList )
  34427. try {
  34428. push.apply(arr = slice.call(preferredDoc.childNodes), preferredDoc.childNodes);
  34429. // Support: Android<4.0
  34430. // Detect silently failing push.apply
  34431. arr[preferredDoc.childNodes.length].nodeType;
  34432. } catch (e) {
  34433. push = { apply: arr.length ?
  34434. // Leverage slice if possible
  34435. function (target, els) {
  34436. push_native.apply(target, slice.call(els));
  34437. } :
  34438. // Support: IE<9
  34439. // Otherwise append directly
  34440. function (target, els) {
  34441. var j = target.length,
  34442. i = 0;
  34443. // Can't trust NodeList.length
  34444. while (target[j++] = els[i++]) {}
  34445. target.length = j - 1;
  34446. }
  34447. };
  34448. }
  34449. function Sizzle(selector, context, results, seed) {
  34450. var m,
  34451. i,
  34452. elem,
  34453. nid,
  34454. match,
  34455. groups,
  34456. newSelector,
  34457. newContext = context && context.ownerDocument,
  34458. // nodeType defaults to 9, since context defaults to document
  34459. nodeType = context ? context.nodeType : 9;
  34460. results = results || [];
  34461. // Return early from calls with invalid selector or context
  34462. if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
  34463. return results;
  34464. }
  34465. // Try to shortcut find operations (as opposed to filters) in HTML documents
  34466. if (!seed) {
  34467. if ((context ? context.ownerDocument || context : preferredDoc) !== document) {
  34468. setDocument(context);
  34469. }
  34470. context = context || document;
  34471. if (documentIsHTML) {
  34472. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  34473. // (excepting DocumentFragment context, where the methods don't exist)
  34474. if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {
  34475. // ID selector
  34476. if (m = match[1]) {
  34477. // Document context
  34478. if (nodeType === 9) {
  34479. if (elem = context.getElementById(m)) {
  34480. // Support: IE, Opera, Webkit
  34481. // TODO: identify versions
  34482. // getElementById can match elements by name instead of ID
  34483. if (elem.id === m) {
  34484. results.push(elem);
  34485. return results;
  34486. }
  34487. } else {
  34488. return results;
  34489. }
  34490. // Element context
  34491. } else {
  34492. // Support: IE, Opera, Webkit
  34493. // TODO: identify versions
  34494. // getElementById can match elements by name instead of ID
  34495. if (newContext && (elem = newContext.getElementById(m)) && contains(context, elem) && elem.id === m) {
  34496. results.push(elem);
  34497. return results;
  34498. }
  34499. }
  34500. // Type selector
  34501. } else if (match[2]) {
  34502. push.apply(results, context.getElementsByTagName(selector));
  34503. return results;
  34504. // Class selector
  34505. } else if ((m = match[3]) && support.getElementsByClassName && context.getElementsByClassName) {
  34506. push.apply(results, context.getElementsByClassName(m));
  34507. return results;
  34508. }
  34509. }
  34510. // Take advantage of querySelectorAll
  34511. if (support.qsa && !compilerCache[selector + " "] && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
  34512. if (nodeType !== 1) {
  34513. newContext = context;
  34514. newSelector = selector;
  34515. // qSA looks outside Element context, which is not what we want
  34516. // Thanks to Andrew Dupont for this workaround technique
  34517. // Support: IE <=8
  34518. // Exclude object elements
  34519. } else if (context.nodeName.toLowerCase() !== "object") {
  34520. // Capture the context ID, setting it first if necessary
  34521. if (nid = context.getAttribute("id")) {
  34522. nid = nid.replace(rcssescape, fcssescape);
  34523. } else {
  34524. context.setAttribute("id", nid = expando);
  34525. }
  34526. // Prefix every selector in the list
  34527. groups = tokenize(selector);
  34528. i = groups.length;
  34529. while (i--) {
  34530. groups[i] = "#" + nid + " " + toSelector(groups[i]);
  34531. }
  34532. newSelector = groups.join(",");
  34533. // Expand context for sibling selectors
  34534. newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
  34535. }
  34536. if (newSelector) {
  34537. try {
  34538. push.apply(results, newContext.querySelectorAll(newSelector));
  34539. return results;
  34540. } catch (qsaError) {} finally {
  34541. if (nid === expando) {
  34542. context.removeAttribute("id");
  34543. }
  34544. }
  34545. }
  34546. }
  34547. }
  34548. }
  34549. // All others
  34550. return select(selector.replace(rtrim, "$1"), context, results, seed);
  34551. }
  34552. /**
  34553. * Create key-value caches of limited size
  34554. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  34555. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  34556. * deleting the oldest entry
  34557. */
  34558. function createCache() {
  34559. var keys = [];
  34560. function cache(key, value) {
  34561. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  34562. if (keys.push(key + " ") > Expr.cacheLength) {
  34563. // Only keep the most recent entries
  34564. delete cache[keys.shift()];
  34565. }
  34566. return cache[key + " "] = value;
  34567. }
  34568. return cache;
  34569. }
  34570. /**
  34571. * Mark a function for special use by Sizzle
  34572. * @param {Function} fn The function to mark
  34573. */
  34574. function markFunction(fn) {
  34575. fn[expando] = true;
  34576. return fn;
  34577. }
  34578. /**
  34579. * Support testing using an element
  34580. * @param {Function} fn Passed the created element and returns a boolean result
  34581. */
  34582. function assert(fn) {
  34583. var el = document.createElement("fieldset");
  34584. try {
  34585. return !!fn(el);
  34586. } catch (e) {
  34587. return false;
  34588. } finally {
  34589. // Remove from its parent by default
  34590. if (el.parentNode) {
  34591. el.parentNode.removeChild(el);
  34592. }
  34593. // release memory in IE
  34594. el = null;
  34595. }
  34596. }
  34597. /**
  34598. * Adds the same handler for all of the specified attrs
  34599. * @param {String} attrs Pipe-separated list of attributes
  34600. * @param {Function} handler The method that will be applied
  34601. */
  34602. function addHandle(attrs, handler) {
  34603. var arr = attrs.split("|"),
  34604. i = arr.length;
  34605. while (i--) {
  34606. Expr.attrHandle[arr[i]] = handler;
  34607. }
  34608. }
  34609. /**
  34610. * Checks document order of two siblings
  34611. * @param {Element} a
  34612. * @param {Element} b
  34613. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  34614. */
  34615. function siblingCheck(a, b) {
  34616. var cur = b && a,
  34617. diff = cur && a.nodeType === 1 && b.nodeType === 1 && a.sourceIndex - b.sourceIndex;
  34618. // Use IE sourceIndex if available on both nodes
  34619. if (diff) {
  34620. return diff;
  34621. }
  34622. // Check if b follows a
  34623. if (cur) {
  34624. while (cur = cur.nextSibling) {
  34625. if (cur === b) {
  34626. return -1;
  34627. }
  34628. }
  34629. }
  34630. return a ? 1 : -1;
  34631. }
  34632. /**
  34633. * Returns a function to use in pseudos for input types
  34634. * @param {String} type
  34635. */
  34636. function createInputPseudo(type) {
  34637. return function (elem) {
  34638. var name = elem.nodeName.toLowerCase();
  34639. return name === "input" && elem.type === type;
  34640. };
  34641. }
  34642. /**
  34643. * Returns a function to use in pseudos for buttons
  34644. * @param {String} type
  34645. */
  34646. function createButtonPseudo(type) {
  34647. return function (elem) {
  34648. var name = elem.nodeName.toLowerCase();
  34649. return (name === "input" || name === "button") && elem.type === type;
  34650. };
  34651. }
  34652. /**
  34653. * Returns a function to use in pseudos for :enabled/:disabled
  34654. * @param {Boolean} disabled true for :disabled; false for :enabled
  34655. */
  34656. function createDisabledPseudo(disabled) {
  34657. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  34658. return function (elem) {
  34659. // Only certain elements can match :enabled or :disabled
  34660. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  34661. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  34662. if ("form" in elem) {
  34663. // Check for inherited disabledness on relevant non-disabled elements:
  34664. // * listed form-associated elements in a disabled fieldset
  34665. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  34666. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  34667. // * option elements in a disabled optgroup
  34668. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  34669. // All such elements have a "form" property.
  34670. if (elem.parentNode && elem.disabled === false) {
  34671. // Option elements defer to a parent optgroup if present
  34672. if ("label" in elem) {
  34673. if ("label" in elem.parentNode) {
  34674. return elem.parentNode.disabled === disabled;
  34675. } else {
  34676. return elem.disabled === disabled;
  34677. }
  34678. }
  34679. // Support: IE 6 - 11
  34680. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  34681. return elem.isDisabled === disabled ||
  34682. // Where there is no isDisabled, check manually
  34683. /* jshint -W018 */
  34684. elem.isDisabled !== !disabled && disabledAncestor(elem) === disabled;
  34685. }
  34686. return elem.disabled === disabled;
  34687. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  34688. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  34689. // even exist on them, let alone have a boolean value.
  34690. } else if ("label" in elem) {
  34691. return elem.disabled === disabled;
  34692. }
  34693. // Remaining elements are neither :enabled nor :disabled
  34694. return false;
  34695. };
  34696. }
  34697. /**
  34698. * Returns a function to use in pseudos for positionals
  34699. * @param {Function} fn
  34700. */
  34701. function createPositionalPseudo(fn) {
  34702. return markFunction(function (argument) {
  34703. argument = +argument;
  34704. return markFunction(function (seed, matches) {
  34705. var j,
  34706. matchIndexes = fn([], seed.length, argument),
  34707. i = matchIndexes.length;
  34708. // Match elements found at the specified indexes
  34709. while (i--) {
  34710. if (seed[j = matchIndexes[i]]) {
  34711. seed[j] = !(matches[j] = seed[j]);
  34712. }
  34713. }
  34714. });
  34715. });
  34716. }
  34717. /**
  34718. * Checks a node for validity as a Sizzle context
  34719. * @param {Element|Object=} context
  34720. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  34721. */
  34722. function testContext(context) {
  34723. return context && typeof context.getElementsByTagName !== "undefined" && context;
  34724. }
  34725. // Expose support vars for convenience
  34726. support = Sizzle.support = {};
  34727. /**
  34728. * Detects XML nodes
  34729. * @param {Element|Object} elem An element or a document
  34730. * @returns {Boolean} True iff elem is a non-HTML XML node
  34731. */
  34732. isXML = Sizzle.isXML = function (elem) {
  34733. // documentElement is verified for cases where it doesn't yet exist
  34734. // (such as loading iframes in IE - #4833)
  34735. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  34736. return documentElement ? documentElement.nodeName !== "HTML" : false;
  34737. };
  34738. /**
  34739. * Sets document-related variables once based on the current document
  34740. * @param {Element|Object} [doc] An element or document object to use to set the document
  34741. * @returns {Object} Returns the current document
  34742. */
  34743. setDocument = Sizzle.setDocument = function (node) {
  34744. var hasCompare,
  34745. subWindow,
  34746. doc = node ? node.ownerDocument || node : preferredDoc;
  34747. // Return early if doc is invalid or already selected
  34748. if (doc === document || doc.nodeType !== 9 || !doc.documentElement) {
  34749. return document;
  34750. }
  34751. // Update global variables
  34752. document = doc;
  34753. docElem = document.documentElement;
  34754. documentIsHTML = !isXML(document);
  34755. // Support: IE 9-11, Edge
  34756. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  34757. if (preferredDoc !== document && (subWindow = document.defaultView) && subWindow.top !== subWindow) {
  34758. // Support: IE 11, Edge
  34759. if (subWindow.addEventListener) {
  34760. subWindow.addEventListener("unload", unloadHandler, false);
  34761. // Support: IE 9 - 10 only
  34762. } else if (subWindow.attachEvent) {
  34763. subWindow.attachEvent("onunload", unloadHandler);
  34764. }
  34765. }
  34766. /* Attributes
  34767. ---------------------------------------------------------------------- */
  34768. // Support: IE<8
  34769. // Verify that getAttribute really returns attributes and not properties
  34770. // (excepting IE8 booleans)
  34771. support.attributes = assert(function (el) {
  34772. el.className = "i";
  34773. return !el.getAttribute("className");
  34774. });
  34775. /* getElement(s)By*
  34776. ---------------------------------------------------------------------- */
  34777. // Check if getElementsByTagName("*") returns only elements
  34778. support.getElementsByTagName = assert(function (el) {
  34779. el.appendChild(document.createComment(""));
  34780. return !el.getElementsByTagName("*").length;
  34781. });
  34782. // Support: IE<9
  34783. support.getElementsByClassName = rnative.test(document.getElementsByClassName);
  34784. // Support: IE<10
  34785. // Check if getElementById returns elements by name
  34786. // The broken getElementById methods don't pick up programmatically-set names,
  34787. // so use a roundabout getElementsByName test
  34788. support.getById = assert(function (el) {
  34789. docElem.appendChild(el).id = expando;
  34790. return !document.getElementsByName || !document.getElementsByName(expando).length;
  34791. });
  34792. // ID filter and find
  34793. if (support.getById) {
  34794. Expr.filter["ID"] = function (id) {
  34795. var attrId = id.replace(runescape, funescape);
  34796. return function (elem) {
  34797. return elem.getAttribute("id") === attrId;
  34798. };
  34799. };
  34800. Expr.find["ID"] = function (id, context) {
  34801. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  34802. var elem = context.getElementById(id);
  34803. return elem ? [elem] : [];
  34804. }
  34805. };
  34806. } else {
  34807. Expr.filter["ID"] = function (id) {
  34808. var attrId = id.replace(runescape, funescape);
  34809. return function (elem) {
  34810. var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
  34811. return node && node.value === attrId;
  34812. };
  34813. };
  34814. // Support: IE 6 - 7 only
  34815. // getElementById is not reliable as a find shortcut
  34816. Expr.find["ID"] = function (id, context) {
  34817. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  34818. var node,
  34819. i,
  34820. elems,
  34821. elem = context.getElementById(id);
  34822. if (elem) {
  34823. // Verify the id attribute
  34824. node = elem.getAttributeNode("id");
  34825. if (node && node.value === id) {
  34826. return [elem];
  34827. }
  34828. // Fall back on getElementsByName
  34829. elems = context.getElementsByName(id);
  34830. i = 0;
  34831. while (elem = elems[i++]) {
  34832. node = elem.getAttributeNode("id");
  34833. if (node && node.value === id) {
  34834. return [elem];
  34835. }
  34836. }
  34837. }
  34838. return [];
  34839. }
  34840. };
  34841. }
  34842. // Tag
  34843. Expr.find["TAG"] = support.getElementsByTagName ? function (tag, context) {
  34844. if (typeof context.getElementsByTagName !== "undefined") {
  34845. return context.getElementsByTagName(tag);
  34846. // DocumentFragment nodes don't have gEBTN
  34847. } else if (support.qsa) {
  34848. return context.querySelectorAll(tag);
  34849. }
  34850. } : function (tag, context) {
  34851. var elem,
  34852. tmp = [],
  34853. i = 0,
  34854. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  34855. results = context.getElementsByTagName(tag);
  34856. // Filter out possible comments
  34857. if (tag === "*") {
  34858. while (elem = results[i++]) {
  34859. if (elem.nodeType === 1) {
  34860. tmp.push(elem);
  34861. }
  34862. }
  34863. return tmp;
  34864. }
  34865. return results;
  34866. };
  34867. // Class
  34868. Expr.find["CLASS"] = support.getElementsByClassName && function (className, context) {
  34869. if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) {
  34870. return context.getElementsByClassName(className);
  34871. }
  34872. };
  34873. /* QSA/matchesSelector
  34874. ---------------------------------------------------------------------- */
  34875. // QSA and matchesSelector support
  34876. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  34877. rbuggyMatches = [];
  34878. // qSa(:focus) reports false when true (Chrome 21)
  34879. // We allow this because of a bug in IE8/9 that throws an error
  34880. // whenever `document.activeElement` is accessed on an iframe
  34881. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  34882. // See https://bugs.jquery.com/ticket/13378
  34883. rbuggyQSA = [];
  34884. if (support.qsa = rnative.test(document.querySelectorAll)) {
  34885. // Build QSA regex
  34886. // Regex strategy adopted from Diego Perini
  34887. assert(function (el) {
  34888. // Select is set to empty string on purpose
  34889. // This is to test IE's treatment of not explicitly
  34890. // setting a boolean content attribute,
  34891. // since its presence should be enough
  34892. // https://bugs.jquery.com/ticket/12359
  34893. docElem.appendChild(el).innerHTML = "<a id='" + expando + "'></a>" + "<select id='" + expando + "-\r\\' msallowcapture=''>" + "<option selected=''></option></select>";
  34894. // Support: IE8, Opera 11-12.16
  34895. // Nothing should be selected when empty strings follow ^= or $= or *=
  34896. // The test attribute must be unknown in Opera but "safe" for WinRT
  34897. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  34898. if (el.querySelectorAll("[msallowcapture^='']").length) {
  34899. rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")");
  34900. }
  34901. // Support: IE8
  34902. // Boolean attributes and "value" are not treated correctly
  34903. if (!el.querySelectorAll("[selected]").length) {
  34904. rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")");
  34905. }
  34906. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  34907. if (!el.querySelectorAll("[id~=" + expando + "-]").length) {
  34908. rbuggyQSA.push("~=");
  34909. }
  34910. // Webkit/Opera - :checked should return selected option elements
  34911. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  34912. // IE8 throws error here and will not see later tests
  34913. if (!el.querySelectorAll(":checked").length) {
  34914. rbuggyQSA.push(":checked");
  34915. }
  34916. // Support: Safari 8+, iOS 8+
  34917. // https://bugs.webkit.org/show_bug.cgi?id=136851
  34918. // In-page `selector#id sibling-combinator selector` fails
  34919. if (!el.querySelectorAll("a#" + expando + "+*").length) {
  34920. rbuggyQSA.push(".#.+[+~]");
  34921. }
  34922. });
  34923. assert(function (el) {
  34924. el.innerHTML = "<a href='' disabled='disabled'></a>" + "<select disabled='disabled'><option/></select>";
  34925. // Support: Windows 8 Native Apps
  34926. // The type and name attributes are restricted during .innerHTML assignment
  34927. var input = document.createElement("input");
  34928. input.setAttribute("type", "hidden");
  34929. el.appendChild(input).setAttribute("name", "D");
  34930. // Support: IE8
  34931. // Enforce case-sensitivity of name attribute
  34932. if (el.querySelectorAll("[name=d]").length) {
  34933. rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?=");
  34934. }
  34935. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  34936. // IE8 throws error here and will not see later tests
  34937. if (el.querySelectorAll(":enabled").length !== 2) {
  34938. rbuggyQSA.push(":enabled", ":disabled");
  34939. }
  34940. // Support: IE9-11+
  34941. // IE's :disabled selector does not pick up the children of disabled fieldsets
  34942. docElem.appendChild(el).disabled = true;
  34943. if (el.querySelectorAll(":disabled").length !== 2) {
  34944. rbuggyQSA.push(":enabled", ":disabled");
  34945. }
  34946. // Opera 10-11 does not throw on post-comma invalid pseudos
  34947. el.querySelectorAll("*,:x");
  34948. rbuggyQSA.push(",.*:");
  34949. });
  34950. }
  34951. if (support.matchesSelector = rnative.test(matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector)) {
  34952. assert(function (el) {
  34953. // Check to see if it's possible to do matchesSelector
  34954. // on a disconnected node (IE 9)
  34955. support.disconnectedMatch = matches.call(el, "*");
  34956. // This should fail with an exception
  34957. // Gecko does not error, returns false instead
  34958. matches.call(el, "[s!='']:x");
  34959. rbuggyMatches.push("!=", pseudos);
  34960. });
  34961. }
  34962. rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
  34963. rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|"));
  34964. /* Contains
  34965. ---------------------------------------------------------------------- */
  34966. hasCompare = rnative.test(docElem.compareDocumentPosition);
  34967. // Element contains another
  34968. // Purposefully self-exclusive
  34969. // As in, an element does not contain itself
  34970. contains = hasCompare || rnative.test(docElem.contains) ? function (a, b) {
  34971. var adown = a.nodeType === 9 ? a.documentElement : a,
  34972. bup = b && b.parentNode;
  34973. return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));
  34974. } : function (a, b) {
  34975. if (b) {
  34976. while (b = b.parentNode) {
  34977. if (b === a) {
  34978. return true;
  34979. }
  34980. }
  34981. }
  34982. return false;
  34983. };
  34984. /* Sorting
  34985. ---------------------------------------------------------------------- */
  34986. // Document order sorting
  34987. sortOrder = hasCompare ? function (a, b) {
  34988. // Flag for duplicate removal
  34989. if (a === b) {
  34990. hasDuplicate = true;
  34991. return 0;
  34992. }
  34993. // Sort on method existence if only one input has compareDocumentPosition
  34994. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  34995. if (compare) {
  34996. return compare;
  34997. }
  34998. // Calculate position if both inputs belong to the same document
  34999. compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) :
  35000. // Otherwise we know they are disconnected
  35001. 1;
  35002. // Disconnected nodes
  35003. if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) {
  35004. // Choose the first element that is related to our preferred document
  35005. if (a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) {
  35006. return -1;
  35007. }
  35008. if (b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) {
  35009. return 1;
  35010. }
  35011. // Maintain original order
  35012. return sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
  35013. }
  35014. return compare & 4 ? -1 : 1;
  35015. } : function (a, b) {
  35016. // Exit early if the nodes are identical
  35017. if (a === b) {
  35018. hasDuplicate = true;
  35019. return 0;
  35020. }
  35021. var cur,
  35022. i = 0,
  35023. aup = a.parentNode,
  35024. bup = b.parentNode,
  35025. ap = [a],
  35026. bp = [b];
  35027. // Parentless nodes are either documents or disconnected
  35028. if (!aup || !bup) {
  35029. return a === document ? -1 : b === document ? 1 : aup ? -1 : bup ? 1 : sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
  35030. // If the nodes are siblings, we can do a quick check
  35031. } else if (aup === bup) {
  35032. return siblingCheck(a, b);
  35033. }
  35034. // Otherwise we need full lists of their ancestors for comparison
  35035. cur = a;
  35036. while (cur = cur.parentNode) {
  35037. ap.unshift(cur);
  35038. }
  35039. cur = b;
  35040. while (cur = cur.parentNode) {
  35041. bp.unshift(cur);
  35042. }
  35043. // Walk down the tree looking for a discrepancy
  35044. while (ap[i] === bp[i]) {
  35045. i++;
  35046. }
  35047. return i ?
  35048. // Do a sibling check if the nodes have a common ancestor
  35049. siblingCheck(ap[i], bp[i]) :
  35050. // Otherwise nodes in our document sort first
  35051. ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0;
  35052. };
  35053. return document;
  35054. };
  35055. Sizzle.matches = function (expr, elements) {
  35056. return Sizzle(expr, null, null, elements);
  35057. };
  35058. Sizzle.matchesSelector = function (elem, expr) {
  35059. // Set document vars if needed
  35060. if ((elem.ownerDocument || elem) !== document) {
  35061. setDocument(elem);
  35062. }
  35063. // Make sure that attribute selectors are quoted
  35064. expr = expr.replace(rattributeQuotes, "='$1']");
  35065. if (support.matchesSelector && documentIsHTML && !compilerCache[expr + " "] && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) {
  35066. try {
  35067. var ret = matches.call(elem, expr);
  35068. // IE 9's matchesSelector returns false on disconnected nodes
  35069. if (ret || support.disconnectedMatch ||
  35070. // As well, disconnected nodes are said to be in a document
  35071. // fragment in IE 9
  35072. elem.document && elem.document.nodeType !== 11) {
  35073. return ret;
  35074. }
  35075. } catch (e) {}
  35076. }
  35077. return Sizzle(expr, document, null, [elem]).length > 0;
  35078. };
  35079. Sizzle.contains = function (context, elem) {
  35080. // Set document vars if needed
  35081. if ((context.ownerDocument || context) !== document) {
  35082. setDocument(context);
  35083. }
  35084. return contains(context, elem);
  35085. };
  35086. Sizzle.attr = function (elem, name) {
  35087. // Set document vars if needed
  35088. if ((elem.ownerDocument || elem) !== document) {
  35089. setDocument(elem);
  35090. }
  35091. var fn = Expr.attrHandle[name.toLowerCase()],
  35092. // Don't get fooled by Object.prototype properties (jQuery #13807)
  35093. val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined;
  35094. return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
  35095. };
  35096. Sizzle.escape = function (sel) {
  35097. return (sel + "").replace(rcssescape, fcssescape);
  35098. };
  35099. Sizzle.error = function (msg) {
  35100. throw new Error("Syntax error, unrecognized expression: " + msg);
  35101. };
  35102. /**
  35103. * Document sorting and removing duplicates
  35104. * @param {ArrayLike} results
  35105. */
  35106. Sizzle.uniqueSort = function (results) {
  35107. var elem,
  35108. duplicates = [],
  35109. j = 0,
  35110. i = 0;
  35111. // Unless we *know* we can detect duplicates, assume their presence
  35112. hasDuplicate = !support.detectDuplicates;
  35113. sortInput = !support.sortStable && results.slice(0);
  35114. results.sort(sortOrder);
  35115. if (hasDuplicate) {
  35116. while (elem = results[i++]) {
  35117. if (elem === results[i]) {
  35118. j = duplicates.push(i);
  35119. }
  35120. }
  35121. while (j--) {
  35122. results.splice(duplicates[j], 1);
  35123. }
  35124. }
  35125. // Clear input after sorting to release objects
  35126. // See https://github.com/jquery/sizzle/pull/225
  35127. sortInput = null;
  35128. return results;
  35129. };
  35130. /**
  35131. * Utility function for retrieving the text value of an array of DOM nodes
  35132. * @param {Array|Element} elem
  35133. */
  35134. getText = Sizzle.getText = function (elem) {
  35135. var node,
  35136. ret = "",
  35137. i = 0,
  35138. nodeType = elem.nodeType;
  35139. if (!nodeType) {
  35140. // If no nodeType, this is expected to be an array
  35141. while (node = elem[i++]) {
  35142. // Do not traverse comment nodes
  35143. ret += getText(node);
  35144. }
  35145. } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
  35146. // Use textContent for elements
  35147. // innerText usage removed for consistency of new lines (jQuery #11153)
  35148. if (typeof elem.textContent === "string") {
  35149. return elem.textContent;
  35150. } else {
  35151. // Traverse its children
  35152. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  35153. ret += getText(elem);
  35154. }
  35155. }
  35156. } else if (nodeType === 3 || nodeType === 4) {
  35157. return elem.nodeValue;
  35158. }
  35159. // Do not include comment or processing instruction nodes
  35160. return ret;
  35161. };
  35162. Expr = Sizzle.selectors = {
  35163. // Can be adjusted by the user
  35164. cacheLength: 50,
  35165. createPseudo: markFunction,
  35166. match: matchExpr,
  35167. attrHandle: {},
  35168. find: {},
  35169. relative: {
  35170. ">": { dir: "parentNode", first: true },
  35171. " ": { dir: "parentNode" },
  35172. "+": { dir: "previousSibling", first: true },
  35173. "~": { dir: "previousSibling" }
  35174. },
  35175. preFilter: {
  35176. "ATTR": function ATTR(match) {
  35177. match[1] = match[1].replace(runescape, funescape);
  35178. // Move the given value to match[3] whether quoted or unquoted
  35179. match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
  35180. if (match[2] === "~=") {
  35181. match[3] = " " + match[3] + " ";
  35182. }
  35183. return match.slice(0, 4);
  35184. },
  35185. "CHILD": function CHILD(match) {
  35186. /* matches from matchExpr["CHILD"]
  35187. 1 type (only|nth|...)
  35188. 2 what (child|of-type)
  35189. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  35190. 4 xn-component of xn+y argument ([+-]?\d*n|)
  35191. 5 sign of xn-component
  35192. 6 x of xn-component
  35193. 7 sign of y-component
  35194. 8 y of y-component
  35195. */
  35196. match[1] = match[1].toLowerCase();
  35197. if (match[1].slice(0, 3) === "nth") {
  35198. // nth-* requires argument
  35199. if (!match[3]) {
  35200. Sizzle.error(match[0]);
  35201. }
  35202. // numeric x and y parameters for Expr.filter.CHILD
  35203. // remember that false/true cast respectively to 0/1
  35204. match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
  35205. match[5] = +(match[7] + match[8] || match[3] === "odd");
  35206. // other types prohibit arguments
  35207. } else if (match[3]) {
  35208. Sizzle.error(match[0]);
  35209. }
  35210. return match;
  35211. },
  35212. "PSEUDO": function PSEUDO(match) {
  35213. var excess,
  35214. unquoted = !match[6] && match[2];
  35215. if (matchExpr["CHILD"].test(match[0])) {
  35216. return null;
  35217. }
  35218. // Accept quoted arguments as-is
  35219. if (match[3]) {
  35220. match[2] = match[4] || match[5] || "";
  35221. // Strip excess characters from unquoted arguments
  35222. } else if (unquoted && rpseudo.test(unquoted) && (
  35223. // Get excess from tokenize (recursively)
  35224. excess = tokenize(unquoted, true)) && (
  35225. // advance to the next closing parenthesis
  35226. excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
  35227. // excess is a negative index
  35228. match[0] = match[0].slice(0, excess);
  35229. match[2] = unquoted.slice(0, excess);
  35230. }
  35231. // Return only captures needed by the pseudo filter method (type and argument)
  35232. return match.slice(0, 3);
  35233. }
  35234. },
  35235. filter: {
  35236. "TAG": function TAG(nodeNameSelector) {
  35237. var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
  35238. return nodeNameSelector === "*" ? function () {
  35239. return true;
  35240. } : function (elem) {
  35241. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  35242. };
  35243. },
  35244. "CLASS": function CLASS(className) {
  35245. var pattern = classCache[className + " "];
  35246. return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function (elem) {
  35247. return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "");
  35248. });
  35249. },
  35250. "ATTR": function ATTR(name, operator, check) {
  35251. return function (elem) {
  35252. var result = Sizzle.attr(elem, name);
  35253. if (result == null) {
  35254. return operator === "!=";
  35255. }
  35256. if (!operator) {
  35257. return true;
  35258. }
  35259. result += "";
  35260. return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf(check) === 0 : operator === "*=" ? check && result.indexOf(check) > -1 : operator === "$=" ? check && result.slice(-check.length) === check : operator === "~=" ? (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1 : operator === "|=" ? result === check || result.slice(0, check.length + 1) === check + "-" : false;
  35261. };
  35262. },
  35263. "CHILD": function CHILD(type, what, argument, first, last) {
  35264. var simple = type.slice(0, 3) !== "nth",
  35265. forward = type.slice(-4) !== "last",
  35266. ofType = what === "of-type";
  35267. return first === 1 && last === 0 ?
  35268. // Shortcut for :nth-*(n)
  35269. function (elem) {
  35270. return !!elem.parentNode;
  35271. } : function (elem, context, xml) {
  35272. var cache,
  35273. uniqueCache,
  35274. outerCache,
  35275. node,
  35276. nodeIndex,
  35277. start,
  35278. dir = simple !== forward ? "nextSibling" : "previousSibling",
  35279. parent = elem.parentNode,
  35280. name = ofType && elem.nodeName.toLowerCase(),
  35281. useCache = !xml && !ofType,
  35282. diff = false;
  35283. if (parent) {
  35284. // :(first|last|only)-(child|of-type)
  35285. if (simple) {
  35286. while (dir) {
  35287. node = elem;
  35288. while (node = node[dir]) {
  35289. if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) {
  35290. return false;
  35291. }
  35292. }
  35293. // Reverse direction for :only-* (if we haven't yet done so)
  35294. start = dir = type === "only" && !start && "nextSibling";
  35295. }
  35296. return true;
  35297. }
  35298. start = [forward ? parent.firstChild : parent.lastChild];
  35299. // non-xml :nth-child(...) stores cache data on `parent`
  35300. if (forward && useCache) {
  35301. // Seek `elem` from a previously-cached index
  35302. // ...in a gzip-friendly way
  35303. node = parent;
  35304. outerCache = node[expando] || (node[expando] = {});
  35305. // Support: IE <9 only
  35306. // Defend against cloned attroperties (jQuery gh-1709)
  35307. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  35308. cache = uniqueCache[type] || [];
  35309. nodeIndex = cache[0] === dirruns && cache[1];
  35310. diff = nodeIndex && cache[2];
  35311. node = nodeIndex && parent.childNodes[nodeIndex];
  35312. while (node = ++nodeIndex && node && node[dir] || (
  35313. // Fallback to seeking `elem` from the start
  35314. diff = nodeIndex = 0) || start.pop()) {
  35315. // When found, cache indexes on `parent` and break
  35316. if (node.nodeType === 1 && ++diff && node === elem) {
  35317. uniqueCache[type] = [dirruns, nodeIndex, diff];
  35318. break;
  35319. }
  35320. }
  35321. } else {
  35322. // Use previously-cached element index if available
  35323. if (useCache) {
  35324. // ...in a gzip-friendly way
  35325. node = elem;
  35326. outerCache = node[expando] || (node[expando] = {});
  35327. // Support: IE <9 only
  35328. // Defend against cloned attroperties (jQuery gh-1709)
  35329. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  35330. cache = uniqueCache[type] || [];
  35331. nodeIndex = cache[0] === dirruns && cache[1];
  35332. diff = nodeIndex;
  35333. }
  35334. // xml :nth-child(...)
  35335. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  35336. if (diff === false) {
  35337. // Use the same loop as above to seek `elem` from the start
  35338. while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) {
  35339. if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) {
  35340. // Cache the index of each encountered element
  35341. if (useCache) {
  35342. outerCache = node[expando] || (node[expando] = {});
  35343. // Support: IE <9 only
  35344. // Defend against cloned attroperties (jQuery gh-1709)
  35345. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  35346. uniqueCache[type] = [dirruns, diff];
  35347. }
  35348. if (node === elem) {
  35349. break;
  35350. }
  35351. }
  35352. }
  35353. }
  35354. }
  35355. // Incorporate the offset, then check against cycle size
  35356. diff -= last;
  35357. return diff === first || diff % first === 0 && diff / first >= 0;
  35358. }
  35359. };
  35360. },
  35361. "PSEUDO": function PSEUDO(pseudo, argument) {
  35362. // pseudo-class names are case-insensitive
  35363. // http://www.w3.org/TR/selectors/#pseudo-classes
  35364. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  35365. // Remember that setFilters inherits from pseudos
  35366. var args,
  35367. fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error("unsupported pseudo: " + pseudo);
  35368. // The user may use createPseudo to indicate that
  35369. // arguments are needed to create the filter function
  35370. // just as Sizzle does
  35371. if (fn[expando]) {
  35372. return fn(argument);
  35373. }
  35374. // But maintain support for old signatures
  35375. if (fn.length > 1) {
  35376. args = [pseudo, pseudo, "", argument];
  35377. return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function (seed, matches) {
  35378. var idx,
  35379. matched = fn(seed, argument),
  35380. i = matched.length;
  35381. while (i--) {
  35382. idx = indexOf(seed, matched[i]);
  35383. seed[idx] = !(matches[idx] = matched[i]);
  35384. }
  35385. }) : function (elem) {
  35386. return fn(elem, 0, args);
  35387. };
  35388. }
  35389. return fn;
  35390. }
  35391. },
  35392. pseudos: {
  35393. // Potentially complex pseudos
  35394. "not": markFunction(function (selector) {
  35395. // Trim the selector passed to compile
  35396. // to avoid treating leading and trailing
  35397. // spaces as combinators
  35398. var input = [],
  35399. results = [],
  35400. matcher = compile(selector.replace(rtrim, "$1"));
  35401. return matcher[expando] ? markFunction(function (seed, matches, context, xml) {
  35402. var elem,
  35403. unmatched = matcher(seed, null, xml, []),
  35404. i = seed.length;
  35405. // Match elements unmatched by `matcher`
  35406. while (i--) {
  35407. if (elem = unmatched[i]) {
  35408. seed[i] = !(matches[i] = elem);
  35409. }
  35410. }
  35411. }) : function (elem, context, xml) {
  35412. input[0] = elem;
  35413. matcher(input, null, xml, results);
  35414. // Don't keep the element (issue #299)
  35415. input[0] = null;
  35416. return !results.pop();
  35417. };
  35418. }),
  35419. "has": markFunction(function (selector) {
  35420. return function (elem) {
  35421. return Sizzle(selector, elem).length > 0;
  35422. };
  35423. }),
  35424. "contains": markFunction(function (text) {
  35425. text = text.replace(runescape, funescape);
  35426. return function (elem) {
  35427. return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1;
  35428. };
  35429. }),
  35430. // "Whether an element is represented by a :lang() selector
  35431. // is based solely on the element's language value
  35432. // being equal to the identifier C,
  35433. // or beginning with the identifier C immediately followed by "-".
  35434. // The matching of C against the element's language value is performed case-insensitively.
  35435. // The identifier C does not have to be a valid language name."
  35436. // http://www.w3.org/TR/selectors/#lang-pseudo
  35437. "lang": markFunction(function (lang) {
  35438. // lang value must be a valid identifier
  35439. if (!ridentifier.test(lang || "")) {
  35440. Sizzle.error("unsupported lang: " + lang);
  35441. }
  35442. lang = lang.replace(runescape, funescape).toLowerCase();
  35443. return function (elem) {
  35444. var elemLang;
  35445. do {
  35446. if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) {
  35447. elemLang = elemLang.toLowerCase();
  35448. return elemLang === lang || elemLang.indexOf(lang + "-") === 0;
  35449. }
  35450. } while ((elem = elem.parentNode) && elem.nodeType === 1);
  35451. return false;
  35452. };
  35453. }),
  35454. // Miscellaneous
  35455. "target": function target(elem) {
  35456. var hash = window.location && window.location.hash;
  35457. return hash && hash.slice(1) === elem.id;
  35458. },
  35459. "root": function root(elem) {
  35460. return elem === docElem;
  35461. },
  35462. "focus": function focus(elem) {
  35463. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  35464. },
  35465. // Boolean properties
  35466. "enabled": createDisabledPseudo(false),
  35467. "disabled": createDisabledPseudo(true),
  35468. "checked": function checked(elem) {
  35469. // In CSS3, :checked should return both checked and selected elements
  35470. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  35471. var nodeName = elem.nodeName.toLowerCase();
  35472. return nodeName === "input" && !!elem.checked || nodeName === "option" && !!elem.selected;
  35473. },
  35474. "selected": function selected(elem) {
  35475. // Accessing this property makes selected-by-default
  35476. // options in Safari work properly
  35477. if (elem.parentNode) {
  35478. elem.parentNode.selectedIndex;
  35479. }
  35480. return elem.selected === true;
  35481. },
  35482. // Contents
  35483. "empty": function empty(elem) {
  35484. // http://www.w3.org/TR/selectors/#empty-pseudo
  35485. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  35486. // but not by others (comment: 8; processing instruction: 7; etc.)
  35487. // nodeType < 6 works because attributes (2) do not appear as children
  35488. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  35489. if (elem.nodeType < 6) {
  35490. return false;
  35491. }
  35492. }
  35493. return true;
  35494. },
  35495. "parent": function parent(elem) {
  35496. return !Expr.pseudos["empty"](elem);
  35497. },
  35498. // Element/input types
  35499. "header": function header(elem) {
  35500. return rheader.test(elem.nodeName);
  35501. },
  35502. "input": function input(elem) {
  35503. return rinputs.test(elem.nodeName);
  35504. },
  35505. "button": function button(elem) {
  35506. var name = elem.nodeName.toLowerCase();
  35507. return name === "input" && elem.type === "button" || name === "button";
  35508. },
  35509. "text": function text(elem) {
  35510. var attr;
  35511. return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && (
  35512. // Support: IE<8
  35513. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  35514. (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text");
  35515. },
  35516. // Position-in-collection
  35517. "first": createPositionalPseudo(function () {
  35518. return [0];
  35519. }),
  35520. "last": createPositionalPseudo(function (matchIndexes, length) {
  35521. return [length - 1];
  35522. }),
  35523. "eq": createPositionalPseudo(function (matchIndexes, length, argument) {
  35524. return [argument < 0 ? argument + length : argument];
  35525. }),
  35526. "even": createPositionalPseudo(function (matchIndexes, length) {
  35527. var i = 0;
  35528. for (; i < length; i += 2) {
  35529. matchIndexes.push(i);
  35530. }
  35531. return matchIndexes;
  35532. }),
  35533. "odd": createPositionalPseudo(function (matchIndexes, length) {
  35534. var i = 1;
  35535. for (; i < length; i += 2) {
  35536. matchIndexes.push(i);
  35537. }
  35538. return matchIndexes;
  35539. }),
  35540. "lt": createPositionalPseudo(function (matchIndexes, length, argument) {
  35541. var i = argument < 0 ? argument + length : argument;
  35542. for (; --i >= 0;) {
  35543. matchIndexes.push(i);
  35544. }
  35545. return matchIndexes;
  35546. }),
  35547. "gt": createPositionalPseudo(function (matchIndexes, length, argument) {
  35548. var i = argument < 0 ? argument + length : argument;
  35549. for (; ++i < length;) {
  35550. matchIndexes.push(i);
  35551. }
  35552. return matchIndexes;
  35553. })
  35554. }
  35555. };
  35556. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  35557. // Add button/input type pseudos
  35558. for (i in { radio: true, checkbox: true, file: true, password: true, image: true }) {
  35559. Expr.pseudos[i] = createInputPseudo(i);
  35560. }
  35561. for (i in { submit: true, reset: true }) {
  35562. Expr.pseudos[i] = createButtonPseudo(i);
  35563. }
  35564. // Easy API for creating new setFilters
  35565. function setFilters() {}
  35566. setFilters.prototype = Expr.filters = Expr.pseudos;
  35567. Expr.setFilters = new setFilters();
  35568. tokenize = Sizzle.tokenize = function (selector, parseOnly) {
  35569. var matched,
  35570. match,
  35571. tokens,
  35572. type,
  35573. soFar,
  35574. groups,
  35575. preFilters,
  35576. cached = tokenCache[selector + " "];
  35577. if (cached) {
  35578. return parseOnly ? 0 : cached.slice(0);
  35579. }
  35580. soFar = selector;
  35581. groups = [];
  35582. preFilters = Expr.preFilter;
  35583. while (soFar) {
  35584. // Comma and first run
  35585. if (!matched || (match = rcomma.exec(soFar))) {
  35586. if (match) {
  35587. // Don't consume trailing commas as valid
  35588. soFar = soFar.slice(match[0].length) || soFar;
  35589. }
  35590. groups.push(tokens = []);
  35591. }
  35592. matched = false;
  35593. // Combinators
  35594. if (match = rcombinators.exec(soFar)) {
  35595. matched = match.shift();
  35596. tokens.push({
  35597. value: matched,
  35598. // Cast descendant combinators to space
  35599. type: match[0].replace(rtrim, " ")
  35600. });
  35601. soFar = soFar.slice(matched.length);
  35602. }
  35603. // Filters
  35604. for (type in Expr.filter) {
  35605. if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {
  35606. matched = match.shift();
  35607. tokens.push({
  35608. value: matched,
  35609. type: type,
  35610. matches: match
  35611. });
  35612. soFar = soFar.slice(matched.length);
  35613. }
  35614. }
  35615. if (!matched) {
  35616. break;
  35617. }
  35618. }
  35619. // Return the length of the invalid excess
  35620. // if we're just parsing
  35621. // Otherwise, throw an error or return tokens
  35622. return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) :
  35623. // Cache the tokens
  35624. tokenCache(selector, groups).slice(0);
  35625. };
  35626. function toSelector(tokens) {
  35627. var i = 0,
  35628. len = tokens.length,
  35629. selector = "";
  35630. for (; i < len; i++) {
  35631. selector += tokens[i].value;
  35632. }
  35633. return selector;
  35634. }
  35635. function addCombinator(matcher, combinator, base) {
  35636. var dir = combinator.dir,
  35637. skip = combinator.next,
  35638. key = skip || dir,
  35639. checkNonElements = base && key === "parentNode",
  35640. doneName = done++;
  35641. return combinator.first ?
  35642. // Check against closest ancestor/preceding element
  35643. function (elem, context, xml) {
  35644. while (elem = elem[dir]) {
  35645. if (elem.nodeType === 1 || checkNonElements) {
  35646. return matcher(elem, context, xml);
  35647. }
  35648. }
  35649. return false;
  35650. } :
  35651. // Check against all ancestor/preceding elements
  35652. function (elem, context, xml) {
  35653. var oldCache,
  35654. uniqueCache,
  35655. outerCache,
  35656. newCache = [dirruns, doneName];
  35657. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  35658. if (xml) {
  35659. while (elem = elem[dir]) {
  35660. if (elem.nodeType === 1 || checkNonElements) {
  35661. if (matcher(elem, context, xml)) {
  35662. return true;
  35663. }
  35664. }
  35665. }
  35666. } else {
  35667. while (elem = elem[dir]) {
  35668. if (elem.nodeType === 1 || checkNonElements) {
  35669. outerCache = elem[expando] || (elem[expando] = {});
  35670. // Support: IE <9 only
  35671. // Defend against cloned attroperties (jQuery gh-1709)
  35672. uniqueCache = outerCache[elem.uniqueID] || (outerCache[elem.uniqueID] = {});
  35673. if (skip && skip === elem.nodeName.toLowerCase()) {
  35674. elem = elem[dir] || elem;
  35675. } else if ((oldCache = uniqueCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) {
  35676. // Assign to newCache so results back-propagate to previous elements
  35677. return newCache[2] = oldCache[2];
  35678. } else {
  35679. // Reuse newcache so results back-propagate to previous elements
  35680. uniqueCache[key] = newCache;
  35681. // A match means we're done; a fail means we have to keep checking
  35682. if (newCache[2] = matcher(elem, context, xml)) {
  35683. return true;
  35684. }
  35685. }
  35686. }
  35687. }
  35688. }
  35689. return false;
  35690. };
  35691. }
  35692. function elementMatcher(matchers) {
  35693. return matchers.length > 1 ? function (elem, context, xml) {
  35694. var i = matchers.length;
  35695. while (i--) {
  35696. if (!matchers[i](elem, context, xml)) {
  35697. return false;
  35698. }
  35699. }
  35700. return true;
  35701. } : matchers[0];
  35702. }
  35703. function multipleContexts(selector, contexts, results) {
  35704. var i = 0,
  35705. len = contexts.length;
  35706. for (; i < len; i++) {
  35707. Sizzle(selector, contexts[i], results);
  35708. }
  35709. return results;
  35710. }
  35711. function condense(unmatched, map, filter, context, xml) {
  35712. var elem,
  35713. newUnmatched = [],
  35714. i = 0,
  35715. len = unmatched.length,
  35716. mapped = map != null;
  35717. for (; i < len; i++) {
  35718. if (elem = unmatched[i]) {
  35719. if (!filter || filter(elem, context, xml)) {
  35720. newUnmatched.push(elem);
  35721. if (mapped) {
  35722. map.push(i);
  35723. }
  35724. }
  35725. }
  35726. }
  35727. return newUnmatched;
  35728. }
  35729. function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
  35730. if (postFilter && !postFilter[expando]) {
  35731. postFilter = setMatcher(postFilter);
  35732. }
  35733. if (postFinder && !postFinder[expando]) {
  35734. postFinder = setMatcher(postFinder, postSelector);
  35735. }
  35736. return markFunction(function (seed, results, context, xml) {
  35737. var temp,
  35738. i,
  35739. elem,
  35740. preMap = [],
  35741. postMap = [],
  35742. preexisting = results.length,
  35743. // Get initial elements from seed or context
  35744. elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []),
  35745. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  35746. matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems,
  35747. matcherOut = matcher ?
  35748. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  35749. postFinder || (seed ? preFilter : preexisting || postFilter) ?
  35750. // ...intermediate processing is necessary
  35751. [] :
  35752. // ...otherwise use results directly
  35753. results : matcherIn;
  35754. // Find primary matches
  35755. if (matcher) {
  35756. matcher(matcherIn, matcherOut, context, xml);
  35757. }
  35758. // Apply postFilter
  35759. if (postFilter) {
  35760. temp = condense(matcherOut, postMap);
  35761. postFilter(temp, [], context, xml);
  35762. // Un-match failing elements by moving them back to matcherIn
  35763. i = temp.length;
  35764. while (i--) {
  35765. if (elem = temp[i]) {
  35766. matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);
  35767. }
  35768. }
  35769. }
  35770. if (seed) {
  35771. if (postFinder || preFilter) {
  35772. if (postFinder) {
  35773. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  35774. temp = [];
  35775. i = matcherOut.length;
  35776. while (i--) {
  35777. if (elem = matcherOut[i]) {
  35778. // Restore matcherIn since elem is not yet a final match
  35779. temp.push(matcherIn[i] = elem);
  35780. }
  35781. }
  35782. postFinder(null, matcherOut = [], temp, xml);
  35783. }
  35784. // Move matched elements from seed to results to keep them synchronized
  35785. i = matcherOut.length;
  35786. while (i--) {
  35787. if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) {
  35788. seed[temp] = !(results[temp] = elem);
  35789. }
  35790. }
  35791. }
  35792. // Add elements to results, through postFinder if defined
  35793. } else {
  35794. matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut);
  35795. if (postFinder) {
  35796. postFinder(null, results, matcherOut, xml);
  35797. } else {
  35798. push.apply(results, matcherOut);
  35799. }
  35800. }
  35801. });
  35802. }
  35803. function matcherFromTokens(tokens) {
  35804. var checkContext,
  35805. matcher,
  35806. j,
  35807. len = tokens.length,
  35808. leadingRelative = Expr.relative[tokens[0].type],
  35809. implicitRelative = leadingRelative || Expr.relative[" "],
  35810. i = leadingRelative ? 1 : 0,
  35811. // The foundational matcher ensures that elements are reachable from top-level context(s)
  35812. matchContext = addCombinator(function (elem) {
  35813. return elem === checkContext;
  35814. }, implicitRelative, true),
  35815. matchAnyContext = addCombinator(function (elem) {
  35816. return indexOf(checkContext, elem) > -1;
  35817. }, implicitRelative, true),
  35818. matchers = [function (elem, context, xml) {
  35819. var ret = !leadingRelative && (xml || context !== outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
  35820. // Avoid hanging onto element (issue #299)
  35821. checkContext = null;
  35822. return ret;
  35823. }];
  35824. for (; i < len; i++) {
  35825. if (matcher = Expr.relative[tokens[i].type]) {
  35826. matchers = [addCombinator(elementMatcher(matchers), matcher)];
  35827. } else {
  35828. matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);
  35829. // Return special upon seeing a positional matcher
  35830. if (matcher[expando]) {
  35831. // Find the next relative operator (if any) for proper handling
  35832. j = ++i;
  35833. for (; j < len; j++) {
  35834. if (Expr.relative[tokens[j].type]) {
  35835. break;
  35836. }
  35837. }
  35838. return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(
  35839. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  35840. tokens.slice(0, i - 1).concat({ value: tokens[i - 2].type === " " ? "*" : "" })).replace(rtrim, "$1"), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens(tokens = tokens.slice(j)), j < len && toSelector(tokens));
  35841. }
  35842. matchers.push(matcher);
  35843. }
  35844. }
  35845. return elementMatcher(matchers);
  35846. }
  35847. function matcherFromGroupMatchers(elementMatchers, setMatchers) {
  35848. var bySet = setMatchers.length > 0,
  35849. byElement = elementMatchers.length > 0,
  35850. superMatcher = function superMatcher(seed, context, xml, results, outermost) {
  35851. var elem,
  35852. j,
  35853. matcher,
  35854. matchedCount = 0,
  35855. i = "0",
  35856. unmatched = seed && [],
  35857. setMatched = [],
  35858. contextBackup = outermostContext,
  35859. // We must always have either seed elements or outermost context
  35860. elems = seed || byElement && Expr.find["TAG"]("*", outermost),
  35861. // Use integer dirruns iff this is the outermost matcher
  35862. dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1,
  35863. len = elems.length;
  35864. if (outermost) {
  35865. outermostContext = context === document || context || outermost;
  35866. }
  35867. // Add elements passing elementMatchers directly to results
  35868. // Support: IE<9, Safari
  35869. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  35870. for (; i !== len && (elem = elems[i]) != null; i++) {
  35871. if (byElement && elem) {
  35872. j = 0;
  35873. if (!context && elem.ownerDocument !== document) {
  35874. setDocument(elem);
  35875. xml = !documentIsHTML;
  35876. }
  35877. while (matcher = elementMatchers[j++]) {
  35878. if (matcher(elem, context || document, xml)) {
  35879. results.push(elem);
  35880. break;
  35881. }
  35882. }
  35883. if (outermost) {
  35884. dirruns = dirrunsUnique;
  35885. }
  35886. }
  35887. // Track unmatched elements for set filters
  35888. if (bySet) {
  35889. // They will have gone through all possible matchers
  35890. if (elem = !matcher && elem) {
  35891. matchedCount--;
  35892. }
  35893. // Lengthen the array for every element, matched or not
  35894. if (seed) {
  35895. unmatched.push(elem);
  35896. }
  35897. }
  35898. }
  35899. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  35900. // makes the latter nonnegative.
  35901. matchedCount += i;
  35902. // Apply set filters to unmatched elements
  35903. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  35904. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  35905. // no element matchers and no seed.
  35906. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  35907. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  35908. // numerically zero.
  35909. if (bySet && i !== matchedCount) {
  35910. j = 0;
  35911. while (matcher = setMatchers[j++]) {
  35912. matcher(unmatched, setMatched, context, xml);
  35913. }
  35914. if (seed) {
  35915. // Reintegrate element matches to eliminate the need for sorting
  35916. if (matchedCount > 0) {
  35917. while (i--) {
  35918. if (!(unmatched[i] || setMatched[i])) {
  35919. setMatched[i] = pop.call(results);
  35920. }
  35921. }
  35922. }
  35923. // Discard index placeholder values to get only actual matches
  35924. setMatched = condense(setMatched);
  35925. }
  35926. // Add matches to results
  35927. push.apply(results, setMatched);
  35928. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  35929. if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) {
  35930. Sizzle.uniqueSort(results);
  35931. }
  35932. }
  35933. // Override manipulation of globals by nested matchers
  35934. if (outermost) {
  35935. dirruns = dirrunsUnique;
  35936. outermostContext = contextBackup;
  35937. }
  35938. return unmatched;
  35939. };
  35940. return bySet ? markFunction(superMatcher) : superMatcher;
  35941. }
  35942. compile = Sizzle.compile = function (selector, match /* Internal Use Only */) {
  35943. var i,
  35944. setMatchers = [],
  35945. elementMatchers = [],
  35946. cached = compilerCache[selector + " "];
  35947. if (!cached) {
  35948. // Generate a function of recursive functions that can be used to check each element
  35949. if (!match) {
  35950. match = tokenize(selector);
  35951. }
  35952. i = match.length;
  35953. while (i--) {
  35954. cached = matcherFromTokens(match[i]);
  35955. if (cached[expando]) {
  35956. setMatchers.push(cached);
  35957. } else {
  35958. elementMatchers.push(cached);
  35959. }
  35960. }
  35961. // Cache the compiled function
  35962. cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));
  35963. // Save selector and tokenization
  35964. cached.selector = selector;
  35965. }
  35966. return cached;
  35967. };
  35968. /**
  35969. * A low-level selection function that works with Sizzle's compiled
  35970. * selector functions
  35971. * @param {String|Function} selector A selector or a pre-compiled
  35972. * selector function built with Sizzle.compile
  35973. * @param {Element} context
  35974. * @param {Array} [results]
  35975. * @param {Array} [seed] A set of elements to match against
  35976. */
  35977. select = Sizzle.select = function (selector, context, results, seed) {
  35978. var i,
  35979. tokens,
  35980. token,
  35981. type,
  35982. find,
  35983. compiled = typeof selector === "function" && selector,
  35984. match = !seed && tokenize(selector = compiled.selector || selector);
  35985. results = results || [];
  35986. // Try to minimize operations if there is only one selector in the list and no seed
  35987. // (the latter of which guarantees us context)
  35988. if (match.length === 1) {
  35989. // Reduce context if the leading compound selector is an ID
  35990. tokens = match[0] = match[0].slice(0);
  35991. if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
  35992. context = (Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [])[0];
  35993. if (!context) {
  35994. return results;
  35995. // Precompiled matchers will still verify ancestry, so step up a level
  35996. } else if (compiled) {
  35997. context = context.parentNode;
  35998. }
  35999. selector = selector.slice(tokens.shift().value.length);
  36000. }
  36001. // Fetch a seed set for right-to-left matching
  36002. i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length;
  36003. while (i--) {
  36004. token = tokens[i];
  36005. // Abort if we hit a combinator
  36006. if (Expr.relative[type = token.type]) {
  36007. break;
  36008. }
  36009. if (find = Expr.find[type]) {
  36010. // Search, expanding context for leading sibling combinators
  36011. if (seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context)) {
  36012. // If seed is empty or no tokens remain, we can return early
  36013. tokens.splice(i, 1);
  36014. selector = seed.length && toSelector(tokens);
  36015. if (!selector) {
  36016. push.apply(results, seed);
  36017. return results;
  36018. }
  36019. break;
  36020. }
  36021. }
  36022. }
  36023. }
  36024. // Compile and execute a filtering function if one is not provided
  36025. // Provide `match` to avoid retokenization if we modified the selector above
  36026. (compiled || compile(selector, match))(seed, context, !documentIsHTML, results, !context || rsibling.test(selector) && testContext(context.parentNode) || context);
  36027. return results;
  36028. };
  36029. // One-time assignments
  36030. // Sort stability
  36031. support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
  36032. // Support: Chrome 14-35+
  36033. // Always assume duplicates if they aren't passed to the comparison function
  36034. support.detectDuplicates = !!hasDuplicate;
  36035. // Initialize against the default document
  36036. setDocument();
  36037. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  36038. // Detached nodes confoundingly follow *each other*
  36039. support.sortDetached = assert(function (el) {
  36040. // Should return 1, but returns 4 (following)
  36041. return el.compareDocumentPosition(document.createElement("fieldset")) & 1;
  36042. });
  36043. // Support: IE<8
  36044. // Prevent attribute/property "interpolation"
  36045. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  36046. if (!assert(function (el) {
  36047. el.innerHTML = "<a href='#'></a>";
  36048. return el.firstChild.getAttribute("href") === "#";
  36049. })) {
  36050. addHandle("type|href|height|width", function (elem, name, isXML) {
  36051. if (!isXML) {
  36052. return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2);
  36053. }
  36054. });
  36055. }
  36056. // Support: IE<9
  36057. // Use defaultValue in place of getAttribute("value")
  36058. if (!support.attributes || !assert(function (el) {
  36059. el.innerHTML = "<input/>";
  36060. el.firstChild.setAttribute("value", "");
  36061. return el.firstChild.getAttribute("value") === "";
  36062. })) {
  36063. addHandle("value", function (elem, name, isXML) {
  36064. if (!isXML && elem.nodeName.toLowerCase() === "input") {
  36065. return elem.defaultValue;
  36066. }
  36067. });
  36068. }
  36069. // Support: IE<9
  36070. // Use getAttributeNode to fetch booleans when getAttribute lies
  36071. if (!assert(function (el) {
  36072. return el.getAttribute("disabled") == null;
  36073. })) {
  36074. addHandle(booleans, function (elem, name, isXML) {
  36075. var val;
  36076. if (!isXML) {
  36077. return elem[name] === true ? name.toLowerCase() : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
  36078. }
  36079. });
  36080. }
  36081. return Sizzle;
  36082. }(window);
  36083. jQuery.find = Sizzle;
  36084. jQuery.expr = Sizzle.selectors;
  36085. // Deprecated
  36086. jQuery.expr[":"] = jQuery.expr.pseudos;
  36087. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  36088. jQuery.text = Sizzle.getText;
  36089. jQuery.isXMLDoc = Sizzle.isXML;
  36090. jQuery.contains = Sizzle.contains;
  36091. jQuery.escapeSelector = Sizzle.escape;
  36092. var dir = function dir(elem, _dir, until) {
  36093. var matched = [],
  36094. truncate = until !== undefined;
  36095. while ((elem = elem[_dir]) && elem.nodeType !== 9) {
  36096. if (elem.nodeType === 1) {
  36097. if (truncate && jQuery(elem).is(until)) {
  36098. break;
  36099. }
  36100. matched.push(elem);
  36101. }
  36102. }
  36103. return matched;
  36104. };
  36105. var _siblings = function _siblings(n, elem) {
  36106. var matched = [];
  36107. for (; n; n = n.nextSibling) {
  36108. if (n.nodeType === 1 && n !== elem) {
  36109. matched.push(n);
  36110. }
  36111. }
  36112. return matched;
  36113. };
  36114. var rneedsContext = jQuery.expr.match.needsContext;
  36115. function nodeName(elem, name) {
  36116. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  36117. };
  36118. var rsingleTag = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;
  36119. // Implement the identical functionality for filter and not
  36120. function winnow(elements, qualifier, not) {
  36121. if (isFunction(qualifier)) {
  36122. return jQuery.grep(elements, function (elem, i) {
  36123. return !!qualifier.call(elem, i, elem) !== not;
  36124. });
  36125. }
  36126. // Single element
  36127. if (qualifier.nodeType) {
  36128. return jQuery.grep(elements, function (elem) {
  36129. return elem === qualifier !== not;
  36130. });
  36131. }
  36132. // Arraylike of elements (jQuery, arguments, Array)
  36133. if (typeof qualifier !== "string") {
  36134. return jQuery.grep(elements, function (elem) {
  36135. return indexOf.call(qualifier, elem) > -1 !== not;
  36136. });
  36137. }
  36138. // Filtered directly for both simple and complex selectors
  36139. return jQuery.filter(qualifier, elements, not);
  36140. }
  36141. jQuery.filter = function (expr, elems, not) {
  36142. var elem = elems[0];
  36143. if (not) {
  36144. expr = ":not(" + expr + ")";
  36145. }
  36146. if (elems.length === 1 && elem.nodeType === 1) {
  36147. return jQuery.find.matchesSelector(elem, expr) ? [elem] : [];
  36148. }
  36149. return jQuery.find.matches(expr, jQuery.grep(elems, function (elem) {
  36150. return elem.nodeType === 1;
  36151. }));
  36152. };
  36153. jQuery.fn.extend({
  36154. find: function find(selector) {
  36155. var i,
  36156. ret,
  36157. len = this.length,
  36158. self = this;
  36159. if (typeof selector !== "string") {
  36160. return this.pushStack(jQuery(selector).filter(function () {
  36161. for (i = 0; i < len; i++) {
  36162. if (jQuery.contains(self[i], this)) {
  36163. return true;
  36164. }
  36165. }
  36166. }));
  36167. }
  36168. ret = this.pushStack([]);
  36169. for (i = 0; i < len; i++) {
  36170. jQuery.find(selector, self[i], ret);
  36171. }
  36172. return len > 1 ? jQuery.uniqueSort(ret) : ret;
  36173. },
  36174. filter: function filter(selector) {
  36175. return this.pushStack(winnow(this, selector || [], false));
  36176. },
  36177. not: function not(selector) {
  36178. return this.pushStack(winnow(this, selector || [], true));
  36179. },
  36180. is: function is(selector) {
  36181. return !!winnow(this,
  36182. // If this is a positional/relative selector, check membership in the returned set
  36183. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  36184. typeof selector === "string" && rneedsContext.test(selector) ? jQuery(selector) : selector || [], false).length;
  36185. }
  36186. });
  36187. // Initialize a jQuery object
  36188. // A central reference to the root jQuery(document)
  36189. var rootjQuery,
  36190. // A simple way to check for HTML strings
  36191. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  36192. // Strict HTML recognition (#11290: must start with <)
  36193. // Shortcut simple #id case for speed
  36194. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  36195. init = jQuery.fn.init = function (selector, context, root) {
  36196. var match, elem;
  36197. // HANDLE: $(""), $(null), $(undefined), $(false)
  36198. if (!selector) {
  36199. return this;
  36200. }
  36201. // Method init() accepts an alternate rootjQuery
  36202. // so migrate can support jQuery.sub (gh-2101)
  36203. root = root || rootjQuery;
  36204. // Handle HTML strings
  36205. if (typeof selector === "string") {
  36206. if (selector[0] === "<" && selector[selector.length - 1] === ">" && selector.length >= 3) {
  36207. // Assume that strings that start and end with <> are HTML and skip the regex check
  36208. match = [null, selector, null];
  36209. } else {
  36210. match = rquickExpr.exec(selector);
  36211. }
  36212. // Match html or make sure no context is specified for #id
  36213. if (match && (match[1] || !context)) {
  36214. // HANDLE: $(html) -> $(array)
  36215. if (match[1]) {
  36216. context = context instanceof jQuery ? context[0] : context;
  36217. // Option to run scripts is true for back-compat
  36218. // Intentionally let the error be thrown if parseHTML is not present
  36219. jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, true));
  36220. // HANDLE: $(html, props)
  36221. if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
  36222. for (match in context) {
  36223. // Properties of context are called as methods if possible
  36224. if (isFunction(this[match])) {
  36225. this[match](context[match]);
  36226. // ...and otherwise set as attributes
  36227. } else {
  36228. this.attr(match, context[match]);
  36229. }
  36230. }
  36231. }
  36232. return this;
  36233. // HANDLE: $(#id)
  36234. } else {
  36235. elem = document.getElementById(match[2]);
  36236. if (elem) {
  36237. // Inject the element directly into the jQuery object
  36238. this[0] = elem;
  36239. this.length = 1;
  36240. }
  36241. return this;
  36242. }
  36243. // HANDLE: $(expr, $(...))
  36244. } else if (!context || context.jquery) {
  36245. return (context || root).find(selector);
  36246. // HANDLE: $(expr, context)
  36247. // (which is just equivalent to: $(context).find(expr)
  36248. } else {
  36249. return this.constructor(context).find(selector);
  36250. }
  36251. // HANDLE: $(DOMElement)
  36252. } else if (selector.nodeType) {
  36253. this[0] = selector;
  36254. this.length = 1;
  36255. return this;
  36256. // HANDLE: $(function)
  36257. // Shortcut for document ready
  36258. } else if (isFunction(selector)) {
  36259. return root.ready !== undefined ? root.ready(selector) :
  36260. // Execute immediately if ready is not present
  36261. selector(jQuery);
  36262. }
  36263. return jQuery.makeArray(selector, this);
  36264. };
  36265. // Give the init function the jQuery prototype for later instantiation
  36266. init.prototype = jQuery.fn;
  36267. // Initialize central reference
  36268. rootjQuery = jQuery(document);
  36269. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  36270. // Methods guaranteed to produce a unique set when starting from a unique set
  36271. guaranteedUnique = {
  36272. children: true,
  36273. contents: true,
  36274. next: true,
  36275. prev: true
  36276. };
  36277. jQuery.fn.extend({
  36278. has: function has(target) {
  36279. var targets = jQuery(target, this),
  36280. l = targets.length;
  36281. return this.filter(function () {
  36282. var i = 0;
  36283. for (; i < l; i++) {
  36284. if (jQuery.contains(this, targets[i])) {
  36285. return true;
  36286. }
  36287. }
  36288. });
  36289. },
  36290. closest: function closest(selectors, context) {
  36291. var cur,
  36292. i = 0,
  36293. l = this.length,
  36294. matched = [],
  36295. targets = typeof selectors !== "string" && jQuery(selectors);
  36296. // Positional selectors never match, since there's no _selection_ context
  36297. if (!rneedsContext.test(selectors)) {
  36298. for (; i < l; i++) {
  36299. for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {
  36300. // Always skip document fragments
  36301. if (cur.nodeType < 11 && (targets ? targets.index(cur) > -1 :
  36302. // Don't pass non-elements to Sizzle
  36303. cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors))) {
  36304. matched.push(cur);
  36305. break;
  36306. }
  36307. }
  36308. }
  36309. }
  36310. return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched);
  36311. },
  36312. // Determine the position of an element within the set
  36313. index: function index(elem) {
  36314. // No argument, return index in parent
  36315. if (!elem) {
  36316. return this[0] && this[0].parentNode ? this.first().prevAll().length : -1;
  36317. }
  36318. // Index in selector
  36319. if (typeof elem === "string") {
  36320. return indexOf.call(jQuery(elem), this[0]);
  36321. }
  36322. // Locate the position of the desired element
  36323. return indexOf.call(this,
  36324. // If it receives a jQuery object, the first element is used
  36325. elem.jquery ? elem[0] : elem);
  36326. },
  36327. add: function add(selector, context) {
  36328. return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(), jQuery(selector, context))));
  36329. },
  36330. addBack: function addBack(selector) {
  36331. return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector));
  36332. }
  36333. });
  36334. function sibling(cur, dir) {
  36335. while ((cur = cur[dir]) && cur.nodeType !== 1) {}
  36336. return cur;
  36337. }
  36338. jQuery.each({
  36339. parent: function parent(elem) {
  36340. var parent = elem.parentNode;
  36341. return parent && parent.nodeType !== 11 ? parent : null;
  36342. },
  36343. parents: function parents(elem) {
  36344. return dir(elem, "parentNode");
  36345. },
  36346. parentsUntil: function parentsUntil(elem, i, until) {
  36347. return dir(elem, "parentNode", until);
  36348. },
  36349. next: function next(elem) {
  36350. return sibling(elem, "nextSibling");
  36351. },
  36352. prev: function prev(elem) {
  36353. return sibling(elem, "previousSibling");
  36354. },
  36355. nextAll: function nextAll(elem) {
  36356. return dir(elem, "nextSibling");
  36357. },
  36358. prevAll: function prevAll(elem) {
  36359. return dir(elem, "previousSibling");
  36360. },
  36361. nextUntil: function nextUntil(elem, i, until) {
  36362. return dir(elem, "nextSibling", until);
  36363. },
  36364. prevUntil: function prevUntil(elem, i, until) {
  36365. return dir(elem, "previousSibling", until);
  36366. },
  36367. siblings: function siblings(elem) {
  36368. return _siblings((elem.parentNode || {}).firstChild, elem);
  36369. },
  36370. children: function children(elem) {
  36371. return _siblings(elem.firstChild);
  36372. },
  36373. contents: function contents(elem) {
  36374. if (nodeName(elem, "iframe")) {
  36375. return elem.contentDocument;
  36376. }
  36377. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  36378. // Treat the template element as a regular one in browsers that
  36379. // don't support it.
  36380. if (nodeName(elem, "template")) {
  36381. elem = elem.content || elem;
  36382. }
  36383. return jQuery.merge([], elem.childNodes);
  36384. }
  36385. }, function (name, fn) {
  36386. jQuery.fn[name] = function (until, selector) {
  36387. var matched = jQuery.map(this, fn, until);
  36388. if (name.slice(-5) !== "Until") {
  36389. selector = until;
  36390. }
  36391. if (selector && typeof selector === "string") {
  36392. matched = jQuery.filter(selector, matched);
  36393. }
  36394. if (this.length > 1) {
  36395. // Remove duplicates
  36396. if (!guaranteedUnique[name]) {
  36397. jQuery.uniqueSort(matched);
  36398. }
  36399. // Reverse order for parents* and prev-derivatives
  36400. if (rparentsprev.test(name)) {
  36401. matched.reverse();
  36402. }
  36403. }
  36404. return this.pushStack(matched);
  36405. };
  36406. });
  36407. var rnothtmlwhite = /[^\x20\t\r\n\f]+/g;
  36408. // Convert String-formatted options into Object-formatted ones
  36409. function createOptions(options) {
  36410. var object = {};
  36411. jQuery.each(options.match(rnothtmlwhite) || [], function (_, flag) {
  36412. object[flag] = true;
  36413. });
  36414. return object;
  36415. }
  36416. /*
  36417. * Create a callback list using the following parameters:
  36418. *
  36419. * options: an optional list of space-separated options that will change how
  36420. * the callback list behaves or a more traditional option object
  36421. *
  36422. * By default a callback list will act like an event callback list and can be
  36423. * "fired" multiple times.
  36424. *
  36425. * Possible options:
  36426. *
  36427. * once: will ensure the callback list can only be fired once (like a Deferred)
  36428. *
  36429. * memory: will keep track of previous values and will call any callback added
  36430. * after the list has been fired right away with the latest "memorized"
  36431. * values (like a Deferred)
  36432. *
  36433. * unique: will ensure a callback can only be added once (no duplicate in the list)
  36434. *
  36435. * stopOnFalse: interrupt callings when a callback returns false
  36436. *
  36437. */
  36438. jQuery.Callbacks = function (options) {
  36439. // Convert options from String-formatted to Object-formatted if needed
  36440. // (we check in cache first)
  36441. options = typeof options === "string" ? createOptions(options) : jQuery.extend({}, options);
  36442. var // Flag to know if list is currently firing
  36443. firing,
  36444. // Last fire value for non-forgettable lists
  36445. memory,
  36446. // Flag to know if list was already fired
  36447. _fired,
  36448. // Flag to prevent firing
  36449. _locked,
  36450. // Actual callback list
  36451. list = [],
  36452. // Queue of execution data for repeatable lists
  36453. queue = [],
  36454. // Index of currently firing callback (modified by add/remove as needed)
  36455. firingIndex = -1,
  36456. // Fire callbacks
  36457. fire = function fire() {
  36458. // Enforce single-firing
  36459. _locked = _locked || options.once;
  36460. // Execute callbacks for all pending executions,
  36461. // respecting firingIndex overrides and runtime changes
  36462. _fired = firing = true;
  36463. for (; queue.length; firingIndex = -1) {
  36464. memory = queue.shift();
  36465. while (++firingIndex < list.length) {
  36466. // Run callback and check for early termination
  36467. if (list[firingIndex].apply(memory[0], memory[1]) === false && options.stopOnFalse) {
  36468. // Jump to end and forget the data so .add doesn't re-fire
  36469. firingIndex = list.length;
  36470. memory = false;
  36471. }
  36472. }
  36473. }
  36474. // Forget the data if we're done with it
  36475. if (!options.memory) {
  36476. memory = false;
  36477. }
  36478. firing = false;
  36479. // Clean up if we're done firing for good
  36480. if (_locked) {
  36481. // Keep an empty list if we have data for future add calls
  36482. if (memory) {
  36483. list = [];
  36484. // Otherwise, this object is spent
  36485. } else {
  36486. list = "";
  36487. }
  36488. }
  36489. },
  36490. // Actual Callbacks object
  36491. self = {
  36492. // Add a callback or a collection of callbacks to the list
  36493. add: function add() {
  36494. if (list) {
  36495. // If we have memory from a past run, we should fire after adding
  36496. if (memory && !firing) {
  36497. firingIndex = list.length - 1;
  36498. queue.push(memory);
  36499. }
  36500. (function add(args) {
  36501. jQuery.each(args, function (_, arg) {
  36502. if (isFunction(arg)) {
  36503. if (!options.unique || !self.has(arg)) {
  36504. list.push(arg);
  36505. }
  36506. } else if (arg && arg.length && toType(arg) !== "string") {
  36507. // Inspect recursively
  36508. add(arg);
  36509. }
  36510. });
  36511. })(arguments);
  36512. if (memory && !firing) {
  36513. fire();
  36514. }
  36515. }
  36516. return this;
  36517. },
  36518. // Remove a callback from the list
  36519. remove: function remove() {
  36520. jQuery.each(arguments, function (_, arg) {
  36521. var index;
  36522. while ((index = jQuery.inArray(arg, list, index)) > -1) {
  36523. list.splice(index, 1);
  36524. // Handle firing indexes
  36525. if (index <= firingIndex) {
  36526. firingIndex--;
  36527. }
  36528. }
  36529. });
  36530. return this;
  36531. },
  36532. // Check if a given callback is in the list.
  36533. // If no argument is given, return whether or not list has callbacks attached.
  36534. has: function has(fn) {
  36535. return fn ? jQuery.inArray(fn, list) > -1 : list.length > 0;
  36536. },
  36537. // Remove all callbacks from the list
  36538. empty: function empty() {
  36539. if (list) {
  36540. list = [];
  36541. }
  36542. return this;
  36543. },
  36544. // Disable .fire and .add
  36545. // Abort any current/pending executions
  36546. // Clear all callbacks and values
  36547. disable: function disable() {
  36548. _locked = queue = [];
  36549. list = memory = "";
  36550. return this;
  36551. },
  36552. disabled: function disabled() {
  36553. return !list;
  36554. },
  36555. // Disable .fire
  36556. // Also disable .add unless we have memory (since it would have no effect)
  36557. // Abort any pending executions
  36558. lock: function lock() {
  36559. _locked = queue = [];
  36560. if (!memory && !firing) {
  36561. list = memory = "";
  36562. }
  36563. return this;
  36564. },
  36565. locked: function locked() {
  36566. return !!_locked;
  36567. },
  36568. // Call all callbacks with the given context and arguments
  36569. fireWith: function fireWith(context, args) {
  36570. if (!_locked) {
  36571. args = args || [];
  36572. args = [context, args.slice ? args.slice() : args];
  36573. queue.push(args);
  36574. if (!firing) {
  36575. fire();
  36576. }
  36577. }
  36578. return this;
  36579. },
  36580. // Call all the callbacks with the given arguments
  36581. fire: function fire() {
  36582. self.fireWith(this, arguments);
  36583. return this;
  36584. },
  36585. // To know if the callbacks have already been called at least once
  36586. fired: function fired() {
  36587. return !!_fired;
  36588. }
  36589. };
  36590. return self;
  36591. };
  36592. function Identity(v) {
  36593. return v;
  36594. }
  36595. function Thrower(ex) {
  36596. throw ex;
  36597. }
  36598. function adoptValue(value, resolve, reject, noValue) {
  36599. var method;
  36600. try {
  36601. // Check for promise aspect first to privilege synchronous behavior
  36602. if (value && isFunction(method = value.promise)) {
  36603. method.call(value).done(resolve).fail(reject);
  36604. // Other thenables
  36605. } else if (value && isFunction(method = value.then)) {
  36606. method.call(value, resolve, reject);
  36607. // Other non-thenables
  36608. } else {
  36609. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  36610. // * false: [ value ].slice( 0 ) => resolve( value )
  36611. // * true: [ value ].slice( 1 ) => resolve()
  36612. resolve.apply(undefined, [value].slice(noValue));
  36613. }
  36614. // For Promises/A+, convert exceptions into rejections
  36615. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  36616. // Deferred#then to conditionally suppress rejection.
  36617. } catch (value) {
  36618. // Support: Android 4.0 only
  36619. // Strict mode functions invoked without .call/.apply get global-object context
  36620. reject.apply(undefined, [value]);
  36621. }
  36622. }
  36623. jQuery.extend({
  36624. Deferred: function Deferred(func) {
  36625. var tuples = [
  36626. // action, add listener, callbacks,
  36627. // ... .then handlers, argument index, [final state]
  36628. ["notify", "progress", jQuery.Callbacks("memory"), jQuery.Callbacks("memory"), 2], ["resolve", "done", jQuery.Callbacks("once memory"), jQuery.Callbacks("once memory"), 0, "resolved"], ["reject", "fail", jQuery.Callbacks("once memory"), jQuery.Callbacks("once memory"), 1, "rejected"]],
  36629. _state = "pending",
  36630. _promise = {
  36631. state: function state() {
  36632. return _state;
  36633. },
  36634. always: function always() {
  36635. deferred.done(arguments).fail(arguments);
  36636. return this;
  36637. },
  36638. "catch": function _catch(fn) {
  36639. return _promise.then(null, fn);
  36640. },
  36641. // Keep pipe for back-compat
  36642. pipe: function pipe() /* fnDone, fnFail, fnProgress */{
  36643. var fns = arguments;
  36644. return jQuery.Deferred(function (newDefer) {
  36645. jQuery.each(tuples, function (i, tuple) {
  36646. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  36647. var fn = isFunction(fns[tuple[4]]) && fns[tuple[4]];
  36648. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  36649. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  36650. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  36651. deferred[tuple[1]](function () {
  36652. var returned = fn && fn.apply(this, arguments);
  36653. if (returned && isFunction(returned.promise)) {
  36654. returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject);
  36655. } else {
  36656. newDefer[tuple[0] + "With"](this, fn ? [returned] : arguments);
  36657. }
  36658. });
  36659. });
  36660. fns = null;
  36661. }).promise();
  36662. },
  36663. then: function then(onFulfilled, onRejected, onProgress) {
  36664. var maxDepth = 0;
  36665. function resolve(depth, deferred, handler, special) {
  36666. return function () {
  36667. var that = this,
  36668. args = arguments,
  36669. mightThrow = function mightThrow() {
  36670. var returned, then;
  36671. // Support: Promises/A+ section 2.3.3.3.3
  36672. // https://promisesaplus.com/#point-59
  36673. // Ignore double-resolution attempts
  36674. if (depth < maxDepth) {
  36675. return;
  36676. }
  36677. returned = handler.apply(that, args);
  36678. // Support: Promises/A+ section 2.3.1
  36679. // https://promisesaplus.com/#point-48
  36680. if (returned === deferred.promise()) {
  36681. throw new TypeError("Thenable self-resolution");
  36682. }
  36683. // Support: Promises/A+ sections 2.3.3.1, 3.5
  36684. // https://promisesaplus.com/#point-54
  36685. // https://promisesaplus.com/#point-75
  36686. // Retrieve `then` only once
  36687. then = returned && (
  36688. // Support: Promises/A+ section 2.3.4
  36689. // https://promisesaplus.com/#point-64
  36690. // Only check objects and functions for thenability
  36691. (typeof returned === "undefined" ? "undefined" : _typeof(returned)) === "object" || typeof returned === "function") && returned.then;
  36692. // Handle a returned thenable
  36693. if (isFunction(then)) {
  36694. // Special processors (notify) just wait for resolution
  36695. if (special) {
  36696. then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special));
  36697. // Normal processors (resolve) also hook into progress
  36698. } else {
  36699. // ...and disregard older resolution values
  36700. maxDepth++;
  36701. then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special), resolve(maxDepth, deferred, Identity, deferred.notifyWith));
  36702. }
  36703. // Handle all other returned values
  36704. } else {
  36705. // Only substitute handlers pass on context
  36706. // and multiple values (non-spec behavior)
  36707. if (handler !== Identity) {
  36708. that = undefined;
  36709. args = [returned];
  36710. }
  36711. // Process the value(s)
  36712. // Default process is resolve
  36713. (special || deferred.resolveWith)(that, args);
  36714. }
  36715. },
  36716. // Only normal processors (resolve) catch and reject exceptions
  36717. process = special ? mightThrow : function () {
  36718. try {
  36719. mightThrow();
  36720. } catch (e) {
  36721. if (jQuery.Deferred.exceptionHook) {
  36722. jQuery.Deferred.exceptionHook(e, process.stackTrace);
  36723. }
  36724. // Support: Promises/A+ section 2.3.3.3.4.1
  36725. // https://promisesaplus.com/#point-61
  36726. // Ignore post-resolution exceptions
  36727. if (depth + 1 >= maxDepth) {
  36728. // Only substitute handlers pass on context
  36729. // and multiple values (non-spec behavior)
  36730. if (handler !== Thrower) {
  36731. that = undefined;
  36732. args = [e];
  36733. }
  36734. deferred.rejectWith(that, args);
  36735. }
  36736. }
  36737. };
  36738. // Support: Promises/A+ section 2.3.3.3.1
  36739. // https://promisesaplus.com/#point-57
  36740. // Re-resolve promises immediately to dodge false rejection from
  36741. // subsequent errors
  36742. if (depth) {
  36743. process();
  36744. } else {
  36745. // Call an optional hook to record the stack, in case of exception
  36746. // since it's otherwise lost when execution goes async
  36747. if (jQuery.Deferred.getStackHook) {
  36748. process.stackTrace = jQuery.Deferred.getStackHook();
  36749. }
  36750. window.setTimeout(process);
  36751. }
  36752. };
  36753. }
  36754. return jQuery.Deferred(function (newDefer) {
  36755. // progress_handlers.add( ... )
  36756. tuples[0][3].add(resolve(0, newDefer, isFunction(onProgress) ? onProgress : Identity, newDefer.notifyWith));
  36757. // fulfilled_handlers.add( ... )
  36758. tuples[1][3].add(resolve(0, newDefer, isFunction(onFulfilled) ? onFulfilled : Identity));
  36759. // rejected_handlers.add( ... )
  36760. tuples[2][3].add(resolve(0, newDefer, isFunction(onRejected) ? onRejected : Thrower));
  36761. }).promise();
  36762. },
  36763. // Get a promise for this deferred
  36764. // If obj is provided, the promise aspect is added to the object
  36765. promise: function promise(obj) {
  36766. return obj != null ? jQuery.extend(obj, _promise) : _promise;
  36767. }
  36768. },
  36769. deferred = {};
  36770. // Add list-specific methods
  36771. jQuery.each(tuples, function (i, tuple) {
  36772. var list = tuple[2],
  36773. stateString = tuple[5];
  36774. // promise.progress = list.add
  36775. // promise.done = list.add
  36776. // promise.fail = list.add
  36777. _promise[tuple[1]] = list.add;
  36778. // Handle state
  36779. if (stateString) {
  36780. list.add(function () {
  36781. // state = "resolved" (i.e., fulfilled)
  36782. // state = "rejected"
  36783. _state = stateString;
  36784. },
  36785. // rejected_callbacks.disable
  36786. // fulfilled_callbacks.disable
  36787. tuples[3 - i][2].disable,
  36788. // rejected_handlers.disable
  36789. // fulfilled_handlers.disable
  36790. tuples[3 - i][3].disable,
  36791. // progress_callbacks.lock
  36792. tuples[0][2].lock,
  36793. // progress_handlers.lock
  36794. tuples[0][3].lock);
  36795. }
  36796. // progress_handlers.fire
  36797. // fulfilled_handlers.fire
  36798. // rejected_handlers.fire
  36799. list.add(tuple[3].fire);
  36800. // deferred.notify = function() { deferred.notifyWith(...) }
  36801. // deferred.resolve = function() { deferred.resolveWith(...) }
  36802. // deferred.reject = function() { deferred.rejectWith(...) }
  36803. deferred[tuple[0]] = function () {
  36804. deferred[tuple[0] + "With"](this === deferred ? undefined : this, arguments);
  36805. return this;
  36806. };
  36807. // deferred.notifyWith = list.fireWith
  36808. // deferred.resolveWith = list.fireWith
  36809. // deferred.rejectWith = list.fireWith
  36810. deferred[tuple[0] + "With"] = list.fireWith;
  36811. });
  36812. // Make the deferred a promise
  36813. _promise.promise(deferred);
  36814. // Call given func if any
  36815. if (func) {
  36816. func.call(deferred, deferred);
  36817. }
  36818. // All done!
  36819. return deferred;
  36820. },
  36821. // Deferred helper
  36822. when: function when(singleValue) {
  36823. var
  36824. // count of uncompleted subordinates
  36825. remaining = arguments.length,
  36826. // count of unprocessed arguments
  36827. i = remaining,
  36828. // subordinate fulfillment data
  36829. resolveContexts = Array(i),
  36830. resolveValues = _slice.call(arguments),
  36831. // the master Deferred
  36832. master = jQuery.Deferred(),
  36833. // subordinate callback factory
  36834. updateFunc = function updateFunc(i) {
  36835. return function (value) {
  36836. resolveContexts[i] = this;
  36837. resolveValues[i] = arguments.length > 1 ? _slice.call(arguments) : value;
  36838. if (! --remaining) {
  36839. master.resolveWith(resolveContexts, resolveValues);
  36840. }
  36841. };
  36842. };
  36843. // Single- and empty arguments are adopted like Promise.resolve
  36844. if (remaining <= 1) {
  36845. adoptValue(singleValue, master.done(updateFunc(i)).resolve, master.reject, !remaining);
  36846. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  36847. if (master.state() === "pending" || isFunction(resolveValues[i] && resolveValues[i].then)) {
  36848. return master.then();
  36849. }
  36850. }
  36851. // Multiple arguments are aggregated like Promise.all array elements
  36852. while (i--) {
  36853. adoptValue(resolveValues[i], updateFunc(i), master.reject);
  36854. }
  36855. return master.promise();
  36856. }
  36857. });
  36858. // These usually indicate a programmer mistake during development,
  36859. // warn about them ASAP rather than swallowing them by default.
  36860. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  36861. jQuery.Deferred.exceptionHook = function (error, stack) {
  36862. // Support: IE 8 - 9 only
  36863. // Console exists when dev tools are open, which can happen at any time
  36864. if (window.console && window.console.warn && error && rerrorNames.test(error.name)) {
  36865. window.console.warn("jQuery.Deferred exception: " + error.message, error.stack, stack);
  36866. }
  36867. };
  36868. jQuery.readyException = function (error) {
  36869. window.setTimeout(function () {
  36870. throw error;
  36871. });
  36872. };
  36873. // The deferred used on DOM ready
  36874. var readyList = jQuery.Deferred();
  36875. jQuery.fn.ready = function (fn) {
  36876. readyList.then(fn)
  36877. // Wrap jQuery.readyException in a function so that the lookup
  36878. // happens at the time of error handling instead of callback
  36879. // registration.
  36880. .catch(function (error) {
  36881. jQuery.readyException(error);
  36882. });
  36883. return this;
  36884. };
  36885. jQuery.extend({
  36886. // Is the DOM ready to be used? Set to true once it occurs.
  36887. isReady: false,
  36888. // A counter to track how many items to wait for before
  36889. // the ready event fires. See #6781
  36890. readyWait: 1,
  36891. // Handle when the DOM is ready
  36892. ready: function ready(wait) {
  36893. // Abort if there are pending holds or we're already ready
  36894. if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
  36895. return;
  36896. }
  36897. // Remember that the DOM is ready
  36898. jQuery.isReady = true;
  36899. // If a normal DOM Ready event fired, decrement, and wait if need be
  36900. if (wait !== true && --jQuery.readyWait > 0) {
  36901. return;
  36902. }
  36903. // If there are functions bound, to execute
  36904. readyList.resolveWith(document, [jQuery]);
  36905. }
  36906. });
  36907. jQuery.ready.then = readyList.then;
  36908. // The ready event handler and self cleanup method
  36909. function completed() {
  36910. document.removeEventListener("DOMContentLoaded", completed);
  36911. window.removeEventListener("load", completed);
  36912. jQuery.ready();
  36913. }
  36914. // Catch cases where $(document).ready() is called
  36915. // after the browser event has already occurred.
  36916. // Support: IE <=9 - 10 only
  36917. // Older IE sometimes signals "interactive" too soon
  36918. if (document.readyState === "complete" || document.readyState !== "loading" && !document.documentElement.doScroll) {
  36919. // Handle it asynchronously to allow scripts the opportunity to delay ready
  36920. window.setTimeout(jQuery.ready);
  36921. } else {
  36922. // Use the handy event callback
  36923. document.addEventListener("DOMContentLoaded", completed);
  36924. // A fallback to window.onload, that will always work
  36925. window.addEventListener("load", completed);
  36926. }
  36927. // Multifunctional method to get and set values of a collection
  36928. // The value/s can optionally be executed if it's a function
  36929. var access = function access(elems, fn, key, value, chainable, emptyGet, raw) {
  36930. var i = 0,
  36931. len = elems.length,
  36932. bulk = key == null;
  36933. // Sets many values
  36934. if (toType(key) === "object") {
  36935. chainable = true;
  36936. for (i in key) {
  36937. access(elems, fn, i, key[i], true, emptyGet, raw);
  36938. }
  36939. // Sets one value
  36940. } else if (value !== undefined) {
  36941. chainable = true;
  36942. if (!isFunction(value)) {
  36943. raw = true;
  36944. }
  36945. if (bulk) {
  36946. // Bulk operations run against the entire set
  36947. if (raw) {
  36948. fn.call(elems, value);
  36949. fn = null;
  36950. // ...except when executing function values
  36951. } else {
  36952. bulk = fn;
  36953. fn = function fn(elem, key, value) {
  36954. return bulk.call(jQuery(elem), value);
  36955. };
  36956. }
  36957. }
  36958. if (fn) {
  36959. for (; i < len; i++) {
  36960. fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key)));
  36961. }
  36962. }
  36963. }
  36964. if (chainable) {
  36965. return elems;
  36966. }
  36967. // Gets
  36968. if (bulk) {
  36969. return fn.call(elems);
  36970. }
  36971. return len ? fn(elems[0], key) : emptyGet;
  36972. };
  36973. // Matches dashed string for camelizing
  36974. var rmsPrefix = /^-ms-/,
  36975. rdashAlpha = /-([a-z])/g;
  36976. // Used by camelCase as callback to replace()
  36977. function fcamelCase(all, letter) {
  36978. return letter.toUpperCase();
  36979. }
  36980. // Convert dashed to camelCase; used by the css and data modules
  36981. // Support: IE <=9 - 11, Edge 12 - 15
  36982. // Microsoft forgot to hump their vendor prefix (#9572)
  36983. function camelCase(string) {
  36984. return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase);
  36985. }
  36986. var acceptData = function acceptData(owner) {
  36987. // Accepts only:
  36988. // - Node
  36989. // - Node.ELEMENT_NODE
  36990. // - Node.DOCUMENT_NODE
  36991. // - Object
  36992. // - Any
  36993. return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType;
  36994. };
  36995. function Data() {
  36996. this.expando = jQuery.expando + Data.uid++;
  36997. }
  36998. Data.uid = 1;
  36999. Data.prototype = {
  37000. cache: function cache(owner) {
  37001. // Check if the owner object already has a cache
  37002. var value = owner[this.expando];
  37003. // If not, create one
  37004. if (!value) {
  37005. value = {};
  37006. // We can accept data for non-element nodes in modern browsers,
  37007. // but we should not, see #8335.
  37008. // Always return an empty object.
  37009. if (acceptData(owner)) {
  37010. // If it is a node unlikely to be stringify-ed or looped over
  37011. // use plain assignment
  37012. if (owner.nodeType) {
  37013. owner[this.expando] = value;
  37014. // Otherwise secure it in a non-enumerable property
  37015. // configurable must be true to allow the property to be
  37016. // deleted when data is removed
  37017. } else {
  37018. Object.defineProperty(owner, this.expando, {
  37019. value: value,
  37020. configurable: true
  37021. });
  37022. }
  37023. }
  37024. }
  37025. return value;
  37026. },
  37027. set: function set(owner, data, value) {
  37028. var prop,
  37029. cache = this.cache(owner);
  37030. // Handle: [ owner, key, value ] args
  37031. // Always use camelCase key (gh-2257)
  37032. if (typeof data === "string") {
  37033. cache[camelCase(data)] = value;
  37034. // Handle: [ owner, { properties } ] args
  37035. } else {
  37036. // Copy the properties one-by-one to the cache object
  37037. for (prop in data) {
  37038. cache[camelCase(prop)] = data[prop];
  37039. }
  37040. }
  37041. return cache;
  37042. },
  37043. get: function get(owner, key) {
  37044. return key === undefined ? this.cache(owner) :
  37045. // Always use camelCase key (gh-2257)
  37046. owner[this.expando] && owner[this.expando][camelCase(key)];
  37047. },
  37048. access: function access(owner, key, value) {
  37049. // In cases where either:
  37050. //
  37051. // 1. No key was specified
  37052. // 2. A string key was specified, but no value provided
  37053. //
  37054. // Take the "read" path and allow the get method to determine
  37055. // which value to return, respectively either:
  37056. //
  37057. // 1. The entire cache object
  37058. // 2. The data stored at the key
  37059. //
  37060. if (key === undefined || key && typeof key === "string" && value === undefined) {
  37061. return this.get(owner, key);
  37062. }
  37063. // When the key is not a string, or both a key and value
  37064. // are specified, set or extend (existing objects) with either:
  37065. //
  37066. // 1. An object of properties
  37067. // 2. A key and value
  37068. //
  37069. this.set(owner, key, value);
  37070. // Since the "set" path can have two possible entry points
  37071. // return the expected data based on which path was taken[*]
  37072. return value !== undefined ? value : key;
  37073. },
  37074. remove: function remove(owner, key) {
  37075. var i,
  37076. cache = owner[this.expando];
  37077. if (cache === undefined) {
  37078. return;
  37079. }
  37080. if (key !== undefined) {
  37081. // Support array or space separated string of keys
  37082. if (Array.isArray(key)) {
  37083. // If key is an array of keys...
  37084. // We always set camelCase keys, so remove that.
  37085. key = key.map(camelCase);
  37086. } else {
  37087. key = camelCase(key);
  37088. // If a key with the spaces exists, use it.
  37089. // Otherwise, create an array by matching non-whitespace
  37090. key = key in cache ? [key] : key.match(rnothtmlwhite) || [];
  37091. }
  37092. i = key.length;
  37093. while (i--) {
  37094. delete cache[key[i]];
  37095. }
  37096. }
  37097. // Remove the expando if there's no more data
  37098. if (key === undefined || jQuery.isEmptyObject(cache)) {
  37099. // Support: Chrome <=35 - 45
  37100. // Webkit & Blink performance suffers when deleting properties
  37101. // from DOM nodes, so set to undefined instead
  37102. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  37103. if (owner.nodeType) {
  37104. owner[this.expando] = undefined;
  37105. } else {
  37106. delete owner[this.expando];
  37107. }
  37108. }
  37109. },
  37110. hasData: function hasData(owner) {
  37111. var cache = owner[this.expando];
  37112. return cache !== undefined && !jQuery.isEmptyObject(cache);
  37113. }
  37114. };
  37115. var dataPriv = new Data();
  37116. var dataUser = new Data();
  37117. // Implementation Summary
  37118. //
  37119. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  37120. // 2. Improve the module's maintainability by reducing the storage
  37121. // paths to a single mechanism.
  37122. // 3. Use the same single mechanism to support "private" and "user" data.
  37123. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  37124. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  37125. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  37126. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  37127. rmultiDash = /[A-Z]/g;
  37128. function getData(data) {
  37129. if (data === "true") {
  37130. return true;
  37131. }
  37132. if (data === "false") {
  37133. return false;
  37134. }
  37135. if (data === "null") {
  37136. return null;
  37137. }
  37138. // Only convert to a number if it doesn't change the string
  37139. if (data === +data + "") {
  37140. return +data;
  37141. }
  37142. if (rbrace.test(data)) {
  37143. return JSON.parse(data);
  37144. }
  37145. return data;
  37146. }
  37147. function dataAttr(elem, key, data) {
  37148. var name;
  37149. // If nothing was found internally, try to fetch any
  37150. // data from the HTML5 data-* attribute
  37151. if (data === undefined && elem.nodeType === 1) {
  37152. name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase();
  37153. data = elem.getAttribute(name);
  37154. if (typeof data === "string") {
  37155. try {
  37156. data = getData(data);
  37157. } catch (e) {}
  37158. // Make sure we set the data so it isn't changed later
  37159. dataUser.set(elem, key, data);
  37160. } else {
  37161. data = undefined;
  37162. }
  37163. }
  37164. return data;
  37165. }
  37166. jQuery.extend({
  37167. hasData: function hasData(elem) {
  37168. return dataUser.hasData(elem) || dataPriv.hasData(elem);
  37169. },
  37170. data: function data(elem, name, _data) {
  37171. return dataUser.access(elem, name, _data);
  37172. },
  37173. removeData: function removeData(elem, name) {
  37174. dataUser.remove(elem, name);
  37175. },
  37176. // TODO: Now that all calls to _data and _removeData have been replaced
  37177. // with direct calls to dataPriv methods, these can be deprecated.
  37178. _data: function _data(elem, name, data) {
  37179. return dataPriv.access(elem, name, data);
  37180. },
  37181. _removeData: function _removeData(elem, name) {
  37182. dataPriv.remove(elem, name);
  37183. }
  37184. });
  37185. jQuery.fn.extend({
  37186. data: function data(key, value) {
  37187. var i,
  37188. name,
  37189. data,
  37190. elem = this[0],
  37191. attrs = elem && elem.attributes;
  37192. // Gets all values
  37193. if (key === undefined) {
  37194. if (this.length) {
  37195. data = dataUser.get(elem);
  37196. if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) {
  37197. i = attrs.length;
  37198. while (i--) {
  37199. // Support: IE 11 only
  37200. // The attrs elements can be null (#14894)
  37201. if (attrs[i]) {
  37202. name = attrs[i].name;
  37203. if (name.indexOf("data-") === 0) {
  37204. name = camelCase(name.slice(5));
  37205. dataAttr(elem, name, data[name]);
  37206. }
  37207. }
  37208. }
  37209. dataPriv.set(elem, "hasDataAttrs", true);
  37210. }
  37211. }
  37212. return data;
  37213. }
  37214. // Sets multiple values
  37215. if ((typeof key === "undefined" ? "undefined" : _typeof(key)) === "object") {
  37216. return this.each(function () {
  37217. dataUser.set(this, key);
  37218. });
  37219. }
  37220. return access(this, function (value) {
  37221. var data;
  37222. // The calling jQuery object (element matches) is not empty
  37223. // (and therefore has an element appears at this[ 0 ]) and the
  37224. // `value` parameter was not undefined. An empty jQuery object
  37225. // will result in `undefined` for elem = this[ 0 ] which will
  37226. // throw an exception if an attempt to read a data cache is made.
  37227. if (elem && value === undefined) {
  37228. // Attempt to get data from the cache
  37229. // The key will always be camelCased in Data
  37230. data = dataUser.get(elem, key);
  37231. if (data !== undefined) {
  37232. return data;
  37233. }
  37234. // Attempt to "discover" the data in
  37235. // HTML5 custom data-* attrs
  37236. data = dataAttr(elem, key);
  37237. if (data !== undefined) {
  37238. return data;
  37239. }
  37240. // We tried really hard, but the data doesn't exist.
  37241. return;
  37242. }
  37243. // Set the data...
  37244. this.each(function () {
  37245. // We always store the camelCased key
  37246. dataUser.set(this, key, value);
  37247. });
  37248. }, null, value, arguments.length > 1, null, true);
  37249. },
  37250. removeData: function removeData(key) {
  37251. return this.each(function () {
  37252. dataUser.remove(this, key);
  37253. });
  37254. }
  37255. });
  37256. jQuery.extend({
  37257. queue: function queue(elem, type, data) {
  37258. var queue;
  37259. if (elem) {
  37260. type = (type || "fx") + "queue";
  37261. queue = dataPriv.get(elem, type);
  37262. // Speed up dequeue by getting out quickly if this is just a lookup
  37263. if (data) {
  37264. if (!queue || Array.isArray(data)) {
  37265. queue = dataPriv.access(elem, type, jQuery.makeArray(data));
  37266. } else {
  37267. queue.push(data);
  37268. }
  37269. }
  37270. return queue || [];
  37271. }
  37272. },
  37273. dequeue: function dequeue(elem, type) {
  37274. type = type || "fx";
  37275. var queue = jQuery.queue(elem, type),
  37276. startLength = queue.length,
  37277. fn = queue.shift(),
  37278. hooks = jQuery._queueHooks(elem, type),
  37279. next = function next() {
  37280. jQuery.dequeue(elem, type);
  37281. };
  37282. // If the fx queue is dequeued, always remove the progress sentinel
  37283. if (fn === "inprogress") {
  37284. fn = queue.shift();
  37285. startLength--;
  37286. }
  37287. if (fn) {
  37288. // Add a progress sentinel to prevent the fx queue from being
  37289. // automatically dequeued
  37290. if (type === "fx") {
  37291. queue.unshift("inprogress");
  37292. }
  37293. // Clear up the last queue stop function
  37294. delete hooks.stop;
  37295. fn.call(elem, next, hooks);
  37296. }
  37297. if (!startLength && hooks) {
  37298. hooks.empty.fire();
  37299. }
  37300. },
  37301. // Not public - generate a queueHooks object, or return the current one
  37302. _queueHooks: function _queueHooks(elem, type) {
  37303. var key = type + "queueHooks";
  37304. return dataPriv.get(elem, key) || dataPriv.access(elem, key, {
  37305. empty: jQuery.Callbacks("once memory").add(function () {
  37306. dataPriv.remove(elem, [type + "queue", key]);
  37307. })
  37308. });
  37309. }
  37310. });
  37311. jQuery.fn.extend({
  37312. queue: function queue(type, data) {
  37313. var setter = 2;
  37314. if (typeof type !== "string") {
  37315. data = type;
  37316. type = "fx";
  37317. setter--;
  37318. }
  37319. if (arguments.length < setter) {
  37320. return jQuery.queue(this[0], type);
  37321. }
  37322. return data === undefined ? this : this.each(function () {
  37323. var queue = jQuery.queue(this, type, data);
  37324. // Ensure a hooks for this queue
  37325. jQuery._queueHooks(this, type);
  37326. if (type === "fx" && queue[0] !== "inprogress") {
  37327. jQuery.dequeue(this, type);
  37328. }
  37329. });
  37330. },
  37331. dequeue: function dequeue(type) {
  37332. return this.each(function () {
  37333. jQuery.dequeue(this, type);
  37334. });
  37335. },
  37336. clearQueue: function clearQueue(type) {
  37337. return this.queue(type || "fx", []);
  37338. },
  37339. // Get a promise resolved when queues of a certain type
  37340. // are emptied (fx is the type by default)
  37341. promise: function promise(type, obj) {
  37342. var tmp,
  37343. count = 1,
  37344. defer = jQuery.Deferred(),
  37345. elements = this,
  37346. i = this.length,
  37347. resolve = function resolve() {
  37348. if (! --count) {
  37349. defer.resolveWith(elements, [elements]);
  37350. }
  37351. };
  37352. if (typeof type !== "string") {
  37353. obj = type;
  37354. type = undefined;
  37355. }
  37356. type = type || "fx";
  37357. while (i--) {
  37358. tmp = dataPriv.get(elements[i], type + "queueHooks");
  37359. if (tmp && tmp.empty) {
  37360. count++;
  37361. tmp.empty.add(resolve);
  37362. }
  37363. }
  37364. resolve();
  37365. return defer.promise(obj);
  37366. }
  37367. });
  37368. var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source;
  37369. var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i");
  37370. var cssExpand = ["Top", "Right", "Bottom", "Left"];
  37371. var isHiddenWithinTree = function isHiddenWithinTree(elem, el) {
  37372. // isHiddenWithinTree might be called from jQuery#filter function;
  37373. // in that case, element will be second argument
  37374. elem = el || elem;
  37375. // Inline style trumps all
  37376. return elem.style.display === "none" || elem.style.display === "" &&
  37377. // Otherwise, check computed style
  37378. // Support: Firefox <=43 - 45
  37379. // Disconnected elements can have computed display: none, so first confirm that elem is
  37380. // in the document.
  37381. jQuery.contains(elem.ownerDocument, elem) && jQuery.css(elem, "display") === "none";
  37382. };
  37383. var swap = function swap(elem, options, callback, args) {
  37384. var ret,
  37385. name,
  37386. old = {};
  37387. // Remember the old values, and insert the new ones
  37388. for (name in options) {
  37389. old[name] = elem.style[name];
  37390. elem.style[name] = options[name];
  37391. }
  37392. ret = callback.apply(elem, args || []);
  37393. // Revert the old values
  37394. for (name in options) {
  37395. elem.style[name] = old[name];
  37396. }
  37397. return ret;
  37398. };
  37399. function adjustCSS(elem, prop, valueParts, tween) {
  37400. var adjusted,
  37401. scale,
  37402. maxIterations = 20,
  37403. currentValue = tween ? function () {
  37404. return tween.cur();
  37405. } : function () {
  37406. return jQuery.css(elem, prop, "");
  37407. },
  37408. initial = currentValue(),
  37409. unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? "" : "px"),
  37410. // Starting value computation is required for potential unit mismatches
  37411. initialInUnit = (jQuery.cssNumber[prop] || unit !== "px" && +initial) && rcssNum.exec(jQuery.css(elem, prop));
  37412. if (initialInUnit && initialInUnit[3] !== unit) {
  37413. // Support: Firefox <=54
  37414. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  37415. initial = initial / 2;
  37416. // Trust units reported by jQuery.css
  37417. unit = unit || initialInUnit[3];
  37418. // Iteratively approximate from a nonzero starting point
  37419. initialInUnit = +initial || 1;
  37420. while (maxIterations--) {
  37421. // Evaluate and update our best guess (doubling guesses that zero out).
  37422. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  37423. jQuery.style(elem, prop, initialInUnit + unit);
  37424. if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) {
  37425. maxIterations = 0;
  37426. }
  37427. initialInUnit = initialInUnit / scale;
  37428. }
  37429. initialInUnit = initialInUnit * 2;
  37430. jQuery.style(elem, prop, initialInUnit + unit);
  37431. // Make sure we update the tween properties later on
  37432. valueParts = valueParts || [];
  37433. }
  37434. if (valueParts) {
  37435. initialInUnit = +initialInUnit || +initial || 0;
  37436. // Apply relative offset (+=/-=) if specified
  37437. adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2];
  37438. if (tween) {
  37439. tween.unit = unit;
  37440. tween.start = initialInUnit;
  37441. tween.end = adjusted;
  37442. }
  37443. }
  37444. return adjusted;
  37445. }
  37446. var defaultDisplayMap = {};
  37447. function getDefaultDisplay(elem) {
  37448. var temp,
  37449. doc = elem.ownerDocument,
  37450. nodeName = elem.nodeName,
  37451. display = defaultDisplayMap[nodeName];
  37452. if (display) {
  37453. return display;
  37454. }
  37455. temp = doc.body.appendChild(doc.createElement(nodeName));
  37456. display = jQuery.css(temp, "display");
  37457. temp.parentNode.removeChild(temp);
  37458. if (display === "none") {
  37459. display = "block";
  37460. }
  37461. defaultDisplayMap[nodeName] = display;
  37462. return display;
  37463. }
  37464. function showHide(elements, show) {
  37465. var display,
  37466. elem,
  37467. values = [],
  37468. index = 0,
  37469. length = elements.length;
  37470. // Determine new display value for elements that need to change
  37471. for (; index < length; index++) {
  37472. elem = elements[index];
  37473. if (!elem.style) {
  37474. continue;
  37475. }
  37476. display = elem.style.display;
  37477. if (show) {
  37478. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  37479. // check is required in this first loop unless we have a nonempty display value (either
  37480. // inline or about-to-be-restored)
  37481. if (display === "none") {
  37482. values[index] = dataPriv.get(elem, "display") || null;
  37483. if (!values[index]) {
  37484. elem.style.display = "";
  37485. }
  37486. }
  37487. if (elem.style.display === "" && isHiddenWithinTree(elem)) {
  37488. values[index] = getDefaultDisplay(elem);
  37489. }
  37490. } else {
  37491. if (display !== "none") {
  37492. values[index] = "none";
  37493. // Remember what we're overwriting
  37494. dataPriv.set(elem, "display", display);
  37495. }
  37496. }
  37497. }
  37498. // Set the display of the elements in a second loop to avoid constant reflow
  37499. for (index = 0; index < length; index++) {
  37500. if (values[index] != null) {
  37501. elements[index].style.display = values[index];
  37502. }
  37503. }
  37504. return elements;
  37505. }
  37506. jQuery.fn.extend({
  37507. show: function show() {
  37508. return showHide(this, true);
  37509. },
  37510. hide: function hide() {
  37511. return showHide(this);
  37512. },
  37513. toggle: function toggle(state) {
  37514. if (typeof state === "boolean") {
  37515. return state ? this.show() : this.hide();
  37516. }
  37517. return this.each(function () {
  37518. if (isHiddenWithinTree(this)) {
  37519. jQuery(this).show();
  37520. } else {
  37521. jQuery(this).hide();
  37522. }
  37523. });
  37524. }
  37525. });
  37526. var rcheckableType = /^(?:checkbox|radio)$/i;
  37527. var rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]+)/i;
  37528. var rscriptType = /^$|^module$|\/(?:java|ecma)script/i;
  37529. // We have to close these tags to support XHTML (#13200)
  37530. var wrapMap = {
  37531. // Support: IE <=9 only
  37532. option: [1, "<select multiple='multiple'>", "</select>"],
  37533. // XHTML parsers do not magically insert elements in the
  37534. // same way that tag soup parsers do. So we cannot shorten
  37535. // this by omitting <tbody> or other required elements.
  37536. thead: [1, "<table>", "</table>"],
  37537. col: [2, "<table><colgroup>", "</colgroup></table>"],
  37538. tr: [2, "<table><tbody>", "</tbody></table>"],
  37539. td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
  37540. _default: [0, "", ""]
  37541. };
  37542. // Support: IE <=9 only
  37543. wrapMap.optgroup = wrapMap.option;
  37544. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  37545. wrapMap.th = wrapMap.td;
  37546. function getAll(context, tag) {
  37547. // Support: IE <=9 - 11 only
  37548. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  37549. var ret;
  37550. if (typeof context.getElementsByTagName !== "undefined") {
  37551. ret = context.getElementsByTagName(tag || "*");
  37552. } else if (typeof context.querySelectorAll !== "undefined") {
  37553. ret = context.querySelectorAll(tag || "*");
  37554. } else {
  37555. ret = [];
  37556. }
  37557. if (tag === undefined || tag && nodeName(context, tag)) {
  37558. return jQuery.merge([context], ret);
  37559. }
  37560. return ret;
  37561. }
  37562. // Mark scripts as having already been evaluated
  37563. function setGlobalEval(elems, refElements) {
  37564. var i = 0,
  37565. l = elems.length;
  37566. for (; i < l; i++) {
  37567. dataPriv.set(elems[i], "globalEval", !refElements || dataPriv.get(refElements[i], "globalEval"));
  37568. }
  37569. }
  37570. var rhtml = /<|&#?\w+;/;
  37571. function buildFragment(elems, context, scripts, selection, ignored) {
  37572. var elem,
  37573. tmp,
  37574. tag,
  37575. wrap,
  37576. contains,
  37577. j,
  37578. fragment = context.createDocumentFragment(),
  37579. nodes = [],
  37580. i = 0,
  37581. l = elems.length;
  37582. for (; i < l; i++) {
  37583. elem = elems[i];
  37584. if (elem || elem === 0) {
  37585. // Add nodes directly
  37586. if (toType(elem) === "object") {
  37587. // Support: Android <=4.0 only, PhantomJS 1 only
  37588. // push.apply(_, arraylike) throws on ancient WebKit
  37589. jQuery.merge(nodes, elem.nodeType ? [elem] : elem);
  37590. // Convert non-html into a text node
  37591. } else if (!rhtml.test(elem)) {
  37592. nodes.push(context.createTextNode(elem));
  37593. // Convert html into DOM nodes
  37594. } else {
  37595. tmp = tmp || fragment.appendChild(context.createElement("div"));
  37596. // Deserialize a standard representation
  37597. tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
  37598. wrap = wrapMap[tag] || wrapMap._default;
  37599. tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2];
  37600. // Descend through wrappers to the right content
  37601. j = wrap[0];
  37602. while (j--) {
  37603. tmp = tmp.lastChild;
  37604. }
  37605. // Support: Android <=4.0 only, PhantomJS 1 only
  37606. // push.apply(_, arraylike) throws on ancient WebKit
  37607. jQuery.merge(nodes, tmp.childNodes);
  37608. // Remember the top-level container
  37609. tmp = fragment.firstChild;
  37610. // Ensure the created nodes are orphaned (#12392)
  37611. tmp.textContent = "";
  37612. }
  37613. }
  37614. }
  37615. // Remove wrapper from fragment
  37616. fragment.textContent = "";
  37617. i = 0;
  37618. while (elem = nodes[i++]) {
  37619. // Skip elements already in the context collection (trac-4087)
  37620. if (selection && jQuery.inArray(elem, selection) > -1) {
  37621. if (ignored) {
  37622. ignored.push(elem);
  37623. }
  37624. continue;
  37625. }
  37626. contains = jQuery.contains(elem.ownerDocument, elem);
  37627. // Append to fragment
  37628. tmp = getAll(fragment.appendChild(elem), "script");
  37629. // Preserve script evaluation history
  37630. if (contains) {
  37631. setGlobalEval(tmp);
  37632. }
  37633. // Capture executables
  37634. if (scripts) {
  37635. j = 0;
  37636. while (elem = tmp[j++]) {
  37637. if (rscriptType.test(elem.type || "")) {
  37638. scripts.push(elem);
  37639. }
  37640. }
  37641. }
  37642. }
  37643. return fragment;
  37644. }
  37645. (function () {
  37646. var fragment = document.createDocumentFragment(),
  37647. div = fragment.appendChild(document.createElement("div")),
  37648. input = document.createElement("input");
  37649. // Support: Android 4.0 - 4.3 only
  37650. // Check state lost if the name is set (#11217)
  37651. // Support: Windows Web Apps (WWA)
  37652. // `name` and `type` must use .setAttribute for WWA (#14901)
  37653. input.setAttribute("type", "radio");
  37654. input.setAttribute("checked", "checked");
  37655. input.setAttribute("name", "t");
  37656. div.appendChild(input);
  37657. // Support: Android <=4.1 only
  37658. // Older WebKit doesn't clone checked state correctly in fragments
  37659. support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
  37660. // Support: IE <=11 only
  37661. // Make sure textarea (and checkbox) defaultValue is properly cloned
  37662. div.innerHTML = "<textarea>x</textarea>";
  37663. support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
  37664. })();
  37665. var documentElement = document.documentElement;
  37666. var rkeyEvent = /^key/,
  37667. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  37668. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  37669. function returnTrue() {
  37670. return true;
  37671. }
  37672. function returnFalse() {
  37673. return false;
  37674. }
  37675. // Support: IE <=9 only
  37676. // See #13393 for more info
  37677. function safeActiveElement() {
  37678. try {
  37679. return document.activeElement;
  37680. } catch (err) {}
  37681. }
  37682. function _on(elem, types, selector, data, fn, one) {
  37683. var origFn, type;
  37684. // Types can be a map of types/handlers
  37685. if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") {
  37686. // ( types-Object, selector, data )
  37687. if (typeof selector !== "string") {
  37688. // ( types-Object, data )
  37689. data = data || selector;
  37690. selector = undefined;
  37691. }
  37692. for (type in types) {
  37693. _on(elem, type, selector, data, types[type], one);
  37694. }
  37695. return elem;
  37696. }
  37697. if (data == null && fn == null) {
  37698. // ( types, fn )
  37699. fn = selector;
  37700. data = selector = undefined;
  37701. } else if (fn == null) {
  37702. if (typeof selector === "string") {
  37703. // ( types, selector, fn )
  37704. fn = data;
  37705. data = undefined;
  37706. } else {
  37707. // ( types, data, fn )
  37708. fn = data;
  37709. data = selector;
  37710. selector = undefined;
  37711. }
  37712. }
  37713. if (fn === false) {
  37714. fn = returnFalse;
  37715. } else if (!fn) {
  37716. return elem;
  37717. }
  37718. if (one === 1) {
  37719. origFn = fn;
  37720. fn = function fn(event) {
  37721. // Can use an empty set, since event contains the info
  37722. jQuery().off(event);
  37723. return origFn.apply(this, arguments);
  37724. };
  37725. // Use same guid so caller can remove using origFn
  37726. fn.guid = origFn.guid || (origFn.guid = jQuery.guid++);
  37727. }
  37728. return elem.each(function () {
  37729. jQuery.event.add(this, types, fn, data, selector);
  37730. });
  37731. }
  37732. /*
  37733. * Helper functions for managing events -- not part of the public interface.
  37734. * Props to Dean Edwards' addEvent library for many of the ideas.
  37735. */
  37736. jQuery.event = {
  37737. global: {},
  37738. add: function add(elem, types, handler, data, selector) {
  37739. var handleObjIn,
  37740. eventHandle,
  37741. tmp,
  37742. events,
  37743. t,
  37744. handleObj,
  37745. special,
  37746. handlers,
  37747. type,
  37748. namespaces,
  37749. origType,
  37750. elemData = dataPriv.get(elem);
  37751. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  37752. if (!elemData) {
  37753. return;
  37754. }
  37755. // Caller can pass in an object of custom data in lieu of the handler
  37756. if (handler.handler) {
  37757. handleObjIn = handler;
  37758. handler = handleObjIn.handler;
  37759. selector = handleObjIn.selector;
  37760. }
  37761. // Ensure that invalid selectors throw exceptions at attach time
  37762. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  37763. if (selector) {
  37764. jQuery.find.matchesSelector(documentElement, selector);
  37765. }
  37766. // Make sure that the handler has a unique ID, used to find/remove it later
  37767. if (!handler.guid) {
  37768. handler.guid = jQuery.guid++;
  37769. }
  37770. // Init the element's event structure and main handler, if this is the first
  37771. if (!(events = elemData.events)) {
  37772. events = elemData.events = {};
  37773. }
  37774. if (!(eventHandle = elemData.handle)) {
  37775. eventHandle = elemData.handle = function (e) {
  37776. // Discard the second event of a jQuery.event.trigger() and
  37777. // when an event is called after a page has unloaded
  37778. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply(elem, arguments) : undefined;
  37779. };
  37780. }
  37781. // Handle multiple events separated by a space
  37782. types = (types || "").match(rnothtmlwhite) || [""];
  37783. t = types.length;
  37784. while (t--) {
  37785. tmp = rtypenamespace.exec(types[t]) || [];
  37786. type = origType = tmp[1];
  37787. namespaces = (tmp[2] || "").split(".").sort();
  37788. // There *must* be a type, no attaching namespace-only handlers
  37789. if (!type) {
  37790. continue;
  37791. }
  37792. // If event changes its type, use the special event handlers for the changed type
  37793. special = jQuery.event.special[type] || {};
  37794. // If selector defined, determine special event api type, otherwise given type
  37795. type = (selector ? special.delegateType : special.bindType) || type;
  37796. // Update special based on newly reset type
  37797. special = jQuery.event.special[type] || {};
  37798. // handleObj is passed to all event handlers
  37799. handleObj = jQuery.extend({
  37800. type: type,
  37801. origType: origType,
  37802. data: data,
  37803. handler: handler,
  37804. guid: handler.guid,
  37805. selector: selector,
  37806. needsContext: selector && jQuery.expr.match.needsContext.test(selector),
  37807. namespace: namespaces.join(".")
  37808. }, handleObjIn);
  37809. // Init the event handler queue if we're the first
  37810. if (!(handlers = events[type])) {
  37811. handlers = events[type] = [];
  37812. handlers.delegateCount = 0;
  37813. // Only use addEventListener if the special events handler returns false
  37814. if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {
  37815. if (elem.addEventListener) {
  37816. elem.addEventListener(type, eventHandle);
  37817. }
  37818. }
  37819. }
  37820. if (special.add) {
  37821. special.add.call(elem, handleObj);
  37822. if (!handleObj.handler.guid) {
  37823. handleObj.handler.guid = handler.guid;
  37824. }
  37825. }
  37826. // Add to the element's handler list, delegates in front
  37827. if (selector) {
  37828. handlers.splice(handlers.delegateCount++, 0, handleObj);
  37829. } else {
  37830. handlers.push(handleObj);
  37831. }
  37832. // Keep track of which events have ever been used, for event optimization
  37833. jQuery.event.global[type] = true;
  37834. }
  37835. },
  37836. // Detach an event or set of events from an element
  37837. remove: function remove(elem, types, handler, selector, mappedTypes) {
  37838. var j,
  37839. origCount,
  37840. tmp,
  37841. events,
  37842. t,
  37843. handleObj,
  37844. special,
  37845. handlers,
  37846. type,
  37847. namespaces,
  37848. origType,
  37849. elemData = dataPriv.hasData(elem) && dataPriv.get(elem);
  37850. if (!elemData || !(events = elemData.events)) {
  37851. return;
  37852. }
  37853. // Once for each type.namespace in types; type may be omitted
  37854. types = (types || "").match(rnothtmlwhite) || [""];
  37855. t = types.length;
  37856. while (t--) {
  37857. tmp = rtypenamespace.exec(types[t]) || [];
  37858. type = origType = tmp[1];
  37859. namespaces = (tmp[2] || "").split(".").sort();
  37860. // Unbind all events (on this namespace, if provided) for the element
  37861. if (!type) {
  37862. for (type in events) {
  37863. jQuery.event.remove(elem, type + types[t], handler, selector, true);
  37864. }
  37865. continue;
  37866. }
  37867. special = jQuery.event.special[type] || {};
  37868. type = (selector ? special.delegateType : special.bindType) || type;
  37869. handlers = events[type] || [];
  37870. tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
  37871. // Remove matching events
  37872. origCount = j = handlers.length;
  37873. while (j--) {
  37874. handleObj = handlers[j];
  37875. if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) {
  37876. handlers.splice(j, 1);
  37877. if (handleObj.selector) {
  37878. handlers.delegateCount--;
  37879. }
  37880. if (special.remove) {
  37881. special.remove.call(elem, handleObj);
  37882. }
  37883. }
  37884. }
  37885. // Remove generic event handler if we removed something and no more handlers exist
  37886. // (avoids potential for endless recursion during removal of special event handlers)
  37887. if (origCount && !handlers.length) {
  37888. if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {
  37889. jQuery.removeEvent(elem, type, elemData.handle);
  37890. }
  37891. delete events[type];
  37892. }
  37893. }
  37894. // Remove data and the expando if it's no longer used
  37895. if (jQuery.isEmptyObject(events)) {
  37896. dataPriv.remove(elem, "handle events");
  37897. }
  37898. },
  37899. dispatch: function dispatch(nativeEvent) {
  37900. // Make a writable jQuery.Event from the native event object
  37901. var event = jQuery.event.fix(nativeEvent);
  37902. var i,
  37903. j,
  37904. ret,
  37905. matched,
  37906. handleObj,
  37907. handlerQueue,
  37908. args = new Array(arguments.length),
  37909. handlers = (dataPriv.get(this, "events") || {})[event.type] || [],
  37910. special = jQuery.event.special[event.type] || {};
  37911. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  37912. args[0] = event;
  37913. for (i = 1; i < arguments.length; i++) {
  37914. args[i] = arguments[i];
  37915. }
  37916. event.delegateTarget = this;
  37917. // Call the preDispatch hook for the mapped type, and let it bail if desired
  37918. if (special.preDispatch && special.preDispatch.call(this, event) === false) {
  37919. return;
  37920. }
  37921. // Determine handlers
  37922. handlerQueue = jQuery.event.handlers.call(this, event, handlers);
  37923. // Run delegates first; they may want to stop propagation beneath us
  37924. i = 0;
  37925. while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {
  37926. event.currentTarget = matched.elem;
  37927. j = 0;
  37928. while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {
  37929. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  37930. // a subset or equal to those in the bound event (both can have no namespace).
  37931. if (!event.rnamespace || event.rnamespace.test(handleObj.namespace)) {
  37932. event.handleObj = handleObj;
  37933. event.data = handleObj.data;
  37934. ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);
  37935. if (ret !== undefined) {
  37936. if ((event.result = ret) === false) {
  37937. event.preventDefault();
  37938. event.stopPropagation();
  37939. }
  37940. }
  37941. }
  37942. }
  37943. }
  37944. // Call the postDispatch hook for the mapped type
  37945. if (special.postDispatch) {
  37946. special.postDispatch.call(this, event);
  37947. }
  37948. return event.result;
  37949. },
  37950. handlers: function handlers(event, _handlers) {
  37951. var i,
  37952. handleObj,
  37953. sel,
  37954. matchedHandlers,
  37955. matchedSelectors,
  37956. handlerQueue = [],
  37957. delegateCount = _handlers.delegateCount,
  37958. cur = event.target;
  37959. // Find delegate handlers
  37960. if (delegateCount &&
  37961. // Support: IE <=9
  37962. // Black-hole SVG <use> instance trees (trac-13180)
  37963. cur.nodeType &&
  37964. // Support: Firefox <=42
  37965. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  37966. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  37967. // Support: IE 11 only
  37968. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  37969. !(event.type === "click" && event.button >= 1)) {
  37970. for (; cur !== this; cur = cur.parentNode || this) {
  37971. // Don't check non-elements (#13208)
  37972. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  37973. if (cur.nodeType === 1 && !(event.type === "click" && cur.disabled === true)) {
  37974. matchedHandlers = [];
  37975. matchedSelectors = {};
  37976. for (i = 0; i < delegateCount; i++) {
  37977. handleObj = _handlers[i];
  37978. // Don't conflict with Object.prototype properties (#13203)
  37979. sel = handleObj.selector + " ";
  37980. if (matchedSelectors[sel] === undefined) {
  37981. matchedSelectors[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) > -1 : jQuery.find(sel, this, null, [cur]).length;
  37982. }
  37983. if (matchedSelectors[sel]) {
  37984. matchedHandlers.push(handleObj);
  37985. }
  37986. }
  37987. if (matchedHandlers.length) {
  37988. handlerQueue.push({ elem: cur, handlers: matchedHandlers });
  37989. }
  37990. }
  37991. }
  37992. }
  37993. // Add the remaining (directly-bound) handlers
  37994. cur = this;
  37995. if (delegateCount < _handlers.length) {
  37996. handlerQueue.push({ elem: cur, handlers: _handlers.slice(delegateCount) });
  37997. }
  37998. return handlerQueue;
  37999. },
  38000. addProp: function addProp(name, hook) {
  38001. Object.defineProperty(jQuery.Event.prototype, name, {
  38002. enumerable: true,
  38003. configurable: true,
  38004. get: isFunction(hook) ? function () {
  38005. if (this.originalEvent) {
  38006. return hook(this.originalEvent);
  38007. }
  38008. } : function () {
  38009. if (this.originalEvent) {
  38010. return this.originalEvent[name];
  38011. }
  38012. },
  38013. set: function set(value) {
  38014. Object.defineProperty(this, name, {
  38015. enumerable: true,
  38016. configurable: true,
  38017. writable: true,
  38018. value: value
  38019. });
  38020. }
  38021. });
  38022. },
  38023. fix: function fix(originalEvent) {
  38024. return originalEvent[jQuery.expando] ? originalEvent : new jQuery.Event(originalEvent);
  38025. },
  38026. special: {
  38027. load: {
  38028. // Prevent triggered image.load events from bubbling to window.load
  38029. noBubble: true
  38030. },
  38031. focus: {
  38032. // Fire native event if possible so blur/focus sequence is correct
  38033. trigger: function trigger() {
  38034. if (this !== safeActiveElement() && this.focus) {
  38035. this.focus();
  38036. return false;
  38037. }
  38038. },
  38039. delegateType: "focusin"
  38040. },
  38041. blur: {
  38042. trigger: function trigger() {
  38043. if (this === safeActiveElement() && this.blur) {
  38044. this.blur();
  38045. return false;
  38046. }
  38047. },
  38048. delegateType: "focusout"
  38049. },
  38050. click: {
  38051. // For checkbox, fire native event so checked state will be right
  38052. trigger: function trigger() {
  38053. if (this.type === "checkbox" && this.click && nodeName(this, "input")) {
  38054. this.click();
  38055. return false;
  38056. }
  38057. },
  38058. // For cross-browser consistency, don't fire native .click() on links
  38059. _default: function _default(event) {
  38060. return nodeName(event.target, "a");
  38061. }
  38062. },
  38063. beforeunload: {
  38064. postDispatch: function postDispatch(event) {
  38065. // Support: Firefox 20+
  38066. // Firefox doesn't alert if the returnValue field is not set.
  38067. if (event.result !== undefined && event.originalEvent) {
  38068. event.originalEvent.returnValue = event.result;
  38069. }
  38070. }
  38071. }
  38072. }
  38073. };
  38074. jQuery.removeEvent = function (elem, type, handle) {
  38075. // This "if" is needed for plain objects
  38076. if (elem.removeEventListener) {
  38077. elem.removeEventListener(type, handle);
  38078. }
  38079. };
  38080. jQuery.Event = function (src, props) {
  38081. // Allow instantiation without the 'new' keyword
  38082. if (!(this instanceof jQuery.Event)) {
  38083. return new jQuery.Event(src, props);
  38084. }
  38085. // Event object
  38086. if (src && src.type) {
  38087. this.originalEvent = src;
  38088. this.type = src.type;
  38089. // Events bubbling up the document may have been marked as prevented
  38090. // by a handler lower down the tree; reflect the correct value.
  38091. this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined &&
  38092. // Support: Android <=2.3 only
  38093. src.returnValue === false ? returnTrue : returnFalse;
  38094. // Create target properties
  38095. // Support: Safari <=6 - 7 only
  38096. // Target should not be a text node (#504, #13143)
  38097. this.target = src.target && src.target.nodeType === 3 ? src.target.parentNode : src.target;
  38098. this.currentTarget = src.currentTarget;
  38099. this.relatedTarget = src.relatedTarget;
  38100. // Event type
  38101. } else {
  38102. this.type = src;
  38103. }
  38104. // Put explicitly provided properties onto the event object
  38105. if (props) {
  38106. jQuery.extend(this, props);
  38107. }
  38108. // Create a timestamp if incoming event doesn't have one
  38109. this.timeStamp = src && src.timeStamp || Date.now();
  38110. // Mark it as fixed
  38111. this[jQuery.expando] = true;
  38112. };
  38113. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  38114. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  38115. jQuery.Event.prototype = {
  38116. constructor: jQuery.Event,
  38117. isDefaultPrevented: returnFalse,
  38118. isPropagationStopped: returnFalse,
  38119. isImmediatePropagationStopped: returnFalse,
  38120. isSimulated: false,
  38121. preventDefault: function preventDefault() {
  38122. var e = this.originalEvent;
  38123. this.isDefaultPrevented = returnTrue;
  38124. if (e && !this.isSimulated) {
  38125. e.preventDefault();
  38126. }
  38127. },
  38128. stopPropagation: function stopPropagation() {
  38129. var e = this.originalEvent;
  38130. this.isPropagationStopped = returnTrue;
  38131. if (e && !this.isSimulated) {
  38132. e.stopPropagation();
  38133. }
  38134. },
  38135. stopImmediatePropagation: function stopImmediatePropagation() {
  38136. var e = this.originalEvent;
  38137. this.isImmediatePropagationStopped = returnTrue;
  38138. if (e && !this.isSimulated) {
  38139. e.stopImmediatePropagation();
  38140. }
  38141. this.stopPropagation();
  38142. }
  38143. };
  38144. // Includes all common event props including KeyEvent and MouseEvent specific props
  38145. jQuery.each({
  38146. altKey: true,
  38147. bubbles: true,
  38148. cancelable: true,
  38149. changedTouches: true,
  38150. ctrlKey: true,
  38151. detail: true,
  38152. eventPhase: true,
  38153. metaKey: true,
  38154. pageX: true,
  38155. pageY: true,
  38156. shiftKey: true,
  38157. view: true,
  38158. "char": true,
  38159. charCode: true,
  38160. key: true,
  38161. keyCode: true,
  38162. button: true,
  38163. buttons: true,
  38164. clientX: true,
  38165. clientY: true,
  38166. offsetX: true,
  38167. offsetY: true,
  38168. pointerId: true,
  38169. pointerType: true,
  38170. screenX: true,
  38171. screenY: true,
  38172. targetTouches: true,
  38173. toElement: true,
  38174. touches: true,
  38175. which: function which(event) {
  38176. var button = event.button;
  38177. // Add which for key events
  38178. if (event.which == null && rkeyEvent.test(event.type)) {
  38179. return event.charCode != null ? event.charCode : event.keyCode;
  38180. }
  38181. // Add which for click: 1 === left; 2 === middle; 3 === right
  38182. if (!event.which && button !== undefined && rmouseEvent.test(event.type)) {
  38183. if (button & 1) {
  38184. return 1;
  38185. }
  38186. if (button & 2) {
  38187. return 3;
  38188. }
  38189. if (button & 4) {
  38190. return 2;
  38191. }
  38192. return 0;
  38193. }
  38194. return event.which;
  38195. }
  38196. }, jQuery.event.addProp);
  38197. // Create mouseenter/leave events using mouseover/out and event-time checks
  38198. // so that event delegation works in jQuery.
  38199. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  38200. //
  38201. // Support: Safari 7 only
  38202. // Safari sends mouseenter too often; see:
  38203. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  38204. // for the description of the bug (it existed in older Chrome versions as well).
  38205. jQuery.each({
  38206. mouseenter: "mouseover",
  38207. mouseleave: "mouseout",
  38208. pointerenter: "pointerover",
  38209. pointerleave: "pointerout"
  38210. }, function (orig, fix) {
  38211. jQuery.event.special[orig] = {
  38212. delegateType: fix,
  38213. bindType: fix,
  38214. handle: function handle(event) {
  38215. var ret,
  38216. target = this,
  38217. related = event.relatedTarget,
  38218. handleObj = event.handleObj;
  38219. // For mouseenter/leave call the handler if related is outside the target.
  38220. // NB: No relatedTarget if the mouse left/entered the browser window
  38221. if (!related || related !== target && !jQuery.contains(target, related)) {
  38222. event.type = handleObj.origType;
  38223. ret = handleObj.handler.apply(this, arguments);
  38224. event.type = fix;
  38225. }
  38226. return ret;
  38227. }
  38228. };
  38229. });
  38230. jQuery.fn.extend({
  38231. on: function on(types, selector, data, fn) {
  38232. return _on(this, types, selector, data, fn);
  38233. },
  38234. one: function one(types, selector, data, fn) {
  38235. return _on(this, types, selector, data, fn, 1);
  38236. },
  38237. off: function off(types, selector, fn) {
  38238. var handleObj, type;
  38239. if (types && types.preventDefault && types.handleObj) {
  38240. // ( event ) dispatched jQuery.Event
  38241. handleObj = types.handleObj;
  38242. jQuery(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler);
  38243. return this;
  38244. }
  38245. if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") {
  38246. // ( types-object [, selector] )
  38247. for (type in types) {
  38248. this.off(type, selector, types[type]);
  38249. }
  38250. return this;
  38251. }
  38252. if (selector === false || typeof selector === "function") {
  38253. // ( types [, fn] )
  38254. fn = selector;
  38255. selector = undefined;
  38256. }
  38257. if (fn === false) {
  38258. fn = returnFalse;
  38259. }
  38260. return this.each(function () {
  38261. jQuery.event.remove(this, types, fn, selector);
  38262. });
  38263. }
  38264. });
  38265. var
  38266. /* eslint-disable max-len */
  38267. // See https://github.com/eslint/eslint/issues/3229
  38268. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  38269. /* eslint-enable */
  38270. // Support: IE <=10 - 11, Edge 12 - 13 only
  38271. // In IE/Edge using regex groups here causes severe slowdowns.
  38272. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  38273. rnoInnerhtml = /<script|<style|<link/i,
  38274. // checked="checked" or checked
  38275. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  38276. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  38277. // Prefer a tbody over its parent table for containing new rows
  38278. function manipulationTarget(elem, content) {
  38279. if (nodeName(elem, "table") && nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")) {
  38280. return jQuery(elem).children("tbody")[0] || elem;
  38281. }
  38282. return elem;
  38283. }
  38284. // Replace/restore the type attribute of script elements for safe DOM manipulation
  38285. function disableScript(elem) {
  38286. elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
  38287. return elem;
  38288. }
  38289. function restoreScript(elem) {
  38290. if ((elem.type || "").slice(0, 5) === "true/") {
  38291. elem.type = elem.type.slice(5);
  38292. } else {
  38293. elem.removeAttribute("type");
  38294. }
  38295. return elem;
  38296. }
  38297. function cloneCopyEvent(src, dest) {
  38298. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  38299. if (dest.nodeType !== 1) {
  38300. return;
  38301. }
  38302. // 1. Copy private data: events, handlers, etc.
  38303. if (dataPriv.hasData(src)) {
  38304. pdataOld = dataPriv.access(src);
  38305. pdataCur = dataPriv.set(dest, pdataOld);
  38306. events = pdataOld.events;
  38307. if (events) {
  38308. delete pdataCur.handle;
  38309. pdataCur.events = {};
  38310. for (type in events) {
  38311. for (i = 0, l = events[type].length; i < l; i++) {
  38312. jQuery.event.add(dest, type, events[type][i]);
  38313. }
  38314. }
  38315. }
  38316. }
  38317. // 2. Copy user data
  38318. if (dataUser.hasData(src)) {
  38319. udataOld = dataUser.access(src);
  38320. udataCur = jQuery.extend({}, udataOld);
  38321. dataUser.set(dest, udataCur);
  38322. }
  38323. }
  38324. // Fix IE bugs, see support tests
  38325. function fixInput(src, dest) {
  38326. var nodeName = dest.nodeName.toLowerCase();
  38327. // Fails to persist the checked state of a cloned checkbox or radio button.
  38328. if (nodeName === "input" && rcheckableType.test(src.type)) {
  38329. dest.checked = src.checked;
  38330. // Fails to return the selected option to the default selected state when cloning options
  38331. } else if (nodeName === "input" || nodeName === "textarea") {
  38332. dest.defaultValue = src.defaultValue;
  38333. }
  38334. }
  38335. function domManip(collection, args, callback, ignored) {
  38336. // Flatten any nested arrays
  38337. args = concat.apply([], args);
  38338. var fragment,
  38339. first,
  38340. scripts,
  38341. hasScripts,
  38342. node,
  38343. doc,
  38344. i = 0,
  38345. l = collection.length,
  38346. iNoClone = l - 1,
  38347. value = args[0],
  38348. valueIsFunction = isFunction(value);
  38349. // We can't cloneNode fragments that contain checked, in WebKit
  38350. if (valueIsFunction || l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value)) {
  38351. return collection.each(function (index) {
  38352. var self = collection.eq(index);
  38353. if (valueIsFunction) {
  38354. args[0] = value.call(this, index, self.html());
  38355. }
  38356. domManip(self, args, callback, ignored);
  38357. });
  38358. }
  38359. if (l) {
  38360. fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored);
  38361. first = fragment.firstChild;
  38362. if (fragment.childNodes.length === 1) {
  38363. fragment = first;
  38364. }
  38365. // Require either new content or an interest in ignored elements to invoke the callback
  38366. if (first || ignored) {
  38367. scripts = jQuery.map(getAll(fragment, "script"), disableScript);
  38368. hasScripts = scripts.length;
  38369. // Use the original fragment for the last item
  38370. // instead of the first because it can end up
  38371. // being emptied incorrectly in certain situations (#8070).
  38372. for (; i < l; i++) {
  38373. node = fragment;
  38374. if (i !== iNoClone) {
  38375. node = jQuery.clone(node, true, true);
  38376. // Keep references to cloned scripts for later restoration
  38377. if (hasScripts) {
  38378. // Support: Android <=4.0 only, PhantomJS 1 only
  38379. // push.apply(_, arraylike) throws on ancient WebKit
  38380. jQuery.merge(scripts, getAll(node, "script"));
  38381. }
  38382. }
  38383. callback.call(collection[i], node, i);
  38384. }
  38385. if (hasScripts) {
  38386. doc = scripts[scripts.length - 1].ownerDocument;
  38387. // Reenable scripts
  38388. jQuery.map(scripts, restoreScript);
  38389. // Evaluate executable scripts on first document insertion
  38390. for (i = 0; i < hasScripts; i++) {
  38391. node = scripts[i];
  38392. if (rscriptType.test(node.type || "") && !dataPriv.access(node, "globalEval") && jQuery.contains(doc, node)) {
  38393. if (node.src && (node.type || "").toLowerCase() !== "module") {
  38394. // Optional AJAX dependency, but won't run scripts if not present
  38395. if (jQuery._evalUrl) {
  38396. jQuery._evalUrl(node.src);
  38397. }
  38398. } else {
  38399. DOMEval(node.textContent.replace(rcleanScript, ""), doc, node);
  38400. }
  38401. }
  38402. }
  38403. }
  38404. }
  38405. }
  38406. return collection;
  38407. }
  38408. function _remove(elem, selector, keepData) {
  38409. var node,
  38410. nodes = selector ? jQuery.filter(selector, elem) : elem,
  38411. i = 0;
  38412. for (; (node = nodes[i]) != null; i++) {
  38413. if (!keepData && node.nodeType === 1) {
  38414. jQuery.cleanData(getAll(node));
  38415. }
  38416. if (node.parentNode) {
  38417. if (keepData && jQuery.contains(node.ownerDocument, node)) {
  38418. setGlobalEval(getAll(node, "script"));
  38419. }
  38420. node.parentNode.removeChild(node);
  38421. }
  38422. }
  38423. return elem;
  38424. }
  38425. jQuery.extend({
  38426. htmlPrefilter: function htmlPrefilter(html) {
  38427. return html.replace(rxhtmlTag, "<$1></$2>");
  38428. },
  38429. clone: function clone(elem, dataAndEvents, deepDataAndEvents) {
  38430. var i,
  38431. l,
  38432. srcElements,
  38433. destElements,
  38434. clone = elem.cloneNode(true),
  38435. inPage = jQuery.contains(elem.ownerDocument, elem);
  38436. // Fix IE cloning issues
  38437. if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {
  38438. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  38439. destElements = getAll(clone);
  38440. srcElements = getAll(elem);
  38441. for (i = 0, l = srcElements.length; i < l; i++) {
  38442. fixInput(srcElements[i], destElements[i]);
  38443. }
  38444. }
  38445. // Copy the events from the original to the clone
  38446. if (dataAndEvents) {
  38447. if (deepDataAndEvents) {
  38448. srcElements = srcElements || getAll(elem);
  38449. destElements = destElements || getAll(clone);
  38450. for (i = 0, l = srcElements.length; i < l; i++) {
  38451. cloneCopyEvent(srcElements[i], destElements[i]);
  38452. }
  38453. } else {
  38454. cloneCopyEvent(elem, clone);
  38455. }
  38456. }
  38457. // Preserve script evaluation history
  38458. destElements = getAll(clone, "script");
  38459. if (destElements.length > 0) {
  38460. setGlobalEval(destElements, !inPage && getAll(elem, "script"));
  38461. }
  38462. // Return the cloned set
  38463. return clone;
  38464. },
  38465. cleanData: function cleanData(elems) {
  38466. var data,
  38467. elem,
  38468. type,
  38469. special = jQuery.event.special,
  38470. i = 0;
  38471. for (; (elem = elems[i]) !== undefined; i++) {
  38472. if (acceptData(elem)) {
  38473. if (data = elem[dataPriv.expando]) {
  38474. if (data.events) {
  38475. for (type in data.events) {
  38476. if (special[type]) {
  38477. jQuery.event.remove(elem, type);
  38478. // This is a shortcut to avoid jQuery.event.remove's overhead
  38479. } else {
  38480. jQuery.removeEvent(elem, type, data.handle);
  38481. }
  38482. }
  38483. }
  38484. // Support: Chrome <=35 - 45+
  38485. // Assign undefined instead of using delete, see Data#remove
  38486. elem[dataPriv.expando] = undefined;
  38487. }
  38488. if (elem[dataUser.expando]) {
  38489. // Support: Chrome <=35 - 45+
  38490. // Assign undefined instead of using delete, see Data#remove
  38491. elem[dataUser.expando] = undefined;
  38492. }
  38493. }
  38494. }
  38495. }
  38496. });
  38497. jQuery.fn.extend({
  38498. detach: function detach(selector) {
  38499. return _remove(this, selector, true);
  38500. },
  38501. remove: function remove(selector) {
  38502. return _remove(this, selector);
  38503. },
  38504. text: function text(value) {
  38505. return access(this, function (value) {
  38506. return value === undefined ? jQuery.text(this) : this.empty().each(function () {
  38507. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  38508. this.textContent = value;
  38509. }
  38510. });
  38511. }, null, value, arguments.length);
  38512. },
  38513. append: function append() {
  38514. return domManip(this, arguments, function (elem) {
  38515. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  38516. var target = manipulationTarget(this, elem);
  38517. target.appendChild(elem);
  38518. }
  38519. });
  38520. },
  38521. prepend: function prepend() {
  38522. return domManip(this, arguments, function (elem) {
  38523. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  38524. var target = manipulationTarget(this, elem);
  38525. target.insertBefore(elem, target.firstChild);
  38526. }
  38527. });
  38528. },
  38529. before: function before() {
  38530. return domManip(this, arguments, function (elem) {
  38531. if (this.parentNode) {
  38532. this.parentNode.insertBefore(elem, this);
  38533. }
  38534. });
  38535. },
  38536. after: function after() {
  38537. return domManip(this, arguments, function (elem) {
  38538. if (this.parentNode) {
  38539. this.parentNode.insertBefore(elem, this.nextSibling);
  38540. }
  38541. });
  38542. },
  38543. empty: function empty() {
  38544. var elem,
  38545. i = 0;
  38546. for (; (elem = this[i]) != null; i++) {
  38547. if (elem.nodeType === 1) {
  38548. // Prevent memory leaks
  38549. jQuery.cleanData(getAll(elem, false));
  38550. // Remove any remaining nodes
  38551. elem.textContent = "";
  38552. }
  38553. }
  38554. return this;
  38555. },
  38556. clone: function clone(dataAndEvents, deepDataAndEvents) {
  38557. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  38558. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  38559. return this.map(function () {
  38560. return jQuery.clone(this, dataAndEvents, deepDataAndEvents);
  38561. });
  38562. },
  38563. html: function html(value) {
  38564. return access(this, function (value) {
  38565. var elem = this[0] || {},
  38566. i = 0,
  38567. l = this.length;
  38568. if (value === undefined && elem.nodeType === 1) {
  38569. return elem.innerHTML;
  38570. }
  38571. // See if we can take a shortcut and just use innerHTML
  38572. if (typeof value === "string" && !rnoInnerhtml.test(value) && !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) {
  38573. value = jQuery.htmlPrefilter(value);
  38574. try {
  38575. for (; i < l; i++) {
  38576. elem = this[i] || {};
  38577. // Remove element nodes and prevent memory leaks
  38578. if (elem.nodeType === 1) {
  38579. jQuery.cleanData(getAll(elem, false));
  38580. elem.innerHTML = value;
  38581. }
  38582. }
  38583. elem = 0;
  38584. // If using innerHTML throws an exception, use the fallback method
  38585. } catch (e) {}
  38586. }
  38587. if (elem) {
  38588. this.empty().append(value);
  38589. }
  38590. }, null, value, arguments.length);
  38591. },
  38592. replaceWith: function replaceWith() {
  38593. var ignored = [];
  38594. // Make the changes, replacing each non-ignored context element with the new content
  38595. return domManip(this, arguments, function (elem) {
  38596. var parent = this.parentNode;
  38597. if (jQuery.inArray(this, ignored) < 0) {
  38598. jQuery.cleanData(getAll(this));
  38599. if (parent) {
  38600. parent.replaceChild(elem, this);
  38601. }
  38602. }
  38603. // Force callback invocation
  38604. }, ignored);
  38605. }
  38606. });
  38607. jQuery.each({
  38608. appendTo: "append",
  38609. prependTo: "prepend",
  38610. insertBefore: "before",
  38611. insertAfter: "after",
  38612. replaceAll: "replaceWith"
  38613. }, function (name, original) {
  38614. jQuery.fn[name] = function (selector) {
  38615. var elems,
  38616. ret = [],
  38617. insert = jQuery(selector),
  38618. last = insert.length - 1,
  38619. i = 0;
  38620. for (; i <= last; i++) {
  38621. elems = i === last ? this : this.clone(true);
  38622. jQuery(insert[i])[original](elems);
  38623. // Support: Android <=4.0 only, PhantomJS 1 only
  38624. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  38625. push.apply(ret, elems.get());
  38626. }
  38627. return this.pushStack(ret);
  38628. };
  38629. });
  38630. var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
  38631. var getStyles = function getStyles(elem) {
  38632. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  38633. // IE throws on elements created in popups
  38634. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  38635. var view = elem.ownerDocument.defaultView;
  38636. if (!view || !view.opener) {
  38637. view = window;
  38638. }
  38639. return view.getComputedStyle(elem);
  38640. };
  38641. var rboxStyle = new RegExp(cssExpand.join("|"), "i");
  38642. (function () {
  38643. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  38644. // so they're executed at the same time to save the second computation.
  38645. function computeStyleTests() {
  38646. // This is a singleton, we need to execute it only once
  38647. if (!div) {
  38648. return;
  38649. }
  38650. container.style.cssText = "position:absolute;left:-11111px;width:60px;" + "margin-top:1px;padding:0;border:0";
  38651. div.style.cssText = "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + "margin:auto;border:1px;padding:1px;" + "width:60%;top:1%";
  38652. documentElement.appendChild(container).appendChild(div);
  38653. var divStyle = window.getComputedStyle(div);
  38654. pixelPositionVal = divStyle.top !== "1%";
  38655. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  38656. reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12;
  38657. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  38658. // Some styles come back with percentage values, even though they shouldn't
  38659. div.style.right = "60%";
  38660. pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36;
  38661. // Support: IE 9 - 11 only
  38662. // Detect misreporting of content dimensions for box-sizing:border-box elements
  38663. boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36;
  38664. // Support: IE 9 only
  38665. // Detect overflow:scroll screwiness (gh-3699)
  38666. div.style.position = "absolute";
  38667. scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
  38668. documentElement.removeChild(container);
  38669. // Nullify the div so it wouldn't be stored in the memory and
  38670. // it will also be a sign that checks already performed
  38671. div = null;
  38672. }
  38673. function roundPixelMeasures(measure) {
  38674. return Math.round(parseFloat(measure));
  38675. }
  38676. var pixelPositionVal,
  38677. boxSizingReliableVal,
  38678. scrollboxSizeVal,
  38679. pixelBoxStylesVal,
  38680. reliableMarginLeftVal,
  38681. container = document.createElement("div"),
  38682. div = document.createElement("div");
  38683. // Finish early in limited (non-browser) environments
  38684. if (!div.style) {
  38685. return;
  38686. }
  38687. // Support: IE <=9 - 11 only
  38688. // Style of cloned element affects source element cloned (#8908)
  38689. div.style.backgroundClip = "content-box";
  38690. div.cloneNode(true).style.backgroundClip = "";
  38691. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  38692. jQuery.extend(support, {
  38693. boxSizingReliable: function boxSizingReliable() {
  38694. computeStyleTests();
  38695. return boxSizingReliableVal;
  38696. },
  38697. pixelBoxStyles: function pixelBoxStyles() {
  38698. computeStyleTests();
  38699. return pixelBoxStylesVal;
  38700. },
  38701. pixelPosition: function pixelPosition() {
  38702. computeStyleTests();
  38703. return pixelPositionVal;
  38704. },
  38705. reliableMarginLeft: function reliableMarginLeft() {
  38706. computeStyleTests();
  38707. return reliableMarginLeftVal;
  38708. },
  38709. scrollboxSize: function scrollboxSize() {
  38710. computeStyleTests();
  38711. return scrollboxSizeVal;
  38712. }
  38713. });
  38714. })();
  38715. function curCSS(elem, name, computed) {
  38716. var width,
  38717. minWidth,
  38718. maxWidth,
  38719. ret,
  38720. // Support: Firefox 51+
  38721. // Retrieving style before computed somehow
  38722. // fixes an issue with getting wrong values
  38723. // on detached elements
  38724. style = elem.style;
  38725. computed = computed || getStyles(elem);
  38726. // getPropertyValue is needed for:
  38727. // .css('filter') (IE 9 only, #12537)
  38728. // .css('--customProperty) (#3144)
  38729. if (computed) {
  38730. ret = computed.getPropertyValue(name) || computed[name];
  38731. if (ret === "" && !jQuery.contains(elem.ownerDocument, elem)) {
  38732. ret = jQuery.style(elem, name);
  38733. }
  38734. // A tribute to the "awesome hack by Dean Edwards"
  38735. // Android Browser returns percentage for some values,
  38736. // but width seems to be reliably pixels.
  38737. // This is against the CSSOM draft spec:
  38738. // https://drafts.csswg.org/cssom/#resolved-values
  38739. if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) {
  38740. // Remember the original values
  38741. width = style.width;
  38742. minWidth = style.minWidth;
  38743. maxWidth = style.maxWidth;
  38744. // Put in the new values to get a computed value out
  38745. style.minWidth = style.maxWidth = style.width = ret;
  38746. ret = computed.width;
  38747. // Revert the changed values
  38748. style.width = width;
  38749. style.minWidth = minWidth;
  38750. style.maxWidth = maxWidth;
  38751. }
  38752. }
  38753. return ret !== undefined ?
  38754. // Support: IE <=9 - 11 only
  38755. // IE returns zIndex value as an integer.
  38756. ret + "" : ret;
  38757. }
  38758. function addGetHookIf(conditionFn, hookFn) {
  38759. // Define the hook, we'll check on the first run if it's really needed.
  38760. return {
  38761. get: function get() {
  38762. if (conditionFn()) {
  38763. // Hook not needed (or it's not possible to use it due
  38764. // to missing dependency), remove it.
  38765. delete this.get;
  38766. return;
  38767. }
  38768. // Hook needed; redefine it so that the support test is not executed again.
  38769. return (this.get = hookFn).apply(this, arguments);
  38770. }
  38771. };
  38772. }
  38773. var
  38774. // Swappable if display is none or starts with table
  38775. // except "table", "table-cell", or "table-caption"
  38776. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  38777. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  38778. rcustomProp = /^--/,
  38779. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  38780. cssNormalTransform = {
  38781. letterSpacing: "0",
  38782. fontWeight: "400"
  38783. },
  38784. cssPrefixes = ["Webkit", "Moz", "ms"],
  38785. emptyStyle = document.createElement("div").style;
  38786. // Return a css property mapped to a potentially vendor prefixed property
  38787. function vendorPropName(name) {
  38788. // Shortcut for names that are not vendor prefixed
  38789. if (name in emptyStyle) {
  38790. return name;
  38791. }
  38792. // Check for vendor prefixed names
  38793. var capName = name[0].toUpperCase() + name.slice(1),
  38794. i = cssPrefixes.length;
  38795. while (i--) {
  38796. name = cssPrefixes[i] + capName;
  38797. if (name in emptyStyle) {
  38798. return name;
  38799. }
  38800. }
  38801. }
  38802. // Return a property mapped along what jQuery.cssProps suggests or to
  38803. // a vendor prefixed property.
  38804. function finalPropName(name) {
  38805. var ret = jQuery.cssProps[name];
  38806. if (!ret) {
  38807. ret = jQuery.cssProps[name] = vendorPropName(name) || name;
  38808. }
  38809. return ret;
  38810. }
  38811. function setPositiveNumber(elem, value, subtract) {
  38812. // Any relative (+/-) values have already been
  38813. // normalized at this point
  38814. var matches = rcssNum.exec(value);
  38815. return matches ?
  38816. // Guard against undefined "subtract", e.g., when used as in cssHooks
  38817. Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") : value;
  38818. }
  38819. function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) {
  38820. var i = dimension === "width" ? 1 : 0,
  38821. extra = 0,
  38822. delta = 0;
  38823. // Adjustment may not be necessary
  38824. if (box === (isBorderBox ? "border" : "content")) {
  38825. return 0;
  38826. }
  38827. for (; i < 4; i += 2) {
  38828. // Both box models exclude margin
  38829. if (box === "margin") {
  38830. delta += jQuery.css(elem, box + cssExpand[i], true, styles);
  38831. }
  38832. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  38833. if (!isBorderBox) {
  38834. // Add padding
  38835. delta += jQuery.css(elem, "padding" + cssExpand[i], true, styles);
  38836. // For "border" or "margin", add border
  38837. if (box !== "padding") {
  38838. delta += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  38839. // But still keep track of it otherwise
  38840. } else {
  38841. extra += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  38842. }
  38843. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  38844. // "padding" or "margin"
  38845. } else {
  38846. // For "content", subtract padding
  38847. if (box === "content") {
  38848. delta -= jQuery.css(elem, "padding" + cssExpand[i], true, styles);
  38849. }
  38850. // For "content" or "padding", subtract border
  38851. if (box !== "margin") {
  38852. delta -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  38853. }
  38854. }
  38855. }
  38856. // Account for positive content-box scroll gutter when requested by providing computedVal
  38857. if (!isBorderBox && computedVal >= 0) {
  38858. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  38859. // Assuming integer scroll gutter, subtract the rest and round down
  38860. delta += Math.max(0, Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - computedVal - delta - extra - 0.5));
  38861. }
  38862. return delta;
  38863. }
  38864. function getWidthOrHeight(elem, dimension, extra) {
  38865. // Start with computed style
  38866. var styles = getStyles(elem),
  38867. val = curCSS(elem, dimension, styles),
  38868. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
  38869. valueIsBorderBox = isBorderBox;
  38870. // Support: Firefox <=54
  38871. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  38872. if (rnumnonpx.test(val)) {
  38873. if (!extra) {
  38874. return val;
  38875. }
  38876. val = "auto";
  38877. }
  38878. // Check for style in case a browser which returns unreliable values
  38879. // for getComputedStyle silently falls back to the reliable elem.style
  38880. valueIsBorderBox = valueIsBorderBox && (support.boxSizingReliable() || val === elem.style[dimension]);
  38881. // Fall back to offsetWidth/offsetHeight when value is "auto"
  38882. // This happens for inline elements with no explicit setting (gh-3571)
  38883. // Support: Android <=4.1 - 4.3 only
  38884. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  38885. if (val === "auto" || !parseFloat(val) && jQuery.css(elem, "display", false, styles) === "inline") {
  38886. val = elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)];
  38887. // offsetWidth/offsetHeight provide border-box values
  38888. valueIsBorderBox = true;
  38889. }
  38890. // Normalize "" and auto
  38891. val = parseFloat(val) || 0;
  38892. // Adjust for the element's box model
  38893. return val + boxModelAdjustment(elem, dimension, extra || (isBorderBox ? "border" : "content"), valueIsBorderBox, styles,
  38894. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  38895. val) + "px";
  38896. }
  38897. jQuery.extend({
  38898. // Add in style property hooks for overriding the default
  38899. // behavior of getting and setting a style property
  38900. cssHooks: {
  38901. opacity: {
  38902. get: function get(elem, computed) {
  38903. if (computed) {
  38904. // We should always get a number back from opacity
  38905. var ret = curCSS(elem, "opacity");
  38906. return ret === "" ? "1" : ret;
  38907. }
  38908. }
  38909. }
  38910. },
  38911. // Don't automatically add "px" to these possibly-unitless properties
  38912. cssNumber: {
  38913. "animationIterationCount": true,
  38914. "columnCount": true,
  38915. "fillOpacity": true,
  38916. "flexGrow": true,
  38917. "flexShrink": true,
  38918. "fontWeight": true,
  38919. "lineHeight": true,
  38920. "opacity": true,
  38921. "order": true,
  38922. "orphans": true,
  38923. "widows": true,
  38924. "zIndex": true,
  38925. "zoom": true
  38926. },
  38927. // Add in properties whose names you wish to fix before
  38928. // setting or getting the value
  38929. cssProps: {},
  38930. // Get and set the style property on a DOM Node
  38931. style: function style(elem, name, value, extra) {
  38932. // Don't set styles on text and comment nodes
  38933. if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
  38934. return;
  38935. }
  38936. // Make sure that we're working with the right name
  38937. var ret,
  38938. type,
  38939. hooks,
  38940. origName = camelCase(name),
  38941. isCustomProp = rcustomProp.test(name),
  38942. style = elem.style;
  38943. // Make sure that we're working with the right name. We don't
  38944. // want to query the value if it is a CSS custom property
  38945. // since they are user-defined.
  38946. if (!isCustomProp) {
  38947. name = finalPropName(origName);
  38948. }
  38949. // Gets hook for the prefixed version, then unprefixed version
  38950. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  38951. // Check if we're setting a value
  38952. if (value !== undefined) {
  38953. type = typeof value === "undefined" ? "undefined" : _typeof(value);
  38954. // Convert "+=" or "-=" to relative numbers (#7345)
  38955. if (type === "string" && (ret = rcssNum.exec(value)) && ret[1]) {
  38956. value = adjustCSS(elem, name, ret);
  38957. // Fixes bug #9237
  38958. type = "number";
  38959. }
  38960. // Make sure that null and NaN values aren't set (#7116)
  38961. if (value == null || value !== value) {
  38962. return;
  38963. }
  38964. // If a number was passed in, add the unit (except for certain CSS properties)
  38965. if (type === "number") {
  38966. value += ret && ret[3] || (jQuery.cssNumber[origName] ? "" : "px");
  38967. }
  38968. // background-* props affect original clone's values
  38969. if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
  38970. style[name] = "inherit";
  38971. }
  38972. // If a hook was provided, use that value, otherwise just set the specified value
  38973. if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) {
  38974. if (isCustomProp) {
  38975. style.setProperty(name, value);
  38976. } else {
  38977. style[name] = value;
  38978. }
  38979. }
  38980. } else {
  38981. // If a hook was provided get the non-computed value from there
  38982. if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) {
  38983. return ret;
  38984. }
  38985. // Otherwise just get the value from the style object
  38986. return style[name];
  38987. }
  38988. },
  38989. css: function css(elem, name, extra, styles) {
  38990. var val,
  38991. num,
  38992. hooks,
  38993. origName = camelCase(name),
  38994. isCustomProp = rcustomProp.test(name);
  38995. // Make sure that we're working with the right name. We don't
  38996. // want to modify the value if it is a CSS custom property
  38997. // since they are user-defined.
  38998. if (!isCustomProp) {
  38999. name = finalPropName(origName);
  39000. }
  39001. // Try prefixed name followed by the unprefixed name
  39002. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  39003. // If a hook was provided get the computed value from there
  39004. if (hooks && "get" in hooks) {
  39005. val = hooks.get(elem, true, extra);
  39006. }
  39007. // Otherwise, if a way to get the computed value exists, use that
  39008. if (val === undefined) {
  39009. val = curCSS(elem, name, styles);
  39010. }
  39011. // Convert "normal" to computed value
  39012. if (val === "normal" && name in cssNormalTransform) {
  39013. val = cssNormalTransform[name];
  39014. }
  39015. // Make numeric if forced or a qualifier was provided and val looks numeric
  39016. if (extra === "" || extra) {
  39017. num = parseFloat(val);
  39018. return extra === true || isFinite(num) ? num || 0 : val;
  39019. }
  39020. return val;
  39021. }
  39022. });
  39023. jQuery.each(["height", "width"], function (i, dimension) {
  39024. jQuery.cssHooks[dimension] = {
  39025. get: function get(elem, computed, extra) {
  39026. if (computed) {
  39027. // Certain elements can have dimension info if we invisibly show them
  39028. // but it must have a current display style that would benefit
  39029. return rdisplayswap.test(jQuery.css(elem, "display")) && (
  39030. // Support: Safari 8+
  39031. // Table columns in Safari have non-zero offsetWidth & zero
  39032. // getBoundingClientRect().width unless display is changed.
  39033. // Support: IE <=11 only
  39034. // Running getBoundingClientRect on a disconnected node
  39035. // in IE throws an error.
  39036. !elem.getClientRects().length || !elem.getBoundingClientRect().width) ? swap(elem, cssShow, function () {
  39037. return getWidthOrHeight(elem, dimension, extra);
  39038. }) : getWidthOrHeight(elem, dimension, extra);
  39039. }
  39040. },
  39041. set: function set(elem, value, extra) {
  39042. var matches,
  39043. styles = getStyles(elem),
  39044. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
  39045. subtract = extra && boxModelAdjustment(elem, dimension, extra, isBorderBox, styles);
  39046. // Account for unreliable border-box dimensions by comparing offset* to computed and
  39047. // faking a content-box to get border and padding (gh-3699)
  39048. if (isBorderBox && support.scrollboxSize() === styles.position) {
  39049. subtract -= Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - parseFloat(styles[dimension]) - boxModelAdjustment(elem, dimension, "border", false, styles) - 0.5);
  39050. }
  39051. // Convert to pixels if value adjustment is needed
  39052. if (subtract && (matches = rcssNum.exec(value)) && (matches[3] || "px") !== "px") {
  39053. elem.style[dimension] = value;
  39054. value = jQuery.css(elem, dimension);
  39055. }
  39056. return setPositiveNumber(elem, value, subtract);
  39057. }
  39058. };
  39059. });
  39060. jQuery.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft, function (elem, computed) {
  39061. if (computed) {
  39062. return (parseFloat(curCSS(elem, "marginLeft")) || elem.getBoundingClientRect().left - swap(elem, { marginLeft: 0 }, function () {
  39063. return elem.getBoundingClientRect().left;
  39064. })) + "px";
  39065. }
  39066. });
  39067. // These hooks are used by animate to expand properties
  39068. jQuery.each({
  39069. margin: "",
  39070. padding: "",
  39071. border: "Width"
  39072. }, function (prefix, suffix) {
  39073. jQuery.cssHooks[prefix + suffix] = {
  39074. expand: function expand(value) {
  39075. var i = 0,
  39076. expanded = {},
  39077. // Assumes a single number if not a string
  39078. parts = typeof value === "string" ? value.split(" ") : [value];
  39079. for (; i < 4; i++) {
  39080. expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0];
  39081. }
  39082. return expanded;
  39083. }
  39084. };
  39085. if (prefix !== "margin") {
  39086. jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;
  39087. }
  39088. });
  39089. jQuery.fn.extend({
  39090. css: function css(name, value) {
  39091. return access(this, function (elem, name, value) {
  39092. var styles,
  39093. len,
  39094. map = {},
  39095. i = 0;
  39096. if (Array.isArray(name)) {
  39097. styles = getStyles(elem);
  39098. len = name.length;
  39099. for (; i < len; i++) {
  39100. map[name[i]] = jQuery.css(elem, name[i], false, styles);
  39101. }
  39102. return map;
  39103. }
  39104. return value !== undefined ? jQuery.style(elem, name, value) : jQuery.css(elem, name);
  39105. }, name, value, arguments.length > 1);
  39106. }
  39107. });
  39108. function Tween(elem, options, prop, end, easing) {
  39109. return new Tween.prototype.init(elem, options, prop, end, easing);
  39110. }
  39111. jQuery.Tween = Tween;
  39112. Tween.prototype = {
  39113. constructor: Tween,
  39114. init: function init(elem, options, prop, end, easing, unit) {
  39115. this.elem = elem;
  39116. this.prop = prop;
  39117. this.easing = easing || jQuery.easing._default;
  39118. this.options = options;
  39119. this.start = this.now = this.cur();
  39120. this.end = end;
  39121. this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px");
  39122. },
  39123. cur: function cur() {
  39124. var hooks = Tween.propHooks[this.prop];
  39125. return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this);
  39126. },
  39127. run: function run(percent) {
  39128. var eased,
  39129. hooks = Tween.propHooks[this.prop];
  39130. if (this.options.duration) {
  39131. this.pos = eased = jQuery.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration);
  39132. } else {
  39133. this.pos = eased = percent;
  39134. }
  39135. this.now = (this.end - this.start) * eased + this.start;
  39136. if (this.options.step) {
  39137. this.options.step.call(this.elem, this.now, this);
  39138. }
  39139. if (hooks && hooks.set) {
  39140. hooks.set(this);
  39141. } else {
  39142. Tween.propHooks._default.set(this);
  39143. }
  39144. return this;
  39145. }
  39146. };
  39147. Tween.prototype.init.prototype = Tween.prototype;
  39148. Tween.propHooks = {
  39149. _default: {
  39150. get: function get(tween) {
  39151. var result;
  39152. // Use a property on the element directly when it is not a DOM element,
  39153. // or when there is no matching style property that exists.
  39154. if (tween.elem.nodeType !== 1 || tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) {
  39155. return tween.elem[tween.prop];
  39156. }
  39157. // Passing an empty string as a 3rd parameter to .css will automatically
  39158. // attempt a parseFloat and fallback to a string if the parse fails.
  39159. // Simple values such as "10px" are parsed to Float;
  39160. // complex values such as "rotate(1rad)" are returned as-is.
  39161. result = jQuery.css(tween.elem, tween.prop, "");
  39162. // Empty strings, null, undefined and "auto" are converted to 0.
  39163. return !result || result === "auto" ? 0 : result;
  39164. },
  39165. set: function set(tween) {
  39166. // Use step hook for back compat.
  39167. // Use cssHook if its there.
  39168. // Use .style if available and use plain properties where available.
  39169. if (jQuery.fx.step[tween.prop]) {
  39170. jQuery.fx.step[tween.prop](tween);
  39171. } else if (tween.elem.nodeType === 1 && (tween.elem.style[jQuery.cssProps[tween.prop]] != null || jQuery.cssHooks[tween.prop])) {
  39172. jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);
  39173. } else {
  39174. tween.elem[tween.prop] = tween.now;
  39175. }
  39176. }
  39177. }
  39178. };
  39179. // Support: IE <=9 only
  39180. // Panic based approach to setting things on disconnected nodes
  39181. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  39182. set: function set(tween) {
  39183. if (tween.elem.nodeType && tween.elem.parentNode) {
  39184. tween.elem[tween.prop] = tween.now;
  39185. }
  39186. }
  39187. };
  39188. jQuery.easing = {
  39189. linear: function linear(p) {
  39190. return p;
  39191. },
  39192. swing: function swing(p) {
  39193. return 0.5 - Math.cos(p * Math.PI) / 2;
  39194. },
  39195. _default: "swing"
  39196. };
  39197. jQuery.fx = Tween.prototype.init;
  39198. // Back compat <1.8 extension point
  39199. jQuery.fx.step = {};
  39200. var fxNow,
  39201. inProgress,
  39202. rfxtypes = /^(?:toggle|show|hide)$/,
  39203. rrun = /queueHooks$/;
  39204. function schedule() {
  39205. if (inProgress) {
  39206. if (document.hidden === false && window.requestAnimationFrame) {
  39207. window.requestAnimationFrame(schedule);
  39208. } else {
  39209. window.setTimeout(schedule, jQuery.fx.interval);
  39210. }
  39211. jQuery.fx.tick();
  39212. }
  39213. }
  39214. // Animations created synchronously will run synchronously
  39215. function createFxNow() {
  39216. window.setTimeout(function () {
  39217. fxNow = undefined;
  39218. });
  39219. return fxNow = Date.now();
  39220. }
  39221. // Generate parameters to create a standard animation
  39222. function genFx(type, includeWidth) {
  39223. var which,
  39224. i = 0,
  39225. attrs = { height: type };
  39226. // If we include width, step value is 1 to do all cssExpand values,
  39227. // otherwise step value is 2 to skip over Left and Right
  39228. includeWidth = includeWidth ? 1 : 0;
  39229. for (; i < 4; i += 2 - includeWidth) {
  39230. which = cssExpand[i];
  39231. attrs["margin" + which] = attrs["padding" + which] = type;
  39232. }
  39233. if (includeWidth) {
  39234. attrs.opacity = attrs.width = type;
  39235. }
  39236. return attrs;
  39237. }
  39238. function createTween(value, prop, animation) {
  39239. var tween,
  39240. collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners["*"]),
  39241. index = 0,
  39242. length = collection.length;
  39243. for (; index < length; index++) {
  39244. if (tween = collection[index].call(animation, prop, value)) {
  39245. // We're done with this property
  39246. return tween;
  39247. }
  39248. }
  39249. }
  39250. function defaultPrefilter(elem, props, opts) {
  39251. var prop,
  39252. value,
  39253. toggle,
  39254. hooks,
  39255. oldfire,
  39256. propTween,
  39257. restoreDisplay,
  39258. display,
  39259. isBox = "width" in props || "height" in props,
  39260. anim = this,
  39261. orig = {},
  39262. style = elem.style,
  39263. hidden = elem.nodeType && isHiddenWithinTree(elem),
  39264. dataShow = dataPriv.get(elem, "fxshow");
  39265. // Queue-skipping animations hijack the fx hooks
  39266. if (!opts.queue) {
  39267. hooks = jQuery._queueHooks(elem, "fx");
  39268. if (hooks.unqueued == null) {
  39269. hooks.unqueued = 0;
  39270. oldfire = hooks.empty.fire;
  39271. hooks.empty.fire = function () {
  39272. if (!hooks.unqueued) {
  39273. oldfire();
  39274. }
  39275. };
  39276. }
  39277. hooks.unqueued++;
  39278. anim.always(function () {
  39279. // Ensure the complete handler is called before this completes
  39280. anim.always(function () {
  39281. hooks.unqueued--;
  39282. if (!jQuery.queue(elem, "fx").length) {
  39283. hooks.empty.fire();
  39284. }
  39285. });
  39286. });
  39287. }
  39288. // Detect show/hide animations
  39289. for (prop in props) {
  39290. value = props[prop];
  39291. if (rfxtypes.test(value)) {
  39292. delete props[prop];
  39293. toggle = toggle || value === "toggle";
  39294. if (value === (hidden ? "hide" : "show")) {
  39295. // Pretend to be hidden if this is a "show" and
  39296. // there is still data from a stopped show/hide
  39297. if (value === "show" && dataShow && dataShow[prop] !== undefined) {
  39298. hidden = true;
  39299. // Ignore all other no-op show/hide data
  39300. } else {
  39301. continue;
  39302. }
  39303. }
  39304. orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);
  39305. }
  39306. }
  39307. // Bail out if this is a no-op like .hide().hide()
  39308. propTween = !jQuery.isEmptyObject(props);
  39309. if (!propTween && jQuery.isEmptyObject(orig)) {
  39310. return;
  39311. }
  39312. // Restrict "overflow" and "display" styles during box animations
  39313. if (isBox && elem.nodeType === 1) {
  39314. // Support: IE <=9 - 11, Edge 12 - 15
  39315. // Record all 3 overflow attributes because IE does not infer the shorthand
  39316. // from identically-valued overflowX and overflowY and Edge just mirrors
  39317. // the overflowX value there.
  39318. opts.overflow = [style.overflow, style.overflowX, style.overflowY];
  39319. // Identify a display type, preferring old show/hide data over the CSS cascade
  39320. restoreDisplay = dataShow && dataShow.display;
  39321. if (restoreDisplay == null) {
  39322. restoreDisplay = dataPriv.get(elem, "display");
  39323. }
  39324. display = jQuery.css(elem, "display");
  39325. if (display === "none") {
  39326. if (restoreDisplay) {
  39327. display = restoreDisplay;
  39328. } else {
  39329. // Get nonempty value(s) by temporarily forcing visibility
  39330. showHide([elem], true);
  39331. restoreDisplay = elem.style.display || restoreDisplay;
  39332. display = jQuery.css(elem, "display");
  39333. showHide([elem]);
  39334. }
  39335. }
  39336. // Animate inline elements as inline-block
  39337. if (display === "inline" || display === "inline-block" && restoreDisplay != null) {
  39338. if (jQuery.css(elem, "float") === "none") {
  39339. // Restore the original display value at the end of pure show/hide animations
  39340. if (!propTween) {
  39341. anim.done(function () {
  39342. style.display = restoreDisplay;
  39343. });
  39344. if (restoreDisplay == null) {
  39345. display = style.display;
  39346. restoreDisplay = display === "none" ? "" : display;
  39347. }
  39348. }
  39349. style.display = "inline-block";
  39350. }
  39351. }
  39352. }
  39353. if (opts.overflow) {
  39354. style.overflow = "hidden";
  39355. anim.always(function () {
  39356. style.overflow = opts.overflow[0];
  39357. style.overflowX = opts.overflow[1];
  39358. style.overflowY = opts.overflow[2];
  39359. });
  39360. }
  39361. // Implement show/hide animations
  39362. propTween = false;
  39363. for (prop in orig) {
  39364. // General show/hide setup for this element animation
  39365. if (!propTween) {
  39366. if (dataShow) {
  39367. if ("hidden" in dataShow) {
  39368. hidden = dataShow.hidden;
  39369. }
  39370. } else {
  39371. dataShow = dataPriv.access(elem, "fxshow", { display: restoreDisplay });
  39372. }
  39373. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  39374. if (toggle) {
  39375. dataShow.hidden = !hidden;
  39376. }
  39377. // Show elements before animating them
  39378. if (hidden) {
  39379. showHide([elem], true);
  39380. }
  39381. /* eslint-disable no-loop-func */
  39382. anim.done(function () {
  39383. /* eslint-enable no-loop-func */
  39384. // The final step of a "hide" animation is actually hiding the element
  39385. if (!hidden) {
  39386. showHide([elem]);
  39387. }
  39388. dataPriv.remove(elem, "fxshow");
  39389. for (prop in orig) {
  39390. jQuery.style(elem, prop, orig[prop]);
  39391. }
  39392. });
  39393. }
  39394. // Per-property setup
  39395. propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
  39396. if (!(prop in dataShow)) {
  39397. dataShow[prop] = propTween.start;
  39398. if (hidden) {
  39399. propTween.end = propTween.start;
  39400. propTween.start = 0;
  39401. }
  39402. }
  39403. }
  39404. }
  39405. function propFilter(props, specialEasing) {
  39406. var index, name, easing, value, hooks;
  39407. // camelCase, specialEasing and expand cssHook pass
  39408. for (index in props) {
  39409. name = camelCase(index);
  39410. easing = specialEasing[name];
  39411. value = props[index];
  39412. if (Array.isArray(value)) {
  39413. easing = value[1];
  39414. value = props[index] = value[0];
  39415. }
  39416. if (index !== name) {
  39417. props[name] = value;
  39418. delete props[index];
  39419. }
  39420. hooks = jQuery.cssHooks[name];
  39421. if (hooks && "expand" in hooks) {
  39422. value = hooks.expand(value);
  39423. delete props[name];
  39424. // Not quite $.extend, this won't overwrite existing keys.
  39425. // Reusing 'index' because we have the correct "name"
  39426. for (index in value) {
  39427. if (!(index in props)) {
  39428. props[index] = value[index];
  39429. specialEasing[index] = easing;
  39430. }
  39431. }
  39432. } else {
  39433. specialEasing[name] = easing;
  39434. }
  39435. }
  39436. }
  39437. function Animation(elem, properties, options) {
  39438. var result,
  39439. stopped,
  39440. index = 0,
  39441. length = Animation.prefilters.length,
  39442. deferred = jQuery.Deferred().always(function () {
  39443. // Don't match elem in the :animated selector
  39444. delete tick.elem;
  39445. }),
  39446. tick = function tick() {
  39447. if (stopped) {
  39448. return false;
  39449. }
  39450. var currentTime = fxNow || createFxNow(),
  39451. remaining = Math.max(0, animation.startTime + animation.duration - currentTime),
  39452. // Support: Android 2.3 only
  39453. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  39454. temp = remaining / animation.duration || 0,
  39455. percent = 1 - temp,
  39456. index = 0,
  39457. length = animation.tweens.length;
  39458. for (; index < length; index++) {
  39459. animation.tweens[index].run(percent);
  39460. }
  39461. deferred.notifyWith(elem, [animation, percent, remaining]);
  39462. // If there's more to do, yield
  39463. if (percent < 1 && length) {
  39464. return remaining;
  39465. }
  39466. // If this was an empty animation, synthesize a final progress notification
  39467. if (!length) {
  39468. deferred.notifyWith(elem, [animation, 1, 0]);
  39469. }
  39470. // Resolve the animation and report its conclusion
  39471. deferred.resolveWith(elem, [animation]);
  39472. return false;
  39473. },
  39474. animation = deferred.promise({
  39475. elem: elem,
  39476. props: jQuery.extend({}, properties),
  39477. opts: jQuery.extend(true, {
  39478. specialEasing: {},
  39479. easing: jQuery.easing._default
  39480. }, options),
  39481. originalProperties: properties,
  39482. originalOptions: options,
  39483. startTime: fxNow || createFxNow(),
  39484. duration: options.duration,
  39485. tweens: [],
  39486. createTween: function createTween(prop, end) {
  39487. var tween = jQuery.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing);
  39488. animation.tweens.push(tween);
  39489. return tween;
  39490. },
  39491. stop: function stop(gotoEnd) {
  39492. var index = 0,
  39493. // If we are going to the end, we want to run all the tweens
  39494. // otherwise we skip this part
  39495. length = gotoEnd ? animation.tweens.length : 0;
  39496. if (stopped) {
  39497. return this;
  39498. }
  39499. stopped = true;
  39500. for (; index < length; index++) {
  39501. animation.tweens[index].run(1);
  39502. }
  39503. // Resolve when we played the last frame; otherwise, reject
  39504. if (gotoEnd) {
  39505. deferred.notifyWith(elem, [animation, 1, 0]);
  39506. deferred.resolveWith(elem, [animation, gotoEnd]);
  39507. } else {
  39508. deferred.rejectWith(elem, [animation, gotoEnd]);
  39509. }
  39510. return this;
  39511. }
  39512. }),
  39513. props = animation.props;
  39514. propFilter(props, animation.opts.specialEasing);
  39515. for (; index < length; index++) {
  39516. result = Animation.prefilters[index].call(animation, elem, props, animation.opts);
  39517. if (result) {
  39518. if (isFunction(result.stop)) {
  39519. jQuery._queueHooks(animation.elem, animation.opts.queue).stop = result.stop.bind(result);
  39520. }
  39521. return result;
  39522. }
  39523. }
  39524. jQuery.map(props, createTween, animation);
  39525. if (isFunction(animation.opts.start)) {
  39526. animation.opts.start.call(elem, animation);
  39527. }
  39528. // Attach callbacks from options
  39529. animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always);
  39530. jQuery.fx.timer(jQuery.extend(tick, {
  39531. elem: elem,
  39532. anim: animation,
  39533. queue: animation.opts.queue
  39534. }));
  39535. return animation;
  39536. }
  39537. jQuery.Animation = jQuery.extend(Animation, {
  39538. tweeners: {
  39539. "*": [function (prop, value) {
  39540. var tween = this.createTween(prop, value);
  39541. adjustCSS(tween.elem, prop, rcssNum.exec(value), tween);
  39542. return tween;
  39543. }]
  39544. },
  39545. tweener: function tweener(props, callback) {
  39546. if (isFunction(props)) {
  39547. callback = props;
  39548. props = ["*"];
  39549. } else {
  39550. props = props.match(rnothtmlwhite);
  39551. }
  39552. var prop,
  39553. index = 0,
  39554. length = props.length;
  39555. for (; index < length; index++) {
  39556. prop = props[index];
  39557. Animation.tweeners[prop] = Animation.tweeners[prop] || [];
  39558. Animation.tweeners[prop].unshift(callback);
  39559. }
  39560. },
  39561. prefilters: [defaultPrefilter],
  39562. prefilter: function prefilter(callback, prepend) {
  39563. if (prepend) {
  39564. Animation.prefilters.unshift(callback);
  39565. } else {
  39566. Animation.prefilters.push(callback);
  39567. }
  39568. }
  39569. });
  39570. jQuery.speed = function (speed, easing, fn) {
  39571. var opt = speed && (typeof speed === "undefined" ? "undefined" : _typeof(speed)) === "object" ? jQuery.extend({}, speed) : {
  39572. complete: fn || !fn && easing || isFunction(speed) && speed,
  39573. duration: speed,
  39574. easing: fn && easing || easing && !isFunction(easing) && easing
  39575. };
  39576. // Go to the end state if fx are off
  39577. if (jQuery.fx.off) {
  39578. opt.duration = 0;
  39579. } else {
  39580. if (typeof opt.duration !== "number") {
  39581. if (opt.duration in jQuery.fx.speeds) {
  39582. opt.duration = jQuery.fx.speeds[opt.duration];
  39583. } else {
  39584. opt.duration = jQuery.fx.speeds._default;
  39585. }
  39586. }
  39587. }
  39588. // Normalize opt.queue - true/undefined/null -> "fx"
  39589. if (opt.queue == null || opt.queue === true) {
  39590. opt.queue = "fx";
  39591. }
  39592. // Queueing
  39593. opt.old = opt.complete;
  39594. opt.complete = function () {
  39595. if (isFunction(opt.old)) {
  39596. opt.old.call(this);
  39597. }
  39598. if (opt.queue) {
  39599. jQuery.dequeue(this, opt.queue);
  39600. }
  39601. };
  39602. return opt;
  39603. };
  39604. jQuery.fn.extend({
  39605. fadeTo: function fadeTo(speed, to, easing, callback) {
  39606. // Show any hidden elements after setting opacity to 0
  39607. return this.filter(isHiddenWithinTree).css("opacity", 0).show()
  39608. // Animate to the value specified
  39609. .end().animate({ opacity: to }, speed, easing, callback);
  39610. },
  39611. animate: function animate(prop, speed, easing, callback) {
  39612. var empty = jQuery.isEmptyObject(prop),
  39613. optall = jQuery.speed(speed, easing, callback),
  39614. doAnimation = function doAnimation() {
  39615. // Operate on a copy of prop so per-property easing won't be lost
  39616. var anim = Animation(this, jQuery.extend({}, prop), optall);
  39617. // Empty animations, or finishing resolves immediately
  39618. if (empty || dataPriv.get(this, "finish")) {
  39619. anim.stop(true);
  39620. }
  39621. };
  39622. doAnimation.finish = doAnimation;
  39623. return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation);
  39624. },
  39625. stop: function stop(type, clearQueue, gotoEnd) {
  39626. var stopQueue = function stopQueue(hooks) {
  39627. var stop = hooks.stop;
  39628. delete hooks.stop;
  39629. stop(gotoEnd);
  39630. };
  39631. if (typeof type !== "string") {
  39632. gotoEnd = clearQueue;
  39633. clearQueue = type;
  39634. type = undefined;
  39635. }
  39636. if (clearQueue && type !== false) {
  39637. this.queue(type || "fx", []);
  39638. }
  39639. return this.each(function () {
  39640. var dequeue = true,
  39641. index = type != null && type + "queueHooks",
  39642. timers = jQuery.timers,
  39643. data = dataPriv.get(this);
  39644. if (index) {
  39645. if (data[index] && data[index].stop) {
  39646. stopQueue(data[index]);
  39647. }
  39648. } else {
  39649. for (index in data) {
  39650. if (data[index] && data[index].stop && rrun.test(index)) {
  39651. stopQueue(data[index]);
  39652. }
  39653. }
  39654. }
  39655. for (index = timers.length; index--;) {
  39656. if (timers[index].elem === this && (type == null || timers[index].queue === type)) {
  39657. timers[index].anim.stop(gotoEnd);
  39658. dequeue = false;
  39659. timers.splice(index, 1);
  39660. }
  39661. }
  39662. // Start the next in the queue if the last step wasn't forced.
  39663. // Timers currently will call their complete callbacks, which
  39664. // will dequeue but only if they were gotoEnd.
  39665. if (dequeue || !gotoEnd) {
  39666. jQuery.dequeue(this, type);
  39667. }
  39668. });
  39669. },
  39670. finish: function finish(type) {
  39671. if (type !== false) {
  39672. type = type || "fx";
  39673. }
  39674. return this.each(function () {
  39675. var index,
  39676. data = dataPriv.get(this),
  39677. queue = data[type + "queue"],
  39678. hooks = data[type + "queueHooks"],
  39679. timers = jQuery.timers,
  39680. length = queue ? queue.length : 0;
  39681. // Enable finishing flag on private data
  39682. data.finish = true;
  39683. // Empty the queue first
  39684. jQuery.queue(this, type, []);
  39685. if (hooks && hooks.stop) {
  39686. hooks.stop.call(this, true);
  39687. }
  39688. // Look for any active animations, and finish them
  39689. for (index = timers.length; index--;) {
  39690. if (timers[index].elem === this && timers[index].queue === type) {
  39691. timers[index].anim.stop(true);
  39692. timers.splice(index, 1);
  39693. }
  39694. }
  39695. // Look for any animations in the old queue and finish them
  39696. for (index = 0; index < length; index++) {
  39697. if (queue[index] && queue[index].finish) {
  39698. queue[index].finish.call(this);
  39699. }
  39700. }
  39701. // Turn off finishing flag
  39702. delete data.finish;
  39703. });
  39704. }
  39705. });
  39706. jQuery.each(["toggle", "show", "hide"], function (i, name) {
  39707. var cssFn = jQuery.fn[name];
  39708. jQuery.fn[name] = function (speed, easing, callback) {
  39709. return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback);
  39710. };
  39711. });
  39712. // Generate shortcuts for custom animations
  39713. jQuery.each({
  39714. slideDown: genFx("show"),
  39715. slideUp: genFx("hide"),
  39716. slideToggle: genFx("toggle"),
  39717. fadeIn: { opacity: "show" },
  39718. fadeOut: { opacity: "hide" },
  39719. fadeToggle: { opacity: "toggle" }
  39720. }, function (name, props) {
  39721. jQuery.fn[name] = function (speed, easing, callback) {
  39722. return this.animate(props, speed, easing, callback);
  39723. };
  39724. });
  39725. jQuery.timers = [];
  39726. jQuery.fx.tick = function () {
  39727. var timer,
  39728. i = 0,
  39729. timers = jQuery.timers;
  39730. fxNow = Date.now();
  39731. for (; i < timers.length; i++) {
  39732. timer = timers[i];
  39733. // Run the timer and safely remove it when done (allowing for external removal)
  39734. if (!timer() && timers[i] === timer) {
  39735. timers.splice(i--, 1);
  39736. }
  39737. }
  39738. if (!timers.length) {
  39739. jQuery.fx.stop();
  39740. }
  39741. fxNow = undefined;
  39742. };
  39743. jQuery.fx.timer = function (timer) {
  39744. jQuery.timers.push(timer);
  39745. jQuery.fx.start();
  39746. };
  39747. jQuery.fx.interval = 13;
  39748. jQuery.fx.start = function () {
  39749. if (inProgress) {
  39750. return;
  39751. }
  39752. inProgress = true;
  39753. schedule();
  39754. };
  39755. jQuery.fx.stop = function () {
  39756. inProgress = null;
  39757. };
  39758. jQuery.fx.speeds = {
  39759. slow: 600,
  39760. fast: 200,
  39761. // Default speed
  39762. _default: 400
  39763. };
  39764. // Based off of the plugin by Clint Helfers, with permission.
  39765. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  39766. jQuery.fn.delay = function (time, type) {
  39767. time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
  39768. type = type || "fx";
  39769. return this.queue(type, function (next, hooks) {
  39770. var timeout = window.setTimeout(next, time);
  39771. hooks.stop = function () {
  39772. window.clearTimeout(timeout);
  39773. };
  39774. });
  39775. };
  39776. (function () {
  39777. var input = document.createElement("input"),
  39778. select = document.createElement("select"),
  39779. opt = select.appendChild(document.createElement("option"));
  39780. input.type = "checkbox";
  39781. // Support: Android <=4.3 only
  39782. // Default value for a checkbox should be "on"
  39783. support.checkOn = input.value !== "";
  39784. // Support: IE <=11 only
  39785. // Must access selectedIndex to make default options select
  39786. support.optSelected = opt.selected;
  39787. // Support: IE <=11 only
  39788. // An input loses its value after becoming a radio
  39789. input = document.createElement("input");
  39790. input.value = "t";
  39791. input.type = "radio";
  39792. support.radioValue = input.value === "t";
  39793. })();
  39794. var boolHook,
  39795. attrHandle = jQuery.expr.attrHandle;
  39796. jQuery.fn.extend({
  39797. attr: function attr(name, value) {
  39798. return access(this, jQuery.attr, name, value, arguments.length > 1);
  39799. },
  39800. removeAttr: function removeAttr(name) {
  39801. return this.each(function () {
  39802. jQuery.removeAttr(this, name);
  39803. });
  39804. }
  39805. });
  39806. jQuery.extend({
  39807. attr: function attr(elem, name, value) {
  39808. var ret,
  39809. hooks,
  39810. nType = elem.nodeType;
  39811. // Don't get/set attributes on text, comment and attribute nodes
  39812. if (nType === 3 || nType === 8 || nType === 2) {
  39813. return;
  39814. }
  39815. // Fallback to prop when attributes are not supported
  39816. if (typeof elem.getAttribute === "undefined") {
  39817. return jQuery.prop(elem, name, value);
  39818. }
  39819. // Attribute hooks are determined by the lowercase version
  39820. // Grab necessary hook if one is defined
  39821. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  39822. hooks = jQuery.attrHooks[name.toLowerCase()] || (jQuery.expr.match.bool.test(name) ? boolHook : undefined);
  39823. }
  39824. if (value !== undefined) {
  39825. if (value === null) {
  39826. jQuery.removeAttr(elem, name);
  39827. return;
  39828. }
  39829. if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
  39830. return ret;
  39831. }
  39832. elem.setAttribute(name, value + "");
  39833. return value;
  39834. }
  39835. if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
  39836. return ret;
  39837. }
  39838. ret = jQuery.find.attr(elem, name);
  39839. // Non-existent attributes return null, we normalize to undefined
  39840. return ret == null ? undefined : ret;
  39841. },
  39842. attrHooks: {
  39843. type: {
  39844. set: function set(elem, value) {
  39845. if (!support.radioValue && value === "radio" && nodeName(elem, "input")) {
  39846. var val = elem.value;
  39847. elem.setAttribute("type", value);
  39848. if (val) {
  39849. elem.value = val;
  39850. }
  39851. return value;
  39852. }
  39853. }
  39854. }
  39855. },
  39856. removeAttr: function removeAttr(elem, value) {
  39857. var name,
  39858. i = 0,
  39859. // Attribute names can contain non-HTML whitespace characters
  39860. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  39861. attrNames = value && value.match(rnothtmlwhite);
  39862. if (attrNames && elem.nodeType === 1) {
  39863. while (name = attrNames[i++]) {
  39864. elem.removeAttribute(name);
  39865. }
  39866. }
  39867. }
  39868. });
  39869. // Hooks for boolean attributes
  39870. boolHook = {
  39871. set: function set(elem, value, name) {
  39872. if (value === false) {
  39873. // Remove boolean attributes when set to false
  39874. jQuery.removeAttr(elem, name);
  39875. } else {
  39876. elem.setAttribute(name, name);
  39877. }
  39878. return name;
  39879. }
  39880. };
  39881. jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function (i, name) {
  39882. var getter = attrHandle[name] || jQuery.find.attr;
  39883. attrHandle[name] = function (elem, name, isXML) {
  39884. var ret,
  39885. handle,
  39886. lowercaseName = name.toLowerCase();
  39887. if (!isXML) {
  39888. // Avoid an infinite loop by temporarily removing this function from the getter
  39889. handle = attrHandle[lowercaseName];
  39890. attrHandle[lowercaseName] = ret;
  39891. ret = getter(elem, name, isXML) != null ? lowercaseName : null;
  39892. attrHandle[lowercaseName] = handle;
  39893. }
  39894. return ret;
  39895. };
  39896. });
  39897. var rfocusable = /^(?:input|select|textarea|button)$/i,
  39898. rclickable = /^(?:a|area)$/i;
  39899. jQuery.fn.extend({
  39900. prop: function prop(name, value) {
  39901. return access(this, jQuery.prop, name, value, arguments.length > 1);
  39902. },
  39903. removeProp: function removeProp(name) {
  39904. return this.each(function () {
  39905. delete this[jQuery.propFix[name] || name];
  39906. });
  39907. }
  39908. });
  39909. jQuery.extend({
  39910. prop: function prop(elem, name, value) {
  39911. var ret,
  39912. hooks,
  39913. nType = elem.nodeType;
  39914. // Don't get/set properties on text, comment and attribute nodes
  39915. if (nType === 3 || nType === 8 || nType === 2) {
  39916. return;
  39917. }
  39918. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  39919. // Fix name and attach hooks
  39920. name = jQuery.propFix[name] || name;
  39921. hooks = jQuery.propHooks[name];
  39922. }
  39923. if (value !== undefined) {
  39924. if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
  39925. return ret;
  39926. }
  39927. return elem[name] = value;
  39928. }
  39929. if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
  39930. return ret;
  39931. }
  39932. return elem[name];
  39933. },
  39934. propHooks: {
  39935. tabIndex: {
  39936. get: function get(elem) {
  39937. // Support: IE <=9 - 11 only
  39938. // elem.tabIndex doesn't always return the
  39939. // correct value when it hasn't been explicitly set
  39940. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  39941. // Use proper attribute retrieval(#12072)
  39942. var tabindex = jQuery.find.attr(elem, "tabindex");
  39943. if (tabindex) {
  39944. return parseInt(tabindex, 10);
  39945. }
  39946. if (rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href) {
  39947. return 0;
  39948. }
  39949. return -1;
  39950. }
  39951. }
  39952. },
  39953. propFix: {
  39954. "for": "htmlFor",
  39955. "class": "className"
  39956. }
  39957. });
  39958. // Support: IE <=11 only
  39959. // Accessing the selectedIndex property
  39960. // forces the browser to respect setting selected
  39961. // on the option
  39962. // The getter ensures a default option is selected
  39963. // when in an optgroup
  39964. // eslint rule "no-unused-expressions" is disabled for this code
  39965. // since it considers such accessions noop
  39966. if (!support.optSelected) {
  39967. jQuery.propHooks.selected = {
  39968. get: function get(elem) {
  39969. /* eslint no-unused-expressions: "off" */
  39970. var parent = elem.parentNode;
  39971. if (parent && parent.parentNode) {
  39972. parent.parentNode.selectedIndex;
  39973. }
  39974. return null;
  39975. },
  39976. set: function set(elem) {
  39977. /* eslint no-unused-expressions: "off" */
  39978. var parent = elem.parentNode;
  39979. if (parent) {
  39980. parent.selectedIndex;
  39981. if (parent.parentNode) {
  39982. parent.parentNode.selectedIndex;
  39983. }
  39984. }
  39985. }
  39986. };
  39987. }
  39988. jQuery.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function () {
  39989. jQuery.propFix[this.toLowerCase()] = this;
  39990. });
  39991. // Strip and collapse whitespace according to HTML spec
  39992. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  39993. function stripAndCollapse(value) {
  39994. var tokens = value.match(rnothtmlwhite) || [];
  39995. return tokens.join(" ");
  39996. }
  39997. function getClass(elem) {
  39998. return elem.getAttribute && elem.getAttribute("class") || "";
  39999. }
  40000. function classesToArray(value) {
  40001. if (Array.isArray(value)) {
  40002. return value;
  40003. }
  40004. if (typeof value === "string") {
  40005. return value.match(rnothtmlwhite) || [];
  40006. }
  40007. return [];
  40008. }
  40009. jQuery.fn.extend({
  40010. addClass: function addClass(value) {
  40011. var classes,
  40012. elem,
  40013. cur,
  40014. curValue,
  40015. clazz,
  40016. j,
  40017. finalValue,
  40018. i = 0;
  40019. if (isFunction(value)) {
  40020. return this.each(function (j) {
  40021. jQuery(this).addClass(value.call(this, j, getClass(this)));
  40022. });
  40023. }
  40024. classes = classesToArray(value);
  40025. if (classes.length) {
  40026. while (elem = this[i++]) {
  40027. curValue = getClass(elem);
  40028. cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  40029. if (cur) {
  40030. j = 0;
  40031. while (clazz = classes[j++]) {
  40032. if (cur.indexOf(" " + clazz + " ") < 0) {
  40033. cur += clazz + " ";
  40034. }
  40035. }
  40036. // Only assign if different to avoid unneeded rendering.
  40037. finalValue = stripAndCollapse(cur);
  40038. if (curValue !== finalValue) {
  40039. elem.setAttribute("class", finalValue);
  40040. }
  40041. }
  40042. }
  40043. }
  40044. return this;
  40045. },
  40046. removeClass: function removeClass(value) {
  40047. var classes,
  40048. elem,
  40049. cur,
  40050. curValue,
  40051. clazz,
  40052. j,
  40053. finalValue,
  40054. i = 0;
  40055. if (isFunction(value)) {
  40056. return this.each(function (j) {
  40057. jQuery(this).removeClass(value.call(this, j, getClass(this)));
  40058. });
  40059. }
  40060. if (!arguments.length) {
  40061. return this.attr("class", "");
  40062. }
  40063. classes = classesToArray(value);
  40064. if (classes.length) {
  40065. while (elem = this[i++]) {
  40066. curValue = getClass(elem);
  40067. // This expression is here for better compressibility (see addClass)
  40068. cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  40069. if (cur) {
  40070. j = 0;
  40071. while (clazz = classes[j++]) {
  40072. // Remove *all* instances
  40073. while (cur.indexOf(" " + clazz + " ") > -1) {
  40074. cur = cur.replace(" " + clazz + " ", " ");
  40075. }
  40076. }
  40077. // Only assign if different to avoid unneeded rendering.
  40078. finalValue = stripAndCollapse(cur);
  40079. if (curValue !== finalValue) {
  40080. elem.setAttribute("class", finalValue);
  40081. }
  40082. }
  40083. }
  40084. }
  40085. return this;
  40086. },
  40087. toggleClass: function toggleClass(value, stateVal) {
  40088. var type = typeof value === "undefined" ? "undefined" : _typeof(value),
  40089. isValidValue = type === "string" || Array.isArray(value);
  40090. if (typeof stateVal === "boolean" && isValidValue) {
  40091. return stateVal ? this.addClass(value) : this.removeClass(value);
  40092. }
  40093. if (isFunction(value)) {
  40094. return this.each(function (i) {
  40095. jQuery(this).toggleClass(value.call(this, i, getClass(this), stateVal), stateVal);
  40096. });
  40097. }
  40098. return this.each(function () {
  40099. var className, i, self, classNames;
  40100. if (isValidValue) {
  40101. // Toggle individual class names
  40102. i = 0;
  40103. self = jQuery(this);
  40104. classNames = classesToArray(value);
  40105. while (className = classNames[i++]) {
  40106. // Check each className given, space separated list
  40107. if (self.hasClass(className)) {
  40108. self.removeClass(className);
  40109. } else {
  40110. self.addClass(className);
  40111. }
  40112. }
  40113. // Toggle whole class name
  40114. } else if (value === undefined || type === "boolean") {
  40115. className = getClass(this);
  40116. if (className) {
  40117. // Store className if set
  40118. dataPriv.set(this, "__className__", className);
  40119. }
  40120. // If the element has a class name or if we're passed `false`,
  40121. // then remove the whole classname (if there was one, the above saved it).
  40122. // Otherwise bring back whatever was previously saved (if anything),
  40123. // falling back to the empty string if nothing was stored.
  40124. if (this.setAttribute) {
  40125. this.setAttribute("class", className || value === false ? "" : dataPriv.get(this, "__className__") || "");
  40126. }
  40127. }
  40128. });
  40129. },
  40130. hasClass: function hasClass(selector) {
  40131. var className,
  40132. elem,
  40133. i = 0;
  40134. className = " " + selector + " ";
  40135. while (elem = this[i++]) {
  40136. if (elem.nodeType === 1 && (" " + stripAndCollapse(getClass(elem)) + " ").indexOf(className) > -1) {
  40137. return true;
  40138. }
  40139. }
  40140. return false;
  40141. }
  40142. });
  40143. var rreturn = /\r/g;
  40144. jQuery.fn.extend({
  40145. val: function val(value) {
  40146. var hooks,
  40147. ret,
  40148. valueIsFunction,
  40149. elem = this[0];
  40150. if (!arguments.length) {
  40151. if (elem) {
  40152. hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];
  40153. if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) {
  40154. return ret;
  40155. }
  40156. ret = elem.value;
  40157. // Handle most common string cases
  40158. if (typeof ret === "string") {
  40159. return ret.replace(rreturn, "");
  40160. }
  40161. // Handle cases where value is null/undef or number
  40162. return ret == null ? "" : ret;
  40163. }
  40164. return;
  40165. }
  40166. valueIsFunction = isFunction(value);
  40167. return this.each(function (i) {
  40168. var val;
  40169. if (this.nodeType !== 1) {
  40170. return;
  40171. }
  40172. if (valueIsFunction) {
  40173. val = value.call(this, i, jQuery(this).val());
  40174. } else {
  40175. val = value;
  40176. }
  40177. // Treat null/undefined as ""; convert numbers to string
  40178. if (val == null) {
  40179. val = "";
  40180. } else if (typeof val === "number") {
  40181. val += "";
  40182. } else if (Array.isArray(val)) {
  40183. val = jQuery.map(val, function (value) {
  40184. return value == null ? "" : value + "";
  40185. });
  40186. }
  40187. hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
  40188. // If set returns undefined, fall back to normal setting
  40189. if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) {
  40190. this.value = val;
  40191. }
  40192. });
  40193. }
  40194. });
  40195. jQuery.extend({
  40196. valHooks: {
  40197. option: {
  40198. get: function get(elem) {
  40199. var val = jQuery.find.attr(elem, "value");
  40200. return val != null ? val :
  40201. // Support: IE <=10 - 11 only
  40202. // option.text throws exceptions (#14686, #14858)
  40203. // Strip and collapse whitespace
  40204. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  40205. stripAndCollapse(jQuery.text(elem));
  40206. }
  40207. },
  40208. select: {
  40209. get: function get(elem) {
  40210. var value,
  40211. option,
  40212. i,
  40213. options = elem.options,
  40214. index = elem.selectedIndex,
  40215. one = elem.type === "select-one",
  40216. values = one ? null : [],
  40217. max = one ? index + 1 : options.length;
  40218. if (index < 0) {
  40219. i = max;
  40220. } else {
  40221. i = one ? index : 0;
  40222. }
  40223. // Loop through all the selected options
  40224. for (; i < max; i++) {
  40225. option = options[i];
  40226. // Support: IE <=9 only
  40227. // IE8-9 doesn't update selected after form reset (#2551)
  40228. if ((option.selected || i === index) &&
  40229. // Don't return options that are disabled or in a disabled optgroup
  40230. !option.disabled && (!option.parentNode.disabled || !nodeName(option.parentNode, "optgroup"))) {
  40231. // Get the specific value for the option
  40232. value = jQuery(option).val();
  40233. // We don't need an array for one selects
  40234. if (one) {
  40235. return value;
  40236. }
  40237. // Multi-Selects return an array
  40238. values.push(value);
  40239. }
  40240. }
  40241. return values;
  40242. },
  40243. set: function set(elem, value) {
  40244. var optionSet,
  40245. option,
  40246. options = elem.options,
  40247. values = jQuery.makeArray(value),
  40248. i = options.length;
  40249. while (i--) {
  40250. option = options[i];
  40251. /* eslint-disable no-cond-assign */
  40252. if (option.selected = jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1) {
  40253. optionSet = true;
  40254. }
  40255. /* eslint-enable no-cond-assign */
  40256. }
  40257. // Force browsers to behave consistently when non-matching value is set
  40258. if (!optionSet) {
  40259. elem.selectedIndex = -1;
  40260. }
  40261. return values;
  40262. }
  40263. }
  40264. }
  40265. });
  40266. // Radios and checkboxes getter/setter
  40267. jQuery.each(["radio", "checkbox"], function () {
  40268. jQuery.valHooks[this] = {
  40269. set: function set(elem, value) {
  40270. if (Array.isArray(value)) {
  40271. return elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1;
  40272. }
  40273. }
  40274. };
  40275. if (!support.checkOn) {
  40276. jQuery.valHooks[this].get = function (elem) {
  40277. return elem.getAttribute("value") === null ? "on" : elem.value;
  40278. };
  40279. }
  40280. });
  40281. // Return jQuery for attributes-only inclusion
  40282. support.focusin = "onfocusin" in window;
  40283. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  40284. stopPropagationCallback = function stopPropagationCallback(e) {
  40285. e.stopPropagation();
  40286. };
  40287. jQuery.extend(jQuery.event, {
  40288. trigger: function trigger(event, data, elem, onlyHandlers) {
  40289. var i,
  40290. cur,
  40291. tmp,
  40292. bubbleType,
  40293. ontype,
  40294. handle,
  40295. special,
  40296. lastElement,
  40297. eventPath = [elem || document],
  40298. type = hasOwn.call(event, "type") ? event.type : event,
  40299. namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : [];
  40300. cur = lastElement = tmp = elem = elem || document;
  40301. // Don't do events on text and comment nodes
  40302. if (elem.nodeType === 3 || elem.nodeType === 8) {
  40303. return;
  40304. }
  40305. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  40306. if (rfocusMorph.test(type + jQuery.event.triggered)) {
  40307. return;
  40308. }
  40309. if (type.indexOf(".") > -1) {
  40310. // Namespaced trigger; create a regexp to match event type in handle()
  40311. namespaces = type.split(".");
  40312. type = namespaces.shift();
  40313. namespaces.sort();
  40314. }
  40315. ontype = type.indexOf(":") < 0 && "on" + type;
  40316. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  40317. event = event[jQuery.expando] ? event : new jQuery.Event(type, (typeof event === "undefined" ? "undefined" : _typeof(event)) === "object" && event);
  40318. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  40319. event.isTrigger = onlyHandlers ? 2 : 3;
  40320. event.namespace = namespaces.join(".");
  40321. event.rnamespace = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
  40322. // Clean up the event in case it is being reused
  40323. event.result = undefined;
  40324. if (!event.target) {
  40325. event.target = elem;
  40326. }
  40327. // Clone any incoming data and prepend the event, creating the handler arg list
  40328. data = data == null ? [event] : jQuery.makeArray(data, [event]);
  40329. // Allow special events to draw outside the lines
  40330. special = jQuery.event.special[type] || {};
  40331. if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
  40332. return;
  40333. }
  40334. // Determine event propagation path in advance, per W3C events spec (#9951)
  40335. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  40336. if (!onlyHandlers && !special.noBubble && !isWindow(elem)) {
  40337. bubbleType = special.delegateType || type;
  40338. if (!rfocusMorph.test(bubbleType + type)) {
  40339. cur = cur.parentNode;
  40340. }
  40341. for (; cur; cur = cur.parentNode) {
  40342. eventPath.push(cur);
  40343. tmp = cur;
  40344. }
  40345. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  40346. if (tmp === (elem.ownerDocument || document)) {
  40347. eventPath.push(tmp.defaultView || tmp.parentWindow || window);
  40348. }
  40349. }
  40350. // Fire handlers on the event path
  40351. i = 0;
  40352. while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {
  40353. lastElement = cur;
  40354. event.type = i > 1 ? bubbleType : special.bindType || type;
  40355. // jQuery handler
  40356. handle = (dataPriv.get(cur, "events") || {})[event.type] && dataPriv.get(cur, "handle");
  40357. if (handle) {
  40358. handle.apply(cur, data);
  40359. }
  40360. // Native handler
  40361. handle = ontype && cur[ontype];
  40362. if (handle && handle.apply && acceptData(cur)) {
  40363. event.result = handle.apply(cur, data);
  40364. if (event.result === false) {
  40365. event.preventDefault();
  40366. }
  40367. }
  40368. }
  40369. event.type = type;
  40370. // If nobody prevented the default action, do it now
  40371. if (!onlyHandlers && !event.isDefaultPrevented()) {
  40372. if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && acceptData(elem)) {
  40373. // Call a native DOM method on the target with the same name as the event.
  40374. // Don't do default actions on window, that's where global variables be (#6170)
  40375. if (ontype && isFunction(elem[type]) && !isWindow(elem)) {
  40376. // Don't re-trigger an onFOO event when we call its FOO() method
  40377. tmp = elem[ontype];
  40378. if (tmp) {
  40379. elem[ontype] = null;
  40380. }
  40381. // Prevent re-triggering of the same event, since we already bubbled it above
  40382. jQuery.event.triggered = type;
  40383. if (event.isPropagationStopped()) {
  40384. lastElement.addEventListener(type, stopPropagationCallback);
  40385. }
  40386. elem[type]();
  40387. if (event.isPropagationStopped()) {
  40388. lastElement.removeEventListener(type, stopPropagationCallback);
  40389. }
  40390. jQuery.event.triggered = undefined;
  40391. if (tmp) {
  40392. elem[ontype] = tmp;
  40393. }
  40394. }
  40395. }
  40396. }
  40397. return event.result;
  40398. },
  40399. // Piggyback on a donor event to simulate a different one
  40400. // Used only for `focus(in | out)` events
  40401. simulate: function simulate(type, elem, event) {
  40402. var e = jQuery.extend(new jQuery.Event(), event, {
  40403. type: type,
  40404. isSimulated: true
  40405. });
  40406. jQuery.event.trigger(e, null, elem);
  40407. }
  40408. });
  40409. jQuery.fn.extend({
  40410. trigger: function trigger(type, data) {
  40411. return this.each(function () {
  40412. jQuery.event.trigger(type, data, this);
  40413. });
  40414. },
  40415. triggerHandler: function triggerHandler(type, data) {
  40416. var elem = this[0];
  40417. if (elem) {
  40418. return jQuery.event.trigger(type, data, elem, true);
  40419. }
  40420. }
  40421. });
  40422. // Support: Firefox <=44
  40423. // Firefox doesn't have focus(in | out) events
  40424. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  40425. //
  40426. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  40427. // focus(in | out) events fire after focus & blur events,
  40428. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  40429. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  40430. if (!support.focusin) {
  40431. jQuery.each({ focus: "focusin", blur: "focusout" }, function (orig, fix) {
  40432. // Attach a single capturing handler on the document while someone wants focusin/focusout
  40433. var handler = function handler(event) {
  40434. jQuery.event.simulate(fix, event.target, jQuery.event.fix(event));
  40435. };
  40436. jQuery.event.special[fix] = {
  40437. setup: function setup() {
  40438. var doc = this.ownerDocument || this,
  40439. attaches = dataPriv.access(doc, fix);
  40440. if (!attaches) {
  40441. doc.addEventListener(orig, handler, true);
  40442. }
  40443. dataPriv.access(doc, fix, (attaches || 0) + 1);
  40444. },
  40445. teardown: function teardown() {
  40446. var doc = this.ownerDocument || this,
  40447. attaches = dataPriv.access(doc, fix) - 1;
  40448. if (!attaches) {
  40449. doc.removeEventListener(orig, handler, true);
  40450. dataPriv.remove(doc, fix);
  40451. } else {
  40452. dataPriv.access(doc, fix, attaches);
  40453. }
  40454. }
  40455. };
  40456. });
  40457. }
  40458. var location = window.location;
  40459. var nonce = Date.now();
  40460. var rquery = /\?/;
  40461. // Cross-browser xml parsing
  40462. jQuery.parseXML = function (data) {
  40463. var xml;
  40464. if (!data || typeof data !== "string") {
  40465. return null;
  40466. }
  40467. // Support: IE 9 - 11 only
  40468. // IE throws on parseFromString with invalid input.
  40469. try {
  40470. xml = new window.DOMParser().parseFromString(data, "text/xml");
  40471. } catch (e) {
  40472. xml = undefined;
  40473. }
  40474. if (!xml || xml.getElementsByTagName("parsererror").length) {
  40475. jQuery.error("Invalid XML: " + data);
  40476. }
  40477. return xml;
  40478. };
  40479. var rbracket = /\[\]$/,
  40480. rCRLF = /\r?\n/g,
  40481. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  40482. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  40483. function buildParams(prefix, obj, traditional, add) {
  40484. var name;
  40485. if (Array.isArray(obj)) {
  40486. // Serialize array item.
  40487. jQuery.each(obj, function (i, v) {
  40488. if (traditional || rbracket.test(prefix)) {
  40489. // Treat each array item as a scalar.
  40490. add(prefix, v);
  40491. } else {
  40492. // Item is non-scalar (array or object), encode its numeric index.
  40493. buildParams(prefix + "[" + ((typeof v === "undefined" ? "undefined" : _typeof(v)) === "object" && v != null ? i : "") + "]", v, traditional, add);
  40494. }
  40495. });
  40496. } else if (!traditional && toType(obj) === "object") {
  40497. // Serialize object item.
  40498. for (name in obj) {
  40499. buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
  40500. }
  40501. } else {
  40502. // Serialize scalar item.
  40503. add(prefix, obj);
  40504. }
  40505. }
  40506. // Serialize an array of form elements or a set of
  40507. // key/values into a query string
  40508. jQuery.param = function (a, traditional) {
  40509. var prefix,
  40510. s = [],
  40511. add = function add(key, valueOrFunction) {
  40512. // If value is a function, invoke it and use its return value
  40513. var value = isFunction(valueOrFunction) ? valueOrFunction() : valueOrFunction;
  40514. s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value == null ? "" : value);
  40515. };
  40516. // If an array was passed in, assume that it is an array of form elements.
  40517. if (Array.isArray(a) || a.jquery && !jQuery.isPlainObject(a)) {
  40518. // Serialize the form elements
  40519. jQuery.each(a, function () {
  40520. add(this.name, this.value);
  40521. });
  40522. } else {
  40523. // If traditional, encode the "old" way (the way 1.3.2 or older
  40524. // did it), otherwise encode params recursively.
  40525. for (prefix in a) {
  40526. buildParams(prefix, a[prefix], traditional, add);
  40527. }
  40528. }
  40529. // Return the resulting serialization
  40530. return s.join("&");
  40531. };
  40532. jQuery.fn.extend({
  40533. serialize: function serialize() {
  40534. return jQuery.param(this.serializeArray());
  40535. },
  40536. serializeArray: function serializeArray() {
  40537. return this.map(function () {
  40538. // Can add propHook for "elements" to filter or add form elements
  40539. var elements = jQuery.prop(this, "elements");
  40540. return elements ? jQuery.makeArray(elements) : this;
  40541. }).filter(function () {
  40542. var type = this.type;
  40543. // Use .is( ":disabled" ) so that fieldset[disabled] works
  40544. return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type));
  40545. }).map(function (i, elem) {
  40546. var val = jQuery(this).val();
  40547. if (val == null) {
  40548. return null;
  40549. }
  40550. if (Array.isArray(val)) {
  40551. return jQuery.map(val, function (val) {
  40552. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  40553. });
  40554. }
  40555. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  40556. }).get();
  40557. }
  40558. });
  40559. var r20 = /%20/g,
  40560. rhash = /#.*$/,
  40561. rantiCache = /([?&])_=[^&]*/,
  40562. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  40563. // #7653, #8125, #8152: local protocol detection
  40564. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  40565. rnoContent = /^(?:GET|HEAD)$/,
  40566. rprotocol = /^\/\//,
  40567. /* Prefilters
  40568. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  40569. * 2) These are called:
  40570. * - BEFORE asking for a transport
  40571. * - AFTER param serialization (s.data is a string if s.processData is true)
  40572. * 3) key is the dataType
  40573. * 4) the catchall symbol "*" can be used
  40574. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  40575. */
  40576. prefilters = {},
  40577. /* Transports bindings
  40578. * 1) key is the dataType
  40579. * 2) the catchall symbol "*" can be used
  40580. * 3) selection will start with transport dataType and THEN go to "*" if needed
  40581. */
  40582. transports = {},
  40583. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  40584. allTypes = "*/".concat("*"),
  40585. // Anchor tag for parsing the document origin
  40586. originAnchor = document.createElement("a");
  40587. originAnchor.href = location.href;
  40588. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  40589. function addToPrefiltersOrTransports(structure) {
  40590. // dataTypeExpression is optional and defaults to "*"
  40591. return function (dataTypeExpression, func) {
  40592. if (typeof dataTypeExpression !== "string") {
  40593. func = dataTypeExpression;
  40594. dataTypeExpression = "*";
  40595. }
  40596. var dataType,
  40597. i = 0,
  40598. dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || [];
  40599. if (isFunction(func)) {
  40600. // For each dataType in the dataTypeExpression
  40601. while (dataType = dataTypes[i++]) {
  40602. // Prepend if requested
  40603. if (dataType[0] === "+") {
  40604. dataType = dataType.slice(1) || "*";
  40605. (structure[dataType] = structure[dataType] || []).unshift(func);
  40606. // Otherwise append
  40607. } else {
  40608. (structure[dataType] = structure[dataType] || []).push(func);
  40609. }
  40610. }
  40611. }
  40612. };
  40613. }
  40614. // Base inspection function for prefilters and transports
  40615. function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {
  40616. var inspected = {},
  40617. seekingTransport = structure === transports;
  40618. function inspect(dataType) {
  40619. var selected;
  40620. inspected[dataType] = true;
  40621. jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) {
  40622. var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);
  40623. if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) {
  40624. options.dataTypes.unshift(dataTypeOrTransport);
  40625. inspect(dataTypeOrTransport);
  40626. return false;
  40627. } else if (seekingTransport) {
  40628. return !(selected = dataTypeOrTransport);
  40629. }
  40630. });
  40631. return selected;
  40632. }
  40633. return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*");
  40634. }
  40635. // A special extend for ajax options
  40636. // that takes "flat" options (not to be deep extended)
  40637. // Fixes #9887
  40638. function ajaxExtend(target, src) {
  40639. var key,
  40640. deep,
  40641. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  40642. for (key in src) {
  40643. if (src[key] !== undefined) {
  40644. (flatOptions[key] ? target : deep || (deep = {}))[key] = src[key];
  40645. }
  40646. }
  40647. if (deep) {
  40648. jQuery.extend(true, target, deep);
  40649. }
  40650. return target;
  40651. }
  40652. /* Handles responses to an ajax request:
  40653. * - finds the right dataType (mediates between content-type and expected dataType)
  40654. * - returns the corresponding response
  40655. */
  40656. function ajaxHandleResponses(s, jqXHR, responses) {
  40657. var ct,
  40658. type,
  40659. finalDataType,
  40660. firstDataType,
  40661. contents = s.contents,
  40662. dataTypes = s.dataTypes;
  40663. // Remove auto dataType and get content-type in the process
  40664. while (dataTypes[0] === "*") {
  40665. dataTypes.shift();
  40666. if (ct === undefined) {
  40667. ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
  40668. }
  40669. }
  40670. // Check if we're dealing with a known content-type
  40671. if (ct) {
  40672. for (type in contents) {
  40673. if (contents[type] && contents[type].test(ct)) {
  40674. dataTypes.unshift(type);
  40675. break;
  40676. }
  40677. }
  40678. }
  40679. // Check to see if we have a response for the expected dataType
  40680. if (dataTypes[0] in responses) {
  40681. finalDataType = dataTypes[0];
  40682. } else {
  40683. // Try convertible dataTypes
  40684. for (type in responses) {
  40685. if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) {
  40686. finalDataType = type;
  40687. break;
  40688. }
  40689. if (!firstDataType) {
  40690. firstDataType = type;
  40691. }
  40692. }
  40693. // Or just use first one
  40694. finalDataType = finalDataType || firstDataType;
  40695. }
  40696. // If we found a dataType
  40697. // We add the dataType to the list if needed
  40698. // and return the corresponding response
  40699. if (finalDataType) {
  40700. if (finalDataType !== dataTypes[0]) {
  40701. dataTypes.unshift(finalDataType);
  40702. }
  40703. return responses[finalDataType];
  40704. }
  40705. }
  40706. /* Chain conversions given the request and the original response
  40707. * Also sets the responseXXX fields on the jqXHR instance
  40708. */
  40709. function ajaxConvert(s, response, jqXHR, isSuccess) {
  40710. var conv2,
  40711. current,
  40712. conv,
  40713. tmp,
  40714. prev,
  40715. converters = {},
  40716. // Work with a copy of dataTypes in case we need to modify it for conversion
  40717. dataTypes = s.dataTypes.slice();
  40718. // Create converters map with lowercased keys
  40719. if (dataTypes[1]) {
  40720. for (conv in s.converters) {
  40721. converters[conv.toLowerCase()] = s.converters[conv];
  40722. }
  40723. }
  40724. current = dataTypes.shift();
  40725. // Convert to each sequential dataType
  40726. while (current) {
  40727. if (s.responseFields[current]) {
  40728. jqXHR[s.responseFields[current]] = response;
  40729. }
  40730. // Apply the dataFilter if provided
  40731. if (!prev && isSuccess && s.dataFilter) {
  40732. response = s.dataFilter(response, s.dataType);
  40733. }
  40734. prev = current;
  40735. current = dataTypes.shift();
  40736. if (current) {
  40737. // There's only work to do if current dataType is non-auto
  40738. if (current === "*") {
  40739. current = prev;
  40740. // Convert response if prev dataType is non-auto and differs from current
  40741. } else if (prev !== "*" && prev !== current) {
  40742. // Seek a direct converter
  40743. conv = converters[prev + " " + current] || converters["* " + current];
  40744. // If none found, seek a pair
  40745. if (!conv) {
  40746. for (conv2 in converters) {
  40747. // If conv2 outputs current
  40748. tmp = conv2.split(" ");
  40749. if (tmp[1] === current) {
  40750. // If prev can be converted to accepted input
  40751. conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]];
  40752. if (conv) {
  40753. // Condense equivalence converters
  40754. if (conv === true) {
  40755. conv = converters[conv2];
  40756. // Otherwise, insert the intermediate dataType
  40757. } else if (converters[conv2] !== true) {
  40758. current = tmp[0];
  40759. dataTypes.unshift(tmp[1]);
  40760. }
  40761. break;
  40762. }
  40763. }
  40764. }
  40765. }
  40766. // Apply converter (if not an equivalence)
  40767. if (conv !== true) {
  40768. // Unless errors are allowed to bubble, catch and return them
  40769. if (conv && s.throws) {
  40770. response = conv(response);
  40771. } else {
  40772. try {
  40773. response = conv(response);
  40774. } catch (e) {
  40775. return {
  40776. state: "parsererror",
  40777. error: conv ? e : "No conversion from " + prev + " to " + current
  40778. };
  40779. }
  40780. }
  40781. }
  40782. }
  40783. }
  40784. }
  40785. return { state: "success", data: response };
  40786. }
  40787. jQuery.extend({
  40788. // Counter for holding the number of active queries
  40789. active: 0,
  40790. // Last-Modified header cache for next request
  40791. lastModified: {},
  40792. etag: {},
  40793. ajaxSettings: {
  40794. url: location.href,
  40795. type: "GET",
  40796. isLocal: rlocalProtocol.test(location.protocol),
  40797. global: true,
  40798. processData: true,
  40799. async: true,
  40800. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  40801. /*
  40802. timeout: 0,
  40803. data: null,
  40804. dataType: null,
  40805. username: null,
  40806. password: null,
  40807. cache: null,
  40808. throws: false,
  40809. traditional: false,
  40810. headers: {},
  40811. */
  40812. accepts: {
  40813. "*": allTypes,
  40814. text: "text/plain",
  40815. html: "text/html",
  40816. xml: "application/xml, text/xml",
  40817. json: "application/json, text/javascript"
  40818. },
  40819. contents: {
  40820. xml: /\bxml\b/,
  40821. html: /\bhtml/,
  40822. json: /\bjson\b/
  40823. },
  40824. responseFields: {
  40825. xml: "responseXML",
  40826. text: "responseText",
  40827. json: "responseJSON"
  40828. },
  40829. // Data converters
  40830. // Keys separate source (or catchall "*") and destination types with a single space
  40831. converters: {
  40832. // Convert anything to text
  40833. "* text": String,
  40834. // Text to html (true = no transformation)
  40835. "text html": true,
  40836. // Evaluate text as a json expression
  40837. "text json": JSON.parse,
  40838. // Parse text as xml
  40839. "text xml": jQuery.parseXML
  40840. },
  40841. // For options that shouldn't be deep extended:
  40842. // you can add your own custom options here if
  40843. // and when you create one that shouldn't be
  40844. // deep extended (see ajaxExtend)
  40845. flatOptions: {
  40846. url: true,
  40847. context: true
  40848. }
  40849. },
  40850. // Creates a full fledged settings object into target
  40851. // with both ajaxSettings and settings fields.
  40852. // If target is omitted, writes into ajaxSettings.
  40853. ajaxSetup: function ajaxSetup(target, settings) {
  40854. return settings ?
  40855. // Building a settings object
  40856. ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) :
  40857. // Extending ajaxSettings
  40858. ajaxExtend(jQuery.ajaxSettings, target);
  40859. },
  40860. ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
  40861. ajaxTransport: addToPrefiltersOrTransports(transports),
  40862. // Main method
  40863. ajax: function ajax(url, options) {
  40864. // If url is an object, simulate pre-1.5 signature
  40865. if ((typeof url === "undefined" ? "undefined" : _typeof(url)) === "object") {
  40866. options = url;
  40867. url = undefined;
  40868. }
  40869. // Force options to be an object
  40870. options = options || {};
  40871. var transport,
  40872. // URL without anti-cache param
  40873. cacheURL,
  40874. // Response headers
  40875. responseHeadersString,
  40876. responseHeaders,
  40877. // timeout handle
  40878. timeoutTimer,
  40879. // Url cleanup var
  40880. urlAnchor,
  40881. // Request state (becomes false upon send and true upon completion)
  40882. completed,
  40883. // To know if global events are to be dispatched
  40884. fireGlobals,
  40885. // Loop variable
  40886. i,
  40887. // uncached part of the url
  40888. uncached,
  40889. // Create the final options object
  40890. s = jQuery.ajaxSetup({}, options),
  40891. // Callbacks context
  40892. callbackContext = s.context || s,
  40893. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  40894. globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event,
  40895. // Deferreds
  40896. deferred = jQuery.Deferred(),
  40897. completeDeferred = jQuery.Callbacks("once memory"),
  40898. // Status-dependent callbacks
  40899. _statusCode = s.statusCode || {},
  40900. // Headers (they are sent all at once)
  40901. requestHeaders = {},
  40902. requestHeadersNames = {},
  40903. // Default abort message
  40904. strAbort = "canceled",
  40905. // Fake xhr
  40906. jqXHR = {
  40907. readyState: 0,
  40908. // Builds headers hashtable if needed
  40909. getResponseHeader: function getResponseHeader(key) {
  40910. var match;
  40911. if (completed) {
  40912. if (!responseHeaders) {
  40913. responseHeaders = {};
  40914. while (match = rheaders.exec(responseHeadersString)) {
  40915. responseHeaders[match[1].toLowerCase()] = match[2];
  40916. }
  40917. }
  40918. match = responseHeaders[key.toLowerCase()];
  40919. }
  40920. return match == null ? null : match;
  40921. },
  40922. // Raw string
  40923. getAllResponseHeaders: function getAllResponseHeaders() {
  40924. return completed ? responseHeadersString : null;
  40925. },
  40926. // Caches the header
  40927. setRequestHeader: function setRequestHeader(name, value) {
  40928. if (completed == null) {
  40929. name = requestHeadersNames[name.toLowerCase()] = requestHeadersNames[name.toLowerCase()] || name;
  40930. requestHeaders[name] = value;
  40931. }
  40932. return this;
  40933. },
  40934. // Overrides response content-type header
  40935. overrideMimeType: function overrideMimeType(type) {
  40936. if (completed == null) {
  40937. s.mimeType = type;
  40938. }
  40939. return this;
  40940. },
  40941. // Status-dependent callbacks
  40942. statusCode: function statusCode(map) {
  40943. var code;
  40944. if (map) {
  40945. if (completed) {
  40946. // Execute the appropriate callbacks
  40947. jqXHR.always(map[jqXHR.status]);
  40948. } else {
  40949. // Lazy-add the new callbacks in a way that preserves old ones
  40950. for (code in map) {
  40951. _statusCode[code] = [_statusCode[code], map[code]];
  40952. }
  40953. }
  40954. }
  40955. return this;
  40956. },
  40957. // Cancel the request
  40958. abort: function abort(statusText) {
  40959. var finalText = statusText || strAbort;
  40960. if (transport) {
  40961. transport.abort(finalText);
  40962. }
  40963. done(0, finalText);
  40964. return this;
  40965. }
  40966. };
  40967. // Attach deferreds
  40968. deferred.promise(jqXHR);
  40969. // Add protocol if not provided (prefilters might expect it)
  40970. // Handle falsy url in the settings object (#10093: consistency with old signature)
  40971. // We also use the url parameter if available
  40972. s.url = ((url || s.url || location.href) + "").replace(rprotocol, location.protocol + "//");
  40973. // Alias method option to type as per ticket #12004
  40974. s.type = options.method || options.type || s.method || s.type;
  40975. // Extract dataTypes list
  40976. s.dataTypes = (s.dataType || "*").toLowerCase().match(rnothtmlwhite) || [""];
  40977. // A cross-domain request is in order when the origin doesn't match the current origin.
  40978. if (s.crossDomain == null) {
  40979. urlAnchor = document.createElement("a");
  40980. // Support: IE <=8 - 11, Edge 12 - 15
  40981. // IE throws exception on accessing the href property if url is malformed,
  40982. // e.g. http://example.com:80x/
  40983. try {
  40984. urlAnchor.href = s.url;
  40985. // Support: IE <=8 - 11 only
  40986. // Anchor's host property isn't correctly set when s.url is relative
  40987. urlAnchor.href = urlAnchor.href;
  40988. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== urlAnchor.protocol + "//" + urlAnchor.host;
  40989. } catch (e) {
  40990. // If there is an error parsing the URL, assume it is crossDomain,
  40991. // it can be rejected by the transport if it is invalid
  40992. s.crossDomain = true;
  40993. }
  40994. }
  40995. // Convert data if not already a string
  40996. if (s.data && s.processData && typeof s.data !== "string") {
  40997. s.data = jQuery.param(s.data, s.traditional);
  40998. }
  40999. // Apply prefilters
  41000. inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);
  41001. // If request was aborted inside a prefilter, stop there
  41002. if (completed) {
  41003. return jqXHR;
  41004. }
  41005. // We can fire global events as of now if asked to
  41006. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  41007. fireGlobals = jQuery.event && s.global;
  41008. // Watch for a new set of requests
  41009. if (fireGlobals && jQuery.active++ === 0) {
  41010. jQuery.event.trigger("ajaxStart");
  41011. }
  41012. // Uppercase the type
  41013. s.type = s.type.toUpperCase();
  41014. // Determine if request has content
  41015. s.hasContent = !rnoContent.test(s.type);
  41016. // Save the URL in case we're toying with the If-Modified-Since
  41017. // and/or If-None-Match header later on
  41018. // Remove hash to simplify url manipulation
  41019. cacheURL = s.url.replace(rhash, "");
  41020. // More options handling for requests with no content
  41021. if (!s.hasContent) {
  41022. // Remember the hash so we can put it back
  41023. uncached = s.url.slice(cacheURL.length);
  41024. // If data is available and should be processed, append data to url
  41025. if (s.data && (s.processData || typeof s.data === "string")) {
  41026. cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s.data;
  41027. // #9682: remove data so that it's not used in an eventual retry
  41028. delete s.data;
  41029. }
  41030. // Add or update anti-cache param if needed
  41031. if (s.cache === false) {
  41032. cacheURL = cacheURL.replace(rantiCache, "$1");
  41033. uncached = (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce++ + uncached;
  41034. }
  41035. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  41036. s.url = cacheURL + uncached;
  41037. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  41038. } else if (s.data && s.processData && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0) {
  41039. s.data = s.data.replace(r20, "+");
  41040. }
  41041. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  41042. if (s.ifModified) {
  41043. if (jQuery.lastModified[cacheURL]) {
  41044. jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]);
  41045. }
  41046. if (jQuery.etag[cacheURL]) {
  41047. jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]);
  41048. }
  41049. }
  41050. // Set the correct header, if data is being sent
  41051. if (s.data && s.hasContent && s.contentType !== false || options.contentType) {
  41052. jqXHR.setRequestHeader("Content-Type", s.contentType);
  41053. }
  41054. // Set the Accepts header for the server, depending on the dataType
  41055. jqXHR.setRequestHeader("Accept", s.dataTypes[0] && s.accepts[s.dataTypes[0]] ? s.accepts[s.dataTypes[0]] + (s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") : s.accepts["*"]);
  41056. // Check for headers option
  41057. for (i in s.headers) {
  41058. jqXHR.setRequestHeader(i, s.headers[i]);
  41059. }
  41060. // Allow custom headers/mimetypes and early abort
  41061. if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed)) {
  41062. // Abort if not done already and return
  41063. return jqXHR.abort();
  41064. }
  41065. // Aborting is no longer a cancellation
  41066. strAbort = "abort";
  41067. // Install callbacks on deferreds
  41068. completeDeferred.add(s.complete);
  41069. jqXHR.done(s.success);
  41070. jqXHR.fail(s.error);
  41071. // Get transport
  41072. transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);
  41073. // If no transport, we auto-abort
  41074. if (!transport) {
  41075. done(-1, "No Transport");
  41076. } else {
  41077. jqXHR.readyState = 1;
  41078. // Send global event
  41079. if (fireGlobals) {
  41080. globalEventContext.trigger("ajaxSend", [jqXHR, s]);
  41081. }
  41082. // If request was aborted inside ajaxSend, stop there
  41083. if (completed) {
  41084. return jqXHR;
  41085. }
  41086. // Timeout
  41087. if (s.async && s.timeout > 0) {
  41088. timeoutTimer = window.setTimeout(function () {
  41089. jqXHR.abort("timeout");
  41090. }, s.timeout);
  41091. }
  41092. try {
  41093. completed = false;
  41094. transport.send(requestHeaders, done);
  41095. } catch (e) {
  41096. // Rethrow post-completion exceptions
  41097. if (completed) {
  41098. throw e;
  41099. }
  41100. // Propagate others as results
  41101. done(-1, e);
  41102. }
  41103. }
  41104. // Callback for when everything is done
  41105. function done(status, nativeStatusText, responses, headers) {
  41106. var isSuccess,
  41107. success,
  41108. error,
  41109. response,
  41110. modified,
  41111. statusText = nativeStatusText;
  41112. // Ignore repeat invocations
  41113. if (completed) {
  41114. return;
  41115. }
  41116. completed = true;
  41117. // Clear timeout if it exists
  41118. if (timeoutTimer) {
  41119. window.clearTimeout(timeoutTimer);
  41120. }
  41121. // Dereference transport for early garbage collection
  41122. // (no matter how long the jqXHR object will be used)
  41123. transport = undefined;
  41124. // Cache response headers
  41125. responseHeadersString = headers || "";
  41126. // Set readyState
  41127. jqXHR.readyState = status > 0 ? 4 : 0;
  41128. // Determine if successful
  41129. isSuccess = status >= 200 && status < 300 || status === 304;
  41130. // Get response data
  41131. if (responses) {
  41132. response = ajaxHandleResponses(s, jqXHR, responses);
  41133. }
  41134. // Convert no matter what (that way responseXXX fields are always set)
  41135. response = ajaxConvert(s, response, jqXHR, isSuccess);
  41136. // If successful, handle type chaining
  41137. if (isSuccess) {
  41138. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  41139. if (s.ifModified) {
  41140. modified = jqXHR.getResponseHeader("Last-Modified");
  41141. if (modified) {
  41142. jQuery.lastModified[cacheURL] = modified;
  41143. }
  41144. modified = jqXHR.getResponseHeader("etag");
  41145. if (modified) {
  41146. jQuery.etag[cacheURL] = modified;
  41147. }
  41148. }
  41149. // if no content
  41150. if (status === 204 || s.type === "HEAD") {
  41151. statusText = "nocontent";
  41152. // if not modified
  41153. } else if (status === 304) {
  41154. statusText = "notmodified";
  41155. // If we have data, let's convert it
  41156. } else {
  41157. statusText = response.state;
  41158. success = response.data;
  41159. error = response.error;
  41160. isSuccess = !error;
  41161. }
  41162. } else {
  41163. // Extract error from statusText and normalize for non-aborts
  41164. error = statusText;
  41165. if (status || !statusText) {
  41166. statusText = "error";
  41167. if (status < 0) {
  41168. status = 0;
  41169. }
  41170. }
  41171. }
  41172. // Set data for the fake xhr object
  41173. jqXHR.status = status;
  41174. jqXHR.statusText = (nativeStatusText || statusText) + "";
  41175. // Success/Error
  41176. if (isSuccess) {
  41177. deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);
  41178. } else {
  41179. deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);
  41180. }
  41181. // Status-dependent callbacks
  41182. jqXHR.statusCode(_statusCode);
  41183. _statusCode = undefined;
  41184. if (fireGlobals) {
  41185. globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [jqXHR, s, isSuccess ? success : error]);
  41186. }
  41187. // Complete
  41188. completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
  41189. if (fireGlobals) {
  41190. globalEventContext.trigger("ajaxComplete", [jqXHR, s]);
  41191. // Handle the global AJAX counter
  41192. if (! --jQuery.active) {
  41193. jQuery.event.trigger("ajaxStop");
  41194. }
  41195. }
  41196. }
  41197. return jqXHR;
  41198. },
  41199. getJSON: function getJSON(url, data, callback) {
  41200. return jQuery.get(url, data, callback, "json");
  41201. },
  41202. getScript: function getScript(url, callback) {
  41203. return jQuery.get(url, undefined, callback, "script");
  41204. }
  41205. });
  41206. jQuery.each(["get", "post"], function (i, method) {
  41207. jQuery[method] = function (url, data, callback, type) {
  41208. // Shift arguments if data argument was omitted
  41209. if (isFunction(data)) {
  41210. type = type || callback;
  41211. callback = data;
  41212. data = undefined;
  41213. }
  41214. // The url can be an options object (which then must have .url)
  41215. return jQuery.ajax(jQuery.extend({
  41216. url: url,
  41217. type: method,
  41218. dataType: type,
  41219. data: data,
  41220. success: callback
  41221. }, jQuery.isPlainObject(url) && url));
  41222. };
  41223. });
  41224. jQuery._evalUrl = function (url) {
  41225. return jQuery.ajax({
  41226. url: url,
  41227. // Make this explicit, since user can override this through ajaxSetup (#11264)
  41228. type: "GET",
  41229. dataType: "script",
  41230. cache: true,
  41231. async: false,
  41232. global: false,
  41233. "throws": true
  41234. });
  41235. };
  41236. jQuery.fn.extend({
  41237. wrapAll: function wrapAll(html) {
  41238. var wrap;
  41239. if (this[0]) {
  41240. if (isFunction(html)) {
  41241. html = html.call(this[0]);
  41242. }
  41243. // The elements to wrap the target around
  41244. wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
  41245. if (this[0].parentNode) {
  41246. wrap.insertBefore(this[0]);
  41247. }
  41248. wrap.map(function () {
  41249. var elem = this;
  41250. while (elem.firstElementChild) {
  41251. elem = elem.firstElementChild;
  41252. }
  41253. return elem;
  41254. }).append(this);
  41255. }
  41256. return this;
  41257. },
  41258. wrapInner: function wrapInner(html) {
  41259. if (isFunction(html)) {
  41260. return this.each(function (i) {
  41261. jQuery(this).wrapInner(html.call(this, i));
  41262. });
  41263. }
  41264. return this.each(function () {
  41265. var self = jQuery(this),
  41266. contents = self.contents();
  41267. if (contents.length) {
  41268. contents.wrapAll(html);
  41269. } else {
  41270. self.append(html);
  41271. }
  41272. });
  41273. },
  41274. wrap: function wrap(html) {
  41275. var htmlIsFunction = isFunction(html);
  41276. return this.each(function (i) {
  41277. jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i) : html);
  41278. });
  41279. },
  41280. unwrap: function unwrap(selector) {
  41281. this.parent(selector).not("body").each(function () {
  41282. jQuery(this).replaceWith(this.childNodes);
  41283. });
  41284. return this;
  41285. }
  41286. });
  41287. jQuery.expr.pseudos.hidden = function (elem) {
  41288. return !jQuery.expr.pseudos.visible(elem);
  41289. };
  41290. jQuery.expr.pseudos.visible = function (elem) {
  41291. return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
  41292. };
  41293. jQuery.ajaxSettings.xhr = function () {
  41294. try {
  41295. return new window.XMLHttpRequest();
  41296. } catch (e) {}
  41297. };
  41298. var xhrSuccessStatus = {
  41299. // File protocol always yields status code 0, assume 200
  41300. 0: 200,
  41301. // Support: IE <=9 only
  41302. // #1450: sometimes IE returns 1223 when it should be 204
  41303. 1223: 204
  41304. },
  41305. xhrSupported = jQuery.ajaxSettings.xhr();
  41306. support.cors = !!xhrSupported && "withCredentials" in xhrSupported;
  41307. support.ajax = xhrSupported = !!xhrSupported;
  41308. jQuery.ajaxTransport(function (options) {
  41309. var _callback, errorCallback;
  41310. // Cross domain only allowed if supported through XMLHttpRequest
  41311. if (support.cors || xhrSupported && !options.crossDomain) {
  41312. return {
  41313. send: function send(headers, complete) {
  41314. var i,
  41315. xhr = options.xhr();
  41316. xhr.open(options.type, options.url, options.async, options.username, options.password);
  41317. // Apply custom fields if provided
  41318. if (options.xhrFields) {
  41319. for (i in options.xhrFields) {
  41320. xhr[i] = options.xhrFields[i];
  41321. }
  41322. }
  41323. // Override mime type if needed
  41324. if (options.mimeType && xhr.overrideMimeType) {
  41325. xhr.overrideMimeType(options.mimeType);
  41326. }
  41327. // X-Requested-With header
  41328. // For cross-domain requests, seeing as conditions for a preflight are
  41329. // akin to a jigsaw puzzle, we simply never set it to be sure.
  41330. // (it can always be set on a per-request basis or even using ajaxSetup)
  41331. // For same-domain requests, won't change header if already provided.
  41332. if (!options.crossDomain && !headers["X-Requested-With"]) {
  41333. headers["X-Requested-With"] = "XMLHttpRequest";
  41334. }
  41335. // Set headers
  41336. for (i in headers) {
  41337. xhr.setRequestHeader(i, headers[i]);
  41338. }
  41339. // Callback
  41340. _callback = function callback(type) {
  41341. return function () {
  41342. if (_callback) {
  41343. _callback = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = xhr.onreadystatechange = null;
  41344. if (type === "abort") {
  41345. xhr.abort();
  41346. } else if (type === "error") {
  41347. // Support: IE <=9 only
  41348. // On a manual native abort, IE9 throws
  41349. // errors on any property access that is not readyState
  41350. if (typeof xhr.status !== "number") {
  41351. complete(0, "error");
  41352. } else {
  41353. complete(
  41354. // File: protocol always yields status 0; see #8605, #14207
  41355. xhr.status, xhr.statusText);
  41356. }
  41357. } else {
  41358. complete(xhrSuccessStatus[xhr.status] || xhr.status, xhr.statusText,
  41359. // Support: IE <=9 only
  41360. // IE9 has no XHR2 but throws on binary (trac-11426)
  41361. // For XHR2 non-text, let the caller handle it (gh-2498)
  41362. (xhr.responseType || "text") !== "text" || typeof xhr.responseText !== "string" ? { binary: xhr.response } : { text: xhr.responseText }, xhr.getAllResponseHeaders());
  41363. }
  41364. }
  41365. };
  41366. };
  41367. // Listen to events
  41368. xhr.onload = _callback();
  41369. errorCallback = xhr.onerror = xhr.ontimeout = _callback("error");
  41370. // Support: IE 9 only
  41371. // Use onreadystatechange to replace onabort
  41372. // to handle uncaught aborts
  41373. if (xhr.onabort !== undefined) {
  41374. xhr.onabort = errorCallback;
  41375. } else {
  41376. xhr.onreadystatechange = function () {
  41377. // Check readyState before timeout as it changes
  41378. if (xhr.readyState === 4) {
  41379. // Allow onerror to be called first,
  41380. // but that will not handle a native abort
  41381. // Also, save errorCallback to a variable
  41382. // as xhr.onerror cannot be accessed
  41383. window.setTimeout(function () {
  41384. if (_callback) {
  41385. errorCallback();
  41386. }
  41387. });
  41388. }
  41389. };
  41390. }
  41391. // Create the abort callback
  41392. _callback = _callback("abort");
  41393. try {
  41394. // Do send the request (this may raise an exception)
  41395. xhr.send(options.hasContent && options.data || null);
  41396. } catch (e) {
  41397. // #14683: Only rethrow if this hasn't been notified as an error yet
  41398. if (_callback) {
  41399. throw e;
  41400. }
  41401. }
  41402. },
  41403. abort: function abort() {
  41404. if (_callback) {
  41405. _callback();
  41406. }
  41407. }
  41408. };
  41409. }
  41410. });
  41411. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  41412. jQuery.ajaxPrefilter(function (s) {
  41413. if (s.crossDomain) {
  41414. s.contents.script = false;
  41415. }
  41416. });
  41417. // Install script dataType
  41418. jQuery.ajaxSetup({
  41419. accepts: {
  41420. script: "text/javascript, application/javascript, " + "application/ecmascript, application/x-ecmascript"
  41421. },
  41422. contents: {
  41423. script: /\b(?:java|ecma)script\b/
  41424. },
  41425. converters: {
  41426. "text script": function textScript(text) {
  41427. jQuery.globalEval(text);
  41428. return text;
  41429. }
  41430. }
  41431. });
  41432. // Handle cache's special case and crossDomain
  41433. jQuery.ajaxPrefilter("script", function (s) {
  41434. if (s.cache === undefined) {
  41435. s.cache = false;
  41436. }
  41437. if (s.crossDomain) {
  41438. s.type = "GET";
  41439. }
  41440. });
  41441. // Bind script tag hack transport
  41442. jQuery.ajaxTransport("script", function (s) {
  41443. // This transport only deals with cross domain requests
  41444. if (s.crossDomain) {
  41445. var script, _callback2;
  41446. return {
  41447. send: function send(_, complete) {
  41448. script = jQuery("<script>").prop({
  41449. charset: s.scriptCharset,
  41450. src: s.url
  41451. }).on("load error", _callback2 = function callback(evt) {
  41452. script.remove();
  41453. _callback2 = null;
  41454. if (evt) {
  41455. complete(evt.type === "error" ? 404 : 200, evt.type);
  41456. }
  41457. });
  41458. // Use native DOM manipulation to avoid our domManip AJAX trickery
  41459. document.head.appendChild(script[0]);
  41460. },
  41461. abort: function abort() {
  41462. if (_callback2) {
  41463. _callback2();
  41464. }
  41465. }
  41466. };
  41467. }
  41468. });
  41469. var oldCallbacks = [],
  41470. rjsonp = /(=)\?(?=&|$)|\?\?/;
  41471. // Default jsonp settings
  41472. jQuery.ajaxSetup({
  41473. jsonp: "callback",
  41474. jsonpCallback: function jsonpCallback() {
  41475. var callback = oldCallbacks.pop() || jQuery.expando + "_" + nonce++;
  41476. this[callback] = true;
  41477. return callback;
  41478. }
  41479. });
  41480. // Detect, normalize options and install callbacks for jsonp requests
  41481. jQuery.ajaxPrefilter("json jsonp", function (s, originalSettings, jqXHR) {
  41482. var callbackName,
  41483. overwritten,
  41484. responseContainer,
  41485. jsonProp = s.jsonp !== false && (rjsonp.test(s.url) ? "url" : typeof s.data === "string" && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0 && rjsonp.test(s.data) && "data");
  41486. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  41487. if (jsonProp || s.dataTypes[0] === "jsonp") {
  41488. // Get callback name, remembering preexisting value associated with it
  41489. callbackName = s.jsonpCallback = isFunction(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback;
  41490. // Insert callback into url or form data
  41491. if (jsonProp) {
  41492. s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName);
  41493. } else if (s.jsonp !== false) {
  41494. s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName;
  41495. }
  41496. // Use data converter to retrieve json after script execution
  41497. s.converters["script json"] = function () {
  41498. if (!responseContainer) {
  41499. jQuery.error(callbackName + " was not called");
  41500. }
  41501. return responseContainer[0];
  41502. };
  41503. // Force json dataType
  41504. s.dataTypes[0] = "json";
  41505. // Install callback
  41506. overwritten = window[callbackName];
  41507. window[callbackName] = function () {
  41508. responseContainer = arguments;
  41509. };
  41510. // Clean-up function (fires after converters)
  41511. jqXHR.always(function () {
  41512. // If previous value didn't exist - remove it
  41513. if (overwritten === undefined) {
  41514. jQuery(window).removeProp(callbackName);
  41515. // Otherwise restore preexisting value
  41516. } else {
  41517. window[callbackName] = overwritten;
  41518. }
  41519. // Save back as free
  41520. if (s[callbackName]) {
  41521. // Make sure that re-using the options doesn't screw things around
  41522. s.jsonpCallback = originalSettings.jsonpCallback;
  41523. // Save the callback name for future use
  41524. oldCallbacks.push(callbackName);
  41525. }
  41526. // Call if it was a function and we have a response
  41527. if (responseContainer && isFunction(overwritten)) {
  41528. overwritten(responseContainer[0]);
  41529. }
  41530. responseContainer = overwritten = undefined;
  41531. });
  41532. // Delegate to script
  41533. return "script";
  41534. }
  41535. });
  41536. // Support: Safari 8 only
  41537. // In Safari 8 documents created via document.implementation.createHTMLDocument
  41538. // collapse sibling forms: the second one becomes a child of the first one.
  41539. // Because of that, this security measure has to be disabled in Safari 8.
  41540. // https://bugs.webkit.org/show_bug.cgi?id=137337
  41541. support.createHTMLDocument = function () {
  41542. var body = document.implementation.createHTMLDocument("").body;
  41543. body.innerHTML = "<form></form><form></form>";
  41544. return body.childNodes.length === 2;
  41545. }();
  41546. // Argument "data" should be string of html
  41547. // context (optional): If specified, the fragment will be created in this context,
  41548. // defaults to document
  41549. // keepScripts (optional): If true, will include scripts passed in the html string
  41550. jQuery.parseHTML = function (data, context, keepScripts) {
  41551. if (typeof data !== "string") {
  41552. return [];
  41553. }
  41554. if (typeof context === "boolean") {
  41555. keepScripts = context;
  41556. context = false;
  41557. }
  41558. var base, parsed, scripts;
  41559. if (!context) {
  41560. // Stop scripts or inline event handlers from being executed immediately
  41561. // by using document.implementation
  41562. if (support.createHTMLDocument) {
  41563. context = document.implementation.createHTMLDocument("");
  41564. // Set the base href for the created document
  41565. // so any parsed elements with URLs
  41566. // are based on the document's URL (gh-2965)
  41567. base = context.createElement("base");
  41568. base.href = document.location.href;
  41569. context.head.appendChild(base);
  41570. } else {
  41571. context = document;
  41572. }
  41573. }
  41574. parsed = rsingleTag.exec(data);
  41575. scripts = !keepScripts && [];
  41576. // Single tag
  41577. if (parsed) {
  41578. return [context.createElement(parsed[1])];
  41579. }
  41580. parsed = buildFragment([data], context, scripts);
  41581. if (scripts && scripts.length) {
  41582. jQuery(scripts).remove();
  41583. }
  41584. return jQuery.merge([], parsed.childNodes);
  41585. };
  41586. /**
  41587. * Load a url into a page
  41588. */
  41589. jQuery.fn.load = function (url, params, callback) {
  41590. var selector,
  41591. type,
  41592. response,
  41593. self = this,
  41594. off = url.indexOf(" ");
  41595. if (off > -1) {
  41596. selector = stripAndCollapse(url.slice(off));
  41597. url = url.slice(0, off);
  41598. }
  41599. // If it's a function
  41600. if (isFunction(params)) {
  41601. // We assume that it's the callback
  41602. callback = params;
  41603. params = undefined;
  41604. // Otherwise, build a param string
  41605. } else if (params && (typeof params === "undefined" ? "undefined" : _typeof(params)) === "object") {
  41606. type = "POST";
  41607. }
  41608. // If we have elements to modify, make the request
  41609. if (self.length > 0) {
  41610. jQuery.ajax({
  41611. url: url,
  41612. // If "type" variable is undefined, then "GET" method will be used.
  41613. // Make value of this field explicit since
  41614. // user can override it through ajaxSetup method
  41615. type: type || "GET",
  41616. dataType: "html",
  41617. data: params
  41618. }).done(function (responseText) {
  41619. // Save response for use in complete callback
  41620. response = arguments;
  41621. self.html(selector ?
  41622. // If a selector was specified, locate the right elements in a dummy div
  41623. // Exclude scripts to avoid IE 'Permission Denied' errors
  41624. jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) :
  41625. // Otherwise use the full result
  41626. responseText);
  41627. // If the request succeeds, this function gets "data", "status", "jqXHR"
  41628. // but they are ignored because response was set above.
  41629. // If it fails, this function gets "jqXHR", "status", "error"
  41630. }).always(callback && function (jqXHR, status) {
  41631. self.each(function () {
  41632. callback.apply(this, response || [jqXHR.responseText, status, jqXHR]);
  41633. });
  41634. });
  41635. }
  41636. return this;
  41637. };
  41638. // Attach a bunch of functions for handling common AJAX events
  41639. jQuery.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function (i, type) {
  41640. jQuery.fn[type] = function (fn) {
  41641. return this.on(type, fn);
  41642. };
  41643. });
  41644. jQuery.expr.pseudos.animated = function (elem) {
  41645. return jQuery.grep(jQuery.timers, function (fn) {
  41646. return elem === fn.elem;
  41647. }).length;
  41648. };
  41649. jQuery.offset = {
  41650. setOffset: function setOffset(elem, options, i) {
  41651. var curPosition,
  41652. curLeft,
  41653. curCSSTop,
  41654. curTop,
  41655. curOffset,
  41656. curCSSLeft,
  41657. calculatePosition,
  41658. position = jQuery.css(elem, "position"),
  41659. curElem = jQuery(elem),
  41660. props = {};
  41661. // Set position first, in-case top/left are set even on static elem
  41662. if (position === "static") {
  41663. elem.style.position = "relative";
  41664. }
  41665. curOffset = curElem.offset();
  41666. curCSSTop = jQuery.css(elem, "top");
  41667. curCSSLeft = jQuery.css(elem, "left");
  41668. calculatePosition = (position === "absolute" || position === "fixed") && (curCSSTop + curCSSLeft).indexOf("auto") > -1;
  41669. // Need to be able to calculate position if either
  41670. // top or left is auto and position is either absolute or fixed
  41671. if (calculatePosition) {
  41672. curPosition = curElem.position();
  41673. curTop = curPosition.top;
  41674. curLeft = curPosition.left;
  41675. } else {
  41676. curTop = parseFloat(curCSSTop) || 0;
  41677. curLeft = parseFloat(curCSSLeft) || 0;
  41678. }
  41679. if (isFunction(options)) {
  41680. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  41681. options = options.call(elem, i, jQuery.extend({}, curOffset));
  41682. }
  41683. if (options.top != null) {
  41684. props.top = options.top - curOffset.top + curTop;
  41685. }
  41686. if (options.left != null) {
  41687. props.left = options.left - curOffset.left + curLeft;
  41688. }
  41689. if ("using" in options) {
  41690. options.using.call(elem, props);
  41691. } else {
  41692. curElem.css(props);
  41693. }
  41694. }
  41695. };
  41696. jQuery.fn.extend({
  41697. // offset() relates an element's border box to the document origin
  41698. offset: function offset(options) {
  41699. // Preserve chaining for setter
  41700. if (arguments.length) {
  41701. return options === undefined ? this : this.each(function (i) {
  41702. jQuery.offset.setOffset(this, options, i);
  41703. });
  41704. }
  41705. var rect,
  41706. win,
  41707. elem = this[0];
  41708. if (!elem) {
  41709. return;
  41710. }
  41711. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  41712. // Support: IE <=11 only
  41713. // Running getBoundingClientRect on a
  41714. // disconnected node in IE throws an error
  41715. if (!elem.getClientRects().length) {
  41716. return { top: 0, left: 0 };
  41717. }
  41718. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  41719. rect = elem.getBoundingClientRect();
  41720. win = elem.ownerDocument.defaultView;
  41721. return {
  41722. top: rect.top + win.pageYOffset,
  41723. left: rect.left + win.pageXOffset
  41724. };
  41725. },
  41726. // position() relates an element's margin box to its offset parent's padding box
  41727. // This corresponds to the behavior of CSS absolute positioning
  41728. position: function position() {
  41729. if (!this[0]) {
  41730. return;
  41731. }
  41732. var offsetParent,
  41733. offset,
  41734. doc,
  41735. elem = this[0],
  41736. parentOffset = { top: 0, left: 0 };
  41737. // position:fixed elements are offset from the viewport, which itself always has zero offset
  41738. if (jQuery.css(elem, "position") === "fixed") {
  41739. // Assume position:fixed implies availability of getBoundingClientRect
  41740. offset = elem.getBoundingClientRect();
  41741. } else {
  41742. offset = this.offset();
  41743. // Account for the *real* offset parent, which can be the document or its root element
  41744. // when a statically positioned element is identified
  41745. doc = elem.ownerDocument;
  41746. offsetParent = elem.offsetParent || doc.documentElement;
  41747. while (offsetParent && (offsetParent === doc.body || offsetParent === doc.documentElement) && jQuery.css(offsetParent, "position") === "static") {
  41748. offsetParent = offsetParent.parentNode;
  41749. }
  41750. if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {
  41751. // Incorporate borders into its offset, since they are outside its content origin
  41752. parentOffset = jQuery(offsetParent).offset();
  41753. parentOffset.top += jQuery.css(offsetParent, "borderTopWidth", true);
  41754. parentOffset.left += jQuery.css(offsetParent, "borderLeftWidth", true);
  41755. }
  41756. }
  41757. // Subtract parent offsets and element margins
  41758. return {
  41759. top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
  41760. left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
  41761. };
  41762. },
  41763. // This method will return documentElement in the following cases:
  41764. // 1) For the element inside the iframe without offsetParent, this method will return
  41765. // documentElement of the parent window
  41766. // 2) For the hidden or detached element
  41767. // 3) For body or html element, i.e. in case of the html node - it will return itself
  41768. //
  41769. // but those exceptions were never presented as a real life use-cases
  41770. // and might be considered as more preferable results.
  41771. //
  41772. // This logic, however, is not guaranteed and can change at any point in the future
  41773. offsetParent: function offsetParent() {
  41774. return this.map(function () {
  41775. var offsetParent = this.offsetParent;
  41776. while (offsetParent && jQuery.css(offsetParent, "position") === "static") {
  41777. offsetParent = offsetParent.offsetParent;
  41778. }
  41779. return offsetParent || documentElement;
  41780. });
  41781. }
  41782. });
  41783. // Create scrollLeft and scrollTop methods
  41784. jQuery.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function (method, prop) {
  41785. var top = "pageYOffset" === prop;
  41786. jQuery.fn[method] = function (val) {
  41787. return access(this, function (elem, method, val) {
  41788. // Coalesce documents and windows
  41789. var win;
  41790. if (isWindow(elem)) {
  41791. win = elem;
  41792. } else if (elem.nodeType === 9) {
  41793. win = elem.defaultView;
  41794. }
  41795. if (val === undefined) {
  41796. return win ? win[prop] : elem[method];
  41797. }
  41798. if (win) {
  41799. win.scrollTo(!top ? val : win.pageXOffset, top ? val : win.pageYOffset);
  41800. } else {
  41801. elem[method] = val;
  41802. }
  41803. }, method, val, arguments.length);
  41804. };
  41805. });
  41806. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  41807. // Add the top/left cssHooks using jQuery.fn.position
  41808. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  41809. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  41810. // getComputedStyle returns percent when specified for top/left/bottom/right;
  41811. // rather than make the css module depend on the offset module, just check for it here
  41812. jQuery.each(["top", "left"], function (i, prop) {
  41813. jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition, function (elem, computed) {
  41814. if (computed) {
  41815. computed = curCSS(elem, prop);
  41816. // If curCSS returns percentage, fallback to offset
  41817. return rnumnonpx.test(computed) ? jQuery(elem).position()[prop] + "px" : computed;
  41818. }
  41819. });
  41820. });
  41821. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  41822. jQuery.each({ Height: "height", Width: "width" }, function (name, type) {
  41823. jQuery.each({ padding: "inner" + name, content: type, "": "outer" + name }, function (defaultExtra, funcName) {
  41824. // Margin is only for outerHeight, outerWidth
  41825. jQuery.fn[funcName] = function (margin, value) {
  41826. var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"),
  41827. extra = defaultExtra || (margin === true || value === true ? "margin" : "border");
  41828. return access(this, function (elem, type, value) {
  41829. var doc;
  41830. if (isWindow(elem)) {
  41831. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  41832. return funcName.indexOf("outer") === 0 ? elem["inner" + name] : elem.document.documentElement["client" + name];
  41833. }
  41834. // Get document width or height
  41835. if (elem.nodeType === 9) {
  41836. doc = elem.documentElement;
  41837. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  41838. // whichever is greatest
  41839. return Math.max(elem.body["scroll" + name], doc["scroll" + name], elem.body["offset" + name], doc["offset" + name], doc["client" + name]);
  41840. }
  41841. return value === undefined ?
  41842. // Get width or height on the element, requesting but not forcing parseFloat
  41843. jQuery.css(elem, type, extra) :
  41844. // Set width or height on the element
  41845. jQuery.style(elem, type, value, extra);
  41846. }, type, chainable ? margin : undefined, chainable);
  41847. };
  41848. });
  41849. });
  41850. jQuery.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 (i, name) {
  41851. // Handle event binding
  41852. jQuery.fn[name] = function (data, fn) {
  41853. return arguments.length > 0 ? this.on(name, null, data, fn) : this.trigger(name);
  41854. };
  41855. });
  41856. jQuery.fn.extend({
  41857. hover: function hover(fnOver, fnOut) {
  41858. return this.mouseenter(fnOver).mouseleave(fnOut || fnOver);
  41859. }
  41860. });
  41861. jQuery.fn.extend({
  41862. bind: function bind(types, data, fn) {
  41863. return this.on(types, null, data, fn);
  41864. },
  41865. unbind: function unbind(types, fn) {
  41866. return this.off(types, null, fn);
  41867. },
  41868. delegate: function delegate(selector, types, data, fn) {
  41869. return this.on(types, selector, data, fn);
  41870. },
  41871. undelegate: function undelegate(selector, types, fn) {
  41872. // ( namespace ) or ( selector, types [, fn] )
  41873. return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn);
  41874. }
  41875. });
  41876. // Bind a function to a context, optionally partially applying any
  41877. // arguments.
  41878. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  41879. // However, it is not slated for removal any time soon
  41880. jQuery.proxy = function (fn, context) {
  41881. var tmp, args, proxy;
  41882. if (typeof context === "string") {
  41883. tmp = fn[context];
  41884. context = fn;
  41885. fn = tmp;
  41886. }
  41887. // Quick check to determine if target is callable, in the spec
  41888. // this throws a TypeError, but we will just return undefined.
  41889. if (!isFunction(fn)) {
  41890. return undefined;
  41891. }
  41892. // Simulated bind
  41893. args = _slice.call(arguments, 2);
  41894. proxy = function proxy() {
  41895. return fn.apply(context || this, args.concat(_slice.call(arguments)));
  41896. };
  41897. // Set the guid of unique handler to the same of original handler, so it can be removed
  41898. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  41899. return proxy;
  41900. };
  41901. jQuery.holdReady = function (hold) {
  41902. if (hold) {
  41903. jQuery.readyWait++;
  41904. } else {
  41905. jQuery.ready(true);
  41906. }
  41907. };
  41908. jQuery.isArray = Array.isArray;
  41909. jQuery.parseJSON = JSON.parse;
  41910. jQuery.nodeName = nodeName;
  41911. jQuery.isFunction = isFunction;
  41912. jQuery.isWindow = isWindow;
  41913. jQuery.camelCase = camelCase;
  41914. jQuery.type = toType;
  41915. jQuery.now = Date.now;
  41916. jQuery.isNumeric = function (obj) {
  41917. // As of jQuery 3.0, isNumeric is limited to
  41918. // strings and numbers (primitives or objects)
  41919. // that can be coerced to finite numbers (gh-2662)
  41920. var type = jQuery.type(obj);
  41921. return (type === "number" || type === "string") &&
  41922. // parseFloat NaNs numeric-cast false positives ("")
  41923. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  41924. // subtraction forces infinities to NaN
  41925. !isNaN(obj - parseFloat(obj));
  41926. };
  41927. // Register as a named AMD module, since jQuery can be concatenated with other
  41928. // files that may use define, but not via a proper concatenation script that
  41929. // understands anonymous AMD modules. A named AMD is safest and most robust
  41930. // way to register. Lowercase jquery is used because AMD module names are
  41931. // derived from file names, and jQuery is normally delivered in a lowercase
  41932. // file name. Do this after creating the global so that if an AMD module wants
  41933. // to call noConflict to hide this version of jQuery, it will work.
  41934. // Note that for maximum portability, libraries that are not jQuery should
  41935. // declare themselves as anonymous modules, and avoid setting a global if an
  41936. // AMD loader is present. jQuery is a special case. For more information, see
  41937. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  41938. if (true) {
  41939. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  41940. return jQuery;
  41941. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  41942. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  41943. }
  41944. var
  41945. // Map over jQuery in case of overwrite
  41946. _jQuery = window.jQuery,
  41947. // Map over the $ in case of overwrite
  41948. _$ = window.$;
  41949. jQuery.noConflict = function (deep) {
  41950. if (window.$ === jQuery) {
  41951. window.$ = _$;
  41952. }
  41953. if (deep && window.jQuery === jQuery) {
  41954. window.jQuery = _jQuery;
  41955. }
  41956. return jQuery;
  41957. };
  41958. // Expose jQuery and $ identifiers, even in AMD
  41959. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  41960. // and CommonJS for browser emulators (#13566)
  41961. if (!noGlobal) {
  41962. window.jQuery = window.$ = jQuery;
  41963. }
  41964. return jQuery;
  41965. });
  41966. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
  41967. /***/ }),
  41968. /***/ "./node_modules/line-i18n/dist/LanguageService.js":
  41969. /*!********************************************************!*\
  41970. !*** ./node_modules/line-i18n/dist/LanguageService.js ***!
  41971. \********************************************************/
  41972. /*! no static exports found */
  41973. /***/ (function(module, exports, __webpack_require__) {
  41974. "use strict";
  41975. Object.defineProperty(exports, "__esModule", {
  41976. value: true
  41977. });
  41978. var LanguageService = /** @class */function () {
  41979. function LanguageService(lsKey, defaultLang) {
  41980. if (defaultLang === void 0) {
  41981. defaultLang = 'pt';
  41982. }
  41983. this.lsKey = lsKey;
  41984. this.defaultLang = defaultLang;
  41985. this.listeners = [];
  41986. this.document = document;
  41987. this.setupListener();
  41988. }
  41989. LanguageService.prototype.setupListener = function () {
  41990. var _this = this;
  41991. if (this.document !== null) {
  41992. this.document.addEventListener("storage", function (event) {
  41993. var e = event;
  41994. if (e.key === _this.lsKey) {
  41995. _this.listeners.forEach(function (l) {
  41996. return l();
  41997. });
  41998. }
  41999. });
  42000. }
  42001. };
  42002. LanguageService.prototype.getLang = function () {
  42003. var lang;
  42004. try { localStorage.getItem(this.lsKey); }
  42005. catch (error) {
  42006. //DEBUG alert('./ivprogh/build/ivprog.bundle.js: LanguageService.prototype.getLang(): error ' + error);
  42007. //TODO rever aqui, pois ao carregar iVProg esse metodo esta sendo chamado MUITAS vezes!
  42008. return "pt"; //TODO "pt_BR" "en_US"
  42009. }
  42010. if (lang === null || lang === undefined) {
  42011. console.warn("Internal Error: User language information has not been set. Returning default...");
  42012. return this.getDefaultLang();
  42013. }
  42014. return lang;
  42015. };
  42016. LanguageService.prototype.getDefaultLang = function () {
  42017. return this.defaultLang;
  42018. };
  42019. LanguageService.prototype.registerLanguageChangeListener = function (listener) {
  42020. this.listeners.push(listener);
  42021. };
  42022. return LanguageService;
  42023. }();
  42024. exports.LanguageService = LanguageService;
  42025. /***/ }),
  42026. /***/ "./node_modules/line-i18n/dist/LocalizedStrings.js":
  42027. /*!*********************************************************!*\
  42028. !*** ./node_modules/line-i18n/dist/LocalizedStrings.js ***!
  42029. \*********************************************************/
  42030. /*! no static exports found */
  42031. /***/ (function(module, exports, __webpack_require__) {
  42032. "use strict";
  42033. Object.defineProperty(exports, "__esModule", {
  42034. value: true
  42035. });
  42036. exports.LocalizedStrings = undefined;
  42037. var _StringTypes = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  42038. var LocalizedStrings = /** @class */function () {
  42039. function LocalizedStrings(service, i18nData, listenToChange) {
  42040. if (listenToChange === void 0) {
  42041. listenToChange = false;
  42042. }
  42043. var _this = this;
  42044. this.service = service;
  42045. this.i18nData = i18nData;
  42046. this.listenToChange = listenToChange;
  42047. this.document = document;
  42048. if (this.listenToChange) {
  42049. service.registerLanguageChangeListener(function () {
  42050. _this.updateTagText();
  42051. });
  42052. }
  42053. }
  42054. LocalizedStrings.prototype.getString = function (id, type) {
  42055. var i18nObj = this.i18nData[this.service.getLang()];
  42056. if (!!!i18nObj) {
  42057. console.warn("Internal Error. The language set at ivprog.lang is not valid: " + this.service.getLang());
  42058. i18nObj = this.i18nData[this.service.getDefaultLang()];
  42059. }
  42060. if (!!!i18nObj[type]) {
  42061. return "{MISSING_I18N_TYPE_IDENTIFIER}";
  42062. } else if (!!!i18nObj[type][id]) {
  42063. return "{MISSING_I18N_IDENTIFIER}";
  42064. } else {
  42065. return i18nObj[type][id];
  42066. }
  42067. };
  42068. LocalizedStrings.prototype.getOR = function () {
  42069. return this.getUI('join_or');
  42070. };
  42071. LocalizedStrings.prototype.getError = function (id, context) {
  42072. if (context === void 0) {
  42073. context = [];
  42074. }
  42075. var text = this.getString(id, _StringTypes.StringTypes.ERROR);
  42076. return this.processString(text, context);
  42077. };
  42078. LocalizedStrings.prototype.getMessage = function (id, context) {
  42079. if (context === void 0) {
  42080. context = [];
  42081. }
  42082. var text = this.getString(id, _StringTypes.StringTypes.MESSAGE);
  42083. return this.processString(text, context);
  42084. };
  42085. LocalizedStrings.prototype.getUI = function (id, context) {
  42086. if (context === void 0) {
  42087. context = [];
  42088. }
  42089. var text = this.getString(id, _StringTypes.StringTypes.UI);
  42090. return this.processString(text, context);
  42091. };
  42092. LocalizedStrings.prototype.processString = function (text, context) {
  42093. for (var i = 0; i < context.length; i++) {
  42094. var v = context[i];
  42095. text = text.replace('\$' + i, v);
  42096. }
  42097. return text;
  42098. };
  42099. LocalizedStrings.prototype.updateTagText = function (func) {
  42100. var _this = this;
  42101. if (func === void 0) {
  42102. func = null;
  42103. }
  42104. if (this.document !== null) {
  42105. var list = this.document.querySelectorAll("data.i18n");
  42106. list.forEach(function (node) {
  42107. if (func === null) {
  42108. node.innerHTML = _this.processTagTex(node.getAttribute("value"));
  42109. } else {
  42110. node.innerHTML = func(node.getAttribute("value"));
  42111. }
  42112. });
  42113. }
  42114. };
  42115. LocalizedStrings.prototype.processTagTex = function (text) {
  42116. if (text === null) {
  42117. return "<Invalid i18n identifier>";
  42118. }
  42119. var opts = text.split(':');
  42120. var type = opts[0].toLowerCase();
  42121. var id = opts[1];
  42122. if (_StringTypes.StringTypes.ERROR === type) {
  42123. return this.getError(id);
  42124. } else if (_StringTypes.StringTypes.MESSAGE === type) {
  42125. return this.getMessage(id);
  42126. } else if (_StringTypes.StringTypes.UI === type) {
  42127. return this.getUI(id);
  42128. } else {
  42129. console.warn(" A string has been passed to the i18n helper function that was not in the form type:id -> " + text);
  42130. return this.getString(id, type);
  42131. }
  42132. };
  42133. return LocalizedStrings;
  42134. }();
  42135. exports.LocalizedStrings = LocalizedStrings;
  42136. /***/ }),
  42137. /***/ "./node_modules/line-i18n/dist/StringTypes.js":
  42138. /*!****************************************************!*\
  42139. !*** ./node_modules/line-i18n/dist/StringTypes.js ***!
  42140. \****************************************************/
  42141. /*! no static exports found */
  42142. /***/ (function(module, exports, __webpack_require__) {
  42143. "use strict";
  42144. Object.defineProperty(exports, "__esModule", {
  42145. value: true
  42146. });
  42147. var StringTypes = exports.StringTypes = undefined;
  42148. (function (StringTypes) {
  42149. StringTypes["ERROR"] = "error";
  42150. StringTypes["MESSAGE"] = "message";
  42151. StringTypes["UI"] = "ui";
  42152. })(StringTypes || (exports.StringTypes = StringTypes = {}));
  42153. /***/ }),
  42154. /***/ "./node_modules/line-i18n/dist/index.js":
  42155. /*!**********************************************!*\
  42156. !*** ./node_modules/line-i18n/dist/index.js ***!
  42157. \**********************************************/
  42158. /*! no static exports found */
  42159. /***/ (function(module, exports, __webpack_require__) {
  42160. "use strict";
  42161. Object.defineProperty(exports, "__esModule", {
  42162. value: true
  42163. });
  42164. var _LanguageService = __webpack_require__(/*! ./LanguageService */ "./node_modules/line-i18n/dist/LanguageService.js");
  42165. var _LocalizedStrings = __webpack_require__(/*! ./LocalizedStrings */ "./node_modules/line-i18n/dist/LocalizedStrings.js");
  42166. var _StringTypes = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  42167. exports.default = {
  42168. LanguageService: _LanguageService.LanguageService,
  42169. LocalizedStrings: _LocalizedStrings.LocalizedStrings,
  42170. StringTypes: _StringTypes.StringTypes
  42171. };
  42172. /***/ }),
  42173. /***/ "./node_modules/melanke-watchjs/src/watch.js":
  42174. /*!***************************************************!*\
  42175. !*** ./node_modules/melanke-watchjs/src/watch.js ***!
  42176. \***************************************************/
  42177. /*! no static exports found */
  42178. /***/ (function(module, exports, __webpack_require__) {
  42179. "use strict";
  42180. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
  42181. * DEVELOPED BY
  42182. * GIL LOPES BUENO
  42183. * gilbueno.mail@gmail.com
  42184. *
  42185. * WORKS WITH:
  42186. * IE8*, IE 9+, FF 4+, SF 5+, WebKit, CH 7+, OP 12+, BESEN, Rhino 1.7+
  42187. * For IE8 (and other legacy browsers) WatchJS will use dirty checking
  42188. *
  42189. * FORK:
  42190. * https://github.com/melanke/Watch.JS
  42191. *
  42192. * LICENSE: MIT
  42193. */
  42194. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  42195. (function (factory) {
  42196. if (( false ? undefined : _typeof(exports)) === 'object') {
  42197. // Node. Does not work with strict CommonJS, but
  42198. // only CommonJS-like enviroments that support module.exports,
  42199. // like Node.
  42200. module.exports = factory();
  42201. } else if (true) {
  42202. // AMD. Register as an anonymous module.
  42203. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  42204. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  42205. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  42206. __WEBPACK_AMD_DEFINE_FACTORY__),
  42207. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  42208. } else {}
  42209. })(function () {
  42210. var WatchJS = {
  42211. noMore: false, // use WatchJS.suspend(obj) instead
  42212. useDirtyCheck: false, // use only dirty checking to track changes.
  42213. preserveExistingSetters: false
  42214. },
  42215. lengthsubjects = [];
  42216. var dirtyChecklist = [];
  42217. var pendingChanges = []; // used coalesce changes from defineProperty and __defineSetter__
  42218. var supportDefineProperty = false;
  42219. try {
  42220. supportDefineProperty = Object.defineProperty && Object.defineProperty({}, 'x', {});
  42221. } catch (ex) {/* not supported */}
  42222. var isFunction = function isFunction(functionToCheck) {
  42223. var getType = {};
  42224. return functionToCheck && getType.toString.call(functionToCheck) == '[object Function]';
  42225. };
  42226. var isInt = function isInt(x) {
  42227. return x % 1 === 0;
  42228. };
  42229. var isArray = function isArray(obj) {
  42230. return Object.prototype.toString.call(obj) === '[object Array]';
  42231. };
  42232. var isObject = function isObject(obj) {
  42233. return {}.toString.apply(obj) === '[object Object]';
  42234. };
  42235. var getObjDiff = function getObjDiff(a, b) {
  42236. var aplus = [],
  42237. bplus = [];
  42238. if (!(typeof a == "string") && !(typeof b == "string")) {
  42239. if (isArray(a) && b) {
  42240. for (var i = 0; i < a.length; i++) {
  42241. if (b[i] === undefined) aplus.push(i);
  42242. }
  42243. } else {
  42244. for (var i in a) {
  42245. if (a.hasOwnProperty(i)) {
  42246. if (b && !b.hasOwnProperty(i)) {
  42247. aplus.push(i);
  42248. }
  42249. }
  42250. }
  42251. }
  42252. if (isArray(b) && a) {
  42253. for (var j = 0; j < b.length; j++) {
  42254. if (a[j] === undefined) bplus.push(j);
  42255. }
  42256. } else {
  42257. for (var j in b) {
  42258. if (b.hasOwnProperty(j)) {
  42259. if (a && !a.hasOwnProperty(j)) {
  42260. bplus.push(j);
  42261. }
  42262. }
  42263. }
  42264. }
  42265. }
  42266. return {
  42267. added: aplus,
  42268. removed: bplus
  42269. };
  42270. };
  42271. var clone = function clone(obj) {
  42272. if (null == obj || "object" != (typeof obj === 'undefined' ? 'undefined' : _typeof(obj))) {
  42273. return obj;
  42274. }
  42275. var copy = obj.constructor();
  42276. for (var attr in obj) {
  42277. copy[attr] = obj[attr];
  42278. }
  42279. return copy;
  42280. };
  42281. var getExistingSetter = function getExistingSetter(obj, propName) {
  42282. if (WatchJS.preserveExistingSetters) {
  42283. var existing = Object.getOwnPropertyDescriptor(obj, propName);
  42284. return existing.set;
  42285. }
  42286. return undefined;
  42287. };
  42288. var defineGetAndSet = function defineGetAndSet(obj, propName, getter, setter) {
  42289. try {
  42290. var existingSetter = getExistingSetter(obj, propName);
  42291. Object.defineProperty(obj, propName, {
  42292. get: getter,
  42293. set: function set(value) {
  42294. setter.call(this, value, true); // coalesce changes
  42295. if (existingSetter) {
  42296. existingSetter(value);
  42297. }
  42298. },
  42299. enumerable: true,
  42300. configurable: true
  42301. });
  42302. } catch (e1) {
  42303. try {
  42304. Object.prototype.__defineGetter__.call(obj, propName, getter);
  42305. Object.prototype.__defineSetter__.call(obj, propName, function (value) {
  42306. setter.call(this, value, true); // coalesce changes
  42307. });
  42308. } catch (e2) {
  42309. observeDirtyChanges(obj, propName, setter);
  42310. //throw new Error("watchJS error: browser not supported :/")
  42311. }
  42312. }
  42313. };
  42314. var defineProp = function defineProp(obj, propName, value) {
  42315. try {
  42316. Object.defineProperty(obj, propName, {
  42317. enumerable: false,
  42318. configurable: true,
  42319. writable: false,
  42320. value: value
  42321. });
  42322. } catch (error) {
  42323. obj[propName] = value;
  42324. }
  42325. };
  42326. var observeDirtyChanges = function observeDirtyChanges(obj, propName, setter) {
  42327. dirtyChecklist[dirtyChecklist.length] = {
  42328. prop: propName,
  42329. object: obj,
  42330. orig: clone(obj[propName]),
  42331. callback: setter
  42332. };
  42333. };
  42334. var watch = function watch() {
  42335. if (isFunction(arguments[1])) {
  42336. watchAll.apply(this, arguments);
  42337. } else if (isArray(arguments[1])) {
  42338. watchMany.apply(this, arguments);
  42339. } else {
  42340. watchOne.apply(this, arguments);
  42341. }
  42342. };
  42343. var watchAll = function watchAll(obj, watcher, level, addNRemove) {
  42344. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  42345. //accepts only objects and array (not string)
  42346. return;
  42347. }
  42348. if (isArray(obj)) {
  42349. defineWatcher(obj, "__watchall__", watcher, level); // watch all changes on the array
  42350. if (level === undefined || level > 0) {
  42351. for (var prop = 0; prop < obj.length; prop++) {
  42352. // watch objects in array
  42353. watchAll(obj[prop], watcher, level, addNRemove);
  42354. }
  42355. }
  42356. } else {
  42357. var prop,
  42358. props = [];
  42359. for (prop in obj) {
  42360. //for each attribute if obj is an object
  42361. if (prop == "$val" || !supportDefineProperty && prop === 'watchers') {
  42362. continue;
  42363. }
  42364. if (Object.prototype.hasOwnProperty.call(obj, prop)) {
  42365. props.push(prop); //put in the props
  42366. }
  42367. }
  42368. watchMany(obj, props, watcher, level, addNRemove); //watch all items of the props
  42369. }
  42370. if (addNRemove) {
  42371. pushToLengthSubjects(obj, "$$watchlengthsubjectroot", watcher, level);
  42372. }
  42373. };
  42374. var watchMany = function watchMany(obj, props, watcher, level, addNRemove) {
  42375. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  42376. //accepts only objects and array (not string)
  42377. return;
  42378. }
  42379. for (var i = 0; i < props.length; i++) {
  42380. //watch each property
  42381. var prop = props[i];
  42382. watchOne(obj, prop, watcher, level, addNRemove);
  42383. }
  42384. };
  42385. var watchOne = function watchOne(obj, prop, watcher, level, addNRemove) {
  42386. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  42387. //accepts only objects and array (not string)
  42388. return;
  42389. }
  42390. if (isFunction(obj[prop])) {
  42391. //dont watch if it is a function
  42392. return;
  42393. }
  42394. if (obj[prop] != null && (level === undefined || level > 0)) {
  42395. watchAll(obj[prop], watcher, level !== undefined ? level - 1 : level); //recursively watch all attributes of this
  42396. }
  42397. defineWatcher(obj, prop, watcher, level);
  42398. if (addNRemove && (level === undefined || level > 0)) {
  42399. pushToLengthSubjects(obj, prop, watcher, level);
  42400. }
  42401. };
  42402. var unwatch = function unwatch() {
  42403. if (isFunction(arguments[1])) {
  42404. unwatchAll.apply(this, arguments);
  42405. } else if (isArray(arguments[1])) {
  42406. unwatchMany.apply(this, arguments);
  42407. } else {
  42408. unwatchOne.apply(this, arguments);
  42409. }
  42410. };
  42411. var unwatchAll = function unwatchAll(obj, watcher) {
  42412. if (obj instanceof String || !(obj instanceof Object) && !isArray(obj)) {
  42413. //accepts only objects and array (not string)
  42414. return;
  42415. }
  42416. if (isArray(obj)) {
  42417. var props = ['__watchall__'];
  42418. for (var prop = 0; prop < obj.length; prop++) {
  42419. //for each item if obj is an array
  42420. props.push(prop); //put in the props
  42421. }
  42422. unwatchMany(obj, props, watcher); //watch all itens of the props
  42423. } else {
  42424. var unwatchPropsInObject = function unwatchPropsInObject(obj2) {
  42425. var props = [];
  42426. for (var prop2 in obj2) {
  42427. //for each attribute if obj is an object
  42428. if (obj2.hasOwnProperty(prop2)) {
  42429. if (obj2[prop2] instanceof Object) {
  42430. unwatchPropsInObject(obj2[prop2]); //recurs into object props
  42431. } else {
  42432. props.push(prop2); //put in the props
  42433. }
  42434. }
  42435. }
  42436. unwatchMany(obj2, props, watcher); //unwatch all of the props
  42437. };
  42438. unwatchPropsInObject(obj);
  42439. }
  42440. };
  42441. var unwatchMany = function unwatchMany(obj, props, watcher) {
  42442. for (var prop2 in props) {
  42443. //watch each attribute of "props" if is an object
  42444. if (props.hasOwnProperty(prop2)) {
  42445. unwatchOne(obj, props[prop2], watcher);
  42446. }
  42447. }
  42448. };
  42449. var timeouts = [],
  42450. timerID = null;
  42451. function clearTimerID() {
  42452. timerID = null;
  42453. for (var i = 0; i < timeouts.length; i++) {
  42454. timeouts[i]();
  42455. }
  42456. timeouts.length = 0;
  42457. }
  42458. var getTimerID = function getTimerID() {
  42459. if (!timerID) {
  42460. timerID = setTimeout(clearTimerID);
  42461. }
  42462. return timerID;
  42463. };
  42464. var registerTimeout = function registerTimeout(fn) {
  42465. // register function to be called on timeout
  42466. if (timerID == null) getTimerID();
  42467. timeouts[timeouts.length] = fn;
  42468. };
  42469. // Track changes made to an array, object or an object's property
  42470. // and invoke callback with a single change object containing type, value, oldvalue and array splices
  42471. // Syntax:
  42472. // trackChange(obj, callback, recursive, addNRemove)
  42473. // trackChange(obj, prop, callback, recursive, addNRemove)
  42474. var trackChange = function trackChange() {
  42475. var fn = isFunction(arguments[2]) ? trackProperty : trackObject;
  42476. fn.apply(this, arguments);
  42477. };
  42478. // track changes made to an object and invoke callback with a single change object containing type, value and array splices
  42479. var trackObject = function trackObject(obj, callback, recursive, addNRemove) {
  42480. var change = null,
  42481. lastTimerID = -1;
  42482. var isArr = isArray(obj);
  42483. var level,
  42484. fn = function fn(prop, action, newValue, oldValue) {
  42485. var timerID = getTimerID();
  42486. if (lastTimerID !== timerID) {
  42487. // check if timer has changed since last update
  42488. lastTimerID = timerID;
  42489. change = {
  42490. type: 'update'
  42491. };
  42492. change['value'] = obj;
  42493. change['splices'] = null;
  42494. registerTimeout(function () {
  42495. callback.call(this, change);
  42496. change = null;
  42497. });
  42498. }
  42499. // create splices for array changes
  42500. if (isArr && obj === this && change !== null) {
  42501. if (action === 'pop' || action === 'shift') {
  42502. newValue = [];
  42503. oldValue = [oldValue];
  42504. } else if (action === 'push' || action === 'unshift') {
  42505. newValue = [newValue];
  42506. oldValue = [];
  42507. } else if (action !== 'splice') {
  42508. return; // return here - for reverse and sort operations we don't need to return splices. a simple update will do
  42509. }
  42510. if (!change.splices) change.splices = [];
  42511. change.splices[change.splices.length] = {
  42512. index: prop,
  42513. deleteCount: oldValue ? oldValue.length : 0,
  42514. addedCount: newValue ? newValue.length : 0,
  42515. added: newValue,
  42516. deleted: oldValue
  42517. };
  42518. }
  42519. };
  42520. level = recursive == true ? undefined : 0;
  42521. watchAll(obj, fn, level, addNRemove);
  42522. };
  42523. // track changes made to the property of an object and invoke callback with a single change object containing type, value, oldvalue and splices
  42524. var trackProperty = function trackProperty(obj, prop, callback, recursive, addNRemove) {
  42525. if (obj && prop) {
  42526. watchOne(obj, prop, function (prop, action, newvalue, oldvalue) {
  42527. var change = {
  42528. type: 'update'
  42529. };
  42530. change['value'] = newvalue;
  42531. change['oldvalue'] = oldvalue;
  42532. if (recursive && isObject(newvalue) || isArray(newvalue)) {
  42533. trackObject(newvalue, callback, recursive, addNRemove);
  42534. }
  42535. callback.call(this, change);
  42536. }, 0);
  42537. if (recursive && isObject(obj[prop]) || isArray(obj[prop])) {
  42538. trackObject(obj[prop], callback, recursive, addNRemove);
  42539. }
  42540. }
  42541. };
  42542. var defineWatcher = function defineWatcher(obj, prop, watcher, level) {
  42543. var newWatcher = false;
  42544. var isArr = isArray(obj);
  42545. if (!obj.watchers) {
  42546. defineProp(obj, "watchers", {});
  42547. if (isArr) {
  42548. // watch array functions
  42549. watchFunctions(obj, function (index, action, newValue, oldValue) {
  42550. addPendingChange(obj, index, action, newValue, oldValue);
  42551. if (level !== 0 && newValue && (isObject(newValue) || isArray(newValue))) {
  42552. var i,
  42553. n,
  42554. ln,
  42555. wAll,
  42556. watchList = obj.watchers[prop];
  42557. if (wAll = obj.watchers['__watchall__']) {
  42558. watchList = watchList ? watchList.concat(wAll) : wAll;
  42559. }
  42560. ln = watchList ? watchList.length : 0;
  42561. for (i = 0; i < ln; i++) {
  42562. if (action !== 'splice') {
  42563. watchAll(newValue, watchList[i], level === undefined ? level : level - 1);
  42564. } else {
  42565. // watch spliced values
  42566. for (n = 0; n < newValue.length; n++) {
  42567. watchAll(newValue[n], watchList[i], level === undefined ? level : level - 1);
  42568. }
  42569. }
  42570. }
  42571. }
  42572. });
  42573. }
  42574. }
  42575. if (!obj.watchers[prop]) {
  42576. obj.watchers[prop] = [];
  42577. if (!isArr) newWatcher = true;
  42578. }
  42579. for (var i = 0; i < obj.watchers[prop].length; i++) {
  42580. if (obj.watchers[prop][i] === watcher) {
  42581. return;
  42582. }
  42583. }
  42584. obj.watchers[prop].push(watcher); //add the new watcher to the watchers array
  42585. if (newWatcher) {
  42586. var val = obj[prop];
  42587. var getter = function getter() {
  42588. return val;
  42589. };
  42590. var setter = function setter(newval, delayWatcher) {
  42591. var oldval = val;
  42592. val = newval;
  42593. if (level !== 0 && obj[prop] && (isObject(obj[prop]) || isArray(obj[prop])) && !obj[prop].watchers) {
  42594. // watch sub properties
  42595. var i,
  42596. ln = obj.watchers[prop].length;
  42597. for (i = 0; i < ln; i++) {
  42598. watchAll(obj[prop], obj.watchers[prop][i], level === undefined ? level : level - 1);
  42599. }
  42600. }
  42601. //watchFunctions(obj, prop);
  42602. if (isSuspended(obj, prop)) {
  42603. resume(obj, prop);
  42604. return;
  42605. }
  42606. if (!WatchJS.noMore) {
  42607. // this does not work with Object.observe
  42608. //if (JSON.stringify(oldval) !== JSON.stringify(newval)) {
  42609. if (oldval !== newval) {
  42610. if (!delayWatcher) {
  42611. callWatchers(obj, prop, "set", newval, oldval);
  42612. } else {
  42613. addPendingChange(obj, prop, "set", newval, oldval);
  42614. }
  42615. WatchJS.noMore = false;
  42616. }
  42617. }
  42618. };
  42619. if (WatchJS.useDirtyCheck) {
  42620. observeDirtyChanges(obj, prop, setter);
  42621. } else {
  42622. defineGetAndSet(obj, prop, getter, setter);
  42623. }
  42624. }
  42625. };
  42626. var callWatchers = function callWatchers(obj, prop, action, newval, oldval) {
  42627. if (prop !== undefined) {
  42628. var ln,
  42629. wl,
  42630. watchList = obj.watchers[prop];
  42631. if (wl = obj.watchers['__watchall__']) {
  42632. watchList = watchList ? watchList.concat(wl) : wl;
  42633. }
  42634. ln = watchList ? watchList.length : 0;
  42635. for (var wr = 0; wr < ln; wr++) {
  42636. watchList[wr].call(obj, prop, action, newval, oldval);
  42637. }
  42638. } else {
  42639. for (var prop in obj) {
  42640. //call all
  42641. if (obj.hasOwnProperty(prop)) {
  42642. callWatchers(obj, prop, action, newval, oldval);
  42643. }
  42644. }
  42645. }
  42646. };
  42647. var methodNames = ['pop', 'push', 'reverse', 'shift', 'sort', 'slice', 'unshift', 'splice'];
  42648. var defineArrayMethodWatcher = function defineArrayMethodWatcher(obj, original, methodName, callback) {
  42649. defineProp(obj, methodName, function () {
  42650. var index = 0;
  42651. var i, newValue, oldValue, response;
  42652. // get values before splicing array
  42653. if (methodName === 'splice') {
  42654. var start = arguments[0];
  42655. var end = start + arguments[1];
  42656. oldValue = obj.slice(start, end);
  42657. newValue = [];
  42658. for (i = 2; i < arguments.length; i++) {
  42659. newValue[i - 2] = arguments[i];
  42660. }
  42661. index = start;
  42662. } else {
  42663. newValue = arguments.length > 0 ? arguments[0] : undefined;
  42664. }
  42665. response = original.apply(obj, arguments);
  42666. if (methodName !== 'slice') {
  42667. if (methodName === 'pop') {
  42668. oldValue = response;
  42669. index = obj.length;
  42670. } else if (methodName === 'push') {
  42671. index = obj.length - 1;
  42672. } else if (methodName === 'shift') {
  42673. oldValue = response;
  42674. } else if (methodName !== 'unshift' && newValue === undefined) {
  42675. newValue = response;
  42676. }
  42677. callback.call(obj, index, methodName, newValue, oldValue);
  42678. }
  42679. return response;
  42680. });
  42681. };
  42682. var watchFunctions = function watchFunctions(obj, callback) {
  42683. if (!isFunction(callback) || !obj || obj instanceof String || !isArray(obj)) {
  42684. return;
  42685. }
  42686. for (var i = methodNames.length, methodName; i--;) {
  42687. methodName = methodNames[i];
  42688. defineArrayMethodWatcher(obj, obj[methodName], methodName, callback);
  42689. }
  42690. };
  42691. var unwatchOne = function unwatchOne(obj, prop, watcher) {
  42692. if (prop) {
  42693. if (obj.watchers && obj.watchers[prop]) {
  42694. if (watcher === undefined) {
  42695. delete obj.watchers[prop]; // remove all property watchers
  42696. } else {
  42697. for (var i = 0; i < obj.watchers[prop].length; i++) {
  42698. var w = obj.watchers[prop][i];
  42699. if (w == watcher) {
  42700. obj.watchers[prop].splice(i, 1);
  42701. }
  42702. }
  42703. }
  42704. }
  42705. } else {
  42706. delete obj.watchers;
  42707. }
  42708. removeFromLengthSubjects(obj, prop, watcher);
  42709. removeFromDirtyChecklist(obj, prop);
  42710. };
  42711. // suspend watchers until next update cycle
  42712. var suspend = function suspend(obj, prop) {
  42713. if (obj.watchers) {
  42714. var name = '__wjs_suspend__' + (prop !== undefined ? prop : '');
  42715. obj.watchers[name] = true;
  42716. }
  42717. };
  42718. var isSuspended = function isSuspended(obj, prop) {
  42719. return obj.watchers && (obj.watchers['__wjs_suspend__'] || obj.watchers['__wjs_suspend__' + prop]);
  42720. };
  42721. // resumes preivously suspended watchers
  42722. var resume = function resume(obj, prop) {
  42723. registerTimeout(function () {
  42724. delete obj.watchers['__wjs_suspend__'];
  42725. delete obj.watchers['__wjs_suspend__' + prop];
  42726. });
  42727. };
  42728. var pendingTimerID = null;
  42729. var addPendingChange = function addPendingChange(obj, prop, mode, newval, oldval) {
  42730. pendingChanges[pendingChanges.length] = {
  42731. obj: obj,
  42732. prop: prop,
  42733. mode: mode,
  42734. newval: newval,
  42735. oldval: oldval
  42736. };
  42737. if (pendingTimerID === null) {
  42738. pendingTimerID = setTimeout(applyPendingChanges);
  42739. }
  42740. };
  42741. var applyPendingChanges = function applyPendingChanges() {
  42742. // apply pending changes
  42743. var change = null;
  42744. pendingTimerID = null;
  42745. for (var i = 0; i < pendingChanges.length; i++) {
  42746. change = pendingChanges[i];
  42747. callWatchers(change.obj, change.prop, change.mode, change.newval, change.oldval);
  42748. }
  42749. if (change) {
  42750. pendingChanges = [];
  42751. change = null;
  42752. }
  42753. };
  42754. var loop = function loop() {
  42755. // check for new or deleted props
  42756. for (var i = 0; i < lengthsubjects.length; i++) {
  42757. var subj = lengthsubjects[i];
  42758. if (subj.prop === "$$watchlengthsubjectroot") {
  42759. var difference = getObjDiff(subj.obj, subj.actual);
  42760. if (difference.added.length || difference.removed.length) {
  42761. if (difference.added.length) {
  42762. watchMany(subj.obj, difference.added, subj.watcher, subj.level - 1, true);
  42763. }
  42764. subj.watcher.call(subj.obj, "root", "differentattr", difference, subj.actual);
  42765. }
  42766. subj.actual = clone(subj.obj);
  42767. } else {
  42768. var difference = getObjDiff(subj.obj[subj.prop], subj.actual);
  42769. if (difference.added.length || difference.removed.length) {
  42770. if (difference.added.length) {
  42771. for (var j = 0; j < subj.obj.watchers[subj.prop].length; j++) {
  42772. watchMany(subj.obj[subj.prop], difference.added, subj.obj.watchers[subj.prop][j], subj.level - 1, true);
  42773. }
  42774. }
  42775. callWatchers(subj.obj, subj.prop, "differentattr", difference, subj.actual);
  42776. }
  42777. subj.actual = clone(subj.obj[subj.prop]);
  42778. }
  42779. }
  42780. // start dirty check
  42781. var n, value;
  42782. if (dirtyChecklist.length > 0) {
  42783. for (var i = 0; i < dirtyChecklist.length; i++) {
  42784. n = dirtyChecklist[i];
  42785. value = n.object[n.prop];
  42786. if (!compareValues(n.orig, value)) {
  42787. n.orig = clone(value);
  42788. n.callback(value);
  42789. }
  42790. }
  42791. }
  42792. };
  42793. var compareValues = function compareValues(a, b) {
  42794. var i,
  42795. state = true;
  42796. if (a !== b) {
  42797. if (isObject(a)) {
  42798. for (i in a) {
  42799. if (!supportDefineProperty && i === 'watchers') continue;
  42800. if (a[i] !== b[i]) {
  42801. state = false;
  42802. break;
  42803. };
  42804. }
  42805. } else {
  42806. state = false;
  42807. }
  42808. }
  42809. return state;
  42810. };
  42811. var pushToLengthSubjects = function pushToLengthSubjects(obj, prop, watcher, level) {
  42812. var actual;
  42813. if (prop === "$$watchlengthsubjectroot") {
  42814. actual = clone(obj);
  42815. } else {
  42816. actual = clone(obj[prop]);
  42817. }
  42818. lengthsubjects.push({
  42819. obj: obj,
  42820. prop: prop,
  42821. actual: actual,
  42822. watcher: watcher,
  42823. level: level
  42824. });
  42825. };
  42826. var removeFromLengthSubjects = function removeFromLengthSubjects(obj, prop, watcher) {
  42827. for (var i = 0; i < lengthsubjects.length; i++) {
  42828. var subj = lengthsubjects[i];
  42829. if (subj.obj == obj) {
  42830. if (!prop || subj.prop == prop) {
  42831. if (!watcher || subj.watcher == watcher) {
  42832. // if we splice off one item at position i
  42833. // we need to decrement i as the array is one item shorter
  42834. // so when we increment i in the loop statement we
  42835. // will land at the correct index.
  42836. // if it's not decremented, you won't delete all length subjects
  42837. lengthsubjects.splice(i--, 1);
  42838. }
  42839. }
  42840. }
  42841. }
  42842. };
  42843. var removeFromDirtyChecklist = function removeFromDirtyChecklist(obj, prop) {
  42844. var notInUse;
  42845. for (var i = 0; i < dirtyChecklist.length; i++) {
  42846. var n = dirtyChecklist[i];
  42847. var watchers = n.object.watchers;
  42848. notInUse = n.object == obj && (!prop || n.prop == prop) && watchers && (!prop || !watchers[prop] || watchers[prop].length == 0);
  42849. if (notInUse) {
  42850. // we use the same syntax as in removeFromLengthSubjects
  42851. dirtyChecklist.splice(i--, 1);
  42852. }
  42853. }
  42854. };
  42855. setInterval(loop, 50);
  42856. WatchJS.watch = watch;
  42857. WatchJS.unwatch = unwatch;
  42858. WatchJS.callWatchers = callWatchers;
  42859. WatchJS.suspend = suspend; // suspend watchers
  42860. WatchJS.onChange = trackChange; // track changes made to object or it's property and return a single change object
  42861. return WatchJS;
  42862. });
  42863. /***/ }),
  42864. /***/ "./node_modules/node-libs-browser/mock/empty.js":
  42865. /*!******************************************************!*\
  42866. !*** ./node_modules/node-libs-browser/mock/empty.js ***!
  42867. \******************************************************/
  42868. /*! no static exports found */
  42869. /***/ (function(module, exports, __webpack_require__) {
  42870. "use strict";
  42871. /***/ }),
  42872. /***/ "./node_modules/webpack/buildin/module.js":
  42873. /*!***********************************!*\
  42874. !*** (webpack)/buildin/module.js ***!
  42875. \***********************************/
  42876. /*! no static exports found */
  42877. /***/ (function(module, exports, __webpack_require__) {
  42878. "use strict";
  42879. module.exports = function (module) {
  42880. if (!module.webpackPolyfill) {
  42881. module.deprecate = function () {};
  42882. module.paths = [];
  42883. // module.parent = undefined by default
  42884. if (!module.children) module.children = [];
  42885. Object.defineProperty(module, "loaded", {
  42886. enumerable: true,
  42887. get: function get() {
  42888. return module.l;
  42889. }
  42890. });
  42891. Object.defineProperty(module, "id", {
  42892. enumerable: true,
  42893. get: function get() {
  42894. return module.i;
  42895. }
  42896. });
  42897. module.webpackPolyfill = 1;
  42898. }
  42899. return module;
  42900. };
  42901. /***/ })
  42902. /******/ });
  42903. //# sourceMappingURL=ivprog.bundle.js.map